git @ Cat's Eye Technologies SixtyPical / a84cd4d
Expand on the callgraph tests. Chris Pressey 2 years ago
2 changed file(s) with 101 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
3232 potential_calls = node['potentially-calls']
3333 if routine.name in potential_calls:
3434 potentially_called_by.append(name)
35 if getattr(routine, 'explicitly_marked_as_called', None) or routine.name == 'main':
36 potentially_called_by.append('*marked*')
3537 graph[routine.name]['potentially-called-by'] = potentially_called_by
3638
3739 return graph
99
1010 -> Tests for functionality "Dump callgraph info for SixtyPical program"
1111
12 The `main` routine is always called.
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 called".
1315
1416 | define main routine
1517 | {
1618 | }
1719 = {
1820 = "main": {
21 = "potentially-called-by": [
22 = "*marked*"
23 = ],
24 = "potentially-calls": []
25 = }
26 = }
27
28 If a routine is called by another routine, this fact will be noted.
29
30 | define main routine
31 | {
32 | call other
33 | }
34 |
35 | define other routine
36 | {
37 | }
38 = {
39 = "main": {
40 = "potentially-called-by": [
41 = "*marked*"
42 = ],
43 = "potentially-calls": [
44 = "other"
45 = ]
46 = },
47 = "other": {
48 = "potentially-called-by": [
49 = "main"
50 = ],
51 = "potentially-calls": []
52 = }
53 = }
54
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.
59
60 | define main routine
61 | {
62 | }
63 |
64 | define other routine
65 | {
66 | }
67 = {
68 = "main": {
69 = "potentially-called-by": [
70 = "*marked*"
71 = ],
72 = "potentially-calls": []
73 = },
74 = "other": {
1975 = "potentially-called-by": [],
2076 = "potentially-calls": []
2177 = }
2278 = }
79
80 If two routines potentially call each other, this will be noted,
81 even if nothing else potentially calls either of those routines.
82 This may change in the future.
83
84 | define main routine
85 | {
86 | }
87 |
88 | define other1 routine
89 | {
90 | call other2
91 | }
92 |
93 | define other2 routine
94 | {
95 | call other1
96 | }
97 = {
98 = "main": {
99 = "potentially-called-by": [
100 = "*marked*"
101 = ],
102 = "potentially-calls": []
103 = },
104 = "other1": {
105 = "potentially-called-by": [
106 = "other2"
107 = ],
108 = "potentially-calls": [
109 = "other2"
110 = ]
111 = },
112 = "other2": {
113 = "potentially-called-by": [
114 = "other1"
115 = ],
116 = "potentially-calls": [
117 = "other1"
118 = ]
119 = }
120 = }