Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Support/RISCVISAInfo.cpp
//===-- RISCVISAInfo.cpp - RISCV Arch String Parser --------------===// | //===-- RISCVISAInfo.cpp - RISCV Arch String Parser --------------===// | ||||
Lint: Lint: clang-format not found in user’s local PATH; not linting file. | |||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | bool RISCVISAInfo::isSupportedExtension(StringRef Ext, unsigned MajorVersion, | ||||
auto FindByNameAndVersion = [=](const RISCVSupportedExtension &ExtInfo) { | auto FindByNameAndVersion = [=](const RISCVSupportedExtension &ExtInfo) { | ||||
return ExtInfo.Name == Ext && (MajorVersion == ExtInfo.Version.Major) && | return ExtInfo.Name == Ext && (MajorVersion == ExtInfo.Version.Major) && | ||||
(MinorVersion == ExtInfo.Version.Minor); | (MinorVersion == ExtInfo.Version.Minor); | ||||
}; | }; | ||||
return llvm::any_of(SupportedExtensions, FindByNameAndVersion) || | return llvm::any_of(SupportedExtensions, FindByNameAndVersion) || | ||||
llvm::any_of(SupportedExperimentalExtensions, FindByNameAndVersion); | llvm::any_of(SupportedExperimentalExtensions, FindByNameAndVersion); | ||||
} | } | ||||
bool RISCVISAInfo::hasVInstructions() const { | |||||
return hasExtension("zve32x"); | |||||
asbUnsubmitted Not Done ReplyInline ActionsGiven the other sub-thread showed that hasExtennsion("zve32x") == hasVInstructions isn't completely obvious, perhaps worth a comment like "zve32x is the root of the V extension inheritance tree. i.e. enabling any of the vector extensions will implicitly enable zve32x." asb: Given the other sub-thread showed that hasExtennsion("zve32x") == hasVInstructions isn't… | |||||
} | |||||
bool RISCVISAInfo::hasExtension(StringRef Ext) const { | bool RISCVISAInfo::hasExtension(StringRef Ext) const { | ||||
stripExperimentalPrefix(Ext); | stripExperimentalPrefix(Ext); | ||||
if (!isSupportedExtension(Ext)) | if (!isSupportedExtension(Ext)) | ||||
return false; | return false; | ||||
return Exts.count(Ext.str()) != 0; | return Exts.count(Ext.str()) != 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 458 Lines • ▼ Show 20 Lines | |||||
Error RISCVISAInfo::checkDependency() { | Error RISCVISAInfo::checkDependency() { | ||||
bool IsRv32 = XLen == 32; | bool IsRv32 = XLen == 32; | ||||
bool HasE = Exts.count("e") != 0; | bool HasE = Exts.count("e") != 0; | ||||
bool HasD = Exts.count("d") != 0; | bool HasD = Exts.count("d") != 0; | ||||
bool HasF = Exts.count("f") != 0; | bool HasF = Exts.count("f") != 0; | ||||
bool HasZfinx = Exts.count("zfinx") != 0; | bool HasZfinx = Exts.count("zfinx") != 0; | ||||
bool HasZdinx = Exts.count("zdinx") != 0; | bool HasZdinx = Exts.count("zdinx") != 0; | ||||
bool HasVector = Exts.count("zve32x") != 0; | bool HasVector = hasVInstructions(); | ||||
bool HasZve32f = Exts.count("zve32f") != 0; | bool HasZve32f = Exts.count("zve32f") != 0; | ||||
bool HasZve64d = Exts.count("zve64d") != 0; | bool HasZve64d = Exts.count("zve64d") != 0; | ||||
bool HasZvl = MinVLen != 0; | bool HasZvl = MinVLen != 0; | ||||
if (HasE && !IsRv32) | if (HasE && !IsRv32) | ||||
return createStringError( | return createStringError( | ||||
errc::invalid_argument, | errc::invalid_argument, | ||||
"standard user-level extension 'e' requires 'rv32'"); | "standard user-level extension 'e' requires 'rv32'"); | ||||
▲ Show 20 Lines • Show All 271 Lines • Show Last 20 Lines |
clang-format not found in user’s local PATH; not linting file.