aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-02-29 21:57:08 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-02-29 21:57:08 +0000
commitb9ace0215d20e29a0e59de2917178ad5e308a835 (patch)
treeaa59e042628011e04d45f2f49dec3b88d1c97d28 /utils/TableGen/CodeGenTarget.cpp
parenteea87153d10b9aa774eb5118a58735b4af6489b8 (diff)
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
Diffstat (limited to 'utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--utils/TableGen/CodeGenTarget.cpp8
1 files changed, 8 insertions, 0 deletions
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.
///