aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-06-15 21:15:00 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-06-15 21:15:00 +0000
commitd42e56e166761d79201f09eeb4ab782e3097bfcd (patch)
treed8dba0d8343e3b865eb6717254ede1c9246fb8e3
parent61a2598ebe007091e054325f568d1cc50c9ff3d2 (diff)
Instructions with unique labels or embedded jumptables cannot be duplicated during ifcvt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37606 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/ARM/ARMInstrInfo.cpp29
-rw-r--r--lib/Target/ARM/ARMInstrInfo.h2
2 files changed, 31 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp
index 1370faba4d..c8f7919eab 100644
--- a/lib/Target/ARM/ARMInstrInfo.cpp
+++ b/lib/Target/ARM/ARMInstrInfo.cpp
@@ -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();
diff --git a/lib/Target/ARM/ARMInstrInfo.h b/lib/Target/ARM/ARMInstrInfo.h
index 5b406cb816..5c098f0f1a 100644
--- a/lib/Target/ARM/ARMInstrInfo.h
+++ b/lib/Target/ARM/ARMInstrInfo.h
@@ -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;