Remove dead debug info intrinsics.

Intrinsic::dbg_stoppoint
 Intrinsic::dbg_region_start 
 Intrinsic::dbg_region_end 
 Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2010-01-05 01:10:40 +00:00
parent 4361bbfd0e
commit 44a29e066a
17 changed files with 19 additions and 483 deletions

View File

@@ -37,8 +37,6 @@ PrintDirectory("print-fullpath",
namespace {
class PrintDbgInfo : public FunctionPass {
raw_ostream &Out;
void printStopPoint(const DbgStopPointInst *DSI);
void printFuncStart(const DbgFuncStartInst *FS);
void printVariableDeclaration(const Value *V);
public:
static char ID; // Pass identification
@@ -74,27 +72,6 @@ void PrintDbgInfo::printVariableDeclaration(const Value *V) {
Out << File << ":" << LineNo << "\n";
}
void PrintDbgInfo::printStopPoint(const DbgStopPointInst *DSI) {
if (PrintDirectory)
if (MDString *Str = dyn_cast<MDString>(DSI->getDirectory()))
Out << Str->getString() << '/';
if (MDString *Str = dyn_cast<MDString>(DSI->getFileName()))
Out << Str->getString();
Out << ':' << DSI->getLine();
if (unsigned Col = DSI->getColumn())
Out << ':' << Col;
}
void PrintDbgInfo::printFuncStart(const DbgFuncStartInst *FS) {
DISubprogram Subprogram(FS->getSubprogram());
Out << "; fully qualified function name: " << Subprogram.getDisplayName()
<< " return type: " << Subprogram.getReturnTypeName()
<< " at line " << Subprogram.getLineNumber()
<< "\n\n";
}
bool PrintDbgInfo::runOnFunction(Function &F) {
if (F.isDeclaration())
return false;
@@ -108,57 +85,21 @@ bool PrintDbgInfo::runOnFunction(Function &F) {
// Skip dead blocks.
continue;
const DbgStopPointInst *DSI = findBBStopPoint(BB);
Out << BB->getName();
Out << ":";
if (DSI) {
Out << "; (";
printStopPoint(DSI);
Out << ")";
}
Out << "\n";
// A dbgstoppoint's information is valid until we encounter a new one.
const DbgStopPointInst *LastDSP = DSI;
bool Printed = DSI != 0;
for (BasicBlock::const_iterator i = BB->begin(), e = BB->end();
i != e; ++i) {
if (isa<DbgInfoIntrinsic>(i)) {
if ((DSI = dyn_cast<DbgStopPointInst>(i))) {
if (DSI->getContext() == LastDSP->getContext() &&
DSI->getLineValue() == LastDSP->getLineValue() &&
DSI->getColumnValue() == LastDSP->getColumnValue())
// Don't print same location twice.
continue;
LastDSP = cast<DbgStopPointInst>(i);
// Don't print consecutive stoppoints, use a flag to know which one we
// printed.
Printed = false;
} else if (const DbgFuncStartInst *FS = dyn_cast<DbgFuncStartInst>(i)) {
printFuncStart(FS);
}
} else {
if (!Printed && LastDSP) {
Out << "; ";
printStopPoint(LastDSP);
Out << "\n";
Printed = true;
}
Out << *i << '\n';
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

@@ -1242,52 +1242,6 @@ bool DebugInfoFinder::addSubprogram(DISubprogram SP) {
return true;
}
/// findStopPoint - Find the stoppoint coressponding to this instruction, that
/// is the stoppoint that dominates this instruction.
const DbgStopPointInst *llvm::findStopPoint(const Instruction *Inst) {
if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(Inst))
return DSI;
const BasicBlock *BB = Inst->getParent();
BasicBlock::const_iterator I = Inst, B;
while (BB) {
B = BB->begin();
// A BB consisting only of a terminator can't have a stoppoint.
while (I != B) {
--I;
if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(I))
return DSI;
}
// This BB didn't have a stoppoint: if there is only one predecessor, look
// for a stoppoint there. We could use getIDom(), but that would require
// dominator info.
BB = I->getParent()->getUniquePredecessor();
if (BB)
I = BB->getTerminator();
}
return 0;
}
/// findBBStopPoint - Find the stoppoint corresponding to first real
/// (non-debug intrinsic) instruction in this Basic Block, and return the
/// stoppoint for it.
const DbgStopPointInst *llvm::findBBStopPoint(const BasicBlock *BB) {
for(BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
if (const DbgStopPointInst *DSI = dyn_cast<DbgStopPointInst>(I))
return DSI;
// Fallback to looking for stoppoint of unique predecessor. Useful if this
// BB contains no stoppoints, but unique predecessor does.
BB = BB->getUniquePredecessor();
if (BB)
return findStopPoint(BB->getTerminator());
return 0;
}
Value *llvm::findDbgGlobalDeclare(GlobalVariable *V) {
const Module *M = V->getParent();
NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv");
@@ -1371,29 +1325,6 @@ bool llvm::getLocationInfo(const Value *V, std::string &DisplayName,
return true;
}
/// ExtractDebugLocation - Extract debug location information
/// from llvm.dbg.stoppoint intrinsic.
DebugLoc llvm::ExtractDebugLocation(DbgStopPointInst &SPI,
DebugLocTracker &DebugLocInfo) {
DebugLoc DL;
Value *Context = SPI.getContext();
// If this location is already tracked then use it.
DebugLocTuple Tuple(cast<MDNode>(Context), NULL, SPI.getLine(),
SPI.getColumn());
DenseMap<DebugLocTuple, unsigned>::iterator II
= DebugLocInfo.DebugIdMap.find(Tuple);
if (II != DebugLocInfo.DebugIdMap.end())
return DebugLoc::get(II->second);
// Add a new location entry.
unsigned Id = DebugLocInfo.DebugLocations.size();
DebugLocInfo.DebugLocations.push_back(Tuple);
DebugLocInfo.DebugIdMap[Tuple] = Id;
return DebugLoc::get(Id);
}
/// ExtractDebugLocation - Extract debug location information
/// from DILocation.
DebugLoc llvm::ExtractDebugLocation(DILocation &Loc,
@@ -1419,32 +1350,6 @@ DebugLoc llvm::ExtractDebugLocation(DILocation &Loc,
return DebugLoc::get(Id);
}
/// ExtractDebugLocation - Extract debug location information
/// from llvm.dbg.func_start intrinsic.
DebugLoc llvm::ExtractDebugLocation(DbgFuncStartInst &FSI,
DebugLocTracker &DebugLocInfo) {
DebugLoc DL;
Value *SP = FSI.getSubprogram();
DISubprogram Subprogram(cast<MDNode>(SP));
unsigned Line = Subprogram.getLineNumber();
DICompileUnit CU(Subprogram.getCompileUnit());
// If this location is already tracked then use it.
DebugLocTuple Tuple(CU.getNode(), NULL, Line, /* Column */ 0);
DenseMap<DebugLocTuple, unsigned>::iterator II
= DebugLocInfo.DebugIdMap.find(Tuple);
if (II != DebugLocInfo.DebugIdMap.end())
return DebugLoc::get(II->second);
// Add a new location entry.
unsigned Id = DebugLocInfo.DebugLocations.size();
DebugLocInfo.DebugLocations.push_back(Tuple);
DebugLocInfo.DebugIdMap[Tuple] = Id;
return DebugLoc::get(Id);
}
/// getDISubprogram - Find subprogram that is enclosing this scope.
DISubprogram llvm::getDISubprogram(MDNode *Scope) {
DIDescriptor D(Scope);