diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-11-15 20:48:17 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-11-15 20:48:17 +0000 |
commit | 9a00279988612d0f960fb8d43e4ccfcab89e0e14 (patch) | |
tree | 618c1be4de338b89b66cb3444b5f7c1b5b45556e | |
parent | 0851b4f3eda110cc21c8d4b59f0d55bc84d9d088 (diff) | |
download | llvm-9a00279988612d0f960fb8d43e4ccfcab89e0e14.tar.gz llvm-9a00279988612d0f960fb8d43e4ccfcab89e0e14.tar.bz2 llvm-9a00279988612d0f960fb8d43e4ccfcab89e0e14.tar.xz |
Add copyKillDeadInfo to copy kill / dead info; other minor updates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31758 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 6eddd880bd..1152a68604 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -206,19 +206,19 @@ public: return IsDead; } void setIsKill() { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isRegister() && !IsDef && "Wrong MachineOperand accessor"); IsKill = true; } void setIsDead() { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isRegister() && IsDef && "Wrong MachineOperand accessor"); IsDead = true; } void unsetIsKill() { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isRegister() && !IsDef && "Wrong MachineOperand accessor"); IsKill = false; } void unsetIsDead() { - assert(isRegister() && "Wrong MachineOperand accessor"); + assert(isRegister() && IsDef && "Wrong MachineOperand accessor"); IsDead = false; } @@ -261,7 +261,7 @@ public: } /// isIdenticalTo - Return true if this operand is identical to the specified - /// operand. + /// operand. Note: This method ignores isKill and isDead properties. bool isIdenticalTo(const MachineOperand &Other) const; /// ChangeToImmediate - Replace this operand with a new immediate operand of @@ -295,13 +295,13 @@ public: /// class MachineInstr { short Opcode; // the opcode + short NumImplicitOps; // Number of implicit operands (which + // are determined at construction time). + std::vector<MachineOperand> Operands; // the operands MachineInstr* prev, *next; // links for our intrusive list MachineBasicBlock* parent; // pointer to the owning basic block - unsigned NumImplicitOps; // Number of implicit operands (which - // are determined at construction time). - // OperandComplete - Return true if it's illegal to add a new operand bool OperandsComplete() const; @@ -376,6 +376,26 @@ public: delete removeFromParent(); } + /// copyKillDeadInfo - Copies kill / dead operand properties from MI. + /// + void copyKillDeadInfo(const MachineInstr *MI) { + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI->getOperand(i); + if (MO.isReg() && (MO.isKill() || MO.isDead())) { + for (unsigned j = 0, ee = getNumOperands(); j != ee; ++j) { + MachineOperand &MOp = getOperand(j); + if (MOp.isIdenticalTo(MO)) { + if (MO.isKill()) + MOp.setIsKill(); + else + MOp.setIsDead(); + break; + } + } + } + } + } + // // Debugging support // |