diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-12-07 19:36:34 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-12-07 19:36:34 +0000 |
commit | fb7c680b619c077e01929f91a57c7e7c262e19d1 (patch) | |
tree | 885adb64714a1cf5a0afb89c79e8ac7b377adc10 /llvm/lib/Analysis/DebugInfo.cpp | |
parent | b2a568d9e5321b90258af663ac0f7ea9e1292573 (diff) | |
download | bcm5719-llvm-fb7c680b619c077e01929f91a57c7e7c262e19d1.tar.gz bcm5719-llvm-fb7c680b619c077e01929f91a57c7e7c262e19d1.zip |
Introduce the "@llvm.dbg.value" debug intrinsic.
The semantics of llvm.dbg.value are that starting from where it is executed, an offset into the specified user source variable is specified to get a new value.
An example:
call void @llvm.dbg.value(metadata !{ i32 7 }, i64 0, metadata !2)
Here the user source variable associated with metadata #2 gets the value "i32 7" at offset 0.
llvm-svn: 90788
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 4a012ce484f..74d9e1e1794 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/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. |