[LLVMdev] Disjoint types after reading several modules
hammacher at cs.uni-saarland.de
Thu Feb 2 04:30:03 PST 2012
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6392 bytes
Desc: S/MIME Cryptographic Signature
More information about the llvm-dev