[LLVMdev] GetElementPtrInst question

Eduardo erocha.ssa at gmail.com
Sun Dec 2 08:26:11 PST 2012


Hi James,

Thanks for your quick reply.

> I assume because you asked this question, something went wrong when using the above method. What was it? :)

No, I am not using this method. I was trying to create a
llvm::GetElementPtrInst . I didn't create IRBuilder. I am writing a
ModulePass that insert new instruction to an existing Module.

Besides, how can you get a reference to myreg1 ? Looking at your
snippet this variable would be a llvm::Value* (I saw that in the
documentation of IRBuilder). All I have in my code is something like:

  llvm::LoadInst *inst2 = new llvm::LoadInst( oneGlobalVariable,
"myreg1", inst1);

Probably I can get a Value pointer to the output register from the
inst2 variable, but I don't know how (I couldn't figure out myself by
just reading the documentation).

Any help is very welcome,
Eduardo



More information about the llvm-dev mailing list