mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
move debug info stuff out of line, allowing two #includes
to go away from IRBuilder.h llvm-svn: 92230
This commit is contained in:
parent
e0b9847223
commit
e70c40e8ac
@ -18,12 +18,11 @@
|
|||||||
#include "llvm/Constants.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/Metadata.h"
|
|
||||||
#include "llvm/LLVMContext.h"
|
|
||||||
#include "llvm/ADT/Twine.h"
|
#include "llvm/ADT/Twine.h"
|
||||||
#include "llvm/Support/ConstantFolder.h"
|
#include "llvm/Support/ConstantFolder.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class MDNode;
|
||||||
|
|
||||||
/// IRBuilderDefaultInserter - This provides the default implementation of the
|
/// IRBuilderDefaultInserter - This provides the default implementation of the
|
||||||
/// IRBuilder 'InsertHelper' method that is called whenever an instruction is
|
/// IRBuilder 'InsertHelper' method that is called whenever an instruction is
|
||||||
@ -42,11 +41,11 @@ protected:
|
|||||||
|
|
||||||
/// IRBuilderBase - Common base class shared among various IRBuilders.
|
/// IRBuilderBase - Common base class shared among various IRBuilders.
|
||||||
class IRBuilderBase {
|
class IRBuilderBase {
|
||||||
|
unsigned DbgMDKind;
|
||||||
|
MDNode *CurDbgLocation;
|
||||||
protected:
|
protected:
|
||||||
BasicBlock *BB;
|
BasicBlock *BB;
|
||||||
BasicBlock::iterator InsertPt;
|
BasicBlock::iterator InsertPt;
|
||||||
unsigned DbgMDKind;
|
|
||||||
MDNode *CurDbgLocation;
|
|
||||||
LLVMContext &Context;
|
LLVMContext &Context;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -84,26 +83,12 @@ public:
|
|||||||
|
|
||||||
/// SetCurrentDebugLocation - Set location information used by debugging
|
/// SetCurrentDebugLocation - Set location information used by debugging
|
||||||
/// information.
|
/// information.
|
||||||
void SetCurrentDebugLocation(MDNode *L) {
|
void SetCurrentDebugLocation(MDNode *L);
|
||||||
if (DbgMDKind == 0)
|
|
||||||
DbgMDKind = Context.getMetadata().getMDKindID("dbg");
|
|
||||||
CurDbgLocation = L;
|
|
||||||
}
|
|
||||||
|
|
||||||
MDNode *getCurrentDebugLocation() const { return CurDbgLocation; }
|
MDNode *getCurrentDebugLocation() const { return CurDbgLocation; }
|
||||||
|
|
||||||
/// SetDebugLocation - Set location information for the given instruction.
|
/// SetInstDebugLocation - If this builder has a current debug location, set
|
||||||
void SetDebugLocation(Instruction *I) {
|
/// it on the specified instruction.
|
||||||
if (CurDbgLocation)
|
void SetInstDebugLocation(Instruction *I) const;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Miscellaneous creation methods.
|
// Miscellaneous creation methods.
|
||||||
@ -216,8 +201,8 @@ public:
|
|||||||
template<typename InstTy>
|
template<typename InstTy>
|
||||||
InstTy *Insert(InstTy *I, const Twine &Name = "") const {
|
InstTy *Insert(InstTy *I, const Twine &Name = "") const {
|
||||||
this->InsertHelper(I, Name, BB, InsertPt);
|
this->InsertHelper(I, Name, BB, InsertPt);
|
||||||
if (CurDbgLocation)
|
if (getCurrentDebugLocation() != 0)
|
||||||
Context.getMetadata().addMD(DbgMDKind, CurDbgLocation, I);
|
this->SetInstDebugLocation(I);
|
||||||
return I;
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "llvm-c/Target.h"
|
#include "llvm-c/Target.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
|
#include "llvm/LLVMContext.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#include "llvm/Support/IRBuilder.h"
|
#include "llvm/Support/IRBuilder.h"
|
||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
|
#include "llvm/Metadata.h"
|
||||||
|
#include "llvm/LLVMContext.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
/// CreateGlobalString - Make a new global variable with an initializer that
|
/// CreateGlobalString - Make a new global variable with an initializer that
|
||||||
@ -29,3 +31,16 @@ Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) {
|
|||||||
GV->setName(Name);
|
GV->setName(Name);
|
||||||
return GV;
|
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);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user