diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.cpp index eec2e7359eda..7b64d3cee9c8 100644 --- a/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.cpp +++ b/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.cpp @@ -29,6 +29,12 @@ using namespace llvm; #define GET_SUBTARGETINFO_CTOR #include "RISCVGenSubtargetInfo.inc" +namespace llvm::RISCVTuneInfoTable { + +#define GET_RISCVTuneInfoTable_IMPL +#include "RISCVGenSearchableTables.inc" +} // namespace llvm::RISCVTuneInfoTable + static cl::opt<bool> EnableSubRegLiveness("riscv-enable-subreg-liveness", cl::init(true), cl::Hidden); @@ -48,6 +54,13 @@ static cl::opt<unsigned> RISCVMaxBuildIntsCost( cl::desc("The maximum cost used for building integers."), cl::init(0), cl::Hidden); +static cl::opt<bool> UseAA("riscv-use-aa", cl::init(true), + cl::desc("Enable the use of AA during codegen.")); + +static cl::opt<unsigned> RISCVMinimumJumpTableEntries( + "riscv-min-jump-table-entries", cl::Hidden, + cl::desc("Set minimum number of entries to use a jump table on RISCV")); + void RISCVSubtarget::anchor() {} RISCVSubtarget & @@ -62,12 +75,13 @@ RISCVSubtarget::initializeSubtargetDependencies(const Triple &TT, StringRef CPU, if (TuneCPU.empty()) TuneCPU = CPU; - ParseSubtargetFeatures(CPU, TuneCPU, FS); - if (Is64Bit) { - XLenVT = MVT::i64; - XLen = 64; - } + TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(TuneCPU); + // If there is no TuneInfo for this CPU, we fail back to generic. + if (!TuneInfo) + TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo("generic"); + assert(TuneInfo && "TuneInfo shouldn't be nullptr!"); + ParseSubtargetFeatures(CPU, TuneCPU, FS); TargetABI = RISCVABI::computeTargetABI(TT, getFeatureBits(), ABIName); RISCVFeatures::validate(TT, getFeatureBits()); return *this; @@ -175,3 +189,13 @@ void RISCVSubtarget::getPostRAMutations( std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const { Mutations.push_back(createRISCVMacroFusionDAGMutation()); } + + /// Enable use of alias analysis during code generation (during MI + /// scheduling, DAGCombine, etc.). +bool RISCVSubtarget::useAA() const { return UseAA; } + +unsigned RISCVSubtarget::getMinimumJumpTableEntries() const { + return RISCVMinimumJumpTableEntries.getNumOccurrences() > 0 + ? RISCVMinimumJumpTableEntries + : TuneInfo->MinimumJumpTableEntries; +} |