[LLVMdev] sharing of constants across modules allowed?

Frits van Bommel fvbommel at gmail.com
Sun Mar 6 10:53:09 PST 2011


On Sun, Mar 6, 2011 at 7:45 PM, Jochen Wilhelmy <j.wilhelmy at arcor.de> wrote:
> is it allowed to create a constant and use it as operand for
> instructions in differend modules (but same context)?

As long as it doesn't contain any references to global values
(functions, global variables & constants and aliases), yes.

For example: 'i32 0' is fine, as is 'i8* inttoptr (i32 1234 to i8*)',
but not 'i32(i8*, ...)* @printf'.
Basically, if it contains an '@' (i.e. anything with a named memory
address) anywhere then it's not allowed, otherwise it's fine.



More information about the llvm-dev mailing list