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

Gabriel Hjort Ã…kerlund via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 23:45:13 PDT 2020


ehjogab added inline comments.


================
Comment at: llvm/utils/TableGen/GlobalISelEmitter.cpp:2656
+      Table << MatchTable::Comment("zero_reg");
+      Table << MatchTable::IntValue(0);
+    }
----------------
bjope wrote:
> 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).
Looking into the Target/Target.td file where zero_reg is defined, it says the following:

```
/// zero_reg definition - Special node to stand for the zero register.
///
def zero_reg;
```

Is "zero register" and "NoRegister" really the same thing? If not, what should then be output?


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