diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-30 00:08:21 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-30 00:08:21 +0000 |
commit | 47bd03b2779bc500fb0472518d0e278f080ee79a (patch) | |
tree | 39bb0fc05120035cc4363b24595147bc361e57df /lib/CodeGen/SelectionDAG | |
parent | f07fc974d330fa355ba60f23828657f54f97e5aa (diff) | |
download | external_llvm-47bd03b2779bc500fb0472518d0e278f080ee79a.zip external_llvm-47bd03b2779bc500fb0472518d0e278f080ee79a.tar.gz external_llvm-47bd03b2779bc500fb0472518d0e278f080ee79a.tar.bz2 |
Set register kill flags on the SelectionDAG path, at least in the
easy cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r-- | lib/CodeGen/SelectionDAG/InstrEmitter.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp index f857a1c..e944dfd 100644 --- a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp +++ b/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)); |