ack/mach/proto/ncg/regvar.h
George Koehler aa876ff4c2 Fix reglap for procedures that use both sizes of reg_float.
After the RA phase of ego, a procedure may put single-word and
double-word values in the same reg_float.  Then ncg will use both
LOCAL and DLOCAL tokens at the same offset.

I add isregvar_size() to ncg.  It receives the size of the LOCAL or
DLOCAL token, and picks the register of the correct size.  This fixes
a problem where ncg got the wrong-size register and corrupted the
stack.  This problem caused one of my test programs to segfault from
stack underflow.

Also adjust how fixregvars() handles both sizes.
2017-10-15 13:15:03 -04:00

36 lines
726 B
C

/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
struct regvar {
struct regvar *rv_next;
long rv_off;
int rv_size;
int rv_type;
int rv_score;
int rv_reg;
};
struct regassigned {
struct regvar *ra_rv;
int ra_score;
};
extern struct regvar *rvlist;
extern int nregvar[];
extern struct regassigned *regassigned[];
struct regvar *linkreg(long, int, int, int);
void tryreg(struct regvar *, int);
void fixregvars(int);
int isregvar(long);
#ifdef REGLAP
int isregvar_size(long, int);
#else
#define isregvar_size(off, size) isregvar(off)
#endif
int isregtyp(long);
void unlinkregs(void);