Debian Codegraph @

gcc/m2/gm2-compiler/M2GenGCC.def

raw
1 (* M2GenGCC.def convert the quadruples into GCC trees.
2
3 Copyright (C) 2001-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 M2GenGCC ;
23
24 (*
25 Title : M2GenGCC
26 Author : Gaius Mulley
27 System : UNIX (gm2)
28 Date : Fri Jul 9 13:05:13 1999
29 Last edit : Fri Jul 9 13:05:13 1999
30 Description: provides an interface to GCC, essentially convert the
31 internal quadruples of m2f into a GCC tree structure.
32 *)
33
34 FROM M2GCCDeclare IMPORT WalkAction ;
35 FROM gcctypes IMPORT location_t, tree ;
36 FROM M2BasicBlock IMPORT BasicBlock ;
37
38
39 (*
40 ConvertQuadsToTree - runs through the quadruple list, Start..End, and converts it into
41 the GCC tree structure.
42 *)
43
44 PROCEDURE ConvertQuadsToTree (Start, End: CARDINAL) ;
45
46
47 (*
48 ResolveConstantExpressions - resolves constant expressions from the quadruple list.
49 It returns TRUE if one or more constants were folded.
50 When a constant symbol value is solved, the call back
51 p(sym) is invoked.
52 *)
53
54 PROCEDURE ResolveConstantExpressions (p: WalkAction; bb: BasicBlock) : BOOLEAN ;
55
56
57 (*
58 GetHighFromUnbounded - returns a Tree containing the value of
59 param.HIGH.
60 *)
61
62 PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : tree ;
63
64
65 (*
66 StringToChar - if type=Char and str is a string (of size <= 1)
67 then convert the string into a character constant.
68 *)
69
70 PROCEDURE StringToChar (t: tree; type, str: CARDINAL) : tree ;
71
72
73 (*
74 LValueToGenericPtr - returns a Tree representing symbol, sym.
75 It coerces a lvalue into an internal pointer type
76 *)
77
78 PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : tree ;
79
80
81 (*
82 ZConstToTypedConst - checks whether op1 and op2 are constants and
83 coerces, t, appropriately.
84 *)
85
86 PROCEDURE ZConstToTypedConst (t: tree; op1, op2: CARDINAL) : tree ;
87
88
89 (*
90 PrepareCopyString - returns two trees:
91 length number of bytes to be copied (including the nul if room)
92 srcTreeType the new string type (with the extra nul character).
93
94 Pre condition: destStrType the dest type string.
95 src is the original string (without a nul)
96 to be copied.
97 Post condition: TRUE or FALSE is returned.
98 if true length and srcTreeType will be assigned
99 else length is set to the maximum length to be
100 copied and srcTree is set to the max length
101 which fits in dest.
102 *)
103
104 PROCEDURE PrepareCopyString (tokenno: CARDINAL; VAR length, srcTree: tree;
105 src, destStrType: CARDINAL) : BOOLEAN ;
106
107
108 END M2GenGCC.