aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/RISCV/RISCVSubtarget.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVSubtarget.h')
-rw-r--r--llvm/lib/Target/RISCV/RISCVSubtarget.h106
1 files changed, 96 insertions, 10 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.h b/llvm/lib/Target/RISCV/RISCVSubtarget.h
index 377d080ad4bf..8bec6edb324b 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -21,7 +21,7 @@
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
-#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
+#include "llvm/CodeGen/MachineScheduler.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
@@ -50,6 +50,25 @@ struct RISCVTuneInfo {
unsigned MaxPrefetchIterationsAhead;
unsigned MinimumJumpTableEntries;
+
+ // Tail duplication threshold at -O3.
+ unsigned TailDupAggressiveThreshold;
+
+ unsigned MaxStoresPerMemsetOptSize;
+ unsigned MaxStoresPerMemset;
+
+ unsigned MaxGluedStoresPerMemcpy;
+ unsigned MaxStoresPerMemcpyOptSize;
+ unsigned MaxStoresPerMemcpy;
+
+ unsigned MaxStoresPerMemmoveOptSize;
+ unsigned MaxStoresPerMemmove;
+
+ unsigned MaxLoadsPerMemcmpOptSize;
+ unsigned MaxLoadsPerMemcmp;
+
+ // The direction of PostRA scheduling.
+ MISched::Direction PostRASchedDirection;
};
#define GET_RISCVTuneInfoTable_DECL
@@ -63,6 +82,7 @@ public:
Others,
SiFive7,
VentanaVeyron,
+ MIPSP8700,
};
// clang-format on
private:
@@ -86,7 +106,6 @@ private:
RISCVInstrInfo InstrInfo;
RISCVRegisterInfo RegInfo;
RISCVTargetLowering TLInfo;
- SelectionDAGTargetInfo TSInfo;
/// Initializes using the passed in CPU and feature strings so that we can
/// use initializer lists for subtarget initialization.
@@ -102,6 +121,8 @@ public:
StringRef FS, StringRef ABIName, unsigned RVVVectorBitsMin,
unsigned RVVVectorLMULMax, const TargetMachine &TM);
+ ~RISCVSubtarget() override;
+
// Parses features string setting specified subtarget options. The
// definition of this function is auto-generated by tblgen.
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
@@ -116,9 +137,7 @@ public:
const RISCVTargetLowering *getTargetLowering() const override {
return &TLInfo;
}
- const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
- return &TSInfo;
- }
+
bool enableMachineScheduler() const override { return true; }
bool enablePostRAScheduler() const override { return UsePostRAScheduler; }
@@ -169,6 +188,8 @@ public:
unsigned getXLen() const {
return is64Bit() ? 64 : 32;
}
+ bool useLoadStorePairs() const;
+ bool useCCMovInsn() const;
unsigned getFLen() const {
if (HasStdExtD)
return 64;
@@ -215,17 +236,20 @@ public:
TargetABI == RISCVABI::ABI_ILP32 ||
TargetABI == RISCVABI::ABI_ILP32E;
}
- bool isRegisterReservedByUser(Register i) const {
+ bool isRegisterReservedByUser(Register i) const override {
assert(i < RISCV::NUM_TARGET_REGS && "Register out of range");
return UserReservedRegister[i];
}
+ // XRay support - require D and C extensions.
+ bool isXRaySupported() const override { return hasStdExtD() && hasStdExtC(); }
+
// Vector codegen related methods.
bool hasVInstructions() const { return HasStdExtZve32x; }
bool hasVInstructionsI64() const { return HasStdExtZve64x; }
bool hasVInstructionsF16Minimal() const { return HasStdExtZvfhmin; }
bool hasVInstructionsF16() const { return HasStdExtZvfh; }
- bool hasVInstructionsBF16() const { return HasStdExtZvfbfmin; }
+ bool hasVInstructionsBF16Minimal() const { return HasStdExtZvfbfmin; }
bool hasVInstructionsF32() const { return HasStdExtZve32f; }
bool hasVInstructionsF64() const { return HasStdExtZve64d; }
// F16 and F64 both require F32.
@@ -235,6 +259,27 @@ public:
return hasVInstructions() ? MaxInterleaveFactor : 1;
}
+ bool hasOptimizedSegmentLoadStore(unsigned NF) const {
+ switch (NF) {
+ case 2:
+ return hasOptimizedNF2SegmentLoadStore();
+ case 3:
+ return hasOptimizedNF3SegmentLoadStore();
+ case 4:
+ return hasOptimizedNF4SegmentLoadStore();
+ case 5:
+ return hasOptimizedNF5SegmentLoadStore();
+ case 6:
+ return hasOptimizedNF6SegmentLoadStore();
+ case 7:
+ return hasOptimizedNF7SegmentLoadStore();
+ case 8:
+ return hasOptimizedNF8SegmentLoadStore();
+ default:
+ llvm_unreachable("Unexpected NF");
+ }
+ }
+
// Returns VLEN divided by DLEN. Where DLEN is the datapath width of the
// vector hardware implementation which may be less than VLEN.
unsigned getDLenFactor() const {
@@ -244,6 +289,9 @@ public:
}
protected:
+ // SelectionDAGISel related APIs.
+ std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;
+
// GlobalISel related APIs.
mutable std::unique_ptr<CallLowering> CallLoweringInfo;
mutable std::unique_ptr<InstructionSelector> InstSelector;
@@ -258,6 +306,7 @@ protected:
unsigned getMinRVVVectorSizeInBits() const;
public:
+ const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;
const CallLowering *getCallLowering() const override;
InstructionSelector *getInstructionSelector() const override;
const LegalizerInfo *getLegalizerInfo() const override;
@@ -277,8 +326,9 @@ public:
bool enableSubRegLiveness() const override;
- void getPostRAMutations(std::vector<std::unique_ptr<ScheduleDAGMutation>>
- &Mutations) const override;
+ bool enableMachinePipeliner() const override;
+
+ bool useDFAforSMS() const override { return false; }
bool useAA() const override;
@@ -300,7 +350,43 @@ public:
unsigned getMinimumJumpTableEntries() const;
- bool supportsInitUndef() const override { return hasVInstructions(); }
+ unsigned getTailDupAggressiveThreshold() const {
+ return TuneInfo->TailDupAggressiveThreshold;
+ }
+
+ unsigned getMaxStoresPerMemset(bool OptSize) const {
+ return OptSize ? TuneInfo->MaxStoresPerMemsetOptSize
+ : TuneInfo->MaxStoresPerMemset;
+ }
+
+ unsigned getMaxGluedStoresPerMemcpy() const {
+ return TuneInfo->MaxGluedStoresPerMemcpy;
+ }
+
+ unsigned getMaxStoresPerMemcpy(bool OptSize) const {
+ return OptSize ? TuneInfo->MaxStoresPerMemcpyOptSize
+ : TuneInfo->MaxStoresPerMemcpy;
+ }
+
+ unsigned getMaxStoresPerMemmove(bool OptSize) const {
+ return OptSize ? TuneInfo->MaxStoresPerMemmoveOptSize
+ : TuneInfo->MaxStoresPerMemmove;
+ }
+
+ unsigned getMaxLoadsPerMemcmp(bool OptSize) const {
+ return OptSize ? TuneInfo->MaxLoadsPerMemcmpOptSize
+ : TuneInfo->MaxLoadsPerMemcmp;
+ }
+
+ MISched::Direction getPostRASchedDirection() const {
+ return TuneInfo->PostRASchedDirection;
+ }
+
+ void overrideSchedPolicy(MachineSchedPolicy &Policy,
+ unsigned NumRegionInstrs) const override;
+
+ void overridePostRASchedPolicy(MachineSchedPolicy &Policy,
+ unsigned NumRegionInstrs) const override;
};
} // End llvm namespace