diff options
| author | Simon Tatham <simon.tatham@arm.com> | 2025-10-21 09:29:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-21 09:29:18 +0100 |
| commit | 8da0df49568206544f64eea890e51354d04187cd (patch) | |
| tree | a516eae82ed581489ee699a38b4c161d4c8567e7 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
| parent | 253e43590842bffcc6950cc517a7f89cafe5ec69 (diff) | |
| download | llvm-8da0df49568206544f64eea890e51354d04187cd.zip llvm-8da0df49568206544f64eea890e51354d04187cd.tar.gz llvm-8da0df49568206544f64eea890e51354d04187cd.tar.bz2 | |
[TableGen] List the indices of sub-operands (#163723)
Some instances of the `Operand` class used in Tablegen instruction
definitions expand to a cluster of multiple operands at the MC layer,
such as complex addressing modes involving base + offset + shift, or
clusters of operands describing conditional Arm instructions or
predicated MVE instructions. There's currently no convenient way for C++
code to know the offset of one of those sub-operands from the start of
the cluster: instead it just hard-codes magic numbers like `index+2`,
which is hard to read and fragile.
This patch adds an extra piece of output to `InstrInfoEmitter` to define
those instruction offsets, based on the name of the `Operand` class
instance in Tablegen, and the names assigned to the sub-operands in the
`MIOperandInfo` field. For example, if target Foo were to define
def Bar : Operand {
let MIOperandInfo = (ops GPR:$first, i32imm:$second);
// ...
}
then the new constants would be `Foo::SUBOP_Bar_first` and
`Foo::SUBOP_Bar_second`, defined as 0 and 1 respectively.
As an example, I've converted some magic numbers related to the MVE
predication operand types (`vpred_n` and its superset `vpred_r`) to use
the new named constants in place of the integer literals they previously
used. This is more verbose, but also clearer, because it explains why
the integer is chosen instead of what its value is.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions
