]> granicus.if.org Git - llvm/commitdiff
[X86] Register and initialize the FixupBW pass.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 7 May 2016 01:11:10 +0000 (01:11 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 7 May 2016 01:11:10 +0000 (01:11 +0000)
That lets us use it in MIR tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268830 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86.h
lib/Target/X86/X86FixupBWInsts.cpp
lib/Target/X86/X86TargetMachine.cpp

index d16cc375e985288559c19bac05a1d181f709aef6..c12554c9b92be7405b0b98358aada84c9415ba06 100644 (file)
@@ -21,6 +21,7 @@ namespace llvm {
 
 class FunctionPass;
 class ImmutablePass;
+class PassRegistry;
 class X86TargetMachine;
 
 /// This pass converts a legalized DAG into a X86-specific DAG, ready for
@@ -78,6 +79,8 @@ FunctionPass *createX86ExpandPseudoPass();
 /// in order to eliminate partial register usage, false dependences on
 /// the upper portions of registers, and to save code size.
 FunctionPass *createX86FixupBWInsts();
+
+void initializeFixupBWInstPassPass(PassRegistry &);
 } // End llvm namespace
 
 #endif
index 045a4ed8dcae2c2bed4883c2fda94dcb2fe1ec75..ad152824c1827c14d8313fe58b0767e873c5e6f7 100644 (file)
 #include "llvm/Target/TargetInstrInfo.h"
 using namespace llvm;
 
-#define DEBUG_TYPE "x86-fixup-bw-insts"
+#define FIXUPBW_DESC "X86 Byte/Word Instruction Fixup"
+#define FIXUPBW_NAME "x86-fixup-bw-insts"
+
+#define DEBUG_TYPE FIXUPBW_NAME
 
 // Option to allow this optimization pass to have fine-grained control.
 // This is turned off by default so as not to affect a large number of
@@ -72,12 +75,6 @@ static cl::opt<bool>
 
 namespace {
 class FixupBWInstPass : public MachineFunctionPass {
-  static char ID;
-
-  const char *getPassName() const override {
-    return "X86 Byte/Word Instruction Fixup";
-  }
-
   /// Loop over all of the instructions in the basic block replacing applicable
   /// byte or word instructions with better alternatives.
   void processBasicBlock(MachineFunction &MF, MachineBasicBlock &MBB);
@@ -94,7 +91,15 @@ class FixupBWInstPass : public MachineFunctionPass {
   MachineInstr *tryReplaceLoad(unsigned New32BitOpcode, MachineInstr *MI) const;
 
 public:
-  FixupBWInstPass() : MachineFunctionPass(ID) {}
+  static char ID;
+
+  const char *getPassName() const override {
+    return FIXUPBW_DESC;
+  }
+
+  FixupBWInstPass() : MachineFunctionPass(ID) {
+    initializeFixupBWInstPassPass(*PassRegistry::getPassRegistry());
+  }
 
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     AU.addRequired<MachineLoopInfo>(); // Machine loop info is used to
@@ -130,6 +135,8 @@ private:
 char FixupBWInstPass::ID = 0;
 }
 
+INITIALIZE_PASS(FixupBWInstPass, FIXUPBW_NAME, FIXUPBW_DESC, false, false)
+
 FunctionPass *llvm::createX86FixupBWInsts() { return new FixupBWInstPass(); }
 
 bool FixupBWInstPass::runOnMachineFunction(MachineFunction &MF) {
index 397303003a9c4464c58fb8cfaee5555fb8ed42da..065389e91307167d3074aab18f41d922c8d67472 100644 (file)
@@ -39,6 +39,7 @@ extern "C" void LLVMInitializeX86Target() {
 
   PassRegistry &PR = *PassRegistry::getPassRegistry();
   initializeWinEHStatePassPass(PR);
+  initializeFixupBWInstPassPass(PR);
 }
 
 static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {