summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-30 01:55:38 +0000
committerChris Lattner <sabre@nondot.org>2002-10-30 01:55:38 +0000
commitac6e97410bc1caf87433348bc69b6090762ffb1d (patch)
tree5165671a2a3f33bf6dcdf4a5d38698a931442f1f /llvm/lib/CodeGen/MachineInstr.cpp
parent5c39f65fcde5f3325c00fdef25e826493a530e80 (diff)
downloadbcm5719-llvm-ac6e97410bc1caf87433348bc69b6090762ffb1d.tar.gz
bcm5719-llvm-ac6e97410bc1caf87433348bc69b6090762ffb1d.zip
Add special code to make printing SSA form machine instructions nicer
llvm-svn: 4446
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 961e568f69f..5ec5c2ad05a 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/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: ";
OpenPOWER on IntegriCloud