Expand api out in the usual inserter way, though, I do have a
authorMike Stump <mrs@apple.com>
Thu, 1 Oct 2009 22:08:58 +0000 (22:08 +0000)
committerMike Stump <mrs@apple.com>
Thu, 1 Oct 2009 22:08:58 +0000 (22:08 +0000)
question, can we get rid of the BasicBlock versions of all inserters
and use Head == 0 to indicate the old case when GetInsertBlock == 0?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83216 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/Analysis/DebugInfo.cpp

index d19cd0b228d15570bebd6fde475f64d79192056c..53c5120de064f1f414cb7615dc1ac9d73e98ff27 100644 (file)
@@ -592,7 +592,12 @@ namespace llvm {
     void InsertRegionEnd(DIDescriptor D, BasicBlock *BB);
 
     /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
-    void InsertDeclare(llvm::Value *Storage, DIVariable D, BasicBlock *BB);
+    void InsertDeclare(llvm::Value *Storage, DIVariable D,
+                       BasicBlock *InsertAtEnd);
+
+    /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
+    void InsertDeclare(llvm::Value *Storage, DIVariable D,
+                       Instruction *InsertBefore);
 
   private:
     Constant *GetTagConstant(unsigned TAG);
index 6b13e74a739c2508d81499837a2cbc01d12b5d21..1d6e3a6e44efd27b4aa9195c4f66561528526cc5 100644 (file)
@@ -933,15 +933,29 @@ void DIFactory::InsertRegionEnd(DIDescriptor D, BasicBlock *BB) {
 }
 
 /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
-void DIFactory::InsertDeclare(Value *Storage, DIVariable D, BasicBlock *BB) {
+void DIFactory::InsertDeclare(Value *Storage, DIVariable D,
+                              Instruction *InsertBefore) {
   // Cast the storage to a {}* for the call to llvm.dbg.declare.
-  Storage = new BitCastInst(Storage, EmptyStructPtr, "", BB);
+  Storage = new BitCastInst(Storage, EmptyStructPtr, "", InsertBefore);
 
   if (!DeclareFn)
     DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
 
   Value *Args[] = { Storage, D.getNode() };
-  CallInst::Create(DeclareFn, Args, Args+2, "", BB);
+  CallInst::Create(DeclareFn, Args, Args+2, "", InsertBefore);
+}
+
+/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
+void DIFactory::InsertDeclare(Value *Storage, DIVariable D,
+                              BasicBlock *InsertAtEnd) {
+  // Cast the storage to a {}* for the call to llvm.dbg.declare.
+  Storage = new BitCastInst(Storage, EmptyStructPtr, "", InsertAtEnd);
+
+  if (!DeclareFn)
+    DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
+
+  Value *Args[] = { Storage, D.getNode() };
+  CallInst::Create(DeclareFn, Args, Args+2, "", InsertAtEnd);
 }