forked from OSchip/llvm-project
Revert r163878 as it breaks on targets with alternate register names. Such targets do not exist in the main tree so this was not noticed.
llvm-svn: 163959
This commit is contained in:
parent
945a819326
commit
f8f0a23ce7
|
@ -575,13 +575,12 @@ emitRegisterNameString(raw_ostream &O, StringRef AltName,
|
||||||
StringTable.add(AsmName);
|
StringTable.add(AsmName);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Entries = StringTable.layout();
|
StringTable.layout();
|
||||||
O << " static const char AsmStrs" << AltName << "[] = {\n";
|
O << " static const char AsmStrs" << AltName << "[] = {\n";
|
||||||
StringTable.emit(O, printChar);
|
StringTable.emit(O, printChar);
|
||||||
O << " };\n\n";
|
O << " };\n\n";
|
||||||
|
|
||||||
O << " static const uint" << ((Entries > 0xffff) ? "32" : "16")
|
O << " static const uint32_t RegAsmOffset" << AltName << "[] = {";
|
||||||
<< "_t RegAsmOffset" << AltName << "[] = {";
|
|
||||||
for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
|
||||||
if ((i % 14) == 0)
|
if ((i % 14) == 0)
|
||||||
O << "\n ";
|
O << "\n ";
|
||||||
|
@ -620,7 +619,7 @@ void AsmWriterEmitter::EmitGetRegisterName(raw_ostream &O) {
|
||||||
emitRegisterNameString(O, "", Registers);
|
emitRegisterNameString(O, "", Registers);
|
||||||
|
|
||||||
if (hasAltNames) {
|
if (hasAltNames) {
|
||||||
O << " const unsigned *RegAsmOffset;\n"
|
O << " const uint32_t *RegAsmOffset;\n"
|
||||||
<< " const char *AsmStrs;\n"
|
<< " const char *AsmStrs;\n"
|
||||||
<< " switch(AltIdx) {\n"
|
<< " switch(AltIdx) {\n"
|
||||||
<< " default: llvm_unreachable(\"Invalid register alt name index!\");\n";
|
<< " default: llvm_unreachable(\"Invalid register alt name index!\");\n";
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
bool empty() const { return Seqs.empty(); }
|
bool empty() const { return Seqs.empty(); }
|
||||||
|
|
||||||
/// layout - Computes the final table layout.
|
/// layout - Computes the final table layout.
|
||||||
unsigned layout() {
|
void layout() {
|
||||||
assert(Entries == 0 && "Can only call layout() once");
|
assert(Entries == 0 && "Can only call layout() once");
|
||||||
// Lay out the table in Seqs iteration order.
|
// Lay out the table in Seqs iteration order.
|
||||||
for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I != E;
|
for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I != E;
|
||||||
|
@ -93,7 +93,6 @@ public:
|
||||||
// Include space for a terminator.
|
// Include space for a terminator.
|
||||||
Entries += I->first.size() + 1;
|
Entries += I->first.size() + 1;
|
||||||
}
|
}
|
||||||
return Entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get - Returns the offset of Seq in the final table.
|
/// get - Returns the offset of Seq in the final table.
|
||||||
|
|
Loading…
Reference in New Issue