Proper patterns for thumb2 shift and rotate instructions.
[oota-llvm.git] / lib / Target / Sparc / FPMover.cpp
index ca70a9ceb41cc95e8081974ddb64426fd41da274..f72a4c4645c15c89dfb957c69fc632c91076aed6 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -32,9 +32,9 @@ namespace {
     ///
     TargetMachine &TM;
     
-    static const char ID;
-    FPMover(TargetMachine &tm) 
-      : MachineFunctionPass((intptr_t)&ID), TM(tm) { }
+    static char ID;
+    explicit FPMover(TargetMachine &tm) 
+      : MachineFunctionPass(&ID), TM(tm) { }
 
     virtual const char *getPassName() const {
       return "Sparc Double-FP Move Fixer";
@@ -43,7 +43,7 @@ namespace {
     bool runOnMachineBasicBlock(MachineBasicBlock &MBB);
     bool runOnMachineFunction(MachineFunction &F);
   };
-  const char FPMover::ID = 0;
+  char FPMover::ID = 0;
 } // end of anonymous namespace
 
 /// createSparcFPMoverPass - Returns a pass that turns FpMOVD
@@ -84,6 +84,7 @@ bool FPMover::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
   bool Changed = false;
   for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ) {
     MachineInstr *MI = I++;
+    DebugLoc dl = MI->getDebugLoc();
     if (MI->getOpcode() == SP::FpMOVD || MI->getOpcode() == SP::FpABSD ||
         MI->getOpcode() == SP::FpNEGD) {
       Changed = true;
@@ -101,11 +102,11 @@ bool FPMover::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
 
       const TargetInstrInfo *TII = TM.getInstrInfo();
       if (MI->getOpcode() == SP::FpMOVD)
-        MI->setInstrDescriptor(TII->get(SP::FMOVS));
+        MI->setDesc(TII->get(SP::FMOVS));
       else if (MI->getOpcode() == SP::FpNEGD)
-        MI->setInstrDescriptor(TII->get(SP::FNEGS));
+        MI->setDesc(TII->get(SP::FNEGS));
       else if (MI->getOpcode() == SP::FpABSD)
-        MI->setInstrDescriptor(TII->get(SP::FABSS));
+        MI->setDesc(TII->get(SP::FABSS));
       else
         assert(0 && "Unknown opcode!");
         
@@ -114,7 +115,7 @@ bool FPMover::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
       DOUT << "FPMover: the modified instr is: " << *MI;
       // Insert copy for the other half of the double.
       if (DestDReg != SrcDReg) {
-        MI = BuildMI(MBB, I, TM.getInstrInfo()->get(SP::FMOVS), OddDestReg)
+        MI = BuildMI(MBB, I, dl, TM.getInstrInfo()->get(SP::FMOVS), OddDestReg)
           .addReg(OddSrcReg);
         DOUT << "FPMover: the inserted instr is: " << *MI;
       }