From: ceriel Date: Tue, 26 Apr 1988 15:33:48 +0000 (+0000) Subject: generate more register messages X-Git-Tag: release-5-5~3317 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=8781ada304328092acc391c2a4f307571ac0b0d6;p=ack.git generate more register messages --- diff --git a/lang/cem/cemcom/blocks.c b/lang/cem/cemcom/blocks.c index 3aea3618f..a5c5c120f 100644 --- a/lang/cem/cemcom/blocks.c +++ b/lang/cem/cemcom/blocks.c @@ -14,8 +14,9 @@ #ifndef STB #include "label.h" #include "stack.h" +#include "Lpars.h" extern arith NewLocal(); -#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, 0) +#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER) #endif STB /* Because EM does not support the loading and storing of diff --git a/lang/cem/cemcom/eval.c b/lang/cem/cemcom/eval.c index 5b3288bd8..144675800 100644 --- a/lang/cem/cemcom/eval.c +++ b/lang/cem/cemcom/eval.c @@ -34,7 +34,7 @@ char *symbol2str(); char *long2str(); arith NewLocal(); /* util.c */ -#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, 0) +#define LocalPtrVar() NewLocal(pointer_size, pointer_align, reg_pointer, REGISTER) /* EVAL() is the main expression-tree evaluator, which turns any legal expression tree into EM code. Parameters: diff --git a/lang/cem/cemcom/idf.c b/lang/cem/cemcom/idf.c index 15b3c839c..31f161966 100644 --- a/lang/cem/cemcom/idf.c +++ b/lang/cem/cemcom/idf.c @@ -343,9 +343,7 @@ declare_idf(ds, dc, lvl) NewLocal(type->tp_size, type->tp_align, regtype(type), - (sc == REGISTER) ? REG_BONUS - : REG_DEFAULT - ); + sc); break; case STATIC: newdef->df_address = (arith) data_label(); @@ -615,9 +613,7 @@ declare_formals(fp) def->df_level = L_FORMAL2; /* CJ */ RegisterAccount(def->df_address, def->df_type->tp_size, regtype(def->df_type), - (def->df_sc == REGISTER ? REG_BONUS - : REG_DEFAULT) - ); + def->df_sc); } *fp = f_offset; } @@ -628,6 +624,7 @@ regtype(tp) { switch(tp->tp_fund) { case INT: + case LONG: return reg_any; #ifndef NOFLOAT case FLOAT: diff --git a/lang/cem/cemcom/util.c b/lang/cem/cemcom/util.c index a97d8898b..50875734f 100644 --- a/lang/cem/cemcom/util.c +++ b/lang/cem/cemcom/util.c @@ -22,6 +22,8 @@ #include "sizes.h" #include "align.h" #include "stack.h" +#include "Lpars.h" +#include "def.h" static struct localvar *FreeTmps; #ifdef USE_TMP @@ -56,7 +58,7 @@ LocalSpace(sz, al) static struct localvar *regs[TABSIZ]; arith -NewLocal(sz, al, regtype, init) +NewLocal(sz, al, regtype, sc) arith sz; { register struct localvar *tmp = FreeTmps; @@ -66,6 +68,7 @@ NewLocal(sz, al, regtype, init) while (tmp) { if (tmp->t_align >= al && tmp->t_size >= sz && + tmp->t_sc == sc && tmp->t_regtype == regtype) { if (prev) { prev->next = tmp->next; @@ -81,8 +84,9 @@ NewLocal(sz, al, regtype, init) tmp->t_offset = LocalSpace(sz, al); tmp->t_align = al; tmp->t_size = sz; + tmp->t_sc = sc; tmp->t_regtype = regtype; - tmp->t_count = init; + tmp->t_count = REG_DEFAULT; } index = (int) (tmp->t_offset >> 2) & (TABSIZ - 1); tmp->next = regs[index]; @@ -120,6 +124,7 @@ LocalFinish() tmp = FreeTmps; while (tmp) { tmp1 = tmp; + if (tmp->t_sc == REGISTER) tmp->t_count += REG_BONUS; if (! options['n'] && tmp->t_regtype >= 0) { C_ms_reg(tmp->t_offset, tmp->t_size, tmp->t_regtype, tmp->t_count); } @@ -130,6 +135,7 @@ LocalFinish() for (i = 0; i < TABSIZ; i++) { tmp = regs[i]; while (tmp) { + if (tmp->t_sc == REGISTER) tmp->t_count += REG_BONUS; tmp1 = tmp; if (! options['n'] && tmp->t_regtype >= 0) { C_ms_reg(tmp->t_offset, @@ -151,7 +157,7 @@ LocalFinish() #endif } -RegisterAccount(offset, size, regtype, init) +RegisterAccount(offset, size, regtype, sc) arith offset, size; { register struct localvar *p; @@ -163,7 +169,8 @@ RegisterAccount(offset, size, regtype, init) index = (int) (offset >> 2) & (TABSIZ - 1); p->t_offset = offset; p->t_regtype = regtype; - p->t_count = init; + p->t_count = REG_DEFAULT; + p->t_sc = sc; p->t_size = size; p->next = regs[index]; regs[index] = p; diff --git a/lang/cem/cemcom/util.str b/lang/cem/cemcom/util.str index 88ec0b8a1..886432343 100644 --- a/lang/cem/cemcom/util.str +++ b/lang/cem/cemcom/util.str @@ -5,6 +5,7 @@ struct localvar { int t_align; int t_regtype; int t_count; + int t_sc; /* storage class */ }; /* ALLOCDEF "localvar" 10 */