1987-04-29 10:22:07 +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".
|
|
|
|
*
|
|
|
|
* Author: Ceriel J.H. Jacobs
|
|
|
|
*/
|
1986-06-20 14:36:49 +00:00
|
|
|
/* P A R S E T R E E W A L K E R */
|
2019-03-01 17:39:25 +00:00
|
|
|
#ifndef WALK_H_
|
|
|
|
#define WALK_H_
|
|
|
|
|
|
|
|
#include "em_label.h"
|
1986-06-20 14:36:49 +00:00
|
|
|
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Forward type declarations. */
|
2019-05-10 17:09:03 +00:00
|
|
|
struct node;
|
|
|
|
struct def;
|
|
|
|
struct desig;
|
1987-04-29 10:22:07 +00:00
|
|
|
|
1986-06-20 14:36:49 +00:00
|
|
|
/* Definition of WalkNode macro
|
|
|
|
*/
|
2019-05-10 17:09:03 +00:00
|
|
|
extern int (*WalkTable[])(struct node*, label, int);
|
1986-06-20 14:36:49 +00:00
|
|
|
|
2019-03-01 17:39:25 +00:00
|
|
|
#define WalkNode(xnd, xlab, rch) (*WalkTable[(unsigned int)((xnd)->nd_class)])((xnd), (xlab),(rch))
|
1986-06-20 14:36:49 +00:00
|
|
|
|
|
|
|
extern label text_label;
|
|
|
|
extern label data_label;
|
1987-09-23 16:39:43 +00:00
|
|
|
|
|
|
|
#ifndef SQUEEZE
|
|
|
|
#define c_loc(x) C_loc((arith) (x))
|
|
|
|
#define c_lae_dlb(x) C_lae_dlb(x,(arith) 0)
|
1988-06-13 10:29:36 +00:00
|
|
|
#define CAL(nm, sz) (C_cal(nm), C_asp((arith)(sz)))
|
1993-11-19 09:53:47 +00:00
|
|
|
#define c_bra(x) C_bra((label) (x))
|
1987-09-23 16:39:43 +00:00
|
|
|
#endif
|
2019-03-01 17:39:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
int LblWalkNode(label lbl, struct node *nd, int exit, int reach);
|
2019-03-01 17:39:25 +00:00
|
|
|
void def_ilb(label l);
|
|
|
|
/* Generate line information as necessary for "nd". */
|
2019-05-10 17:09:03 +00:00
|
|
|
void DoLineno(register struct node* nd);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate filename information, when needed.
|
|
|
|
This routine is called at the generation of a
|
|
|
|
procedure entry, and after generating a call to
|
|
|
|
another procedure. The current active filename
|
|
|
|
is used.
|
|
|
|
*/
|
|
|
|
void DoFilename(int needed);
|
|
|
|
|
|
|
|
/* Walk through a module, and all its local definitions.
|
|
|
|
Also generate code for its body.
|
|
|
|
This code is collected in an initialization routine.
|
|
|
|
*/
|
2019-05-10 17:09:03 +00:00
|
|
|
void WalkModule(register struct def* module);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Walk through the definition of a procedure and all its
|
|
|
|
local definitions, checking and generating code.
|
|
|
|
*/
|
2019-05-10 17:09:03 +00:00
|
|
|
void WalkProcedure(register struct def* procedure);
|
2019-03-01 17:39:25 +00:00
|
|
|
|
|
|
|
/* Walk node "nd", which is a link.
|
|
|
|
"exit_label" is set to a label number when inside a LOOP.
|
|
|
|
"end_reached" maintains info about reachability (REACH_FLAG),
|
|
|
|
and whether an EXIT statement was seen (EXIT_FLAG).
|
|
|
|
*/
|
2019-05-10 17:09:03 +00:00
|
|
|
int WalkLink(register struct node* nd, label exit_label, int end_reached);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Walk through a statement node "nd", generating code for it. */
|
2019-05-10 17:09:03 +00:00
|
|
|
int WalkStat(register struct node* nd, label exit_label, int end_reached);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate code to evaluate a boolean expression "pnd" */
|
2019-05-10 17:09:03 +00:00
|
|
|
void ExpectBool(register struct node** pnd, label true_label, label false_label);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Check designator and generate code for it */
|
2019-05-10 17:09:03 +00:00
|
|
|
int WalkDesignator(struct node** pnd, struct desig* ds, int flags);
|
2019-03-01 17:39:25 +00:00
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
void DoAssign(register struct node* nd);
|
2019-03-01 17:39:25 +00:00
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
int DoForInit(struct node* nd);
|
2019-03-01 17:39:25 +00:00
|
|
|
|
|
|
|
#endif /* WALK_H_ */
|