diff options
| author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-03 01:13:07 +0000 |
|---|---|---|
| committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-03 01:13:07 +0000 |
| commit | 4e7854407ced8e2160592675918312a20cfb7cde (patch) | |
| tree | da0f658db536c6cd06029a0d3c1e0e5a967cdc47 /lib/CodeGen/MachineInstr.cpp | |
| parent | 9fe7602862328c0081106709e0a8f03316dc845b (diff) | |
When an instruction like: A += B had both A and B virtual registers
spilled, A was loaded from its stack location twice. This fixes the bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
| -rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 9d7b1b2d99..869d963d53 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -27,6 +27,24 @@ namespace llvm { // extern const TargetInstrDescriptor *TargetInstrDescriptors; +bool MachineOperand::isEverUsed(const MachineInstr& mi) const +{ + for (int i = 0, e = mi.getNumOperands(); i != e; ++i) { + if (*this == mi.getOperand(i) && mi.getOperand(i).isUse()) + return true; + } + return false; +} + +bool MachineOperand::isEverDefined(const MachineInstr& mi) const +{ + for (int i = 0, e = mi.getNumOperands(); i != e; ++i) { + if (*this == mi.getOperand(i) && mi.getOperand(i).isDef()) + return true; + } + return false; +} + // Constructor for instructions with variable #operands MachineInstr::MachineInstr(MachineOpCode OpCode, unsigned numOperands) : opCode(OpCode), |
