[LLVMdev] Disjoint types after reading several modules

Clemens Hammacher hammacher at cs.uni-saarland.de
Thu Feb 2 04:30:03 PST 2012


Hi Chris,
thanks for your answer!

On 2/2/12 1:15 AM, Chris Lattner wrote:
> The linker has to solve the exact same problem (read multiple .bc files and unify types across them).  This is the impetus behind TypeMapTy in lib/Linker/LinkModules.cpp.  You'll probably need to do something like that.

I already looked into that. The linker is using the GlobalValues of both 
modules to identify the types to unify.
This leads to interesting effects in some cases, but I'll write another 
post about this.

Nevertheless the TypeMapTy is a great piece of code, and we will 
definitely reuse it to remap duplicated types (and composed types) to 
unique ones (via mutateType(), recursively descending to all uses).

> I have to ask: why are you writing these modules out as separate bc files?

I knew that someone would ask that ;)
We need to have separate modules during runtime. One of them contains 
the code that is actually JIT compiled and executed, and simultaneously 
different optimizations are concurrently (in individual threads) 
building up or restructuring new code in their individual "working 
modules". Eventually some code will get copied over to the main module 
to be executed, and that's why they need to use the same types.

Cheers,
Clemens

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6392 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120202/7d96d23a/attachment.bin>


More information about the llvm-dev mailing list