summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-08-29 17:19:30 +0000
committerChris Lattner <sabre@nondot.org>2008-08-29 17:19:30 +0000
commit828db8a2f90e0e3faf27c1fe69a632c666e3a343 (patch)
tree56cf854c2a900b3e014d12d37823ab3aa9a0849b /lib/VMCore
parent33e4e610b50e8bf25974dbb22f4b4035680ae95d (diff)
downloadllvm-828db8a2f90e0e3faf27c1fe69a632c666e3a343.tar.gz
llvm-828db8a2f90e0e3faf27c1fe69a632c666e3a343.tar.bz2
llvm-828db8a2f90e0e3faf27c1fe69a632c666e3a343.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 21fb925782..80ecea3d6a 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/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<Instruction>(V)) {
int SlotNum;
if (const GlobalValue *GV = dyn_cast<GlobalValue>(&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 << "<badref> = ";
+ else
+ Out << '%' << SlotNum << " = ";
}
// If this is a volatile load or store, print out the volatile marker.