*/
/* $Id$ */
+#ifndef H_CGG_CG_H
+#define H_CGG_CG_H
+
/* offsets of interesting fields in EM-pattern */
#define PO_HASH 0
if ((a=((*(b)++)&BMASK)) >= 128) {\
a = ((a-128)<<BSHIFT) | (*(b)++&BMASK); \
}
+
+#endif /* H_CGG_CG_H */
\ No newline at end of file
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
%{
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
+#include <stdio.h>
#include "param.h"
#include "varinfo.h"
#include "iocc.h"
#include "instruct.h"
#include "expr.h"
+#include "output.h"
#include "extern.h"
+#include "strlookup.h"
#include <cgg_cg.h>
#include <em_reg.h>
inithall();
}
optexpr allocates generates yields
- { tokpatro[0] = 0;
+ {
+ iocc_t empty; /* WARNING */
+ tokpatro[0] = 0;
checkhall();
- n_coerc($3,$5,$6,$7,$8);
+ n_coerc($3,$5,$6,$7,$8, empty);
freevi($6);
freevi($7);
cursetno = -1;
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
+#include <stdio.h>
#include "assert.h"
#include "param.h"
#include "reg.h"
#include "token.h"
#include "varinfo.h"
+#include "instruct.h"
#include "iocc.h"
+#include "error.h"
+#include "output.h"
+#include "subr.h"
+#include "hall.h"
#include <cgg_cg.h>
#include "pseudo.h"
#include "extern.h"
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
a
void enterkeyw() {
- register symbol *sy_p;
+ symbol *sy_p;
.
$a
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <stdlib.h>
#include <string.h>
#include "param.h"
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#if __STDC__
#include <stdarg.h>
#endif
#include <stdlib.h>
#include <stdio.h>
+#include "varinfo.h"
+#include "output.h"
+
#if __STDC__
void error(char *fmt, ...);
#else
}
#endif
-void tabovf(char *string)
+int tabovf(char *string)
{
fatal("%s overflow", string);
+ return 0;
}
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "property.h"
#include "expr.h"
#include "regvar.h"
+#include "error.h"
#include <cgg_cg.h>
#include "extern.h"
*/
/* $Id$ */
+#ifndef UTIL_NCGG_EXPR_H
+#define UTIL_NCGG_EXPR_H
+
typedef struct expr {
int ex_typ;
short ex_regset[SZOFSET(MAXREGS)];
/* When the type is register the regset contains the set of
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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include "assert.h"
#include "param.h"
#include "set.h"
+#include "hall.h"
+#include "error.h"
#include <stdio.h>
-void unite(short *sp, short *into);
-
/*
* This file implements the marriage thesis from Hall.
* The thesis says that given a number, say N, of subsets from
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <string.h>
#include "param.h"
#include "set.h"
#include "expr.h"
#include "iocc.h"
+#include "set.h"
+#include "subr.h"
+#include "error.h"
#include <cgg_cg.h>
#include "extern.h"
extern set_t l_sets[];
extern inst_t l_instances[];
-extern expr_t subreg_expr(),regno_expr();
-
struct varinfo *setcoco(int n)
{
struct varinfo *vi;
*/
/* $Id$ */
+#ifndef LANG_NCGG_INSTRUCT_H
+#define LANG_NCGG_INSTRUCT_H
+
#ifndef _COST_
#include "cost.h"
#endif
* if it contains the same information and is allowed as an operand
* in this place. Too difficult for now.
*/
+
+#endif /* LANG_NCGG_INSTRUCT_H */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "token.h"
#include "property.h"
#include "iocc.h"
+#include "error.h"
+#include "subr.h"
#include <cgg_cg.h>
#include "regvar.h"
#include "extern.h"
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef LANG_NCGG_IOCC_H
+#define LANG_NCGG_IOCC_H
typedef struct iocc {
short in_set[SETSIZE];
int in_index;
} 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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <string.h>
#include "assert.h"
#include "param.h"
#include "lookup.h"
+#include "error.h"
+#include "lookup.h"
#include "extern.h"
-unsigned int hashvalue(char *s);
-
symbol dumsym; /* dummy to return in case of error */
symbol *lookup(char *name, symtype type, lookupstyle style)
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef LANG_NCGG_LOOKUP_H
+#define LANG_NCGG_LOOKUP_H
typedef enum {
justlooking,mustexist,newsymbol,makeexist
#define NSYMHASH 61
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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <stdlib.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 *beg_sbrk;
-extern char *sbrk();
-main(argc,argv) char **argv; {
+int main(int argc, char *argv[])
+{
extern int nerrors;
extern int code_in_c;
extern int tabledebug;
char *h_file= "tables.H";
char *cd_file= "code";
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <stdio.h>
#include <ctype.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include "assert.h"
#include "varinfo.h"
#include "param.h"
#include "set.h"
#include "instruct.h"
#include "lookup.h"
+#include "error.h"
+#include "strlookup.h"
+#include "subr.h"
#include <cgg_cg.h>
#include "pseudo.h"
#include "regvar.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 BSHIFT 8
register int c;
fprintf(ctable,"\"");
while ((c= (*p++&0377))!=0) {
- if (! isascii(c) || iscntrl(c)) {
+ if (! IsAscii(c) || iscntrl(c)) {
fprintf(ctable,"\\%c%c%c",
((c&~0300)>>6) + '0', ((c&070)>>3)+'0',
(c&07)+'0');
void outstrings()
{
int i;
+#if 0
char *p;
int c;
+#endif
extern char * filename;
if (tabledebug)
outfmt(l_strings[i]);
#if 0
while ((c= (*p++&0377))!=0) {
- if (! isascii(c) || iscntrl(c)) {
+ if (! IsAscii(c) || iscntrl(c)) {
fprintf(ctable,"\\%c%c%c",
((c&~0300)>>6) + '0', ((c&070)>>3)+'0',
(c&07)+'0');
void finishio()
{
- int nregs;
+ int nregs = 0;
finishcode();
hashpatterns();
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid2[]= "$Id$";
-#endif
-
+#include "emlookup.h"
+#include "subr.h"
+#include "error.h"
+#include "hall.h"
+#include "coerc.h"
#include "extern.h"
+
+/* fileno is not C89 and can be missing sometimes. */
+int fileno(FILE *stream);
+
int lineno=1;
extern char *filename;
#undef yywrap
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include "param.h"
#include "property.h"
#include "set.h"
#include "token.h"
#include "lookup.h"
#include "reg.h"
-#include <cgg_cg.h>
+#include "error.h"
+#include "subr.h"
#include "extern.h"
extern set_t l_sets[];
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $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 BIC(sp,n) (sp)[(n)>>4] &= ~(1<<((n)&0xF))
#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 */
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <string.h>
#include "param.h"
+#include "error.h"
#include "extern.h"
int nstrings=0;
--- /dev/null
+/*
+ * (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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include <stdlib.h>
#include <string.h>
#include "param.h"
#include "instruct.h"
#include "token.h"
#include "regvar.h"
+#include "error.h"
+#include "subr.h"
#include <cgg_cg.h>
#include "extern.h"
-
-expr_t ident_expr(char *name);
+#include "strlookup.h"
+#include "hall.h"
void n_proc(char *name)
{
--- /dev/null
+#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 */
\ No newline at end of file
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORCSID
-static char rcsid[]= "$Id$";
-#endif
-
#include "param.h"
#include "reg.h"
#include "property.h"
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef LANG_NCGG_VARINFO_H
+#define LANG_NCGG_VARINFO_H
#define VI_NSTR 1
#define VI_NINT 3
} varinfo;
#define VI_NULL (struct varinfo *) 0
+
+#endif /* LANG_NCGG_VARINFO_H */
\ No newline at end of file