[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
Antony Yu
swpenim at gmail.com
Mon Jun 24 08:20:05 PDT 2013
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.
More information about the llvm-dev
mailing list