[PATCH] D145205: [codegen][riscv] Emit CFI directives when using shadow call stack

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 09:57:44 PST 2023


paulkirth added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:87
+      18, // register
+      2,  // length
+      static_cast<char>(unsigned(dwarf::DW_OP_breg18)),
----------------
mcgrathr wrote:
> jrtc27 wrote:
> > Similarly don't hard-code (up to you whether you unconditionally use bregx or branch on whether reg num is < 32)
> Definitely don't use bregx. That takes another byte and CFI size is precious. Just use `DW_OP_breg0 + n` after an assertion that n < 32 because it actually is (it's 18 and will only ever be 18).
> 
I don't see a good way to not directly encode the length of the following expression without making this much more complex.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145205



More information about the llvm-commits mailing list