1 //===- Types.cpp - Helper for the selection of C++ data types. ------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // For LLVM_ATTRIBUTE_UNUSED
13 #include "llvm/Support/Compiler.h"
19 const char *llvm::getMinimalTypeForRange(uint64_t Range, unsigned MaxSize LLVM_ATTRIBUTE_UNUSED) {
20 // TODO: The original callers only used 32 and 64 so these are the only
21 // values permitted. Rather than widen the supported values we should
22 // allow 64 for the callers that currently use 32 and remove the
23 // argument altogether.
24 assert((MaxSize == 32 || MaxSize == 64) && "Unexpected size");
25 assert(MaxSize <= 64 && "Unexpected size");
26 assert(((MaxSize > 32) ? Range <= 0xFFFFFFFFFFFFFFFFULL
27 : Range <= 0xFFFFFFFFULL) &&
30 if (Range > 0xFFFFFFFFULL)
39 const char *llvm::getMinimalTypeForEnumBitfield(uint64_t Size) {
40 uint64_t MaxIndex = Size;
43 assert(MaxIndex <= 64 && "Too many bits");
44 return getMinimalTypeForRange(1ULL << MaxIndex);