_PROTOTYPE(void C_ms_std, (char *, int, int));
_PROTOTYPE(int C_out, (struct e_instr *p));
+_PROTOTYPE(void error, (char *, ...));
+_PROTOTYPE(void fatal, (char *, ...));
+
#ifdef PEEPHOLE
#include "em_codeO.h"
#include "emO_code.h"
char *filename; /* Name of input file */
int errors; /* Number of errors */
-main(argc,argv)
- char **argv;
+int main(int argc, char *argv[])
{
struct e_instr buf;
- register struct e_instr *p = &buf;
+ struct e_instr *p = &buf;
if (argc >= 2) {
filename = argv[1];
}
/* VARARGS */
-error(s,a1,a2,a3,a4)
- char *s;
+static int verror(char *s, va_list ap)
{
- fprint(STDERR,
+ fprintf(stderr,
"%s, line %d: ",
filename ? filename : "standard input",
EM_lineno);
- fprint(STDERR,s,a1,a2,a3,a4);
- fprint(STDERR, "\n");
+ vfprintf(stderr, s, ap);
+ fprintf(stderr, "\n");
errors++;
+ return 0;
}
-/* VARARGS */
-fatal(s,a1,a2,a3,a4)
- char *s;
+int error(char *s, ...)
+{
+ va_list ap;
+ va_start(ap, s);
+ verror(s, ap);
+ va_end(ap);
+ return 0;
+}
+
+/*VARARGS1*/
+int fatal(char *s, ...)
{
- error(s,a1,a2,a3,a4);
+ va_list ap;
+ va_start(ap, s);
+ verror(s, ap);
+ va_end(ap);
exit(1);
+ return 0;
}
* (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 rcsid1[] = "$Id$";
-#endif
-
/* This is the main program for the stand-alone version of the
peephole optimizer.
*/
-
+#include <stdarg.h>
#include "nopt.h"
char *filename; /* Name of input file */
int errors; /* Number of errors */
-main(argc,argv)
- char **argv;
+int main(int argc, char *argv[])
{
static struct e_instr buff;
- register p_instr p = &buff;
+ p_instr p = &buff;
if (argc >= 2) {
filename = argv[1];
}
/*VARARGS1*/
-error(s,a1,a2,a3,a4)
- char *s;
+static int verror(char *s, va_list ap)
{
fprintf(stderr,
"%s, line %d: ",
filename ? filename : "standard input",
EM_lineno);
- fprintf(stderr,s,a1,a2,a3,a4);
+ vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
errors++;
+ return 0;
+}
+
+int error(char *s, ...)
+{
+ va_list ap;
+ va_start(ap, s);
+ verror(s, ap);
+ va_end(ap);
+ return 0;
}
/*VARARGS1*/
-fatal(s,a1,a2,a3,a4)
- char *s;
+int fatal(char *s, ...)
{
- error(s,a1,a2,a3,a4);
+ va_list ap;
+ va_start(ap, s);
+ verror(s, ap);
+ va_end(ap);
exit(1);
+ return 0;
}
#include "flt_misc.h"
#include <em_arith.h>
-void
-flt_arith2flt(n, e, uns)
- register arith n;
- register flt_arith *e;
+void flt_arith2flt(arith n, flt_arith *e, int uns)
{
/* Convert the arith "n" to a flt_arith "e".
*/
va_start(ap, format);
nerrors++;
diag("fatal", format, ap);
+ va_end(ap);
stop();
}
* (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 <stdio.h>
#include <stdlib.h>
#include "system.h"
+#include <em_arith.h>
+#include <em_label.h>
#include "em_pseu.h"
#include "em_mnem.h"
#include "em_spec.h"
#include "em_flag.h"
#include "em_ptyp.h"
-#include "em.h"
#include "em_comp.h"
+#include "em.h"
+#include <em_code.h>
#if __STDC__
void error(char *fmt, ...);
void fatal(char *fmt, ...);
#else
+#include "print.h"
void error();
void fatal();
#endif
void error(char *fmt, ...)
{
va_list ap;
- fprint(stderr,
+ fprintf(stderr,
"%s, line %d: ",
filename ? filename : "standard input",
EM_lineno);
if (C_busy()) C_close();
- fprint(stderr,
+ fprintf(stderr,
"%s, line %d: ",
filename ? filename : "standard input",
EM_lineno);
#include <stdlib.h>
#include <stdio.h>
+#include "object.h"
+
#ifndef MAGIC
#define MAGIC 07255
#endif /* MAGIC */
void esize(char *fname);
void rd_close();
+int rd_header();
int main(int argc, char *argv[])
{
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "line.h"
#include "lookup.h"
#include "proinf.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
+#include "util.h"
#ifdef USEMALLOC
#else /* USEMALLOC */
-void coreinit() {
+void coreinit(short *p1, short *p2) {
/*
* Empty function, no initialization needed
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
-
-extern line_p newline();
-extern offset *newrom();
-extern sym_p newsym();
-extern num_p newnum();
-extern arg_p newarg();
-extern argb_p newargb();
-extern reg_p newreg();
-
-
-
-void oldline(line_p lnp);
-void oldargb(argb_p abp);
-void oldreg(reg_p rp);
+#ifndef UTIL_OPT_ALLOC_H
+#define UTIL_OPT_ALLOC_H
#define USEMALLOC /* if defined malloc() and free() are used */
#define STACKROOM 1 /* 0 gives problems */
#endif /* USEMALLOC */
+
+/* util/opt/alloc.c */
+line_p newline(int optyp);
+void oldline(line_p lnp);
+arg_p newarg(int kind);
+void oldargs(arg_p ap);
+void oldargb(argb_p abp);
+reg_p newreg(void);
+void oldreg(reg_p rp);
+num_p newnum(void);
+void oldnum(num_p lp);
+offset *newrom(void);
+sym_p newsym(int len);
+argb_p newargb(void);
+void coreinit(short *p1, short *p2);
+short *myalloc(int size);
+
+#endif /* UTIL_OPT_ALLOC_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include "param.h"
#include "types.h"
#include "tes.h"
#include <em_mnem.h>
#include <em_mes.h>
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
+#include "reg.h"
+#include "util.h"
+#include "getline.h"
#define local(x) ((((x)->s_flags&SYMKNOWN) == 0 && \
((x)->s_flags &= ~ SYMGLOBAL)),\
--- /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 UTIL_OPT_BACKWARD_H
+#define UTIL_OPT_BACKWARD_H
+
+/* util/opt/backward.c */
+void backward(void);
+
+#endif /* UTIL_OPT_BACKWARD_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include <stdio.h>
+#include <unistd.h>
#include "param.h"
#include "types.h"
#include "assert.h"
#include <em_mes.h>
#include "lookup.h"
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-
+#include "putline.h"
+#include "util.h"
void cleanup()
{
--- /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 UTIL_OPT_CLEANUP_H
+#define UTIL_OPT_CLEANUP_H
+
+/* util/opt/cleanup.c */
+void cleanup(void);
+
+#endif /* UTIL_OPT_CLEANUP_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include "param.h"
#include "types.h"
#include "tes.h"
#include "proinf.h"
#include "optim.h"
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-
-void findreach();
-void reach(line_p lnp);
-void cleaninstrs();
+#include "flow.h"
void flow()
{
--- /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 UTIL_OPT_FLOW_H
+#define UTIL_OPT_FLOW_H
+
+/* util/opt/flow.c */
+void flow(void);
+void findreach(void);
+void reach(line_p lnp);
+void cleaninstrs(void);
+
+#endif /* UTIL_OPT_FLOW_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include <stdlib.h>
#include <stdio.h>
#include "param.h"
#include "lookup.h"
#include "alloc.h"
#include "proinf.h"
+#include "getline.h"
+#include "util.h"
+#include "process.h"
+#include "reg.h"
#include <em_spec.h>
#include <em_pseu.h>
#include <em_flag.h>
#include <em_mes.h>
#include "ext.h"
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-
-
static short tabval; /* temp store for shorts */
static offset tabval2; /* temp store for offsets */
static char string[IDL+1]; /* temp store for names */
#define readbyte getchar
-int inpseudo(short n);
-void tstinpro();
-
short readshort()
{
int l_byte, h_byte;
--- /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 UTIL_OPT_GETLINE_H
+#define UTIL_OPT_GETLINE_H
+
+/* util/opt/getline.c */
+short readshort(void);
+offset readoffset(void);
+void draininput(void);
+short getint(void);
+sym_p getsym(int status);
+offset getoff(void);
+void make_string(int n);
+void inident(void);
+int table3(int n);
+int table1(void);
+int table2(void);
+void getlines(void);
+void argstring(offset length, argb_p abp);
+line_p arglist(int n);
+offset aoff(arg_p ap, int n);
+int inpseudo(short n);
+void tstinpro(void);
+
+
+#endif /* UTIL_OPT_GETLINE_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
#include <stdlib.h>
#include <string.h>
#include "param.h"
#include "lookup.h"
#include "alloc.h"
#include "proinf.h"
+#include "util.h"
+#include "lookup.h"
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef UTIL_OPT_LOOKUP_H
+#define UTIL_OPT_LOOKUP_H
#define IDL 100
#define OCCURRING 0
#define DEFINING 1
#define NOTHING 2
+
+#endif /* UTIL_OPT_LOOKUP_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include <stdlib.h>
#include <stdio.h>
#include "param.h"
#include "types.h"
#include "tes.h"
#include "alloc.h"
+#include "util.h"
+#include "getline.h"
+#include "cleanup.h"
+#include "util.h"
+#include "putline.h"
#include <em_spec.h>
#include "ext.h"
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
+#include <missing_proto.h>
/*
* Main program for EM optimizer
%{
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int nerrors=0;
char patid[128];
+/* fileno is not C89 and can be missing sometimes. */
+int fileno(FILE *stream);
+
int CBO_instrs[] = {
op_adi,
op_adu,
printf("};\n\nshort lastind = %d;\n\nexpr_t enodes[] = {\n",prevind);
for (p=nodes;p<lastnode;p++)
- printf("/* %3ld */\t%3d,%6u,%6u,\n",
+ printf("/* %3ld */\t { %3d,%6u,%6u },\n",
(long)(p-nodes),p->ex_operator,p->ex_lnode,p->ex_rnode);
printf("};\n\niarg_t iargs[%d];\n", (maxpatlen>0 ? maxpatlen : 1));
if (patid[0])
- printf("static char rcsid[] = %s;\n",patid);
+ printf("/*rcsid: %s*/\n",patid);
}
void initio()
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef UTIL_OPT_PATTERN_H
+#define UTIL_OPT_PATTERN_H
/*
* pattern contains the optimization patterns in an apparently
extern bool nonumlab[];
extern bool onlyconst[];
extern expr_t enodes[];
+
+#endif /* UTIL_OPT_PATTERN_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
+#include <stdio.h>
#include "param.h"
#include "types.h"
#include "tes.h"
#include <em_mnem.h>
#include "optim.h"
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-
-#undef CHK_HASH /* print numbers patterns are hashed to */
-#ifdef CHK_HASH
-#include <stdio.h>
-#endif
-
-int optimize();
+#include "util.h"
+#include "peephole.h"
+#include "reg.h"
#define ILLHASH 0177777
short pathash[256]; /* table of indices into pattern[] */
--- /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 UTIL_OPT_PEEPHOLE_H
+#define UTIL_OPT_PEEPHOLE_H
+
+#include "types.h"
+#include "pattern.h"
+
+/* util/opt/peephole.c */
+void opcheck(byte *bp);
+void hashpatterns(void);
+int peephole(void);
+int optimize(void);
+offset oabs(offset off);
+line_p repline(eval_t ev, int patlen);
+offset rotate(offset w, offset amount);
+eval_t compute(expr_p pexp);
+bool tryrepl(line_p *lpp, register byte *bp, int patlen);
+bool trypat(line_p *lpp, register byte *bp, int len);
+int basicblock(line_p *alpp);
+int repl_mul(register line_p lp, line_p *b, line_p *e);
+
+#endif /* UTIL_OPT_PEEPHOLE_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include "param.h"
#include "types.h"
#include "tes.h"
#include "lookup.h"
#include "proinf.h"
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-
-void relabel();
-void symknown();
-void cleanlocals();
-void checklocs();
-void symvalue();
-void do_tes();
+#include "util.h"
+#include "backward.h"
+#include "process.h"
+#include "peephole.h"
+#include "flow.h"
+#include "putline.h"
+#include "reg.h"
void process()
{
--- /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 UTIL_OPT_PROCESS_H
+#define UTIL_OPT_PROCESS_H
+
+#include "types.h"
+
+/* util/opt/process.c */
+void process(void);
+void relabel(void);
+void symknown(void);
+void cleanlocals(void);
+void checklocs(void);
+offset align(offset count, offset alignment);
+void symvalue(void);
+void do_tes(void);
+
+#endif /* UTIL_OPT_PROCESS_H */
\ No newline at end of file
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef UTIL_OPT_PROINF_H
+#define UTIL_OPT_PROINF_H
struct num {
num_p n_next;
} proinf;
extern proinf curpro;
+
+#endif /* UTIL_OPT_PROINF_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
+#include <stdlib.h>
#include "param.h"
#include "types.h"
#include "proinf.h"
#include "optim.h"
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-void putargs(arg_p ap);
-void putstr(argb_p abp);
-void outdef(sym_p sp);
-void outocc(sym_p sp);
-void outinst(int m);
-void outoff(offset off);
-void outint(short i);
-void outshort(short i);
-void numlab(num_p np);
-void outnum(num_p np);
-void outsym(sym_p sp);
+#include "util.h"
+#include "putline.h"
#define outbyte(b) putc(b,outfile)
--- /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 UTIL_OPT_PUTLINE_H
+#define UTIL_OPT_PUTLINE_H
+
+#include "proinf.h"
+#include "types.h"
+
+/* util/opt/putline.c */
+void putlines(line_p lnp);
+void putargs(arg_p ap);
+void putstr(argb_p abp);
+void outdef(sym_p sp);
+void outocc(sym_p sp);
+void outpro(void);
+void outend(void);
+void outinst(int m);
+void outoff(offset off);
+void outint(short i);
+void outshort(short i);
+void numlab(num_p np);
+void outnum(num_p np);
+void outsym(sym_p sp);
+
+#endif /* UTIL_OPT_PUTLINE_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include "assert.h"
#include "param.h"
#include "types.h"
#include <em_pseu.h>
#include <em_mes.h>
#include "ext.h"
-
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
+#include "util.h"
+#include "putline.h"
void regvar(arg_p ap)
{
void incregusage(offset off)
{
+#ifndef GLOBAL_OPT
reg_p rp;
-#ifndef GLOBAL_OPT
/* If we're optimizing the output of the global optimizer
* we must not change the count fields of the register messages.
*/
--- /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 UTIL_OPT_REG_H
+#define UTIL_OPT_REG_H
+
+#include "types.h"
+
+/* util/opt/reg.c */
+void regvar(arg_p ap);
+int inreg(offset off);
+void outregs(void);
+void outtes(void);
+void incregusage(offset off);
+
+#endif /* UTIL_OPT_REG_H */
\ No newline at end of file
%{
-#ifndef NORCSID
-static char rcsid2[] = "$Id$";
-#endif
-
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
* Author: Hans van Staveren
*/
-extern long atol();
%}
+
+%option nounput
+%option noinput
+
%%
\"[^"]*\" { strncpy(patid,yytext,sizeof(patid)); return(STRING); }
notreg return(NOTREG);
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
/*
* This file contains the main part of the top element size computation phase.
*
* Author: Hans van Eck.
*/
-
#include <stdio.h>
#include <em_spec.h>
#include <em_mnem.h>
#include "line.h"
#include "ext.h"
#include "pop_push.h"
+#include "util.h"
extern char *pop_push[];
extern char flow_tab[];
-void assign_label(num_p label);
-void do_inst_label(line_p lnp);
-
#define NON_CONTINUABLE(i) (flow_tab[i]&JUMP)
#define ISABRANCH(i) (flow_tab[i]&HASLABEL)
#define ISCONDBRANCH(i) (flow_tab[i]&CONDBRA)
/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
* Author: Hans van Eck.
*/
/* $Id$ */
+#ifndef UTIL_OPT_TES_H
+#define UTIL_OPT_TES_H
extern int state;
#define KNOWN 1
#define NOTREACHED 2
+
+/* util/opt/tes.c */
+void init_state(void);
+void tes_pseudos(void);
+void tes_instr(line_p lnp, line_p x, line_p y);
+void assign_label(num_p label);
+void do_inst_label(line_p lnp);
+
+#endif /* UTIL_OPT_TES_H */
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Id$ */
+#ifndef UTIL_OPT_TYPES_H
+#define UTIL_OPT_TYPES_H
typedef char byte;
typedef char bool;
#else
typedef short offset;
#endif
+
+#endif /* UTIL_OPT_TYPES_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ *
+ * Author: Hans van Staveren
+ */
#include <stdlib.h>
#include <stdio.h>
+#include <stdarg.h>
#include "param.h"
#include "types.h"
#include "tes.h"
#include "optim.h"
#include "ext.h"
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Staveren
- */
-
-
/* VARARGS1 */
-void error(char *s, char *a)
+void error(char *s, ...)
{
+ va_list ap;
fprintf(stderr,"%s: error on line %u",progname,linecount);
if (prodepth != 0)
fprintf(stderr,"(%.*s)",IDL,curpro.symbol->s_name);
fprintf(stderr,": ");
- fprintf(stderr,s,a);
+ va_start(ap, s);
+ vfprintf(stderr,s, ap);
+ va_end(ap);
fprintf(stderr,"\n");
#ifndef NDEBUG
abort();
void badassertion(char *file, unsigned int line)
{
fprintf(stderr,"assertion failed file %s, line %u\n",file,line);
- error("assertion", NULL);
+ error("assertion");
}
#endif
--- /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 UTIL_OPT_UTIL_H
+#define UTIL_OPT_UTIL_H
+
+/* util/opt/util.c */
+void error(char *s, ...);
+
+#ifndef NDEBUG
+void badassertion(char *file, unsigned int line);
+#endif
+
+#ifdef DIAGOPT
+void optim(int n);
+#endif
+#endif /* UTIL_OPT_UTIL_H */
\ No newline at end of file
-#ifndef NORCSID
-static char rcsid[] = "$Id$";
-#endif
-
#include <stdio.h>
#include "param.h"
#include "types.h"