;
29 "x0",
"x1",
"x2",
"x3",
"x4",
"x5",
"x6",
"x7",
30 "x8",
"x9",
"x10",
"x11",
"x12",
"x13",
"x14",
"x15",
31 "x16",
"x17",
"x18",
"x19",
"x20",
"x21",
"x22",
"x23",
32 "x24",
"x25",
"x26",
"x27",
"x28",
"x29",
"x30",
"x31",
35 "f0",
"f1",
"f2",
"f3",
"f4",
"f5",
"f6",
"f7",
36 "f8",
"f9",
"f10",
"f11",
"f12",
"f13",
"f14",
"f15",
37 "f16",
"f17",
"f18",
"f19",
"f20",
"f21",
"f22",
"f23",
38 "f24",
"f25",
"f26",
"f27",
"f28",
"f29",
"f30",
"f31",
41 "v0",
"v1",
"v2",
"v3",
"v4",
"v5",
"v6",
"v7",
42 "v8",
"v9",
"v10",
"v11",
"v12",
"v13",
"v14",
"v15",
43 "v16",
"v17",
"v18",
"v19",
"v20",
"v21",
"v22",
"v23",
44 "v24",
"v25",
"v26",
"v27",
"v28",
"v29",
"v30",
"v31",
47 "fflags",
"frm",
"vtype",
"vl",
"vxsat",
"vxrm",
"sf.vcix_state" 55{{
"zero"},
"x0"}, {{
"ra"},
"x1"}, {{
"sp"},
"x2"}, {{
"gp"},
"x3"},
56{{
"tp"},
"x4"}, {{
"t0"},
"x5"}, {{
"t1"},
"x6"}, {{
"t2"},
"x7"},
57{{
"s0"},
"x8"}, {{
"s1"},
"x9"}, {{
"a0"},
"x10"}, {{
"a1"},
"x11"},
58{{
"a2"},
"x12"}, {{
"a3"},
"x13"}, {{
"a4"},
"x14"}, {{
"a5"},
"x15"},
59{{
"a6"},
"x16"}, {{
"a7"},
"x17"}, {{
"s2"},
"x18"}, {{
"s3"},
"x19"},
60{{
"s4"},
"x20"}, {{
"s5"},
"x21"}, {{
"s6"},
"x22"}, {{
"s7"},
"x23"},
61{{
"s8"},
"x24"}, {{
"s9"},
"x25"}, {{
"s10"},
"x26"}, {{
"s11"},
"x27"},
62{{
"t3"},
"x28"}, {{
"t4"},
"x29"}, {{
"t5"},
"x30"}, {{
"t6"},
"x31"},
63{{
"ft0"},
"f0"}, {{
"ft1"},
"f1"}, {{
"ft2"},
"f2"}, {{
"ft3"},
"f3"},
64{{
"ft4"},
"f4"}, {{
"ft5"},
"f5"}, {{
"ft6"},
"f6"}, {{
"ft7"},
"f7"},
65{{
"fs0"},
"f8"}, {{
"fs1"},
"f9"}, {{
"fa0"},
"f10"}, {{
"fa1"},
"f11"},
66{{
"fa2"},
"f12"}, {{
"fa3"},
"f13"}, {{
"fa4"},
"f14"}, {{
"fa5"},
"f15"},
67{{
"fa6"},
"f16"}, {{
"fa7"},
"f17"}, {{
"fs2"},
"f18"}, {{
"fs3"},
"f19"},
68{{
"fs4"},
"f20"}, {{
"fs5"},
"f21"}, {{
"fs6"},
"f22"}, {{
"fs7"},
"f23"},
69{{
"fs8"},
"f24"}, {{
"fs9"},
"f25"}, {{
"fs10"},
"f26"}, {{
"fs11"},
"f27"},
70{{
"ft8"},
"f28"}, {{
"ft9"},
"f29"}, {{
"ft10"},
"f30"}, {{
"ft11"},
"f31"}};
105 if(Name[1] ==
'r'|| Name[1] ==
'R'|| Name[1] ==
'f') {
117 if(Name[1] ==
'r'|| Name[1] ==
'd'|| Name[1] ==
'm') {
128 switch(*Constraint) {
132R = std::string(
"^") + std::string(Constraint, 2);
143 returnMajorVersion * 1000000 + MinorVersion * 1000;
148Builder.defineMacro(
"__riscv");
150Builder.defineMacro(
"__riscv_xlen", Is64Bit ?
"64":
"32");
152 unsignedFLen =
ISAInfo->getFLen();
153 unsignedMinVLen =
ISAInfo->getMinVLen();
154 unsignedMaxELen =
ISAInfo->getMaxELen();
155 unsignedMaxELenFp =
ISAInfo->getMaxELenFp();
156 if(CodeModel ==
"default")
157CodeModel =
"small";
159 if(CodeModel ==
"small")
160Builder.defineMacro(
"__riscv_cmodel_medlow");
161 else if(CodeModel ==
"medium")
162Builder.defineMacro(
"__riscv_cmodel_medany");
163 else if(CodeModel ==
"large")
164Builder.defineMacro(
"__riscv_cmodel_large");
166StringRef ABIName =
getABI();
167 if(ABIName ==
"ilp32f"|| ABIName ==
"lp64f")
168Builder.defineMacro(
"__riscv_float_abi_single");
169 else if(ABIName ==
"ilp32d"|| ABIName ==
"lp64d")
170Builder.defineMacro(
"__riscv_float_abi_double");
172Builder.defineMacro(
"__riscv_float_abi_soft");
174 if(ABIName ==
"ilp32e"|| ABIName ==
"lp64e")
175Builder.defineMacro(
"__riscv_abi_rve");
177Builder.defineMacro(
"__riscv_arch_test");
179 for(
auto&Extension :
ISAInfo->getExtensions()) {
180 autoExtName = Extension.first;
181 autoExtInfo = Extension.second;
183Builder.defineMacro(Twine(
"__riscv_", ExtName),
187 if(
ISAInfo->hasExtension(
"zmmul"))
188Builder.defineMacro(
"__riscv_mul");
190 if(
ISAInfo->hasExtension(
"m")) {
191Builder.defineMacro(
"__riscv_div");
192Builder.defineMacro(
"__riscv_muldiv");
195 if(
ISAInfo->hasExtension(
"a")) {
196Builder.defineMacro(
"__riscv_atomic");
197Builder.defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
198Builder.defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
199Builder.defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
201Builder.defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
205Builder.defineMacro(
"__riscv_flen", Twine(FLen));
206Builder.defineMacro(
"__riscv_fdiv");
207Builder.defineMacro(
"__riscv_fsqrt");
211Builder.defineMacro(
"__riscv_v_min_vlen", Twine(MinVLen));
212Builder.defineMacro(
"__riscv_v_elen", Twine(MaxELen));
213Builder.defineMacro(
"__riscv_v_elen_fp", Twine(MaxELenFp));
216 if(
ISAInfo->hasExtension(
"c"))
217Builder.defineMacro(
"__riscv_compressed");
219 if(
ISAInfo->hasExtension(
"zve32x"))
220Builder.defineMacro(
"__riscv_vector");
223Builder.defineMacro(
"__riscv_v_intrinsic", Twine(
getVersionValue(1, 0)));
226 if(VScale && VScale->first && VScale->first == VScale->second)
227Builder.defineMacro(
"__riscv_v_fixed_vlen",
228Twine(VScale->first * llvm::RISCV::RVVBitsPerBlock));
230 if(FastScalarUnalignedAccess)
231Builder.defineMacro(
"__riscv_misaligned_fast");
233Builder.defineMacro(
"__riscv_misaligned_avoid");
235 if(
ISAInfo->hasExtension(
"e")) {
237Builder.defineMacro(
"__riscv_64e");
239Builder.defineMacro(
"__riscv_32e");
244#define BUILTIN(ID, TYPE, ATTRS) \ 245 {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES}, 246#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \ 247 {#ID, TYPE, ATTRS, FEATURE, HeaderDesc::NO_HEADER, ALL_LANGUAGES}, 248#include "clang/Basic/BuiltinsRISCVVector.def" 249#define BUILTIN(ID, TYPE, ATTRS) \ 250 {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES}, 251#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \ 252 {#ID, TYPE, ATTRS, FEATURE, HeaderDesc::NO_HEADER, ALL_LANGUAGES}, 253#include "clang/Basic/BuiltinsRISCV.inc" 263 conststd::vector<std::string> &FeaturesVec)
const{
268Features[
"64bit"] =
true;
271Features[
"32bit"] =
true;
274std::vector<std::string> AllFeatures = FeaturesVec;
275 autoParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec);
278llvm::raw_string_ostream OutputErrMsg(Buffer);
279handleAllErrors(ParseResult.takeError(), [&](llvm::StringError &ErrMsg) {
280OutputErrMsg << ErrMsg.getMessage();
282Diags.
Report(diag::err_invalid_feature_combination) << OutputErrMsg.str();
287llvm::append_range(AllFeatures, (*ParseResult)->toFeatures());
291std::optional<std::pair<unsigned, unsigned>>
295 unsignedVScaleMin =
ISAInfo->getMinVLen() / llvm::RISCV::RVVBitsPerBlock;
297 if(LangOpts.VScaleMin || LangOpts.VScaleMax) {
299VScaleMin = std::max(VScaleMin, LangOpts.VScaleMin);
300 unsignedVScaleMax = LangOpts.VScaleMax;
301 if(VScaleMax != 0 && VScaleMax < VScaleMin)
302VScaleMax = VScaleMin;
303 returnstd::pair<unsigned, unsigned>(VScaleMin ? VScaleMin : 1, VScaleMax);
307 unsignedVScaleMax =
ISAInfo->getMaxVLen() / llvm::RISCV::RVVBitsPerBlock;
308 returnstd::make_pair(VScaleMin, VScaleMax);
317 auto Result= llvm::StringSwitch<std::optional<bool>>(Feature)
318.Case(
"riscv",
true)
319.Case(
"riscv32", !Is64Bit)
320.Case(
"riscv64", Is64Bit)
321.Case(
"32bit", !Is64Bit)
322.Case(
"64bit", Is64Bit)
323.Case(
"experimental", HasExperimental)
324.Default(std::nullopt);
328 return ISAInfo->hasExtension(Feature);
334 unsignedXLen =
getTriple().isArch64Bit() ? 64 : 32;
335 autoParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, Features);
338llvm::raw_string_ostream OutputErrMsg(Buffer);
339handleAllErrors(ParseResult.takeError(), [&](llvm::StringError &ErrMsg) {
340OutputErrMsg << ErrMsg.getMessage();
342Diags.
Report(diag::err_invalid_feature_combination) << OutputErrMsg.str();
345 ISAInfo= std::move(*ParseResult);
351 if(
ISAInfo->hasExtension(
"zfh") ||
ISAInfo->hasExtension(
"zhinx"))
354FastScalarUnalignedAccess =
355llvm::is_contained(Features,
"+unaligned-scalar-mem");
357 if(llvm::is_contained(Features,
"+experimental"))
358HasExperimental =
true;
360 if(
ABI==
"ilp32e"&&
ISAInfo->hasExtension(
"d")) {
361Diags.
Report(diag::err_invalid_feature_combination)
362<<
"ILP32E cannot be used with the D ISA extension";
369 boolIs64Bit =
getTriple().isArch64Bit();
370 returnllvm::RISCV::parseCPU(Name, Is64Bit);
375 boolIs64Bit =
getTriple().isArch64Bit();
376llvm::RISCV::fillValidCPUArchList(Values, Is64Bit);
380 boolIs64Bit =
getTriple().isArch64Bit();
381 returnllvm::RISCV::parseTuneCPU(Name, Is64Bit);
386 boolIs64Bit =
getTriple().isArch64Bit();
387llvm::RISCV::fillValidTuneCPUArchList(Values, Is64Bit);
391 autoRII = llvm::RISCVISAInfo::parseArchString(
394 if(llvm::errorToBool(RII.takeError()))
395llvm_unreachable(
"unsupport rv64i");
397std::vector<std::string> FeatStrings =
398(*RII)->toFeatures(
true);
399Features.insert(Features.end(), FeatStrings.begin(), FeatStrings.end());
403std::vector<std::string> &Features) {
404 autoRII = llvm::RISCVISAInfo::parseArchString(
406 if(llvm::errorToBool(RII.takeError())) {
408Features.push_back(FullArchStr.str());
413std::vector<std::string> FeatStrings =
414(*RII)->toFeatures(
true);
415Features.insert(Features.end(), FeatStrings.begin(), FeatStrings.end());
421 if(Features ==
"default")
424Features.split(AttrFeatures,
";");
425 boolFoundArch =
false;
427 autohandleArchExtension = [](StringRef AttrString,
428std::vector<std::string> &Features) {
430AttrString.split(Exts,
",");
431 for(
autoExt : Exts) {
435StringRef ExtName = Ext.substr(1);
436std::string TargetFeature =
437llvm::RISCVISAInfo::getTargetFeatureForExtension(ExtName);
438 if(!TargetFeature.empty())
439Features.push_back(Ext.front() + TargetFeature);
441Features.push_back(Ext.str());
445 for(
auto&Feature : AttrFeatures) {
446Feature = Feature.trim();
447StringRef AttrString = Feature.split(
"=").second.trim();
449 if(Feature.starts_with(
"arch=")) {
451Ret.Features.clear();
453Ret.Duplicate =
"arch=";
456 if(AttrString.starts_with(
"+")) {
458handleArchExtension(AttrString, Ret.Features);
463}
else if(Feature.starts_with(
"cpu=")) {
464 if(!Ret.CPU.empty())
465Ret.Duplicate =
"cpu=";
467Ret.CPU = AttrString;
471StringRef MarchFromCPU = llvm::RISCV::getMArchFromMcpu(Ret.CPU);
472 if(MarchFromCPU !=
"") {
473Ret.Features.clear();
477}
else if(Feature.starts_with(
"tune=")) {
478 if(!Ret.Tune.empty())
479Ret.Duplicate =
"tune=";
481Ret.Tune = AttrString;
482}
else if(Feature.starts_with(
"priority")) {
484}
else if(Feature.starts_with(
"+")) {
487handleArchExtension(Feature, Ret.Features);
497 for(StringRef Feature : Features) {
498 auto[LHS, RHS] = Feature.rsplit(
';');
499 if(LHS.consume_front(
"priority="))
501 else if(RHS.consume_front(
"priority="))
506 if(!Feature.getAsInteger(0,
Priority))
527 return-1 != llvm::RISCVISAInfo::getRISCVFeaturesBitsInfo(Feature).second;
531 returnllvm::RISCVISAInfo::isSupportedExtensionFeature(Name);
535StringRef RegName,
unsignedRegSize,
bool&HasSizeMismatch)
const{
536 if(RegName ==
"ra"|| RegName ==
"sp"|| RegName ==
"gp"||
537RegName ==
"tp"|| RegName.starts_with(
"x") || RegName.starts_with(
"a") ||
538RegName.starts_with(
"s") || RegName.starts_with(
"t")) {
539 unsignedXLen =
getTriple().isArch64Bit() ? 64 : 32;
540HasSizeMismatch = RegSize != XLen;
548 "__builtin_cpu_is() is only supported for Linux.");
550 returnllvm::RISCV::hasValidCPUModel(CPUName);
Defines the Diagnostic-related interfaces.
static void populateNegativeRISCVFeatures(std::vector< std::string > &Features)
static unsigned getVersionValue(unsigned MajorVersion, unsigned MinorVersion)
static void handleFullArchString(StringRef FullArchStr, std::vector< std::string > &Features)
static constexpr Builtin::Info BuiltinInfo[]
Defines the clang::MacroBuilder utility class.
Enumerates target-specific builtins in their own namespaces within namespace clang.
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
TargetOptions & getTargetOpts() const
Retrieve the target options.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeatureVec) const
Initialize the map with the default set of target features for the CPU this should include all legal ...
virtual std::string convertConstraint(const char *&Constraint) const
bool isValidFeatureName(StringRef Name) const override
Determine whether this TargetInfo supports the given feature.
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 ...
std::unique_ptr< llvm::RISCVISAInfo > ISAInfo
void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values for tuning CPU.
bool isValidTuneCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name for tuning.
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
ArrayRef< const char * > getGCCRegNames() const override
std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts, bool IsArmStreamingFunction) const override
Returns target-specific min and max values VScale_Range.
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.
uint64_t getFMVPriority(ArrayRef< StringRef > Features) const override
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features.
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 isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
static const char *const GCCRegNames[]
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
bool IsArmStreamingFunction(const FunctionDecl *FD, bool IncludeLocallyStreaming)
Returns whether the given FunctionDecl has an __arm[_locally]_streaming attribute.
Contains information gathered from parsing the contents of TargetAttr.
void setRequiresImmediate(int Min, int Max)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4