Skip to content

Commit e7291ff

Browse files
authored
[RISCV] Recognize CSR name ssp for Zicfilp. (#81974)
The CSR address of `ssp` is 0x011. Ref: https://github.com/riscv/riscv-cfi/blob/main/cfi_backward.adoc#shadow-stack-pointer-ssp
1 parent aff6cb4 commit e7291ff

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

llvm/lib/Target/RISCV/RISCVSystemOperands.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ def SysRegVL : SysReg<"vl", 0xC20>;
342342
def : SysReg<"vtype", 0xC21>;
343343
def SysRegVLENB: SysReg<"vlenb", 0xC22>;
344344

345+
//===----------------------------------------------------------------------===//
346+
// Shadow Stack CSR
347+
//===----------------------------------------------------------------------===//
348+
def : SysReg<"ssp", 0x011>;
349+
345350
//===----------------------------------------------------------------------===//
346351
// State Enable Extension (Smstateen)
347352
//===----------------------------------------------------------------------===//

llvm/test/MC/RISCV/user-csr-names.s

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ csrrs t1, instret, zero
6161
# uimm12
6262
csrrs t2, 0xC02, zero
6363

64+
# ssp
65+
# name
66+
# CHECK-INST: csrrs t1, ssp, zero
67+
# CHECK-ENC: encoding: [0x73,0x23,0x10,0x01]
68+
# CHECK-INST-ALIAS: csrr t1, ssp
69+
# uimm12
70+
# CHECK-INST: csrrs t2, ssp, zero
71+
# CHECK-ENC: encoding: [0xf3,0x23,0x10,0x01]
72+
# CHECK-INST-ALIAS: csrr t2, ssp
73+
# name
74+
csrrs t1, ssp, zero
75+
# uimm12
76+
csrrs t2, 0x011, zero
77+
6478
# hpmcounter3
6579
# name
6680
# CHECK-INST: csrrs t1, hpmcounter3, zero

0 commit comments

Comments
 (0)