aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r--lib/Analysis/DebugInfo.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 4a012ce484..74d9e1e179 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -1050,6 +1050,35 @@ Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
return CallInst::Create(DeclareFn, Args, Args+2, "", InsertAtEnd);
}
+/// InsertValue - Insert a new llvm.dbg.value intrinsic call.
+Instruction *DIFactory::InsertValue(Value *V, Value *Offset, DIVariable D,
+ Instruction *InsertBefore) {
+ assert(V && "no value passed to dbg.value");
+ assert(Offset->getType() == Type::getInt64Ty(V->getContext()) &&
+ "offset must be i64");
+ if (!ValueFn)
+ ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
+
+ Value *Elts[] = { V };
+ Value *Args[] = { MDNode::get(V->getContext(), Elts, 1), Offset,
+ D.getNode() };
+ return CallInst::Create(ValueFn, Args, Args+3, "", InsertBefore);
+}
+
+/// InsertValue - Insert a new llvm.dbg.value intrinsic call.
+Instruction *DIFactory::InsertValue(Value *V, Value *Offset, DIVariable D,
+ BasicBlock *InsertAtEnd) {
+ assert(V && "no value passed to dbg.value");
+ assert(Offset->getType() == Type::getInt64Ty(V->getContext()) &&
+ "offset must be i64");
+ if (!ValueFn)
+ ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
+
+ Value *Elts[] = { V };
+ Value *Args[] = { MDNode::get(V->getContext(), Elts, 1), Offset,
+ D.getNode() };
+ return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd);
+}
//===----------------------------------------------------------------------===//
// DebugInfoFinder implementations.