[llvm-dev] llvm pass

Varun Patil via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 28 04:09:38 PST 2016


I want to insert new alloca Instruction after existing alloca Instruction
in llvm pass so what attribute to be passed at last in following
newallocaI =  new AllocaInst(llvm::Type::getInt32PtrTy(context,0), //type
                                                0, // ArraySize
                                                8, // Alignment
                                                "p", // const
<http://llvm.org/docs/doxygen/html/AArch64PromoteConstant_8cpp.html#a90f8350fecae261c25be85d38b451bff>
Twine <http://llvm.org/docs/doxygen/html/classllvm_1_1Twine.html> Name
<http://llvm.org/docs/doxygen/html/SymbolizableObjectFile_8cpp.html#ab104eb44fb0574709f0ceb43b50bdb63>
                                                allocaI);  // InsertBefore
Presently I am passing previous allocaInstr Poiter as last argument as i
shown above So New allocaInstr is inserting before previous allocaInstr in
LLVM IR as follows output

 %p1 = alloca i32*, align 8 // New Alloca Instrctions
 %b = alloca i32, align 4   // previous Alloca Instrctions

how can I get output like below
 %b = alloca i32, align 4   // previous Alloca Instrctions
 %p1 = alloca i32*, align 8 // New Alloca Instrctions

Please help me to the needful Thank you

Thanks and Regards
Varun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161228/de221f2a/attachment.html>


More information about the llvm-dev mailing list