Add two new calling conventions for runtime calls
[oota-llvm.git] / lib / Target / Hexagon / HexagonCopyToCombine.cpp
index dd63523291237aa5d02480c7d37d5cdee08ccf5a..97e7b85f55bb4dc246b4d2a12574ac1b97a568a9 100644 (file)
 #define DEBUG_TYPE "hexagon-copy-combine"
 
 #include "llvm/PassSupport.h"
-#include "llvm/ADT/DenseSet.h"
+#include "Hexagon.h"
+#include "HexagonInstrInfo.h"
+#include "HexagonMachineFunctionInfo.h"
+#include "HexagonRegisterInfo.h"
+#include "HexagonSubtarget.h"
+#include "HexagonTargetMachine.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/CodeGen/Passes.h"
+#include "llvm/ADT/DenseSet.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
-#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/CodeGen/Passes.h"
 #include "llvm/Support/CodeGen.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
-
-#include "Hexagon.h"
-#include "HexagonInstrInfo.h"
-#include "HexagonRegisterInfo.h"
-#include "HexagonSubtarget.h"
-#include "HexagonTargetMachine.h"
-#include "HexagonMachineFunctionInfo.h"
+#include "llvm/Target/TargetRegisterInfo.h"
 
 using namespace llvm;
 
@@ -217,10 +216,11 @@ static void removeKillInfo(MachineInstr *MI, unsigned RegNotKilled) {
   }
 }
 
-/// isUnsafeToMoveAccross - Returns true if it is unsafe to move a copy
+/// isUnsafeToMoveAcross - Returns true if it is unsafe to move a copy
 /// instruction from \p UseReg to \p DestReg over the instruction \p I.
-bool isUnsafeToMoveAccross(MachineInstr *I, unsigned UseReg, unsigned DestReg,
-                            const TargetRegisterInfo *TRI) {
+static bool isUnsafeToMoveAcross(MachineInstr *I, unsigned UseReg,
+                                  unsigned DestReg,
+                                  const TargetRegisterInfo *TRI) {
   return (UseReg && (I->modifiesRegister(UseReg, TRI))) ||
           I->modifiesRegister(DestReg, TRI) ||
           I->readsRegister(DestReg, TRI) ||
@@ -271,7 +271,7 @@ bool HexagonCopyToCombine::isSafeToMoveTogether(MachineInstr *I1,
       //   * reads I2's def reg
       //   * or has unmodelled side effects
       // we can't move I2 across it.
-      if (isUnsafeToMoveAccross(&*I, I2UseReg, I2DestReg, TRI)) {
+      if (isUnsafeToMoveAcross(&*I, I2UseReg, I2DestReg, TRI)) {
         isSafe = false;
         break;
       }
@@ -303,7 +303,7 @@ bool HexagonCopyToCombine::isSafeToMoveTogether(MachineInstr *I1,
       End = llvm::next(MachineBasicBlock::iterator(I2));
     IsImmUseReg = I1->getOperand(1).isImm() || I1->getOperand(1).isGlobal();
     unsigned I1UseReg = IsImmUseReg ? 0 : I1->getOperand(1).getReg();
-    // Track killed operands. If we move accross an instruction that kills our
+    // Track killed operands. If we move across an instruction that kills our
     // operand, we need to update the kill information on the moved I1. It kills
     // the operand now.
     MachineInstr *KillingInstr = 0;
@@ -326,7 +326,7 @@ bool HexagonCopyToCombine::isSafeToMoveTogether(MachineInstr *I1,
       //      to remove the %D4<imp-use,kill> operand. For now, we are
       //      conservative and disallow the move.
       // we can't move I1 across it.
-      if (isUnsafeToMoveAccross(I, I1UseReg, I1DestReg, TRI) ||
+      if (isUnsafeToMoveAcross(I, I1UseReg, I1DestReg, TRI) ||
           // Check for an aliased register kill. Bail out if we see one.
           (!I->killsRegister(I1UseReg) && I->killsRegister(I1UseReg, TRI)))
         return false;