generate more register messages
This commit is contained in:
parent
a0799c99ec
commit
8781ada304
5 changed files with 18 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -5,6 +5,7 @@ struct localvar {
|
|||
int t_align;
|
||||
int t_regtype;
|
||||
int t_count;
|
||||
int t_sc; /* storage class */
|
||||
};
|
||||
|
||||
/* ALLOCDEF "localvar" 10 */
|
||||
|
|
Loading…
Reference in a new issue