[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX

Antony Yu swpenim at gmail.com
Sat Jun 22 07:36:15 PDT 2013


I write my pass in a mix way of NVPTXAllocaHoisting, NVPTXSplitBBatBar and
transforms/Hello.

The following is part of the codes:

in NVPTXTargetMachine.cpp

bool NVPTXPassConfig::addPreEmitPass()                                                                                                                
{
    addPass(createTest());   
    return false;
}     

in NVPTXTest.h

namespace llvm{
class NVPTXTest : public ModulePass
{
    void getAnalysisUsage(AnalysisUsage &AU) const {       
AU.setPreservesAll();   }                                                                                                                                                                                                                                           
};
extern ModulePass *createTest();
}

in NVPTXTest.cpp

namespace llvm
{                                                                                                                                                      
char NVPTXTest::ID = 0;
static RegisterPass<NVPTXTest> X("test", "Test Module Pass");
ModulePass *createTest() {    return new NVPTXTest();  }
}

Thanks
Antony Yu




--
View this message in context: http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58752.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list