2019-03-01 17:39:25 +00:00
|
|
|
/* Copyright (c) 2019 ACK Project.
|
|
|
|
* See the copyright notice in the ACK home directory,
|
|
|
|
* in the file "Copyright".
|
|
|
|
*
|
|
|
|
* Created on: 2019-02-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef CODE_H_
|
|
|
|
#define CODE_H_
|
|
|
|
|
|
|
|
#include "parameters.h"
|
|
|
|
#include <em_arith.h>
|
|
|
|
#include <em_label.h>
|
|
|
|
|
|
|
|
/* Forward declarations. */
|
2019-05-10 17:09:03 +00:00
|
|
|
struct node;
|
|
|
|
struct desig;
|
|
|
|
struct type;
|
|
|
|
|
2019-03-01 17:39:25 +00:00
|
|
|
|
|
|
|
/* Generate code to push constant "cst" with size "size" bytes. */
|
|
|
|
void CodeConst(arith cst, int size);
|
|
|
|
/* Generate constant character or string. */
|
2019-05-10 17:09:03 +00:00
|
|
|
void CodeString(register struct node *nd);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate code for an expression contained in "nd". */
|
2019-05-10 17:09:03 +00:00
|
|
|
void CodeExpr(struct node *nd, struct desig *ds, label true_label, label false_label);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate implicit type conversion code. */
|
2019-05-10 17:09:03 +00:00
|
|
|
void CodeCoercion(struct type *t1, struct type *t2);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate code for a procedure call including parameter setup. Checking of parameters
|
|
|
|
and result is already done. */
|
2019-05-10 17:09:03 +00:00
|
|
|
void CodeCall(struct node *nd);
|
|
|
|
void CodePString(struct node *nd, struct type *tp);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate a range check if necessary */
|
2019-05-10 17:09:03 +00:00
|
|
|
void RangeCheck(register struct type *tpl, struct type *tpr);
|
|
|
|
void CodeOper(register struct node *expr, label true_label, label false_label);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate code to push the value of the expression "nd"
|
|
|
|
on the stack. */
|
2019-05-10 17:09:03 +00:00
|
|
|
void CodePExpr(register struct node *nd);
|
2019-03-01 17:39:25 +00:00
|
|
|
/* Generate code to store the expression on the stack into the
|
|
|
|
designator "nd".
|
|
|
|
*/
|
2019-05-10 17:09:03 +00:00
|
|
|
void CodeDStore(register struct node *nd);
|
2019-03-01 17:39:25 +00:00
|
|
|
|
|
|
|
#ifdef SQUEEZE
|
|
|
|
void c_bra(label l);
|
|
|
|
void c_loc(int n);
|
|
|
|
void c_lae_dlb(label l);
|
|
|
|
void CAL(char *name, int ssp);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CODE_H_ */
|