one pass of cleanup over DebugInfo.h. Much more is still needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-12-29 09:15:46 +00:00
parent 19f2dc436d
commit 784b850e32
2 changed files with 24 additions and 37 deletions

View File

@ -17,14 +17,10 @@
#ifndef LLVM_ANALYSIS_DEBUGINFO_H #ifndef LLVM_ANALYSIS_DEBUGINFO_H
#define LLVM_ANALYSIS_DEBUGINFO_H #define LLVM_ANALYSIS_DEBUGINFO_H
#include "llvm/Metadata.h" #include "llvm/Metadata.h" // FIXME: Should not need this.
#include "llvm/Target/TargetMachine.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Dwarf.h" #include "llvm/Support/Dwarf.h" // FIXME: Should not need this.
#include "llvm/Support/ValueHandle.h"
namespace llvm { namespace llvm {
class BasicBlock; class BasicBlock;
@ -42,13 +38,13 @@ namespace llvm {
class DebugLoc; class DebugLoc;
struct DebugLocTracker; struct DebugLocTracker;
class Instruction; class Instruction;
class LLVMContext;
/// DIDescriptor - A thin wraper around MDNode to access encoded debug info. This should not /// DIDescriptor - A thin wraper around MDNode to access encoded debug info.
/// be stored in a container, because underly MDNode may change in certain situations. /// This should not be stored in a container, because underly MDNode may
/// change in certain situations.
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
/// to make sure that the tag in the descriptor matches 'RequiredTag'. If /// to make sure that the tag in the descriptor matches 'RequiredTag'. If
@ -86,7 +82,7 @@ namespace llvm {
} }
/// ValidDebugInfo - Return true if N represents valid debug info value. /// ValidDebugInfo - Return true if N represents valid debug info value.
static bool ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel); static bool ValidDebugInfo(MDNode *N, unsigned OptLevel);
/// dump - print descriptor. /// dump - print descriptor.
void dump() const; void dump() const;
@ -483,7 +479,7 @@ namespace llvm {
StringRef getName() const { return getStringField(2); } StringRef getName() const { return getStringField(2); }
StringRef getDirectory() const { return getContext().getDirectory(); } StringRef getDirectory() const { return getContext().getDirectory(); }
StringRef getFilename() const { return getContext().getFilename(); } StringRef getFilename() const { return getContext().getFilename(); }
DICompileUnit getCompileUnit() const { return getFieldAs<DICompileUnit>(3); } DICompileUnit getCompileUnit() const { return getFieldAs<DICompileUnit>(3);}
unsigned getLineNumber() const { return getUnsignedField(4); } unsigned getLineNumber() const { return getUnsignedField(4); }
}; };
@ -688,34 +684,29 @@ 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, unsigned 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, unsigned 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, unsigned 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, unsigned 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, unsigned OptLev);
CodeGenOpt::Level OptLev);
/// ExtractDebugLocation - Extract debug location information /// ExtractDebugLocation - Extract debug location information
/// from llvm.dbg.stoppoint intrinsic. /// from llvm.dbg.stoppoint intrinsic.

View File

@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/DebugInfo.h"
#include "llvm/Target/TargetMachine.h" // FIXME: LAYERING VIOLATION!
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
@ -34,7 +35,7 @@ using namespace llvm::dwarf;
/// ValidDebugInfo - Return true if V represents valid debug info value. /// ValidDebugInfo - Return true if V represents valid debug info value.
/// FIXME : Add DIDescriptor.isValid() /// FIXME : Add DIDescriptor.isValid()
bool DIDescriptor::ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel) { bool DIDescriptor::ValidDebugInfo(MDNode *N, unsigned OptLevel) {
if (!N) if (!N)
return false; return false;
@ -1353,7 +1354,7 @@ namespace llvm {
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) {
DICompileUnit Unit; DICompileUnit Unit;
DIType TypeD; DIType TypeD;
@ -1395,37 +1396,32 @@ bool getLocationInfo(const Value *V, std::string &DisplayName,
/// 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, unsigned 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, unsigned 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, unsigned 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, unsigned OptLev) {
CodeGenOpt::Level OptLev) {
return DIDescriptor::ValidDebugInfo(REI.getContext(), OptLev); return DIDescriptor::ValidDebugInfo(REI.getContext(), 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, unsigned OptLev) {
CodeGenOpt::Level OptLev) {
return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev); return DIDescriptor::ValidDebugInfo(DI.getVariable(), OptLev);
} }