[PATCH] D25617: [tablegen] Merge duplicate definitions of getMinimalTypeForRange. NFC.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 12:00:47 PST 2016


qcolombet added inline comments.


================
Comment at: utils/TableGen/Types.cpp:17
+const char *llvm::getMinimalTypeForRange(uint64_t Range, unsigned MaxSize) {
+  if (MaxSize > 32) {
+    assert(Range <= 0xFFFFFFFFFFFFFFFFULL && "Enum too large");
----------------
Get rid of that if.


================
Comment at: utils/TableGen/Types.cpp:22
+  } else
+    assert(Range < 0xFFFFFFFFULL && "Enum too large");
+  if (Range > 0xFFFF)
----------------
Adapt the assert to the MaxSize.
Also check that MaxSize is smaller or equal than 64.


================
Comment at: utils/TableGen/Types.h:19
+/// supports values of at least 32.
+const char *getMinimalTypeForRange(uint64_t Range, unsigned MaxSize = 64);
+}
----------------
I would move a bit differently with the implementation.

I would say that MaxSize is just for static assert and that it must be smaller or equal to 64.


https://reviews.llvm.org/D25617





More information about the llvm-commits mailing list