[LLVMdev] LLVM GHC Backend: Tables Next To Code

Gabor Greif ggreif at gmail.com
Thu Mar 15 02:30:48 PDT 2012


Chris said:

> I really like the idea of adding this as an inline asm blob at the start of a function, and biasing the actual address of the closure based on the size of the table.  I'm not 100% confident that it will work (not being very familiar with TNTC) but it seems quite plausible and the impact on LLVM would be quite reasonable (some new calling convention work?)

While reading this I had the idea that the LLVM code generator could
watch out for the specific combination of inline asm and calling
convention and strip off the fat. This way the code increase could be
dealt with. OTOH the inline asm would still need to be target
specific, which is very ugly. What about a new intrinsic which holds a
reference to the global and creates the right assembly in the backend?
Since the reference to the global (which is the table) would not be
used otherwise, the linker could drop it, thus no code increase and no
redundant global.

Does this make sense?

Cheers,

    Gabor




More information about the llvm-dev mailing list