[llvm-dev] How to include a opt pass in clang driver
Soham Sinha via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 25 14:03:41 PDT 2018
Hi Eli,
I have tried that:
static void registerMyPass(const PassManagerBuilder &,
llvm::legacy::PassManagerBase &PM) {
PM.add(new MyPass());
}
static RegisterStandardPasses
RegisterMyPass(PassManagerBuilder::EP_OptimizerLast,
registerMyPass);
It still couldn't find my pass.
Regards,
Soham Sinha
PhD Student, Department of Computer Science
Boston University
On Mon, Jun 25, 2018 at 3:58 PM Friedman, Eli <efriedma at codeaurora.org>
wrote:
> On 6/25/2018 1:38 PM, Soham Sinha via llvm-dev wrote:
> > Hello,
> >
> > I have written a pass for the IR and I can run it with opt -load
> > lib/LLVMMyPass.so -mypass -myarguments -S -o output.ll < output.bc
> >
> > I have registered my pass with the following code:
> > static RegisterPass<MyPass>
> > X("mypass", "MyPass Pass (with getAnalysisUsage implemented)");
> >
> > How do I include the same pass in the clang driver. I tried running
> > the pass:
> >
> > clang output.c -o output -Xclang -load -Xclang lib/LLVMMyPass.so
> > -mypass -myarguments
> >
> > However, the pass is not being run as I cannot see output from my
> > pass. What is the standard way to do it?
>
> See RegisterStandardPasses in llvm/Transforms/IPO/PassManagerBuilder.h .
>
> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180625/989f3255/attachment.html>
More information about the llvm-dev
mailing list