mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
Don't use enums larger than 1 << 31 for target features.
Patch by Andy Zhang! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147491 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6d5b7cc235
commit
ac1ed44d95
@ -39,29 +39,42 @@ void SubtargetEmitter::Enumeration(raw_ostream &OS,
|
||||
|
||||
OS << "namespace " << Target << " {\n";
|
||||
|
||||
// Open enumeration
|
||||
OS << "enum {\n";
|
||||
// For bit flag enumerations with more than 32 items, emit constants.
|
||||
// Emit an enum for everything else.
|
||||
if (isBits && N > 32) {
|
||||
// For each record
|
||||
for (unsigned i = 0; i < N; i++) {
|
||||
// Next record
|
||||
Record *Def = DefList[i];
|
||||
|
||||
// For each record
|
||||
for (unsigned i = 0; i < N;) {
|
||||
// Next record
|
||||
Record *Def = DefList[i];
|
||||
// Get and emit name and expression (1 << i)
|
||||
OS << " const uint64_t " << Def->getName() << " = 1ULL << " << i << ";\n";
|
||||
}
|
||||
} else {
|
||||
// Open enumeration
|
||||
OS << "enum {\n";
|
||||
|
||||
// Get and emit name
|
||||
OS << " " << Def->getName();
|
||||
// For each record
|
||||
for (unsigned i = 0; i < N;) {
|
||||
// Next record
|
||||
Record *Def = DefList[i];
|
||||
|
||||
// If bit flags then emit expression (1 << i)
|
||||
if (isBits) OS << " = " << " 1ULL << " << i;
|
||||
// Get and emit name
|
||||
OS << " " << Def->getName();
|
||||
|
||||
// Depending on 'if more in the list' emit comma
|
||||
if (++i < N) OS << ",";
|
||||
// If bit flags then emit expression (1 << i)
|
||||
if (isBits) OS << " = " << " 1ULL << " << i;
|
||||
|
||||
OS << "\n";
|
||||
// Depending on 'if more in the list' emit comma
|
||||
if (++i < N) OS << ",";
|
||||
|
||||
OS << "\n";
|
||||
}
|
||||
|
||||
// Close enumeration
|
||||
OS << "};\n";
|
||||
}
|
||||
|
||||
// Close enumeration
|
||||
OS << "};\n";
|
||||
|
||||
OS << "}\n";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user