[PATCH] D40805: [RISCV] Support for varargs

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 06:51:22 PST 2018


asb added inline comments.


================
Comment at: lib/Target/RISCV/RISCVISelLowering.cpp:446
+    unsigned RegIdx = State.getFirstUnallocated(ArgGPRs);
+    if (RegIdx != array_lengthof(ArgGPRs) && RegIdx % 2 == 1) {
+      State.AllocateReg(ArgGPRs);
----------------
xiangzhai wrote:
> `RegIdx % 2 == 1` is an odd register, not an even, but the comment is "ensure it is assigned to an even register".
The comment and code are correct. If we would use an odd register, we 'waste' it by mark it as allocated to ensure that an even register will be used. I'll add an extra comment to make it a bit clearer - thanks for the feedback.


https://reviews.llvm.org/D40805





More information about the llvm-commits mailing list