1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
(* m2treelib.def definition module for m2treelib.cc.
Copyright (C) 2011-2025 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Modula-2 is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE FOR "C" m2treelib ;
FROM gcctypes IMPORT location_t, tree ;
FROM SYSTEM IMPORT ADDRESS ;
TYPE
tree_code = INTEGER ;
(*
get_set_address_if_var - returns the address of, op, providing
it is not a constant.
NULL is returned if, op, is a constant.
*)
PROCEDURE get_set_address_if_var (location: location_t; op: tree; is_lvalue, is_const: BOOLEAN) : tree ;
(*
get_set_field_rhs - returns the value of p->field.
*)
PROCEDURE get_set_field_rhs (location: location_t; p: tree; field: tree) : tree ;
(*
get_set_field_lhs - returns the address of p->field.
*)
PROCEDURE get_set_field_lhs (location: location_t; p: tree; field: tree) : tree ;
(*
get_set_address - returns the address of op1.
*)
PROCEDURE get_set_address (location: location_t; op1: tree; is_lvalue: BOOLEAN) : tree ;
(*
get_set_value - returns the value indicated by, field, in the set.
Either p->field or the constant(op.fieldNo) is returned.
*)
PROCEDURE get_set_value (location: location_t; p: tree; field: tree; is_const: BOOLEAN; op: tree; fieldNo: CARDINAL) : tree ;
(*
get_field_no - returns the field no for, op. The, op, is either
a constructor or a variable of type record.
If, op, is a constructor (a set constant in GNU Modula-2)
then this function is essentially a no-op and it returns op.
Else we iterate over the field list and return the
appropriate field number.
*)
PROCEDURE get_field_no (type: tree; op: tree; is_const: BOOLEAN; fieldNo: CARDINAL) : tree ;
(*
get_rvalue - returns the rvalue of t. The, type, is the object type to be
copied upon indirection.
*)
PROCEDURE get_rvalue (location: location_t; t: tree; type: tree; is_lvalue: BOOLEAN) : tree ;
(*
DoCall - build a call tree arranging the parameter list as a vector.
*)
PROCEDURE DoCall (location: location_t; rettype: tree; funcptr: tree; param_list: tree) : tree ;
PROCEDURE build_modify_expr (location: location_t; des: tree; modifycode: tree_code; copy: tree) : tree ;
(*
do_jump_if_bit - tests bit in word against integer zero using operator, code.
If the result is true then jump to label.
*)
PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: tree; bit: tree; label: ADDRESS) ;
END m2treelib.
|