This reverts commit 151760.
We want to move getSubReg() from TargetRegisterInfo into MCRegisterInfo,
but to do that, the type of the lookup table needs to be the same for
all targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151814
91177308-0d34-0410-b5e6-
96231b3b80d8
+static const char *getMinimalTypeForRange(uint64_t Range) {
+ assert(Range < 0xFFFFFFFFULL && "Enum too large");
+ if (Range > 0xFFFF)
+ return "uint32_t";
+ if (Range > 0xFF)
+ return "uint16_t";
+ return "uint8_t";
+}
+
static void EmitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
const AsmMatcherInfo &Info, StringRef ClassName) {
// Emit the static custom operand parsing table;
static void EmitCustomOperandParsing(raw_ostream &OS, CodeGenTarget &Target,
const AsmMatcherInfo &Info, StringRef ClassName) {
// Emit the static custom operand parsing table;
return Namespace + "::" + R->getName();
}
return Namespace + "::" + R->getName();
}
-const char *llvm::getMinimalTypeForRange(uint64_t Range) {
- assert(Range < 0xFFFFFFFFULL && "Enum too large");
- if (Range > 0xFFFF)
- return "uint32_t";
- if (Range > 0xFF)
- return "uint16_t";
- return "uint8_t";
-}
/// getTarget - Return the current instance of the Target class.
///
/// getTarget - Return the current instance of the Target class.
///
/// namespace qualifier if the record contains one.
std::string getQualifiedName(const Record *R);
/// namespace qualifier if the record contains one.
std::string getQualifiedName(const Record *R);
-/// getMinimalTypeForRange - Helper method to get the minimum data type required
-/// to represent Range.
-const char *getMinimalTypeForRange(uint64_t Range);
-
/// CodeGenTarget - This class corresponds to the Target class in the .td files.
///
class CodeGenTarget {
/// CodeGenTarget - This class corresponds to the Target class in the .td files.
///
class CodeGenTarget {
// Emit the data table for getSubReg().
if (SubRegIndices.size()) {
// Emit the data table for getSubReg().
if (SubRegIndices.size()) {
- OS << "static const " << getMinimalTypeForRange(Regs.size()) << ' '
- << TargetName << "SubRegTable[][" << SubRegIndices.size() << "] = {\n";
+ OS << "static const unsigned short " << TargetName << "SubRegTable[]["
+ << SubRegIndices.size() << "] = {\n";
for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
const CodeGenRegister::SubRegMap &SRM = Regs[i]->getSubRegs();
OS << " /* " << Regs[i]->TheDef->getName() << " */\n";
for (unsigned i = 0, e = Regs.size(); i != e; ++i) {
const CodeGenRegister::SubRegMap &SRM = Regs[i]->getSubRegs();
OS << " /* " << Regs[i]->TheDef->getName() << " */\n";