[PATCH] D40805: [RISCV] Support for varargs

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 15:23:06 PST 2018


efriedma added inline comments.


================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:701
+    // If saving an odd-number of registers, create an extra stack slot to
+    // ensure even-numbered registers are always 2*XLEN-aligned.
+    if (Idx % 2) {
----------------
Could you clarify what "ensure even-numbered registers are always 2*XLEN-aligned" means?  The varargs save area is always right next to any arguments passed on the stack, so I'm not sure what exactly you need to align.


================
Comment at: test/CodeGen/RISCV/vararg.ll:3
+; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
+; RUN:   | FileCheck -check-prefix=RV32I %s
+
----------------
Could you generate 64-bit tests as well?  (It probably isn't that different, but nice to have.)


================
Comment at: test/CodeGen/RISCV/vararg.ll:297
+; RV32I-NEXT:    sw s0, 16(sp)
+; RV32I-NEXT:    addi s0, sp, 24
+; RV32I-NEXT:    sw a7, 20(s0)
----------------
This looks a little weird; why are we loading sp+24 into a scratch register?


https://reviews.llvm.org/D40805





More information about the llvm-commits mailing list