mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-06 12:04:52 +00:00
e8660ea63d
Summary: The SelectionDAG importer now imports rules with Predicate's attached via Requires, PredicateControl, etc. These predicates are implemented as bitset's to allow multiple predicates to be tested together. However, unlike the MC layer subtarget features, each target only pays for it's own predicates (e.g. AArch64 doesn't have 192 feature bits just because X86 needs a lot). Both AArch64 and X86 derive at least one predicate from the MachineFunction or Function so they must re-initialize AvailableFeatures before each function. They also declare locals in <Target>InstructionSelector so that computeAvailableFeatures() can use the code from SelectionDAG without modification. Reviewers: rovka, qcolombet, aditya_nandakumar, t.p.northover, ab Reviewed By: rovka Subscribers: aemerson, rengolin, dberris, kristof.beyls, llvm-commits, igorb Differential Revision: https://reviews.llvm.org/D31418 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300993 91177308-0d34-0410-b5e6-96231b3b80d8
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
//===- Types.cpp - Helper for the selection of C++ data types. ------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Types.h"
|
|
|
|
// For LLVM_ATTRIBUTE_UNUSED
|
|
#include "llvm/Support/Compiler.h"
|
|
|
|
#include <cassert>
|
|
|
|
using namespace llvm;
|
|
|
|
const char *llvm::getMinimalTypeForRange(uint64_t Range, unsigned MaxSize LLVM_ATTRIBUTE_UNUSED) {
|
|
// TODO: The original callers only used 32 and 64 so these are the only
|
|
// values permitted. Rather than widen the supported values we should
|
|
// allow 64 for the callers that currently use 32 and remove the
|
|
// argument altogether.
|
|
assert((MaxSize == 32 || MaxSize == 64) && "Unexpected size");
|
|
assert(MaxSize <= 64 && "Unexpected size");
|
|
assert(((MaxSize > 32) ? Range <= 0xFFFFFFFFFFFFFFFFULL
|
|
: Range <= 0xFFFFFFFFULL) &&
|
|
"Enum too large");
|
|
|
|
if (Range > 0xFFFFFFFFULL)
|
|
return "uint64_t";
|
|
if (Range > 0xFFFF)
|
|
return "uint32_t";
|
|
if (Range > 0xFF)
|
|
return "uint16_t";
|
|
return "uint8_t";
|
|
}
|
|
|
|
const char *llvm::getMinimalTypeForEnumBitfield(uint64_t Size) {
|
|
uint64_t MaxIndex = Size;
|
|
if (MaxIndex > 0)
|
|
MaxIndex--;
|
|
assert(MaxIndex <= 64 && "Too many bits");
|
|
return getMinimalTypeForRange(1ULL << MaxIndex);
|
|
}
|