diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-30 01:55:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-30 01:55:38 +0000 |
commit | 6a592271fb2946a0704b06fd66199987cdd40b3c (patch) | |
tree | 28817222381d05add22fde5ad9050e19b31e1186 /lib/CodeGen/MachineInstr.cpp | |
parent | 1162262a289ac275d30726adf3fa9456489f9566 (diff) | |
download | external_llvm-6a592271fb2946a0704b06fd66199987cdd40b3c.zip external_llvm-6a592271fb2946a0704b06fd66199987cdd40b3c.tar.gz external_llvm-6a592271fb2946a0704b06fd66199987cdd40b3c.tar.bz2 |
Add special code to make printing SSA form machine instructions nicer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index 961e568..5ec5c2a 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -266,17 +266,28 @@ static void print(const MachineOperand &MO, std::ostream &OS, } void MachineInstr::print(std::ostream &OS, const TargetMachine &TM) { + unsigned StartOp = 0; + + // Specialize printing if op#0 is definition + if (getNumOperands() && operandIsDefined(0)) { + ::print(getOperand(0), OS, TM); + OS << " = "; + ++StartOp; // Don't print this operand again! + } OS << TM.getInstrInfo().getName(getOpcode()); - for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { - OS << "\t"; + + for (unsigned i = StartOp, e = getNumOperands(); i != e; ++i) { + if (i != StartOp) + OS << ","; + OS << " "; ::print(getOperand(i), OS, TM); - + if (operandIsDefinedAndUsed(i)) OS << "<def&use>"; else if (operandIsDefined(i)) OS << "<def>"; } - + // code for printing implict references if (getNumImplicitRefs()) { OS << "\tImplicitRefs: "; |