1. Hash not quite right for DIEValues.

2. Not going to use Usage (no significant benefit.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31384 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Laskey 2006-11-02 21:48:18 +00:00
parent 63fd6ad77b
commit f673388351

View File

@ -354,19 +354,13 @@ public:
/// ///
unsigned Type; unsigned Type;
/// Usage - Number of uses of this value.
///
unsigned Usage;
DIEValue(unsigned T) DIEValue(unsigned T)
: Type(T) : Type(T)
, Usage(1)
{} {}
virtual ~DIEValue() {} virtual ~DIEValue() {}
// Accessors
unsigned getType() const { return Type; } unsigned getType() const { return Type; }
unsigned getUsage() const { return Usage; }
void IncUsage() { ++Usage; }
// Implement isa/cast/dyncast. // Implement isa/cast/dyncast.
static bool classof(const DIEValue *) { return true; } static bool classof(const DIEValue *) { return true; }
@ -445,6 +439,7 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void Profile(FoldingSetNodeID &ID) { virtual void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isInteger);
ID.AddInteger(Integer); ID.AddInteger(Integer);
} }
@ -482,6 +477,7 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void Profile(FoldingSetNodeID &ID) { virtual void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isString);
ID.AddString(String); ID.AddString(String);
} }
@ -517,6 +513,7 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void Profile(FoldingSetNodeID &ID) { virtual void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isLabel);
Label.Profile(ID); Label.Profile(ID);
} }
@ -553,6 +550,7 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void Profile(FoldingSetNodeID &ID) { virtual void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isAsIsLabel);
ID.AddString(Label); ID.AddString(Label);
} }
@ -589,6 +587,7 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void Profile(FoldingSetNodeID &ID){ virtual void Profile(FoldingSetNodeID &ID){
ID.AddInteger(isDelta);
LabelHi.Profile(ID); LabelHi.Profile(ID);
LabelLo.Profile(ID); LabelLo.Profile(ID);
} }
@ -630,6 +629,8 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void Profile(FoldingSetNodeID &ID) { virtual void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isEntry);
if (Entry) { if (Entry) {
ID.AddPointer(Entry); ID.AddPointer(Entry);
} else { } else {
@ -688,6 +689,7 @@ public:
/// Profile - Used to gather unique data for the value folding set. /// Profile - Used to gather unique data for the value folding set.
/// ///
virtual void DIEBlock::Profile(FoldingSetNodeID &ID) { virtual void DIEBlock::Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isBlock);
DIE::Profile(ID); DIE::Profile(ID);
} }
@ -1147,10 +1149,7 @@ public:
void *Where; void *Where;
Value = static_cast<DIEntry *>(ValuesSet.FindNodeOrInsertPos(ID, Where)); Value = static_cast<DIEntry *>(ValuesSet.FindNodeOrInsertPos(ID, Where));
if (Value) { if (Value) return Value;
Value->IncUsage();
return Value;
}
Value = new DIEntry(Entry); Value = new DIEntry(Entry);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
@ -1184,8 +1183,6 @@ public:
Value = new DIEInteger(Integer); Value = new DIEInteger(Integer);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else {
Value->IncUsage();
} }
Die->AddValue(Attribute, Form, Value); Die->AddValue(Attribute, Form, Value);
@ -1204,8 +1201,6 @@ public:
Value = new DIEInteger(Integer); Value = new DIEInteger(Integer);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else {
Value->IncUsage();
} }
Die->AddValue(Attribute, Form, Value); Die->AddValue(Attribute, Form, Value);
@ -1223,8 +1218,6 @@ public:
Value = new DIEString(String); Value = new DIEString(String);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else {
Value->IncUsage();
} }
Die->AddValue(Attribute, Form, Value); Die->AddValue(Attribute, Form, Value);
@ -1242,8 +1235,6 @@ public:
Value = new DIEDwarfLabel(Label); Value = new DIEDwarfLabel(Label);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else {
Value->IncUsage();
} }
Die->AddValue(Attribute, Form, Value); Die->AddValue(Attribute, Form, Value);
@ -1261,8 +1252,6 @@ public:
Value = new DIEObjectLabel(Label); Value = new DIEObjectLabel(Label);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else {
Value->IncUsage();
} }
Die->AddValue(Attribute, Form, Value); Die->AddValue(Attribute, Form, Value);
@ -1281,8 +1270,6 @@ public:
Value = new DIEDelta(Hi, Lo); Value = new DIEDelta(Hi, Lo);
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else {
Value->IncUsage();
} }
Die->AddValue(Attribute, Form, Value); Die->AddValue(Attribute, Form, Value);
@ -1307,7 +1294,6 @@ public:
ValuesSet.InsertNode(Value, Where); ValuesSet.InsertNode(Value, Where);
Values.push_back(Value); Values.push_back(Value);
} else { } else {
Value->IncUsage();
delete Block; delete Block;
} }
@ -1402,7 +1388,6 @@ private:
// If it exists then use the existing value. // If it exists then use the existing value.
if (Slot) { if (Slot) {
Slot->IncUsage();
Entity->AddValue(DW_AT_type, DW_FORM_ref4, Slot); Entity->AddValue(DW_AT_type, DW_FORM_ref4, Slot);
return; return;
} }