[PATCH] D86215: [TableGen][GlobalISel] Fix handling of zero_reg

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 10:17:56 PDT 2020


bjope added inline comments.


================
Comment at: llvm/utils/TableGen/GlobalISelEmitter.cpp:2656
+      Table << MatchTable::Comment("zero_reg");
+      Table << MatchTable::IntValue(0);
+    }
----------------
arsenm wrote:
> ehjogab wrote:
> > arsenm wrote:
> > > Could this use TargetNamespace::NoRegister?
> > I suppose that works. I checked for our target and NoRegister is indeed assigned value 0, so the semantics would be the same. But I am not sure whether that would work for all targets. If it does, I do believe your suggestion to be a better solution than to simply output value 0. Perhaps someone more knowledgeable regarding TableGen could comment on this?
> That's generated for all targets. 0 is always $noreg, with an added NoRegister entry.
> 
> I also think zero_reg should really be renamed to $noreg or something closer to what it really is
Agree `zero_reg` is not a good name if this refers to `NoRegister` (register number zero in the internal representation).

I would have guessed that it mapped to a register always being read as zero (if the target got such a register).

Changing the name is perhaps outside the scope of this patch. But we better (make sure) clarify that zero_reg is NoRegister (holding an undefined value, rather than holding the value zero).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86215



More information about the llvm-commits mailing list