Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Support/RISCVISAInfo.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | static const RISCVSupportedExtension SupportedExperimentalExtensions[] = { | ||||
{"zbe", RISCVExtensionVersion{0, 93}}, | {"zbe", RISCVExtensionVersion{0, 93}}, | ||||
{"zbf", RISCVExtensionVersion{0, 93}}, | {"zbf", RISCVExtensionVersion{0, 93}}, | ||||
{"zbm", RISCVExtensionVersion{0, 93}}, | {"zbm", RISCVExtensionVersion{0, 93}}, | ||||
{"zbp", RISCVExtensionVersion{0, 93}}, | {"zbp", RISCVExtensionVersion{0, 93}}, | ||||
{"zbr", RISCVExtensionVersion{0, 93}}, | {"zbr", RISCVExtensionVersion{0, 93}}, | ||||
{"zbt", RISCVExtensionVersion{0, 93}}, | {"zbt", RISCVExtensionVersion{0, 93}}, | ||||
{"zca", RISCVExtensionVersion{0, 70}}, | {"zca", RISCVExtensionVersion{0, 70}}, | ||||
{"zcmt", RISCVExtensionVersion{0, 70}}, | |||||
{"zvfh", RISCVExtensionVersion{0, 1}}, | {"zvfh", RISCVExtensionVersion{0, 1}}, | ||||
}; | }; | ||||
static bool stripExperimentalPrefix(StringRef &Ext) { | static bool stripExperimentalPrefix(StringRef &Ext) { | ||||
return Ext.consume_front("experimental-"); | return Ext.consume_front("experimental-"); | ||||
} | } | ||||
// This function finds the first character that doesn't belong to a version | // This function finds the first character that doesn't belong to a version | ||||
▲ Show 20 Lines • Show All 570 Lines • ▼ Show 20 Lines | if (!isSupportedExtension(Ext)) { | ||||
Desc.str().c_str(), Ext.str().c_str()); | Desc.str().c_str(), Ext.str().c_str()); | ||||
} | } | ||||
} | } | ||||
return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo)); | return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo)); | ||||
} | } | ||||
Error RISCVISAInfo::checkDependency() { | Error RISCVISAInfo::checkDependency() { | ||||
bool IsRv32 = XLen == 32; | bool IsRv32 = XLen == 32; | ||||
craig.topper: This variable is unused. | |||||
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 = Exts.count("zve32x") != 0; | ||||
bool HasZve32f = Exts.count("zve32f") != 0; | bool HasZve32f = Exts.count("zve32f") != 0; | ||||
bool HasZve64d = Exts.count("zve64d") != 0; | bool HasZve64d = Exts.count("zve64d") != 0; | ||||
Show All 29 Lines | return createStringError( | ||||
"zvfh requires zfh, zfhmin, zhinx or zhinxmin extension to also be " | "zvfh requires zfh, zfhmin, zhinx or zhinxmin extension to also be " | ||||
"specified"); | "specified"); | ||||
if (HasZvl && !HasVector) | if (HasZvl && !HasVector) | ||||
return createStringError( | return createStringError( | ||||
errc::invalid_argument, | errc::invalid_argument, | ||||
"zvl*b requires v or zve* extension to also be specified"); | "zvl*b requires v or zve* extension to also be specified"); | ||||
// Additional dependency checks. | // Additional dependency checks. | ||||
It wouldn't be incompatible with Zca + D without Zcd would it? craig.topper: It wouldn't be incompatible with Zca + D without Zcd would it? | |||||
// TODO: The 'q' extension requires rv64. | // TODO: The 'q' extension requires rv64. | ||||
// TODO: It is illegal to specify 'e' extensions with 'f' and 'd'. | // TODO: It is illegal to specify 'e' extensions with 'f' and 'd'. | ||||
Extension names should be in single quotes. Should we use 'zcmt' and 'c' extensions are incompatible to match line 863? craig.topper: Extension names should be in single quotes.
Should we use `'zcmt' and 'c' extensions are… | |||||
My understanding is Zcmt still compatible with C if no D/Zcd is present. rv32ic_zcmt in theory is valid combination according to spec[1]. [1] https://github.com/riscv/riscv-code-size-reduction/blob/main/Zc-specification/Zc.adoc#19-zcmt
kito-cheng: My understanding is Zcmt still compatible with C if no D/Zcd is present.
`rv32ic_zcmt` in… | |||||
Not Done ReplyInline ActionsThe ‘or’ in the error message makes it unnecessarily complex for users. Tell them exactly what extensions they used that are in compatible. craig.topper: The ‘or’ in the error message makes it unnecessarily complex for users. Tell them exactly what… | |||||
'd' extensions - > 'd' extension craig.topper: 'd' extensions - > 'd' extension | |||||
return Error::success(); | return Error::success(); | ||||
} | } | ||||
static const char *ImpliedExtsV[] = {"zvl128b", "zve64d", "f", "d"}; | static const char *ImpliedExtsV[] = {"zvl128b", "zve64d", "f", "d"}; | ||||
static const char *ImpliedExtsZfhmin[] = {"f"}; | static const char *ImpliedExtsZfhmin[] = {"f"}; | ||||
static const char *ImpliedExtsZfh[] = {"f"}; | static const char *ImpliedExtsZfh[] = {"f"}; | ||||
static const char *ImpliedExtsZdinx[] = {"zfinx"}; | static const char *ImpliedExtsZdinx[] = {"zfinx"}; | ||||
static const char *ImpliedExtsZhinxmin[] = {"zfinx"}; | static const char *ImpliedExtsZhinxmin[] = {"zfinx"}; | ||||
Show All 13 Lines | |||||
static const char *ImpliedExtsZvl512b[] = {"zvl256b"}; | static const char *ImpliedExtsZvl512b[] = {"zvl256b"}; | ||||
static const char *ImpliedExtsZvl256b[] = {"zvl128b"}; | static const char *ImpliedExtsZvl256b[] = {"zvl128b"}; | ||||
static const char *ImpliedExtsZvl128b[] = {"zvl64b"}; | static const char *ImpliedExtsZvl128b[] = {"zvl64b"}; | ||||
static const char *ImpliedExtsZvl64b[] = {"zvl32b"}; | static const char *ImpliedExtsZvl64b[] = {"zvl32b"}; | ||||
static const char *ImpliedExtsZk[] = {"zkn", "zkt", "zkr"}; | static const char *ImpliedExtsZk[] = {"zkn", "zkt", "zkr"}; | ||||
static const char *ImpliedExtsZkn[] = {"zbkb", "zbkc", "zbkx", "zkne", "zknd", "zknh"}; | static const char *ImpliedExtsZkn[] = {"zbkb", "zbkc", "zbkx", "zkne", "zknd", "zknh"}; | ||||
static const char *ImpliedExtsZks[] = {"zbkb", "zbkc", "zbkx", "zksed", "zksh"}; | static const char *ImpliedExtsZks[] = {"zbkb", "zbkc", "zbkx", "zksed", "zksh"}; | ||||
static const char *ImpliedExtsZvfh[] = {"zve32f"}; | static const char *ImpliedExtsZvfh[] = {"zve32f"}; | ||||
static const char *ImpliedExtsZcmt[] = {"zca"}; | |||||
struct ImpliedExtsEntry { | struct ImpliedExtsEntry { | ||||
StringLiteral Name; | StringLiteral Name; | ||||
ArrayRef<const char *> Exts; | ArrayRef<const char *> Exts; | ||||
bool operator<(const ImpliedExtsEntry &Other) const { | bool operator<(const ImpliedExtsEntry &Other) const { | ||||
return Name < Other.Name; | return Name < Other.Name; | ||||
} | } | ||||
bool operator<(StringRef Other) const { return Name < Other; } | bool operator<(StringRef Other) const { return Name < Other; } | ||||
}; | }; | ||||
// Note: The table needs to be sorted by name. | // Note: The table needs to be sorted by name. | ||||
static constexpr ImpliedExtsEntry ImpliedExts[] = { | static constexpr ImpliedExtsEntry ImpliedExts[] = { | ||||
{{"v"}, {ImpliedExtsV}}, | {{"v"}, {ImpliedExtsV}}, | ||||
{{"zcmt"}, {ImpliedExtsZcmt}}, | |||||
{{"zdinx"}, {ImpliedExtsZdinx}}, | {{"zdinx"}, {ImpliedExtsZdinx}}, | ||||
{{"zfh"}, {ImpliedExtsZfh}}, | {{"zfh"}, {ImpliedExtsZfh}}, | ||||
{{"zfhmin"}, {ImpliedExtsZfhmin}}, | {{"zfhmin"}, {ImpliedExtsZfhmin}}, | ||||
{{"zhinx"}, {ImpliedExtsZhinx}}, | {{"zhinx"}, {ImpliedExtsZhinx}}, | ||||
{{"zhinxmin"}, {ImpliedExtsZhinxmin}}, | {{"zhinxmin"}, {ImpliedExtsZhinxmin}}, | ||||
{{"zk"}, {ImpliedExtsZk}}, | {{"zk"}, {ImpliedExtsZk}}, | ||||
{{"zkn"}, {ImpliedExtsZkn}}, | {{"zkn"}, {ImpliedExtsZkn}}, | ||||
{{"zks"}, {ImpliedExtsZks}}, | {{"zks"}, {ImpliedExtsZks}}, | ||||
▲ Show 20 Lines • Show All 184 Lines • Show Last 20 Lines |
This variable is unused.