aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-01-03 18:04:11 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:13:16 +0000
commit647cbc5de815c5651677bf8582797f716ec7b48d (patch)
tree0a57db146d82068137e0fe0109ca612aaef5afb6 /contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
parentedc2dc17b1f2dfe45dc85e6cc0ff54bca1ac8214 (diff)
parent77dbea07356e1ab2f37a777d4d1ddc5dd3e301c2 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp45
1 files changed, 3 insertions, 42 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index f3ea0f597eec..4759aa951664 100644
--- a/contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -1832,57 +1832,18 @@ ParseStatus RISCVAsmParser::parseCSRSystemRegister(OperandVector &Operands) {
if (getParser().parseIdentifier(Identifier))
return ParseStatus::Failure;
- // Check for CSR names conflicts.
- // Custom CSR names might conflict with CSR names in privileged spec.
- // E.g. - SiFive mnscratch(0x350) and privileged spec mnscratch(0x740).
- auto CheckCSRNameConflict = [&]() {
- if (!(RISCVSysReg::lookupSysRegByName(Identifier))) {
- Error(S, "system register use requires an option to be enabled");
- return true;
- }
- return false;
- };
-
- // First check for vendor specific CSRs.
- auto SiFiveReg = RISCVSysReg::lookupSiFiveRegByName(Identifier);
- if (SiFiveReg) {
- if (SiFiveReg->haveVendorRequiredFeatures(getSTI().getFeatureBits())) {
- Operands.push_back(
- RISCVOperand::createSysReg(Identifier, S, SiFiveReg->Encoding));
- return ParseStatus::Success;
- }
- if (CheckCSRNameConflict())
- return ParseStatus::Failure;
- }
-
auto SysReg = RISCVSysReg::lookupSysRegByName(Identifier);
if (!SysReg)
+ SysReg = RISCVSysReg::lookupSysRegByAltName(Identifier);
+ if (!SysReg)
if ((SysReg = RISCVSysReg::lookupSysRegByDeprecatedName(Identifier)))
Warning(S, "'" + Identifier + "' is a deprecated alias for '" +
SysReg->Name + "'");
- // Check for CSR encoding conflicts.
- // Custom CSR encoding might conflict with CSR encoding in privileged spec.
- // E.g. - SiFive mnscratch(0x350) and privileged spec miselect(0x350).
- auto CheckCSREncodingConflict = [&]() {
- auto Reg = RISCVSysReg::lookupSiFiveRegByEncoding(SysReg->Encoding);
- if (Reg && Reg->haveVendorRequiredFeatures(getSTI().getFeatureBits())) {
- Warning(S, "'" + Identifier + "' CSR is not available on the current " +
- "subtarget. Instead '" + Reg->Name +
- "' CSR will be used.");
- Operands.push_back(
- RISCVOperand::createSysReg(Reg->Name, S, Reg->Encoding));
- return true;
- }
- return false;
- };
-
- // Accept a named SysReg if the required features are present.
+ // Accept a named Sys Reg if the required features are present.
if (SysReg) {
if (!SysReg->haveRequiredFeatures(getSTI().getFeatureBits()))
return Error(S, "system register use requires an option to be enabled");
- if (CheckCSREncodingConflict())
- return ParseStatus::Success;
Operands.push_back(
RISCVOperand::createSysReg(Identifier, S, SysReg->Encoding));
return ParseStatus::Success;