[PATCH] D105800: [AMDGPU] Tidy SReg/SGPR definitions using template class

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 19:12:26 PDT 2021


critson marked 2 inline comments as done.
critson added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIRegisterInfo.td:714
+                     SIRegisterTuples regList,
+                     SIRegisterTuples ttmpList = regList,
+                     int copyCost = !sra(!add(numRegs, 1), 1),
----------------
foad wrote:
> Wouldn't it be a bit simpler to use `[]` as the default, and test it with !empty?
It's not possible to initialise a SIRegisterTuples variable with [], so this is the simplest solution in my opinion. Beyond creating a dummy SIRegisterTuples variable to use.


================
Comment at: llvm/lib/Target/AMDGPU/SIRegisterInfo.td:715
+                     SIRegisterTuples ttmpList = regList,
+                     int copyCost = !sra(!add(numRegs, 1), 1),
+                     bit hasTTMP = !ne(regList, ttmpList),
----------------
foad wrote:
> Isn't defvar a better way of defining all these variables, instead of making them optional arguments that are never actually used?
Good point. It seems we don't actually use defvar much in AMDGPU.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105800



More information about the llvm-commits mailing list