[PATCH] D68946: [MIParser] Set RegClassOrRegBank during instruction parsing

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 01:43:13 PDT 2019


Petar.Avramovic added a comment.

`RegClassOrRegBank` is a `PointerUnion<const TargetRegisterClass *, const RegisterBank *>`.
Plain nullptr `is` a `const TargetRegisterClass *` (the first template type)
but `static_cast<RegisterBank *>(nullptr)` `is` nullptr of `const RegisterBank *` type.

file: `lib/CodeGen/GlobalISel/RegisterBankInfo.cpp` in ...`RegisterBankInfo::constrainGenericRegister(`...
line :
`if (RegClassOrBank.is<const TargetRegisterClass *>())`
makes the difference.

if we go through IRTranslator, it uses createGenericVirtualRegister which also sets RegClassOrRegBank to `nullptr` `RegisterBank *`

file: `lib/CodeGen/MachineRegisterInfo.cpp` in  ...`MachineRegisterInfo::createGenericVirtualRegister(`...

  // FIXME: Should we use a dummy register class?
  VRegInfo[Reg].first = static_cast<RegisterBank *>(nullptr);
  setType(Reg, Ty);


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

https://reviews.llvm.org/D68946





More information about the llvm-commits mailing list