aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2/gm2-gcc/m2decl.def
blob: 5db08a71663ab5c025c29f6eac1f69afd2de2ea6 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
(* m2decl.def definition module for m2decl.cc.

Copyright (C) 2011-2022 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 m2decl ;

FROM SYSTEM IMPORT ADDRESS ;
FROM m2tree IMPORT Tree ;
FROM m2linemap IMPORT location_t ;


(*
    GetBitsPerBitset - returns the number of bits in a BITSET.
*)

PROCEDURE GetBitsPerBitset () : INTEGER ;


(*
    GetBitsPerInt - returns the number of bits in a INTEGER.
*)

PROCEDURE GetBitsPerInt () : INTEGER ;


(*
    GetBitsPerUnit - returns the number of bits in a UNIT.
*)

PROCEDURE GetBitsPerUnit () : INTEGER ;


(*
    GetBitsPerWord - returns the number of bits in a WORD.
*)

PROCEDURE GetBitsPerWord () : INTEGER ;


(*
    BuildIntegerConstant - return a tree containing the integer value.
*)

PROCEDURE BuildIntegerConstant (value: INTEGER) : Tree ;


(*
    BuildStringConstantType - builds a string constant with a type.
*)

PROCEDURE BuildStringConstantType (length: INTEGER; string: ADDRESS; type: Tree) : Tree ;


(*
    DeclareKnownVariable - declares a variable in scope,
                           funcscope. Note that the global variable,
                           current_function_decl, is altered if
                           isglobal is TRUE.
*)

PROCEDURE DeclareKnownVariable (location: location_t; name: ADDRESS; type: Tree;
                                exported, imported, istemporary, isglobal: BOOLEAN;
                                scope: Tree) : Tree ;


(*
    DeclareKnownConstant - given a constant, value, of, type, create a constant in the GCC
                           symbol table. Note that the name of the constant is not used
                           as _all_ constants are declared in the global scope. The front end
                           deals with scoping rules - here we declare all constants with no names
                           in the global scope. This allows M2SubExp and constant folding routines
                           the liberty of operating with quadruples which all assume constants can
                           always be referenced.
*)

PROCEDURE DeclareKnownConstant (location: location_t; type: Tree; value: Tree) : Tree ;


(*
    BuildParameterDeclaration - creates and returns one parameter from, name, and, type.
                                It appends this parameter to the internal param_type_list.
                                If name is nul then we assume we are creating a function
                                type declaration and we ignore names.
*)

PROCEDURE BuildParameterDeclaration (location: location_t; name: ADDRESS; type: Tree;
                                     isreference: BOOLEAN) : Tree ;


(*
    BuildStartFunctionDeclaration - initializes global variables ready
                                    for building a function.
*)

PROCEDURE BuildStartFunctionDeclaration (uses_varargs: BOOLEAN) ;


(*
    BuildEndFunctionDeclaration - build a function which will return a value of returntype.
                                  The arguments have been created by BuildParameterDeclaration.
*)

PROCEDURE BuildEndFunctionDeclaration (location_begin, location_end: location_t;
                                       name: ADDRESS; returntype: Tree;
                                       isexternal, isnested, ispublic: BOOLEAN) : Tree ;


(*
    RememberVariables -
*)

PROCEDURE RememberVariables (l: Tree) ;


(*
    DetermineSizeOfConstant - given, str, and, base, fill in
                              needsLong and needsUnsigned appropriately.
*)

PROCEDURE DetermineSizeOfConstant (str: ADDRESS; base: CARDINAL;
                                   VAR needsLong, needsUnsigned: BOOLEAN) ;


(*
    BuildConstLiteralNumber - returns a GCC TREE built from the string, str.
                              It assumes that, str, represents a legal
                              number in Modula-2. It always returns a
                              positive value.
*)

PROCEDURE BuildConstLiteralNumber (str: ADDRESS; base: CARDINAL) : Tree ;


(*
    BuildStringConstant - creates a string constant given a, string,
                          and, length.
*)

PROCEDURE BuildStringConstant (location: location_t; string: ADDRESS; length: INTEGER) : Tree ;


(*
    BuildCStringConstant - creates a string constant given a, string,
                           and, length.
*)

PROCEDURE BuildCStringConstant (string: ADDRESS; length: INTEGER) : Tree ;



PROCEDURE GetDeclContext (t: Tree) : Tree ;


END m2decl.