13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_RISCV_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_RISCV_H
18#include "llvm/Support/Compiler.h"
19#include "llvm/TargetParser/RISCVISAInfo.h"
20#include "llvm/TargetParser/Triple.h"
30 std::unique_ptr<llvm::RISCVISAInfo>
ISAInfo;
33 bool FastScalarUnalignedAccess;
34 bool HasExperimental =
false;
54 bool setCPU(
const std::string &Name)
override {
99 const std::vector<std::string> &FeaturesVec)
const override;
101 std::optional<std::pair<unsigned, unsigned>>
104 bool hasFeature(StringRef Feature)
const override;
128 return std::make_pair(32, 32);
139 bool &HasSizeMismatch)
const override;
149 if (
ISAInfo->hasExtension(
"zicfiss"))
155 return CFBranchLabelSchemeKind::FuncSig;
163 case CFBranchLabelSchemeKind::Unlabeled:
164 case CFBranchLabelSchemeKind::FuncSig:
174 IntPtrType = SignedInt;
175 PtrDiffType = SignedInt;
176 SizeType = UnsignedInt;
177 resetDataLayout(
"e-m:e-p:32:32-i64:64-n32-S128");
180 bool setABI(
const std::string &Name)
override {
181 if (Name ==
"ilp32e") {
183 resetDataLayout(
"e-m:e-p:32:32-i64:64-n32-S32");
187 if (Name ==
"ilp32" || Name ==
"ilp32f" || Name ==
"ilp32d") {
195 MaxAtomicPromoteWidth = 128;
197 if (ISAInfo->hasExtension(
"a"))
198 MaxAtomicInlineWidth = 32;
205 LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
206 IntMaxType = Int64Type = SignedLong;
207 resetDataLayout(
"e-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
210 bool setABI(
const std::string &Name)
override {
211 if (Name ==
"lp64e") {
213 resetDataLayout(
"e-m:e-p:64:64-i64:64-i128:128-n32:64-S64");
217 if (Name ==
"lp64" || Name ==
"lp64f" || Name ==
"lp64d") {
225 MaxAtomicPromoteWidth = 128;
227 if (ISAInfo->hasExtension(
"a"))
228 MaxAtomicInlineWidth = 64;
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Exposes information about the current target.
virtual bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const
Check if the target supports CFProtection return.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual bool checkCFBranchLabelSchemeSupported(const CFBranchLabelSchemeKind Scheme, DiagnosticsEngine &Diags) const
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Options for controlling the target.
RISCV32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
bool setABI(const std::string &Name) override
Use the specified ABI.
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
RISCV64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
void setMaxAtomicWidth() override
Set the maximum inline or promote width lock-free atomic operation for the given target.
bool setABI(const std::string &Name) override
Use the specified ABI.
bool isValidFeatureName(StringRef Name) const override
Determine whether this TargetInfo supports the given feature.
RISCVTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
std::string convertConstraint(const char *&Constraint) const override
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods -----------------------—===//
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
bool validateGlobalRegisterVariable(StringRef RegName, unsigned RegSize, bool &HasSizeMismatch) const override
Validate register name used for global register variables.
bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeaturesVec) const override
Initialize the map with the default set of target features for the CPU this should include all legal ...
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
std::unique_ptr< llvm::RISCVISAInfo > ISAInfo
void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values for tuning CPU.
bool supportsCpuInit() const override
bool isValidTuneCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name for tuning.
std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts) const override
Returns target-specific min and max values VScale_Range.
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
bool supportsCpuSupports() const override
ArrayRef< const char * > getGCCRegNames() const override
bool hasBFloat16Type() const override
Determine whether the _BFloat16 type is supported on this target.
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
bool checkCFProtectionReturnSupported(DiagnosticsEngine &Diags) const override
Check if the target supports CFProtection return.
bool validateCpuSupports(StringRef Feature) const override
StringRef getABI() const override
Get the ABI currently in use.
std::pair< unsigned, unsigned > hardwareInterferenceSizes() const override
The first value in the pair is the minimum offset between two objects to avoid false sharing (destruc...
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
CFBranchLabelSchemeKind getDefaultCFBranchLabelScheme() const override
Get the target default CFBranchLabelScheme scheme.
bool checkCFProtectionBranchSupported(DiagnosticsEngine &) const override
Check if the target supports CFProtection branch.
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features.
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
StringRef getConstraintRegister(StringRef Constraint, StringRef Expression) const override
Extracts a register from the passed constraint (if it is a single-register constraint) and the asm la...
bool supportsTargetAttributeTune() const override
Determine whether this TargetInfo supports tune in target attribute.
ParsedTargetAttr parseTargetAttr(StringRef Str) const override
bool hasFeature(StringRef Feature) const override
Return true if has this feature, need to sync with handleTargetFeatures.
bool validateCpuIs(StringRef CPUName) const override
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
bool isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
unsigned getFMVPriority(ArrayRef< StringRef > Features) const override
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
bool supportsCpuIs() const override
bool setCPU(const std::string &Name) override
Target the specified CPU.
bool checkCFBranchLabelSchemeSupported(const CFBranchLabelSchemeKind Scheme, DiagnosticsEngine &Diags) const override
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Contains information gathered from parsing the contents of TargetAttr.
unsigned short SuitableAlign
const llvm::fltSemantics * LongDoubleFormat
unsigned char BFloat16Width
unsigned char LongDoubleAlign
unsigned char LongDoubleWidth
unsigned char BFloat16Align
const llvm::fltSemantics * BFloat16Format