mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 01:03:52 +00:00
Stabilize 'getDwarfRegNumFull' output to not depend on random memory
orders, part of PR2590 llvm-svn: 55359
This commit is contained in:
parent
c5c00890e5
commit
e589d360a1
@ -1175,6 +1175,23 @@ public:
|
||||
void dump() const;
|
||||
};
|
||||
|
||||
/// LessRecord - Sorting predicate to sort record pointers by name.
|
||||
///
|
||||
struct LessRecord {
|
||||
bool operator()(const Record *Rec1, const Record *Rec2) const {
|
||||
return Rec1->getName() < Rec2->getName();
|
||||
}
|
||||
};
|
||||
|
||||
/// LessRecord - Sorting predicate to sort record pointers by their name field.
|
||||
///
|
||||
struct LessRecordFieldName {
|
||||
bool operator()(const Record *Rec1, const Record *Rec2) const {
|
||||
return Rec1->getValueAsString("Name") < Rec2->getValueAsString("Name");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &OS, const RecordKeeper &RK);
|
||||
|
||||
extern RecordKeeper Records;
|
||||
|
@ -422,7 +422,8 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
std::map<Record*, std::set<Record*> > RegisterSuperRegs;
|
||||
std::map<Record*, std::set<Record*> > RegisterAliases;
|
||||
std::map<Record*, std::vector<std::pair<int, Record*> > > SubRegVectors;
|
||||
std::map<Record*, std::vector<int> > DwarfRegNums;
|
||||
typedef std::map<Record*, std::vector<int>, LessRecord> DwarfRegNumsMapTy;
|
||||
DwarfRegNumsMapTy DwarfRegNums;
|
||||
|
||||
const std::vector<CodeGenRegister> &Regs = Target.getRegisters();
|
||||
|
||||
@ -693,8 +694,8 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
}
|
||||
|
||||
// Now we know maximal length of number list. Append -1's, where needed
|
||||
for (std::map<Record*, std::vector<int> >::iterator
|
||||
I = DwarfRegNums.begin(), E = DwarfRegNums.end(); I != E; ++I)
|
||||
for (DwarfRegNumsMapTy::iterator
|
||||
I = DwarfRegNums.begin(), E = DwarfRegNums.end(); I != E; ++I)
|
||||
for (unsigned i = I->second.size(), e = maxLength; i != e; ++i)
|
||||
I->second.push_back(-1);
|
||||
|
||||
@ -712,8 +713,11 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
<< " default:\n"
|
||||
<< " assert(0 && \"Invalid RegNum\");\n"
|
||||
<< " return -1;\n";
|
||||
|
||||
// Sort by name to get a stable order.
|
||||
|
||||
|
||||
for (std::map<Record*, std::vector<int> >::iterator
|
||||
for (DwarfRegNumsMapTy::iterator
|
||||
I = DwarfRegNums.begin(), E = DwarfRegNums.end(); I != E; ++I) {
|
||||
int RegNo = I->second[i];
|
||||
if (RegNo != -2)
|
||||
|
@ -19,24 +19,6 @@
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
//
|
||||
// Record sort by name function.
|
||||
//
|
||||
struct LessRecord {
|
||||
bool operator()(const Record *Rec1, const Record *Rec2) const {
|
||||
return Rec1->getName() < Rec2->getName();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Record sort by field "Name" function.
|
||||
//
|
||||
struct LessRecordFieldName {
|
||||
bool operator()(const Record *Rec1, const Record *Rec2) const {
|
||||
return Rec1->getValueAsString("Name") < Rec2->getValueAsString("Name");
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Enumeration - Emit the specified class as an enumeration.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user