From 8eaa11ac72f71e42b7a6002572fd8eebf4452f24 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 14 Feb 2019 00:05:08 +0100 Subject: [PATCH] Turns out that every time the compiler tried to do a stack retraction with asp, it would flush registers onto the stack. This stops it doing this. Star Trek goes from 40779 to 40452 bytes. --- mach/i80/ncg/table | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/mach/i80/ncg/table b/mach/i80/ncg/table index d3e5a0a6b..87d1d0a3e 100644 --- a/mach/i80/ncg/table +++ b/mach/i80/ncg/table @@ -53,6 +53,7 @@ smallnconst2 = { INT num; } 2 num. /* Byte-sized negative constant */ label = { ADDR off; } 2 off. plabel = { ADDR off; INT param; } 2 off param. m = { } 2 cost(0,3) "m". +comment = { ADDR str; } 2 "! " str. SETS @@ -118,7 +119,7 @@ INSTRUCTIONS mov m:wo,reg1:ro cost(1, 4). mov reg1:wo,m:ro cost(1, 4). mvi reg1:wo,const1:ro cost(2, 7). -/* nop cost(1, 3). */ + nop comment:ro cost(1, 3). ora reg1:ro kills a:cc cost(1, 4). ori const1:ro kills a:cc cost(2, 7). /* out const1:ro cost(2,10). */ @@ -2161,12 +2162,22 @@ gen 1: /* Group 15: Miscellaneous */ /******************************************/ -pat asp ($1<=0-12) || ($1>=12) +pat asp $1==0 /* do nothing */ + +pat asp ($1==2) + with regpair with STACK - uses hlreg={const2,$1} + uses hlreg gen - dad sp - sphl. + pop hl + +pat asp ($1==4) + with regpair regpair + with STACK + uses hlreg + gen + pop hl + pop hl pat asp ($1<0) && ($1>0-12) with STACK @@ -2175,9 +2186,7 @@ pat asp ($1<0) && ($1>0-12) leaving asp $1+2 -pat asp $1==0 /* do nothing */ - -pat asp ($1>0) && ($1<12) +pat asp ($1>4) && ($1<12) with STACK uses hlreg gen @@ -2185,6 +2194,13 @@ pat asp ($1>0) && ($1<12) leaving asp $1-2 +pat asp + with STACK + uses hlreg={const2,$1} + gen + dad sp + sphl. + pat ass $1==2 with hlreg STACK gen dad sp