diff --git a/llvm/lib/Target/AVR/AVR.h b/llvm/lib/Target/AVR/AVR.h --- a/llvm/lib/Target/AVR/AVR.h +++ b/llvm/lib/Target/AVR/AVR.h @@ -31,6 +31,7 @@ FunctionPass *createAVRFrameAnalyzerPass(); FunctionPass *createAVRBranchSelectionPass(); +void initializeAVRDAGToDAGISelPass(PassRegistry &); void initializeAVRShiftExpandPass(PassRegistry &); void initializeAVRExpandPseudoPass(PassRegistry &); diff --git a/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp b/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp --- a/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp +++ b/llvm/lib/Target/AVR/AVRISelDAGToDAG.cpp @@ -26,8 +26,9 @@ /// Lowers LLVM IR (in DAG form) to AVR MC instructions (in DAG form). class AVRDAGToDAGISel : public SelectionDAGISel { public: - AVRDAGToDAGISel(AVRTargetMachine &TM, CodeGenOpt::Level OptLevel) - : SelectionDAGISel(TM, OptLevel), Subtarget(nullptr) {} + explicit AVRDAGToDAGISel(AVRTargetMachine *TM = nullptr, + CodeGenOpt::Level OptLevel = CodeGenOpt::Default) + : SelectionDAGISel(*TM, OptLevel), Subtarget(nullptr) {} StringRef getPassName() const override { return "AVR DAG->DAG Instruction Selection"; @@ -577,7 +578,12 @@ FunctionPass *createAVRISelDag(AVRTargetMachine &TM, CodeGenOpt::Level OptLevel) { - return new AVRDAGToDAGISel(TM, OptLevel); + return new AVRDAGToDAGISel(&TM, OptLevel); } } // end of namespace llvm + +using namespace llvm; + +INITIALIZE_PASS(AVRDAGToDAGISel, "avr-isel", + "AVR DAG->DAG Instruction Selection", false, false) diff --git a/llvm/lib/Target/AVR/AVRTargetMachine.cpp b/llvm/lib/Target/AVR/AVRTargetMachine.cpp --- a/llvm/lib/Target/AVR/AVRTargetMachine.cpp +++ b/llvm/lib/Target/AVR/AVRTargetMachine.cpp @@ -93,6 +93,7 @@ RegisterTargetMachine X(getTheAVRTarget()); auto &PR = *PassRegistry::getPassRegistry(); + initializeAVRDAGToDAGISelPass(PR); initializeAVRExpandPseudoPass(PR); initializeAVRShiftExpandPass(PR); }