summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-07-23 00:22:51 +0000
committerManman Ren <manman.ren@gmail.com>2013-07-23 00:22:51 +0000
commit0e29eeec278d80048de6cf6605e004bbdefaf38c (patch)
treee75b7471e00d617b8ab62811a5341594e65df088 /lib
parentaf1d08782b0f9c60c2504e39dda160a784d1ed1e (diff)
downloadllvm-0e29eeec278d80048de6cf6605e004bbdefaf38c.tar.gz
llvm-0e29eeec278d80048de6cf6605e004bbdefaf38c.tar.bz2
llvm-0e29eeec278d80048de6cf6605e004bbdefaf38c.tar.xz
Debug Info Finder: use processDeclare and processValue to list debug info
MDNodes used by DbgDeclareInst and DbgValueInst. Another 16 testing cases failed and they are disabled with -disable-debug-info-verifier. A total of 34 cases are disabled with -disable-debug-info-verifier and will be corrected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/IR/DebugInfo.cpp22
-rw-r--r--lib/IR/Verifier.cpp15
2 files changed, 36 insertions, 1 deletions
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index f63fa1a22d..9d88ce0e50 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -847,6 +847,15 @@ bool llvm::isSubprogramContext(const MDNode *Context) {
// DebugInfoFinder implementations.
//===----------------------------------------------------------------------===//
+void DebugInfoFinder::reset() {
+ CUs.clear();
+ SPs.clear();
+ GVs.clear();
+ TYs.clear();
+ Scopes.clear();
+ NodesSeen.clear();
+}
+
/// processModule - Process entire module and collect debug info.
void DebugInfoFinder::processModule(const Module &M) {
if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu")) {
@@ -970,6 +979,19 @@ void DebugInfoFinder::processDeclare(const DbgDeclareInst *DDI) {
processType(DIVariable(N).getType());
}
+void DebugInfoFinder::processValue(const DbgValueInst *DVI) {
+ MDNode *N = dyn_cast<MDNode>(DVI->getVariable());
+ if (!N) return;
+
+ DIDescriptor DV(N);
+ if (!DV.isVariable())
+ return;
+
+ if (!NodesSeen.insert(DV))
+ return;
+ processType(DIVariable(N).getType());
+}
+
/// addType - Add type into Tys.
bool DebugInfoFinder::addType(DIType DT) {
if (!DT.isValid())
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index fa53a4ee69..b22d211772 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -147,6 +147,9 @@ namespace {
/// the same personality function.
const Value *PersonalityFn;
+ /// Finder keeps track of all debug info MDNodes in a Module.
+ DebugInfoFinder Finder;
+
Verifier()
: FunctionPass(ID), Broken(false),
action(AbortProcessAction), Mod(0), Context(0), DT(0),
@@ -162,6 +165,7 @@ namespace {
bool doInitialization(Module &M) {
Mod = &M;
Context = &M.getContext();
+ Finder.reset();
// We must abort before returning back to the pass manager, or else the
// pass manager may try to run other passes on the broken module.
@@ -2144,7 +2148,17 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
MDNode *MD = cast<MDNode>(CI.getArgOperand(0));
Assert1(MD->getNumOperands() == 1,
"invalid llvm.dbg.declare intrinsic call 2", &CI);
+ if (!DisableDebugInfoVerifier)
+ Finder.processDeclare(cast<DbgDeclareInst>(&CI));
} break;
+ case Intrinsic::dbg_value: { //llvm.dbg.value
+ if (!DisableDebugInfoVerifier) {
+ Assert1(CI.getArgOperand(0) && isa<MDNode>(CI.getArgOperand(0)),
+ "invalid llvm.dbg.value intrinsic call 1", &CI);
+ Finder.processValue(cast<DbgValueInst>(&CI));
+ }
+ break;
+ }
case Intrinsic::memcpy:
case Intrinsic::memmove:
case Intrinsic::memset:
@@ -2209,7 +2223,6 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
void Verifier::verifyDebugInfo(Module &M) {
// Verify Debug Info.
if (!DisableDebugInfoVerifier) {
- DebugInfoFinder Finder;
Finder.processModule(M);
for (DebugInfoFinder::iterator I = Finder.compile_unit_begin(),