25#define DEBUG_TYPE "riscv-subtarget"
27#define GET_SUBTARGETINFO_TARGET_DESC
28#define GET_SUBTARGETINFO_CTOR
29#include "RISCVGenSubtargetInfo.inc"
31#define GET_RISCV_MACRO_FUSION_PRED_IMPL
32#include "RISCVGenMacroFusion.inc"
36#define GET_RISCVTuneInfoTable_IMPL
37#include "RISCVGenSearchableTables.inc"
41 "riscv-v-fixed-length-vector-lmul-max",
42 cl::desc(
"The maximum LMUL value to use for fixed length vectors. "
43 "Fractional LMUL values are not supported."),
47 "riscv-disable-using-constant-pool-for-large-ints",
48 cl::desc(
"Disable using constant pool for large integers."),
52 "riscv-max-build-ints-cost",
57 cl::desc(
"Enable the use of AA during codegen."));
61 cl::desc(
"Set minimum number of entries to use a jump table on RISCV"));
64 "use-riscv-mips-load-store-pairs",
69 cl::desc(
"Use 'mips.ccmov' instruction"),
73 "riscv-enable-p-ext-simd-codegen",
74 cl::desc(
"Turn on P Extension SIMD codegen(This is a temporary switch "
75 "where only partial codegen is currently supported)"),
78void RISCVSubtarget::anchor() {}
81RISCVSubtarget::initializeSubtargetDependencies(
const Triple &TT,
StringRef CPU,
85 bool Is64Bit =
TT.isArch64Bit();
86 if (CPU.
empty() || CPU ==
"generic")
87 CPU = Is64Bit ?
"generic-rv64" :
"generic-rv32";
91 if (TuneCPU ==
"generic")
92 TuneCPU = Is64Bit ?
"generic-rv64" :
"generic-rv32";
94 TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(TuneCPU);
97 TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(
"generic");
98 assert(TuneInfo &&
"TuneInfo shouldn't be nullptr!");
108 StringRef ABIName,
unsigned RVVVectorBitsMin,
109 unsigned RVVVectorBitsMax,
112 IsLittleEndian(TT.
isLittleEndian()), RVVVectorBitsMin(RVVVectorBitsMin),
113 RVVVectorBitsMax(RVVVectorBitsMax),
115 initializeSubtargetDependencies(TT, CPU, TuneCPU, FS, ABIName)),
116 InstrInfo(*this), TLInfo(TM, *this) {
117 TSInfo = std::make_unique<RISCVSelectionDAGInfo>();
168 ? getSchedModel().LoadLatency + 1
174 "Tried to get vector length without Zve or V extension support!");
178 if (RVVVectorBitsMax != 0 && RVVVectorBitsMax < ZvlLen)
180 "than the Zvl*b limitation");
182 return RVVVectorBitsMax;
187 "Tried to get vector length without Zve or V extension support!");
189 if (RVVVectorBitsMin == -1U)
194 if (RVVVectorBitsMin != 0 && RVVVectorBitsMin < ZvlLen)
196 "than the Zvl*b limitation");
198 return RVVVectorBitsMin;
203 "Tried to get vector length without Zve or V extension support!");
206 "V extension requires a LMUL to be at most 8 and a power of 2!");
218 return getSchedModel().hasInstrSchedModel();
228 : TuneInfo->MinimumJumpTableEntries;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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< bool > UseMIPSCCMovInsn("use-riscv-mips-ccmov", cl::desc("Use 'mips.ccmov' instruction"), cl::init(true), cl::Hidden)
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 > UseMIPSLoadStorePairsOpt("use-riscv-mips-load-store-pairs", cl::desc("Enable the load/store pair optimization pass"), cl::init(false), cl::Hidden)
static cl::opt< bool > EnablePExtSIMDCodeGen("riscv-enable-p-ext-simd-codegen", cl::desc("Turn on P Extension SIMD codegen(This is a temporary switch " "where only partial codegen is currently supported)"), cl::init(false), cl::Hidden)
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)
This class provides the information for the target register banks.
unsigned getMinimumJumpTableEntries() const
const LegalizerInfo * getLegalizerInfo() const override
void overrideSchedPolicy(MachineSchedPolicy &Policy, const SchedRegion &Region) const override
std::unique_ptr< LegalizerInfo > Legalizer
unsigned getMaxLMULForFixedLengthVectors() const
bool useMIPSLoadStorePairs() const
bool useRVVForFixedLengthVectors() const
MISched::Direction getPostRASchedDirection() 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)
bool useMIPSCCMovInsn() const
const RISCVRegisterBankInfo * getRegBankInfo() const override
const CallLowering * getCallLowering() const override
InstructionSelector * getInstructionSelector() const override
unsigned getMaxBuildIntsCost() const
std::unique_ptr< const SelectionDAGTargetInfo > TSInfo
bool hasVInstructions() const
bool useAA() const override
Enable use of alias analysis during code generation (during MI scheduling, DAGCombine,...
bool enableMachinePipeliner() const override
bool useConstantPoolForLargeInts() const
bool isLittleEndian() const
bool enablePExtSIMDCodeGen() const
~RISCVSubtarget() override
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
void overridePostRASchedPolicy(MachineSchedPolicy &Policy, const SchedRegion &Region) const override
bool enableSubRegLiveness() const override
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
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.
InstructionSelector * createRISCVInstructionSelector(const RISCVTargetMachine &TM, const RISCVSubtarget &Subtarget, const RISCVRegisterBankInfo &RBI)
constexpr bool has_single_bit(T Value) noexcept
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
T bit_floor(T Value)
Returns the largest integral power of two no greater than Value if Value is nonzero.
Define a generic scheduling policy for targets that don't provide their own MachineSchedStrategy.
bool DisableLatencyHeuristic
A region of an MBB for scheduling.