]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | (* M2BasicBlock.def converts a scope block into a list of basic blocks. |
2 | ||
a945c346 | 3 | Copyright (C) 2001-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 M2BasicBlock ; | |
23 | ||
24 | (* | |
25 | Title : M2BasicBlock | |
26 | Author : Gaius Mulley | |
27 | Date : 20/8/2003 | |
28 | System : GNU Modula-2 | |
29 | Description: Converts a scope block into a list of basic blocks. | |
30 | The basic blocks are either converted back into quadruples | |
31 | or alternatively translated into GCC trees. | |
32 | *) | |
33 | ||
34 | FROM M2Scope IMPORT ScopeBlock ; | |
1eee94d3 GM |
35 | |
36 | ||
37 | TYPE | |
38 | BasicBlock ; | |
9f168b41 | 39 | BasicBlockProc = PROCEDURE (BasicBlock) ; |
1eee94d3 GM |
40 | |
41 | ||
42 | (* | |
43 | InitBasicBlocks - converts a list of quadruples as defined by | |
44 | scope blocks into a set of basic blocks. | |
45 | All quadruples within this list which are not | |
46 | reachable are removed. | |
47 | *) | |
48 | ||
49 | PROCEDURE InitBasicBlocks (sb: ScopeBlock) : BasicBlock ; | |
50 | ||
51 | ||
52 | (* | |
53 | InitBasicBlocksFromRange - converts a list of quadruples as defined by | |
54 | start..end. | |
55 | All quadruples within this list which are not | |
56 | reachable are removed. | |
57 | *) | |
58 | ||
40b91158 GM |
59 | PROCEDURE InitBasicBlocksFromRange (ScopeSym: CARDINAL; |
60 | start, end: CARDINAL) : BasicBlock ; | |
1eee94d3 GM |
61 | |
62 | ||
63 | (* | |
64 | KillBasicBlocks - destroys the list of Basic Blocks and assigns bb to NIL. | |
65 | *) | |
66 | ||
67 | PROCEDURE KillBasicBlocks (VAR bb: BasicBlock) ; | |
68 | ||
69 | ||
70 | (* | |
71 | FreeBasicBlocks - destroys the list of Basic Blocks. | |
72 | *) | |
73 | ||
74 | PROCEDURE FreeBasicBlocks (bb: BasicBlock) ; | |
75 | ||
76 | ||
77 | (* | |
78 | ForeachBasicBlockDo - for each basic block call procedure, p. | |
79 | *) | |
80 | ||
81 | PROCEDURE ForeachBasicBlockDo (bb: BasicBlock; p: BasicBlockProc) ; | |
82 | ||
83 | ||
9f168b41 GM |
84 | (* |
85 | GetBasicBlockScope - return the scope associated with the basic block. | |
86 | *) | |
87 | ||
88 | PROCEDURE GetBasicBlockScope (bb: BasicBlock) : CARDINAL ; | |
89 | ||
90 | ||
91 | (* | |
92 | GetBasicBlockStart - return the quad associated with the start of the basic block. | |
93 | *) | |
94 | ||
95 | PROCEDURE GetBasicBlockStart (bb: BasicBlock) : CARDINAL ; | |
96 | ||
97 | ||
98 | (* | |
99 | GetBasicBlockEnd - return the quad associated with the end of the basic block. | |
100 | *) | |
101 | ||
102 | PROCEDURE GetBasicBlockEnd (bb: BasicBlock) : CARDINAL ; | |
103 | ||
104 | ||
105 | (* | |
106 | IsBasicBlockFirst - return TRUE if this basic block is the first in the sequence. | |
107 | *) | |
108 | ||
109 | PROCEDURE IsBasicBlockFirst (bb: BasicBlock) : BOOLEAN ; | |
110 | ||
111 | ||
1eee94d3 | 112 | END M2BasicBlock. |