1994-06-24 11:31:16 +00:00
|
|
|
/* $Id$ */
|
1987-03-09 19:15:41 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1984-11-26 15:04:22 +00:00
|
|
|
/* I N P U T R O U T I N E S */
|
|
|
|
|
1984-11-29 10:18:53 +00:00
|
|
|
extern FILE *curinp; /* current input file */
|
|
|
|
extern block_id lastbid; /* block identifying number */
|
|
|
|
extern lab_id lastlabid; /* last label identifier */
|
|
|
|
|
|
|
|
#define getbyte() getc(curinp)
|
2017-11-15 21:29:27 +00:00
|
|
|
short getshort(void); /*
|
1984-11-29 10:18:53 +00:00
|
|
|
* Read a short from curinp
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
offset getoff(void); /*
|
1984-11-29 10:18:53 +00:00
|
|
|
* Read an offset from curinp
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
line_p read_line(proc_p *p_out); /*
|
1984-11-29 10:18:53 +00:00
|
|
|
* Read a line of EM code (i.e. one
|
|
|
|
* instruction) and its arguments
|
|
|
|
* (if any). If the instruction is a
|
|
|
|
* 'pro' pseudo, set p_out.
|
|
|
|
*/
|
|
|
|
|
2017-11-15 21:29:27 +00:00
|
|
|
line_p getlines(FILE *lf, int n, proc_p *p_out, bool collect_mes);
|
|
|
|
/*
|
1984-11-29 10:18:53 +00:00
|
|
|
* Read n lines of EM text and doubly
|
|
|
|
* link them. Also process messages
|
|
|
|
* if required.
|
1984-12-03 12:12:37 +00:00
|
|
|
*/
|
1984-11-29 10:18:53 +00:00
|
|
|
|
2017-11-15 21:29:27 +00:00
|
|
|
bblock_p freshblock(void); /*
|
1984-11-26 15:04:22 +00:00
|
|
|
* Allocate a bblock struct and assign
|
|
|
|
* it a brand new block_id.
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
lab_id freshlabel(void); /*
|
1984-11-26 15:04:22 +00:00
|
|
|
* Get a brand new lab_id.
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
dblock_p getdtable(const char *dname); /*
|
1984-11-26 15:04:22 +00:00
|
|
|
* Read the data block table from
|
|
|
|
* the file with the given name.
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
proc_p getptable(const char *pname); /*
|
1984-11-26 15:04:22 +00:00
|
|
|
* Read the proc table from
|
|
|
|
* the file with the given name.
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
bool getunit(FILE *gf, FILE *lf, short *kind_out, bblock_p *g_out,
|
|
|
|
line_p *l_out, proc_p *p_out, bool collect_mes);
|
|
|
|
/*
|
1984-11-26 15:04:22 +00:00
|
|
|
* Read the control flow graph
|
|
|
|
* (from file gf) and the EM text
|
|
|
|
* (from lf). If collect_mes is TRUE,
|
|
|
|
* all register messages will be
|
|
|
|
* collected and put in the global
|
|
|
|
* variable 'mesregs'. The proc read
|
|
|
|
* is returned in p_out.
|
|
|
|
*/
|
2017-11-15 21:29:27 +00:00
|
|
|
void message(line_p lnp); /*
|
|
|
|
* See if lnp is some useful message.
|
1988-09-02 13:55:54 +00:00
|
|
|
* (e.g. a message telling that a
|
|
|
|
* certain local variable will never be
|
|
|
|
* referenced indirectly, so it may be
|
|
|
|
* put in a register.
|
|
|
|
* If so, add it to the mesregs set.)
|
|
|
|
*/
|