diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-14 13:24:17 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-12-14 13:24:17 +0000 |
commit | aaba4639f8b4e4b516b5d0534e726fe596c21081 (patch) | |
tree | 1b5d6e541d3ff5c644c4a2e7b5534e5137499573 /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | fbeb3b02c3d0012b3c56f166905cabd2e4b09706 (diff) | |
download | bcm5719-llvm-aaba4639f8b4e4b516b5d0534e726fe596c21081.tar.gz bcm5719-llvm-aaba4639f8b4e4b516b5d0534e726fe596c21081.zip |
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.
llvm-svn: 10461
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index ef31cc4cb3f..9d7b1b2d99f 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/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 << "<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()) |