[LLVMdev] Is there a path from MachineInstr to the associated Instruction
Qingan Li
ww345ww at gmail.com
Mon Nov 17 19:02:39 PST 2014
Hi John,
Thanks so much!
I have checked the BasicBlock. However, there may be multiple call sites in
one basic block, so it cannot guarantee correctness.
Finally, I chose to add the CallInst into VDNode during DAG construction,
and then add the CallInst into MachineInstr during instruction selection.
Thanks all the same!
Best regards,
Li Qingan
2014-11-17 1:44 GMT+08:00 John Criswell <jtcriswel at gmail.com>:
> On 11/14/14, 6:53 AM, Qingan Li wrote:
>
> Hi,
>
> Recently, I am working on some information collection on the machine
> instruction (MachineInstr) level.
> But, sometimes, I need check the corresponding IR level instruction of the
> a machine instruction.
>
> When visiting a machine instruction which is a call
> (MachineInstr::isCall()), I need to check the arguments of this call site.
> I know that the CallSite class provides good facility for this work, but
> the CallSite can be constructed only fromInstruction rather than
> MachineInstr.
>
> Is there any workaround?
>
>
> If you're working on MachineInstr's, then you can probably examine the
> MachineIntr's operands to determine which function is being called. This
> probably won't be target independent, but if you're working at the
> MachineInstr level, you're not doing target independent work, anyway.
>
> Alternatively, you should check to see if the MachineBasicBlock has a
> method to fetch the BasicBlock from which it was generated. Using that,
> you could potentially scan the BasicBlock looking for a CallInst or
> InvokeInst that is likely to match the MachineInstr.
>
> Regards,
>
> John Criswell
>
>
> Thanks.
>
> --
> Best regards,
>
> Li Qingan
>
>
> _______________________________________________
> LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> --
> John Criswell
> Assistant Professor
> Department of Computer Science, University of Rochesterhttp://www.cs.rochester.edu/u/criswell
>
>
--
Best regards,
Li Qingan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141118/f74df6ba/attachment.html>
More information about the llvm-dev
mailing list