mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
Change interface of MachineOperand as follows:
a) remove opIsUse(), opIsDefOnly(), opIsDefAndUse() b) add isUse(), isDef() c) rename opHiBits32() to isHiBits32(), opLoBits32() to isLoBits32(), opHiBits64() to isHiBits64(), opLoBits64() to isLoBits64(). This results to much more readable code, for example compare "op.opIsDef() || op.opIsDefAndUse()" to "op.isDef()" a pattern used very often in the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10461 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -153,8 +153,8 @@ MachineInstr::substituteValue(const Value* oldVal, Value* newVal,
|
||||
for (MachineInstr::val_op_iterator O = begin(), E = end(); O != E; ++O)
|
||||
if (*O == oldVal)
|
||||
if (!defsOnly ||
|
||||
notDefsAndUses && O.isDefOnly() ||
|
||||
!notDefsAndUses && !O.isUseOnly())
|
||||
notDefsAndUses && (O.isDef() && !O.isUse()) ||
|
||||
!notDefsAndUses && O.isDef())
|
||||
{
|
||||
O.getMachineOperand().value = newVal;
|
||||
++numSubst;
|
||||
@ -166,8 +166,8 @@ MachineInstr::substituteValue(const Value* oldVal, Value* newVal,
|
||||
for (unsigned i=0, N=getNumImplicitRefs(); i < N; ++i)
|
||||
if (getImplicitRef(i) == oldVal)
|
||||
if (!defsOnly ||
|
||||
notDefsAndUses && getImplicitOp(i).opIsDefOnly() ||
|
||||
!notDefsAndUses && !getImplicitOp(i).opIsUse())
|
||||
notDefsAndUses && (getImplicitOp(i).isDef() && !getImplicitOp(i).isUse()) ||
|
||||
!notDefsAndUses && getImplicitOp(i).isDef())
|
||||
{
|
||||
getImplicitOp(i).value = newVal;
|
||||
++numSubst;
|
||||
@ -210,13 +210,13 @@ static void print(const MachineOperand &MO, std::ostream &OS,
|
||||
const TargetMachine &TM) {
|
||||
const MRegisterInfo *MRI = TM.getRegisterInfo();
|
||||
bool CloseParen = true;
|
||||
if (MO.opHiBits32())
|
||||
if (MO.isHiBits32())
|
||||
OS << "%lm(";
|
||||
else if (MO.opLoBits32())
|
||||
else if (MO.isLoBits32())
|
||||
OS << "%lo(";
|
||||
else if (MO.opHiBits64())
|
||||
else if (MO.isHiBits64())
|
||||
OS << "%hh(";
|
||||
else if (MO.opLoBits64())
|
||||
else if (MO.isLoBits64())
|
||||
OS << "%hm(";
|
||||
else
|
||||
CloseParen = false;
|
||||
@ -289,8 +289,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const {
|
||||
unsigned StartOp = 0;
|
||||
|
||||
// Specialize printing if op#0 is definition
|
||||
if (getNumOperands() &&
|
||||
(getOperand(0).opIsDefOnly() || getOperand(0).opIsDefAndUse())) {
|
||||
if (getNumOperands() && getOperand(0).isDef() && !getOperand(0).isUse()) {
|
||||
llvm::print(getOperand(0), OS, TM);
|
||||
OS << " = ";
|
||||
++StartOp; // Don't print this operand again!
|
||||
@ -304,10 +303,11 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const {
|
||||
OS << " ";
|
||||
llvm::print(mop, OS, TM);
|
||||
|
||||
if (mop.opIsDefAndUse())
|
||||
OS << "<def&use>";
|
||||
else if (mop.opIsDefOnly())
|
||||
OS << "<def>";
|
||||
if (mop.isDef())
|
||||
if (mop.isUse())
|
||||
OS << "<def&use>";
|
||||
else
|
||||
OS << "<def>";
|
||||
}
|
||||
|
||||
// code for printing implicit references
|
||||
@ -316,10 +316,11 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) const {
|
||||
for(unsigned i = 0, e = getNumImplicitRefs(); i != e; ++i) {
|
||||
OS << "\t";
|
||||
OutputValue(OS, getImplicitRef(i));
|
||||
if (getImplicitOp(i).opIsDefAndUse())
|
||||
OS << "<def&use>";
|
||||
else if (getImplicitOp(i).opIsDefOnly())
|
||||
OS << "<def>";
|
||||
if (getImplicitOp(i).isDef())
|
||||
if (getImplicitOp(i).isUse())
|
||||
OS << "<def&use>";
|
||||
else
|
||||
OS << "<def>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,10 +334,11 @@ std::ostream &operator<<(std::ostream& os, const MachineInstr& MI)
|
||||
|
||||
for (unsigned i=0, N=MI.getNumOperands(); i < N; i++) {
|
||||
os << "\t" << MI.getOperand(i);
|
||||
if (MI.getOperand(i).opIsDefOnly())
|
||||
os << "<d>";
|
||||
if (MI.getOperand(i).opIsDefAndUse())
|
||||
os << "<d&u>";
|
||||
if (MI.getOperand(i).isDef())
|
||||
if (MI.getOperand(i).isUse())
|
||||
os << "<d&u>";
|
||||
else
|
||||
os << "<d>";
|
||||
}
|
||||
|
||||
// code for printing implicit references
|
||||
@ -345,8 +347,11 @@ std::ostream &operator<<(std::ostream& os, const MachineInstr& MI)
|
||||
os << "\tImplicit: ";
|
||||
for (unsigned z=0; z < NumOfImpRefs; z++) {
|
||||
OutputValue(os, MI.getImplicitRef(z));
|
||||
if (MI.getImplicitOp(z).opIsDefOnly()) os << "<d>";
|
||||
if (MI.getImplicitOp(z).opIsDefAndUse()) os << "<d&u>";
|
||||
if (MI.getImplicitOp(z).isDef())
|
||||
if (MI.getImplicitOp(z).isUse())
|
||||
os << "<d&u>";
|
||||
else
|
||||
os << "<d>";
|
||||
os << "\t";
|
||||
}
|
||||
}
|
||||
@ -356,13 +361,13 @@ std::ostream &operator<<(std::ostream& os, const MachineInstr& MI)
|
||||
|
||||
std::ostream &operator<<(std::ostream &OS, const MachineOperand &MO)
|
||||
{
|
||||
if (MO.opHiBits32())
|
||||
if (MO.isHiBits32())
|
||||
OS << "%lm(";
|
||||
else if (MO.opLoBits32())
|
||||
else if (MO.isLoBits32())
|
||||
OS << "%lo(";
|
||||
else if (MO.opHiBits64())
|
||||
else if (MO.isHiBits64())
|
||||
OS << "%hh(";
|
||||
else if (MO.opLoBits64())
|
||||
else if (MO.isLoBits64())
|
||||
OS << "%hm(";
|
||||
|
||||
switch (MO.getType())
|
||||
|
Reference in New Issue
Block a user