summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-30 14:39:06 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-08-30 14:39:06 +0000
commite941df5e354ff7d327bab8e59af687ec90fdd149 (patch)
treea3b1db653683b1019ee025db74165d9e55a6dd4d /lib/CodeGen/MachineInstr.cpp
parent1dfe9b52646ce56446ecd3548dbc81068369ef3f (diff)
downloadllvm-e941df5e354ff7d327bab8e59af687ec90fdd149.tar.gz
llvm-e941df5e354ff7d327bab8e59af687ec90fdd149.tar.bz2
llvm-e941df5e354ff7d327bab8e59af687ec90fdd149.tar.xz
Don't use MCInstrDesc flags for implicit operands.
When a MachineInstr is constructed, its implicit operands are added first, then the explicit operands are inserted before the implicits. MCInstrDesc has oprand flags like early clobber and operand ties that apply to the explicit operands. Don't look at those flags when the implicit operands are first added in the explicit operands's positions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 4a4c7217bd..ae205f6d10 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -721,19 +721,24 @@ void MachineInstr::addOperand(const MachineOperand &Op) {
// Add the new operand to RegInfo.
if (RegInfo)
RegInfo->addRegOperandToUseList(&Operands[OpNo]);
- // Set the IsTied bit if MC indicates this use is tied to a def.
- if (Operands[OpNo].isUse()) {
- int DefIdx = MCID->getOperandConstraint(OpNo, MCOI::TIED_TO);
- if (DefIdx != -1) {
- MachineOperand &DefMO = getOperand(DefIdx);
- assert(DefMO.isDef() && "Use tied to operand that isn't a def");
- DefMO.IsTied = true;
- Operands[OpNo].IsTied = true;
+ // The MCID operand information isn't accurate until we start adding
+ // explicit operands. The implicit operands are added first, then the
+ // explicits are inserted before them.
+ if (!isImpReg) {
+ // Set the IsTied bit if MC indicates this use is tied to a def.
+ if (Operands[OpNo].isUse()) {
+ int DefIdx = MCID->getOperandConstraint(OpNo, MCOI::TIED_TO);
+ if (DefIdx != -1) {
+ MachineOperand &DefMO = getOperand(DefIdx);
+ assert(DefMO.isDef() && "Use tied to operand that isn't a def");
+ DefMO.IsTied = true;
+ Operands[OpNo].IsTied = true;
+ }
}
+ // If the register operand is flagged as early, mark the operand as such.
+ if (MCID->getOperandConstraint(OpNo, MCOI::EARLY_CLOBBER) != -1)
+ Operands[OpNo].setIsEarlyClobber(true);
}
- // If the register operand is flagged as early, mark the operand as such.
- if (MCID->getOperandConstraint(OpNo, MCOI::EARLY_CLOBBER) != -1)
- Operands[OpNo].setIsEarlyClobber(true);
}
// Re-add all the implicit ops.