isa.yaml: use condition expressions instead of matchers

This commit is contained in:
Richard Patel 2022-04-07 01:25:20 +02:00
parent ea364a52d8
commit 82970d166b
2 changed files with 45 additions and 149 deletions

View File

@ -606,10 +606,6 @@ pub(crate) struct ModifiersExpr {
} }
impl ModifiersExpr { impl ModifiersExpr {
fn new() -> Self {
Self::default()
}
fn build(&self) -> Result<TokenStream> { fn build(&self) -> Result<TokenStream> {
if self.modifiers.is_empty() && self.side_effects.is_empty() { if self.modifiers.is_empty() && self.side_effects.is_empty() {
return Ok(Self::build_empty()); return Ok(Self::build_empty());

190
isa.yaml
View File

@ -1956,28 +1956,18 @@ mnemonics:
- name: lis - name: lis
opcode: addis opcode: addis
args: [ rD, uimm ] args: [ rD, uimm ]
match: condition: rA == 0
- arg: rA
value: 0
- name: li - name: li
opcode: addi opcode: addi
args: [ rD, simm ] args: [ rD, simm ]
match: condition: rA == 0
- arg: rA
value: 0
- name: mr - name: mr
opcode: or opcode: or
args: [ rA, rS ] args: [ rA, rS ]
condition: rS == rB condition: rS == rB
- name: nop - name: nop
opcode: ori opcode: ori
match: condition: rA == 0 && rS == 0 && uimm == 0
- arg: rA
value: 0
- arg: rS
value: 0
- arg: uimm
value: 0
# Rotates/Shifts # Rotates/Shifts
- name: clrlwi - name: clrlwi
@ -2033,180 +2023,122 @@ mnemonics:
- name: twgti - name: twgti
opcode: twi opcode: twi
args: [ rA, simm ] args: [ rA, simm ]
match: condition: TO == 8
- arg: TO
value: 8
- name: twllei - name: twllei
opcode: twi opcode: twi
args: [ rA, simm ] args: [ rA, simm ]
match: condition: TO == 6
- arg: TO
value: 6
- name: twui - name: twui
args: [ rA, simm ] args: [ rA, simm ]
match: condition: TO == 31
- arg: TO
value: 31
# Branches # Branches
- name: blr - name: blr
opcode: bclr opcode: bclr
match: condition: BO == 20 && BI == 0
- arg: BO
value: 20
- arg: BI
value: 0
# Move to special-purpose register # Move to special-purpose register
- name: mtxer - name: mtxer
opcode: mtspr opcode: mtspr
args: [ rS ] args: [ rS ]
match: condition: spr == 1
- arg: spr
value: 1
- name: mtlr - name: mtlr
opcode: mtspr opcode: mtspr
args: [ rS ] args: [ rS ]
match: condition: spr == 8
- arg: spr
value: 8
- name: mtctr - name: mtctr
opcode: mtspr opcode: mtspr
args: [ rS ] args: [ rS ]
match: condition: spr == 9
- arg: spr
value: 9
- name: mtdsisr - name: mtdsisr
opcode: mtspr opcode: mtspr
args: [ rS ] args: [ rS ]
match: condition: spr == 18
- arg: spr
value: 18
- name: mtdbatu - name: mtdbatu
opcode: mtspr opcode: mtspr
args: [ rS ] args: [ rS ]
match: condition: spr == 397
- arg: spr
value: 397
- name: mttdu - name: mttdu
opcode: mtspr opcode: mtspr
args: [ rS ] args: [ rS ]
match: condition: spr == 571
- arg: spr
value: 571
# Move from special-purpose register # Move from special-purpose register
- name: mfxer - name: mfxer
opcode: mfspr opcode: mfspr
args: [ rD ] args: [ rD ]
match: condition: spr == 1
- arg: spr
value: 1
- name: mflr - name: mflr
opcode: mfspr opcode: mfspr
args: [ rD ] args: [ rD ]
match: condition: spr == 8
- arg: spr
value: 8
- name: mfctr - name: mfctr
opcode: mfspr opcode: mfspr
args: [ rD ] args: [ rD ]
match: condition: spr == 9
- arg: spr
value: 9
- name: mfdsisr - name: mfdsisr
opcode: mfspr opcode: mfspr
args: [ rD ] args: [ rD ]
match: condition: spr == 18
- arg: spr
value: 18
- name: mfdbatu - name: mfdbatu
opcode: mfspr opcode: mfspr
args: [ rD ] args: [ rD ]
match: condition: spr == 397
- arg: spr
value: 397
- name: mftdu - name: mftdu
opcode: mfspr opcode: mfspr
args: [ rD ] args: [ rD ]
match: condition: spr == 571
- arg: spr
value: 571
# Branch Conditional # Branch Conditional
- name: blt - name: blt
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: ble - name: ble
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: beq - name: beq
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bge - name: bge
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bgt - name: bgt
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bne - name: bne
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bso - name: bso
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bns - name: bns
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bdnz - name: bdnz
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ BD ] args: [ BD ]
match: condition: BO == 16 && BI == 0
- arg: BO
value: 16
- arg: BI
value: 0
- name: bdz - name: bdz
opcode: bc opcode: bc
modifiers: [ AA, LK ] modifiers: [ AA, LK ]
args: [ BD ] args: [ BD ]
match: condition: BO == 18 && BI == 0
- arg: BO
value: 18
- arg: BI
value: 0
# TODO support conditional bd... # TODO support conditional bd...
# Branch Conditional to Count Register # Branch Conditional to Count Register
@ -2214,113 +2146,81 @@ mnemonics:
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: blectr - name: blectr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: beqctr - name: beqctr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bgectr - name: bgectr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bgtctr - name: bgtctr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bnectr - name: bnectr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bsoctr - name: bsoctr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bnsctr - name: bnsctr
opcode: bcctr opcode: bcctr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
# Branch Conditional to Link Register # Branch Conditional to Link Register
- name: bltlr - name: bltlr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: blelr - name: blelr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: beqlr - name: beqlr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bgelr - name: bgelr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bgtlr - name: bgtlr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bnelr - name: bnelr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4
- name: bsolr - name: bsolr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 12
- arg: BO
value: 12
- name: bnslr - name: bnslr
opcode: bclr opcode: bclr
modifiers: [ LK ] modifiers: [ LK ]
args: [ crfS, BD ] args: [ crfS, BD ]
match: condition: BO == 4
- arg: BO
value: 4