[LLVMdev] Dynamically loadable pass doesn't show up in opt's pass list

Frank Winter fwinter at jlab.org
Tue Jul 7 09:31:26 PDT 2015


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







More information about the llvm-dev mailing list