From 32f21c2bfae1b718ac8a0a6cd7ea00d31608a3b2 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 26 Oct 1990 18:18:53 +0000 Subject: [PATCH] changed 'uses REG=%1' behaviour: if no REG containing %1 is found, an attempt is made to find an empty one --- mach/proto/ncg/codegen.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/mach/proto/ncg/codegen.c b/mach/proto/ncg/codegen.c index ff02718f6..cffb11a8b 100644 --- a/mach/proto/ncg/codegen.c +++ b/mach/proto/ncg/codegen.c @@ -563,7 +563,7 @@ normalfailed: if (stackpad!=tokpatlen) { int npos,npos2,pos[NREGS],pos2[NREGS]; unsigned mincost,t; struct reginfo *rp,**rpp; - token_t token,mtoken,token2; + token_t token,token2; int propno; int exactmatch; int decision; @@ -585,7 +585,7 @@ normalfailed: if (stackpad!=tokpatlen) { if (getrefcount(rp-machregs, FALSE)==0) { pos[npos++] = rp-machregs; if (eqtoken(&rp->r_contents,&token)) - exactmatch++; + pos2[exactmatch++] = rp-machregs; } /* * Now pos[] contains all free registers with desired @@ -606,6 +606,21 @@ normalfailed: if (stackpad!=tokpatlen) { CHKCOST(); } } while (npos==0); + + if (!exactmatch && tinstno!=0) { + /* + * No exact match, but we were looking for a particular + * token. Now try to find registers of which no + * known contents is available (the others might still + * be useful). + */ + instance(0,&token2); + for (i=0;i