[PATCH] D115861: [LoongArch 4/6] Add basic tablegen infra for LoongArch

Lu Weining via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 7 01:20:41 PST 2022


SixWeining added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchRegisterInfo.td:62
+  def R20 : LoongArchReg<20, "r20", ["t8"]>, DwarfRegNum<[20]>;
+  def R21 : LoongArchReg<21, "r21", ["r21"]>, DwarfRegNum<[21]>;
+  def R22 : LoongArchReg<22, "r22", ["fp"]>, DwarfRegNum<[22]>;
----------------
xen0n wrote:
> SixWeining wrote:
> > xen0n wrote:
> > > Is the "r21" alias needed, given it's identical to its canonical name?
> > Right. This alias is unnecessary and I will remove it although other targets have similar usage, like the `CSKY`:
> > 
> > ```
> >  78   def R26 : CSKYReg<26, "r26", ["r26"]>, DwarfRegNum<[26]>;
> >  79   def R27 : CSKYReg<27, "r27", ["r27"]>, DwarfRegNum<[27]>;
> > ```
> Hmm, I wonder if `[""]` or `[]` is correct; perhaps this "duplication" is necessary for proper functioning after all, I'm not quite sure. Maybe others more familiar with tblgen could clarify this.
If we use `[]` , tblgen is not happy.
If we use `[""]`, tblgen is happy but `llvm-mc` will crash. We must  add this change:

```
let FallbackRegAltNameIndex = NoRegAltName in
def RegAliasName : RegAltNameIndex;
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115861



More information about the llvm-commits mailing list