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
|
#ifndef STB
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
|
#include "Lpars.h"
|
||||||
extern arith NewLocal();
|
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
|
#endif STB
|
||||||
|
|
||||||
/* Because EM does not support the loading and storing of
|
/* Because EM does not support the loading and storing of
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
char *symbol2str();
|
char *symbol2str();
|
||||||
char *long2str();
|
char *long2str();
|
||||||
arith NewLocal(); /* util.c */
|
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
|
/* EVAL() is the main expression-tree evaluator, which turns
|
||||||
any legal expression tree into EM code. Parameters:
|
any legal expression tree into EM code. Parameters:
|
||||||
|
|
|
@ -343,9 +343,7 @@ declare_idf(ds, dc, lvl)
|
||||||
NewLocal(type->tp_size,
|
NewLocal(type->tp_size,
|
||||||
type->tp_align,
|
type->tp_align,
|
||||||
regtype(type),
|
regtype(type),
|
||||||
(sc == REGISTER) ? REG_BONUS
|
sc);
|
||||||
: REG_DEFAULT
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case STATIC:
|
case STATIC:
|
||||||
newdef->df_address = (arith) data_label();
|
newdef->df_address = (arith) data_label();
|
||||||
|
@ -615,9 +613,7 @@ declare_formals(fp)
|
||||||
def->df_level = L_FORMAL2; /* CJ */
|
def->df_level = L_FORMAL2; /* CJ */
|
||||||
RegisterAccount(def->df_address, def->df_type->tp_size,
|
RegisterAccount(def->df_address, def->df_type->tp_size,
|
||||||
regtype(def->df_type),
|
regtype(def->df_type),
|
||||||
(def->df_sc == REGISTER ? REG_BONUS
|
def->df_sc);
|
||||||
: REG_DEFAULT)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
*fp = f_offset;
|
*fp = f_offset;
|
||||||
}
|
}
|
||||||
|
@ -628,6 +624,7 @@ regtype(tp)
|
||||||
{
|
{
|
||||||
switch(tp->tp_fund) {
|
switch(tp->tp_fund) {
|
||||||
case INT:
|
case INT:
|
||||||
|
case LONG:
|
||||||
return reg_any;
|
return reg_any;
|
||||||
#ifndef NOFLOAT
|
#ifndef NOFLOAT
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "sizes.h"
|
#include "sizes.h"
|
||||||
#include "align.h"
|
#include "align.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
|
#include "Lpars.h"
|
||||||
|
#include "def.h"
|
||||||
|
|
||||||
static struct localvar *FreeTmps;
|
static struct localvar *FreeTmps;
|
||||||
#ifdef USE_TMP
|
#ifdef USE_TMP
|
||||||
|
@ -56,7 +58,7 @@ LocalSpace(sz, al)
|
||||||
static struct localvar *regs[TABSIZ];
|
static struct localvar *regs[TABSIZ];
|
||||||
|
|
||||||
arith
|
arith
|
||||||
NewLocal(sz, al, regtype, init)
|
NewLocal(sz, al, regtype, sc)
|
||||||
arith sz;
|
arith sz;
|
||||||
{
|
{
|
||||||
register struct localvar *tmp = FreeTmps;
|
register struct localvar *tmp = FreeTmps;
|
||||||
|
@ -66,6 +68,7 @@ NewLocal(sz, al, regtype, init)
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
if (tmp->t_align >= al &&
|
if (tmp->t_align >= al &&
|
||||||
tmp->t_size >= sz &&
|
tmp->t_size >= sz &&
|
||||||
|
tmp->t_sc == sc &&
|
||||||
tmp->t_regtype == regtype) {
|
tmp->t_regtype == regtype) {
|
||||||
if (prev) {
|
if (prev) {
|
||||||
prev->next = tmp->next;
|
prev->next = tmp->next;
|
||||||
|
@ -81,8 +84,9 @@ NewLocal(sz, al, regtype, init)
|
||||||
tmp->t_offset = LocalSpace(sz, al);
|
tmp->t_offset = LocalSpace(sz, al);
|
||||||
tmp->t_align = al;
|
tmp->t_align = al;
|
||||||
tmp->t_size = sz;
|
tmp->t_size = sz;
|
||||||
|
tmp->t_sc = sc;
|
||||||
tmp->t_regtype = regtype;
|
tmp->t_regtype = regtype;
|
||||||
tmp->t_count = init;
|
tmp->t_count = REG_DEFAULT;
|
||||||
}
|
}
|
||||||
index = (int) (tmp->t_offset >> 2) & (TABSIZ - 1);
|
index = (int) (tmp->t_offset >> 2) & (TABSIZ - 1);
|
||||||
tmp->next = regs[index];
|
tmp->next = regs[index];
|
||||||
|
@ -120,6 +124,7 @@ LocalFinish()
|
||||||
tmp = FreeTmps;
|
tmp = FreeTmps;
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
tmp1 = tmp;
|
tmp1 = tmp;
|
||||||
|
if (tmp->t_sc == REGISTER) tmp->t_count += REG_BONUS;
|
||||||
if (! options['n'] && tmp->t_regtype >= 0) {
|
if (! options['n'] && tmp->t_regtype >= 0) {
|
||||||
C_ms_reg(tmp->t_offset, tmp->t_size, tmp->t_regtype, tmp->t_count);
|
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++) {
|
for (i = 0; i < TABSIZ; i++) {
|
||||||
tmp = regs[i];
|
tmp = regs[i];
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
|
if (tmp->t_sc == REGISTER) tmp->t_count += REG_BONUS;
|
||||||
tmp1 = tmp;
|
tmp1 = tmp;
|
||||||
if (! options['n'] && tmp->t_regtype >= 0) {
|
if (! options['n'] && tmp->t_regtype >= 0) {
|
||||||
C_ms_reg(tmp->t_offset,
|
C_ms_reg(tmp->t_offset,
|
||||||
|
@ -151,7 +157,7 @@ LocalFinish()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterAccount(offset, size, regtype, init)
|
RegisterAccount(offset, size, regtype, sc)
|
||||||
arith offset, size;
|
arith offset, size;
|
||||||
{
|
{
|
||||||
register struct localvar *p;
|
register struct localvar *p;
|
||||||
|
@ -163,7 +169,8 @@ RegisterAccount(offset, size, regtype, init)
|
||||||
index = (int) (offset >> 2) & (TABSIZ - 1);
|
index = (int) (offset >> 2) & (TABSIZ - 1);
|
||||||
p->t_offset = offset;
|
p->t_offset = offset;
|
||||||
p->t_regtype = regtype;
|
p->t_regtype = regtype;
|
||||||
p->t_count = init;
|
p->t_count = REG_DEFAULT;
|
||||||
|
p->t_sc = sc;
|
||||||
p->t_size = size;
|
p->t_size = size;
|
||||||
p->next = regs[index];
|
p->next = regs[index];
|
||||||
regs[index] = p;
|
regs[index] = p;
|
||||||
|
|
|
@ -5,6 +5,7 @@ struct localvar {
|
||||||
int t_align;
|
int t_align;
|
||||||
int t_regtype;
|
int t_regtype;
|
||||||
int t_count;
|
int t_count;
|
||||||
|
int t_sc; /* storage class */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ALLOCDEF "localvar" 10 */
|
/* ALLOCDEF "localvar" 10 */
|
||||||
|
|
Loading…
Reference in a new issue