HomePhabricator

[MC] Assert that MCRegUnitIterator operates over MCRegisters
Audit Required0a3523299dec

Authored by mtrofin on Oct 1 2020, 2:35 PM.

Description

[MC] Assert that MCRegUnitIterator operates over MCRegisters

The signature of the ctor expects a MCRegister, but currently any
unsigned value can be converted to a MCRegister.

This patch checks that indeed the provided value is a physical register
only. We want to eventually stop implicitly converting unsigned or
Register to MCRegister (which is incorrect). The next step after this
patch is changing uses of MCRegUnitIterator to explicitly cast Register
or unsigned values to MCRegister. To that end, this patch also
introduces 2 APIs that make that conversion checked and explicit.

Differential Revision: https://reviews.llvm.org/D88705

Details