Displaying 2 results from an estimated 2 matches for "thebasicblock".
2012 Sep 19
3
[LLVMdev] newbie question on getelementptr
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
2012 Sep 19
0
[LLVMdev] newbie question on getelementptr
Hi Óscar,
Thank you for your prompt reply. Unfortunately, I still need more guidance
as using the Demo page to generate C++ code didn't result in a global
variable being used.
Basically, I'm following your advice to use a LoadInst:
Value *v = new LoadInst(result, "", theBasicBlock);
Function *myfn = cast<Function>(v);
I was not sure how I could get a BasicBlock for the LoadInst, so I created
a dummy function (which was never called).
Casting was successful as myfn->getType()->dump() produced i32 (i32, i32)*.
However, I'm getting a "bus error" when...