Frank Winter
2015-Jul-07 16:31 UTC
[LLVMdev] Dynamically loadable pass doesn't show up in opt's pass list
Hi All! I'd like to create a dynamically loadable version of the SLP vectorizer pass which should be named differently than the original (e.g. 'slp-mod'). (The reason for why I'd like this is that I need to modify the pass and I'd like a quick modify/build/test cycle.) I copied the file to a separate directory (SLPVectorizer.cpp -> my_pass/SLPMod.cpp), renamed the SLPVectorizer class to SLPMod and use the same pass registration as in the original pass: #define SV_NAME "slp-mod" #define DEBUG_TYPE "SLPMod" static const char lv_name[] = "SLP Mod"; INITIALIZE_PASS_BEGIN(SLPMod, SV_NAME, lv_name, false, false) INITIALIZE_AG_DEPENDENCY(AliasAnalysis) INITIALIZE_AG_DEPENDENCY(TargetTransformInfo) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) INITIALIZE_PASS_DEPENDENCY(ScalarEvolution) INITIALIZE_PASS_DEPENDENCY(LoopSimplify) INITIALIZE_PASS_END(SLPMod, SV_NAME, lv_name, false, false) I got this to build and 'opt' seems to succeed in dynamically loading it. However, the pass is not callable with -slp-mod, nor does it show up in the pass list with -help. Is the way as above indicated correct for registration of a dynamically loadable pass? Thanks, Frank
Frank Winter
2015-Jul-07 17:55 UTC
[LLVMdev] Dynamically loadable pass doesn't show up in opt's pass list
For the record: Removing the pass interaction statements and adding the single pass registration worked for me (of course one has to provide a default constructor): char SLPMod::ID = 0; static RegisterPass<SLPMod> X(SV_NAME, "SLPMod"); #if 0 static const char lv_name[] = "SLP Mod"; INITIALIZE_PASS_BEGIN(SLPMod, SV_NAME, lv_name, false, false) INITIALIZE_AG_DEPENDENCY(AliasAnalysis) INITIALIZE_AG_DEPENDENCY(TargetTransformInfo) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) INITIALIZE_PASS_DEPENDENCY(ScalarEvolution) INITIALIZE_PASS_DEPENDENCY(LoopSimplify) INITIALIZE_PASS_END(SLPMod, SV_NAME, lv_name, false, false) #endif Strange! I thought that was so important. Frank On 07/07/2015 12:31 PM, Frank Winter wrote:> Hi All! > > I'd like to create a dynamically loadable version of the SLP > vectorizer pass which should be named differently than the original > (e.g. 'slp-mod'). (The reason for why I'd like this is that I need to > modify the pass and I'd like a quick modify/build/test cycle.) > > I copied the file to a separate directory (SLPVectorizer.cpp -> > my_pass/SLPMod.cpp), renamed the SLPVectorizer class to SLPMod and use > the same pass registration as in the original pass: > > #define SV_NAME "slp-mod" > #define DEBUG_TYPE "SLPMod" > > static const char lv_name[] = "SLP Mod"; > INITIALIZE_PASS_BEGIN(SLPMod, SV_NAME, lv_name, false, false) > INITIALIZE_AG_DEPENDENCY(AliasAnalysis) > INITIALIZE_AG_DEPENDENCY(TargetTransformInfo) > INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) > INITIALIZE_PASS_DEPENDENCY(ScalarEvolution) > INITIALIZE_PASS_DEPENDENCY(LoopSimplify) > INITIALIZE_PASS_END(SLPMod, SV_NAME, lv_name, false, false) > > I got this to build and 'opt' seems to succeed in dynamically loading > it. However, the pass is not callable with -slp-mod, nor does it show > up in the pass list with -help. > > Is the way as above indicated correct for registration of a > dynamically loadable pass? > > Thanks, > Frank > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev