[LLVMdev] newbie question on getelementptr

Jay Gelisah jay.gelisah at gmail.com
Tue Sep 18 21:52:47 PDT 2012

Hi All,

I'm new to LLVM and I'm having a coding problem.

I'm creating a GlobalVariable that contains a StructType that contains a
Function. The function returns i32 and takes two i32's.

Here is my code:
GlobalVariable* retrieved = module->getGlobalVariable("myGV");
Constant* result = ConstantExpr::getGetElementPtr(retrieved, indices);

How do I get my Function back from the Constant* result? I'd like to be
able to run the function.

result->dump() shows the following:
i32 (i32, i32)** getelementptr inbounds (%myStruct* @myGV, i32 0, i32 0)

Many thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120919/4043bafc/attachment.html>

More information about the llvm-dev mailing list