Xiaoguang Wang
2014-Oct-30 20:13 UTC
[LLVMdev] Emit a jump instruction to a place inside basicblock
On Thu, Oct 30, 2014 at 2:33 PM, Robin Morisset <morisset at google.com> wrote:> Hi, > > From my understanding of the LLVM IR, it is impossible to jump to the > middle of a Basic Block, only to its beginning. But there is a > splitBasicBlock function that seems like it might be useful to you, to make > sure a basic block is starting at the exact place you want to jump. > > Best regards, > Robin >Thanks you all! I'm looking at splitBasicBlock and trying to use that. BTW, is there a way at lower level of LLVM that can implement this functionality? E.g. MCBasicBlock or MCInst? Sincerely, Xiaoguang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141030/78d378da/attachment.html>
Eric Christopher
2014-Oct-30 20:48 UTC
[LLVMdev] Emit a jump instruction to a place inside basicblock
On Thu Oct 30 2014 at 1:16:38 PM Xiaoguang Wang <xgwang09 at gmail.com> wrote:> On Thu, Oct 30, 2014 at 2:33 PM, Robin Morisset <morisset at google.com> > wrote: > >> Hi, >> >> From my understanding of the LLVM IR, it is impossible to jump to the >> middle of a Basic Block, only to its beginning. But there is a >> splitBasicBlock function that seems like it might be useful to you, to make >> sure a basic block is starting at the exact place you want to jump. >> >> Best regards, >> Robin >> > > Thanks you all! I'm looking at splitBasicBlock and trying to use that. > BTW, is there a way at lower level of LLVM that can implement this > functionality? E.g. MCBasicBlock or MCInst? > >You are unlikely to want to do this at the MC level, maybe the MI level. What are you trying to accomplish? -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141030/ffed0ca6/attachment.html>
Xiaoguang Wang
2014-Oct-30 21:01 UTC
[LLVMdev] Emit a jump instruction to a place inside basicblock
On Thu, Oct 30, 2014 at 4:48 PM, Eric Christopher <echristo at gmail.com> wrote:> > > On Thu Oct 30 2014 at 1:16:38 PM Xiaoguang Wang <xgwang09 at gmail.com> > wrote: > >> On Thu, Oct 30, 2014 at 2:33 PM, Robin Morisset <morisset at google.com> >> wrote: >> >>> Hi, >>> >>> From my understanding of the LLVM IR, it is impossible to jump to the >>> middle of a Basic Block, only to its beginning. But there is a >>> splitBasicBlock function that seems like it might be useful to you, to make >>> sure a basic block is starting at the exact place you want to jump. >>> >>> Best regards, >>> Robin >>> >> >> Thanks you all! I'm looking at splitBasicBlock and trying to use that. >> BTW, is there a way at lower level of LLVM that can implement this >> functionality? E.g. MCBasicBlock or MCInst? >> >> > You are unlikely to want to do this at the MC level, maybe the MI level. > What are you trying to accomplish? > > -eric >Thanks for the answer. I want to construct a table which can jump to the address after a call instruction. And replace the call/ret instructions with that indirection table. So to protect return address on stack. Sincerely, Xiaoguang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141030/15105541/attachment.html>
Maybe Matching Threads
- [LLVMdev] Emit a jump instruction to a place inside basicblock
- [LLVMdev] Emit a jump instruction to a place inside basicblock
- [LLVMdev] Plan to optimize atomics in LLVM
- [LLVMdev] LICM promoting memory to scalar
- Problems in starting up domU with Xen-ARM (on Cortex-A15 Fast Models)