Remove -print-dbginfo as it is unused & bitrotten.

This pass hasn't been touched in two years & would fail with assertions against
the current debug info metadata format (the only test case for it still uses a
many-versions old debug info metadata format)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176707 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2013-03-08 18:17:46 +00:00
parent 778ef97c76
commit 423de3f047
7 changed files with 0 additions and 297 deletions

View File

@ -198,9 +198,6 @@ namespace llvm {
// analyze.
FunctionPass *createInstCountPass();
// print debug info intrinsics in human readable form
FunctionPass *createDbgInfoPrinterPass();
//===--------------------------------------------------------------------===//
//
// createRegionInfoPass - This pass finds all single entry single exit regions

View File

@ -213,7 +213,6 @@ void initializePostDomViewerPass(PassRegistry&);
void initializePostDominatorTreePass(PassRegistry&);
void initializePostRASchedulerPass(PassRegistry&);
void initializePreVerifierPass(PassRegistry&);
void initializePrintDbgInfoPass(PassRegistry&);
void initializePrintFunctionPassPass(PassRegistry&);
void initializePrintModulePassPass(PassRegistry&);
void initializePrintBasicBlockPassPass(PassRegistry&);

View File

@ -152,7 +152,6 @@ namespace {
(void) llvm::createPrintModulePass(0);
(void) llvm::createPrintFunctionPass("", 0);
(void) llvm::createPrintBasicBlockPass(0);
(void) llvm::createDbgInfoPrinterPass();
(void) llvm::createModuleDebugInfoPrinterPass();
(void) llvm::createPartialInliningPass();
(void) llvm::createLintPass();

View File

@ -31,7 +31,6 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeCFGPrinterPass(Registry);
initializeCFGOnlyViewerPass(Registry);
initializeCFGOnlyPrinterPass(Registry);
initializePrintDbgInfoPass(Registry);
initializeDependenceAnalysisPass(Registry);
initializeDominanceFrontierPass(Registry);
initializeDomViewerPass(Registry);

View File

@ -13,7 +13,6 @@ add_llvm_library(LLVMAnalysis
CostModel.cpp
CodeMetrics.cpp
ConstantFolding.cpp
DbgInfoPrinter.cpp
DependenceAnalysis.cpp
DomPrinter.cpp
DominanceFrontier.cpp

View File

@ -1,224 +0,0 @@
//===- DbgInfoPrinter.cpp - Print debug info in a human readable form ------==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements a pass that prints instructions, and associated debug
// info:
//
// - source/line/col information
// - original variable name
// - original type name
//
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/Passes.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/DebugInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
static cl::opt<bool>
PrintDirectory("print-fullpath",
cl::desc("Print fullpath when printing debug info"),
cl::Hidden);
namespace {
class PrintDbgInfo : public FunctionPass {
raw_ostream &Out;
void printVariableDeclaration(const Value *V);
public:
static char ID; // Pass identification
PrintDbgInfo() : FunctionPass(ID), Out(errs()) {
initializePrintDbgInfoPass(*PassRegistry::getPassRegistry());
}
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
};
char PrintDbgInfo::ID = 0;
}
INITIALIZE_PASS(PrintDbgInfo, "print-dbginfo",
"Print debug info in human readable form", false, false)
FunctionPass *llvm::createDbgInfoPrinterPass() { return new PrintDbgInfo(); }
/// Find the debug info descriptor corresponding to this global variable.
static Value *findDbgGlobalDeclare(GlobalVariable *V) {
const Module *M = V->getParent();
NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv");
if (!NMD)
return 0;
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
DIDescriptor DIG(cast<MDNode>(NMD->getOperand(i)));
if (!DIG.isGlobalVariable())
continue;
if (DIGlobalVariable(DIG).getGlobal() == V)
return DIG;
}
return 0;
}
/// Find the debug info descriptor corresponding to this function.
static Value *findDbgSubprogramDeclare(Function *V) {
const Module *M = V->getParent();
NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp");
if (!NMD)
return 0;
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
DIDescriptor DIG(cast<MDNode>(NMD->getOperand(i)));
if (!DIG.isSubprogram())
continue;
if (DISubprogram(DIG).getFunction() == V)
return DIG;
}
return 0;
}
/// Finds the llvm.dbg.declare intrinsic corresponding to this value if any.
/// It looks through pointer casts too.
static const DbgDeclareInst *findDbgDeclare(const Value *V) {
V = V->stripPointerCasts();
if (!isa<Instruction>(V) && !isa<Argument>(V))
return 0;
const Function *F = NULL;
if (const Instruction *I = dyn_cast<Instruction>(V))
F = I->getParent()->getParent();
else if (const Argument *A = dyn_cast<Argument>(V))
F = A->getParent();
for (Function::const_iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
for (BasicBlock::const_iterator BI = (*FI).begin(), BE = (*FI).end();
BI != BE; ++BI)
if (const DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
if (DDI->getAddress() == V)
return DDI;
return 0;
}
static bool getLocationInfo(const Value *V, std::string &DisplayName,
std::string &Type, unsigned &LineNo,
std::string &File, std::string &Dir) {
DICompileUnit Unit;
DIType TypeD;
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(const_cast<Value*>(V))) {
Value *DIGV = findDbgGlobalDeclare(GV);
if (!DIGV) return false;
DIGlobalVariable Var(cast<MDNode>(DIGV));
StringRef D = Var.getDisplayName();
if (!D.empty())
DisplayName = D;
LineNo = Var.getLineNumber();
Unit = Var.getCompileUnit();
TypeD = Var.getType();
} else if (Function *F = dyn_cast<Function>(const_cast<Value*>(V))){
Value *DIF = findDbgSubprogramDeclare(F);
if (!DIF) return false;
DISubprogram Var(cast<MDNode>(DIF));
StringRef D = Var.getDisplayName();
if (!D.empty())
DisplayName = D;
LineNo = Var.getLineNumber();
Unit = Var.getCompileUnit();
TypeD = Var.getType();
} else {
const DbgDeclareInst *DDI = findDbgDeclare(V);
if (!DDI) return false;
DIVariable Var(cast<MDNode>(DDI->getVariable()));
StringRef D = Var.getName();
if (!D.empty())
DisplayName = D;
LineNo = Var.getLineNumber();
Unit = Var.getCompileUnit();
TypeD = Var.getType();
}
StringRef T = TypeD.getName();
if (!T.empty())
Type = T;
StringRef F = Unit.getFilename();
if (!F.empty())
File = F;
StringRef D = Unit.getDirectory();
if (!D.empty())
Dir = D;
return true;
}
void PrintDbgInfo::printVariableDeclaration(const Value *V) {
std::string DisplayName, File, Directory, Type;
unsigned LineNo = 0;
if (!getLocationInfo(V, DisplayName, Type, LineNo, File, Directory))
return;
Out << "; ";
WriteAsOperand(Out, V, false, 0);
if (isa<Function>(V))
Out << " is function " << DisplayName
<< " of type " << Type << " declared at ";
else
Out << " is variable " << DisplayName
<< " of type " << Type << " declared at ";
if (PrintDirectory)
Out << Directory << "/";
Out << File << ":" << LineNo << "\n";
}
bool PrintDbgInfo::runOnFunction(Function &F) {
if (F.isDeclaration())
return false;
Out << "function " << F.getName() << "\n\n";
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
BasicBlock *BB = I;
if (I != F.begin() && (pred_begin(BB) == pred_end(BB)))
// Skip dead blocks.
continue;
Out << BB->getName();
Out << ":";
Out << "\n";
for (BasicBlock::const_iterator i = BB->begin(), e = BB->end();
i != e; ++i) {
printVariableDeclaration(i);
if (const User *U = dyn_cast<User>(i)) {
for(unsigned i=0;i<U->getNumOperands();i++)
printVariableDeclaration(U->getOperand(i));
}
}
}
return false;
}

View File

@ -1,66 +0,0 @@
; RUN: opt < %s -print-dbginfo -disable-output 2>&1 | FileCheck %s
; grep {%b is variable b of type x declared at x.c:7} %t1
; grep {%2 is variable b of type x declared at x.c:7} %t1
; grep {@c.1442 is variable c of type int declared at x.c:4} %t1
%struct.foo = type { i32 }
@main.c = internal global i32 5 ; <i32*> [#uses=1]
define i32 @main() nounwind {
entry:
%retval = alloca i32 ; <i32*> [#uses=3]
%b = alloca %struct.foo, align 4 ; <%struct.foo*> [#uses=2]
; CHECK:; %b is variable b of type foo declared at x.c:7
%a = alloca [4 x i32], align 4 ; <[4 x i32]*> [#uses=1]
; CHECK:; %a is variable a of type declared at x.c:8
call void @llvm.dbg.func.start(metadata !3)
store i32 0, i32* %retval
call void @llvm.dbg.stoppoint(i32 6, i32 3, metadata !1)
call void @llvm.dbg.stoppoint(i32 7, i32 3, metadata !1)
%0 = bitcast %struct.foo* %b to { }* ; <{ }*> [#uses=1]
call void @llvm.dbg.declare(metadata !{%struct.foo* %b}, metadata !4)
; CHECK:; %0 is variable b of type foo declared at x.c:7
call void @llvm.dbg.stoppoint(i32 8, i32 3, metadata !1)
%1 = bitcast [4 x i32]* %a to { }* ; <{ }*> [#uses=1]
call void @llvm.dbg.declare(metadata !{[4 x i32]* %a}, metadata !8)
; CHECK:; %1 is variable a of type declared at x.c:8
call void @llvm.dbg.stoppoint(i32 9, i32 3, metadata !1)
%tmp = getelementptr inbounds %struct.foo* %b, i32 0, i32 0 ; <i32*> [#uses=1]
; CHECK:; %tmp is variable b of type foo declared at x.c:7
store i32 5, i32* %tmp
call void @llvm.dbg.stoppoint(i32 10, i32 3, metadata !1)
%tmp1 = load i32* @main.c ; <i32> [#uses=1]
; CHECK:; @main.c is variable c of type int declared at x.c:6
store i32 %tmp1, i32* %retval
br label %2
; <label>:2 ; preds = %entry
call void @llvm.dbg.stoppoint(i32 11, i32 1, metadata !1)
call void @llvm.dbg.region.end(metadata !3)
%3 = load i32* %retval ; <i32> [#uses=1]
ret i32 %3
}
declare void @llvm.dbg.func.start(metadata) nounwind readnone
declare void @llvm.dbg.stoppoint(i32, i32, metadata) nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
declare void @llvm.dbg.region.end(metadata) nounwind readnone
!llvm.dbg.gv = !{!0}
!0 = metadata !{i32 458804, i32 0, metadata !1, metadata !"c", metadata !"c", metadata !"", metadata !1, i32 6, metadata !2, i1 true, i1 true, i32* @main.c}
!1 = metadata !{i32 458769, i32 0, i32 12, metadata !"x.c", metadata !"/home/edwin/llvm-git/llvm/test/DebugInfo", metadata !"clang 1.0", i1 true, i1 false, metadata !"", i32 0}
!2 = metadata !{i32 458788, metadata !1, metadata !"int", metadata !1, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5}
!3 = metadata !{i32 458798, i32 0, metadata !1, metadata !"main", metadata !"main", metadata !"main", metadata !1, i32 5, metadata !2, i1 false, i1 true}
!4 = metadata !{i32 459008, metadata !3, metadata !"b", metadata !1, i32 7, metadata !5}
!5 = metadata !{i32 458771, metadata !1, metadata !"foo", metadata !1, i32 1, i64 32, i64 32, i64 0, i32 0, null, metadata !6, i32 0}
!6 = metadata !{metadata !7}
!7 = metadata !{i32 458765, metadata !1, metadata !"a", metadata !1, i32 2, i64 32, i64 32, i64 0, i32 0, metadata !2}
!8 = metadata !{i32 459008, metadata !3, metadata !"a", metadata !1, i32 8, metadata !9}
!9 = metadata !{i32 458753, metadata !1, metadata !"", null, i32 0, i64 128, i64 32, i64 0, i32 0, metadata !2, metadata !10, i32 0}
!10 = metadata !{metadata !11}
!11 = metadata !{i32 458785, i64 0, i64 3}