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

Chris Lattner sabre at nondot.org
Mon Dec 28 13:45:40 PST 2009


Author: lattner
Date: Mon Dec 28 15:45:40 2009
New Revision: 92230

URL: http://llvm.org/viewvc/llvm-project?rev=92230&view=rev
Log:
move debug info stuff out of line, allowing two #includes
to go away from IRBuilder.h

Modified:
    llvm/trunk/include/llvm/Support/IRBuilder.h
    llvm/trunk/lib/Target/Target.cpp
    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=92230&r1=92229&r2=92230&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Mon Dec 28 15:45:40 2009
@@ -18,12 +18,11 @@
 #include "llvm/Constants.h"
 #include "llvm/Instructions.h"
 #include "llvm/Function.h"
-#include "llvm/Metadata.h"
-#include "llvm/LLVMContext.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ConstantFolder.h"
 
 namespace llvm {
+  class MDNode;
 
 /// IRBuilderDefaultInserter - This provides the default implementation of the
 /// IRBuilder 'InsertHelper' method that is called whenever an instruction is
@@ -42,11 +41,11 @@
 
 /// IRBuilderBase - Common base class shared among various IRBuilders.
 class IRBuilderBase {
+  unsigned DbgMDKind;
+  MDNode *CurDbgLocation;
 protected:
   BasicBlock *BB;
   BasicBlock::iterator InsertPt;
-  unsigned DbgMDKind;
-  MDNode *CurDbgLocation;
   LLVMContext &Context;
 public:
   
@@ -84,27 +83,13 @@
   
   /// SetCurrentDebugLocation - Set location information used by debugging
   /// information.
-  void SetCurrentDebugLocation(MDNode *L) {
-    if (DbgMDKind == 0) 
-      DbgMDKind = Context.getMetadata().getMDKindID("dbg");
-    CurDbgLocation = L;
-  }
-  
+  void SetCurrentDebugLocation(MDNode *L);
   MDNode *getCurrentDebugLocation() const { return CurDbgLocation; }
   
-  /// SetDebugLocation -  Set location information for the given instruction.
-  void SetDebugLocation(Instruction *I) {
-    if (CurDbgLocation)
-      Context.getMetadata().addMD(DbgMDKind, CurDbgLocation, I);
-  }
-  
-  /// SetDebugLocation -  Set location information for the given instruction.
-  void SetDebugLocation(Instruction *I, MDNode *Loc) {
-    if (DbgMDKind == 0) 
-      DbgMDKind = Context.getMetadata().getMDKindID("dbg");
-    Context.getMetadata().addMD(DbgMDKind, Loc, I);
-  }
-  
+  /// SetInstDebugLocation - If this builder has a current debug location, set
+  /// it on the specified instruction.
+  void SetInstDebugLocation(Instruction *I) const;
+
   //===--------------------------------------------------------------------===//
   // Miscellaneous creation methods.
   //===--------------------------------------------------------------------===//
@@ -216,8 +201,8 @@
   template<typename InstTy>
   InstTy *Insert(InstTy *I, const Twine &Name = "") const {
     this->InsertHelper(I, Name, BB, InsertPt);
-    if (CurDbgLocation)
-      Context.getMetadata().addMD(DbgMDKind, CurDbgLocation, I);
+    if (getCurrentDebugLocation() != 0)
+      this->SetInstDebugLocation(I);
     return I;
   }
 

Modified: llvm/trunk/lib/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.cpp?rev=92230&r1=92229&r2=92230&view=diff

==============================================================================
--- llvm/trunk/lib/Target/Target.cpp (original)
+++ llvm/trunk/lib/Target/Target.cpp Mon Dec 28 15:45:40 2009
@@ -15,6 +15,7 @@
 #include "llvm-c/Target.h"
 #include "llvm/PassManager.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/LLVMContext.h"
 #include <cstring>
 
 using namespace llvm;

Modified: llvm/trunk/lib/VMCore/IRBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IRBuilder.cpp?rev=92230&r1=92229&r2=92230&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/IRBuilder.cpp (original)
+++ llvm/trunk/lib/VMCore/IRBuilder.cpp Mon Dec 28 15:45:40 2009
@@ -14,6 +14,8 @@
 
 #include "llvm/Support/IRBuilder.h"
 #include "llvm/GlobalVariable.h"
+#include "llvm/Metadata.h"
+#include "llvm/LLVMContext.h"
 using namespace llvm;
 
 /// CreateGlobalString - Make a new global variable with an initializer that
@@ -29,3 +31,16 @@
   GV->setName(Name);
   return GV;
 }
+
+/// SetCurrentDebugLocation - Set location information used by debugging
+/// information.
+void IRBuilderBase::SetCurrentDebugLocation(MDNode *L) {
+  if (DbgMDKind == 0) 
+    DbgMDKind = Context.getMetadata().getMDKindID("dbg");
+  CurDbgLocation = L;
+}
+
+void IRBuilderBase::SetInstDebugLocation(Instruction *I) const {
+  if (CurDbgLocation)
+    Context.getMetadata().addMD(DbgMDKind, CurDbgLocation, I);
+}





More information about the llvm-commits mailing list