forked from OSchip/llvm-project
parent
c64a54eda2
commit
a4ae8d4740
|
@ -22,16 +22,16 @@
|
|||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
class AsmPrinter;
|
||||
class MCSymbol;
|
||||
class MCSymbolRefExpr;
|
||||
class raw_ostream;
|
||||
class DwarfTypeUnit;
|
||||
class AsmPrinter;
|
||||
class MCSymbol;
|
||||
class MCSymbolRefExpr;
|
||||
class raw_ostream;
|
||||
class DwarfTypeUnit;
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEAbbrevData - Dwarf abbreviation data, describes one attribute of a
|
||||
/// Dwarf abbreviation.
|
||||
class DIEAbbrevData {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEAbbrevData - Dwarf abbreviation data, describes one attribute of a
|
||||
/// Dwarf abbreviation.
|
||||
class DIEAbbrevData {
|
||||
/// Attribute - Dwarf attribute code.
|
||||
///
|
||||
dwarf::Attribute Attribute;
|
||||
|
@ -39,7 +39,8 @@ namespace llvm {
|
|||
/// Form - Dwarf form code.
|
||||
///
|
||||
dwarf::Form Form;
|
||||
public:
|
||||
|
||||
public:
|
||||
DIEAbbrevData(dwarf::Attribute A, dwarf::Form F) : Attribute(A), Form(F) {}
|
||||
|
||||
// Accessors.
|
||||
|
@ -49,12 +50,12 @@ namespace llvm {
|
|||
/// Profile - Used to gather unique data for the abbreviation folding set.
|
||||
///
|
||||
void Profile(FoldingSetNodeID &ID) const;
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEAbbrev - Dwarf abbreviation, describes the organization of a debug
|
||||
/// information object.
|
||||
class DIEAbbrev : public FoldingSetNode {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEAbbrev - Dwarf abbreviation, describes the organization of a debug
|
||||
/// information object.
|
||||
class DIEAbbrev : public FoldingSetNode {
|
||||
/// Tag - Dwarf tag code.
|
||||
///
|
||||
dwarf::Tag Tag;
|
||||
|
@ -71,7 +72,7 @@ namespace llvm {
|
|||
///
|
||||
SmallVector<DIEAbbrevData, 12> Data;
|
||||
|
||||
public:
|
||||
public:
|
||||
DIEAbbrev(dwarf::Tag T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}
|
||||
|
||||
// Accessors.
|
||||
|
@ -100,15 +101,15 @@ namespace llvm {
|
|||
void print(raw_ostream &O);
|
||||
void dump();
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIE - A structured debug information entry. Has an abbreviation which
|
||||
/// describes its organization.
|
||||
class DIEValue;
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIE - A structured debug information entry. Has an abbreviation which
|
||||
/// describes its organization.
|
||||
class DIEValue;
|
||||
|
||||
class DIE {
|
||||
protected:
|
||||
class DIE {
|
||||
protected:
|
||||
/// Offset - Offset in debug info section.
|
||||
///
|
||||
unsigned Offset;
|
||||
|
@ -129,9 +130,9 @@ namespace llvm {
|
|||
|
||||
/// Attribute values.
|
||||
///
|
||||
SmallVector<DIEValue*, 12> Values;
|
||||
SmallVector<DIEValue *, 12> Values;
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit DIE(unsigned Tag)
|
||||
: Offset(0), Size(0), Abbrev((dwarf::Tag)Tag, dwarf::DW_CHILDREN_no),
|
||||
Parent(0) {}
|
||||
|
@ -145,7 +146,7 @@ namespace llvm {
|
|||
unsigned getOffset() const { return Offset; }
|
||||
unsigned getSize() const { return Size; }
|
||||
const std::vector<DIE *> &getChildren() const { return Children; }
|
||||
const SmallVectorImpl<DIEValue*> &getValues() const { return Values; }
|
||||
const SmallVectorImpl<DIEValue *> &getValues() const { return Values; }
|
||||
DIE *getParent() const { return Parent; }
|
||||
/// Climb up the parent chain to get the compile or type unit DIE this DIE
|
||||
/// belongs to.
|
||||
|
@ -158,8 +159,7 @@ namespace llvm {
|
|||
|
||||
/// addValue - Add a value and attributes to a DIE.
|
||||
///
|
||||
void addValue(dwarf::Attribute Attribute, dwarf::Form Form,
|
||||
DIEValue *Value) {
|
||||
void addValue(dwarf::Attribute Attribute, dwarf::Form Form, DIEValue *Value) {
|
||||
Abbrev.AddAttribute(Attribute, Form);
|
||||
Values.push_back(Value);
|
||||
}
|
||||
|
@ -181,14 +181,15 @@ namespace llvm {
|
|||
void print(raw_ostream &O, unsigned IndentCount = 0) const;
|
||||
void dump();
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEValue - A debug information entry value.
|
||||
///
|
||||
class DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEValue - A debug information entry value.
|
||||
///
|
||||
class DIEValue {
|
||||
virtual void anchor();
|
||||
public:
|
||||
|
||||
public:
|
||||
enum {
|
||||
isInteger,
|
||||
isString,
|
||||
|
@ -200,11 +201,13 @@ namespace llvm {
|
|||
isBlock,
|
||||
isLoc
|
||||
};
|
||||
protected:
|
||||
|
||||
protected:
|
||||
/// Type - Type of data stored in the value.
|
||||
///
|
||||
unsigned Type;
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit DIEValue(unsigned T) : Type(T) {}
|
||||
virtual ~DIEValue() {}
|
||||
|
||||
|
@ -223,14 +226,15 @@ namespace llvm {
|
|||
virtual void print(raw_ostream &O) const = 0;
|
||||
void dump() const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEInteger - An integer value DIE.
|
||||
///
|
||||
class DIEInteger : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEInteger - An integer value DIE.
|
||||
///
|
||||
class DIEInteger : public DIEValue {
|
||||
uint64_t Integer;
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit DIEInteger(uint64_t I) : DIEValue(isInteger), Integer(I) {}
|
||||
|
||||
/// BestForm - Choose the best form for integer.
|
||||
|
@ -238,13 +242,19 @@ namespace llvm {
|
|||
static dwarf::Form BestForm(bool IsSigned, uint64_t Int) {
|
||||
if (IsSigned) {
|
||||
const int64_t SignedInt = Int;
|
||||
if ((char)Int == SignedInt) return dwarf::DW_FORM_data1;
|
||||
if ((short)Int == SignedInt) return dwarf::DW_FORM_data2;
|
||||
if ((int)Int == SignedInt) return dwarf::DW_FORM_data4;
|
||||
if ((char)Int == SignedInt)
|
||||
return dwarf::DW_FORM_data1;
|
||||
if ((short)Int == SignedInt)
|
||||
return dwarf::DW_FORM_data2;
|
||||
if ((int)Int == SignedInt)
|
||||
return dwarf::DW_FORM_data4;
|
||||
} else {
|
||||
if ((unsigned char)Int == Int) return dwarf::DW_FORM_data1;
|
||||
if ((unsigned short)Int == Int) return dwarf::DW_FORM_data2;
|
||||
if ((unsigned int)Int == Int) return dwarf::DW_FORM_data4;
|
||||
if ((unsigned char)Int == Int)
|
||||
return dwarf::DW_FORM_data1;
|
||||
if ((unsigned short)Int == Int)
|
||||
return dwarf::DW_FORM_data2;
|
||||
if ((unsigned int)Int == Int)
|
||||
return dwarf::DW_FORM_data4;
|
||||
}
|
||||
return dwarf::DW_FORM_data8;
|
||||
}
|
||||
|
@ -265,14 +275,15 @@ namespace llvm {
|
|||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEExpr - An expression DIE.
|
||||
//
|
||||
class DIEExpr : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEExpr - An expression DIE.
|
||||
//
|
||||
class DIEExpr : public DIEValue {
|
||||
const MCExpr *Expr;
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit DIEExpr(const MCExpr *E) : DIEValue(isExpr), Expr(E) {}
|
||||
|
||||
/// EmitValue - Emit expression value.
|
||||
|
@ -293,14 +304,15 @@ namespace llvm {
|
|||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIELabel - A label DIE.
|
||||
//
|
||||
class DIELabel : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIELabel - A label DIE.
|
||||
//
|
||||
class DIELabel : public DIEValue {
|
||||
const MCSymbol *Label;
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit DIELabel(const MCSymbol *L) : DIEValue(isLabel), Label(L) {}
|
||||
|
||||
/// EmitValue - Emit label value.
|
||||
|
@ -321,15 +333,16 @@ namespace llvm {
|
|||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEDelta - A simple label difference DIE.
|
||||
///
|
||||
class DIEDelta : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEDelta - A simple label difference DIE.
|
||||
///
|
||||
class DIEDelta : public DIEValue {
|
||||
const MCSymbol *LabelHi;
|
||||
const MCSymbol *LabelLo;
|
||||
public:
|
||||
|
||||
public:
|
||||
DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo)
|
||||
: DIEValue(isDelta), LabelHi(Hi), LabelLo(Lo) {}
|
||||
|
||||
|
@ -347,16 +360,16 @@ namespace llvm {
|
|||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEString - A container for string values.
|
||||
///
|
||||
class DIEString : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEString - A container for string values.
|
||||
///
|
||||
class DIEString : public DIEValue {
|
||||
const DIEValue *Access;
|
||||
const StringRef Str;
|
||||
|
||||
public:
|
||||
public:
|
||||
DIEString(const DIEValue *Acc, const StringRef S)
|
||||
: DIEValue(isString), Access(Acc), Str(S) {}
|
||||
|
||||
|
@ -374,18 +387,19 @@ namespace llvm {
|
|||
// Implement isa/cast/dyncast.
|
||||
static bool classof(const DIEValue *D) { return D->getType() == isString; }
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEEntry - A pointer to another debug information entry. An instance of
|
||||
/// this class can also be used as a proxy for a debug information entry not
|
||||
/// yet defined (ie. types.)
|
||||
class DIEEntry : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEEntry - A pointer to another debug information entry. An instance of
|
||||
/// this class can also be used as a proxy for a debug information entry not
|
||||
/// yet defined (ie. types.)
|
||||
class DIEEntry : public DIEValue {
|
||||
DIE *const Entry;
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit DIEEntry(DIE *E) : DIEValue(isEntry), Entry(E) {
|
||||
assert(E && "Cannot construct a DIEEntry with a null DIE");
|
||||
}
|
||||
|
@ -412,13 +426,14 @@ namespace llvm {
|
|||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// \brief A signature reference to a type unit.
|
||||
class DIETypeSignature : public DIEValue {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// \brief A signature reference to a type unit.
|
||||
class DIETypeSignature : public DIEValue {
|
||||
const DwarfTypeUnit &Unit;
|
||||
public:
|
||||
|
||||
public:
|
||||
explicit DIETypeSignature(const DwarfTypeUnit &Unit)
|
||||
: DIEValue(isTypeSignature), Unit(Unit) {}
|
||||
|
||||
|
@ -439,14 +454,14 @@ namespace llvm {
|
|||
virtual void print(raw_ostream &O) const;
|
||||
void dump() const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIELoc - Represents an expression location.
|
||||
//
|
||||
class DIELoc : public DIEValue, public DIE {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIELoc - Represents an expression location.
|
||||
//
|
||||
class DIELoc : public DIEValue, public DIE {
|
||||
mutable unsigned Size; // Size in bytes excluding size header.
|
||||
public:
|
||||
public:
|
||||
DIELoc() : DIEValue(isLoc), DIE(0), Size(0) {}
|
||||
|
||||
/// ComputeSize - Calculate the size of the location expression.
|
||||
|
@ -456,11 +471,15 @@ namespace llvm {
|
|||
/// BestForm - Choose the best form for data.
|
||||
///
|
||||
dwarf::Form BestForm(unsigned DwarfVersion) const {
|
||||
if (DwarfVersion > 3) return dwarf::DW_FORM_exprloc;
|
||||
if (DwarfVersion > 3)
|
||||
return dwarf::DW_FORM_exprloc;
|
||||
// Pre-DWARF4 location expressions were blocks and not exprloc.
|
||||
if ((unsigned char)Size == Size) return dwarf::DW_FORM_block1;
|
||||
if ((unsigned short)Size == Size) return dwarf::DW_FORM_block2;
|
||||
if ((unsigned int)Size == Size) return dwarf::DW_FORM_block4;
|
||||
if ((unsigned char)Size == Size)
|
||||
return dwarf::DW_FORM_block1;
|
||||
if ((unsigned short)Size == Size)
|
||||
return dwarf::DW_FORM_block2;
|
||||
if ((unsigned int)Size == Size)
|
||||
return dwarf::DW_FORM_block4;
|
||||
return dwarf::DW_FORM_block;
|
||||
}
|
||||
|
||||
|
@ -478,14 +497,14 @@ namespace llvm {
|
|||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEBlock - Represents a block of values.
|
||||
//
|
||||
class DIEBlock : public DIEValue, public DIE {
|
||||
//===--------------------------------------------------------------------===//
|
||||
/// DIEBlock - Represents a block of values.
|
||||
//
|
||||
class DIEBlock : public DIEValue, public DIE {
|
||||
mutable unsigned Size; // Size in bytes excluding size header.
|
||||
public:
|
||||
public:
|
||||
DIEBlock() : DIEValue(isBlock), DIE(0), Size(0) {}
|
||||
|
||||
/// ComputeSize - Calculate the size of the location expression.
|
||||
|
@ -495,9 +514,12 @@ namespace llvm {
|
|||
/// BestForm - Choose the best form for data.
|
||||
///
|
||||
dwarf::Form BestForm() const {
|
||||
if ((unsigned char)Size == Size) return dwarf::DW_FORM_block1;
|
||||
if ((unsigned short)Size == Size) return dwarf::DW_FORM_block2;
|
||||
if ((unsigned int)Size == Size) return dwarf::DW_FORM_block4;
|
||||
if ((unsigned char)Size == Size)
|
||||
return dwarf::DW_FORM_block1;
|
||||
if ((unsigned short)Size == Size)
|
||||
return dwarf::DW_FORM_block2;
|
||||
if ((unsigned int)Size == Size)
|
||||
return dwarf::DW_FORM_block4;
|
||||
return dwarf::DW_FORM_block;
|
||||
}
|
||||
|
||||
|
@ -512,10 +534,10 @@ namespace llvm {
|
|||
// Implement isa/cast/dyncast.
|
||||
static bool classof(const DIEValue *E) { return E->getType() == isBlock; }
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
virtual void print(raw_ostream &O) const;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
};
|
||||
} // end llvm namespace
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue