27#define DEBUG_TYPE "riscv-subtarget"
29#define GET_SUBTARGETINFO_TARGET_DESC
30#define GET_SUBTARGETINFO_CTOR
31#include "RISCVGenSubtargetInfo.inc"
33#define GET_RISCV_MACRO_FUSION_PRED_IMPL
34#include "RISCVGenMacroFusion.inc"
38#define GET_RISCVTuneInfoTable_IMPL
39#include "RISCVGenSearchableTables.inc"
43 "riscv-disable-using-constant-pool-for-large-ints",
44 cl::desc(
"Disable using constant pool for large integers."),
48 "riscv-max-build-ints-cost",
53 cl::desc(
"Enable the use of AA during codegen."));
57 cl::desc(
"Set minimum number of entries to use a jump table on RISCV"));
60 "use-riscv-mips-load-store-pairs",
65 cl::desc(
"Use 'mips.ccmov' instruction"),
68void RISCVSubtarget::anchor() {}
71RISCVSubtarget::initializeSubtargetDependencies(
const Triple &TT,
StringRef CPU,
75 bool Is64Bit =
TT.isArch64Bit();
76 if (CPU.
empty() || CPU ==
"generic")
77 CPU = Is64Bit ?
"generic-rv64" :
"generic-rv32";
81 if (TuneCPU ==
"generic")
82 TuneCPU = Is64Bit ?
"generic-rv64" :
"generic-rv32";
84 TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(TuneCPU);
87 TuneInfo = RISCVTuneInfoTable::getRISCVTuneInfo(
"generic");
88 assert(TuneInfo &&
"TuneInfo shouldn't be nullptr!");
95 HasStdExtZcd =
hasFeature(RISCV::FeatureStdExtZcd);
96 HasStdExtZcf =
hasFeature(RISCV::FeatureStdExtZcf);
97 HasStdExtC =
hasFeature(RISCV::FeatureStdExtC);
98 HasStdExtZce =
hasFeature(RISCV::FeatureStdExtZce);
107 StringRef ABIName,
unsigned RVVVectorBitsMin,
108 unsigned RVVVectorBitsMax,
111 IsLittleEndian(TT.
isLittleEndian()), RVVVectorBitsMin(RVVVectorBitsMin),
112 RVVVectorBitsMax(RVVVectorBitsMax),
114 initializeSubtargetDependencies(TT, CPU, TuneCPU, FS, ABIName)),
115 InstrInfo(*this), TLInfo(TM, *this) {
116 TSInfo = std::make_unique<RISCVSelectionDAGInfo>();
169 if (!
is64Bit() && (VT == MVT::v4i8 || VT == MVT::v2i16))
172 return VT == MVT::v8i8 || VT == MVT::v4i16 || VT == MVT::v2i32;
180 return VT == MVT::v8i8 || VT == MVT::v4i16 || VT == MVT::v2i32;
190 ? getSchedModel().LoadLatency + 1
196 "Tried to get vector length without Zve or V extension support!");
200 if (RVVVectorBitsMax != 0 && RVVVectorBitsMax < ZvlLen)
202 "than the Zvl*b limitation");
204 return RVVVectorBitsMax;
209 "Tried to get vector length without Zve or V extension support!");
211 if (RVVVectorBitsMin == -1U)
216 if (RVVVectorBitsMin != 0 && RVVVectorBitsMin < ZvlLen)
218 "than the Zvl*b limitation");
220 return RVVVectorBitsMin;
225 "Tried to get vector length without Zve or V extension support!");
237 return getSchedModel().hasInstrSchedModel();
257 : 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."))
static bool hasFeature(StringRef Feature, const FeatureBitset &FeatureBits, ArrayRef< SubtargetFeatureKV > ProcFeatures)
This file describes how to lower LLVM calls to machine code calls.
This file describes how to lower LLVM inline asm to machine code INLINEASM.
This file declares the targeting of the Machinelegalizer class for RISC-V.
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 > 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)
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
LLVM_ABI void computeMaxCallFrameSize(MachineFunction &MF, std::vector< MachineBasicBlock::iterator > *FrameSDOps=nullptr)
Computes the maximum size of a callframe.
bool isMaxCallFrameSizeComputed() const
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
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 isPExtPackedDoubleType(MVT VT) const
bool useMIPSLoadStorePairs() const
const InlineAsmLowering * getInlineAsmLowering() const override
bool useRVVForFixedLengthVectors() const
MISched::Direction getPostRASchedDirection() const
std::unique_ptr< InlineAsmLowering > InlineAsmLoweringInfo
bool isPExtPackedType(MVT VT) 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
~RISCVSubtarget() override
unsigned getMaxRVVVectorSizeInBits() const
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
std::unique_ptr< RISCVRegisterBankInfo > RegBankInfo
void mirFileLoaded(MachineFunction &MF) const override
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...
Represent a constant reference to a string, i.e.
constexpr bool empty() const
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 MCSubtargetInfo &STI, StringRef ABIName)
void validate(const Triple &TT, const FeatureBitset &FeatureBits)
void updateCZceFeatureImplications(MCSubtargetInfo &STI)
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)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Define a generic scheduling policy for targets that don't provide their own MachineSchedStrategy.
bool DisableLatencyHeuristic
A region of an MBB for scheduling.