[LLVMdev] GetElementPtrInst question

James Molloy James.Molloy at arm.com
Sun Dec 2 08:01:47 PST 2012


Hi,

You'd use an IRBuilder, like you did to create your LoadInsts.

IRBuilder<> IRB(BB);
IRB.CreateGEP(myreg1, myreg2);

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

Cheers,

James
________________________________________
From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] On Behalf Of Eduardo [erocha.ssa at gmail.com]
Sent: 02 December 2012 15:37
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] GetElementPtrInst question

Hi all,

How can I create an llvm::GetElementPtrInst in which the pointer and
the index are in registers previously loaded with llvm::LoadInst ? I
mean, the generated instruction will be like this:

  %1 = getelementptr i8* %myreg1, i32 %myreg2

here, %myreg1 and %myreg2 are previously created by load instructions
(llvm::LoadInst).

Please, let me know if there is an example of something similar.

Thanks for the help,
Eduardo
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev






More information about the llvm-dev mailing list