OSDN Git Service

[GlobalISel] Move method definition to the proper file. NFC.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Sun, 19 Mar 2017 16:12:48 +0000 (16:12 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Sun, 19 Mar 2017 16:12:48 +0000 (16:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298221 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/GlobalISel/InstructionSelect.cpp
lib/CodeGen/GlobalISel/InstructionSelector.cpp

index c1e4a86..0ca4134 100644 (file)
@@ -177,22 +177,3 @@ bool InstructionSelect::runOnMachineFunction(MachineFunction &MF) {
   // FIXME: Should we accurately track changes?
   return true;
 }
-
-bool InstructionSelector::isOperandImmEqual(
-    const MachineOperand &MO, int64_t Value,
-    const MachineRegisterInfo &MRI) const {
-  // TODO: We should also test isImm() and isCImm() too but this isn't required
-  //       until a DAGCombine equivalent is implemented.
-
-  if (MO.isReg()) {
-    MachineInstr *Def = MRI.getVRegDef(MO.getReg());
-    if (Def->getOpcode() != TargetOpcode::G_CONSTANT)
-      return false;
-    assert(Def->getOperand(1).isCImm() &&
-           "G_CONSTANT values must be constants");
-    const ConstantInt &Imm = *Def->getOperand(1).getCImm();
-    return Imm.getBitWidth() <= 64 && Imm.getSExtValue() == Value;
-  }
-
-  return false;
-}
index 1e1d039..104835c 100644 (file)
@@ -14,6 +14,8 @@
 #include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
 #include "llvm/CodeGen/GlobalISel/Utils.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/IR/Constants.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 
@@ -65,3 +67,22 @@ bool InstructionSelector::constrainSelectedInstRegOperands(
   }
   return true;
 }
+
+bool InstructionSelector::isOperandImmEqual(
+    const MachineOperand &MO, int64_t Value,
+    const MachineRegisterInfo &MRI) const {
+  // TODO: We should also test isImm() and isCImm() too but this isn't required
+  //       until a DAGCombine equivalent is implemented.
+
+  if (MO.isReg()) {
+    MachineInstr *Def = MRI.getVRegDef(MO.getReg());
+    if (Def->getOpcode() != TargetOpcode::G_CONSTANT)
+      return false;
+    assert(Def->getOperand(1).isCImm() &&
+           "G_CONSTANT values must be constants");
+    const ConstantInt &Imm = *Def->getOperand(1).getCImm();
+    return Imm.getBitWidth() <= 64 && Imm.getSExtValue() == Value;
+  }
+
+  return false;
+}