[AArch64] Add target feature "all"
authorFangrui Song <i@maskray.me>
Thu, 30 Jun 2022 17:37:58 +0000 (10:37 -0700)
committerFangrui Song <i@maskray.me>
Thu, 30 Jun 2022 17:37:58 +0000 (10:37 -0700)
commit45f3a5aae7320a847bbcb24eca0a33e933ec8561
tree7dbbc2880acc36a501ab638fcfcdbc2974f5a4aa
parent3a743a589244d02c8b05e4e514a8d7f0d235b24d
[AArch64] Add target feature "all"

This is used by disassemblers: `llvm-mc -disassemble -mattr=` and `llvm-objdump --mattr=`.
The main use case is for llvm-objdump to disassemble all known instructions
(D128030).

In user-facing tools, "all" is intentionally not supported in producers:
integrated assembler (`.arch_extension all`), clang -march (`-march=armv9.3a+all`).
Due to the code structure, `llvm-mc -mattr=+all` `llc -mattr=+all` are not
rejected (they are internal tool). Add `llvm/test/CodeGen/AArch64/mattr-all.ll`
to catch behavior changes.

AArch64SysReg::SysReg::haveFeatures: check `FeatureAll` to print
`AArch64SysReg::SysReg::AltName` for some system registers (e.g. `ERRIDR_EL1, RNDR`).

AArch64.td: add `AssemblerPredicateWithAll` to additionally test `FeatureAll`.
Change all `AssemblerPredicate` (except `UseNegativeImmediates`) to `AssemblerPredicateWithAll`.

utils/TableGen/{DecoderEmitter,SubtargetFeatureInfo}.cpp: support arbitrarily
nested all_of, any_of, and not.

Note: A predicate supports all_of, any_of, and not. For a target (though
currently not for AArch64) an encoding may be disassembled differently with
different target features.
Note: AArch64MCCodeEmitter::computeAvailableFeatures is not available to
the disassembler.

Reviewed By: peter.smith, lenary

Differential Revision: https://reviews.llvm.org/D128029
12 files changed:
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AArch64SystemOperands.td
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
llvm/test/CodeGen/AArch64/mattr-all.ll [new file with mode: 0644]
llvm/test/MC/AArch64/alias-addsubimm.s
llvm/test/MC/AArch64/armv8.6a-bf16.s
llvm/test/MC/Disassembler/AArch64/mattr-all.txt [new file with mode: 0644]
llvm/test/TableGen/AsmPredicateCombining.td
llvm/utils/TableGen/AsmWriterEmitter.cpp
llvm/utils/TableGen/DecoderEmitter.cpp
llvm/utils/TableGen/SubtargetFeatureInfo.cpp