mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 17:38:39 +00:00
Switch to using a numeric id for anchors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26598 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e1c173bc77
commit
e8c3e3b51c
@ -142,16 +142,18 @@ public:
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// AnchorDesc - Descriptors of this class act as markers for identifying
|
/// AnchorDesc - Descriptors of this class act as markers for identifying
|
||||||
/// descriptors of certain groups.
|
/// descriptors of certain groups.
|
||||||
|
class AnchoredDesc;
|
||||||
class AnchorDesc : public DebugInfoDesc {
|
class AnchorDesc : public DebugInfoDesc {
|
||||||
private:
|
private:
|
||||||
std::string Name; // Anchor type string.
|
unsigned AnchorTag; // Tag number of descriptors anchored
|
||||||
|
// by this object.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AnchorDesc();
|
AnchorDesc();
|
||||||
AnchorDesc(const std::string &N);
|
AnchorDesc(AnchoredDesc *D);
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
const std::string &getName() const { return Name; }
|
unsigned getAnchorTag() const { return AnchorTag; }
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
static bool classof(const AnchorDesc *) { return true; }
|
static bool classof(const AnchorDesc *) { return true; }
|
||||||
@ -198,6 +200,10 @@ public:
|
|||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Subclasses should supply the following virtual methods.
|
// Subclasses should supply the following virtual methods.
|
||||||
|
|
||||||
|
/// getAnchorString - Return a string used to label descriptor's anchor.
|
||||||
|
///
|
||||||
|
virtual const char *getAnchorString() const = 0;
|
||||||
|
|
||||||
/// ApplyToFields - Target the visitor to the fields of the AnchoredDesc.
|
/// ApplyToFields - Target the visitor to the fields of the AnchoredDesc.
|
||||||
///
|
///
|
||||||
virtual void ApplyToFields(DIVisitor *Visitor);
|
virtual void ApplyToFields(DIVisitor *Visitor);
|
||||||
@ -217,6 +223,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
CompileUnitDesc();
|
CompileUnitDesc();
|
||||||
|
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
unsigned getDebugVersion() const { return DebugVersion; }
|
unsigned getDebugVersion() const { return DebugVersion; }
|
||||||
unsigned getLanguage() const { return Language; }
|
unsigned getLanguage() const { return Language; }
|
||||||
@ -252,6 +259,7 @@ public:
|
|||||||
|
|
||||||
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
||||||
///
|
///
|
||||||
|
static const char *AnchorString;
|
||||||
virtual const char *getAnchorString() const;
|
virtual const char *getAnchorString() const;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -553,6 +561,7 @@ public:
|
|||||||
|
|
||||||
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
||||||
///
|
///
|
||||||
|
static const char *AnchorString;
|
||||||
virtual const char *getAnchorString() const;
|
virtual const char *getAnchorString() const;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -591,6 +600,7 @@ public:
|
|||||||
|
|
||||||
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
||||||
///
|
///
|
||||||
|
static const char *AnchorString;
|
||||||
virtual const char *getAnchorString() const;
|
virtual const char *getAnchorString() const;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -53,7 +53,7 @@ getGlobalVariablesUsing(Module &M, const std::string &RootName) {
|
|||||||
|
|
||||||
std::vector<const Type*> FieldTypes;
|
std::vector<const Type*> FieldTypes;
|
||||||
FieldTypes.push_back(Type::UIntTy);
|
FieldTypes.push_back(Type::UIntTy);
|
||||||
FieldTypes.push_back(PointerType::get(Type::SByteTy));
|
FieldTypes.push_back(Type::UIntTy);
|
||||||
|
|
||||||
// Get the GlobalVariable root.
|
// Get the GlobalVariable root.
|
||||||
GlobalVariable *UseRoot = M.getGlobalVariable(RootName,
|
GlobalVariable *UseRoot = M.getGlobalVariable(RootName,
|
||||||
@ -539,11 +539,11 @@ void DebugInfoDesc::ApplyToFields(DIVisitor *Visitor) {
|
|||||||
|
|
||||||
AnchorDesc::AnchorDesc()
|
AnchorDesc::AnchorDesc()
|
||||||
: DebugInfoDesc(DW_TAG_anchor)
|
: DebugInfoDesc(DW_TAG_anchor)
|
||||||
, Name("")
|
, AnchorTag(0)
|
||||||
{}
|
{}
|
||||||
AnchorDesc::AnchorDesc(const std::string &N)
|
AnchorDesc::AnchorDesc(AnchoredDesc *D)
|
||||||
: DebugInfoDesc(DW_TAG_anchor)
|
: DebugInfoDesc(DW_TAG_anchor)
|
||||||
, Name(N)
|
, AnchorTag(D->getTag())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// Implement isa/cast/dyncast.
|
// Implement isa/cast/dyncast.
|
||||||
@ -562,13 +562,26 @@ GlobalValue::LinkageTypes AnchorDesc::getLinkage() const {
|
|||||||
void AnchorDesc::ApplyToFields(DIVisitor *Visitor) {
|
void AnchorDesc::ApplyToFields(DIVisitor *Visitor) {
|
||||||
DebugInfoDesc::ApplyToFields(Visitor);
|
DebugInfoDesc::ApplyToFields(Visitor);
|
||||||
|
|
||||||
Visitor->Apply(Name);
|
Visitor->Apply(AnchorTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getDescString - Return a string used to compose global names and labels.
|
/// getDescString - Return a string used to compose global names and labels. A
|
||||||
///
|
/// A global variable name needs to be defined for each debug descriptor that is
|
||||||
|
/// anchored. NOTE: that each global variable name here also needs to be added
|
||||||
|
/// to the list of names left external in the internalizer.
|
||||||
|
/// ExternalNames.insert("llvm.dbg.compile_units");
|
||||||
|
/// ExternalNames.insert("llvm.dbg.global_variables");
|
||||||
|
/// ExternalNames.insert("llvm.dbg.subprograms");
|
||||||
const char *AnchorDesc::getDescString() const {
|
const char *AnchorDesc::getDescString() const {
|
||||||
return Name.c_str();
|
switch (AnchorTag) {
|
||||||
|
case DW_TAG_compile_unit: return CompileUnitDesc::AnchorString;
|
||||||
|
case DW_TAG_variable: return GlobalVariableDesc::AnchorString;
|
||||||
|
case DW_TAG_subprogram: return SubprogramDesc::AnchorString;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(0 && "Tag does not have a case for anchor string");
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getTypeString - Return a string used to label this descriptors type.
|
/// getTypeString - Return a string used to label this descriptors type.
|
||||||
@ -581,7 +594,7 @@ const char *AnchorDesc::getTypeString() const {
|
|||||||
void AnchorDesc::dump() {
|
void AnchorDesc::dump() {
|
||||||
std::cerr << getDescString() << " "
|
std::cerr << getDescString() << " "
|
||||||
<< "Tag(" << getTag() << "), "
|
<< "Tag(" << getTag() << "), "
|
||||||
<< "Name(" << Name << ")\n";
|
<< "AnchorTag(" << AnchorTag << ")\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -649,8 +662,9 @@ const char *CompileUnitDesc::getTypeString() const {
|
|||||||
|
|
||||||
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
||||||
///
|
///
|
||||||
|
const char *CompileUnitDesc::AnchorString = "llvm.dbg.compile_units";
|
||||||
const char *CompileUnitDesc::getAnchorString() const {
|
const char *CompileUnitDesc::getAnchorString() const {
|
||||||
return "llvm.dbg.compile_units";
|
return AnchorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -1014,8 +1028,9 @@ const char *GlobalVariableDesc::getTypeString() const {
|
|||||||
|
|
||||||
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
||||||
///
|
///
|
||||||
|
const char *GlobalVariableDesc::AnchorString = "llvm.dbg.global_variables";
|
||||||
const char *GlobalVariableDesc::getAnchorString() const {
|
const char *GlobalVariableDesc::getAnchorString() const {
|
||||||
return "llvm.dbg.global_variables";
|
return AnchorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
@ -1063,8 +1078,9 @@ const char *SubprogramDesc::getTypeString() const {
|
|||||||
|
|
||||||
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
/// getAnchorString - Return a string used to label this descriptor's anchor.
|
||||||
///
|
///
|
||||||
|
const char *SubprogramDesc::AnchorString = "llvm.dbg.subprograms";
|
||||||
const char *SubprogramDesc::getAnchorString() const {
|
const char *SubprogramDesc::getAnchorString() const {
|
||||||
return "llvm.dbg.subprograms";
|
return AnchorString;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -112,9 +112,10 @@ bool InternalizePass::runOnModule(Module &M) {
|
|||||||
ExternalNames.insert("llvm.used");
|
ExternalNames.insert("llvm.used");
|
||||||
|
|
||||||
// Never internalize anchors used by the debugger, else the debugger won't
|
// Never internalize anchors used by the debugger, else the debugger won't
|
||||||
// find them.
|
// find them. (see MachineDebugInfo.)
|
||||||
ExternalNames.insert("llvm.dbg.translation_units");
|
ExternalNames.insert("llvm.dbg.compile_units");
|
||||||
ExternalNames.insert("llvm.dbg.globals");
|
ExternalNames.insert("llvm.dbg.global_variables");
|
||||||
|
ExternalNames.insert("llvm.dbg.subprograms");
|
||||||
|
|
||||||
// Mark all global variables with initializers as internal as well.
|
// Mark all global variables with initializers as internal as well.
|
||||||
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user