Mercurial > hg > index.cgi
annotate lwcc/cc-gencode.c @ 508:10f62dc61a75
Fix bad usage of sprintf()
Usage of sprintf() to append to a string in the form of
sprintf(buf, "%s...", buf...) is undefined, regardless whether it
worked on a lot of older systems. It was always a bad idea and it
now breaks on current glibc and gcc development environments.
The moral: if any of your code uses sprintf() in a way similar to
the above, fix it. It may not fail in a benign way.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 10 May 2020 22:38:24 -0600 |
parents | 59b8c8b15bd4 |
children |
rev | line source |
---|---|
499 | 1 /* |
2 lwcc/cc-gencode.c | |
3 | |
4 Copyright © 2019 William Astle | |
5 | |
6 This file is part of LWTOOLS. | |
7 | |
8 LWTOOLS is free software: you can redistribute it and/or modify it under the | |
9 terms of the GNU General Public License as published by the Free Software | |
10 Foundation, either version 3 of the License, or (at your option) any later | |
11 version. | |
12 | |
13 This program is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 more details. | |
17 | |
18 You should have received a copy of the GNU General Public License along with | |
19 this program. If not, see <http://www.gnu.org/licenses/>. | |
20 */ | |
21 | |
22 #include <stdio.h> | |
505
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
23 #include <stdlib.h> |
499 | 24 #include <string.h> |
25 | |
26 #include <lw_alloc.h> | |
27 #include <lw_string.h> | |
28 | |
29 #include "tree.h" | |
30 | |
502 | 31 char *generate_nextlabel(void) |
32 { | |
33 static int labelnum = 0; | |
34 char buf[16]; | |
35 | |
36 sprintf(buf, "L%d", labelnum++); | |
37 return lw_strdup(buf); | |
38 } | |
39 | |
505
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
40 void generate_code(node_t *n, FILE *output); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
41 |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
42 void generate_code_shift(node_t *n, FILE *output, int dir) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
43 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
44 generate_code(n -> children, output); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
45 if (n -> children -> next_child -> type == NODE_CONST_INT) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
46 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
47 long ival; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
48 int i; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
49 ival = strtol(n -> children -> next_child -> strval, NULL, 0); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
50 if (ival <= 0) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
51 return; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
52 if (ival >= 16) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
53 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
54 fprintf(output, "\tldd #%d\n", dir == 1 ? 0 : -1); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
55 return; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
56 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
57 if (ival >= 8) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
58 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
59 if (dir == 1) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
60 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
61 fprintf(output, "\ttfr b,a\n\tclrb\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
62 for (i = ival - 8; i > 0; i--) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
63 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
64 fprintf(output, "\tlsla\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
65 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
66 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
67 else |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
68 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
69 fprintf(output, "\ttfr a,b\n\tsex\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
70 for (i = ival - 8; i > 0; i--) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
71 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
72 fprintf(output, "\tasrb\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
73 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
74 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
75 return; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
76 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
77 for (i = ival; i > 0; i--) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
78 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
79 if (dir == 1) |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
80 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
81 fprintf(output, "\taslb\n\trola\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
82 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
83 else |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
84 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
85 fprintf(output, "\tasra\n\trorb\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
86 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
87 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
88 return; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
89 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
90 else |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
91 { |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
92 fprintf(output, "\tpshs d\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
93 generate_code(n -> children -> next_child, output); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
94 fprintf(output, "\tjsr ___%ssh16\n\tpuls d\n", dir == 1 ? "l" : "r"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
95 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
96 } |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
97 |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
98 |
499 | 99 void generate_code(node_t *n, FILE *output) |
100 { | |
101 node_t *nn; | |
502 | 102 char *label1, *label2; |
103 | |
499 | 104 switch (n -> type) |
105 { | |
106 // function definition - output prologue, then statements, then epilogue | |
107 case NODE_FUNDEF: | |
505
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
108 fprintf(output, "\tsection .text\n\texport _%s\n_%s\n", n->children->next_child->strval, n->children->next_child->strval); |
499 | 109 generate_code(n->children->next_child->next_child->next_child, output); |
110 fprintf(output, "\trts\n"); | |
111 break; | |
112 | |
113 case NODE_CONST_INT: | |
114 fprintf(output, "\tldd #%s\n", n->strval); | |
115 break; | |
116 | |
501
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
117 case NODE_OPER_PLUS: |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
118 generate_code(n->children, output); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
119 fprintf(output, "\tpshs d\n"); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
120 generate_code(n->children->next_child, output); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
121 fprintf(output, "\taddd ,s++\n"); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
122 break; |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
123 |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
124 case NODE_OPER_MINUS: |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
125 generate_code(n->children, output); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
126 fprintf(output, "\tpshs d,x\n"); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
127 generate_code(n->children->next_child, output); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
128 fprintf(output, "\tstd 2,s\n\tpuls d\n\tsubd ,s++\n"); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
129 break; |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
130 |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
131 case NODE_OPER_TIMES: |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
132 generate_code(n -> children, output); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
133 fprintf(output, "\tpshs d\n"); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
134 generate_code(n->children->next_child, output); |
505
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
135 fprintf(output, "\tjsr ___mul16i\n\tpuls d\n"); |
501
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
136 break; |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
137 |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
138 case NODE_OPER_DIVIDE: |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
139 generate_code(n -> children, output); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
140 fprintf(output, "\tpshs d\n"); |
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
141 generate_code(n->children->next_child, output); |
505
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
142 fprintf(output, "\tjsr ___div16i\n\tpuls d\n"); |
501
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
143 break; |
502 | 144 |
145 case NODE_OPER_MOD: | |
146 generate_code(n -> children, output); | |
147 fprintf(output, "\tpshs d\n"); | |
148 generate_code(n -> children -> next_child, output); | |
505
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
149 fprintf(output, "\tjsr ___mod16i\n\tpuls d\n"); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
150 break; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
151 |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
152 case NODE_OPER_LSH: |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
153 generate_code_shift(n, output, 1); |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
154 break; |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
155 |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
156 case NODE_OPER_RSH: |
59b8c8b15bd4
Add integer shifts and fix code template errors for mul/div/mod
William Astle <lost@l-w.ca>
parents:
502
diff
changeset
|
157 generate_code_shift(n, output, 0); |
502 | 158 break; |
501
f3e9732973f1
Add basic integer operations to lwcc
William Astle <lost@l-w.ca>
parents:
499
diff
changeset
|
159 |
502 | 160 case NODE_OPER_COND: |
161 label1 = generate_nextlabel(); | |
162 label2 = generate_nextlabel(); | |
163 generate_code(n -> children, output); | |
164 fprintf(output, "\tsubd #0\n\tbeq %s\n", label1); | |
165 generate_code(n -> children -> next_child, output); | |
166 fprintf(output, "\tbra %s\n%s\n", label2, label1); | |
167 generate_code(n -> children -> next_child -> next_child, output); | |
168 fprintf(output, "%s\n", label2); | |
169 lw_free(label1); | |
170 lw_free(label2); | |
171 break; | |
172 | |
173 case NODE_OPER_COMMA: | |
174 generate_code(n -> children, output); | |
175 generate_code(n -> children -> next_child, output); | |
176 break; | |
177 | |
178 case NODE_OPER_BWAND: | |
179 generate_code(n -> children, output); | |
180 fprintf(output, "\tpshs d\n"); | |
181 generate_code(n -> children -> next_child, output); | |
182 fprintf(output, "\tandb 1,s\n\tanda ,s++\n"); | |
183 break; | |
184 | |
185 case NODE_OPER_BWOR: | |
186 generate_code(n -> children, output); | |
187 fprintf(output, "\tpshs d\n"); | |
188 generate_code(n -> children -> next_child, output); | |
189 fprintf(output, "\torb 1,s\n\tora ,s++\n"); | |
190 break; | |
191 | |
192 case NODE_OPER_BWXOR: | |
193 generate_code(n -> children, output); | |
194 fprintf(output, "\tpshs d\n"); | |
195 generate_code(n -> children -> next_child, output); | |
196 fprintf(output, "\teorb 1,s\n\teora ,s++\n"); | |
197 break; | |
198 | |
199 case NODE_OPER_BAND: | |
200 label1 = generate_nextlabel(); | |
201 generate_code(n -> children, output); | |
202 fprintf(output, "\tsubd #0\n\tbeq %s\n", label1); | |
203 generate_code(n -> children -> next_child, output); | |
204 fprintf(output, "\tsubd #0\n\tbeq %s\n\tldd #1\n%s\n", label1, label1); | |
205 lw_free(label1); | |
206 break; | |
207 | |
208 case NODE_OPER_BOR: | |
209 label1 = generate_nextlabel(); | |
210 label2 = generate_nextlabel(); | |
211 generate_code(n -> children, output); | |
212 fprintf(output, "\tsubd #0\n\tbne %s\n", label1); | |
213 generate_code(n -> children -> next_child, output); | |
214 fprintf(output, "\tsubd #0\n\tbeq %s\n%s\tldd #1\n%s\n", label2, label1, label2); | |
215 lw_free(label1); | |
216 lw_free(label2); | |
217 break; | |
218 | |
219 case NODE_OPER_NE: | |
220 case NODE_OPER_EQ: | |
221 case NODE_OPER_LT: | |
222 case NODE_OPER_GT: | |
223 case NODE_OPER_LE: | |
224 case NODE_OPER_GE: | |
225 generate_code(n -> children, output); | |
226 fprintf(output, "\tpshs d\n"); | |
227 generate_code(n -> children -> next_child, output); | |
228 fprintf(output, "\tsubd ,s++\n"); | |
229 label1 = generate_nextlabel(); | |
230 label2 = generate_nextlabel(); | |
231 fprintf(output, "\t%s %s\n", ( | |
232 (n -> type == NODE_OPER_NE ? "bne" : | |
233 (n -> type == NODE_OPER_EQ ? "beq" : | |
234 (n -> type == NODE_OPER_LT ? "bge" : | |
235 (n -> type == NODE_OPER_GT ? "ble" : | |
236 (n -> type == NODE_OPER_LE ? "bgt" : | |
237 (n -> type == NODE_OPER_GE ? "blt" : | |
238 "foobar")))))) | |
239 ), label1); | |
240 fprintf(output, "\tldd #0\n\tbra %s\n%s\tldd #1\n%s\n", label2, label1, label2); | |
241 lw_free(label1); | |
242 lw_free(label2); | |
243 break; | |
244 | |
499 | 245 default: |
246 for (nn = n -> children; nn; nn = nn -> next_child) | |
247 generate_code(nn, output); | |
248 break; | |
249 } | |
250 } |