diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -169,6 +169,7 @@ * Added support for Zfa extension version 0.2. * Updated support experimental vector crypto extensions to version 0.5.1 of the specification. +* Deprecated N extension (User-Level Interrupts) CSR names in the assembler. Changes to the WebAssembly Backend ---------------------------------- diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -1686,6 +1686,9 @@ Warning(S, "'" + Identifier + "' is a deprecated alias for '" + SysReg->Name + "'"); + if (SysReg && SysReg->isDeprecated) + Warning(S, Twine("'") + SysReg->Name + "' is deprecated"); + // Accept a named Sys Reg if the required features are present. if (SysReg) { if (!SysReg->haveRequiredFeatures(getSTI().getFeatureBits())) { diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -368,6 +368,7 @@ // unsigned Number; FeatureBitset FeaturesRequired; bool isRV32Only; + bool isDeprecated; bool haveRequiredFeatures(const FeatureBitset &ActiveFeatures) const { // Not in 32-bit mode. diff --git a/llvm/lib/Target/RISCV/RISCVSystemOperands.td b/llvm/lib/Target/RISCV/RISCVSystemOperands.td --- a/llvm/lib/Target/RISCV/RISCVSystemOperands.td +++ b/llvm/lib/Target/RISCV/RISCVSystemOperands.td @@ -37,6 +37,7 @@ // bits<6> Number = op{5 - 0}; code FeaturesRequired = [{ {} }]; bit isRV32Only = 0; + bit isDeprecated = 0; } def SysRegsList : GenericTable { @@ -44,7 +45,7 @@ // FIXME: add "ReadWrite", "Mode", "Extra", "Number" fields when needed. let Fields = [ "Name", "AltName", "DeprecatedName", "Encoding", "FeaturesRequired", - "isRV32Only", + "isRV32Only", "isDeprecated" ]; let PrimaryKey = [ "Encoding" ]; @@ -67,25 +68,29 @@ } // The following CSR encodings match those given in Tables 2.2, -// 2.3, 2.4 and 2.5 in the RISC-V Instruction Set Manual +// 2.3, 2.4, 2.5 and 2.6 in the RISC-V Instruction Set Manual // Volume II: Privileged Architecture. //===----------------------------------------------------------------------===// -// User Trap Setup +// User Trap Setup (Deprecated) //===----------------------------------------------------------------------===// +let isDeprecated = 1 in { def : SysReg<"ustatus", 0x000>; def : SysReg<"uie", 0x004>; def : SysReg<"utvec", 0x005>; +} // isDeprecated = 1 //===----------------------------------------------------------------------===// -// User Trap Handling +// User Trap Handling (Deprecated) //===----------------------------------------------------------------------===// +let isDeprecated = 1 in { def : SysReg<"uscratch", 0x040>; def : SysReg<"uepc", 0x041>; def : SysReg<"ucause", 0x042>; let DeprecatedName = "ubadaddr" in def : SysReg<"utval", 0x043>; def : SysReg<"uip", 0x044>; +} // isDeprecated = 1 //===----------------------------------------------------------------------===// // User Floating-Point CSRs @@ -120,7 +125,9 @@ // Supervisor Trap Setup //===----------------------------------------------------------------------===// def : SysReg<"sstatus", 0x100>; +let isDeprecated = 1 in def : SysReg<"sedeleg", 0x102>; +let isDeprecated = 1 in def : SysReg<"sideleg", 0x103>; def : SysReg<"sie", 0x104>; def : SysReg<"stvec", 0x105>; diff --git a/llvm/test/MC/RISCV/deprecated-csr-names.s b/llvm/test/MC/RISCV/deprecated-csr-names.s --- a/llvm/test/MC/RISCV/deprecated-csr-names.s +++ b/llvm/test/MC/RISCV/deprecated-csr-names.s @@ -59,6 +59,7 @@ csrrw zero, 0x043, zero # CHECK-WARN: warning: 'ubadaddr' is a deprecated alias for 'utval' +# CHECK-WARN: warning: 'utval' is deprecated # sptbr # name @@ -75,3 +76,161 @@ csrrw zero, 0x180, zero # CHECK-WARN: warning: 'sptbr' is a deprecated alias for 'satp' + +# ustatus +# name +# CHECK-INST: csrrs t1, ustatus, zero +# CHECK-ENC: encoding: [0x73,0x23,0x00,0x00] +# CHECK-INST-ALIAS: csrr t1, ustatus +# uimm12 +# CHECK-INST: csrrs t2, ustatus, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x00,0x00] +# CHECK-INST-ALIAS: csrr t2, ustatus +csrrs t1, ustatus, zero +# uimm12 +csrrs t2, 0x000, zero + +# CHECK-WARN: warning: 'ustatus' is deprecated + +# uie +# name +# CHECK-INST: csrrs t1, uie, zero +# CHECK-ENC: encoding: [0x73,0x23,0x40,0x00] +# CHECK-INST-ALIAS: csrr t1, uie +# uimm12 +# CHECK-INST: csrrs t2, uie, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x40,0x00] +# CHECK-INST-ALIAS: csrr t2, uie +# name +csrrs t1, uie, zero +# uimm12 +csrrs t2, 0x004, zero + +# CHECK-WARN: warning: 'uie' is deprecated + +# utvec +# name +# CHECK-INST: csrrs t1, utvec, zero +# CHECK-ENC: encoding: [0x73,0x23,0x50,0x00] +# CHECK-INST-ALIAS: csrr t1, utvec +# uimm12 +# CHECK-INST: csrrs t2, utvec, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x50,0x00] +# CHECK-INST-ALIAS: csrr t2, utvec +# name +csrrs t1, utvec, zero +# uimm12 +csrrs t2, 0x005, zero + +# CHECK-WARN: warning: 'utvec' is deprecated + +# uscratch +# name +# CHECK-INST: csrrs t1, uscratch, zero +# CHECK-ENC: encoding: [0x73,0x23,0x00,0x04] +# CHECK-INST-ALIAS: csrr t1, uscratch +# uimm12 +# CHECK-INST: csrrs t2, uscratch, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x00,0x04] +# CHECK-INST-ALIAS: csrr t2, uscratch +# name +csrrs t1, uscratch, zero +# uimm12 +csrrs t2, 0x040, zero + +# CHECK-WARN: warning: 'uscratch' is deprecated + +# uepc +# name +# CHECK-INST: csrrs t1, uepc, zero +# CHECK-ENC: encoding: [0x73,0x23,0x10,0x04] +# CHECK-INST-ALIAS: csrr t1, uepc +# uimm12 +# CHECK-INST: csrrs t2, uepc, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x10,0x04] +# CHECK-INST-ALIAS: csrr t2, uepc +# name +csrrs t1, uepc, zero +# uimm12 +csrrs t2, 0x041, zero + +# CHECK-WARN: warning: 'uepc' is deprecated + +# ucause +# name +# CHECK-INST: csrrs t1, ucause, zero +# CHECK-ENC: encoding: [0x73,0x23,0x20,0x04] +# CHECK-INST-ALIAS: csrr t1, ucause +# uimm12 +# CHECK-INST: csrrs t2, ucause, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x20,0x04] +# CHECK-INST-ALIAS: csrr t2, ucause +# name +csrrs t1, ucause, zero +# uimm12 +csrrs t2, 0x042, zero + +# CHECK-WARN: warning: 'ucause' is deprecated + +# utval +# name +# CHECK-INST: csrrs t1, utval, zero +# CHECK-ENC: encoding: [0x73,0x23,0x30,0x04] +# CHECK-INST-ALIAS: csrr t1, utval +# uimm12 +# CHECK-INST: csrrs t2, utval, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x30,0x04] + +csrrs t1, utval, zero +# uimm12 +csrrs t2, 0x043, zero + +# CHECK-WARN: warning: 'utval' is deprecated + +# uip +# name +# CHECK-INST: csrrs t1, uip, zero +# CHECK-ENC: encoding: [0x73,0x23,0x40,0x04] +# CHECK-INST-ALIAS: csrr t1, uip +# uimm12 +# CHECK-INST: csrrs t2, uip, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x40,0x04] +# CHECK-INST-ALIAS: csrr t2, uip +#name +csrrs t1, uip, zero +# uimm12 +csrrs t2, 0x044, zero + +# CHECK-WARN: warning: 'uip' is deprecated + +# sedeleg +# name +# CHECK-INST: csrrs t1, sedeleg, zero +# CHECK-ENC: encoding: [0x73,0x23,0x20,0x10] +# CHECK-INST-ALIAS: csrr t1, sedeleg +# uimm12 +# CHECK-INST: csrrs t2, sedeleg, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x20,0x10] +# CHECK-INST-ALIAS: csrr t2, sedeleg +# name +csrrs t1, sedeleg, zero +# uimm12 +csrrs t2, 0x102, zero + +# CHECK-WARN: warning: 'sedeleg' is deprecated + +# sideleg +# name +# CHECK-INST: csrrs t1, sideleg, zero +# CHECK-ENC: encoding: [0x73,0x23,0x30,0x10] +# CHECK-INST-ALIAS: csrr t1, sideleg +# uimm12 +# CHECK-INST: csrrs t2, sideleg, zero +# CHECK-ENC: encoding: [0xf3,0x23,0x30,0x10] +# CHECK-INST-ALIAS: csrr t2, sideleg +# name +csrrs t1, sideleg, zero +# uimm12 +csrrs t2, 0x103, zero + +# CHECK-WARN: warning: 'sideleg' is deprecated diff --git a/llvm/test/MC/RISCV/supervisor-csr-names.s b/llvm/test/MC/RISCV/supervisor-csr-names.s --- a/llvm/test/MC/RISCV/supervisor-csr-names.s +++ b/llvm/test/MC/RISCV/supervisor-csr-names.s @@ -28,34 +28,6 @@ # uimm12 csrrs t2, 0x100, zero -# sedeleg -# name -# CHECK-INST: csrrs t1, sedeleg, zero -# CHECK-ENC: encoding: [0x73,0x23,0x20,0x10] -# CHECK-INST-ALIAS: csrr t1, sedeleg -# uimm12 -# CHECK-INST: csrrs t2, sedeleg, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x20,0x10] -# CHECK-INST-ALIAS: csrr t2, sedeleg -# name -csrrs t1, sedeleg, zero -# uimm12 -csrrs t2, 0x102, zero - -# sideleg -# name -# CHECK-INST: csrrs t1, sideleg, zero -# CHECK-ENC: encoding: [0x73,0x23,0x30,0x10] -# CHECK-INST-ALIAS: csrr t1, sideleg -# uimm12 -# CHECK-INST: csrrs t2, sideleg, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x30,0x10] -# CHECK-INST-ALIAS: csrr t2, sideleg -# name -csrrs t1, sideleg, zero -# uimm12 -csrrs t2, 0x103, zero - # sie # name # CHECK-INST: csrrs t1, sie, zero diff --git a/llvm/test/MC/RISCV/user-csr-names.s b/llvm/test/MC/RISCV/user-csr-names.s --- a/llvm/test/MC/RISCV/user-csr-names.s +++ b/llvm/test/MC/RISCV/user-csr-names.s @@ -10,125 +10,6 @@ # RUN: | llvm-objdump -d - \ # RUN: | FileCheck -check-prefix=CHECK-INST-ALIAS %s -################################## -# User Trap Setup -################################## - -# ustatus -# name -# CHECK-INST: csrrs t1, ustatus, zero -# CHECK-ENC: encoding: [0x73,0x23,0x00,0x00] -# CHECK-INST-ALIAS: csrr t1, ustatus -# uimm12 -# CHECK-INST: csrrs t2, ustatus, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x00,0x00] -# CHECK-INST-ALIAS: csrr t2, ustatus -csrrs t1, ustatus, zero -# uimm12 -csrrs t2, 0x000, zero - -# uie -# name -# CHECK-INST: csrrs t1, uie, zero -# CHECK-ENC: encoding: [0x73,0x23,0x40,0x00] -# CHECK-INST-ALIAS: csrr t1, uie -# uimm12 -# CHECK-INST: csrrs t2, uie, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x40,0x00] -# CHECK-INST-ALIAS: csrr t2, uie -# name -csrrs t1, uie, zero -# uimm12 -csrrs t2, 0x004, zero - -# utvec -# name -# CHECK-INST: csrrs t1, utvec, zero -# CHECK-ENC: encoding: [0x73,0x23,0x50,0x00] -# CHECK-INST-ALIAS: csrr t1, utvec -# uimm12 -# CHECK-INST: csrrs t2, utvec, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x50,0x00] -# CHECK-INST-ALIAS: csrr t2, utvec -# name -csrrs t1, utvec, zero -# uimm12 -csrrs t2, 0x005, zero - -################################## -# User Trap Handling -################################## - -# uscratch -# name -# CHECK-INST: csrrs t1, uscratch, zero -# CHECK-ENC: encoding: [0x73,0x23,0x00,0x04] -# CHECK-INST-ALIAS: csrr t1, uscratch -# uimm12 -# CHECK-INST: csrrs t2, uscratch, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x00,0x04] -# CHECK-INST-ALIAS: csrr t2, uscratch -# name -csrrs t1, uscratch, zero -# uimm12 -csrrs t2, 0x040, zero - -# uepc -# name -# CHECK-INST: csrrs t1, uepc, zero -# CHECK-ENC: encoding: [0x73,0x23,0x10,0x04] -# CHECK-INST-ALIAS: csrr t1, uepc -# uimm12 -# CHECK-INST: csrrs t2, uepc, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x10,0x04] -# CHECK-INST-ALIAS: csrr t2, uepc -# name -csrrs t1, uepc, zero -# uimm12 -csrrs t2, 0x041, zero - -# ucause -# name -# CHECK-INST: csrrs t1, ucause, zero -# CHECK-ENC: encoding: [0x73,0x23,0x20,0x04] -# CHECK-INST-ALIAS: csrr t1, ucause -# uimm12 -# CHECK-INST: csrrs t2, ucause, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x20,0x04] -# CHECK-INST-ALIAS: csrr t2, ucause -# name -csrrs t1, ucause, zero -# uimm12 -csrrs t2, 0x042, zero - -# utval -# name -# CHECK-INST: csrrs t1, utval, zero -# CHECK-ENC: encoding: [0x73,0x23,0x30,0x04] -# CHECK-INST-ALIAS: csrr t1, utval -# uimm12 -# CHECK-INST: csrrs t2, utval, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x30,0x04] -# CHECK-INST-ALIAS: csrr t2, utval -# name -csrrs t1, utval, zero -# uimm12 -csrrs t2, 0x043, zero - -# uip -# name -# CHECK-INST: csrrs t1, uip, zero -# CHECK-ENC: encoding: [0x73,0x23,0x40,0x04] -# CHECK-INST-ALIAS: csrr t1, uip -# uimm12 -# CHECK-INST: csrrs t2, uip, zero -# CHECK-ENC: encoding: [0xf3,0x23,0x40,0x04] -# CHECK-INST-ALIAS: csrr t2, uip -#name -csrrs t1, uip, zero -# uimm12 -csrrs t2, 0x044, zero - ################################## # User Floating Point CSRs ##################################