Skip to content

aco: Replace Operand literal constructors with factory member functions

Tony Wasserka requested to merge neobrain/mesa:refactor_operand_ctors into main

(reviewing ded497ac separately from other the patches is strongly recommended)

We run into build issues due to ambiguous constructors from time to time (see !7944 (merged) or !11627 (merged)), so it seems better to make the operand size explicit. As a bonus, this makes it much easier to see which function actually constructs the Operand now.

The bulk of this migration was done with libclang-based automatic tooling, which performed these replacements:

  • Operand(uint8_t) -> Operand::c8
  • Operand(uint16_t) -> Operand::c16
  • Operand(uint32_t, false) -> Operand::c32
  • Operand(uint32_t, bool) -> Operand::c32_or_c64
  • Operand(uint64_t) -> Operand::c64
  • Operand(0) -> Operand::zero(num_bytes)

FWIW I can easily re-run the migration if anyone wants to bikeshed on the member function names. I could also add user-defined literal syntax (Operand((uint16_t)0) -> 0_op16) if that is deemed desirable.

TODO:

  • Add Operand::zero and Operand::uint_max(size) factories
  • Deprecate c32_or_c64 (maybe)
  • Reformat once !11258 (merged) is merged
Edited by Tony Wasserka

Merge request reports

Loading