[PATCH] D67185: [RISCV] Add support for -ffixed-xX flags

Sam Elliott via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 10:02:47 PDT 2019


lenary added a comment.

I don't quite understand all the details of this patch. I understand reserving registers that the compiler would otherwise be using as general-purpose registers.

But what do we do about using registers within the calling convention when someone says they should be reserved against compiler use? I think you're saying that GCC ignores that they should be fixed, and uses them anyway - it seems like that would cause hard-to-diagnose errors, for instance if a user requests fixed `x8` but requests the use of frame pointers, it seems like that should be an error, and yet here it might not be? I think the clang-y approach would be to say "you can't fix x8, we're going to use it anyway", at which point the "fix x8" option becomes pointless.



================
Comment at: llvm/test/CodeGen/RISCV/reserved-regs.ll:71
+
+; X1-NOT: lw ra,
+; X1-NOT: ld ra,
----------------
These tests aren't going to test what you think they are, or at least aren't going to fail when you hope they are, as the allocator will probably choose a0 for these registers, even if other registers are available (it uses the GPRs in a specific order, starting with the first free one, which will usually be a0).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67185





More information about the cfe-commits mailing list