26#define DEBUG_TYPE "riscv-subtarget"
28#define GET_SUBTARGETINFO_TARGET_DESC
29#define GET_SUBTARGETINFO_CTOR
30#include "RISCVGenSubtargetInfo.inc"
32#define GET_RISCV_MACRO_FUSION_PRED_IMPL
33#include "RISCVGenMacroFusion.inc"
37#define GET_RISCVTuneInfoTable_IMPL
38#include "RISCVGenSearchableTables.inc"
42 "riscv-v-fixed-length-vector-lmul-max",
43 cl::desc(
"The maximum LMUL value to use for fixed length vectors. "
44 "Fractional LMUL values are not supported."),
48 "riscv-disable-using-constant-pool-for-large-ints",
49 cl::desc(
"Disable using constant pool for large integers."),
53 "riscv-max-build-ints-cost",
58 cl::desc(
"Enable the use of AA during codegen."));
62 cl::desc(
"Set minimum number of entries to use a jump table on RISCV"));
64void RISCVSubtarget::anchor() {}
67RISCVSubtarget::initializeSubtargetDependencies(
const Triple &TT,
StringRef CPU,
71 bool Is64Bit =
TT.isArch64Bit();
72 if (CPU.
empty() || CPU ==
"generic")
73 CPU = Is64Bit ?
"generic-rv64" :
"generic-rv32";
78 TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(TuneCPU);
81 TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(
"generic");
82 assert(TuneInfo &&
"TuneInfo shouldn't be nullptr!");
92 StringRef ABIName,
unsigned RVVVectorBitsMin,
93 unsigned RVVVectorBitsMax,
96 RVVVectorBitsMin(RVVVectorBitsMin), RVVVectorBitsMax(RVVVectorBitsMax),
98 initializeSubtargetDependencies(TT, CPU, TuneCPU, FS, ABIName)),
99 InstrInfo(*this), RegInfo(getHwMode()), TLInfo(TM, *this) {}
139 ? getSchedModel().LoadLatency + 1
145 "Tried to get vector length without Zve or V extension support!");
149 if (RVVVectorBitsMax != 0 && RVVVectorBitsMax < ZvlLen)
151 "than the Zvl*b limitation");
153 return RVVVectorBitsMax;
158 "Tried to get vector length without Zve or V extension support!");
160 if (RVVVectorBitsMin == -1U)
165 if (RVVVectorBitsMin != 0 && RVVVectorBitsMin < ZvlLen)
167 "than the Zvl*b limitation");
169 return RVVVectorBitsMin;
174 "Tried to get vector length without Zve or V extension support!");
177 "V extension requires a LMUL to be at most 8 and a power of 2!");
189 std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations)
const {
static cl::opt< bool > UseAA("aarch64-use-aa", cl::init(true), cl::desc("Enable the use of AA during codegen."))
This file describes how to lower LLVM calls to machine code calls.
This file declares the targeting of the Machinelegalizer class for RISC-V.
static cl::opt< unsigned > RVVVectorLMULMax("riscv-v-fixed-length-vector-lmul-max", cl::desc("The maximum LMUL value to use for fixed length vectors. " "Fractional LMUL values are not supported."), cl::init(8), 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"))
static cl::opt< bool > RISCVDisableUsingConstantPoolForLargeInts("riscv-disable-using-constant-pool-for-large-ints", cl::desc("Disable using constant pool for large integers."), cl::init(false), cl::Hidden)
static cl::opt< unsigned > RISCVMaxBuildIntsCost("riscv-max-build-ints-cost", cl::desc("The maximum cost used for building integers."), cl::init(0), cl::Hidden)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class provides the information for the target register banks.
unsigned getMinimumJumpTableEntries() const
void getPostRAMutations(std::vector< std::unique_ptr< ScheduleDAGMutation > > &Mutations) const override
const LegalizerInfo * getLegalizerInfo() const override
unsigned getMaxLMULForFixedLengthVectors() const
bool useRVVForFixedLengthVectors() const
unsigned getMinRVVVectorSizeInBits() const
std::unique_ptr< InstructionSelector > InstSelector
RISCVSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, StringRef ABIName, unsigned RVVVectorBitsMin, unsigned RVVVectorLMULMax, const TargetMachine &TM)
const RISCVRegisterBankInfo * getRegBankInfo() const override
const CallLowering * getCallLowering() const override
InstructionSelector * getInstructionSelector() const override
unsigned getMaxBuildIntsCost() const
bool hasVInstructions() const
bool useAA() const override
Enable use of alias analysis during code generation (during MI scheduling, DAGCombine,...
bool useConstantPoolForLargeInts() const
unsigned getMaxRVVVectorSizeInBits() const
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
std::unique_ptr< RISCVRegisterBankInfo > RegBankInfo
std::unique_ptr< CallLowering > CallLoweringInfo
const RISCVTargetLowering * getTargetLowering() const override
bool enableSubRegLiveness() const override
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
const TargetMachine & getTargetMachine() const
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits, StringRef ABIName)
void validate(const Triple &TT, const FeatureBitset &FeatureBits)
static constexpr unsigned RVVBitsPerBlock
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(ArrayRef< MacroFusionPredTy > Predicates, bool BranchOnly=false)
Create a DAG scheduling mutation to pair instructions back to back for instructions that benefit acco...
InstructionSelector * createRISCVInstructionSelector(const RISCVTargetMachine &TM, const RISCVSubtarget &Subtarget, const RISCVRegisterBankInfo &RBI)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
T bit_floor(T Value)
Returns the largest integral power of two no greater than Value if Value is nonzero.
unsigned MinimumJumpTableEntries