[PATCH] D158492: [RISCV] Add CSR RegisterClass and save/restore fcsr in interrupt

Wang Pengcheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 01:12:18 PDT 2023


wangpc added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:549
+      BuildMI(MBB, I, DL, get(RISCV::CSRRS))
+          .addReg(RISCV::X5, RegState::Define)
+          .addImm(getSysRegEncoding(SrcReg))
----------------
craig.topper wrote:
> This seems tricky to me to hardcode a GPR in here. This makes the code only work in certain scenarios. Do other targets do anything like this?
> This seems tricky to me to hardcode a GPR in here.
We just need a GPR to store the value of CSRs.
> This makes the code only work in certain scenarios. 
I don't get it. This code is only for saving CSRs.
> Do other targets do anything like this?
No, I haven't find any target doing this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158492/new/

https://reviews.llvm.org/D158492



More information about the llvm-commits mailing list