<div dir="ltr"><div>Hi Erdem,</div><div><br></div>Since it is a target specific pass, you should put your pass inside the target's folder (e.g. lib/Target/X86/) and declare your pass in Target.h. Then you need to modify the target's TargetPassConfig (<a href="http://llvm.org/docs/doxygen/html/classllvm_1_1TargetPassConfig.html">http://llvm.org/docs/doxygen/html/classllvm_1_1TargetPassConfig.html</a>) to enable your pass.<div><br></div><div>You can check out the existing MachineFunction passes (e.g. X86ExpandPseudo.cpp) to get an idea.</div><div><br></div><div>Volkan</div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Oct 3, 2015 at 7:21 AM Erdem Derebaşoğlu <<a href="mailto:erdemderebasoglu@hotmail.com">erdemderebasoglu@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr"><span style="color:rgb(68,68,68);font-family:Calibri;line-height:22.7199993133545px;background-color:rgb(255,255,255)">I wrote the pass but when I try to build LLVM, I get this error: </span><div><span style="color:rgb(68,68,68);font-size:15px;line-height:21.2999992370605px;background-color:rgb(255,255,255)">"/home/erdem/llvm/lib/CodeGen/CodeGen.cpp:80: error: undefined reference to 'llvm::initializeNoopInserterPass(llvm::PassRegistry&)</span><span style="color:rgb(68,68,68);font-family:Calibri;line-height:22.7199993133545px;background-color:rgb(255,255,255)">. </span></div><div><span style="color:rgb(68,68,68);font-family:Calibri;line-height:22.7199993133545px;background-color:rgb(255,255,255)">I need to modify Passes.h, InitializePasses.h, and Codegen.cpp files to register my pass, right?</span><div><font color="#444444" face="Calibri"><span style="line-height:22.7199993133545px"><br></span></font></div><div></div></div></div></div><div><div dir="ltr"><div><div><font color="#444444" face="Calibri"><span style="line-height:22.7199993133545px">Erdem<br></span></font></div></div></div></div><div><div dir="ltr"><div><div><div><hr>From: <a href="mailto:erdemderebasoglu@hotmail.com" target="_blank">erdemderebasoglu@hotmail.com</a><br>To: <a href="mailto:vlknkls@gmail.com" target="_blank">vlknkls@gmail.com</a>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>Subject: RE: [llvm-dev] How to add NOP?<br>Date: Thu, 17 Sep 2015 16:38:36 +0300</div></div></div></div></div><div><div dir="ltr"><div><div><div><br><br>


<div dir="ltr">This seems to be what I am looking for. That was very helpful. Thank you.<div><br></div><div>Erdem<br><br><div><hr>From: <a href="mailto:vlknkls@gmail.com" target="_blank">vlknkls@gmail.com</a><br>Date: Wed, 16 Sep 2015 16:25:29 +0000<br>Subject: Re: [llvm-dev] How to add NOP?<br>To: <a href="mailto:erdemderebasoglu@hotmail.com" target="_blank">erdemderebasoglu@hotmail.com</a>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><br><div dir="ltr">Use MachineInstr::memoperands() function to get memory operands then you can get the address space by using MachineMemOperand::getAddrSpace().<div><br></div><div>Volkan<br><br><div><div dir="ltr">On Tue, Sep 15, 2015 at 11:40 PM Erdem Derebaşoğlu <<a href="mailto:erdemderebasoglu@hotmail.com" target="_blank">erdemderebasoglu@hotmail.com</a>> wrote:<br></div><blockquote style="border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">Thanks for the response. How can I find out if an instruction uses a private memory access?<div><br></div><div></div></div></div><div><div dir="ltr"><div>Erdem<br></div></div></div><div><div dir="ltr"><div><div><hr>From: <a href="mailto:vlknkls@gmail.com" target="_blank">vlknkls@gmail.com</a><br>Date: Tue, 15 Sep 2015 14:38:16 +0000<br>Subject: Re: [llvm-dev] How to add NOP?<br>To: <a href="mailto:erdemderebasoglu@hotmail.com" target="_blank">erdemderebasoglu@hotmail.com</a>; <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a></div></div></div></div><div><div dir="ltr"><div><div><br><br><div style="white-space:pre-wrap">Hi Erdem,<br><br>I would write a MachineFunction pass. You can check each load instruction to see if it is a private memory access and insert what you want by using BuildMI(...) function.<br><br>Volkan</div><br><div><div dir="ltr">On Tue, Sep 15, 2015 at 4:16 AM Erdem Derebaşoğlu <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote style="border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">I would like to convert a C file that uses OpenMP library to X86 code with a condition: I want to insert a NOP before each instruction that does a private memory access.<div>I have written an optimization pass that inserts an inline assembly call (NOP) but it is applied at IR level, and I cannot determine where to insert it. How can I use LLVM to add NOPs accordingly?</div><div><br></div><div>Thanks.</div>                                     </div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div></div></div></div></blockquote></div></div></div></div></div>                                    </div></div></div></div></div></div></blockquote></div>