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;
127 return std::make_pair(32, 32);
138 IntPtrType = SignedInt;
139 PtrDiffType = SignedInt;
140 SizeType = UnsignedInt;
141 resetDataLayout(
"e-m:e-p:32:32-i64:64-n32-S128");
144 bool setABI(
const std::string &Name)
override {
145 if (Name ==
"ilp32e") {
147 resetDataLayout(
"e-m:e-p:32:32-i64:64-n32-S32");
151 if (Name ==
"ilp32" || Name ==
"ilp32f" || Name ==
"ilp32d") {
159 MaxAtomicPromoteWidth = 128;
161 if (ISAInfo->hasExtension(
"a"))
162 MaxAtomicInlineWidth = 32;
169 LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
170 IntMaxType = Int64Type = SignedLong;
171 resetDataLayout(
"e-m:e-p:64:64-i64:64-i128:128-n32:64-S128");
174 bool setABI(
const std::string &Name)
override {
175 if (Name ==
"lp64e") {
177 resetDataLayout(
"e-m:e-p:64:64-i64:64-i128:128-n32:64-S64");
181 if (Name ==
"lp64" || Name ==
"lp64f" || Name ==
"lp64d") {
189 MaxAtomicPromoteWidth = 128;
191 if (ISAInfo->hasExtension(
"a"))
192 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.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
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.
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 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 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.
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 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.
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
bool setCPU(const std::string &Name) override
Target the specified CPU.
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