From b25e5eab238dc7c103d72bfb5f58625f16476b7b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 29 Aug 2008 17:19:30 +0000 Subject: [PATCH] Asmprint nameless instructions as: %4 = add ... instead of: add ... ; 4 This makes opt -print-cfg output actually usable and makes .ll files generally easier to read. This fixes PR2480 llvm-svn: 55541 --- llvm/lib/VMCore/AsmWriter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 21fb92578262..80ecea3d6a9c 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -1486,7 +1486,7 @@ void AssemblyWriter::printInfoComment(const Value &V) { printType(V.getType()); Out << '>'; - if (!V.hasName()) { + if (!V.hasName() && !isa(V)) { int SlotNum; if (const GlobalValue *GV = dyn_cast(&V)) SlotNum = Machine.getGlobalSlot(GV); @@ -1511,6 +1511,13 @@ void AssemblyWriter::printInstruction(const Instruction &I) { if (I.hasName()) { PrintLLVMName(Out, &I); Out << " = "; + } else if (I.getType() != Type::VoidTy) { + // Print out the def slot taken. + int SlotNum = Machine.getLocalSlot(&I); + if (SlotNum == -1) + Out << " = "; + else + Out << '%' << SlotNum << " = "; } // If this is a volatile load or store, print out the volatile marker.