[LLVMdev] constpool

reed kotler rkotler at mips.com
Mon Jul 28 15:26:08 PDT 2014


Does anyone know how LLVM decides what goes in the constant pool?

For example:

const int i = 10; // does not go in the constant pool, even if &i is present

whereas:

const  char * hello = "hello"; // the string "hello" does go into the 
constant pool

For fast-isel, I am seeing the high level clang IR and I need to emit a 
different load sequence to get the
address of a normal variable as opposed to something in the constant 
pool (.rdata).

it makes a difference for Mips because some objects, constant string for 
example, are accessed
in a special way, apparanently to avoid using an extra GOT entry to 
access them.

The GOT entry for the constant data (.rdata) section for that module is 
used and the address of the string relative
to the .rdata reference is added to it.


TIA.

Reed



More information about the llvm-dev mailing list