Instructions with unique labels or embedded jumptables cannot be duplicated during...
authorEvan Cheng <evan.cheng@apple.com>
Fri, 15 Jun 2007 21:15:00 +0000 (21:15 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 15 Jun 2007 21:15:00 +0000 (21:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37606 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrInfo.cpp
lib/Target/ARM/ARMInstrInfo.h

index 1370faba4d7c9e592f4679bb4f9732b602a73f49..c8f7919eabe71a15f751d2218e1714aa7d56f588 100644 (file)
@@ -446,6 +446,35 @@ bool ARMInstrInfo::isPredicated(const MachineInstr *MI) const {
   return PIdx != -1 && MI->getOperand(PIdx).getImmedValue() != ARMCC::AL;
 }
 
+bool ARMInstrInfo::CanBeDuplicated(const MachineInstr *MI) const {
+  switch (MI->getOpcode()) {
+  default: return true;
+  // These have unique labels.
+  case ARM::PICADD:
+  case ARM::PICLD:
+  case ARM::PICLDZH:
+  case ARM::PICLDZB:
+  case ARM::PICLDH:
+  case ARM::PICLDB:
+  case ARM::PICLDSH:
+  case ARM::PICLDSB:
+  case ARM::PICSTR:
+  case ARM::PICSTRH:
+  case ARM::PICSTRB:
+  case ARM::LEApcrel:
+  case ARM::LEApcrelJT:
+  case ARM::tPICADD:
+  case ARM::tLEApcrel:
+  case ARM::tLEApcrelJT:
+  case ARM::CONSTPOOL_ENTRY:
+  // These embed jumptables.
+  case ARM::BR_JTr:
+  case ARM::BR_JTm:
+  case ARM::BR_JTadd:
+    return false;
+  }
+}
+
 bool ARMInstrInfo::PredicateInstruction(MachineInstr *MI,
                                 const std::vector<MachineOperand> &Pred) const {
   unsigned Opc = MI->getOpcode();
index 5b406cb8168f67626f9bbd53f08dd652ef0d3acb..5c098f0f1aa4659b9b75883497dc1342604917a4 100644 (file)
@@ -106,6 +106,8 @@ public:
   // Predication support.
   virtual bool isPredicated(const MachineInstr *MI) const;
 
+  virtual bool CanBeDuplicated(const MachineInstr *MI) const;
+
   virtual
   bool PredicateInstruction(MachineInstr *MI,
                             const std::vector<MachineOperand> &Pred) const;