summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-04-30 00:08:21 +0000
committerDan Gohman <gohman@apple.com>2010-04-30 00:08:21 +0000
commitac55510c4eb03daf1ec8316ada50e66a17885f01 (patch)
treed1d76e864fdd746fed3bcc2743d3b42af000c112 /llvm/lib/CodeGen
parentdac3ea6e8d712f09c3c7db89648c6c4ab4bb1166 (diff)
downloadbcm5719-llvm-ac55510c4eb03daf1ec8316ada50e66a17885f01.tar.gz
bcm5719-llvm-ac55510c4eb03daf1ec8316ada50e66a17885f01.zip
Set register kill flags on the SelectionDAG path, at least in the
easy cases. llvm-svn: 102678
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index f857a1c8942..e944dfd17d0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -296,8 +296,19 @@ InstrEmitter::AddRegisterOperand(MachineInstr *MI, SDValue Op,
}
}
+ // If this value has only one use, that use is a kill. This is a
+ // conservative approximation. Tied operands are never killed, so we need
+ // to check that. And that means we need to determine the index of the
+ // operand.
+ unsigned Idx = MI->getNumOperands();
+ while (Idx > 0 &&
+ MI->getOperand(Idx-1).isReg() && MI->getOperand(Idx-1).isImplicit())
+ --Idx;
+ bool isTied = MI->getDesc().getOperandConstraint(Idx, TOI::TIED_TO) != -1;
+ bool isKill = Op.hasOneUse() && !isTied;
+
MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef,
- false/*isImp*/, false/*isKill*/,
+ false/*isImp*/, isKill,
false/*isDead*/, false/*isUndef*/,
false/*isEarlyClobber*/,
0/*SubReg*/, IsDebug));
OpenPOWER on IntegriCloud