Commit 9a0636a
committed
[AArch64][llvm] Add support for optional register in
Add support for future AArch64 instructions in the `SYS` alias encoding
space which may support an optional register as an operand. For example:
```
SYS #4, c8, c5, #2, {<Xt>}
```
Currently, AArch64 `SYS` alias instructions fall into two categories:
* a register value must be present (indicated by any value except `XZR`)
* no register value must be present (this value must be `XZR`)
This is defined by the optional "needsreg" parameter in TableGen (e.g. see
the multiclass definition for TLBI), which defaults to requiring a register
operand for the instruction to be valid.
Expand the code so that if an optional register operand is specified
in TableGen, then if it's not `XZR`, encode this value in the `SYS` alias
and for disassembly, print this value if it's not `XZR`. Don't produce an
error message if the register operand is missing or unexpected, if it is
specified as an optional register.
If a mandatory or optional register is not specified in the TableGen
(i.e. no register operand should be present), then disassemble to a SYS
alias instead if the register value is not xzr/x31 (encoded as 0b11111).
For instructions taking no register operands, this is specified in the
Arm ARM, with language similar to:
```
Rt should be encoded as 0b11111. If the Rt field is not set to 0b11111,
it is CONSTRAINED UNPREDICTABLE whether:
* The instruction is UNDEFINED.
* The instruction behaves as if the Rt field is set to 0b11111.
```
and since we want to follow "should" directives, and not encourage
undefined behaviour, these are not considered valid instructions, so
should not be assembled or disassembled as such.SYS alias instructions1 parent 25285b3 commit 9a0636a
File tree
3 files changed
+33
-8
lines changed- llvm/lib/Target/AArch64
- AsmParser
- MCTargetDesc
- Utils
3 files changed
+33
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3908 | 3908 | | |
3909 | 3909 | | |
3910 | 3910 | | |
| 3911 | + | |
| 3912 | + | |
3911 | 3913 | | |
3912 | 3914 | | |
3913 | 3915 | | |
| |||
3956 | 3958 | | |
3957 | 3959 | | |
3958 | 3960 | | |
3959 | | - | |
3960 | 3961 | | |
3961 | 3962 | | |
3962 | 3963 | | |
| |||
3989 | 3990 | | |
3990 | 3991 | | |
3991 | 3992 | | |
3992 | | - | |
3993 | | - | |
3994 | | - | |
3995 | | - | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
| 3996 | + | |
| 3997 | + | |
| 3998 | + | |
3996 | 3999 | | |
3997 | 4000 | | |
3998 | 4001 | | |
| |||
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
917 | 917 | | |
918 | 918 | | |
919 | 919 | | |
| 920 | + | |
920 | 921 | | |
921 | 922 | | |
922 | 923 | | |
| |||
1017 | 1018 | | |
1018 | 1019 | | |
1019 | 1020 | | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
1020 | 1030 | | |
1021 | 1031 | | |
1022 | 1032 | | |
1023 | 1033 | | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1027 | 1039 | | |
1028 | 1040 | | |
1029 | 1041 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
412 | 422 | | |
413 | 423 | | |
414 | 424 | | |
| |||
0 commit comments