Thanks for your last reply.
Could I understand the way to adding a pass (built into the llvm rather than dynamic loadable) includes:
- Declaring a creator function for this pass
- Implementing the creator function for this pass
- Instantiating this pass and get a object of it
- Register this pass into the PassRegistry
Then, for a built-into bytecode pass,
task 1(declaration of the creator) should be done in Scalar.h;
task 2(implementation of the creator) should be done the related mypass.cpp file;
task 3(instantiation of the pass class) should be done in LinkAllPasses.h;
task 4(registration of the pass into the PassRegistry) should be done by INITIALIZE_PASS
class LiveVariables : public MachineFunctionPass is a case of point.
For a built-into codegen/MachineCode pass,
task 1 should be done in Passes.h;
task 2 should be done in the related mypass.cpp file;
task 3 should be done in LLVMTargetMachine.cpp
task 4 should be done by INITIALIZE_PASS
class IntervalAnalylsis: public MachineFunctionPass is a case in point.
I have implemented a new mypass (just for analysis, rather than transformation) as a subclass of MchineFunctionPass, and finished task 1, 2, 4. But I don’t know how to finish task 3, since I failed to make clear how the class IntervalAnalysis did task 3. So I need your help.