summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-01-06 23:47:07 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-01-06 23:47:07 +0000
commit29a64c9575dd91df633b74aa612ed572b9a45242 (patch)
tree387acc5de4ec313296c11350df464618e198fb2e /llvm/lib/CodeGen
parent5fd6feb883dced8a54ba44678c3f7bf4c6e2ddd8 (diff)
downloadbcm5719-llvm-29a64c9575dd91df633b74aa612ed572b9a45242.tar.gz
bcm5719-llvm-29a64c9575dd91df633b74aa612ed572b9a45242.zip
Add Target hook to duplicate machine instructions.
Some instructions refer to unique labels, and so cannot be trivially cloned with CloneMachineInstr. llvm-svn: 92873
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/TailDuplication.cpp2
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfoImpl.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TailDuplication.cpp b/llvm/lib/CodeGen/TailDuplication.cpp
index fddbebd9f7b..c99c74c0f4d 100644
--- a/llvm/lib/CodeGen/TailDuplication.cpp
+++ b/llvm/lib/CodeGen/TailDuplication.cpp
@@ -346,7 +346,7 @@ void TailDuplicatePass::DuplicateInstruction(MachineInstr *MI,
MachineBasicBlock *PredBB,
MachineFunction &MF,
DenseMap<unsigned, unsigned> &LocalVRMap) {
- MachineInstr *NewMI = MF.CloneMachineInstr(MI);
+ MachineInstr *NewMI = TII->duplicate(MI, MF);
for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = NewMI->getOperand(i);
if (!MO.isReg())
diff --git a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
index 393e315a321..a0fccabdb5a 100644
--- a/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfoImpl.cpp
@@ -150,6 +150,13 @@ void TargetInstrInfoImpl::reMaterialize(MachineBasicBlock &MBB,
MBB.insert(I, MI);
}
+MachineInstr *TargetInstrInfoImpl::duplicate(MachineInstr *Orig,
+ MachineFunction &MF) const {
+ assert(!Orig->getDesc().isNotDuplicable() &&
+ "Instruction cannot be duplicated");
+ return MF.CloneMachineInstr(Orig);
+}
+
bool
TargetInstrInfoImpl::isIdentical(const MachineInstr *MI,
const MachineInstr *Other,
OpenPOWER on IntegriCloud