Ananth Durbha <avdurbha at yahoo.com> writes:
> The getInitializer() method of a GlobalVariable returns 4 pointers like
below.
>
>
> [4 x i32*] [i32* getelementptr inbounds ([256 x i32]* @CRC24ATable,
> i32 0, i32 0), i32* getelementptr inbounds ([256 x i32]* @CRC24BTable,
> i32 0, i32 0), i32* getelementptr inbounds ([256 x i32]* @CRC16Table,
> i32 0, i32 0), i32* getelementptr inbounds ([256 x
>
> i32]* @CRC8Table, i32 0, i32 0)]
>
>
> I can use getAggregateElement(uint) to access each of the 4 elements
> (pointers). But I am not able to figure out how to cast the element so
> that I can then access each of the GEP expressions and its operands.
> I tried dyn_cast return value of getAggregateElement(uint) into Instruction
type -
> but that didn't yield a non-null conversion.
The getelementptr there is not an instruction, but a constant
expression, which derives from Value. See
http://www.llvm.org/docs/LangRef.html#constant-expressions
and
http://llvm.org/docs/doxygen/html/classllvm_1_1GetElementPtrConstantExpr.html