Justin Holewinski
2013-Jun-24 18:15 UTC
[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
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>
Antony Yu
2013-Jun-25 07:35 UTC
[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
So that's how it is !! Thanks! Hmm, in fact, I want to get Call Graph information in machine code stage, is there any way to get this? I try CallGraph &g= getAnalysis<CallGraph>, but it prints the same error and doesn't work as expected. Antony Yu Justin Holewinski-2 wrote> 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(). > > -- > > Thanks, > > Justin Holewinski > > _______________________________________________ > LLVM Developers mailing list> LLVMdev at .uiuc> http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- View this message in context: http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58813.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Antony Yu
2013-Jun-25 15:09 UTC
[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
Oops! No need of Call Graph! In fact, what I want to do is to find which function is the kernel function and which function is called by that kernel. Since OpenCL will make all functions called by kernels inline, I can use function attribute: Noinline to distinguish them. Sorry for bothering you. Antony Yu -- View this message in context: http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58839.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Reasonably Related Threads
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX