[LLVMdev] ConstantExpr Evaluation
baldrick at free.fr
Thu Oct 27 12:06:12 PDT 2011
> What I'm currently working on is a translation from LLVM IR to a
> register transfer list format used in VPO.
> If my understanding of ConstantExpr is correct, that they can be
> evaluated at compile-time,
that's not so, because they may (for example) involve the address of a global
variable or other label, which is not known at compile time.
how can I simply have them be evaluated but
> have the code still remain in IR format?
> For example, in:
> store i32 1, i32* getelementptr [6 x i32]* @arr, i32 0, i32 0
> the getelementptr ConstantExpr can be evaluated at compile-time, so is
> there a way to run a pass and end up with something like:
> store i32 1, i32* ???
> where ??? is not another ConstantExpr, but rather a ConstantInt or similar.
It can't be, since the address @arr is not known at compile time.
More information about the llvm-dev