[llvm-commits] [llvm] r55541 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Chris Lattner
sabre at nondot.org
Fri Aug 29 10:19:30 PDT 2008
Author: lattner
Date: Fri Aug 29 12:19:30 2008
New Revision: 55541
URL: http://llvm.org/viewvc/llvm-project?rev=55541&view=rev
Log:
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
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=55541&r1=55540&r2=55541&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Fri Aug 29 12:19:30 2008
@@ -1486,7 +1486,7 @@
printType(V.getType());
Out << '>';
- if (!V.hasName()) {
+ if (!V.hasName() && !isa<Instruction>(V)) {
int SlotNum;
if (const GlobalValue *GV = dyn_cast<GlobalValue>(&V))
SlotNum = Machine.getGlobalSlot(GV);
@@ -1511,6 +1511,13 @@
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 << "<badref> = ";
+ else
+ Out << '%' << SlotNum << " = ";
}
// If this is a volatile load or store, print out the volatile marker.
More information about the llvm-commits
mailing list