llvm-dis.cpp (218885) | llvm-dis.cpp (221337) |
---|---|
1//===-- llvm-dis.cpp - The low-level LLVM disassembler --------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 5 unchanged lines hidden (view full) --- 14// Options: 15// --help - Output information about command line switches 16// 17//===----------------------------------------------------------------------===// 18 19#include "llvm/LLVMContext.h" 20#include "llvm/Module.h" 21#include "llvm/Type.h" | 1//===-- llvm-dis.cpp - The low-level LLVM disassembler --------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 5 unchanged lines hidden (view full) --- 14// Options: 15// --help - Output information about command line switches 16// 17//===----------------------------------------------------------------------===// 18 19#include "llvm/LLVMContext.h" 20#include "llvm/Module.h" 21#include "llvm/Type.h" |
22#include "llvm/IntrinsicInst.h" |
|
22#include "llvm/Bitcode/ReaderWriter.h" | 23#include "llvm/Bitcode/ReaderWriter.h" |
24#include "llvm/Analysis/DebugInfo.h" |
|
23#include "llvm/Assembly/AssemblyAnnotationWriter.h" 24#include "llvm/Support/CommandLine.h" 25#include "llvm/Support/FormattedStream.h" 26#include "llvm/Support/ManagedStatic.h" 27#include "llvm/Support/MemoryBuffer.h" 28#include "llvm/Support/PrettyStackTrace.h" 29#include "llvm/Support/ToolOutputFile.h" 30#include "llvm/Support/Signals.h" --- 14 unchanged lines hidden (view full) --- 45DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden); 46 47static cl::opt<bool> 48ShowAnnotations("show-annotations", 49 cl::desc("Add informational comments to the .ll file")); 50 51namespace { 52 | 25#include "llvm/Assembly/AssemblyAnnotationWriter.h" 26#include "llvm/Support/CommandLine.h" 27#include "llvm/Support/FormattedStream.h" 28#include "llvm/Support/ManagedStatic.h" 29#include "llvm/Support/MemoryBuffer.h" 30#include "llvm/Support/PrettyStackTrace.h" 31#include "llvm/Support/ToolOutputFile.h" 32#include "llvm/Support/Signals.h" --- 14 unchanged lines hidden (view full) --- 47DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden); 48 49static cl::opt<bool> 50ShowAnnotations("show-annotations", 51 cl::desc("Add informational comments to the .ll file")); 52 53namespace { 54 |
55static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) { 56 OS << DL.getLine() << ":" << DL.getCol(); 57 if (MDNode *N = DL.getInlinedAt(getGlobalContext())) { 58 DebugLoc IDL = DebugLoc::getFromDILocation(N); 59 if (!IDL.isUnknown()) { 60 OS << "@"; 61 printDebugLoc(IDL,OS); 62 } 63 } 64} |
|
53class CommentWriter : public AssemblyAnnotationWriter { 54public: 55 void emitFunctionAnnot(const Function *F, 56 formatted_raw_ostream &OS) { 57 OS << "; [#uses=" << F->getNumUses() << ']'; // Output # uses 58 OS << '\n'; 59 } 60 void printInfoComment(const Value &V, formatted_raw_ostream &OS) { | 65class CommentWriter : public AssemblyAnnotationWriter { 66public: 67 void emitFunctionAnnot(const Function *F, 68 formatted_raw_ostream &OS) { 69 OS << "; [#uses=" << F->getNumUses() << ']'; // Output # uses 70 OS << '\n'; 71 } 72 void printInfoComment(const Value &V, formatted_raw_ostream &OS) { |
61 if (V.getType()->isVoidTy()) return; 62 63 OS.PadToColumn(50); 64 OS << "; [#uses=" << V.getNumUses() << ']'; // Output # uses | 73 bool Padded = false; 74 if (!V.getType()->isVoidTy()) { 75 OS.PadToColumn(50); 76 Padded = true; 77 OS << "; [#uses=" << V.getNumUses() << " type=" << V.getType()->getDescription() << "]"; // Output # uses and type 78 } 79 if (const Instruction *I = dyn_cast<Instruction>(&V)) { 80 const DebugLoc &DL = I->getDebugLoc(); 81 if (!DL.isUnknown()) { 82 if (!Padded) { 83 OS.PadToColumn(50); 84 Padded = true; 85 OS << ";"; 86 } 87 OS << " [debug line = "; 88 printDebugLoc(DL,OS); 89 OS << "]"; 90 } 91 if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I)) { 92 DIVariable Var(DDI->getVariable()); 93 if (!Padded) { 94 OS.PadToColumn(50); 95 Padded = true; 96 OS << ";"; 97 } 98 OS << " [debug variable = " << Var.getName() << "]"; 99 } 100 else if (const DbgValueInst *DVI = dyn_cast<DbgValueInst>(I)) { 101 DIVariable Var(DVI->getVariable()); 102 if (!Padded) { 103 OS.PadToColumn(50); 104 Padded = true; 105 OS << ";"; 106 } 107 OS << " [debug variable = " << Var.getName() << "]"; 108 } 109 } |
65 } 66}; 67 68} // end anon namespace 69 70int main(int argc, char **argv) { 71 // Print a stack trace if we signal out. 72 sys::PrintStackTraceOnErrorSignal(); --- 69 unchanged lines hidden --- | 110 } 111}; 112 113} // end anon namespace 114 115int main(int argc, char **argv) { 116 // Print a stack trace if we signal out. 117 sys::PrintStackTraceOnErrorSignal(); --- 69 unchanged lines hidden --- |