[LLVMdev] Accessing constant indexes in GetElementPtr

Wojciech Stryjewski stryjews at uiuc.edu
Sun Sep 22 23:55:00 PDT 2002


Ok. Let's say I have a GetElementPtrInst that is used to access structure
elements. In this case the indexes will be constants and I want to get the
constant values as an a native C int.

Now I can iterate over all the indexes with idx_begin(). I can cast
all of the indexes to a ConstantIntegral. However, I cannot cast the
indexes to a ConstantSInt or ConstantUInt (cast<> throws an assertion) and
these two classes are the ones that have the getValue() method I need.

Am I missing something here?

Wojciech




More information about the llvm-dev mailing list