| 1 |
(* m2treelib.def definition module for m2treelib.cc. |
| 2 |
|
| 3 |
Copyright (C) 2011-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Gaius Mulley <[email protected]>. |
| 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 gcctypes IMPORT location_t, tree ; |
| 25 |
FROM SYSTEM IMPORT ADDRESS ; |
| 26 |
|
| 27 |
TYPE |
| 28 |
tree_code = INTEGER ; |
| 29 |
|
| 30 |
|
| 31 |
(* |
| 32 |
get_set_address_if_var - returns the address of, op, providing |
| 33 |
it is not a constant. |
| 34 |
NULL is returned if, op, is a constant. |
| 35 |
*) |
| 36 |
|
| 37 |
PROCEDURE get_set_address_if_var (location: location_t; op: tree; is_lvalue, is_const: BOOLEAN) : tree ; |
| 38 |
|
| 39 |
|
| 40 |
(* |
| 41 |
get_set_field_rhs - returns the value of p->field. |
| 42 |
*) |
| 43 |
|
| 44 |
PROCEDURE get_set_field_rhs (location: location_t; p: tree; field: tree) : tree ; |
| 45 |
|
| 46 |
|
| 47 |
(* |
| 48 |
get_set_field_lhs - returns the address of p->field. |
| 49 |
*) |
| 50 |
|
| 51 |
PROCEDURE get_set_field_lhs (location: location_t; p: tree; field: tree) : tree ; |
| 52 |
|
| 53 |
|
| 54 |
(* |
| 55 |
get_set_address - returns the address of op1. |
| 56 |
*) |
| 57 |
|
| 58 |
PROCEDURE get_set_address (location: location_t; op1: tree; is_lvalue: BOOLEAN) : tree ; |
| 59 |
|
| 60 |
|
| 61 |
(* |
| 62 |
get_set_value - returns the value indicated by, field, in the set. |
| 63 |
Either p->field or the constant(op.fieldNo) is returned. |
| 64 |
*) |
| 65 |
|
| 66 |
PROCEDURE get_set_value (location: location_t; p: tree; field: tree; is_const: BOOLEAN; op: tree; fieldNo: CARDINAL) : tree ; |
| 67 |
|
| 68 |
|
| 69 |
(* |
| 70 |
get_field_no - returns the field no for, op. The, op, is either |
| 71 |
a constructor or a variable of type record. |
| 72 |
If, op, is a constructor (a set constant in GNU Modula-2) |
| 73 |
then this function is essentially a no-op and it returns op. |
| 74 |
Else we iterate over the field list and return the |
| 75 |
appropriate field number. |
| 76 |
*) |
| 77 |
|
| 78 |
PROCEDURE get_field_no (type: tree; op: tree; is_const: BOOLEAN; fieldNo: CARDINAL) : tree ; |
| 79 |
|
| 80 |
|
| 81 |
(* |
| 82 |
get_rvalue - returns the rvalue of t. The, type, is the object type to be |
| 83 |
copied upon indirection. |
| 84 |
*) |
| 85 |
|
| 86 |
PROCEDURE get_rvalue (location: location_t; t: tree; type: tree; is_lvalue: BOOLEAN) : tree ; |
| 87 |
|
| 88 |
|
| 89 |
(* |
| 90 |
DoCall - build a call tree arranging the parameter list as a vector. |
| 91 |
*) |
| 92 |
|
| 93 |
PROCEDURE DoCall (location: location_t; rettype: tree; funcptr: tree; param_list: tree) : tree ; |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
PROCEDURE build_modify_expr (location: location_t; des: tree; modifycode: tree_code; copy: tree) : tree ; |
| 98 |
|
| 99 |
|
| 100 |
(* |
| 101 |
do_jump_if_bit - tests bit in word against integer zero using operator, code. |
| 102 |
If the result is true then jump to label. |
| 103 |
*) |
| 104 |
|
| 105 |
PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: tree; bit: tree; label: ADDRESS) ; |
| 106 |
|
| 107 |
|
| 108 |
END m2treelib. |