1 (* m2treelib.def definition module for m2treelib.cc.
3 Copyright (C) 2011-2022 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
22 DEFINITION MODULE FOR "C" m2treelib ;
24 FROM m2tree IMPORT Tree ;
25 FROM m2linemap IMPORT location_t ;
26 FROM SYSTEM IMPORT ADDRESS ;
33 get_set_address_if_var - returns the address of, op, providing
35 NULL is returned if, op, is a constant.
38 PROCEDURE get_set_address_if_var (location: location_t; op: Tree; is_lvalue: INTEGER; is_const: INTEGER) : Tree ;
42 get_set_field_rhs - returns the value of p->field.
45 PROCEDURE get_set_field_rhs (location: location_t; p: Tree; field: Tree) : Tree ;
49 get_set_field_lhs - returns the address of p->field.
52 PROCEDURE get_set_field_lhs (location: location_t; p: Tree; field: Tree) : Tree ;
56 get_set_address - returns the address of op1.
59 PROCEDURE get_set_address (location: location_t; op1: Tree; is_lvalue: INTEGER) : Tree ;
63 get_set_value - returns the value indicated by, field, in the set.
64 Either p->field or the constant(op.fieldNo) is returned.
67 PROCEDURE get_set_value (location: location_t; p: Tree; field: Tree; is_const: INTEGER; op: Tree; fieldNo: CARDINAL) : Tree ;
71 get_field_no - returns the field no for, op. The, op, is either
72 a constructor or a variable of type record.
73 If, op, is a constructor (a set constant in GNU Modula-2)
74 then this function is essentially a no-op and it returns op.
75 Else we iterate over the field list and return the
76 appropriate field number.
79 PROCEDURE get_field_no (type: Tree; op: Tree; is_const: INTEGER; fieldNo: CARDINAL) : Tree ;
83 get_rvalue - returns the rvalue of t. The, type, is the object type to be
84 copied upon indirection.
87 PROCEDURE get_rvalue (location: location_t; t: Tree; type: Tree; is_lvalue: INTEGER) : Tree ;
91 DoCall - build a call tree arranging the parameter list as a vector.
94 PROCEDURE DoCall (location: location_t; rettype: Tree; funcptr: Tree; param_list: Tree) : Tree ;
98 PROCEDURE build_modify_expr (location: location_t; des: Tree; modifycode: tree_code; copy: Tree) : Tree ;
102 do_jump_if_bit - tests bit in word against integer zero using operator, code.
103 If the result is true then jump to label.
106 PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: Tree; bit: Tree; label: ADDRESS) ;