From b9ace0215d20e29a0e59de2917178ad5e308a835 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 29 Feb 2012 21:57:08 +0000 Subject: Emit the SubRegTable with the smallest possible integer type. Doesn't help ARM with its massive register set, but halves the size on x86 and all other targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151760 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/CodeGenTarget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'utils/TableGen/CodeGenTarget.cpp') diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index cf6793570a..1eb1a54e56 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -108,6 +108,14 @@ std::string llvm::getQualifiedName(const Record *R) { 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. /// -- cgit v1.2.3