forked from OSchip/llvm-project
parent
86f158ccb6
commit
c418d6b106
|
@ -44,7 +44,7 @@ namespace llvm {
|
||||||
class LLVMContext;
|
class LLVMContext;
|
||||||
|
|
||||||
class DIDescriptor {
|
class DIDescriptor {
|
||||||
protected:
|
protected:
|
||||||
MDNode *DbgNode;
|
MDNode *DbgNode;
|
||||||
|
|
||||||
/// DIDescriptor constructor. If the specified node is non-null, check
|
/// DIDescriptor constructor. If the specified node is non-null, check
|
||||||
|
@ -112,7 +112,7 @@ namespace llvm {
|
||||||
/// DIArray - This descriptor holds an array of descriptors.
|
/// DIArray - This descriptor holds an array of descriptors.
|
||||||
class DIArray : public DIDescriptor {
|
class DIArray : public DIDescriptor {
|
||||||
public:
|
public:
|
||||||
explicit DIArray(MDNode *N = 0)
|
explicit DIArray(MDNode *N = 0)
|
||||||
: DIDescriptor(N) {}
|
: DIDescriptor(N) {}
|
||||||
|
|
||||||
unsigned getNumElements() const;
|
unsigned getNumElements() const;
|
||||||
|
@ -158,14 +158,14 @@ namespace llvm {
|
||||||
const std::string &getProducer(std::string &F) const {
|
const std::string &getProducer(std::string &F) const {
|
||||||
return getStringField(5, F);
|
return getStringField(5, F);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
||||||
/// debugging information output. However, many target specific tool chains
|
/// debugging information output. However, many target specific tool chains
|
||||||
/// prefer to encode only one compile unit in an object file. In this
|
/// prefer to encode only one compile unit in an object file. In this
|
||||||
/// situation, the LLVM code generator will include debugging information
|
/// situation, the LLVM code generator will include debugging information
|
||||||
/// entities in the compile unit that is marked as main compile unit. The
|
/// entities in the compile unit that is marked as main compile unit. The
|
||||||
/// code generator accepts maximum one main compile unit per module. If a
|
/// code generator accepts maximum one main compile unit per module. If a
|
||||||
/// module does not contain any main compile unit then the code generator
|
/// module does not contain any main compile unit then the code generator
|
||||||
/// will emit multiple compile units in the output object file.
|
/// will emit multiple compile units in the output object file.
|
||||||
|
|
||||||
bool isMain() const { return getUnsignedField(6); }
|
bool isMain() const { return getUnsignedField(6); }
|
||||||
|
@ -210,7 +210,7 @@ namespace llvm {
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DIType(MDNode *N, unsigned Tag)
|
DIType(MDNode *N, unsigned Tag)
|
||||||
: DIDescriptor(N, Tag) {}
|
: DIDescriptor(N, Tag) {}
|
||||||
// This ctor is used when the Tag has already been validated by a derived
|
// This ctor is used when the Tag has already been validated by a derived
|
||||||
// ctor.
|
// ctor.
|
||||||
|
@ -238,17 +238,17 @@ namespace llvm {
|
||||||
uint64_t getOffsetInBits() const { return getUInt64Field(7); }
|
uint64_t getOffsetInBits() const { return getUInt64Field(7); }
|
||||||
unsigned getFlags() const { return getUnsignedField(8); }
|
unsigned getFlags() const { return getUnsignedField(8); }
|
||||||
bool isPrivate() const {
|
bool isPrivate() const {
|
||||||
return (getFlags() & FlagPrivate) != 0;
|
return (getFlags() & FlagPrivate) != 0;
|
||||||
}
|
}
|
||||||
bool isProtected() const {
|
bool isProtected() const {
|
||||||
return (getFlags() & FlagProtected) != 0;
|
return (getFlags() & FlagProtected) != 0;
|
||||||
}
|
}
|
||||||
bool isForwardDecl() const {
|
bool isForwardDecl() const {
|
||||||
return (getFlags() & FlagFwdDecl) != 0;
|
return (getFlags() & FlagFwdDecl) != 0;
|
||||||
}
|
}
|
||||||
// isAppleBlock - Return true if this is the Apple Blocks extension.
|
// isAppleBlock - Return true if this is the Apple Blocks extension.
|
||||||
bool isAppleBlockExtension() const {
|
bool isAppleBlockExtension() const {
|
||||||
return (getFlags() & FlagAppleBlock) != 0;
|
return (getFlags() & FlagAppleBlock) != 0;
|
||||||
}
|
}
|
||||||
bool isBlockByrefStruct() const {
|
bool isBlockByrefStruct() const {
|
||||||
return (getFlags() & FlagBlockByrefStruct) != 0;
|
return (getFlags() & FlagBlockByrefStruct) != 0;
|
||||||
|
@ -448,8 +448,8 @@ namespace llvm {
|
||||||
|
|
||||||
/// isBlockByrefVariable - Return true if the variable was declared as
|
/// isBlockByrefVariable - Return true if the variable was declared as
|
||||||
/// a "__block" variable (Apple Blocks).
|
/// a "__block" variable (Apple Blocks).
|
||||||
bool isBlockByrefVariable() const {
|
bool isBlockByrefVariable() const {
|
||||||
return getType().isBlockByrefStruct();
|
return getType().isBlockByrefStruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dump - print variable.
|
/// dump - print variable.
|
||||||
|
@ -461,7 +461,7 @@ namespace llvm {
|
||||||
public:
|
public:
|
||||||
explicit DILexicalBlock(MDNode *N = 0) {
|
explicit DILexicalBlock(MDNode *N = 0) {
|
||||||
DbgNode = N;
|
DbgNode = N;
|
||||||
if (DbgNode && !isLexicalBlock())
|
if (DbgNode && !isLexicalBlock())
|
||||||
DbgNode = 0;
|
DbgNode = 0;
|
||||||
}
|
}
|
||||||
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
DIScope getContext() const { return getFieldAs<DIScope>(1); }
|
||||||
|
@ -484,11 +484,11 @@ namespace llvm {
|
||||||
unsigned getColumnNumber() const { return getUnsignedField(1); }
|
unsigned getColumnNumber() const { return getUnsignedField(1); }
|
||||||
DIScope getScope() const { return getFieldAs<DIScope>(3); }
|
DIScope getScope() const { return getFieldAs<DIScope>(3); }
|
||||||
DILocation getOrigLocation() const { return getFieldAs<DILocation>(4); }
|
DILocation getOrigLocation() const { return getFieldAs<DILocation>(4); }
|
||||||
std::string getFilename(std::string &F) const {
|
std::string getFilename(std::string &F) const {
|
||||||
return getScope().getFilename(F);
|
return getScope().getFilename(F);
|
||||||
}
|
}
|
||||||
std::string getDirectory(std::string &D) const {
|
std::string getDirectory(std::string &D) const {
|
||||||
return getScope().getDirectory(D);
|
return getScope().getDirectory(D);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ namespace llvm {
|
||||||
class DIFactory {
|
class DIFactory {
|
||||||
Module &M;
|
Module &M;
|
||||||
LLVMContext& VMContext;
|
LLVMContext& VMContext;
|
||||||
|
|
||||||
// Cached values for uniquing and faster lookups.
|
// Cached values for uniquing and faster lookups.
|
||||||
const Type *EmptyStructPtr; // "{}*".
|
const Type *EmptyStructPtr; // "{}*".
|
||||||
Function *StopPointFn; // llvm.dbg.stoppoint
|
Function *StopPointFn; // llvm.dbg.stoppoint
|
||||||
|
@ -513,7 +513,7 @@ namespace llvm {
|
||||||
public:
|
public:
|
||||||
explicit DIFactory(Module &m);
|
explicit DIFactory(Module &m);
|
||||||
|
|
||||||
/// GetOrCreateArray - Create an descriptor for an array of descriptors.
|
/// GetOrCreateArray - Create an descriptor for an array of descriptors.
|
||||||
/// This implicitly uniques the arrays created.
|
/// This implicitly uniques the arrays created.
|
||||||
DIArray GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys);
|
DIArray GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ namespace llvm {
|
||||||
DIGlobalVariable
|
DIGlobalVariable
|
||||||
CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
||||||
const std::string &DisplayName,
|
const std::string &DisplayName,
|
||||||
const std::string &LinkageName,
|
const std::string &LinkageName,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNo, DIType Type, bool isLocalToUnit,
|
unsigned LineNo, DIType Type, bool isLocalToUnit,
|
||||||
bool isDefinition, llvm::GlobalVariable *GV);
|
bool isDefinition, llvm::GlobalVariable *GV);
|
||||||
|
@ -588,12 +588,12 @@ namespace llvm {
|
||||||
DICompileUnit CompileUnit, unsigned LineNo,
|
DICompileUnit CompileUnit, unsigned LineNo,
|
||||||
DIType Type);
|
DIType Type);
|
||||||
|
|
||||||
/// CreateLexicalBlock - This creates a descriptor for a lexical block
|
/// CreateLexicalBlock - This creates a descriptor for a lexical block
|
||||||
/// with the specified parent context.
|
/// with the specified parent context.
|
||||||
DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
|
DILexicalBlock CreateLexicalBlock(DIDescriptor Context);
|
||||||
|
|
||||||
/// CreateLocation - Creates a debug info location.
|
/// CreateLocation - Creates a debug info location.
|
||||||
DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
|
DILocation CreateLocation(unsigned LineNo, unsigned ColumnNo,
|
||||||
DIScope S, DILocation OrigLoc);
|
DIScope S, DILocation OrigLoc);
|
||||||
|
|
||||||
/// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
|
/// InsertStopPoint - Create a new llvm.dbg.stoppoint intrinsic invocation,
|
||||||
|
@ -621,10 +621,10 @@ namespace llvm {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Finds the stoppoint coressponding to this instruction, that is the
|
/// Finds the stoppoint coressponding to this instruction, that is the
|
||||||
/// stoppoint that dominates this instruction
|
/// stoppoint that dominates this instruction
|
||||||
const DbgStopPointInst *findStopPoint(const Instruction *Inst);
|
const DbgStopPointInst *findStopPoint(const Instruction *Inst);
|
||||||
|
|
||||||
/// Finds the stoppoint corresponding to first real (non-debug intrinsic)
|
/// Finds the stoppoint corresponding to first real (non-debug intrinsic)
|
||||||
/// instruction in this Basic Block, and returns the stoppoint for it.
|
/// instruction in this Basic Block, and returns the stoppoint for it.
|
||||||
const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB);
|
const DbgStopPointInst *findBBStopPoint(const BasicBlock *BB);
|
||||||
|
|
||||||
|
@ -635,46 +635,46 @@ namespace llvm {
|
||||||
/// Find the debug info descriptor corresponding to this global variable.
|
/// Find the debug info descriptor corresponding to this global variable.
|
||||||
Value *findDbgGlobalDeclare(GlobalVariable *V);
|
Value *findDbgGlobalDeclare(GlobalVariable *V);
|
||||||
|
|
||||||
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
bool getLocationInfo(const Value *V, std::string &DisplayName,
|
||||||
std::string &Type, unsigned &LineNo, std::string &File,
|
std::string &Type, unsigned &LineNo, std::string &File,
|
||||||
std::string &Dir);
|
std::string &Dir);
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
|
bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
|
||||||
CodeGenOpt::Level OptLev);
|
CodeGenOpt::Level OptLev);
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
|
bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
|
||||||
CodeGenOpt::Level OptLev);
|
CodeGenOpt::Level OptLev);
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
|
bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
|
||||||
CodeGenOpt::Level OptLev);
|
CodeGenOpt::Level OptLev);
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
|
bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
|
||||||
CodeGenOpt::Level OptLev);
|
CodeGenOpt::Level OptLev);
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
|
bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
|
||||||
CodeGenOpt::Level OptLev);
|
CodeGenOpt::Level OptLev);
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.stoppoint intrinsic.
|
/// from llvm.dbg.stoppoint intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
||||||
DebugLocTracker &DebugLocInfo);
|
DebugLocTracker &DebugLocInfo);
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from DILocation.
|
/// from DILocation.
|
||||||
DebugLoc ExtractDebugLocation(DILocation &Loc,
|
DebugLoc ExtractDebugLocation(DILocation &Loc,
|
||||||
DebugLocTracker &DebugLocInfo);
|
DebugLocTracker &DebugLocInfo);
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.func_start intrinsic.
|
/// from llvm.dbg.func_start intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
||||||
DebugLocTracker &DebugLocInfo);
|
DebugLocTracker &DebugLocInfo);
|
||||||
|
@ -691,7 +691,7 @@ namespace llvm {
|
||||||
/// processModule - Process entire module and collect debug info
|
/// processModule - Process entire module and collect debug info
|
||||||
/// anchors.
|
/// anchors.
|
||||||
void processModule(Module &M);
|
void processModule(Module &M);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// processType - Process DIType.
|
/// processType - Process DIType.
|
||||||
void processType(DIType DT);
|
void processType(DIType DT);
|
||||||
|
@ -716,7 +716,7 @@ namespace llvm {
|
||||||
|
|
||||||
/// addCompileUnit - Add compile unit into CUs.
|
/// addCompileUnit - Add compile unit into CUs.
|
||||||
bool addCompileUnit(DICompileUnit CU);
|
bool addCompileUnit(DICompileUnit CU);
|
||||||
|
|
||||||
/// addGlobalVariable - Add global variable into GVs.
|
/// addGlobalVariable - Add global variable into GVs.
|
||||||
bool addGlobalVariable(DIGlobalVariable DIG);
|
bool addGlobalVariable(DIGlobalVariable DIG);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
||||||
Callback
|
Callback
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
|
|
||||||
PointerIntPair<ValueHandleBase**, 2, HandleBaseKind> PrevPair;
|
PointerIntPair<ValueHandleBase**, 2, HandleBaseKind> PrevPair;
|
||||||
ValueHandleBase *Next;
|
ValueHandleBase *Next;
|
||||||
Value *VP;
|
Value *VP;
|
||||||
|
@ -68,9 +68,9 @@ public:
|
||||||
}
|
}
|
||||||
~ValueHandleBase() {
|
~ValueHandleBase() {
|
||||||
if (isValid(VP))
|
if (isValid(VP))
|
||||||
RemoveFromUseList();
|
RemoveFromUseList();
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *operator=(Value *RHS) {
|
Value *operator=(Value *RHS) {
|
||||||
if (VP == RHS) return RHS;
|
if (VP == RHS) return RHS;
|
||||||
if (isValid(VP)) RemoveFromUseList();
|
if (isValid(VP)) RemoveFromUseList();
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
if (isValid(VP)) AddToExistingUseList(RHS.getPrevPtr());
|
if (isValid(VP)) AddToExistingUseList(RHS.getPrevPtr());
|
||||||
return VP;
|
return VP;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *operator->() const { return getValPtr(); }
|
Value *operator->() const { return getValPtr(); }
|
||||||
Value &operator*() const { return *getValPtr(); }
|
Value &operator*() const { return *getValPtr(); }
|
||||||
|
|
||||||
|
@ -102,22 +102,22 @@ private:
|
||||||
// Callbacks made from Value.
|
// Callbacks made from Value.
|
||||||
static void ValueIsDeleted(Value *V);
|
static void ValueIsDeleted(Value *V);
|
||||||
static void ValueIsRAUWd(Value *Old, Value *New);
|
static void ValueIsRAUWd(Value *Old, Value *New);
|
||||||
|
|
||||||
// Internal implementation details.
|
// Internal implementation details.
|
||||||
ValueHandleBase **getPrevPtr() const { return PrevPair.getPointer(); }
|
ValueHandleBase **getPrevPtr() const { return PrevPair.getPointer(); }
|
||||||
HandleBaseKind getKind() const { return PrevPair.getInt(); }
|
HandleBaseKind getKind() const { return PrevPair.getInt(); }
|
||||||
void setPrevPtr(ValueHandleBase **Ptr) { PrevPair.setPointer(Ptr); }
|
void setPrevPtr(ValueHandleBase **Ptr) { PrevPair.setPointer(Ptr); }
|
||||||
|
|
||||||
/// AddToExistingUseList - Add this ValueHandle to the use list for VP,
|
/// AddToExistingUseList - Add this ValueHandle to the use list for VP,
|
||||||
/// where List is known to point into the existing use list.
|
/// where List is known to point into the existing use list.
|
||||||
void AddToExistingUseList(ValueHandleBase **List);
|
void AddToExistingUseList(ValueHandleBase **List);
|
||||||
|
|
||||||
/// AddToUseList - Add this ValueHandle to the use list for VP.
|
/// AddToUseList - Add this ValueHandle to the use list for VP.
|
||||||
void AddToUseList();
|
void AddToUseList();
|
||||||
/// RemoveFromUseList - Remove this ValueHandle from its current use list.
|
/// RemoveFromUseList - Remove this ValueHandle from its current use list.
|
||||||
void RemoveFromUseList();
|
void RemoveFromUseList();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// WeakVH - This is a value handle that tries hard to point to a Value, even
|
/// WeakVH - This is a value handle that tries hard to point to a Value, even
|
||||||
/// across RAUW operations, but will null itself out if the value is destroyed.
|
/// across RAUW operations, but will null itself out if the value is destroyed.
|
||||||
/// this is useful for advisory sorts of information, but should not be used as
|
/// this is useful for advisory sorts of information, but should not be used as
|
||||||
|
@ -160,7 +160,7 @@ template<> struct simplify_type<WeakVH> : public simplify_type<const WeakVH> {};
|
||||||
/// AssertingVH's as it moves. This is required because in non-assert mode this
|
/// AssertingVH's as it moves. This is required because in non-assert mode this
|
||||||
/// class turns into a trivial wrapper around a pointer.
|
/// class turns into a trivial wrapper around a pointer.
|
||||||
template <typename ValueTy>
|
template <typename ValueTy>
|
||||||
class AssertingVH
|
class AssertingVH
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
: public ValueHandleBase
|
: public ValueHandleBase
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -71,7 +71,7 @@ bool DIDescriptor::ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel) {
|
||||||
|
|
||||||
DIDescriptor::DIDescriptor(MDNode *N, unsigned RequiredTag) {
|
DIDescriptor::DIDescriptor(MDNode *N, unsigned RequiredTag) {
|
||||||
DbgNode = N;
|
DbgNode = N;
|
||||||
|
|
||||||
// If this is non-null, check to see if the Tag matches. If not, set to null.
|
// If this is non-null, check to see if the Tag matches. If not, set to null.
|
||||||
if (N && getTag() != RequiredTag) {
|
if (N && getTag() != RequiredTag) {
|
||||||
DbgNode = 0;
|
DbgNode = 0;
|
||||||
|
@ -84,28 +84,28 @@ DIDescriptor::getStringField(unsigned Elt, std::string &Result) const {
|
||||||
if (DbgNode == 0)
|
if (DbgNode == 0)
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
if (Elt < DbgNode->getNumElements())
|
if (Elt < DbgNode->getNumElements())
|
||||||
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt))) {
|
if (MDString *MDS = dyn_cast_or_null<MDString>(DbgNode->getElement(Elt))) {
|
||||||
Result.assign(MDS->begin(), MDS->begin() + MDS->length());
|
Result.assign(MDS->begin(), MDS->begin() + MDS->length());
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
|
uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
|
||||||
if (DbgNode == 0)
|
if (DbgNode == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (Elt < DbgNode->getNumElements())
|
if (Elt < DbgNode->getNumElements())
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(DbgNode->getElement(Elt)))
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(DbgNode->getElement(Elt)))
|
||||||
return CI->getZExtValue();
|
return CI->getZExtValue();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
|
DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
|
||||||
if (DbgNode == 0)
|
if (DbgNode == 0)
|
||||||
return DIDescriptor();
|
return DIDescriptor();
|
||||||
|
|
||||||
if (Elt < DbgNode->getNumElements() && DbgNode->getElement(Elt))
|
if (Elt < DbgNode->getNumElements() && DbgNode->getElement(Elt))
|
||||||
|
@ -115,7 +115,7 @@ DIDescriptor DIDescriptor::getDescriptorField(unsigned Elt) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
|
GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
|
||||||
if (DbgNode == 0)
|
if (DbgNode == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (Elt < DbgNode->getNumElements())
|
if (Elt < DbgNode->getNumElements())
|
||||||
|
@ -132,7 +132,7 @@ GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
|
||||||
bool DIDescriptor::isBasicType() const {
|
bool DIDescriptor::isBasicType() const {
|
||||||
assert (!isNull() && "Invalid descriptor!");
|
assert (!isNull() && "Invalid descriptor!");
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
|
|
||||||
return Tag == dwarf::DW_TAG_base_type;
|
return Tag == dwarf::DW_TAG_base_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ bool DIDescriptor::isVariable() const {
|
||||||
bool DIDescriptor::isSubprogram() const {
|
bool DIDescriptor::isSubprogram() const {
|
||||||
assert (!isNull() && "Invalid descriptor!");
|
assert (!isNull() && "Invalid descriptor!");
|
||||||
unsigned Tag = getTag();
|
unsigned Tag = getTag();
|
||||||
|
|
||||||
return Tag == dwarf::DW_TAG_subprogram;
|
return Tag == dwarf::DW_TAG_subprogram;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ bool DIDescriptor::isGlobalVariable() const {
|
||||||
return Tag == dwarf::DW_TAG_variable;
|
return Tag == dwarf::DW_TAG_variable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isScope - Return true if the specified tag is one of the scope
|
/// isScope - Return true if the specified tag is one of the scope
|
||||||
/// related tag.
|
/// related tag.
|
||||||
bool DIDescriptor::isScope() const {
|
bool DIDescriptor::isScope() const {
|
||||||
assert (!isNull() && "Invalid descriptor!");
|
assert (!isNull() && "Invalid descriptor!");
|
||||||
|
@ -273,10 +273,10 @@ void DIDerivedType::replaceAllUsesWith(DIDescriptor &D) {
|
||||||
|
|
||||||
/// Verify - Verify that a compile unit is well formed.
|
/// Verify - Verify that a compile unit is well formed.
|
||||||
bool DICompileUnit::Verify() const {
|
bool DICompileUnit::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
std::string Res;
|
std::string Res;
|
||||||
if (getFilename(Res).empty())
|
if (getFilename(Res).empty())
|
||||||
return false;
|
return false;
|
||||||
// It is possible that directory and produce string is empty.
|
// It is possible that directory and produce string is empty.
|
||||||
return true;
|
return true;
|
||||||
|
@ -284,26 +284,26 @@ bool DICompileUnit::Verify() const {
|
||||||
|
|
||||||
/// Verify - Verify that a type descriptor is well formed.
|
/// Verify - Verify that a type descriptor is well formed.
|
||||||
bool DIType::Verify() const {
|
bool DIType::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
if (getContext().isNull())
|
if (getContext().isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DICompileUnit CU = getCompileUnit();
|
DICompileUnit CU = getCompileUnit();
|
||||||
if (!CU.isNull() && !CU.Verify())
|
if (!CU.isNull() && !CU.Verify())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Verify - Verify that a composite type descriptor is well formed.
|
/// Verify - Verify that a composite type descriptor is well formed.
|
||||||
bool DICompositeType::Verify() const {
|
bool DICompositeType::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
if (getContext().isNull())
|
if (getContext().isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DICompileUnit CU = getCompileUnit();
|
DICompileUnit CU = getCompileUnit();
|
||||||
if (!CU.isNull() && !CU.Verify())
|
if (!CU.isNull() && !CU.Verify())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -312,12 +312,12 @@ bool DICompositeType::Verify() const {
|
||||||
bool DISubprogram::Verify() const {
|
bool DISubprogram::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (getContext().isNull())
|
if (getContext().isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DICompileUnit CU = getCompileUnit();
|
DICompileUnit CU = getCompileUnit();
|
||||||
if (!CU.Verify())
|
if (!CU.Verify())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DICompositeType Ty = getType();
|
DICompositeType Ty = getType();
|
||||||
|
@ -330,12 +330,12 @@ bool DISubprogram::Verify() const {
|
||||||
bool DIGlobalVariable::Verify() const {
|
bool DIGlobalVariable::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (getContext().isNull())
|
if (getContext().isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DICompileUnit CU = getCompileUnit();
|
DICompileUnit CU = getCompileUnit();
|
||||||
if (!CU.isNull() && !CU.Verify())
|
if (!CU.isNull() && !CU.Verify())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DIType Ty = getType();
|
DIType Ty = getType();
|
||||||
|
@ -352,7 +352,7 @@ bool DIGlobalVariable::Verify() const {
|
||||||
bool DIVariable::Verify() const {
|
bool DIVariable::Verify() const {
|
||||||
if (isNull())
|
if (isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (getContext().isNull())
|
if (getContext().isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -420,14 +420,14 @@ void DIType::dump() const {
|
||||||
|
|
||||||
// TODO : Print context
|
// TODO : Print context
|
||||||
getCompileUnit().dump();
|
getCompileUnit().dump();
|
||||||
errs() << " ["
|
errs() << " ["
|
||||||
<< getLineNumber() << ", "
|
<< getLineNumber() << ", "
|
||||||
<< getSizeInBits() << ", "
|
<< getSizeInBits() << ", "
|
||||||
<< getAlignInBits() << ", "
|
<< getAlignInBits() << ", "
|
||||||
<< getOffsetInBits()
|
<< getOffsetInBits()
|
||||||
<< "] ";
|
<< "] ";
|
||||||
|
|
||||||
if (isPrivate())
|
if (isPrivate())
|
||||||
errs() << " [private] ";
|
errs() << " [private] ";
|
||||||
else if (isProtected())
|
else if (isProtected())
|
||||||
errs() << " [protected] ";
|
errs() << " [protected] ";
|
||||||
|
@ -538,7 +538,7 @@ void DIVariable::dump() const {
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
DIFactory::DIFactory(Module &m)
|
DIFactory::DIFactory(Module &m)
|
||||||
: M(m), VMContext(M.getContext()), StopPointFn(0), FuncStartFn(0),
|
: M(m), VMContext(M.getContext()), StopPointFn(0), FuncStartFn(0),
|
||||||
RegionStartFn(0), RegionEndFn(0),
|
RegionStartFn(0), RegionEndFn(0),
|
||||||
DeclareFn(0) {
|
DeclareFn(0) {
|
||||||
EmptyStructPtr = PointerType::getUnqual(StructType::get(VMContext));
|
EmptyStructPtr = PointerType::getUnqual(StructType::get(VMContext));
|
||||||
|
@ -554,11 +554,11 @@ Constant *DIFactory::GetTagConstant(unsigned TAG) {
|
||||||
// DIFactory: Primary Constructors
|
// DIFactory: Primary Constructors
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// GetOrCreateArray - Create an descriptor for an array of descriptors.
|
/// GetOrCreateArray - Create an descriptor for an array of descriptors.
|
||||||
/// This implicitly uniques the arrays created.
|
/// This implicitly uniques the arrays created.
|
||||||
DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) {
|
DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) {
|
||||||
SmallVector<Value*, 16> Elts;
|
SmallVector<Value*, 16> Elts;
|
||||||
|
|
||||||
if (NumTys == 0)
|
if (NumTys == 0)
|
||||||
Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
||||||
else
|
else
|
||||||
|
@ -576,7 +576,7 @@ DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) {
|
||||||
ConstantInt::get(Type::getInt64Ty(VMContext), Lo),
|
ConstantInt::get(Type::getInt64Ty(VMContext), Lo),
|
||||||
ConstantInt::get(Type::getInt64Ty(VMContext), Hi)
|
ConstantInt::get(Type::getInt64Ty(VMContext), Hi)
|
||||||
};
|
};
|
||||||
|
|
||||||
return DISubrange(MDNode::get(VMContext, &Elts[0], 3));
|
return DISubrange(MDNode::get(VMContext, &Elts[0], 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +705,7 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
|
||||||
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
|
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
|
||||||
/// See comments in DISubprogram for descriptions of these fields. This
|
/// See comments in DISubprogram for descriptions of these fields. This
|
||||||
/// method does not unique the generated descriptors.
|
/// method does not unique the generated descriptors.
|
||||||
DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
||||||
const std::string &Name,
|
const std::string &Name,
|
||||||
const std::string &DisplayName,
|
const std::string &DisplayName,
|
||||||
const std::string &LinkageName,
|
const std::string &LinkageName,
|
||||||
|
@ -738,7 +738,7 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
|
||||||
DICompileUnit CompileUnit,
|
DICompileUnit CompileUnit,
|
||||||
unsigned LineNo, DIType Type,bool isLocalToUnit,
|
unsigned LineNo, DIType Type,bool isLocalToUnit,
|
||||||
bool isDefinition, llvm::GlobalVariable *Val) {
|
bool isDefinition, llvm::GlobalVariable *Val) {
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
GetTagConstant(dwarf::DW_TAG_variable),
|
GetTagConstant(dwarf::DW_TAG_variable),
|
||||||
llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
||||||
Context.getNode(),
|
Context.getNode(),
|
||||||
|
@ -792,7 +792,7 @@ DILexicalBlock DIFactory::CreateLexicalBlock(DIDescriptor Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateLocation - Creates a debug info location.
|
/// CreateLocation - Creates a debug info location.
|
||||||
DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
|
DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
|
||||||
DIScope S, DILocation OrigLoc) {
|
DIScope S, DILocation OrigLoc) {
|
||||||
Value *Elts[] = {
|
Value *Elts[] = {
|
||||||
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
||||||
|
@ -812,12 +812,12 @@ DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo,
|
||||||
/// inserting it at the end of the specified basic block.
|
/// inserting it at the end of the specified basic block.
|
||||||
void DIFactory::InsertStopPoint(DICompileUnit CU, unsigned LineNo,
|
void DIFactory::InsertStopPoint(DICompileUnit CU, unsigned LineNo,
|
||||||
unsigned ColNo, BasicBlock *BB) {
|
unsigned ColNo, BasicBlock *BB) {
|
||||||
|
|
||||||
// Lazily construct llvm.dbg.stoppoint function.
|
// Lazily construct llvm.dbg.stoppoint function.
|
||||||
if (!StopPointFn)
|
if (!StopPointFn)
|
||||||
StopPointFn = llvm::Intrinsic::getDeclaration(&M,
|
StopPointFn = llvm::Intrinsic::getDeclaration(&M,
|
||||||
llvm::Intrinsic::dbg_stoppoint);
|
llvm::Intrinsic::dbg_stoppoint);
|
||||||
|
|
||||||
// Invoke llvm.dbg.stoppoint
|
// Invoke llvm.dbg.stoppoint
|
||||||
Value *Args[] = {
|
Value *Args[] = {
|
||||||
ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo),
|
ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo),
|
||||||
|
@ -833,7 +833,7 @@ void DIFactory::InsertSubprogramStart(DISubprogram SP, BasicBlock *BB) {
|
||||||
// Lazily construct llvm.dbg.func.start.
|
// Lazily construct llvm.dbg.func.start.
|
||||||
if (!FuncStartFn)
|
if (!FuncStartFn)
|
||||||
FuncStartFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_func_start);
|
FuncStartFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_func_start);
|
||||||
|
|
||||||
// Call llvm.dbg.func.start which also implicitly sets a stoppoint.
|
// Call llvm.dbg.func.start which also implicitly sets a stoppoint.
|
||||||
CallInst::Create(FuncStartFn, SP.getNode(), "", BB);
|
CallInst::Create(FuncStartFn, SP.getNode(), "", BB);
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ void DIFactory::InsertRegionEnd(DIDescriptor D, BasicBlock *BB) {
|
||||||
void DIFactory::InsertDeclare(Value *Storage, DIVariable D, BasicBlock *BB) {
|
void DIFactory::InsertDeclare(Value *Storage, DIVariable D, BasicBlock *BB) {
|
||||||
// Cast the storage to a {}* for the call to llvm.dbg.declare.
|
// Cast the storage to a {}* for the call to llvm.dbg.declare.
|
||||||
Storage = new BitCastInst(Storage, EmptyStructPtr, "", BB);
|
Storage = new BitCastInst(Storage, EmptyStructPtr, "", BB);
|
||||||
|
|
||||||
if (!DeclareFn)
|
if (!DeclareFn)
|
||||||
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
|
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ void DebugInfoFinder::processModule(Module &M) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// processType - Process DIType.
|
/// processType - Process DIType.
|
||||||
void DebugInfoFinder::processType(DIType DT) {
|
void DebugInfoFinder::processType(DIType DT) {
|
||||||
if (!addType(DT))
|
if (!addType(DT))
|
||||||
|
@ -926,12 +926,12 @@ void DebugInfoFinder::processType(DIType DT) {
|
||||||
DIType TypeE = DIType(D.getNode());
|
DIType TypeE = DIType(D.getNode());
|
||||||
if (!TypeE.isNull())
|
if (!TypeE.isNull())
|
||||||
processType(TypeE);
|
processType(TypeE);
|
||||||
else
|
else
|
||||||
processSubprogram(DISubprogram(D.getNode()));
|
processSubprogram(DISubprogram(D.getNode()));
|
||||||
}
|
}
|
||||||
} else if (DT.isDerivedType()) {
|
} else if (DT.isDerivedType()) {
|
||||||
DIDerivedType DDT(DT.getNode());
|
DIDerivedType DDT(DT.getNode());
|
||||||
if (!DDT.isNull())
|
if (!DDT.isNull())
|
||||||
processType(DDT.getTypeDerivedFrom());
|
processType(DDT.getTypeDerivedFrom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1006,7 @@ bool DebugInfoFinder::addCompileUnit(DICompileUnit CU) {
|
||||||
CUs.push_back(CU.getNode());
|
CUs.push_back(CU.getNode());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addGlobalVariable - Add global variable into GVs.
|
/// addGlobalVariable - Add global variable into GVs.
|
||||||
bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) {
|
bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) {
|
||||||
if (DIG.isNull())
|
if (DIG.isNull())
|
||||||
|
@ -1023,7 +1023,7 @@ bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) {
|
||||||
bool DebugInfoFinder::addSubprogram(DISubprogram SP) {
|
bool DebugInfoFinder::addSubprogram(DISubprogram SP) {
|
||||||
if (SP.isNull())
|
if (SP.isNull())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!NodesSeen.insert(SP.getNode()))
|
if (!NodesSeen.insert(SP.getNode()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1083,7 +1083,7 @@ namespace llvm {
|
||||||
NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv");
|
NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.gv");
|
||||||
if (!NMD)
|
if (!NMD)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = NMD->getNumElements(); i != e; ++i) {
|
||||||
DIGlobalVariable DIG(cast_or_null<MDNode>(NMD->getElement(i)));
|
DIGlobalVariable DIG(cast_or_null<MDNode>(NMD->getElement(i)));
|
||||||
if (DIG.isNull())
|
if (DIG.isNull())
|
||||||
|
@ -1150,28 +1150,28 @@ namespace llvm {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if SPI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
|
bool isValidDebugInfoIntrinsic(DbgStopPointInst &SPI,
|
||||||
CodeGenOpt::Level OptLev) {
|
CodeGenOpt::Level OptLev) {
|
||||||
return DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLev);
|
return DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if FSI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
|
bool isValidDebugInfoIntrinsic(DbgFuncStartInst &FSI,
|
||||||
CodeGenOpt::Level OptLev) {
|
CodeGenOpt::Level OptLev) {
|
||||||
return DIDescriptor::ValidDebugInfo(FSI.getSubprogram(), OptLev);
|
return DIDescriptor::ValidDebugInfo(FSI.getSubprogram(), OptLev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if RSI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
|
bool isValidDebugInfoIntrinsic(DbgRegionStartInst &RSI,
|
||||||
CodeGenOpt::Level OptLev) {
|
CodeGenOpt::Level OptLev) {
|
||||||
return DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLev);
|
return DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if REI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
|
bool isValidDebugInfoIntrinsic(DbgRegionEndInst &REI,
|
||||||
CodeGenOpt::Level OptLev) {
|
CodeGenOpt::Level OptLev) {
|
||||||
|
@ -1179,14 +1179,14 @@ namespace llvm {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
|
/// isValidDebugInfoIntrinsic - Return true if DI is a valid debug
|
||||||
/// info intrinsic.
|
/// info intrinsic.
|
||||||
bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
|
bool isValidDebugInfoIntrinsic(DbgDeclareInst &DI,
|
||||||
CodeGenOpt::Level OptLev) {
|
CodeGenOpt::Level OptLev) {
|
||||||
return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev);
|
return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.stoppoint intrinsic.
|
/// from llvm.dbg.stoppoint intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
||||||
DebugLocTracker &DebugLocInfo) {
|
DebugLocTracker &DebugLocInfo) {
|
||||||
|
@ -1194,7 +1194,7 @@ namespace llvm {
|
||||||
Value *Context = SPI.getContext();
|
Value *Context = SPI.getContext();
|
||||||
|
|
||||||
// If this location is already tracked then use it.
|
// If this location is already tracked then use it.
|
||||||
DebugLocTuple Tuple(cast<MDNode>(Context), SPI.getLine(),
|
DebugLocTuple Tuple(cast<MDNode>(Context), SPI.getLine(),
|
||||||
SPI.getColumn());
|
SPI.getColumn());
|
||||||
DenseMap<DebugLocTuple, unsigned>::iterator II
|
DenseMap<DebugLocTuple, unsigned>::iterator II
|
||||||
= DebugLocInfo.DebugIdMap.find(Tuple);
|
= DebugLocInfo.DebugIdMap.find(Tuple);
|
||||||
|
@ -1205,11 +1205,11 @@ namespace llvm {
|
||||||
unsigned Id = DebugLocInfo.DebugLocations.size();
|
unsigned Id = DebugLocInfo.DebugLocations.size();
|
||||||
DebugLocInfo.DebugLocations.push_back(Tuple);
|
DebugLocInfo.DebugLocations.push_back(Tuple);
|
||||||
DebugLocInfo.DebugIdMap[Tuple] = Id;
|
DebugLocInfo.DebugIdMap[Tuple] = Id;
|
||||||
|
|
||||||
return DebugLoc::get(Id);
|
return DebugLoc::get(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from DILocation.
|
/// from DILocation.
|
||||||
DebugLoc ExtractDebugLocation(DILocation &Loc,
|
DebugLoc ExtractDebugLocation(DILocation &Loc,
|
||||||
DebugLocTracker &DebugLocInfo) {
|
DebugLocTracker &DebugLocInfo) {
|
||||||
|
@ -1228,11 +1228,11 @@ namespace llvm {
|
||||||
unsigned Id = DebugLocInfo.DebugLocations.size();
|
unsigned Id = DebugLocInfo.DebugLocations.size();
|
||||||
DebugLocInfo.DebugLocations.push_back(Tuple);
|
DebugLocInfo.DebugLocations.push_back(Tuple);
|
||||||
DebugLocInfo.DebugIdMap[Tuple] = Id;
|
DebugLocInfo.DebugIdMap[Tuple] = Id;
|
||||||
|
|
||||||
return DebugLoc::get(Id);
|
return DebugLoc::get(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.func_start intrinsic.
|
/// from llvm.dbg.func_start intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
||||||
DebugLocTracker &DebugLocInfo) {
|
DebugLocTracker &DebugLocInfo) {
|
||||||
|
@ -1254,7 +1254,7 @@ namespace llvm {
|
||||||
unsigned Id = DebugLocInfo.DebugLocations.size();
|
unsigned Id = DebugLocInfo.DebugLocations.size();
|
||||||
DebugLocInfo.DebugLocations.push_back(Tuple);
|
DebugLocInfo.DebugLocations.push_back(Tuple);
|
||||||
DebugLocInfo.DebugIdMap[Tuple] = Id;
|
DebugLocInfo.DebugIdMap[Tuple] = Id;
|
||||||
|
|
||||||
return DebugLoc::get(Id);
|
return DebugLoc::get(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ class VISIBILITY_HIDDEN DbgScope {
|
||||||
SmallVector<DbgScope *, 4> Scopes; // Scopes defined in scope.
|
SmallVector<DbgScope *, 4> Scopes; // Scopes defined in scope.
|
||||||
SmallVector<DbgVariable *, 8> Variables;// Variables declared in scope.
|
SmallVector<DbgVariable *, 8> Variables;// Variables declared in scope.
|
||||||
SmallVector<DbgConcreteScope *, 8> ConcreteInsts;// Concrete insts of funcs.
|
SmallVector<DbgConcreteScope *, 8> ConcreteInsts;// Concrete insts of funcs.
|
||||||
|
|
||||||
// Private state for dump()
|
// Private state for dump()
|
||||||
mutable unsigned IndentLevel;
|
mutable unsigned IndentLevel;
|
||||||
public:
|
public:
|
||||||
|
@ -232,7 +232,7 @@ DbgScope::~DbgScope() {
|
||||||
DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T)
|
DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T)
|
||||||
: Dwarf(OS, A, T, "dbg"), ModuleCU(0),
|
: Dwarf(OS, A, T, "dbg"), ModuleCU(0),
|
||||||
AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
|
AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
|
||||||
ValuesSet(InitValuesSetSize), Values(), StringPool(),
|
ValuesSet(InitValuesSetSize), Values(), StringPool(),
|
||||||
SectionSourceLines(), didInitial(false), shouldEmit(false),
|
SectionSourceLines(), didInitial(false), shouldEmit(false),
|
||||||
FunctionDbgScope(0), DebugTimer(0) {
|
FunctionDbgScope(0), DebugTimer(0) {
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
|
@ -593,7 +593,7 @@ DIType DwarfDebug::GetBlockByrefType(DIType Ty, std::string Name) {
|
||||||
the variable's Debug Information Entry as its real type. So far, so good.
|
the variable's Debug Information Entry as its real type. So far, so good.
|
||||||
However now the debugger will expect the variable VarName to have the type
|
However now the debugger will expect the variable VarName to have the type
|
||||||
SomeType. So we need the location attribute for the variable to be an
|
SomeType. So we need the location attribute for the variable to be an
|
||||||
expression that explains to the debugger how to navigate through the
|
expression that explains to the debugger how to navigate through the
|
||||||
pointers and struct to find the actual variable of type SomeType.
|
pointers and struct to find the actual variable of type SomeType.
|
||||||
|
|
||||||
The following function does just that. We start by getting
|
The following function does just that. We start by getting
|
||||||
|
@ -639,7 +639,7 @@ DIType DwarfDebug::GetBlockByrefType(DIType Ty, std::string Name) {
|
||||||
/// starting location. Add the DWARF information to the die. For
|
/// starting location. Add the DWARF information to the die. For
|
||||||
/// more information, read large comment just above here.
|
/// more information, read large comment just above here.
|
||||||
///
|
///
|
||||||
void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||||
unsigned Attribute,
|
unsigned Attribute,
|
||||||
const MachineLocation &Location) {
|
const MachineLocation &Location) {
|
||||||
const DIVariable &VD = DV->getVariable();
|
const DIVariable &VD = DV->getVariable();
|
||||||
|
@ -667,7 +667,7 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||||
|
|
||||||
// Find the __forwarding field and the variable field in the __Block_byref
|
// Find the __forwarding field and the variable field in the __Block_byref
|
||||||
// struct.
|
// struct.
|
||||||
|
|
||||||
DIArray Fields = blockStruct.getTypeArray();
|
DIArray Fields = blockStruct.getTypeArray();
|
||||||
DIDescriptor varField = DIDescriptor();
|
DIDescriptor varField = DIDescriptor();
|
||||||
DIDescriptor forwardingField = DIDescriptor();
|
DIDescriptor forwardingField = DIDescriptor();
|
||||||
|
@ -683,19 +683,19 @@ void DwarfDebug::AddBlockByrefAddress(DbgVariable *&DV, DIE *Die,
|
||||||
else if (fieldName == varName)
|
else if (fieldName == varName)
|
||||||
varField = Element;
|
varField = Element;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (!varField.isNull() && "Can't find byref variable in Block struct");
|
assert (!varField.isNull() && "Can't find byref variable in Block struct");
|
||||||
assert (!forwardingField.isNull()
|
assert (!forwardingField.isNull()
|
||||||
&& "Can't find forwarding field in Block struct");
|
&& "Can't find forwarding field in Block struct");
|
||||||
|
|
||||||
// Get the offsets for the forwarding field and the variable field.
|
// Get the offsets for the forwarding field and the variable field.
|
||||||
|
|
||||||
unsigned int forwardingFieldOffset =
|
unsigned int forwardingFieldOffset =
|
||||||
DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3;
|
DIDerivedType(forwardingField.getNode()).getOffsetInBits() >> 3;
|
||||||
unsigned int varFieldOffset =
|
unsigned int varFieldOffset =
|
||||||
DIDerivedType(varField.getNode()).getOffsetInBits() >> 3;
|
DIDerivedType(varField.getNode()).getOffsetInBits() >> 3;
|
||||||
|
|
||||||
// Decode the original location, and use that as the start of the
|
// Decode the original location, and use that as the start of the
|
||||||
// byref variable's location.
|
// byref variable's location.
|
||||||
|
|
||||||
unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false);
|
unsigned Reg = RI->getDwarfRegNum(Location.getReg(), false);
|
||||||
|
@ -1393,13 +1393,13 @@ void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) {
|
||||||
StringMap<DIE*>::iterator GI = Globals.find(MF->getFunction()->getName());
|
StringMap<DIE*>::iterator GI = Globals.find(MF->getFunction()->getName());
|
||||||
if (GI != Globals.end()) {
|
if (GI != Globals.end()) {
|
||||||
DIE *SPDie = GI->second;
|
DIE *SPDie = GI->second;
|
||||||
|
|
||||||
// Add the function bounds.
|
// Add the function bounds.
|
||||||
AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
|
||||||
DWLabel("func_begin", SubprogramCount));
|
DWLabel("func_begin", SubprogramCount));
|
||||||
AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
|
||||||
DWLabel("func_end", SubprogramCount));
|
DWLabel("func_end", SubprogramCount));
|
||||||
|
|
||||||
MachineLocation Location(RI->getFrameRegister(*MF));
|
MachineLocation Location(RI->getFrameRegister(*MF));
|
||||||
AddAddress(SPDie, dwarf::DW_AT_frame_base, Location);
|
AddAddress(SPDie, dwarf::DW_AT_frame_base, Location);
|
||||||
}
|
}
|
||||||
|
@ -1487,7 +1487,7 @@ void DwarfDebug::ConstructCompileUnit(MDNode *N) {
|
||||||
|
|
||||||
void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) {
|
void DwarfDebug::ConstructGlobalVariableDIE(MDNode *N) {
|
||||||
DIGlobalVariable DI_GV(N);
|
DIGlobalVariable DI_GV(N);
|
||||||
|
|
||||||
// If debug information is malformed then ignore it.
|
// If debug information is malformed then ignore it.
|
||||||
if (DI_GV.Verify() == false)
|
if (DI_GV.Verify() == false)
|
||||||
return;
|
return;
|
||||||
|
@ -1582,7 +1582,7 @@ void DwarfDebug::BeginModule(Module *M, MachineModuleInfo *mmi) {
|
||||||
DebugTimer->stopTimer();
|
DebugTimer->stopTimer();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create DIEs for each of the externally visible global variables.
|
// Create DIEs for each of the externally visible global variables.
|
||||||
for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(),
|
for (DebugInfoFinder::iterator I = DbgFinder.global_variable_begin(),
|
||||||
E = DbgFinder.global_variable_end(); I != E; ++I)
|
E = DbgFinder.global_variable_end(); I != E; ++I)
|
||||||
|
@ -1904,7 +1904,7 @@ void DwarfDebug::RecordVariable(MDNode *N, unsigned FrameIndex) {
|
||||||
Scope = I->second;
|
Scope = I->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!InlinedVar)
|
if (!InlinedVar)
|
||||||
Scope = getOrCreateScope(Context);
|
Scope = getOrCreateScope(Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2109,7 +2109,7 @@ void DwarfDebug::EmitInitial() {
|
||||||
didInitial = true;
|
didInitial = true;
|
||||||
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
// Dwarf sections base addresses.
|
// Dwarf sections base addresses.
|
||||||
if (MAI->doesDwarfRequireFrameSection()) {
|
if (MAI->doesDwarfRequireFrameSection()) {
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getDwarfFrameSection());
|
Asm->OutStreamer.SwitchSection(TLOF.getDwarfFrameSection());
|
||||||
|
@ -2669,7 +2669,7 @@ void DwarfDebug::EmitDebugRanges() {
|
||||||
/// EmitDebugMacInfo - Emit visible names into a debug macinfo section.
|
/// EmitDebugMacInfo - Emit visible names into a debug macinfo section.
|
||||||
///
|
///
|
||||||
void DwarfDebug::EmitDebugMacInfo() {
|
void DwarfDebug::EmitDebugMacInfo() {
|
||||||
if (const MCSection *LineInfo =
|
if (const MCSection *LineInfo =
|
||||||
Asm->getObjFileLowering().getDwarfMacroInfoSection()) {
|
Asm->getObjFileLowering().getDwarfMacroInfoSection()) {
|
||||||
// Start the dwarf macinfo section.
|
// Start the dwarf macinfo section.
|
||||||
Asm->OutStreamer.SwitchSection(LineInfo);
|
Asm->OutStreamer.SwitchSection(LineInfo);
|
||||||
|
|
Loading…
Reference in New Issue