1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-10-18 22:24:28 +00:00

BREQ/BRNE optimizations

This commit is contained in:
Dave Schmenk 2018-03-15 21:54:11 -07:00
parent 3d84a2192c
commit 5fc2807ace
2 changed files with 34 additions and 0 deletions

View File

@ -453,6 +453,38 @@ def crunch_seq(seq, pass)
break
wend
break // LOGIC_NOT_CODE
is EQ_CODE
when nextop->opcode
is BRFALSE_CODE
op->opcode = BRNE_CODE
op->opgroup = RELATIVE_GROUP
op=>optag = nextop=>optag
freeops = 1
break
is BRTRUE_CODE
op->opcode = BREQ_CODE
op->opgroup = RELATIVE_GROUP
op=>optag = nextop=>optag
freeops = 1
break
wend
break // EQ_CODE
is NE_CODE
when nextop->opcode
is BRFALSE_CODE
op->opcode = BREQ_CODE
op->opgroup = RELATIVE_GROUP
op=>optag = nextop=>optag
freeops = 1
break
is BRTRUE_CODE
op->opcode = BRNE_CODE
op->opgroup = RELATIVE_GROUP
op=>optag = nextop=>optag
freeops = 1
break
wend
break // NE_CODE
is SLB_CODE
if nextop->opcode == LLB_CODE and op=>opoffset == nextop=>opoffset
op->opcode = DLB_CODE

View File

@ -82,6 +82,8 @@ const IDXAW_CODE = $BE
// Relative address code group
//
const RELATIVE_GROUP = $05
const BREQ_CODE = $22
const BRNE_CODE = $24
const BRFALSE_CODE = $4C
const BRTRUE_CODE = $4E
const BRNCH_CODE = $50