mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 08:26:02 +00:00
add isIdenticalTo method to machineinstr/operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31087 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -118,6 +118,10 @@ public:
|
|||||||
assert(isImm() && "Wrong MachineOperand accessor");
|
assert(isImm() && "Wrong MachineOperand accessor");
|
||||||
return contents.immedVal;
|
return contents.immedVal;
|
||||||
}
|
}
|
||||||
|
MachineBasicBlock *getMBB() const {
|
||||||
|
assert(isMachineBasicBlock() && "Wrong MachineOperand accessor");
|
||||||
|
return contents.MBB;
|
||||||
|
}
|
||||||
MachineBasicBlock *getMachineBasicBlock() const {
|
MachineBasicBlock *getMachineBasicBlock() const {
|
||||||
assert(isMachineBasicBlock() && "Wrong MachineOperand accessor");
|
assert(isMachineBasicBlock() && "Wrong MachineOperand accessor");
|
||||||
return contents.MBB;
|
return contents.MBB;
|
||||||
@@ -203,6 +207,9 @@ public:
|
|||||||
contents.immedVal = Idx;
|
contents.immedVal = Idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// isIdenticalTo - Return true if this operand is identical to the specified
|
||||||
|
/// operand.
|
||||||
|
bool isIdenticalTo(const MachineOperand &Other) const;
|
||||||
|
|
||||||
/// ChangeToImmediate - Replace this operand with a new immediate operand of
|
/// ChangeToImmediate - Replace this operand with a new immediate operand of
|
||||||
/// the specified value. If an operand is known to be an immediate already,
|
/// the specified value. If an operand is known to be an immediate already,
|
||||||
@@ -280,6 +287,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// isIdenticalTo - Return true if this instruction is identical to (same
|
||||||
|
/// opcode and same operands as) the specified instruction.
|
||||||
|
bool isIdenticalTo(const MachineInstr *Other) const {
|
||||||
|
if (Other->getOpcode() != getOpcode() ||
|
||||||
|
getNumOperands() != getNumOperands())
|
||||||
|
return false;
|
||||||
|
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
|
||||||
|
if (!getOperand(i).isIdenticalTo(Other->getOperand(i)))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// clone - Create a copy of 'this' instruction that is identical in
|
/// clone - Create a copy of 'this' instruction that is identical in
|
||||||
/// all ways except the the instruction has no parent, prev, or next.
|
/// all ways except the the instruction has no parent, prev, or next.
|
||||||
MachineInstr* clone() const { return new MachineInstr(*this); }
|
MachineInstr* clone() const { return new MachineInstr(*this); }
|
||||||
|
Reference in New Issue
Block a user