[LLVMdev] global constant next to function in generated binary

David Terei davidterei at gmail.com
Thu Oct 1 21:05:22 PDT 2009


Hi all,

I was wondering if it is somehow possible to get llvm to generate code
such that you can enforce a relationship where a global constant and a
function are adjacent to each other in the binary. I want to do this
as its an optimisation technique used by the compiler I'm working on
(ghc). The global constant is a so called 'info table' which stores
information about the function needed by the run time system. The
unoptimised layout is to have the info table store a pointer to the
code it is tied to but this increases the size of the info table and
also requires two indirect jumps to get to the code. Having the table
and code adjacent as in the optimised layout allows access to both
through just one pointer using the correct offsets, reducing the info
table and number of indirect jumps required to access the function.

If this isn't possible currently in LLVM where would llvm need to be
changed to implement this and would this be something the llvm devs
would be happy to accept patches for?

Cheers,
David



More information about the llvm-dev mailing list