[PATCH] D68979: [RISCV] Handle variable sized objects with the stack need to be realigned

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 20:22:39 PDT 2019


shiva0217 marked an inline comment as done.
shiva0217 added inline comments.


================
Comment at: llvm/test/CodeGen/RISCV/stack-realignment-with-variable-sized-objects.ll:33
+; RV32I-NEXT:    lw s0, 120(sp)
+; RV32I-NEXT:    .cfi_def_cfa sp, 128
+; RV32I-NEXT:    lw ra, 124(sp)
----------------
lenary wrote:
> This doesn't look right. Why does this directive come after the restore of `s0` and `s1` (but not `ra`)? Shouldn't it come immediately after the `addi` instruction?
I think the idea is that before `s0` been restored, debugger could use `s0` as the base to calculate CFA. After the `s0` been corrupted, the CFA calculation has to base on sp with sp_offset. `addi sp, s0, -128` will be generated for the frame contains variable-sized objects. For the case has FP but not contains variable-sized objects, the directive need to be inserted, too. I guess that's why the directive inserts here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68979





More information about the llvm-commits mailing list