[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
Justin Holewinski
justin.holewinski at gmail.com
Mon Jun 24 11:15:55 PDT 2013
Sorry for the delay. Yeah, that error message is a bit confusing. What's
happening is that your pass sequence is invalid. Once the IR has been
lowered to machine code, its too late to run LLVM IR passes (ModulePass,
FunctionPass, CallGraphSCCPass, etc.). At that point, you need to run a
Machine*Pass, e.g. MachineFunctionPass. If you need to run an IR level
pass, you need to use addIRPasses().
On Mon, Jun 24, 2013 at 11:20 AM, Antony Yu <swpenim at gmail.com> wrote:
> I try to use INITIALIZE_PASS instead of RegisterPass<> to register my pass,
> though I don't understand what's their difference and how it works because
> its documents doesn't exist. But it still doesn't work.
>
> Parts of my codes is as follows:
>
> in NVPTXTest.h
>
> namespace llvm {
>
> void initializeNVPTXTestPass(PassRegistry &r);
>
> class NVPTXTest : public ModulePass
> {
> public:
>
> NVPTXTest() : ModulePass(ID){
> initializeNVPTXTestPass(*PassRegistry::getPassRegistry());
> }
> void getAnalysisUsage(AnalysisUsage &AU) const {
> AU.setPreservesAll();
> ModulePass::getAnalysisUsage(AU);
> }
>
> };
>
> in NVPTXTest.cpp
>
> #include "NVPTXTest.h"
>
> namespace llvm
> {
> //static RegisterPass<NVPTXTest> X("test", "Test Module Pass");
> char NVPTXTest::ID = 0;
> ModulePass *createTest()
> {
> return new NVPTXTest();
> }
> }
> using namespace llvm;
>
> INITIALIZE_PASS(NVPTXTest, "test", "TestModule Pass", true, true);
> ====
> When I use the same way to write a CallGraphSCCPass, it still doesn't work,
> but this time it tells me that my CallGraphSCCPass is not initialized
> instead of 'NVPTX Assembly Printer'.
> It's really weird...
>
>
>
>
> --
> View this message in context:
> http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58770.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Thanks,
Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130624/b3ee415a/attachment.html>
More information about the llvm-dev
mailing list