[LLVMdev] Reading Static Values

Eli Friedman eli.friedman at gmail.com
Sat Sep 24 12:55:43 PDT 2011


On Sat, Sep 24, 2011 at 12:21 PM,  <bdavis at cs.fsu.edu> wrote:
> Hi,
>
> I'm currently trying to translate LLVM IR language to VPO .dec file
> specification. I'm using LLVM source parser in the same way that it is
> used in tools llc or llvm-as. One issue I'm having is I cannot find
> any static values. For example, in a global declaration i.e. '@a =
> global i32 7, align 4' I cannot get '7' from the parsed structure.

llvm::GlobalVariable::getInitializer()?

> Similarly (sort of), once I'm looking at a parsed Function, and I go
> into a BasicBlock, and get say and add Instruction, and I get its
> operands, I can't get static values. If for example the Instruction
> was '%add = add i32 %tmp, 60', I can get the name of value 'tmp' which
> is enough, but I can't get the value '60'.

60 is an llvm::ConstantInt.

If you're still having trouble, feel free to ask more questions.

-Eli



More information about the llvm-dev mailing list