OSDN Git Service

make irbuilder use the new optimized debug info accessors.
authorChris Lattner <sabre@nondot.org>
Wed, 31 Mar 2010 04:09:11 +0000 (04:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 31 Mar 2010 04:09:11 +0000 (04:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99984 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/IRBuilder.h
lib/VMCore/IRBuilder.cpp

index 1f4e598..acda93b 100644 (file)
@@ -40,7 +40,6 @@ protected:
 
 /// IRBuilderBase - Common base class shared among various IRBuilders.
 class IRBuilderBase {
-  unsigned DbgMDKind;
   MDNode *CurDbgLocation;
 protected:
   BasicBlock *BB;
@@ -49,7 +48,7 @@ protected:
 public:
   
   IRBuilderBase(LLVMContext &context)
-    : DbgMDKind(0), CurDbgLocation(0), Context(context) {
+    : CurDbgLocation(0), Context(context) {
     ClearInsertionPoint();
   }
   
@@ -82,12 +81,20 @@ public:
   
   /// SetCurrentDebugLocation - Set location information used by debugging
   /// information.
-  void SetCurrentDebugLocation(MDNode *L);
+  void SetCurrentDebugLocation(MDNode *L) {
+    CurDbgLocation = L;
+  }
+  
+  /// SetCurrentDebugLocation - Set location information used by debugging
+  /// information.
   MDNode *getCurrentDebugLocation() const { return CurDbgLocation; }
   
   /// SetInstDebugLocation - If this builder has a current debug location, set
   /// it on the specified instruction.
-  void SetInstDebugLocation(Instruction *I) const;
+  void SetInstDebugLocation(Instruction *I) const {
+    if (CurDbgLocation)
+      I->setDbgMetadata(CurDbgLocation);
+  }
 
   //===--------------------------------------------------------------------===//
   // Miscellaneous creation methods.
index 9f2786e..c1b783c 100644 (file)
@@ -32,19 +32,6 @@ Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) {
   return GV;
 }
 
-/// SetCurrentDebugLocation - Set location information used by debugging
-/// information.
-void IRBuilderBase::SetCurrentDebugLocation(MDNode *L) {
-  if (DbgMDKind == 0) 
-    DbgMDKind = Context.getMDKindID("dbg");
-  CurDbgLocation = L;
-}
-
-void IRBuilderBase::SetInstDebugLocation(Instruction *I) const {
-  if (CurDbgLocation)
-    I->setMetadata(DbgMDKind, CurDbgLocation);
-}
-
 const Type *IRBuilderBase::getCurrentFunctionReturnType() const {
   assert(BB && BB->getParent() && "No current function!");
   return BB->getParent()->getReturnType();