[llvm-commits] [llvm-gcc-4.2] r83430 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-debug.cpp llvm-debug.h
Devang Patel
dpatel at apple.com
Tue Oct 6 16:14:05 PDT 2009
Author: dpatel
Date: Tue Oct 6 18:14:03 2009
New Revision: 83430
URL: http://llvm.org/viewvc/llvm-project?rev=83430&view=rev
Log:
Add support to attach debug info to an instruction.
This is not yet enabled.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
llvm-gcc-4.2/trunk/gcc/llvm-debug.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=83430&r1=83429&r2=83430&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Oct 6 18:14:03 2009
@@ -695,7 +695,7 @@
}
}
if (TheDebugInfo) {
- TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock());
+ TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
TheDebugInfo->EmitFunctionEnd(Builder.GetInsertBlock(), true);
}
if (RetVals.empty())
@@ -792,7 +792,7 @@
TheDebugInfo->setLocationLine(EXPR_LINENO(exp));
}
- TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock());
+ TheDebugInfo->EmitStopPoint(Fn, Builder.GetInsertBlock(), Builder);
}
switch (TREE_CODE(exp)) {
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=83430&r1=83429&r2=83430&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Tue Oct 6 18:14:03 2009
@@ -250,8 +250,9 @@
Fn->hasInternalLinkage(),
true /*definition*/);
+#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
DebugFactory.InsertSubprogramStart(SP, CurBB);
-
+#endif
// Push function on region stack.
RegionStack.push_back(SP);
RegionMap[FnDecl] = SP;
@@ -292,7 +293,9 @@
/// region - "llvm.dbg.region.end."
void DebugInfo::EmitFunctionEnd(BasicBlock *CurBB, bool EndFunction) {
assert(!RegionStack.empty() && "Region stack mismatch, stack empty!");
+#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
DebugFactory.InsertRegionEnd(RegionStack.back(), CurBB);
+#endif
RegionStack.pop_back();
// Blocks get erased; clearing these is needed for determinism, and also
// a good idea if the next function gets inlined.
@@ -356,8 +359,8 @@
/// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of
/// source line - "llvm.dbg.stoppoint." Now enabled at -O.
-void DebugInfo::EmitStopPoint(Function *Fn, BasicBlock *CurBB) {
-
+void DebugInfo::EmitStopPoint(Function *Fn, BasicBlock *CurBB,
+ LLVMBuilder &Builder) {
// Don't bother if things are the same as last time.
if (PrevLineNo == CurLineNo &&
PrevBB == CurBB &&
@@ -373,10 +376,20 @@
// Don't set/allow source line breakpoints in Apple Block prologue code
// or in Apple Block helper functions.
if (!isPartOfAppleBlockPrologue(CurLineNo)
- && !isCopyOrDestroyHelper(cfun->decl))
+ && !isCopyOrDestroyHelper(cfun->decl)) {
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+ llvm::DIDescriptor DR = RegionStack.back();
+ llvm::DIScope DS = llvm::DIScope(DR.getNode());
+ llvm::DILocation DO(NULL);
+ llvm::DILocation DL =
+ DebugFactory.CreateLocation(CurLineNo, 0 /* column */, DS, DO);
+ Builder.SetCurrentDebugLocation(DL.getNode());
+#else
DebugFactory.InsertStopPoint(getOrCreateCompileUnit(CurFullPath),
CurLineNo, 0 /*column no. */,
CurBB);
+#endif
+ }
}
/// EmitGlobalVariable - Emit information about a global variable.
Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=83430&r1=83429&r2=83430&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Tue Oct 6 18:14:03 2009
@@ -28,6 +28,7 @@
#ifndef LLVM_DEBUG_H
#define LLVM_DEBUG_H
+#include "llvm-internal.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ValueHandle.h"
@@ -96,7 +97,7 @@
/// EmitStopPoint - Emit a call to llvm.dbg.stoppoint to indicate a change of
/// source line.
- void EmitStopPoint(Function *Fn, BasicBlock *CurBB);
+ void EmitStopPoint(Function *Fn, BasicBlock *CurBB, LLVMBuilder &Builder);
/// EmitGlobalVariable - Emit information about a global variable.
///
More information about the llvm-commits
mailing list