[llvm-commits] [llvm] r99984 - in /llvm/trunk: include/llvm/Support/IRBuilder.h lib/VMCore/IRBuilder.cpp

Chris Lattner sabre at nondot.org
Tue Mar 30 21:09:11 PDT 2010


Author: lattner
Date: Tue Mar 30 23:09:11 2010
New Revision: 99984

URL: http://llvm.org/viewvc/llvm-project?rev=99984&view=rev
Log:
make irbuilder use the new optimized debug info accessors.

Modified:
    llvm/trunk/include/llvm/Support/IRBuilder.h
    llvm/trunk/lib/VMCore/IRBuilder.cpp

Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=99984&r1=99983&r2=99984&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Mar 30 23:09:11 2010
@@ -40,7 +40,6 @@
 
 /// IRBuilderBase - Common base class shared among various IRBuilders.
 class IRBuilderBase {
-  unsigned DbgMDKind;
   MDNode *CurDbgLocation;
 protected:
   BasicBlock *BB;
@@ -49,7 +48,7 @@
 public:
   
   IRBuilderBase(LLVMContext &context)
-    : DbgMDKind(0), CurDbgLocation(0), Context(context) {
+    : CurDbgLocation(0), Context(context) {
     ClearInsertionPoint();
   }
   
@@ -82,12 +81,20 @@
   
   /// 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.

Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=99984&r1=99983&r2=99984&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/IRBuilder.cpp (original)
+++ llvm/trunk/lib/VMCore/IRBuilder.cpp Tue Mar 30 23:09:11 2010
@@ -32,19 +32,6 @@
   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();





More information about the llvm-commits mailing list