[llvm-commits] [llvm] r93149 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h include/llvm/IntrinsicInst.h lib/Analysis/DebugInfo.cpp lib/VMCore/IntrinsicInst.cpp
Victor Hernandez
vhernandez at apple.com
Sun Jan 10 23:45:19 PST 2010
Author: hernande
Date: Mon Jan 11 01:45:19 2010
New Revision: 93149
URL: http://llvm.org/viewvc/llvm-project?rev=93149&view=rev
Log:
Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().
Modified:
llvm/trunk/include/llvm/Analysis/DebugInfo.h
llvm/trunk/include/llvm/IntrinsicInst.h
llvm/trunk/lib/Analysis/DebugInfo.cpp
llvm/trunk/lib/VMCore/IntrinsicInst.cpp
Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=93149&r1=93148&r2=93149&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Jan 11 01:45:19 2010
@@ -647,11 +647,11 @@
Instruction *InsertBefore);
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
- Instruction *InsertDbgValueIntrinsic(llvm::Value *V, llvm::Value *Offset,
+ Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
DIVariable D, BasicBlock *InsertAtEnd);
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
- Instruction *InsertDbgValueIntrinsic(llvm::Value *V, llvm::Value *Offset,
+ Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
DIVariable D, Instruction *InsertBefore);
private:
Constant *GetTagConstant(unsigned TAG);
Modified: llvm/trunk/include/llvm/IntrinsicInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicInst.h?rev=93149&r1=93148&r2=93149&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IntrinsicInst.h (original)
+++ llvm/trunk/include/llvm/IntrinsicInst.h Mon Jan 11 01:45:19 2010
@@ -99,9 +99,14 @@
///
class DbgValueInst : public DbgInfoIntrinsic {
public:
- Value *getValue() const;
- Value *getOffset() const { return getOperand(2); }
- MDNode *getVariable() const { return cast<MDNode>(getOperand(3)); }
+ const Value *getValue() const;
+ Value *getValue();
+ uint64_t getOffset() const {
+ return cast<ConstantInt>(
+ const_cast<Value*>(getOperand(2)))->getZExtValue();
+ }
+ const MDNode *getVariable() const { return cast<MDNode>(getOperand(3)); }
+ MDNode *getVariable() { return cast<MDNode>(getOperand(3)); }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const DbgValueInst *) { return true; }
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=93149&r1=93148&r2=93149&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Jan 11 01:45:19 2010
@@ -1033,7 +1033,7 @@
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
- Instruction *InsertBefore) {
+ Instruction *InsertBefore) {
// Cast the storage to a {}* for the call to llvm.dbg.declare.
Storage = new BitCastInst(Storage, EmptyStructPtr, "", InsertBefore);
@@ -1046,7 +1046,7 @@
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd) {
// Cast the storage to a {}* for the call to llvm.dbg.declare.
Storage = new BitCastInst(Storage, EmptyStructPtr, "", InsertAtEnd);
@@ -1058,31 +1058,31 @@
}
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
-Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, Value *Offset,
+Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, uint64_t Offset,
DIVariable D,
Instruction *InsertBefore) {
assert(V && "no value passed to dbg.value");
- assert(Offset->getType()->isInteger(64) && "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,
+ Value *Args[] = { MDNode::get(V->getContext(), Elts, 1),
+ ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
D.getNode() };
return CallInst::Create(ValueFn, Args, Args+3, "", InsertBefore);
}
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
-Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, Value *Offset,
+Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, uint64_t Offset,
DIVariable D,
BasicBlock *InsertAtEnd) {
assert(V && "no value passed to dbg.value");
- assert(Offset->getType()->isInteger(64) && "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,
+ Value *Args[] = { MDNode::get(V->getContext(), Elts, 1),
+ ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
D.getNode() };
return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd);
}
Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=93149&r1=93148&r2=93149&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original)
+++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Mon Jan 11 01:45:19 2010
@@ -54,6 +54,10 @@
/// DbgValueInst - This represents the llvm.dbg.value instruction.
///
-Value *DbgValueInst::getValue() const {
+const Value *DbgValueInst::getValue() const {
+ return cast<MDNode>(getOperand(1))->getOperand(0);
+}
+
+Value *DbgValueInst::getValue() {
return cast<MDNode>(getOperand(1))->getOperand(0);
}
More information about the llvm-commits
mailing list