From 4d7af65903cbc858464362e70a6adf499982ec8a Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Sun, 14 Dec 2003 13:24:17 +0000 Subject: 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 --- lib/CodeGen/MachineInstr.cpp | 61 ++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'lib/CodeGen/MachineInstr.cpp') diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index ef31cc4cb3..9d7b1b2d99 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -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 << ""; - else if (mop.opIsDefOnly()) - OS << ""; + if (mop.isDef()) + if (mop.isUse()) + OS << ""; + else + OS << ""; } // 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 << ""; - else if (getImplicitOp(i).opIsDefOnly()) - OS << ""; + if (getImplicitOp(i).isDef()) + if (getImplicitOp(i).isUse()) + OS << ""; + else + OS << ""; } } @@ -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 << ""; - if (MI.getOperand(i).opIsDefAndUse()) - os << ""; + if (MI.getOperand(i).isDef()) + if (MI.getOperand(i).isUse()) + os << ""; + else + os << ""; } // 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 << ""; - if (MI.getImplicitOp(z).opIsDefAndUse()) os << ""; + if (MI.getImplicitOp(z).isDef()) + if (MI.getImplicitOp(z).isUse()) + os << ""; + else + os << ""; 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()) -- cgit v1.2.3-18-g5258