10 | 10 |
-> Tests for functionality "Dump callgraph info for SixtyPical program"
|
11 | 11 |
|
12 | 12 |
The `main` routine is always called. The thing that it will
|
13 | |
be called by is the system, but the callgraph analyzer will
|
14 | |
simply consider it to be "marked as preserved".
|
|
13 |
be called by is the system, but the callgraph analyzer simply
|
|
14 |
considers it to be "reachable".
|
15 | 15 |
|
16 | 16 |
| define main routine
|
17 | 17 |
| {
|
18 | 18 |
| }
|
19 | 19 |
= {
|
20 | 20 |
= "main": {
|
21 | |
= "potentially-called-by": [
|
22 | |
= "*preserved*"
|
23 | |
= ],
|
24 | |
= "potentially-calls": []
|
|
21 |
= "potentially-called-by": [],
|
|
22 |
= "potentially-calls": [],
|
|
23 |
= "reachable": true
|
25 | 24 |
= }
|
26 | 25 |
= }
|
27 | 26 |
|
28 | 27 |
If a routine is called by another routine, this fact will be noted.
|
|
28 |
If it is reachable (directly or indirectly) from `main`, this will
|
|
29 |
be noted as well.
|
29 | 30 |
|
30 | 31 |
| define main routine
|
31 | 32 |
| {
|
|
37 | 38 |
| }
|
38 | 39 |
= {
|
39 | 40 |
= "main": {
|
40 | |
= "potentially-called-by": [
|
41 | |
= "*preserved*"
|
42 | |
= ],
|
|
41 |
= "potentially-called-by": [],
|
43 | 42 |
= "potentially-calls": [
|
44 | 43 |
= "other"
|
45 | |
= ]
|
|
44 |
= ],
|
|
45 |
= "reachable": true
|
46 | 46 |
= },
|
47 | 47 |
= "other": {
|
48 | 48 |
= "potentially-called-by": [
|
49 | 49 |
= "main"
|
50 | 50 |
= ],
|
51 | |
= "potentially-calls": []
|
|
51 |
= "potentially-calls": [],
|
|
52 |
= "reachable": true
|
52 | 53 |
= }
|
53 | 54 |
= }
|
54 | 55 |
|
55 | |
If a routine is not called by another routine, and it is not `main`
|
56 | |
and it is not explicitly marked as preserved, this absence will be
|
57 | |
noted, and a compiler or linker will be permitted to omit it from
|
58 | |
the final executable.
|
|
56 |
If a routine is not potentially called by any other routine that is
|
|
57 |
ultimately potentially called by `main`, this absence will be noted
|
|
58 |
— the routine will not be considered reachable — and a compiler or
|
|
59 |
linker will be permitted to omit it from the final executable.
|
59 | 60 |
|
60 | 61 |
| define main routine
|
61 | 62 |
| {
|
|
66 | 67 |
| }
|
67 | 68 |
= {
|
68 | 69 |
= "main": {
|
69 | |
= "potentially-called-by": [
|
70 | |
= "*preserved*"
|
71 | |
= ],
|
72 | |
= "potentially-calls": []
|
|
70 |
= "potentially-called-by": [],
|
|
71 |
= "potentially-calls": [],
|
|
72 |
= "reachable": true
|
73 | 73 |
= },
|
74 | 74 |
= "other": {
|
75 | 75 |
= "potentially-called-by": [],
|
|
78 | 78 |
= }
|
79 | 79 |
|
80 | 80 |
If a routine is not called by another routine, but it is declared
|
81 | |
explicitly as `preserved`, then it will not be considered unused,
|
82 | |
and a compiler or linker will not be permitted to omit it from
|
83 | |
the final executable. This is useful for interrupt routines and
|
84 | |
such that really are used by some part of the system, even if not
|
85 | |
directly by another SixtyPical routine.
|
|
81 |
explicitly as `preserved`, then it will still be considered
|
|
82 |
reachable, and a compiler or linker will not be permitted to omit it
|
|
83 |
from the final executable. This is useful for interrupt routines
|
|
84 |
and such that really are used by some part of the system, even if
|
|
85 |
not directly by another SixtyPical routine.
|
86 | 86 |
|
87 | 87 |
| define main routine
|
88 | 88 |
| {
|
|
93 | 93 |
| }
|
94 | 94 |
= {
|
95 | 95 |
= "main": {
|
96 | |
= "potentially-called-by": [
|
97 | |
= "*preserved*"
|
98 | |
= ],
|
99 | |
= "potentially-calls": []
|
|
96 |
= "potentially-called-by": [],
|
|
97 |
= "potentially-calls": [],
|
|
98 |
= "reachable": true
|
100 | 99 |
= },
|
101 | 100 |
= "other": {
|
102 | |
= "potentially-called-by": [
|
103 | |
= "*preserved*"
|
104 | |
= ],
|
105 | |
= "potentially-calls": []
|
|
101 |
= "potentially-called-by": [],
|
|
102 |
= "potentially-calls": [],
|
|
103 |
= "reachable": true
|
106 | 104 |
= }
|
107 | 105 |
= }
|
108 | 106 |
|
109 | |
If two routines potentially call each other, this will be noted,
|
110 | |
even if nothing else potentially calls either of those routines.
|
111 | |
This may change in the future.
|
|
107 |
If a routine is called from a preserved routine, that routine is
|
|
108 |
reachable.
|
|
109 |
|
|
110 |
| define main routine
|
|
111 |
| {
|
|
112 |
| }
|
|
113 |
|
|
|
114 |
| define other1 preserved routine
|
|
115 |
| {
|
|
116 |
| call other2
|
|
117 |
| }
|
|
118 |
|
|
|
119 |
| define other2 preserved routine
|
|
120 |
| {
|
|
121 |
| }
|
|
122 |
= {
|
|
123 |
= "main": {
|
|
124 |
= "potentially-called-by": [],
|
|
125 |
= "potentially-calls": [],
|
|
126 |
= "reachable": true
|
|
127 |
= },
|
|
128 |
= "other1": {
|
|
129 |
= "potentially-called-by": [],
|
|
130 |
= "potentially-calls": [
|
|
131 |
= "other2"
|
|
132 |
= ],
|
|
133 |
= "reachable": true
|
|
134 |
= },
|
|
135 |
= "other2": {
|
|
136 |
= "potentially-called-by": [
|
|
137 |
= "other1"
|
|
138 |
= ],
|
|
139 |
= "potentially-calls": [],
|
|
140 |
= "reachable": true
|
|
141 |
= }
|
|
142 |
= }
|
|
143 |
|
|
144 |
If a group of routines potentially call each other, but neither is
|
|
145 |
found to be reachable (directly or indirectly) from `main` or a
|
|
146 |
`preserved` routine, the routines in the group will not be considered
|
|
147 |
reachable.
|
112 | 148 |
|
113 | 149 |
| define main routine
|
114 | 150 |
| {
|
|
125 | 161 |
| }
|
126 | 162 |
= {
|
127 | 163 |
= "main": {
|
128 | |
= "potentially-called-by": [
|
129 | |
= "*preserved*"
|
130 | |
= ],
|
131 | |
= "potentially-calls": []
|
|
164 |
= "potentially-called-by": [],
|
|
165 |
= "potentially-calls": [],
|
|
166 |
= "reachable": true
|
132 | 167 |
= },
|
133 | 168 |
= "other1": {
|
134 | 169 |
= "potentially-called-by": [
|