Remove more warns on ncgg
!! Maybe a bug found in ncgg cgg.y with n_coerc call atline 612
This commit is contained in:
parent
e3b4856beb
commit
08d1784f95
@ -4,6 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
#ifndef H_CGG_CG_H
|
||||||
|
#define H_CGG_CG_H
|
||||||
|
|
||||||
/* offsets of interesting fields in EM-pattern */
|
/* offsets of interesting fields in EM-pattern */
|
||||||
|
|
||||||
#define PO_HASH 0
|
#define PO_HASH 0
|
||||||
@ -165,3 +168,5 @@ typedef struct { /* one to one coercions */
|
|||||||
if ((a=((*(b)++)&BMASK)) >= 128) {\
|
if ((a=((*(b)++)&BMASK)) >= 128) {\
|
||||||
a = ((a-128)<<BSHIFT) | (*(b)++&BMASK); \
|
a = ((a-128)<<BSHIFT) | (*(b)++&BMASK); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* H_CGG_CG_H */
|
||||||
@ -3,9 +3,7 @@
|
|||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
%{
|
%{
|
||||||
#ifndef NORCSID
|
#include <stdio.h>
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "varinfo.h"
|
#include "varinfo.h"
|
||||||
@ -14,7 +12,9 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "iocc.h"
|
#include "iocc.h"
|
||||||
#include "instruct.h"
|
#include "instruct.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
#include "output.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
#include "strlookup.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include <em_reg.h>
|
#include <em_reg.h>
|
||||||
|
|
||||||
@ -610,9 +610,11 @@ coercdeflist_el
|
|||||||
inithall();
|
inithall();
|
||||||
}
|
}
|
||||||
optexpr allocates generates yields
|
optexpr allocates generates yields
|
||||||
{ tokpatro[0] = 0;
|
{
|
||||||
|
iocc_t empty; /* WARNING */
|
||||||
|
tokpatro[0] = 0;
|
||||||
checkhall();
|
checkhall();
|
||||||
n_coerc($3,$5,$6,$7,$8);
|
n_coerc($3,$5,$6,$7,$8, empty);
|
||||||
freevi($6);
|
freevi($6);
|
||||||
freevi($7);
|
freevi($7);
|
||||||
cursetno = -1;
|
cursetno = -1;
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
#include <stdio.h>
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
@ -13,7 +11,12 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "reg.h"
|
#include "reg.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "varinfo.h"
|
#include "varinfo.h"
|
||||||
|
#include "instruct.h"
|
||||||
#include "iocc.h"
|
#include "iocc.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "subr.h"
|
||||||
|
#include "hall.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include "pseudo.h"
|
#include "pseudo.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|||||||
27
util/ncgg/coerc.h
Normal file
27
util/ncgg/coerc.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_COERC_H
|
||||||
|
#define LANG_NCGG_COERC_H
|
||||||
|
|
||||||
|
#include "iocc.h"
|
||||||
|
#include "varinfo.h"
|
||||||
|
|
||||||
|
/* util/ncgg/coerc.c */
|
||||||
|
void n_move(int s1, int e1, int s2, int e2, struct varinfo *vi);
|
||||||
|
int existmove(iocc_t from, short *sp);
|
||||||
|
int existalmove(iocc_t from, int prpno);
|
||||||
|
struct varinfo *gen_move(iocc_t from, iocc_t to);
|
||||||
|
void n_test(int s, int e, struct varinfo *vi);
|
||||||
|
struct varinfo *gen_test(iocc_t from);
|
||||||
|
struct varinfo *gen_label(int arg);
|
||||||
|
struct varinfo *gen_preturn(void);
|
||||||
|
struct varinfo *gen_tlab(int n);
|
||||||
|
void n_stack(int s, int e, int p, struct varinfo *vi);
|
||||||
|
void checkstacking(short *sp);
|
||||||
|
void n_coerc(int ti, int be, struct varinfo *al, struct varinfo *ge, struct varinfo *rp, iocc_t in);
|
||||||
|
void checkunstacking(int setno);
|
||||||
|
void n_split(int ti, int be, struct varinfo *al, struct varinfo *ge, struct varinfo *rp, int n);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_COERC_H */
|
||||||
@ -12,7 +12,7 @@ g/^#/d
|
|||||||
a
|
a
|
||||||
|
|
||||||
void enterkeyw() {
|
void enterkeyw() {
|
||||||
register symbol *sy_p;
|
symbol *sy_p;
|
||||||
|
|
||||||
.
|
.
|
||||||
$a
|
$a
|
||||||
|
|||||||
10
util/ncgg/cvtkeywords.h
Normal file
10
util/ncgg/cvtkeywords.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_CVTKEYWORDS_H
|
||||||
|
#define LANG_NCGG_CVTKEYWORDS_H
|
||||||
|
|
||||||
|
void enterkeyw();
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_CVTKEYWORDS_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
|||||||
16
util/ncgg/emlookup.h
Normal file
16
util/ncgg/emlookup.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_EMLOOKUP_H
|
||||||
|
#define LANG_NCGG_EMLOOKUP_H
|
||||||
|
|
||||||
|
/* util/ncgg/emlookup.c */
|
||||||
|
void initemhash(void);
|
||||||
|
unsigned int emhash(char *name);
|
||||||
|
void enter(char *name, int value);
|
||||||
|
int mlookup(char *name);
|
||||||
|
int argtyp(int mn);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_EMLOOKUP_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __STDC__
|
#if __STDC__
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
@ -13,6 +9,9 @@ static char rcsid[]= "$Id$";
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "varinfo.h"
|
||||||
|
#include "output.h"
|
||||||
|
|
||||||
#if __STDC__
|
#if __STDC__
|
||||||
void error(char *fmt, ...);
|
void error(char *fmt, ...);
|
||||||
#else
|
#else
|
||||||
@ -98,7 +97,8 @@ void badassertion(char *string, char *file, int line)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void tabovf(char *string)
|
int tabovf(char *string)
|
||||||
{
|
{
|
||||||
fatal("%s overflow", string);
|
fatal("%s overflow", string);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
26
util/ncgg/error.h
Normal file
26
util/ncgg/error.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_ERROR_H
|
||||||
|
#define LANG_NCGG_ERROR_H
|
||||||
|
|
||||||
|
void yyerror(char *s);
|
||||||
|
void goodbye();
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
void error(char *fmt, ...);
|
||||||
|
void fatal(char *fmt, ...);
|
||||||
|
#else /* __STDC__ */
|
||||||
|
/*VARARGS1*/
|
||||||
|
fatal(s,a,b,c,d);
|
||||||
|
error(s,a,b,c,d);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
void badassertion(char *string, char *file, int line);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int tabovf(char *string);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_ERROR_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -18,6 +14,7 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "regvar.h"
|
#include "regvar.h"
|
||||||
|
#include "error.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
#ifndef UTIL_NCGG_EXPR_H
|
||||||
|
#define UTIL_NCGG_EXPR_H
|
||||||
|
|
||||||
typedef struct expr {
|
typedef struct expr {
|
||||||
int ex_typ;
|
int ex_typ;
|
||||||
short ex_regset[SZOFSET(MAXREGS)];
|
short ex_regset[SZOFSET(MAXREGS)];
|
||||||
@ -18,3 +21,26 @@ typedef struct expr {
|
|||||||
/* When the type is register the regset contains the set of
|
/* When the type is register the regset contains the set of
|
||||||
possible registers for checking purposes only.
|
possible registers for checking purposes only.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* util/ncgg/expr.c */
|
||||||
|
int i_expr(expr_t e);
|
||||||
|
int b_expr(expr_t e);
|
||||||
|
expr_t make_expr(int type, int operator, int op1, int op2);
|
||||||
|
expr_t regno_expr(int regno);
|
||||||
|
expr_t ident_expr(char *name);
|
||||||
|
expr_t subreg_expr(int tokarg, int subreg);
|
||||||
|
void subregset(short *sp, int subreg, short *regset);
|
||||||
|
int membset(int setno, char *name, short *regset, char *appearance, int restyp, int *typp);
|
||||||
|
expr_t memb_expr(int setno, char *name, char *appearance, int tokarg);
|
||||||
|
expr_t tokm_expr(int tokarg, char *name);
|
||||||
|
expr_t perc_ident_expr(char *name);
|
||||||
|
expr_t all_expr(int all_no, int subreg);
|
||||||
|
int eq2expr(expr_t e1, expr_t e2);
|
||||||
|
int ne2expr(expr_t e1, expr_t e2);
|
||||||
|
expr_t sum_expr(expr_t e1, expr_t e2);
|
||||||
|
expr_t iextoaddr(expr_t e);
|
||||||
|
expr_t regvar_expr(expr_t e, int regtyp);
|
||||||
|
void initnodes(void);
|
||||||
|
int ex_lookup(int operator, int lnode, int rnode);
|
||||||
|
|
||||||
|
#endif /* UTIL_NCGG_EXPR_H */
|
||||||
@ -2,17 +2,13 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
|
#include "hall.h"
|
||||||
|
#include "error.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void unite(short *sp, short *into);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file implements the marriage thesis from Hall.
|
* This file implements the marriage thesis from Hall.
|
||||||
* The thesis says that given a number, say N, of subsets from
|
* The thesis says that given a number, say N, of subsets from
|
||||||
|
|||||||
18
util/ncgg/hall.h
Normal file
18
util/ncgg/hall.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_HALL_H
|
||||||
|
#define LANG_NCGG_HALL_H
|
||||||
|
|
||||||
|
/* util/ncgg/hall.c */
|
||||||
|
void hallverbose(void);
|
||||||
|
void inithall(void);
|
||||||
|
void nexthall(short *sp);
|
||||||
|
int card(short *sp);
|
||||||
|
void checkhall(void);
|
||||||
|
int hall(void);
|
||||||
|
int recurhall(int nhallsets, short hallsets[][(((40 +100)+15)/16)]);
|
||||||
|
void unite(short *sp, short *into);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_HALL_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
@ -15,6 +11,9 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
#include "iocc.h"
|
#include "iocc.h"
|
||||||
|
#include "set.h"
|
||||||
|
#include "subr.h"
|
||||||
|
#include "error.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
@ -25,8 +24,6 @@ extern inproc;
|
|||||||
extern set_t l_sets[];
|
extern set_t l_sets[];
|
||||||
extern inst_t l_instances[];
|
extern inst_t l_instances[];
|
||||||
|
|
||||||
extern expr_t subreg_expr(),regno_expr();
|
|
||||||
|
|
||||||
struct varinfo *setcoco(int n)
|
struct varinfo *setcoco(int n)
|
||||||
{
|
{
|
||||||
struct varinfo *vi;
|
struct varinfo *vi;
|
||||||
|
|||||||
@ -4,6 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
#ifndef LANG_NCGG_INSTRUCT_H
|
||||||
|
#define LANG_NCGG_INSTRUCT_H
|
||||||
|
|
||||||
#ifndef _COST_
|
#ifndef _COST_
|
||||||
#include "cost.h"
|
#include "cost.h"
|
||||||
#endif
|
#endif
|
||||||
@ -39,3 +42,5 @@ extern instr_t l_instr[];
|
|||||||
* if it contains the same information and is allowed as an operand
|
* if it contains the same information and is allowed as an operand
|
||||||
* in this place. Too difficult for now.
|
* in this place. Too difficult for now.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_INSTRUCT_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -17,6 +13,8 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "iocc.h"
|
#include "iocc.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "subr.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include "regvar.h"
|
#include "regvar.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|||||||
@ -3,8 +3,21 @@
|
|||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
#ifndef LANG_NCGG_IOCC_H
|
||||||
|
#define LANG_NCGG_IOCC_H
|
||||||
|
|
||||||
typedef struct iocc {
|
typedef struct iocc {
|
||||||
short in_set[SETSIZE];
|
short in_set[SETSIZE];
|
||||||
int in_index;
|
int in_index;
|
||||||
} iocc_t,*iocc_p;
|
} iocc_t,*iocc_p;
|
||||||
|
|
||||||
|
/* util/ncgg/iocc.c */
|
||||||
|
iocc_t subr_iocc(int tokarg, int subreg);
|
||||||
|
iocc_t tokm_iocc(int tokarg, char *ident);
|
||||||
|
iocc_t percident_iocc(char *ident);
|
||||||
|
iocc_t ident_iocc(char *ident);
|
||||||
|
iocc_t all_iocc(int all_no, int subreg);
|
||||||
|
iocc_t descr_iocc(char *ident);
|
||||||
|
int instalookup(inst_t insta, int filled);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_IOCC_H */
|
||||||
@ -2,18 +2,14 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "lookup.h"
|
#include "lookup.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "lookup.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
unsigned int hashvalue(char *s);
|
|
||||||
|
|
||||||
symbol dumsym; /* dummy to return in case of error */
|
symbol dumsym; /* dummy to return in case of error */
|
||||||
|
|
||||||
symbol *lookup(char *name, symtype type, lookupstyle style)
|
symbol *lookup(char *name, symtype type, lookupstyle style)
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
#ifndef LANG_NCGG_LOOKUP_H
|
||||||
|
#define LANG_NCGG_LOOKUP_H
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
justlooking,mustexist,newsymbol,makeexist
|
justlooking,mustexist,newsymbol,makeexist
|
||||||
@ -30,4 +32,9 @@ typedef struct symbol {
|
|||||||
|
|
||||||
#define NSYMHASH 61
|
#define NSYMHASH 61
|
||||||
extern symbol *symhash[NSYMHASH]; /* chained hashtable */
|
extern symbol *symhash[NSYMHASH]; /* chained hashtable */
|
||||||
extern symbol *lookup();
|
|
||||||
|
/* util/ncgg/lookup.c */
|
||||||
|
symbol *lookup(char *name, symtype type, lookupstyle style);
|
||||||
|
unsigned int hashvalue(char *s);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_LOOKUP_H */
|
||||||
@ -2,18 +2,28 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "param.h"
|
||||||
|
#include "varinfo.h"
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
#include "emlookup.h"
|
||||||
|
#include "cvtkeywords.h"
|
||||||
|
#include "expr.h"
|
||||||
|
#include "output.h"
|
||||||
|
#include "hall.h"
|
||||||
|
#include <missing_proto.h>
|
||||||
|
|
||||||
|
/* From YACC lexer */
|
||||||
|
void yyparse(void);
|
||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
char *beg_sbrk;
|
char *beg_sbrk;
|
||||||
extern char *sbrk();
|
|
||||||
|
|
||||||
main(argc,argv) char **argv; {
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
extern int nerrors;
|
extern int nerrors;
|
||||||
extern int code_in_c;
|
extern int code_in_c;
|
||||||
extern int tabledebug;
|
extern int tabledebug;
|
||||||
|
|||||||
@ -16,12 +16,13 @@ char *c_file= "tables.c";
|
|||||||
char *h_file= "tables.H";
|
char *h_file= "tables.H";
|
||||||
char *cd_file= "code";
|
char *cd_file= "code";
|
||||||
|
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "varinfo.h"
|
#include "varinfo.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
@ -31,11 +32,17 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "instruct.h"
|
#include "instruct.h"
|
||||||
#include "lookup.h"
|
#include "lookup.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "strlookup.h"
|
||||||
|
#include "subr.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include "pseudo.h"
|
#include "pseudo.h"
|
||||||
#include "regvar.h"
|
#include "regvar.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
|
/* Since isascii is not standard, as c89 or C99, privide another method */
|
||||||
|
#define IsAscii(_c) (((_c) & ~0x7f) == 0)
|
||||||
|
|
||||||
#define BMASK 0xFF
|
#define BMASK 0xFF
|
||||||
#define BSHIFT 8
|
#define BSHIFT 8
|
||||||
|
|
||||||
@ -387,7 +394,7 @@ void outfmt(char *p)
|
|||||||
register int c;
|
register int c;
|
||||||
fprintf(ctable,"\"");
|
fprintf(ctable,"\"");
|
||||||
while ((c= (*p++&0377))!=0) {
|
while ((c= (*p++&0377))!=0) {
|
||||||
if (! isascii(c) || iscntrl(c)) {
|
if (! IsAscii(c) || iscntrl(c)) {
|
||||||
fprintf(ctable,"\\%c%c%c",
|
fprintf(ctable,"\\%c%c%c",
|
||||||
((c&~0300)>>6) + '0', ((c&070)>>3)+'0',
|
((c&~0300)>>6) + '0', ((c&070)>>3)+'0',
|
||||||
(c&07)+'0');
|
(c&07)+'0');
|
||||||
@ -433,8 +440,10 @@ void outenodes()
|
|||||||
void outstrings()
|
void outstrings()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
#if 0
|
||||||
char *p;
|
char *p;
|
||||||
int c;
|
int c;
|
||||||
|
#endif
|
||||||
extern char * filename;
|
extern char * filename;
|
||||||
|
|
||||||
if (tabledebug)
|
if (tabledebug)
|
||||||
@ -445,7 +454,7 @@ void outstrings()
|
|||||||
outfmt(l_strings[i]);
|
outfmt(l_strings[i]);
|
||||||
#if 0
|
#if 0
|
||||||
while ((c= (*p++&0377))!=0) {
|
while ((c= (*p++&0377))!=0) {
|
||||||
if (! isascii(c) || iscntrl(c)) {
|
if (! IsAscii(c) || iscntrl(c)) {
|
||||||
fprintf(ctable,"\\%c%c%c",
|
fprintf(ctable,"\\%c%c%c",
|
||||||
((c&~0300)>>6) + '0', ((c&070)>>3)+'0',
|
((c&~0300)>>6) + '0', ((c&070)>>3)+'0',
|
||||||
(c&07)+'0');
|
(c&07)+'0');
|
||||||
@ -658,7 +667,7 @@ void outars()
|
|||||||
|
|
||||||
void finishio()
|
void finishio()
|
||||||
{
|
{
|
||||||
int nregs;
|
int nregs = 0;
|
||||||
|
|
||||||
finishcode();
|
finishcode();
|
||||||
hashpatterns();
|
hashpatterns();
|
||||||
|
|||||||
49
util/ncgg/output.h
Normal file
49
util/ncgg/output.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_OUTPUT_H
|
||||||
|
#define LANG_NCGG_OUTPUT_H
|
||||||
|
|
||||||
|
/* util/ncgg/output.c */
|
||||||
|
void opnfile(FILE **f, char *s);
|
||||||
|
void unlfile(FILE *f, char *s);
|
||||||
|
void initio(void);
|
||||||
|
void finishcode(void);
|
||||||
|
void errorexit(void);
|
||||||
|
void code8(int x);
|
||||||
|
void code53(int x, int y);
|
||||||
|
void codeint(int x);
|
||||||
|
void outpatterns(void);
|
||||||
|
void pat(int n);
|
||||||
|
void patshort(int n);
|
||||||
|
void patbyte(int n);
|
||||||
|
void hashpatterns(void);
|
||||||
|
void outincludes(void);
|
||||||
|
void outregs(void);
|
||||||
|
void outregvars(void);
|
||||||
|
int typeconv(int n);
|
||||||
|
void outfmt(char *p);
|
||||||
|
void outtokens(void);
|
||||||
|
void outenodes(void);
|
||||||
|
void outstrings(void);
|
||||||
|
void outsets(void);
|
||||||
|
void outinstances(void);
|
||||||
|
void outmoves(void);
|
||||||
|
void outtests(void);
|
||||||
|
void outstacks(void);
|
||||||
|
void outsplits(void);
|
||||||
|
void outcoercs(void);
|
||||||
|
void outproplists(void);
|
||||||
|
void outconsts(void);
|
||||||
|
void cdef(char *s, int n);
|
||||||
|
void passon(char *s);
|
||||||
|
void outdefs(void);
|
||||||
|
void outars(void);
|
||||||
|
void finishio(void);
|
||||||
|
void codecoco(int cocono);
|
||||||
|
void dopattern(int stackcoerc, varinfo *kills, varinfo *allocates, varinfo *generates, varinfo *yields, varinfo *leaving);
|
||||||
|
void used(char *resource, int use, int max);
|
||||||
|
void statistics(void);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_OUTPUT_H */
|
||||||
@ -3,12 +3,17 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
#include "emlookup.h"
|
||||||
static char rcsid2[]= "$Id$";
|
#include "subr.h"
|
||||||
#endif
|
#include "error.h"
|
||||||
|
#include "hall.h"
|
||||||
|
#include "coerc.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* fileno is not C89 and can be missing sometimes. */
|
||||||
|
int fileno(FILE *stream);
|
||||||
|
|
||||||
int lineno=1;
|
int lineno=1;
|
||||||
extern char *filename;
|
extern char *filename;
|
||||||
#undef yywrap
|
#undef yywrap
|
||||||
|
|||||||
@ -2,17 +2,14 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "lookup.h"
|
#include "lookup.h"
|
||||||
#include "reg.h"
|
#include "reg.h"
|
||||||
#include <cgg_cg.h>
|
#include "error.h"
|
||||||
|
#include "subr.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
extern set_t l_sets[];
|
extern set_t l_sets[];
|
||||||
|
|||||||
@ -3,7 +3,21 @@
|
|||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
#ifndef LANG_NCGG_SET_H
|
||||||
|
#define LANG_NCGG_SET_H
|
||||||
|
|
||||||
|
#include <cgg_cg.h>
|
||||||
|
|
||||||
#define BIS(sp,n) (sp)[(n)>>4] |= 1<<((n)&0xF)
|
#define BIS(sp,n) (sp)[(n)>>4] |= 1<<((n)&0xF)
|
||||||
#define BIC(sp,n) (sp)[(n)>>4] &= ~(1<<((n)&0xF))
|
#define BIC(sp,n) (sp)[(n)>>4] &= ~(1<<((n)&0xF))
|
||||||
#define BIT(sp,n) (((sp)[(n)>>4]&(1<<((n)&0xF)))!=0)
|
#define BIT(sp,n) (((sp)[(n)>>4]&(1<<((n)&0xF)))!=0)
|
||||||
|
|
||||||
|
/* util/ncgg/set.c */
|
||||||
|
int setlookup(set_t s);
|
||||||
|
void make_std_sets(void);
|
||||||
|
set_t ident_to_set(char *name);
|
||||||
|
set_t setproduct(set_t s1, set_t s2);
|
||||||
|
set_t setsum(set_t s1, set_t s2);
|
||||||
|
set_t setdiff(set_t s1, set_t s2);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_SET_H */
|
||||||
|
|||||||
@ -2,12 +2,9 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
#include "error.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
int nstrings=0;
|
int nstrings=0;
|
||||||
|
|||||||
11
util/ncgg/strlookup.h
Normal file
11
util/ncgg/strlookup.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
|
*/
|
||||||
|
#ifndef LANG_NCGG_STRLOOKUP_H
|
||||||
|
#define LANG_NCGG_STRLOOKUP_H
|
||||||
|
|
||||||
|
/* util/ncgg/strlookup.c */
|
||||||
|
int strlookup(char *str);
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_STRLOOKUP_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
@ -18,10 +14,12 @@ static char rcsid[]= "$Id$";
|
|||||||
#include "instruct.h"
|
#include "instruct.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "regvar.h"
|
#include "regvar.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "subr.h"
|
||||||
#include <cgg_cg.h>
|
#include <cgg_cg.h>
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
#include "strlookup.h"
|
||||||
expr_t ident_expr(char *name);
|
#include "hall.h"
|
||||||
|
|
||||||
void n_proc(char *name)
|
void n_proc(char *name)
|
||||||
{
|
{
|
||||||
|
|||||||
31
util/ncgg/subr.h
Normal file
31
util/ncgg/subr.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef UTIL_NCGG_SUBR_H
|
||||||
|
#define UTIL_NCGG_SUBR_H
|
||||||
|
|
||||||
|
#include "varinfo.h"
|
||||||
|
#include "instruct.h"
|
||||||
|
|
||||||
|
/* util/ncgg/subr.c */
|
||||||
|
void n_proc(char *name);
|
||||||
|
struct varinfo *make_erase(char *name);
|
||||||
|
void n_instr(char *name, char *asname, operand *oplist, struct varinfo *eraselist, struct varinfo *cost);
|
||||||
|
void n_set(char *name, int number);
|
||||||
|
void n_tok(char *name, struct varinfo *atts, int size, struct varinfo *cost, struct varinfo *format);
|
||||||
|
void checkprintformat(int n);
|
||||||
|
void n_prop(char *name, int size);
|
||||||
|
void prophall(int n);
|
||||||
|
int n_reg(char *name, char *printstring, int nmemb, int member1, int member2);
|
||||||
|
void make_const(void);
|
||||||
|
int cmustbeset(char *ident);
|
||||||
|
void n_const(char *ident, int val);
|
||||||
|
void n_sconst(char *ident, char *val);
|
||||||
|
void regline(varinfo *rl, varinfo *pl, int rv);
|
||||||
|
void setallreg(struct varinfo *vi);
|
||||||
|
void freevi(struct varinfo *vip);
|
||||||
|
int myatoi(char *s);
|
||||||
|
char *mystrcpy(char *s);
|
||||||
|
char *myalloc(int n);
|
||||||
|
int chkincl(int value, int lwb, int upb);
|
||||||
|
int subset(short *sp1, short *sp2, int setsize);
|
||||||
|
int vilength(struct varinfo *vip);
|
||||||
|
|
||||||
|
#endif /* UTIL_NCGG_SUBR_H */
|
||||||
@ -2,10 +2,6 @@
|
|||||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
#ifndef NORCSID
|
|
||||||
static char rcsid[]= "$Id$";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
#include "reg.h"
|
#include "reg.h"
|
||||||
#include "property.h"
|
#include "property.h"
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||||
*/
|
*/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
#ifndef LANG_NCGG_VARINFO_H
|
||||||
|
#define LANG_NCGG_VARINFO_H
|
||||||
|
|
||||||
#define VI_NSTR 1
|
#define VI_NSTR 1
|
||||||
#define VI_NINT 3
|
#define VI_NINT 3
|
||||||
@ -15,3 +17,5 @@ typedef struct varinfo {
|
|||||||
} varinfo;
|
} varinfo;
|
||||||
|
|
||||||
#define VI_NULL (struct varinfo *) 0
|
#define VI_NULL (struct varinfo *) 0
|
||||||
|
|
||||||
|
#endif /* LANG_NCGG_VARINFO_H */
|
||||||
Loading…
x
Reference in New Issue
Block a user