Hi Erdem, 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 ( http://llvm.org/docs/doxygen/html/classllvm_1_1TargetPassConfig.html) to enable your pass. You can check out the existing MachineFunction passes (e.g. X86ExpandPseudo.cpp) to get an idea. Volkan On Sat, Oct 3, 2015 at 7:21 AM Erdem Derebaşoğlu < erdemderebasoglu at hotmail.com> wrote:> I wrote the pass but when I try to build LLVM, I get this error: > "/home/erdem/llvm/lib/CodeGen/CodeGen.cpp:80: error: undefined reference > to 'llvm::initializeNoopInserterPass(llvm::PassRegistry&). > I need to modify Passes.h, InitializePasses.h, and Codegen.cpp files to > register my pass, right? > > Erdem > ------------------------------ > From: erdemderebasoglu at hotmail.com > To: vlknkls at gmail.com; llvm-dev at lists.llvm.org > Subject: RE: [llvm-dev] How to add NOP? > Date: Thu, 17 Sep 2015 16:38:36 +0300 > > > This seems to be what I am looking for. That was very helpful. Thank you. > > Erdem > > ------------------------------ > From: vlknkls at gmail.com > Date: Wed, 16 Sep 2015 16:25:29 +0000 > Subject: Re: [llvm-dev] How to add NOP? > To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org > > Use MachineInstr::memoperands() function to get memory operands then you > can get the address space by using MachineMemOperand::getAddrSpace(). > > Volkan > > On Tue, Sep 15, 2015 at 11:40 PM Erdem Derebaşoğlu < > erdemderebasoglu at hotmail.com> wrote: > > Thanks for the response. How can I find out if an instruction uses a > private memory access? > > Erdem > ------------------------------ > From: vlknkls at gmail.com > Date: Tue, 15 Sep 2015 14:38:16 +0000 > Subject: Re: [llvm-dev] How to add NOP? > To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org > > > Hi Erdem, > > 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. > > Volkan > > On Tue, Sep 15, 2015 at 4:16 AM Erdem Derebaşoğlu <llvm-dev at lists.llvm.org> > wrote: > > 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. > 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? > > Thanks. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151004/6031ad05/attachment.html>
Thanks. I enabled my pass. I have one resolved issue though: MachineMemOperand::getAddrSpace() always returns zero. How can I use it to distinguish private memory accesses? Erdem From: vlknkls at gmail.com Date: Sun, 4 Oct 2015 01:51:29 +0000 Subject: Re: [llvm-dev] How to add NOP? To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org Hi Erdem, 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 (http://llvm.org/docs/doxygen/html/classllvm_1_1TargetPassConfig.html) to enable your pass. You can check out the existing MachineFunction passes (e.g. X86ExpandPseudo.cpp) to get an idea. Volkan On Sat, Oct 3, 2015 at 7:21 AM Erdem Derebaşoğlu <erdemderebasoglu at hotmail.com> wrote: I wrote the pass but when I try to build LLVM, I get this error: "/home/erdem/llvm/lib/CodeGen/CodeGen.cpp:80: error: undefined reference to 'llvm::initializeNoopInserterPass(llvm::PassRegistry&). I need to modify Passes.h, InitializePasses.h, and Codegen.cpp files to register my pass, right? Erdem From: erdemderebasoglu at hotmail.com To: vlknkls at gmail.com; llvm-dev at lists.llvm.org Subject: RE: [llvm-dev] How to add NOP? Date: Thu, 17 Sep 2015 16:38:36 +0300 This seems to be what I am looking for. That was very helpful. Thank you. Erdem From: vlknkls at gmail.com Date: Wed, 16 Sep 2015 16:25:29 +0000 Subject: Re: [llvm-dev] How to add NOP? To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org Use MachineInstr::memoperands() function to get memory operands then you can get the address space by using MachineMemOperand::getAddrSpace(). Volkan On Tue, Sep 15, 2015 at 11:40 PM Erdem Derebaşoğlu <erdemderebasoglu at hotmail.com> wrote: Thanks for the response. How can I find out if an instruction uses a private memory access? Erdem From: vlknkls at gmail.com Date: Tue, 15 Sep 2015 14:38:16 +0000 Subject: Re: [llvm-dev] How to add NOP? To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org Hi Erdem, 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. Volkan On Tue, Sep 15, 2015 at 4:16 AM Erdem Derebaşoğlu <llvm-dev at lists.llvm.org> wrote: 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.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? Thanks. _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151008/6b1ba5ee/attachment.html>
Can you send the IR you are using? Volkan On Thu, Oct 8, 2015 at 6:28 AM Erdem Derebaşoğlu < erdemderebasoglu at hotmail.com> wrote:> Thanks. I enabled my pass. I have one resolved issue though: > MachineMemOperand::getAddrSpace() always returns zero. How can I use it to > distinguish private memory accesses? > > Erdem > > ------------------------------ > From: vlknkls at gmail.com > Date: Sun, 4 Oct 2015 01:51:29 +0000 > > Subject: Re: [llvm-dev] How to add NOP? > To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org > > Hi Erdem, > > 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 ( > http://llvm.org/docs/doxygen/html/classllvm_1_1TargetPassConfig.html) to > enable your pass. > > You can check out the existing MachineFunction passes > (e.g. X86ExpandPseudo.cpp) to get an idea. > > Volkan > > On Sat, Oct 3, 2015 at 7:21 AM Erdem Derebaşoğlu < > erdemderebasoglu at hotmail.com> wrote: > > I wrote the pass but when I try to build LLVM, I get this error: > "/home/erdem/llvm/lib/CodeGen/CodeGen.cpp:80: error: undefined reference > to 'llvm::initializeNoopInserterPass(llvm::PassRegistry&). > I need to modify Passes.h, InitializePasses.h, and Codegen.cpp files to > register my pass, right? > > Erdem > ------------------------------ > From: erdemderebasoglu at hotmail.com > To: vlknkls at gmail.com; llvm-dev at lists.llvm.org > Subject: RE: [llvm-dev] How to add NOP? > Date: Thu, 17 Sep 2015 16:38:36 +0300 > > > This seems to be what I am looking for. That was very helpful. Thank you. > > Erdem > > ------------------------------ > From: vlknkls at gmail.com > Date: Wed, 16 Sep 2015 16:25:29 +0000 > Subject: Re: [llvm-dev] How to add NOP? > To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org > > Use MachineInstr::memoperands() function to get memory operands then you > can get the address space by using MachineMemOperand::getAddrSpace(). > > Volkan > > On Tue, Sep 15, 2015 at 11:40 PM Erdem Derebaşoğlu < > erdemderebasoglu at hotmail.com> wrote: > > Thanks for the response. How can I find out if an instruction uses a > private memory access? > > Erdem > ------------------------------ > From: vlknkls at gmail.com > Date: Tue, 15 Sep 2015 14:38:16 +0000 > Subject: Re: [llvm-dev] How to add NOP? > To: erdemderebasoglu at hotmail.com; llvm-dev at lists.llvm.org > > > Hi Erdem, > > 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. > > Volkan > > On Tue, Sep 15, 2015 at 4:16 AM Erdem Derebaşoğlu <llvm-dev at lists.llvm.org> > wrote: > > 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. > 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? > > Thanks. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151011/d716779e/attachment.html>