]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | (* m2treelib.def definition module for m2treelib.cc. |
2 | ||
a945c346 | 3 | Copyright (C) 2011-2024 Free Software Foundation, Inc. |
1eee94d3 GM |
4 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
5 | ||
6 | This file is part of GNU Modula-2. | |
7 | ||
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) | |
11 | any later version. | |
12 | ||
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. | |
17 | ||
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/>. *) | |
21 | ||
22 | DEFINITION MODULE FOR "C" m2treelib ; | |
23 | ||
24 | FROM m2tree IMPORT Tree ; | |
25 | FROM m2linemap IMPORT location_t ; | |
26 | FROM SYSTEM IMPORT ADDRESS ; | |
27 | ||
28 | TYPE | |
29 | tree_code = INTEGER ; | |
30 | ||
31 | ||
32 | (* | |
33 | get_set_address_if_var - returns the address of, op, providing | |
34 | it is not a constant. | |
35 | NULL is returned if, op, is a constant. | |
36 | *) | |
37 | ||
8804eb0b | 38 | PROCEDURE get_set_address_if_var (location: location_t; op: Tree; is_lvalue, is_const: BOOLEAN) : Tree ; |
1eee94d3 GM |
39 | |
40 | ||
41 | (* | |
42 | get_set_field_rhs - returns the value of p->field. | |
43 | *) | |
44 | ||
45 | PROCEDURE get_set_field_rhs (location: location_t; p: Tree; field: Tree) : Tree ; | |
46 | ||
47 | ||
48 | (* | |
49 | get_set_field_lhs - returns the address of p->field. | |
50 | *) | |
51 | ||
52 | PROCEDURE get_set_field_lhs (location: location_t; p: Tree; field: Tree) : Tree ; | |
53 | ||
54 | ||
55 | (* | |
56 | get_set_address - returns the address of op1. | |
57 | *) | |
58 | ||
8804eb0b | 59 | PROCEDURE get_set_address (location: location_t; op1: Tree; is_lvalue: BOOLEAN) : Tree ; |
1eee94d3 GM |
60 | |
61 | ||
62 | (* | |
63 | get_set_value - returns the value indicated by, field, in the set. | |
64 | Either p->field or the constant(op.fieldNo) is returned. | |
65 | *) | |
66 | ||
8804eb0b | 67 | PROCEDURE get_set_value (location: location_t; p: Tree; field: Tree; is_const: BOOLEAN; op: Tree; fieldNo: CARDINAL) : Tree ; |
1eee94d3 GM |
68 | |
69 | ||
70 | (* | |
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. | |
77 | *) | |
78 | ||
8804eb0b | 79 | PROCEDURE get_field_no (type: Tree; op: Tree; is_const: BOOLEAN; fieldNo: CARDINAL) : Tree ; |
1eee94d3 GM |
80 | |
81 | ||
82 | (* | |
83 | get_rvalue - returns the rvalue of t. The, type, is the object type to be | |
84 | copied upon indirection. | |
85 | *) | |
86 | ||
8804eb0b | 87 | PROCEDURE get_rvalue (location: location_t; t: Tree; type: Tree; is_lvalue: BOOLEAN) : Tree ; |
1eee94d3 GM |
88 | |
89 | ||
90 | (* | |
91 | DoCall - build a call tree arranging the parameter list as a vector. | |
92 | *) | |
93 | ||
94 | PROCEDURE DoCall (location: location_t; rettype: Tree; funcptr: Tree; param_list: Tree) : Tree ; | |
95 | ||
96 | ||
97 | ||
98 | PROCEDURE build_modify_expr (location: location_t; des: Tree; modifycode: tree_code; copy: Tree) : Tree ; | |
99 | ||
100 | ||
101 | (* | |
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. | |
104 | *) | |
105 | ||
106 | PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: Tree; bit: Tree; label: ADDRESS) ; | |
107 | ||
108 | ||
109 | END m2treelib. |