aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-06-19 01:26:51 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-06-19 01:26:51 +0000
commiteaa91b0a1fc68984aae51f3c4b0cf29b38f89dac (patch)
tree93a8cd9aecd8080137878288ae7fc57872f4e5ca /lib
parent4e6b1e1d999a224d932c466118aad577f27cdd56 (diff)
downloadexternal_llvm-eaa91b0a1fc68984aae51f3c4b0cf29b38f89dac.zip
external_llvm-eaa91b0a1fc68984aae51f3c4b0cf29b38f89dac.tar.gz
external_llvm-eaa91b0a1fc68984aae51f3c4b0cf29b38f89dac.tar.bz2
Replace TargetInstrInfo::CanBeDuplicated() with a M_NOT_DUPLICABLE bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/IfConversion.cpp4
-rw-r--r--lib/Target/ARM/ARMInstrInfo.cpp29
-rw-r--r--lib/Target/ARM/ARMInstrInfo.h2
-rw-r--r--lib/Target/ARM/ARMInstrInfo.td6
-rw-r--r--lib/Target/ARM/ARMInstrThumb.td1
-rw-r--r--lib/Target/Target.td1
6 files changed, 10 insertions, 33 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 8702bb3..965cf6a 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -547,10 +547,10 @@ void IfConverter::ScanInstructions(BBInfo &BBI) {
bool SeenCondBr = false;
for (MachineBasicBlock::iterator I = BBI.BB->begin(), E = BBI.BB->end();
I != E; ++I) {
- if (!BBI.CannotBeCopied && !TII->CanBeDuplicated(I))
+ const TargetInstrDescriptor *TID = I->getInstrDescriptor();
+ if ((TID->Flags & M_NOT_DUPLICABLE) != 0)
BBI.CannotBeCopied = true;
- const TargetInstrDescriptor *TID = I->getInstrDescriptor();
bool isPredicated = TII->isPredicated(I);
bool isCondBr = BBI.IsBrAnalyzable &&
(TID->Flags & M_BRANCH_FLAG) != 0 && (TID->Flags & M_BARRIER_FLAG) == 0;
diff --git a/lib/Target/ARM/ARMInstrInfo.cpp b/lib/Target/ARM/ARMInstrInfo.cpp
index c8f7919..1370fab 100644
--- a/lib/Target/ARM/ARMInstrInfo.cpp
+++ b/lib/Target/ARM/ARMInstrInfo.cpp
@@ -446,35 +446,6 @@ 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 5c098f0..5b406cb 100644
--- a/lib/Target/ARM/ARMInstrInfo.h
+++ b/lib/Target/ARM/ARMInstrInfo.h
@@ -106,8 +106,6 @@ 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;
diff --git a/lib/Target/ARM/ARMInstrInfo.td b/lib/Target/ARM/ARMInstrInfo.td
index 7635824..33a41a0 100644
--- a/lib/Target/ARM/ARMInstrInfo.td
+++ b/lib/Target/ARM/ARMInstrInfo.td
@@ -533,6 +533,7 @@ PseudoInst<(ops GPR:$rD, pred:$p),
/// the function. The first operand is the ID# for this instruction, the second
/// is the index into the MachineConstantPool that this is, the third is the
/// size in bytes of this constant pool entry.
+let isNotDuplicable = 1 in
def CONSTPOOL_ENTRY :
PseudoInst<(ops cpinst_operand:$instid, cpinst_operand:$cpidx, i32imm:$size),
"${instid:label} ${cpidx:cpentry}", []>;
@@ -552,6 +553,7 @@ PseudoInst<(ops i32imm:$line, i32imm:$col, i32imm:$file),
".loc $file, $line, $col",
[(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>;
+let isNotDuplicable = 1 in {
def PICADD : AXI1<(ops GPR:$dst, GPR:$a, pclabel:$cp, pred:$p),
"$cp:\n\tadd$p $dst, pc, $a",
[(set GPR:$dst, (ARMpic_add GPR:$a, imm:$cp))]>;
@@ -598,6 +600,7 @@ def PICSTRB : AXI2<(ops GPR:$src, addrmodepc:$addr, pred:$p),
"${addr:label}:\n\tstr${p}b $src, $addr",
[(truncstorei8 GPR:$src, addrmodepc:$addr)]>;
}
+}
//===----------------------------------------------------------------------===//
// Control Flow Instructions.
@@ -637,6 +640,7 @@ let isBranch = 1, isTerminator = 1, noResults = 1 in {
def B : AXI<(ops brtarget:$dst), "b $dst",
[(br bb:$dst)]>;
+ let isNotDuplicable = 1 in {
def BR_JTr : JTI<(ops GPR:$dst, jtblock_operand:$jt, i32imm:$id),
"mov pc, $dst \n$jt",
[(ARMbrjt GPR:$dst, tjumptable:$jt, imm:$id)]>;
@@ -649,6 +653,7 @@ let isBranch = 1, isTerminator = 1, noResults = 1 in {
[(ARMbrjt (add GPR:$dst, GPR:$idx), tjumptable:$jt,
imm:$id)]>;
}
+ }
def Bcc : AXI<(ops brtarget:$dst, ccop:$cc), "b$cc $dst",
[(ARMbrcond bb:$dst, imm:$cc)]>;
@@ -1152,6 +1157,7 @@ def LEApcrelJT : AXI1<(ops GPR:$dst, i32imm:$label, i32imm:$id, pred:$p),
!strconcat("${:private}PCRELL${:uid}:\n\t",
"add$p $dst, pc, #PCRELV${:uid}")),
[]>;
+
//===----------------------------------------------------------------------===//
// TLS Instructions
//
diff --git a/lib/Target/ARM/ARMInstrThumb.td b/lib/Target/ARM/ARMInstrThumb.td
index a1e4e24..996b635 100644
--- a/lib/Target/ARM/ARMInstrThumb.td
+++ b/lib/Target/ARM/ARMInstrThumb.td
@@ -170,6 +170,7 @@ PseudoInst<(ops i32imm:$amt),
"@ tADJCALLSTACKDOWN $amt",
[(ARMcallseq_start imm:$amt)]>, Imp<[SP],[SP]>, Requires<[IsThumb]>;
+let isNotDuplicable = 1 in
def tPICADD : TIt<(ops GPR:$dst, GPR:$lhs, pclabel:$cp),
"$cp:\n\tadd $dst, pc",
[(set GPR:$dst, (ARMpic_add GPR:$lhs, imm:$cp))]>;
diff --git a/lib/Target/Target.td b/lib/Target/Target.td
index 4babef1..43e3af8 100644
--- a/lib/Target/Target.td
+++ b/lib/Target/Target.td
@@ -193,6 +193,7 @@ class Instruction {
bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow chains?
bit noResults = 0; // Does this instruction produce no results?
bit clobbersPred = 0; // Does it clobbers condition code / predicate?
+ bit isNotDuplicable = 0; // Is it unsafe to duplicate this instruction?
InstrItinClass Itinerary = NoItinerary;// Execution steps used for scheduling.