History

Revert "Fix some errors on arm64-asm.c, rename some variables, fix several code style declarations"

This reverts commit 61537d899af7bc163238ac21f666170ad84b6851.

mingodad committed 5 years ago

Commit 2ce2dbc1 parent d33f58218 files · +2854 −2853Browse files

Unified · Split

18 files
  1. arm-asm.c +119 −119
  2. arm-gen.c +187 −187
  3. arm64-asm.c +23 −23
  4. arm64-gen.c +142 −142
  5. c67-gen.c +183 −183
  6. i386-asm.c +52 −52
  7. i386-gen.c +129 −129
  8. libtcc.c +22 −22
  9. riscv64-asm.c +37 −37
  10. riscv64-gen.c +197 −197
  11. tcc.h +164 −163
  12. tccasm.c +123 −123
  13. tccelf.c +10 −10
  14. tccgen.c +901 −901
  15. tccmacho.c +7 −7
  16. tccpe.c +3 −3
  17. tccpp.c +355 −355
  18. x86_64-gen.c +200 −200
arm-asm.c+119−119
@@ -24,9 +24,9 @@ · 23 unmodified lines
2424 #define CONFIG_TCC_ASM
2525 #define NB_ASM_REGS 16
2626
27−ST_FUNC void g(TCCState *S, int c);
28−ST_FUNC void gen_le16(TCCState *S, int c);
29−ST_FUNC void gen_le32(TCCState *S, int c);
27+ST_FUNC void g(TCCState* S, int c);
28+ST_FUNC void gen_le16(TCCState* S, int c);
29+ST_FUNC void gen_le32(TCCState* S, int c);
3030
3131 /*************************************************************/
3232 #else
@@ -100,10 +100,10 @@ static void parse_operand(TCCState *S, Operand *op) · 67 unmodified lines
100100
101101 op->type = 0;
102102
103− if (S->tok == '{') { // regset literal
103+ if (S->tccpp_tok == '{') { // regset literal
104104 next(S); // skip '{'
105− while (S->tok != '}' && S->tok != TOK_EOF) {
106− reg = asm_parse_regvar(S, S->tok);
105+ while (S->tccpp_tok != '}' && S->tccpp_tok != TOK_EOF) {
106+ reg = asm_parse_regvar(S, S->tccpp_tok);
107107 if (reg == -1) {
108108 expect(S, "register");
109109 return;
@@ -113,11 +113,11 @@ static void parse_operand(TCCState *S, Operand *op) · 3 unmodified lines
113113 if ((1 << reg) < regset)
114114 tcc_warning(S, "registers will be processed in ascending order by hardware--but are not specified in ascending order here");
115115 regset |= 1 << reg;
116− if (S->tok != ',')
116+ if (S->tccpp_tok != ',')
117117 break;
118118 next(S); // skip ','
119119 }
120− if (S->tok != '}')
120+ if (S->tccpp_tok != '}')
121121 expect(S, "'}'");
122122 next(S); // skip '}'
123123 if (regset == 0) {
@@ -128,22 +128,22 @@ static void parse_operand(TCCState *S, Operand *op) · 4 unmodified lines
128128 op->regset = regset;
129129 }
130130 return;
131− } else if ((reg = asm_parse_regvar(S, S->tok)) != -1) {
131+ } else if ((reg = asm_parse_regvar(S, S->tccpp_tok)) != -1) {
132132 next(S); // skip register name
133133 op->type = OP_REG32;
134134 op->reg = (uint8_t) reg;
135135 return;
136− } else if ((reg = asm_parse_vfp_regvar(S->tok, 0)) != -1) {
136+ } else if ((reg = asm_parse_vfp_regvar(S->tccpp_tok, 0)) != -1) {
137137 next(S); // skip register name
138138 op->type = OP_VREG32;
139139 op->reg = (uint8_t) reg;
140140 return;
141− } else if ((reg = asm_parse_vfp_regvar(S->tok, 1)) != -1) {
141+ } else if ((reg = asm_parse_vfp_regvar(S->tccpp_tok, 1)) != -1) {
142142 next(S); // skip register name
143143 op->type = OP_VREG64;
144144 op->reg = (uint8_t) reg;
145145 return;
146− } else if (S->tok == '#' || S->tok == '$') {
146+ } else if (S->tccpp_tok == '#' || S->tccpp_tok == '$') {
147147 /* constant value */
148148 next(S); // skip '#' or '$'
149149 }
@@ -160,44 +160,44 @@ static void parse_operand(TCCState *S, Operand *op) · 10 unmodified lines
160160 }
161161
162162 /* XXX: make it faster ? */
163−ST_FUNC void g(TCCState *S, int c)
163+ST_FUNC void g(TCCState* S, int c)
164164 {
165165 int ind1;
166− if (S->nocode_wanted)
166+ if (S->tccgen_nocode_wanted)
167167 return;
168− ind1 = S->ind + 1;
168+ ind1 = S->tccgen_ind + 1;
169169 if (ind1 > cur_text_section->data_allocated)
170170 section_realloc(S, cur_text_section, ind1);
171− cur_text_section->data[S->ind] = c;
172− S->ind = ind1;
171+ cur_text_section->data[S->tccgen_ind] = c;
172+ S->tccgen_ind = ind1;
173173 }
174174
175−ST_FUNC void gen_le16 (TCCState *S, int i)
175+ST_FUNC void gen_le16 (TCCState* S, int i)
176176 {
177177 g(S, i);
178178 g(S, i>>8);
179179 }
180180
181−ST_FUNC void gen_le32 (TCCState *S, int i)
181+ST_FUNC void gen_le32 (TCCState* S, int i)
182182 {
183183 int ind1;
184− if (S->nocode_wanted)
184+ if (S->tccgen_nocode_wanted)
185185 return;
186− ind1 = S->ind + 4;
186+ ind1 = S->tccgen_ind + 4;
187187 if (ind1 > cur_text_section->data_allocated)
188188 section_realloc(S, cur_text_section, ind1);
189− cur_text_section->data[S->ind++] = i & 0xFF;
190− cur_text_section->data[S->ind++] = (i >> 8) & 0xFF;
191− cur_text_section->data[S->ind++] = (i >> 16) & 0xFF;
192− cur_text_section->data[S->ind++] = (i >> 24) & 0xFF;
189+ cur_text_section->data[S->tccgen_ind++] = i & 0xFF;
190+ cur_text_section->data[S->tccgen_ind++] = (i >> 8) & 0xFF;
191+ cur_text_section->data[S->tccgen_ind++] = (i >> 16) & 0xFF;
192+ cur_text_section->data[S->tccgen_ind++] = (i >> 24) & 0xFF;
193193 }
194194
195−ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe)
195+ST_FUNC void gen_expr32(TCCState* S, ExprValue *pe)
196196 {
197197 gen_le32(S, pe->v);
198198 }
199199
200−static uint32_t condition_code_of_token(TCCState *S, int token) {
200+static uint32_t condition_code_of_token(TCCState* S, int token) {
201201 if (token < TOK_ASM_nopeq) {
202202 expect(S, "condition-enabled instruction");
203203 return 0;
@@ -205,15 +205,15 @@ static uint32_t condition_code_of_token(TCCState *S, int token) { · 1 unmodified line
205205 return (token - TOK_ASM_nopeq) & 15;
206206 }
207207
208−static void asm_emit_opcode(TCCState *S, int token, uint32_t opcode) {
208+static void asm_emit_opcode(TCCState* S, int token, uint32_t opcode) {
209209 gen_le32(S, (condition_code_of_token(S, token) << 28) | opcode);
210210 }
211211
212−static void asm_emit_unconditional_opcode(TCCState *S, uint32_t opcode) {
212+static void asm_emit_unconditional_opcode(TCCState* S, uint32_t opcode) {
213213 gen_le32(S, opcode);
214214 }
215215
216−static void asm_emit_coprocessor_opcode(TCCState *S, uint32_t high_nibble, uint8_t cp_number, uint8_t cp_opcode, uint8_t cp_destination_register, uint8_t cp_n_operand_register, uint8_t cp_m_operand_register, uint8_t cp_opcode2, int inter_processor_transfer)
216+static void asm_emit_coprocessor_opcode(TCCState* S, uint32_t high_nibble, uint8_t cp_number, uint8_t cp_opcode, uint8_t cp_destination_register, uint8_t cp_n_operand_register, uint8_t cp_m_operand_register, uint8_t cp_opcode2, int inter_processor_transfer)
217217 {
218218 uint32_t opcode = 0xe000000;
219219 if (inter_processor_transfer)
@@ -233,7 +233,7 @@ static void asm_emit_coprocessor_opcode(TCCState *S, uint32_t high_nibble, uint8 · 13 unmodified lines
233233 asm_emit_unconditional_opcode(S, (high_nibble << 28) | opcode);
234234 }
235235
236−static void asm_nullary_opcode(TCCState *S, int token)
236+static void asm_nullary_opcode(TCCState* S, int token)
237237 {
238238 switch (ARM_INSTRUCTION_GROUP(token)) {
239239 case TOK_ASM_nopeq:
@@ -276,7 +276,7 @@ static void asm_binary_opcode(TCCState *S, int token) · 36 unmodified lines
276276 uint32_t encoded_rotation = 0;
277277 uint64_t amount;
278278 parse_operand(S, &ops[0]);
279− if (S->tok == ',')
279+ if (S->tccpp_tok == ',')
280280 next(S);
281281 else
282282 expect(S, "','");
@@ -328,9 +328,9 @@ static void asm_binary_opcode(TCCState *S, int token) · 45 unmodified lines
328328 if (ops[1].reg == 13)
329329 tcc_warning(S, "Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(S, token, NULL));
330330
331− if (S->tok == ',') {
331+ if (S->tccpp_tok == ',') {
332332 next(S); // skip ','
333− if (S->tok == TOK_ASM_ror) {
333+ if (S->tccpp_tok == TOK_ASM_ror) {
334334 next(S); // skip 'ror'
335335 parse_operand(S, &rotation);
336336 if (rotation.type != OP_IM8) {
@@ -387,15 +387,15 @@ static void asm_coprocessor_opcode(TCCState *S, int token) { · 50 unmodified lines
387387 uint8_t high_nibble;
388388 uint8_t mrc = 0;
389389
390− if (S->tok >= TOK_ASM_p0 && S->tok <= TOK_ASM_p15) {
391− coprocessor = S->tok - TOK_ASM_p0;
390+ if (S->tccpp_tok >= TOK_ASM_p0 && S->tccpp_tok <= TOK_ASM_p15) {
391+ coprocessor = S->tccpp_tok - TOK_ASM_p0;
392392 next(S);
393393 } else {
394394 expect(S, "'p<number>'");
395395 return;
396396 }
397397
398− if (S->tok == ',')
398+ if (S->tccpp_tok == ',')
399399 next(S);
400400 else
401401 expect(S, "','");
@@ -407,21 +407,21 @@ static void asm_coprocessor_opcode(TCCState *S, int token) { · 5 unmodified lines
407407 }
408408
409409 for (i = 0; i < 3; ++i) {
410− if (S->tok == ',')
410+ if (S->tccpp_tok == ',')
411411 next(S);
412412 else
413413 expect(S, "','");
414414 if (i == 0 && token != TOK_ASM_cdp2 && (ARM_INSTRUCTION_GROUP(token) == TOK_ASM_mrceq || ARM_INSTRUCTION_GROUP(token) == TOK_ASM_mcreq)) {
415− if (S->tok >= TOK_ASM_r0 && S->tok <= TOK_ASM_r15) {
416− registers[i] = S->tok - TOK_ASM_r0;
415+ if (S->tccpp_tok >= TOK_ASM_r0 && S->tccpp_tok <= TOK_ASM_r15) {
416+ registers[i] = S->tccpp_tok - TOK_ASM_r0;
417417 next(S);
418418 } else {
419419 expect(S, "'r<number>'");
420420 return;
421421 }
422422 } else {
423− if (S->tok >= TOK_ASM_c0 && S->tok <= TOK_ASM_c15) {
424− registers[i] = S->tok - TOK_ASM_c0;
423+ if (S->tccpp_tok >= TOK_ASM_c0 && S->tccpp_tok <= TOK_ASM_c15) {
424+ registers[i] = S->tccpp_tok - TOK_ASM_c0;
425425 next(S);
426426 } else {
427427 expect(S, "'c<number>'");
@@ -429,7 +429,7 @@ static void asm_coprocessor_opcode(TCCState *S, int token) { · 1 unmodified line
429429 }
430430 }
431431 }
432− if (S->tok == ',') {
432+ if (S->tccpp_tok == ',') {
433433 next(S);
434434 parse_operand(S, &opcode2);
435435 } else {
@@ -493,11 +493,11 @@ static void asm_block_data_transfer_opcode(TCCState *S, int token) · 57 unmodified lines
493493 Operand ops[2];
494494 int nb_ops = 1;
495495 parse_operand(S, &ops[0]);
496− if (S->tok == '!') {
496+ if (S->tccpp_tok == '!') {
497497 op0_exclam = 1;
498498 next(S); // skip '!'
499499 }
500− if (S->tok == ',') {
500+ if (S->tccpp_tok == ',') {
501501 next(S); // skip comma
502502 parse_operand(S, &ops[1]);
503503 ++nb_ops;
@@ -600,17 +600,17 @@ static void asm_block_data_transfer_opcode(TCCState *S, int token) · 96 unmodified lines
600600
601601 NB_SHIFT: will be set to 1 iff SHIFT is filled. Note that for rrx, there's no need to fill SHIFT.
602602 SHIFT: will be filled in with the shift operand to use, if any. */
603−static uint32_t asm_parse_optional_shift(TCCState *S, int* nb_shift, Operand* shift)
603+static uint32_t asm_parse_optional_shift(TCCState* S, int* nb_shift, Operand* shift)
604604 {
605605 uint32_t opcode = 0;
606606 *nb_shift = 0;
607− switch (S->tok) {
607+ switch (S->tccpp_tok) {
608608 case TOK_ASM_asl:
609609 case TOK_ASM_lsl:
610610 case TOK_ASM_asr:
611611 case TOK_ASM_lsr:
612612 case TOK_ASM_ror:
613− switch (S->tok) {
613+ switch (S->tccpp_tok) {
614614 case TOK_ASM_asl:
615615 /* fallthrough */
616616 case TOK_ASM_lsl:
@@ -677,15 +677,15 @@ static void asm_data_processing_opcode(TCCState *S, int token) · 60 unmodified lines
677677 uint32_t opcode_nos = opcode_idx >> 1; // without "s"; "OpCode" in ARM docs
678678
679679 for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ) {
680− if (S->tok == TOK_ASM_asl || S->tok == TOK_ASM_lsl || S->tok == TOK_ASM_lsr || S->tok == TOK_ASM_asr || S->tok == TOK_ASM_ror || S->tok == TOK_ASM_rrx)
680+ if (S->tccpp_tok == TOK_ASM_asl || S->tccpp_tok == TOK_ASM_lsl || S->tccpp_tok == TOK_ASM_lsr || S->tccpp_tok == TOK_ASM_asr || S->tccpp_tok == TOK_ASM_ror || S->tccpp_tok == TOK_ASM_rrx)
681681 break;
682682 parse_operand(S, &ops[nb_ops]);
683683 ++nb_ops;
684− if (S->tok != ',')
684+ if (S->tccpp_tok != ',')
685685 break;
686686 next(S); // skip ','
687687 }
688− if (S->tok == ',')
688+ if (S->tccpp_tok == ',')
689689 next(S);
690690 operands |= asm_parse_optional_shift(S, &nb_shift, &shift);
691691 if (nb_ops < 2)
@@ -852,7 +852,7 @@ static void asm_shift_opcode(TCCState *S, int token) · 160 unmodified lines
852852
853853 for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ++nb_ops) {
854854 parse_operand(S, &ops[nb_ops]);
855− if (S->tok != ',') {
855+ if (S->tccpp_tok != ',') {
856856 ++nb_ops;
857857 break;
858858 }
@@ -961,7 +961,7 @@ static void asm_multiplication_opcode(TCCState *S, int token) · 102 unmodified lines
961961
962962 for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ++nb_ops) {
963963 parse_operand(S, &ops[nb_ops]);
964− if (S->tok != ',') {
964+ if (S->tccpp_tok != ',') {
965965 ++nb_ops;
966966 break;
967967 }
@@ -1043,7 +1043,7 @@ static void asm_long_multiplication_opcode(TCCState *S, int token) · 75 unmodified lines
10431043
10441044 for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ++nb_ops) {
10451045 parse_operand(S, &ops[nb_ops]);
1046− if (S->tok != ',') {
1046+ if (S->tccpp_tok != ',') {
10471047 ++nb_ops;
10481048 break;
10491049 }
@@ -1133,7 +1133,7 @@ static void asm_single_data_transfer_opcode(TCCState *S, int token) · 83 unmodified lines
11331133 expect(S, "(destination operand) register");
11341134 return;
11351135 }
1136− if (S->tok != ',')
1136+ if (S->tccpp_tok != ',')
11371137 expect(S, "at least two arguments");
11381138 else
11391139 next(S); // skip ','
@@ -1146,14 +1146,14 @@ static void asm_single_data_transfer_opcode(TCCState *S, int token) · 6 unmodified lines
11461146 expect(S, "register");
11471147 return;
11481148 }
1149− if (S->tok != ',')
1149+ if (S->tccpp_tok != ',')
11501150 expect(S, "at least three arguments");
11511151 else
11521152 next(S); // skip ','
11531153 break;
11541154 }
11551155
1156− if (S->tok != '[')
1156+ if (S->tccpp_tok != '[')
11571157 expect(S, "'['");
11581158 else
11591159 next(S); // skip '['
@@ -1165,14 +1165,14 @@ static void asm_single_data_transfer_opcode(TCCState *S, int token) · 5 unmodified lines
11651165 expect(S, "(first source operand) register");
11661166 return;
11671167 }
1168− if (S->tok == ']') {
1168+ if (S->tccpp_tok == ']') {
11691169 next(S);
11701170 closed_bracket = 1;
11711171 // exclam = 1; // implicit in hardware; don't do it in software
11721172 }
1173− if (S->tok == ',') {
1173+ if (S->tccpp_tok == ',') {
11741174 next(S); // skip ','
1175− if (S->tok == '-') {
1175+ if (S->tccpp_tok == '-') {
11761176 op2_minus = 1;
11771177 next(S);
11781178 }
@@ -1182,7 +1182,7 @@ static void asm_single_data_transfer_opcode(TCCState *S, int token) · 3 unmodified lines
11821182 tcc_error(S, "Using 'pc' for register offset in '%s' is not implemented by ARM", get_tok_str(S, token, NULL));
11831183 return;
11841184 }
1185− if (S->tok == ',') {
1185+ if (S->tccpp_tok == ',') {
11861186 next(S);
11871187 opcode |= asm_parse_optional_shift(S, &nb_shift, &shift);
11881188 if (opcode == 0)
@@ -1196,12 +1196,12 @@ static void asm_single_data_transfer_opcode(TCCState *S, int token) · 7 unmodified lines
11961196 opcode |= 1 << 24; // add offset before transfer
11971197 }
11981198 if (!closed_bracket) {
1199− if (S->tok != ']')
1199+ if (S->tccpp_tok != ']')
12001200 expect(S, "']'");
12011201 else
12021202 next(S); // skip ']'
12031203 opcode |= 1 << 24; // add offset before transfer
1204− if (S->tok == '!') {
1204+ if (S->tccpp_tok == '!') {
12051205 exclam = 1;
12061206 next(S); // skip '!'
12071207 }
@@ -1389,33 +1389,33 @@ static void asm_coprocessor_data_transfer_opcode(TCCState *S, int token) · 181 unmodified lines
13891389 // Note: ldc p2, c0, [r4, #4]! ; pre-indexed: r0 = *(int*)(r4+4); r4 = r4+4
13901390 // Note: ldc p3, c0, [r4], #4 ; post-indexed: r0 = *(int*)(r4+0); r4 = r4+4
13911391
1392− if (S->tok >= TOK_ASM_p0 && S->tok <= TOK_ASM_p15) {
1393− coprocessor = S->tok - TOK_ASM_p0;
1392+ if (S->tccpp_tok >= TOK_ASM_p0 && S->tccpp_tok <= TOK_ASM_p15) {
1393+ coprocessor = S->tccpp_tok - TOK_ASM_p0;
13941394 next(S);
13951395 } else {
13961396 expect(S, "'c<number>'");
13971397 return;
13981398 }
13991399
1400− if (S->tok == ',')
1400+ if (S->tccpp_tok == ',')
14011401 next(S);
14021402 else
14031403 expect(S, "','");
14041404
1405− if (S->tok >= TOK_ASM_c0 && S->tok <= TOK_ASM_c15) {
1406− coprocessor_destination_register = S->tok - TOK_ASM_c0;
1405+ if (S->tccpp_tok >= TOK_ASM_c0 && S->tccpp_tok <= TOK_ASM_c15) {
1406+ coprocessor_destination_register = S->tccpp_tok - TOK_ASM_c0;
14071407 next(S);
14081408 } else {
14091409 expect(S, "'c<number>'");
14101410 return;
14111411 }
14121412
1413− if (S->tok == ',')
1413+ if (S->tccpp_tok == ',')
14141414 next(S);
14151415 else
14161416 expect(S, "','");
14171417
1418− if (S->tok != '[')
1418+ if (S->tccpp_tok != '[')
14191419 expect(S, "'['");
14201420 else
14211421 next(S); // skip '['
@@ -1425,14 +1425,14 @@ static void asm_coprocessor_data_transfer_opcode(TCCState *S, int token) · 3 unmodified lines
14251425 expect(S, "(first source operand) register");
14261426 return;
14271427 }
1428− if (S->tok == ']') {
1428+ if (S->tccpp_tok == ']') {
14291429 next(S);
14301430 closed_bracket = 1;
14311431 // exclam = 1; // implicit in hardware; don't do it in software
14321432 }
1433− if (S->tok == ',') {
1433+ if (S->tccpp_tok == ',') {
14341434 next(S); // skip ','
1435− if (S->tok == '-') {
1435+ if (S->tccpp_tok == '-') {
14361436 op2_minus = 1;
14371437 next(S);
14381438 }
@@ -1453,12 +1453,12 @@ static void asm_coprocessor_data_transfer_opcode(TCCState *S, int token) · 14 unmodified lines
14531453 preincrement = 1; // add offset before transfer
14541454 }
14551455 if (!closed_bracket) {
1456− if (S->tok != ']')
1456+ if (S->tccpp_tok != ']')
14571457 expect(S, "']'");
14581458 else
14591459 next(S); // skip ']'
14601460 preincrement = 1; // add offset before transfer
1461− if (S->tok == '!') {
1461+ if (S->tccpp_tok == '!') {
14621462 exclam = 1;
14631463 next(S); // skip '!'
14641464 }
@@ -1528,12 +1528,12 @@ static void asm_floating_point_single_data_transfer_opcode(TCCState *S, int toke · 63 unmodified lines
15281528 return;
15291529 }
15301530
1531− if (S->tok == ',')
1531+ if (S->tccpp_tok == ',')
15321532 next(S);
15331533 else
15341534 expect(S, "','");
15351535
1536− if (S->tok != '[')
1536+ if (S->tccpp_tok != '[')
15371537 expect(S, "'['");
15381538 else
15391539 next(S); // skip '['
@@ -1543,7 +1543,7 @@ static void asm_floating_point_single_data_transfer_opcode(TCCState *S, int toke · 3 unmodified lines
15431543 expect(S, "(first source operand) register");
15441544 return;
15451545 }
1546− if (S->tok == ',') {
1546+ if (S->tccpp_tok == ',') {
15471547 next(S); // skip ','
15481548 parse_operand(S, &ops[2]);
15491549 if (ops[2].type != OP_IM8 && ops[2].type != OP_IM8N) {
@@ -1555,7 +1555,7 @@ static void asm_floating_point_single_data_transfer_opcode(TCCState *S, int toke · 5 unmodified lines
15551555 ops[2].type = OP_IM8;
15561556 ops[2].e.v = 0;
15571557 }
1558− if (S->tok != ']')
1558+ if (S->tccpp_tok != ']')
15591559 expect(S, "']'");
15601560 else
15611561 next(S); // skip ']'
@@ -1593,11 +1593,11 @@ static void asm_floating_point_block_data_transfer_opcode(TCCState *S, int token · 31 unmodified lines
15931593 break;
15941594 default:
15951595 parse_operand(S, &ops[0]);
1596− if (S->tok == '!') {
1596+ if (S->tccpp_tok == '!') {
15971597 op0_exclam = 1;
15981598 next(S); // skip '!'
15991599 }
1600− if (S->tok == ',')
1600+ if (S->tccpp_tok == ',')
16011601 next(S); // skip comma
16021602 else {
16031603 expect(S, "','");
@@ -1605,16 +1605,16 @@ static void asm_floating_point_block_data_transfer_opcode(TCCState *S, int token · 1 unmodified line
16051605 }
16061606 }
16071607
1608− if (S->tok != '{') {
1608+ if (S->tccpp_tok != '{') {
16091609 expect(S, "'{'");
16101610 return;
16111611 }
16121612 next(S); // skip '{'
1613− first_regset_register = asm_parse_vfp_regvar(S->tok, 1);
1614− if ((first_regset_register = asm_parse_vfp_regvar(S->tok, 1)) != -1) {
1613+ first_regset_register = asm_parse_vfp_regvar(S->tccpp_tok, 1);
1614+ if ((first_regset_register = asm_parse_vfp_regvar(S->tccpp_tok, 1)) != -1) {
16151615 coprocessor = CP_DOUBLE_PRECISION_FLOAT;
16161616 next(S);
1617− } else if ((first_regset_register = asm_parse_vfp_regvar(S->tok, 0)) != -1) {
1617+ } else if ((first_regset_register = asm_parse_vfp_regvar(S->tccpp_tok, 0)) != -1) {
16181618 coprocessor = CP_SINGLE_PRECISION_FLOAT;
16191619 next(S);
16201620 } else {
@@ -1622,9 +1622,9 @@ static void asm_floating_point_block_data_transfer_opcode(TCCState *S, int token · 1 unmodified line
16221622 return;
16231623 }
16241624
1625− if (S->tok == '-') {
1625+ if (S->tccpp_tok == '-') {
16261626 next(S);
1627− if ((last_regset_register = asm_parse_vfp_regvar(S->tok, coprocessor == CP_DOUBLE_PRECISION_FLOAT)) != -1)
1627+ if ((last_regset_register = asm_parse_vfp_regvar(S->tccpp_tok, coprocessor == CP_DOUBLE_PRECISION_FLOAT)) != -1)
16281628 next(S);
16291629 else {
16301630 expect(S, "floating-point register");
@@ -1637,7 +1637,7 @@ static void asm_floating_point_block_data_transfer_opcode(TCCState *S, int token · 6 unmodified lines
16371637 tcc_error(S, "registers will be processed in ascending order by hardware--but are not specified in ascending order here");
16381638 return;
16391639 }
1640− if (S->tok != '}') {
1640+ if (S->tccpp_tok != '}') {
16411641 expect(S, "'}'");
16421642 return;
16431643 }
@@ -1688,7 +1688,7 @@ static void asm_floating_point_block_data_transfer_opcode(TCCState *S, int token · 44 unmodified lines
16881688 #define VMOV_FRACTIONAL_DIGITS 7
16891689 #define VMOV_ONE 10000000 /* pow(10, VMOV_FRACTIONAL_DIGITS) */
16901690
1691−static uint32_t vmov_parse_fractional_part(TCCState *S, const char* s)
1691+static uint32_t vmov_parse_fractional_part(TCCState* S, const char* s)
16921692 {
16931693 uint32_t result = 0;
16941694 int i;
@@ -1720,16 +1720,16 @@ static int vmov_linear_approx_index(uint32_t beginning, uint32_t end, uint32_t v · 25 unmodified lines
17201720 return -1;
17211721 }
17221722
1723−static uint32_t vmov_parse_immediate_value(TCCState *S) {
1723+static uint32_t vmov_parse_immediate_value(TCCState* S) {
17241724 uint32_t value;
17251725 unsigned long integral_value;
17261726 const char *p;
17271727
1728− if (S->tok != TOK_PPNUM) {
1728+ if (S->tccpp_tok != TOK_PPNUM) {
17291729 expect(S, "immediate value");
17301730 return 0;
17311731 }
1732− p = S->tokc.str.data;
1732+ p = S->tccpp_tokc.str.data;
17331733 errno = 0;
17341734 integral_value = strtoul(p, (char **)&p, 0);
17351735
@@ -1747,7 +1747,7 @@ static uint32_t vmov_parse_immediate_value(TCCState *S) { · 11 unmodified lines
17471747 return value;
17481748 }
17491749
1750−static uint8_t vmov_encode_immediate_value(TCCState *S, uint32_t value)
1750+static uint8_t vmov_encode_immediate_value(TCCState* S, uint32_t value)
17511751 {
17521752 uint32_t limit;
17531753 uint32_t end = 0;
@@ -1785,10 +1785,10 @@ static void asm_floating_point_immediate_data_processing_opcode_tail(TCCState *S · 31 unmodified lines
17851785
17861786 operands[0] = CRd;
17871787
1788− if (S->tok == '#' || S->tok == '$') {
1788+ if (S->tccpp_tok == '#' || S->tccpp_tok == '$') {
17891789 next(S);
17901790 }
1791− if (S->tok == '-') {
1791+ if (S->tccpp_tok == '-') {
17921792 op_minus = 1;
17931793 next(S);
17941794 }
@@ -1956,7 +1956,7 @@ static void asm_floating_point_vcvt_data_processing_opcode(TCCState *S, int toke · 161 unmodified lines
19561956 break;
19571957 }
19581958
1959− if (S->tok == ',')
1959+ if (S->tccpp_tok == ',')
19601960 next(S);
19611961 else
19621962 expect(S, "','");
@@ -2078,7 +2078,7 @@ static void asm_floating_point_data_processing_opcode(TCCState *S, int token) { · 115 unmodified lines
20782078
20792079 for (nb_ops = 0; nb_ops < 3; ) {
20802080 // Note: Necessary because parse_operand can't parse decimal numerals.
2081− if (nb_ops == 1 && (S->tok == '#' || S->tok == '$' || S->tok == TOK_PPNUM || S->tok == '-')) {
2081+ if (nb_ops == 1 && (S->tccpp_tok == '#' || S->tccpp_tok == '$' || S->tccpp_tok == TOK_PPNUM || S->tccpp_tok == '-')) {
20822082 asm_floating_point_immediate_data_processing_opcode_tail(S, token, coprocessor, ops[0].reg);
20832083 return;
20842084 }
@@ -2100,7 +2100,7 @@ static void asm_floating_point_data_processing_opcode(TCCState *S, int token) { · 15 unmodified lines
21002100 return;
21012101 }
21022102 ++nb_ops;
2103− if (S->tok == ',')
2103+ if (S->tccpp_tok == ',')
21042104 next(S);
21052105 else
21062106 break;
@@ -2239,7 +2239,7 @@ static void asm_floating_point_data_processing_opcode(TCCState *S, int token) { · 132 unmodified lines
22392239 asm_emit_coprocessor_opcode(S, condition_code_of_token(S, token), coprocessor, opcode1, ops[0].reg, (ops[1].type == OP_IM8) ? ops[1].e.v : ops[1].reg, (ops[2].type == OP_IM8) ? ops[2].e.v : ops[2].reg, opcode2, 0);
22402240 }
22412241
2242−static void asm_floating_point_status_register_opcode(TCCState *S, int token)
2242+static void asm_floating_point_status_register_opcode(TCCState* S, int token)
22432243 {
22442244 uint8_t coprocessor = CP_SINGLE_PRECISION_FLOAT;
22452245 uint8_t opcode;
@@ -2248,7 +2248,7 @@ static void asm_floating_point_status_register_opcode(TCCState *S, int token) · 2 unmodified lines
22482248 switch (ARM_INSTRUCTION_GROUP(token)) {
22492249 case TOK_ASM_vmrseq:
22502250 opcode = 0xf;
2251− if (S->tok == TOK_ASM_apsr_nzcv) {
2251+ if (S->tccpp_tok == TOK_ASM_apsr_nzcv) {
22522252 arm_operand.type = OP_REG32;
22532253 arm_operand.reg = 15; // not PC
22542254 next(S); // skip apsr_nzcv
@@ -2260,11 +2260,11 @@ static void asm_floating_point_status_register_opcode(TCCState *S, int token) · 5 unmodified lines
22602260 }
22612261 }
22622262
2263− if (S->tok != ',')
2263+ if (S->tccpp_tok != ',')
22642264 expect(S, "','");
22652265 else
22662266 next(S); // skip ','
2267− vfp_sys_reg = asm_parse_vfp_status_regvar(S->tok);
2267+ vfp_sys_reg = asm_parse_vfp_status_regvar(S->tccpp_tok);
22682268 next(S); // skip vfp sys reg
22692269 if (arm_operand.type == OP_REG32 && arm_operand.reg == 15 && vfp_sys_reg != 1) {
22702270 tcc_error(S, "'%s' only supports the variant 'vmrs apsr_nzcv, fpscr' here", get_tok_str(S, token, NULL));
@@ -2273,9 +2273,9 @@ static void asm_floating_point_status_register_opcode(TCCState *S, int token) · 2 unmodified lines
22732273 break;
22742274 case TOK_ASM_vmsreq:
22752275 opcode = 0xe;
2276− vfp_sys_reg = asm_parse_vfp_status_regvar(S->tok);
2276+ vfp_sys_reg = asm_parse_vfp_status_regvar(S->tccpp_tok);
22772277 next(S); // skip vfp sys reg
2278− if (S->tok != ',')
2278+ if (S->tccpp_tok != ',')
22792279 expect(S, "','");
22802280 else
22812281 next(S); // skip ','
@@ -2329,12 +2329,12 @@ static void asm_misc_single_data_transfer_opcode(TCCState *S, int token) · 47 unmodified lines
23292329 expect(S, "(destination operand) register");
23302330 return;
23312331 }
2332− if (S->tok != ',')
2332+ if (S->tccpp_tok != ',')
23332333 expect(S, "at least two arguments");
23342334 else
23352335 next(S); // skip ','
23362336
2337− if (S->tok != '[')
2337+ if (S->tccpp_tok != '[')
23382338 expect(S, "'['");
23392339 else
23402340 next(S); // skip '['
@@ -2346,14 +2346,14 @@ static void asm_misc_single_data_transfer_opcode(TCCState *S, int token) · 5 unmodified lines
23462346 expect(S, "(first source operand) register");
23472347 return;
23482348 }
2349− if (S->tok == ']') {
2349+ if (S->tccpp_tok == ']') {
23502350 next(S);
23512351 closed_bracket = 1;
23522352 // exclam = 1; // implicit in hardware; don't do it in software
23532353 }
2354− if (S->tok == ',') {
2354+ if (S->tccpp_tok == ',') {
23552355 next(S); // skip ','
2356− if (S->tok == '-') {
2356+ if (S->tccpp_tok == '-') {
23572357 op2_minus = 1;
23582358 next(S);
23592359 }
@@ -2365,12 +2365,12 @@ static void asm_misc_single_data_transfer_opcode(TCCState *S, int token) · 5 unmodified lines
23652365 opcode |= 1 << 24; // add offset before transfer
23662366 }
23672367 if (!closed_bracket) {
2368− if (S->tok != ']')
2368+ if (S->tccpp_tok != ']')
23692369 expect(S, "']'");
23702370 else
23712371 next(S); // skip ']'
23722372 opcode |= 1 << 24; // add offset before transfer
2373− if (S->tok == '!') {
2373+ if (S->tccpp_tok == '!') {
23742374 exclam = 1;
23752375 next(S); // skip '!'
23762376 }
@@ -2439,7 +2439,7 @@ static void asm_misc_single_data_transfer_opcode(TCCState *S, int token) · 62 unmodified lines
24392439 }
24402440
24412441 /* Note: almost dupe of encbranch in arm-gen.c */
2442−static uint32_t encbranchoffset(TCCState *S, int pos, int addr, int fail)
2442+static uint32_t encbranchoffset(TCCState* S, int pos, int addr, int fail)
24432443 {
24442444 addr-=pos+8;
24452445 addr/=4;
@@ -2467,7 +2467,7 @@ static void asm_branch_opcode(TCCState *S, int token) · 21 unmodified lines
24672467 tcc_error(S, "invalid branch target");
24682468 return;
24692469 }
2470− jmp_disp = encbranchoffset(S, S->ind, e.v + esym->st_value, 1);
2470+ jmp_disp = encbranchoffset(S, S->tccgen_ind, e.v + esym->st_value, 1);
24712471 break;
24722472 default:
24732473 parse_operand(S, &op);
@@ -2501,7 +2501,7 @@ ST_FUNC void asm_opcode(TCCState *S, int token) · 27 unmodified lines
25012501 {
25022502 while (token == TOK_LINEFEED) {
25032503 next(S);
2504− token = S->tok;
2504+ token = S->tccpp_tok;
25052505 }
25062506 if (token == TOK_EOF)
25072507 return;
@@ -2737,7 +2737,7 @@ ST_FUNC void asm_opcode(TCCState *S, int token) · 229 unmodified lines
27372737 }
27382738 }
27392739
2740−ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str, SValue *sv, int modifier)
2740+ST_FUNC void subst_asm_operand(TCCState* S, CString *add_str, SValue *sv, int modifier)
27412741 {
27422742 int r, reg, size, val;
27432743 char buf[64];
@@ -2814,7 +2814,7 @@ ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str, SValue *sv, int mo · 70 unmodified lines
28142814 }
28152815
28162816 /* generate prolog and epilog code for asm statement */
2817−ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands,
2817+ST_FUNC void asm_gen_code(TCCState* S, ASMOperand *operands, int nb_operands,
28182818 int nb_outputs, int is_output,
28192819 uint8_t *clobber_regs,
28202820 int out_reg)
@@ -2900,7 +2900,7 @@ ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands, · 79 unmodified lines
29002900
29012901 /* return the constraint priority (we allocate first the lowest
29022902 numbered constraints) */
2903−static inline int constraint_priority(TCCState *S, const char *str)
2903+static inline int constraint_priority(TCCState* S, const char *str)
29042904 {
29052905 int priority, c, pr;
29062906
@@ -2956,7 +2956,7 @@ static const char *skip_constraint_modifiers(const char *p) · 49 unmodified lines
29562956
29572957 #define is_reg_allocated(reg) (regs_allocated[reg] & reg_mask)
29582958
2959−ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands,
2959+ST_FUNC void asm_compute_constraints(TCCState* S, ASMOperand *operands,
29602960 int nb_operands, int nb_outputs,
29612961 const uint8_t *clobber_regs,
29622962 int *pout_reg)
@@ -3191,7 +3191,7 @@ ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands, · 228 unmodified lines
31913191 #endif
31923192 }
31933193
3194−ST_FUNC void asm_clobber(TCCState *S, uint8_t *clobber_regs, const char *str)
3194+ST_FUNC void asm_clobber(TCCState* S, uint8_t *clobber_regs, const char *str)
31953195 {
31963196 int reg;
31973197 TokenSym *ts;
arm-gen.c+187−187
@@ -216,13 +216,13 @@ ST_FUNC void arm_init(struct TCCState *s) · 215 unmodified lines
216216
217217 #define CHECK_R(r) ((r) >= TREG_R0 && (r) <= TREG_LR)
218218
219−static int two2mask(TCCState *S, int a,int b) {
219+static int two2mask(TCCState* S, int a,int b) {
220220 if (!CHECK_R(a) || !CHECK_R(b))
221221 tcc_error(S, "compiler error! registers %i,%i is not valid",a,b);
222222 return (reg_classes[a]|reg_classes[b])&~(RC_INT|RC_FLOAT);
223223 }
224224
225−static int regmask(TCCState *S, int r) {
225+static int regmask(TCCState* S, int r) {
226226 if (!CHECK_R(r))
227227 tcc_error(S, "compiler error! register %i is not valid",r);
228228 return reg_classes[r]&~(RC_INT|RC_FLOAT);
@@ -240,25 +240,25 @@ const char *default_elfinterp(struct TCCState *s) · 11 unmodified lines
240240 }
241241 #endif
242242
243−void o(TCCState *S, uint32_t i)
243+void o(TCCState* S, uint32_t i)
244244 {
245245 /* this is a good place to start adding big-endian support*/
246246 int ind1;
247− if (S->nocode_wanted)
247+ if (S->tccgen_nocode_wanted)
248248 return;
249− ind1 = S->ind + 4;
249+ ind1 = S->tccgen_ind + 4;
250250 if (!cur_text_section)
251251 tcc_error(S, "compiler error! This happens f.ex. if the compiler\n"
252252 "can't evaluate constant expressions outside of a function.");
253253 if (ind1 > cur_text_section->data_allocated)
254254 section_realloc(S, cur_text_section, ind1);
255− cur_text_section->data[S->ind++] = i&255;
255+ cur_text_section->data[S->tccgen_ind++] = i&255;
256256 i>>=8;
257− cur_text_section->data[S->ind++] = i&255;
257+ cur_text_section->data[S->tccgen_ind++] = i&255;
258258 i>>=8;
259− cur_text_section->data[S->ind++] = i&255;
259+ cur_text_section->data[S->tccgen_ind++] = i&255;
260260 i>>=8;
261− cur_text_section->data[S->ind++] = i;
261+ cur_text_section->data[S->tccgen_ind++] = i;
262262 }
263263
264264 static uint32_t stuff_const(uint32_t op, uint32_t c)
@@ -315,7 +315,7 @@ static uint32_t stuff_const(uint32_t op, uint32_t c) · 50 unmodified lines
315315
316316
317317 //only add,sub
318−void stuff_const_harder(TCCState *S, uint32_t op, uint32_t v) {
318+void stuff_const_harder(TCCState* S, uint32_t op, uint32_t v) {
319319 uint32_t x;
320320 x=stuff_const(op,v);
321321 if(x)
@@ -371,7 +371,7 @@ void stuff_const_harder(TCCState *S, uint32_t op, uint32_t v) { · 49 unmodified lines
371371 }
372372 }
373373
374−uint32_t encbranch(TCCState *S, int pos, int addr, int fail)
374+uint32_t encbranch(TCCState* S, int pos, int addr, int fail)
375375 {
376376 addr-=pos+8;
377377 addr/=4;
@@ -383,7 +383,7 @@ uint32_t encbranch(TCCState *S, int pos, int addr, int fail) · 5 unmodified lines
383383 return 0x0A000000|(addr&0xffffff);
384384 }
385385
386−int decbranch(TCCState *S, int pos)
386+int decbranch(TCCState* S, int pos)
387387 {
388388 int x;
389389 x=*(uint32_t *)(cur_text_section->data + pos);
@@ -394,7 +394,7 @@ int decbranch(TCCState *S, int pos) · 4 unmodified lines
394394 }
395395
396396 /* output a symbol and patch all calls to it */
397−void gsym_addr(TCCState *S, int t, int a)
397+void gsym_addr(TCCState* S, int t, int a)
398398 {
399399 uint32_t *x;
400400 int lt;
@@ -411,14 +411,14 @@ void gsym_addr(TCCState *S, int t, int a) · 10 unmodified lines
411411 }
412412
413413 #ifdef TCC_ARM_VFP
414−static uint32_t vfpr(TCCState *S, int r)
414+static uint32_t vfpr(TCCState* S, int r)
415415 {
416416 if(r<TREG_F0 || r>TREG_F7)
417417 tcc_error(S, "compiler error! register %i is no vfp register",r);
418418 return r - TREG_F0;
419419 }
420420 #else
421−static uint32_t fpr(TCCState *S, int r)
421+static uint32_t fpr(TCCState* S, int r)
422422 {
423423 if(r<TREG_F0 || r>TREG_F3)
424424 tcc_error(S, "compiler error! register %i is no fpa register",r);
@@ -426,7 +426,7 @@ static uint32_t fpr(TCCState *S, int r) · 1 unmodified line
426426 }
427427 #endif
428428
429−static uint32_t intr(TCCState *S, int r)
429+static uint32_t intr(TCCState* S, int r)
430430 {
431431 if(r == TREG_R12)
432432 return 12;
@@ -437,7 +437,7 @@ static uint32_t intr(TCCState *S, int r) · 4 unmodified lines
437437 return r + (13 - TREG_SP);
438438 }
439439
440−static void calcaddr(TCCState *S, uint32_t *base, int *off, int *sgn, int maxoff, unsigned shift)
440+static void calcaddr(TCCState* S, uint32_t *base, int *off, int *sgn, int maxoff, unsigned shift)
441441 {
442442 if(*off>maxoff || *off&((1<<shift)-1)) {
443443 uint32_t x, y;
@@ -464,7 +464,7 @@ static void calcaddr(TCCState *S, uint32_t *base, int *off, int *sgn, int maxoff · 20 unmodified lines
464464 }
465465 }
466466
467−static uint32_t mapcc(TCCState *S, int cc)
467+static uint32_t mapcc(TCCState* S, int cc)
468468 {
469469 switch(cc)
470470 {
@@ -497,7 +497,7 @@ static uint32_t mapcc(TCCState *S, int cc) · 26 unmodified lines
497497 return 0xE0000000; /* AL */
498498 }
499499
500−static int negcc(TCCState *S, int cc)
500+static int negcc(TCCState* S, int cc)
501501 {
502502 switch(cc)
503503 {
@@ -532,13 +532,13 @@ static int negcc(TCCState *S, int cc) · 28 unmodified lines
532532
533533 /* Load value into register r.
534534 Use relative/got addressing to avoid setting DT_TEXTREL */
535−static void load_value(TCCState *S, SValue *sv, int r)
535+static void load_value(TCCState* S, SValue *sv, int r)
536536 {
537537 o(S, 0xE59F0000|(intr(S, r)<<12)); /* ldr r, [pc] */
538538 o(S, 0xEA000000); /* b $+4 */
539539 #ifndef CONFIG_TCC_PIE
540540 if(sv->r & VT_SYM)
541− greloc(S, cur_text_section, sv->sym, S->ind, R_ARM_ABS32);
541+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind, R_ARM_ABS32);
542542 o(S, sv->c.i);
543543 #else
544544 if(sv->r & VT_SYM) {
@@ -563,7 +563,7 @@ static void load_value(TCCState *S, SValue *sv, int r) · 18 unmodified lines
563563 }
564564
565565 /* load 'r' from value 'sv' */
566−void load(TCCState *S, int r, SValue *sv)
566+void load(TCCState* S, int r, SValue *sv)
567567 {
568568 int v, ft, fc, fr, sign;
569569 uint32_t op;
@@ -696,7 +696,7 @@ void load(TCCState *S, int r, SValue *sv) · 126 unmodified lines
696696 }
697697
698698 /* store register 'r' in lvalue 'v' */
699−void store(TCCState *S, int r, SValue *sv)
699+void store(TCCState* S, int r, SValue *sv)
700700 {
701701 SValue v1;
702702 int v, ft, fc, fr, sign;
@@ -777,27 +777,27 @@ void store(TCCState *S, int r, SValue *sv) · 74 unmodified lines
777777 tcc_error(S, "store unimplemented");
778778 }
779779
780−static void gadd_sp(TCCState *S, int val)
780+static void gadd_sp(TCCState* S, int val)
781781 {
782782 stuff_const_harder(S, 0xE28DD000,val);
783783 }
784784
785785 /* 'is_jmp' is '1' if it is a jump */
786−static void gcall_or_jmp(TCCState *S, int is_jmp)
786+static void gcall_or_jmp(TCCState* S, int is_jmp)
787787 {
788788 int r;
789789 uint32_t x;
790− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
790+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
791791 /* constant case */
792− if(S->vtop->r & VT_SYM){
793− x=encbranch(S, S->ind, S->ind+S->vtop->c.i,0);
792+ if(S->tccgen_vtop->r & VT_SYM){
793+ x=encbranch(S, S->tccgen_ind, S->tccgen_ind+S->tccgen_vtop->c.i,0);
794794 if(x) {
795795 /* relocation case */
796− greloc(S, cur_text_section, S->vtop->sym, S->ind, R_ARM_PC24);
796+ greloc(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind, R_ARM_PC24);
797797 o(S, x|(is_jmp?0xE0000000:0xE1000000));
798798 } else {
799799 r = TREG_LR;
800− load_value(S, S->vtop, r);
800+ load_value(S, S->tccgen_vtop, r);
801801 if(is_jmp)
802802 o(S, 0xE1A0F000 | intr(S, r)); // mov pc, r
803803 else
@@ -807,12 +807,12 @@ static void gcall_or_jmp(TCCState *S, int is_jmp) · 3 unmodified lines
807807 if(!is_jmp)
808808 o(S, 0xE28FE004); // add lr,pc,#4
809809 o(S, 0xE51FF004); // ldr pc,[pc,#-4]
810− o(S, S->vtop->c.i);
810+ o(S, S->tccgen_vtop->c.i);
811811 }
812812 } else {
813813 /* otherwise, indirect call */
814814 #ifdef CONFIG_TCC_BCHECK
815− S->vtop->r &= ~VT_MUSTBOUND;
815+ S->tccgen_vtop->r &= ~VT_MUSTBOUND;
816816 #endif
817817 r = gv(S, RC_INT);
818818 if(!is_jmp)
@@ -823,19 +823,19 @@ static void gcall_or_jmp(TCCState *S, int is_jmp) · 4 unmodified lines
823823
824824 #if defined(CONFIG_TCC_BCHECK)
825825
826−static void gen_bounds_call(TCCState *S, int v)
826+static void gen_bounds_call(TCCState* S, int v)
827827 {
828828 Sym *sym = external_helper_sym(S, v);
829829
830− greloc(S, cur_text_section, sym, S->ind, R_ARM_PC24);
830+ greloc(S, cur_text_section, sym, S->tccgen_ind, R_ARM_PC24);
831831 o(S, 0xebfffffe);
832832 }
833833
834−static void gen_bounds_prolog(TCCState *S)
834+static void gen_bounds_prolog(TCCState* S)
835835 {
836836 /* leave some room for bound checking code */
837837 S->func_bound_offset = lbounds_section->data_offset;
838− S->func_bound_ind = S->ind;
838+ S->func_bound_ind = S->tccgen_ind;
839839 S->func_bound_add_epilog = 0;
840840 o(S, 0xe1a00000); /* ld r0,lbounds_section->data_offset */
841841 o(S, 0xe1a00000);
@@ -844,7 +844,7 @@ static void gen_bounds_prolog(TCCState *S) · 2 unmodified lines
844844 o(S, 0xe1a00000); /* call __bound_local_new */
845845 }
846846
847−static void gen_bounds_epilog(TCCState *S)
847+static void gen_bounds_epilog(TCCState* S)
848848 {
849849 addr_t saved_ind;
850850 addr_t *bounds_ptr;
@@ -858,20 +858,20 @@ static void gen_bounds_epilog(TCCState *S) · 7 unmodified lines
858858 bounds_ptr = section_ptr_add(S, lbounds_section, sizeof(addr_t));
859859 *bounds_ptr = 0;
860860
861− sym_data = get_sym_ref(S, &S->char_pointer_type, lbounds_section,
861+ sym_data = get_sym_ref(S, &S->tccgen_char_pointer_type, lbounds_section,
862862 S->func_bound_offset, lbounds_section->data_offset);
863863
864864 /* generate bound local allocation */
865865 if (offset_modified) {
866− saved_ind = S->ind;
867− S->ind = S->func_bound_ind;
866+ saved_ind = S->tccgen_ind;
867+ S->tccgen_ind = S->func_bound_ind;
868868 o(S, 0xe59f0000); /* ldr r0, [pc] */
869869 o(S, 0xea000000); /* b $+4 */
870− greloc(S, cur_text_section, sym_data, S->ind, R_ARM_REL32);
870+ greloc(S, cur_text_section, sym_data, S->tccgen_ind, R_ARM_REL32);
871871 o(S, -12); /* lbounds_section->data_offset */
872872 o(S, 0xe080000f); /* add r0,r0,pc */
873873 gen_bounds_call(S, TOK___bound_local_new);
874− S->ind = saved_ind;
874+ S->tccgen_ind = saved_ind;
875875 }
876876
877877 /* generate bound check local freeing */
@@ -879,7 +879,7 @@ static void gen_bounds_epilog(TCCState *S) · 1 unmodified line
879879 o(S, 0xed2d0b02); /* vpush {d0} */
880880 o(S, 0xe59f0000); /* ldr r0, [pc] */
881881 o(S, 0xea000000); /* b $+4 */
882− greloc(S, cur_text_section, sym_data, S->ind, R_ARM_REL32);
882+ greloc(S, cur_text_section, sym_data, S->tccgen_ind, R_ARM_REL32);
883883 o(S, -12); /* lbounds_section->data_offset */
884884 o(S, 0xe080000f); /* add r0,r0,pc */
885885 gen_bounds_call(S, TOK___bound_local_delete);
@@ -1081,12 +1081,12 @@ static int assign_regs(TCCState *S, int nb_args, int float_abi, struct plan *pla · 195 unmodified lines
10811081
10821082 for(i = nb_args; i-- ;) {
10831083 int j, start_vfpreg = 0;
1084− CType type = S->vtop[-i].type;
1084+ CType type = S->tccgen_vtop[-i].type;
10851085 type.t &= ~VT_ARRAY;
10861086 size = type_size(&type, &align);
10871087 size = (size + 3) & ~3;
10881088 align = (align + 3) & ~3;
1089− switch(S->vtop[-i].type.t & VT_BTYPE) {
1089+ switch(S->tccgen_vtop[-i].type.t & VT_BTYPE) {
10901090 case VT_STRUCT:
10911091 case VT_FLOAT:
10921092 case VT_DOUBLE:
@@ -1094,15 +1094,15 @@ static int assign_regs(TCCState *S, int nb_args, int float_abi, struct plan *pla · 1 unmodified line
10941094 if (float_abi == ARM_HARD_FLOAT) {
10951095 int is_hfa = 0; /* Homogeneous float aggregate */
10961096
1097− if (is_float(S->vtop[-i].type.t)
1098− || (is_hfa = is_hgen_float_aggr(&S->vtop[-i].type))) {
1097+ if (is_float(S->tccgen_vtop[-i].type.t)
1098+ || (is_hfa = is_hgen_float_aggr(&S->tccgen_vtop[-i].type))) {
10991099 int end_vfpreg;
11001100
11011101 start_vfpreg = assign_vfpreg(&avregs, align, size);
11021102 end_vfpreg = start_vfpreg + ((size - 1) >> 2);
11031103 if (start_vfpreg >= 0) {
11041104 add_param_plan(plan, is_hfa ? VFP_STRUCT_CLASS : VFP_CLASS,
1105− start_vfpreg, end_vfpreg, &S->vtop[-i]);
1105+ start_vfpreg, end_vfpreg, &S->tccgen_vtop[-i]);
11061106 continue;
11071107 } else
11081108 break;
@@ -1115,7 +1115,7 @@ static int assign_regs(TCCState *S, int nb_args, int float_abi, struct plan *pla · 6 unmodified lines
11151115 * CORE_STRUCT_CLASS or the first of STACK_CLASS. */
11161116 for (j = ncrn; j < 4 && j < ncrn + size / 4; j++)
11171117 *todo|=(1<<j);
1118− add_param_plan(plan, CORE_STRUCT_CLASS, ncrn, j, &S->vtop[-i]);
1118+ add_param_plan(plan, CORE_STRUCT_CLASS, ncrn, j, &S->tccgen_vtop[-i]);
11191119 ncrn += size/4;
11201120 if (ncrn > 4)
11211121 nsaa = (ncrn - 4) * 4;
@@ -1126,20 +1126,20 @@ static int assign_regs(TCCState *S, int nb_args, int float_abi, struct plan *pla · 4 unmodified lines
11261126 continue;
11271127 default:
11281128 if (ncrn < 4) {
1129− int is_long = (S->vtop[-i].type.t & VT_BTYPE) == VT_LLONG;
1129+ int is_long = (S->tccgen_vtop[-i].type.t & VT_BTYPE) == VT_LLONG;
11301130
11311131 if (is_long) {
11321132 ncrn = (ncrn + 1) & -2;
11331133 if (ncrn == 4)
11341134 break;
11351135 }
1136− add_param_plan(plan, CORE_CLASS, ncrn, ncrn + is_long, &S->vtop[-i]);
1136+ add_param_plan(plan, CORE_CLASS, ncrn, ncrn + is_long, &S->tccgen_vtop[-i]);
11371137 ncrn += 1 + is_long;
11381138 continue;
11391139 }
11401140 }
11411141 nsaa = (nsaa + (align - 1)) & ~(align - 1);
1142− add_param_plan(plan, STACK_CLASS, nsaa, nsaa + size, &S->vtop[-i]);
1142+ add_param_plan(plan, STACK_CLASS, nsaa, nsaa + size, &S->tccgen_vtop[-i]);
11431143 nsaa += size; /* size already rounded up before */
11441144 }
11451145 return nsaa;
@@ -1153,7 +1153,7 @@ static int assign_regs(TCCState *S, int nb_args, int float_abi, struct plan *pla · 7 unmodified lines
11531153 todo: a bitmap indicating what core reg will hold a parameter
11541154
11551155 Returns the number of SValue added by this function on the value stack */
1156−static int copy_params(TCCState *S, int nb_args, struct plan *plan, int todo)
1156+static int copy_params(TCCState* S, int nb_args, struct plan *plan, int todo)
11571157 {
11581158 int size, align, r, i, nb_extra_sval = 0;
11591159 struct param_plan *pplan;
@@ -1201,7 +1201,7 @@ again: · 41 unmodified lines
12011201 /* generate structure store */
12021202 r = get_reg(S, RC_INT);
12031203 o(S, 0xE28D0000|(intr(S, r)<<12)|padding); /* add r, sp, padding */
1204− vset(S, &S->vtop->type, r | VT_LVAL, 0);
1204+ vset(S, &S->tccgen_vtop->type, r | VT_LVAL, 0);
12051205 vswap(S);
12061206 /* XXX: optimize. Save all register because memcpy can use them */
12071207 o(S, 0xED2D0A00|(0&1)<<22|(0>>1)<<12|16); /* vpush {s0-s15} */
@@ -1255,7 +1255,7 @@ again: · 47 unmodified lines
12551255 size = 8;
12561256 r = gv(S, RC_INT);
12571257 o(S, 0xE52D0004|(intr(S, r)<<12)); /* push r */
1258− S->vtop--;
1258+ S->tccgen_vtop--;
12591259 }
12601260 r = gv(S, RC_INT);
12611261 o(S, 0xE52D0004|(intr(S, r)<<12)); /* push r */
@@ -1269,7 +1269,7 @@ again: · 7 unmodified lines
12691269 gv(S, regmask(S, TREG_F0 + (pplan->start >> 1)));
12701270 if (pplan->start & 1) { /* Must be in upper part of double register */
12711271 o(S, 0xEEF00A40|((pplan->start>>1)<<12)|(pplan->start>>1)); /* vmov.f32 s(n+1), sn */
1272− S->vtop->r = VT_CONST; /* avoid being saved on stack by gv for next float */
1272+ S->tccgen_vtop->r = VT_CONST; /* avoid being saved on stack by gv for next float */
12731273 }
12741274 break;
12751275
@@ -1277,16 +1277,16 @@ again: · 1 unmodified line
12771277 if ((pplan->sval->type.t & VT_BTYPE) == VT_LLONG) {
12781278 lexpand(S);
12791279 gv(S, regmask(S, pplan->end));
1280− pplan->sval->r2 = S->vtop->r;
1281− S->vtop--;
1280+ pplan->sval->r2 = S->tccgen_vtop->r;
1281+ S->tccgen_vtop--;
12821282 }
12831283 gv(S, regmask(S, pplan->start));
12841284 /* Mark register as used so that gcall_or_jmp use another one
12851285 (regs >=4 are free as never used to pass parameters) */
1286− pplan->sval->r = S->vtop->r;
1286+ pplan->sval->r = S->tccgen_vtop->r;
12871287 break;
12881288 }
1289− S->vtop--;
1289+ S->tccgen_vtop--;
12901290 }
12911291 }
12921292
@@ -1312,7 +1312,7 @@ again: · 19 unmodified lines
13121312 if (todo & (1 << r)) {
13131313 nb_extra_sval++;
13141314 vpushi(S, 0);
1315− S->vtop->r = r;
1315+ S->tccgen_vtop->r = r;
13161316 }
13171317 }
13181318 }
@@ -1323,7 +1323,7 @@ again: · 4 unmodified lines
13231323 /* Generate function call. The function address is pushed first, then
13241324 all the parameters in call order. This functions pops all the
13251325 parameters and the function address. */
1326−void gfunc_call(TCCState *S, int nb_args)
1326+void gfunc_call(TCCState* S, int nb_args)
13271327 {
13281328 int r, args_size;
13291329 int def_float_abi = float_abi;
@@ -1340,15 +1340,15 @@ void gfunc_call(TCCState *S, int nb_args) · 10 unmodified lines
13401340
13411341 #ifdef TCC_ARM_EABI
13421342 if (float_abi == ARM_HARD_FLOAT) {
1343− variadic = (S->vtop[-nb_args].type.ref->f.func_type == FUNC_ELLIPSIS);
1344− if (variadic || floats_in_core_regs(&S->vtop[-nb_args]))
1343+ variadic = (S->tccgen_vtop[-nb_args].type.ref->f.func_type == FUNC_ELLIPSIS);
1344+ if (variadic || floats_in_core_regs(&S->tccgen_vtop[-nb_args]))
13451345 float_abi = ARM_SOFTFP_FLOAT;
13461346 }
13471347 #endif
13481348 /* cannot let cpu flags if other instruction are generated. Also avoid leaving
13491349 VT_JMP anywhere except on the top of the stack because it would complicate
13501350 the code generator. */
1351− r = S->vtop->r & VT_VALMASK;
1351+ r = S->tccgen_vtop->r & VT_VALMASK;
13521352 if (r == VT_CMP || (r & ~1) == VT_JMP)
13531353 gv(S, RC_INT);
13541354
@@ -1374,8 +1374,8 @@ void gfunc_call(TCCState *S, int nb_args) · 19 unmodified lines
13741374 if (args_size)
13751375 gadd_sp(S, args_size); /* pop all parameters passed on the stack */
13761376 #if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP)
1377− if(float_abi == ARM_SOFTFP_FLOAT && is_float(S->vtop->type.ref->type.t)) {
1378− if((S->vtop->type.ref->type.t & VT_BTYPE) == VT_FLOAT) {
1377+ if(float_abi == ARM_SOFTFP_FLOAT && is_float(S->tccgen_vtop->type.ref->type.t)) {
1378+ if((S->tccgen_vtop->type.ref->type.t & VT_BTYPE) == VT_FLOAT) {
13791379 o(S, 0xEE000A10); /*vmov s0, r0 */
13801380 } else {
13811381 o(S, 0xEE000B10); /* vmov.32 d0[0], r0 */
@@ -1383,13 +1383,13 @@ void gfunc_call(TCCState *S, int nb_args) · 1 unmodified line
13831383 }
13841384 }
13851385 #endif
1386− S->vtop -= nb_args + 1; /* Pop all params and fct address from value stack */
1386+ S->tccgen_vtop -= nb_args + 1; /* Pop all params and fct address from value stack */
13871387 leaffunc = 0; /* we are calling a function, so we aren't in a leaf function */
13881388 float_abi = def_float_abi;
13891389 }
13901390
13911391 /* generate function prolog of type 't' */
1392−void gfunc_prolog(TCCState *S, Sym *func_sym)
1392+void gfunc_prolog(TCCState* S, Sym *func_sym)
13931393 {
13941394 CType *func_type = &func_sym->type;
13951395 Sym *sym,*sym2;
@@ -1443,7 +1443,7 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 47 unmodified lines
14431443 }
14441444 o(S, 0xE92D5800); /* save fp, ip, lr */
14451445 o(S, 0xE1A0B00D); /* mov fp, sp */
1446− func_sub_sp_offset = S->ind;
1446+ func_sub_sp_offset = S->tccgen_ind;
14471447 o(S, 0xE1A00000); /* nop, leave space for stack adjustment in epilog */
14481448
14491449 #ifdef TCC_ARM_EABI
@@ -1490,7 +1490,7 @@ from_stack: · 40 unmodified lines
14901490 }
14911491 last_itod_magic=0;
14921492 leaffunc = 1;
1493− S->loc = 0;
1493+ S->tccgen_loc = 0;
14941494 #ifdef CONFIG_TCC_BCHECK
14951495 if (S->do_bounds_check)
14961496 gen_bounds_prolog(S);
@@ -1498,7 +1498,7 @@ from_stack: · 1 unmodified line
14981498 }
14991499
15001500 /* generate function epilog */
1501−void gfunc_epilog(TCCState *S)
1501+void gfunc_epilog(TCCState* S)
15021502 {
15031503 uint32_t x;
15041504 int diff;
@@ -1520,7 +1520,7 @@ void gfunc_epilog(TCCState *S) · 15 unmodified lines
15201520 }
15211521 #endif
15221522 o(S, 0xE89BA800); /* restore fp, sp, pc */
1523− diff = (-S->loc + 3) & -4;
1523+ diff = (-S->tccgen_loc + 3) & -4;
15241524 #ifdef TCC_ARM_EABI
15251525 if(!leaffunc)
15261526 diff = ((diff + 11) & -8) - 4;
@@ -1531,7 +1531,7 @@ void gfunc_epilog(TCCState *S) · 4 unmodified lines
15311531 *(uint32_t *)(cur_text_section->data + func_sub_sp_offset) = x;
15321532 else {
15331533 int addr;
1534− addr=S->ind;
1534+ addr=S->tccgen_ind;
15351535 o(S, 0xE59FC004); /* ldr ip,[pc+4] */
15361536 o(S, 0xE04BD00C); /* sub sp,fp,ip */
15371537 o(S, 0xE1A0F00E); /* mov pc,lr */
@@ -1541,7 +1541,7 @@ void gfunc_epilog(TCCState *S) · 3 unmodified lines
15411541 }
15421542 }
15431543
1544−ST_FUNC void gen_fill_nops(TCCState *S, int bytes)
1544+ST_FUNC void gen_fill_nops(TCCState* S, int bytes)
15451545 {
15461546 if ((bytes & 3))
15471547 tcc_error(S, "alignment of code section not multiple of 4");
@@ -1552,35 +1552,35 @@ ST_FUNC void gen_fill_nops(TCCState *S, int bytes) · 4 unmodified lines
15521552 }
15531553
15541554 /* generate a jump to a label */
1555−ST_FUNC int gjmp(TCCState *S, int t)
1555+ST_FUNC int gjmp(TCCState* S, int t)
15561556 {
15571557 int r;
1558− if (S->nocode_wanted)
1558+ if (S->tccgen_nocode_wanted)
15591559 return t;
1560− r=S->ind;
1560+ r=S->tccgen_ind;
15611561 o(S, 0xE0000000|encbranch(S, r,t,1));
15621562 return r;
15631563 }
15641564
15651565 /* generate a jump to a fixed address */
1566−ST_FUNC void gjmp_addr(TCCState *S, int a)
1566+ST_FUNC void gjmp_addr(TCCState* S, int a)
15671567 {
15681568 gjmp(S, a);
15691569 }
15701570
1571−ST_FUNC int gjmp_cond(TCCState *S, int op, int t)
1571+ST_FUNC int gjmp_cond(TCCState* S, int op, int t)
15721572 {
15731573 int r;
1574− if (S->nocode_wanted)
1574+ if (S->tccgen_nocode_wanted)
15751575 return t;
1576− r=S->ind;
1576+ r=S->tccgen_ind;
15771577 op=mapcc(S, op);
15781578 op|=encbranch(S, r,t,1);
15791579 o(S, op);
15801580 return r;
15811581 }
15821582
1583−ST_FUNC int gjmp_append(TCCState *S, int n, int t)
1583+ST_FUNC int gjmp_append(TCCState* S, int n, int t)
15841584 {
15851585 uint32_t *x;
15861586 int p,lp;
@@ -1598,7 +1598,7 @@ ST_FUNC int gjmp_append(TCCState *S, int n, int t) · 11 unmodified lines
15981598 }
15991599
16001600 /* generate an integer binary operation */
1601−void gen_opi(TCCState *S, int op)
1601+void gen_opi(TCCState* S, int op)
16021602 {
16031603 int c, func = 0;
16041604 uint32_t opc = 0, r, fr;
@@ -1644,9 +1644,9 @@ void gen_opi(TCCState *S, int op) · 39 unmodified lines
16441644 break;
16451645 case '*':
16461646 gv2(S, RC_INT, RC_INT);
1647− r = S->vtop[-1].r;
1648− fr = S->vtop[0].r;
1649− S->vtop--;
1647+ r = S->tccgen_vtop[-1].r;
1648+ fr = S->tccgen_vtop[0].r;
1649+ S->tccgen_vtop--;
16501650 o(S, 0xE0000090|(intr(S, r)<<16)|(intr(S, r)<<8)|intr(S, fr));
16511651 return;
16521652 case TOK_SHL:
@@ -1690,11 +1690,11 @@ void gen_opi(TCCState *S, int op) · 37 unmodified lines
16901690 break;
16911691 case TOK_UMULL:
16921692 gv2(S, RC_INT, RC_INT);
1693− r=intr(S, S->vtop[-1].r2=get_reg(S, RC_INT));
1694− c=S->vtop[-1].r;
1695− S->vtop[-1].r=get_reg_ex(S, RC_INT,regmask(S, c));
1696− S->vtop--;
1697− o(S, 0xE0800090|(r<<16)|(intr(S, S->vtop->r)<<12)|(intr(S, c)<<8)|intr(S, S->vtop[1].r));
1693+ r=intr(S, S->tccgen_vtop[-1].r2=get_reg(S, RC_INT));
1694+ c=S->tccgen_vtop[-1].r;
1695+ S->tccgen_vtop[-1].r=get_reg_ex(S, RC_INT,regmask(S, c));
1696+ S->tccgen_vtop--;
1697+ o(S, 0xE0800090|(r<<16)|(intr(S, S->tccgen_vtop->r)<<12)|(intr(S, c)<<8)|intr(S, S->tccgen_vtop[1].r));
16981698 return;
16991699 default:
17001700 opc = 0x15;
@@ -1703,27 +1703,27 @@ void gen_opi(TCCState *S, int op) · 2 unmodified lines
17031703 }
17041704 switch(c) {
17051705 case 1:
1706− if((S->vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
1706+ if((S->tccgen_vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
17071707 if(opc == 4 || opc == 5 || opc == 0xc) {
17081708 vswap(S);
17091709 opc|=2; // sub -> rsb
17101710 }
17111711 }
1712− if ((S->vtop->r & VT_VALMASK) == VT_CMP ||
1713− (S->vtop->r & (VT_VALMASK & ~1)) == VT_JMP)
1712+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_CMP ||
1713+ (S->tccgen_vtop->r & (VT_VALMASK & ~1)) == VT_JMP)
17141714 gv(S, RC_INT);
17151715 vswap(S);
17161716 c=intr(S, gv(S, RC_INT));
17171717 vswap(S);
17181718 opc=0xE0000000|(opc<<20);
1719− if((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
1719+ if((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
17201720 uint32_t x;
1721− x=stuff_const(opc|0x2000000|(c<<16),S->vtop->c.i);
1721+ x=stuff_const(opc|0x2000000|(c<<16),S->tccgen_vtop->c.i);
17221722 if(x) {
17231723 if ((x & 0xfff00000) == 0xe3500000) // cmp rx,#c
17241724 o(S, x);
17251725 else {
1726− r=intr(S, S->vtop[-1].r=get_reg_ex(S, RC_INT,regmask(S, S->vtop[-1].r)));
1726+ r=intr(S, S->tccgen_vtop[-1].r=get_reg_ex(S, RC_INT,regmask(S, S->tccgen_vtop[-1].r)));
17271727 o(S, x|(r<<12));
17281728 }
17291729 goto done;
@@ -1731,7 +1731,7 @@ void gen_opi(TCCState *S, int op) · 1 unmodified line
17311731 }
17321732 fr=intr(S, gv(S, RC_INT));
17331733 #ifdef CONFIG_TCC_BCHECK
1734− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
1734+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
17351735 vswap(S);
17361736 c=intr(S, gv(S, RC_INT));
17371737 vswap(S);
@@ -1740,46 +1740,46 @@ void gen_opi(TCCState *S, int op) · 2 unmodified lines
17401740 if ((opc & 0xfff00000) == 0xe1500000) // cmp rx,ry
17411741 o(S, opc|(c<<16)|fr);
17421742 else {
1743− r=intr(S, S->vtop[-1].r=get_reg_ex(S, RC_INT,two2mask(S, S->vtop->r,S->vtop[-1].r)));
1743+ r=intr(S, S->tccgen_vtop[-1].r=get_reg_ex(S, RC_INT,two2mask(S, S->tccgen_vtop->r,S->tccgen_vtop[-1].r)));
17441744 o(S, opc|(c<<16)|(r<<12)|fr);
17451745 }
17461746 done:
1747− S->vtop--;
1747+ S->tccgen_vtop--;
17481748 if (op >= TOK_ULT && op <= TOK_GT)
17491749 vset_VT_CMP(S, op);
17501750 break;
17511751 case 2:
17521752 opc=0xE1A00000|(opc<<5);
1753− if ((S->vtop->r & VT_VALMASK) == VT_CMP ||
1754− (S->vtop->r & (VT_VALMASK & ~1)) == VT_JMP)
1753+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_CMP ||
1754+ (S->tccgen_vtop->r & (VT_VALMASK & ~1)) == VT_JMP)
17551755 gv(S, RC_INT);
17561756 vswap(S);
17571757 r=intr(S, gv(S, RC_INT));
17581758 vswap(S);
1759− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
1760− fr=intr(S, S->vtop[-1].r=get_reg_ex(S, RC_INT,regmask(S, S->vtop[-1].r)));
1761− c = S->vtop->c.i & 0x1f;
1759+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
1760+ fr=intr(S, S->tccgen_vtop[-1].r=get_reg_ex(S, RC_INT,regmask(S, S->tccgen_vtop[-1].r)));
1761+ c = S->tccgen_vtop->c.i & 0x1f;
17621762 o(S, opc|r|(c<<7)|(fr<<12));
17631763 } else {
17641764 fr=intr(S, gv(S, RC_INT));
17651765 #ifdef CONFIG_TCC_BCHECK
1766− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
1766+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
17671767 vswap(S);
17681768 r=intr(S, gv(S, RC_INT));
17691769 vswap(S);
17701770 }
17711771 #endif
1772− c=intr(S, S->vtop[-1].r=get_reg_ex(S, RC_INT,two2mask(S, S->vtop->r,S->vtop[-1].r)));
1772+ c=intr(S, S->tccgen_vtop[-1].r=get_reg_ex(S, RC_INT,two2mask(S, S->tccgen_vtop->r,S->tccgen_vtop[-1].r)));
17731773 o(S, opc|r|(c<<12)|(fr<<8)|0x10);
17741774 }
1775− S->vtop--;
1775+ S->tccgen_vtop--;
17761776 break;
17771777 case 3:
17781778 vpush_helper_func(S, func);
17791779 vrott(S, 3);
17801780 gfunc_call(S, 2);
17811781 vpushi(S, 0);
1782− S->vtop->r = retreg;
1782+ S->tccgen_vtop->r = retreg;
17831783 break;
17841784 default:
17851785 tcc_error(S, "gen_opi %i unimplemented!",op);
@@ -1787,30 +1787,30 @@ done: · 1 unmodified line
17871787 }
17881788
17891789 #ifdef TCC_ARM_VFP
1790−static int is_zero(TCCState *S, int i)
1790+static int is_zero(TCCState* S, int i)
17911791 {
1792− if((S->vtop[i].r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST)
1792+ if((S->tccgen_vtop[i].r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST)
17931793 return 0;
1794− if (S->vtop[i].type.t == VT_FLOAT)
1795− return (S->vtop[i].c.f == 0.f);
1796− else if (S->vtop[i].type.t == VT_DOUBLE)
1797− return (S->vtop[i].c.d == 0.0);
1798− return (S->vtop[i].c.ld == 0.l);
1794+ if (S->tccgen_vtop[i].type.t == VT_FLOAT)
1795+ return (S->tccgen_vtop[i].c.f == 0.f);
1796+ else if (S->tccgen_vtop[i].type.t == VT_DOUBLE)
1797+ return (S->tccgen_vtop[i].c.d == 0.0);
1798+ return (S->tccgen_vtop[i].c.ld == 0.l);
17991799 }
18001800
18011801 /* generate a floating point operation 'v = t1 op t2' instruction. The
18021802 * two operands are guaranteed to have the same floating point type */
1803−void gen_opf(TCCState *S, int op)
1803+void gen_opf(TCCState* S, int op)
18041804 {
18051805 uint32_t x;
18061806 int fneg=0,r;
1807− x=0xEE000A00|T2CPR(S->vtop->type.t);
1807+ x=0xEE000A00|T2CPR(S->tccgen_vtop->type.t);
18081808 switch(op) {
18091809 case '+':
18101810 if(is_zero(S, -1))
18111811 vswap(S);
18121812 if(is_zero(S, 0)) {
1813− S->vtop--;
1813+ S->tccgen_vtop--;
18141814 return;
18151815 }
18161816 x|=0x300000;
@@ -1818,13 +1818,13 @@ void gen_opf(TCCState *S, int op) · 1 unmodified line
18181818 case '-':
18191819 x|=0x300040;
18201820 if(is_zero(S, 0)) {
1821− S->vtop--;
1821+ S->tccgen_vtop--;
18221822 return;
18231823 }
18241824 if(is_zero(S, -1)) {
18251825 x|=0x810000; /* fsubX -> fnegX */
18261826 vswap(S);
1827− S->vtop--;
1827+ S->tccgen_vtop--;
18281828 fneg=1;
18291829 }
18301830 break;
@@ -1852,13 +1852,13 @@ void gen_opf(TCCState *S, int op) · 21 unmodified lines
18521852 if(op!=TOK_EQ && op!=TOK_NE)
18531853 x|=0x80; /* fcmpX -> fcmpeX */
18541854 if(is_zero(S, 0)) {
1855− S->vtop--;
1855+ S->tccgen_vtop--;
18561856 o(S, x|0x10000|(vfpr(S, gv(S, RC_FLOAT))<<12)); /* fcmp(e)X -> fcmp(e)zX */
18571857 } else {
18581858 gv2(S, RC_FLOAT,RC_FLOAT);
1859− x|=vfpr(S, S->vtop[0].r);
1860− o(S, x|(vfpr(S, S->vtop[-1].r) << 12));
1861− S->vtop--;
1859+ x|=vfpr(S, S->tccgen_vtop[0].r);
1860+ o(S, x|(vfpr(S, S->tccgen_vtop[-1].r) << 12));
1861+ S->tccgen_vtop--;
18621862 }
18631863 o(S, 0xEEF1FA10); /* fmstat */
18641864
@@ -1881,7 +1881,7 @@ void gen_opf(TCCState *S, int op) · 16 unmodified lines
18811881 x|=vfpr(S, r2)<<16;
18821882 r|=regmask(S, r2);
18831883 #ifdef CONFIG_TCC_BCHECK
1884− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
1884+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
18851885 vswap(S);
18861886 r=gv(S, RC_FLOAT);
18871887 vswap(S);
@@ -1889,25 +1889,25 @@ void gen_opf(TCCState *S, int op) · 1 unmodified line
18891889 }
18901890 #endif
18911891 }
1892− S->vtop->r=get_reg_ex(S, RC_FLOAT,r);
1892+ S->tccgen_vtop->r=get_reg_ex(S, RC_FLOAT,r);
18931893 if(!fneg)
1894− S->vtop--;
1895− o(S, x|(vfpr(S, S->vtop->r)<<12));
1894+ S->tccgen_vtop--;
1895+ o(S, x|(vfpr(S, S->tccgen_vtop->r)<<12));
18961896 }
18971897
18981898 #else
1899−static uint32_t is_fconst(TCCState *S)
1899+static uint32_t is_fconst(TCCState* S)
19001900 {
19011901 long double f;
19021902 uint32_t r;
1903− if((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST)
1903+ if((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST)
19041904 return 0;
1905− if (S->vtop->type.t == VT_FLOAT)
1906− f = S->vtop->c.f;
1907− else if (S->vtop->type.t == VT_DOUBLE)
1908− f = S->vtop->c.d;
1905+ if (S->tccgen_vtop->type.t == VT_FLOAT)
1906+ f = S->tccgen_vtop->c.f;
1907+ else if (S->tccgen_vtop->type.t == VT_DOUBLE)
1908+ f = S->tccgen_vtop->c.d;
19091909 else
1910− f = S->vtop->c.ld;
1910+ f = S->tccgen_vtop->c.ld;
19111911 if(!ieee_finite(f))
19121912 return 0;
19131913 r=0x8;
@@ -1936,7 +1936,7 @@ static uint32_t is_fconst(TCCState *S) · 22 unmodified lines
19361936
19371937 /* generate a floating point operation 'v = t1 op t2' instruction. The
19381938 two operands are guaranteed to have the same floating point type */
1939−void gen_opf(TCCState *S, int op)
1939+void gen_opf(TCCState* S, int op)
19401940 {
19411941 uint32_t x, r, r2, c1, c2;
19421942 //fputs("gen_opf\n",stderr);
@@ -1946,12 +1946,12 @@ void gen_opf(TCCState *S, int op) · 3 unmodified lines
19461946 c2 = is_fconst(S);
19471947 x=0xEE000100;
19481948 #if LDOUBLE_SIZE == 8
1949− if ((S->vtop->type.t & VT_BTYPE) != VT_FLOAT)
1949+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_FLOAT)
19501950 x|=0x80;
19511951 #else
1952− if ((S->vtop->type.t & VT_BTYPE) == VT_DOUBLE)
1952+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_DOUBLE)
19531953 x|=0x80;
1954− else if ((S->vtop->type.t & VT_BTYPE) == VT_LDOUBLE)
1954+ else if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LDOUBLE)
19551955 x|=0x80000;
19561956 #endif
19571957 switch(op)
@@ -1971,7 +1971,7 @@ void gen_opf(TCCState *S, int op) · 13 unmodified lines
19711971 } else {
19721972 r2=fpr(S, gv(S, RC_FLOAT));
19731973 #ifdef CONFIG_TCC_BCHECK
1974− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
1974+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
19751975 vswap(S);
19761976 r=fpr(S, gv(S, RC_FLOAT));
19771977 vswap(S);
@@ -1999,7 +1999,7 @@ void gen_opf(TCCState *S, int op) · 21 unmodified lines
19991999 vswap(S);
20002000 r2=fpr(S, gv(S, RC_FLOAT));
20012001 #ifdef CONFIG_TCC_BCHECK
2002− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
2002+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
20032003 vswap(S);
20042004 r=fpr(S, gv(S, RC_FLOAT));
20052005 vswap(S);
@@ -2020,7 +2020,7 @@ void gen_opf(TCCState *S, int op) · 14 unmodified lines
20202020 else {
20212021 r2=fpr(S, gv(S, RC_FLOAT));
20222022 #ifdef CONFIG_TCC_BCHECK
2023− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
2023+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
20242024 vswap(S);
20252025 r=fpr(S, gv(S, RC_FLOAT));
20262026 vswap(S);
@@ -2048,7 +2048,7 @@ void gen_opf(TCCState *S, int op) · 21 unmodified lines
20482048 vswap(S);
20492049 r2=fpr(S, gv(S, RC_FLOAT));
20502050 #ifdef CONFIG_TCC_BCHECK
2051− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
2051+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
20522052 vswap(S);
20532053 r=fpr(S, gv(S, RC_FLOAT));
20542054 vswap(S);
@@ -2107,65 +2107,65 @@ void gen_opf(TCCState *S, int op) · 52 unmodified lines
21072107 } else {
21082108 r2=fpr(S, gv(S, RC_FLOAT));
21092109 #ifdef CONFIG_TCC_BCHECK
2110− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
2110+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
21112111 vswap(S);
21122112 r=fpr(S, gv(S, RC_FLOAT));
21132113 vswap(S);
21142114 }
21152115 #endif
21162116 }
2117− --S->vtop;
2117+ --S->tccgen_vtop;
21182118 vset_VT_CMP(S, op);
2119− ++S->vtop;
2119+ ++S->tccgen_vtop;
21202120 } else {
21212121 tcc_error(S, "unknown fp op %x!",op);
21222122 return;
21232123 }
21242124 }
2125− if(S->vtop[-1].r == VT_CMP)
2125+ if(S->tccgen_vtop[-1].r == VT_CMP)
21262126 c1=15;
21272127 else {
2128− c1=S->vtop->r;
2128+ c1=S->tccgen_vtop->r;
21292129 if(r2&0x8)
2130− c1=S->vtop[-1].r;
2131− S->vtop[-1].r=get_reg_ex(S, RC_FLOAT,two2mask(S, S->vtop[-1].r,c1));
2132− c1=fpr(S, S->vtop[-1].r);
2130+ c1=S->tccgen_vtop[-1].r;
2131+ S->tccgen_vtop[-1].r=get_reg_ex(S, RC_FLOAT,two2mask(S, S->tccgen_vtop[-1].r,c1));
2132+ c1=fpr(S, S->tccgen_vtop[-1].r);
21332133 }
2134− S->vtop--;
2134+ S->tccgen_vtop--;
21352135 o(S, x|(r<<16)|(c1<<12)|r2);
21362136 }
21372137 #endif
21382138
21392139 /* convert integers to fp 't' type. Must handle 'int', 'unsigned int'
21402140 and 'long long' cases. */
2141−ST_FUNC void gen_cvt_itof(TCCState *S, int t)
2141+ST_FUNC void gen_cvt_itof(TCCState* S, int t)
21422142 {
21432143 uint32_t r, r2;
21442144 int bt;
2145− bt=S->vtop->type.t & VT_BTYPE;
2145+ bt=S->tccgen_vtop->type.t & VT_BTYPE;
21462146 if(bt == VT_INT || bt == VT_SHORT || bt == VT_BYTE) {
21472147 #ifndef TCC_ARM_VFP
21482148 uint32_t dsize = 0;
21492149 #endif
21502150 r=intr(S, gv(S, RC_INT));
21512151 #ifdef TCC_ARM_VFP
2152− r2=vfpr(S, S->vtop->r=get_reg(S, RC_FLOAT));
2152+ r2=vfpr(S, S->tccgen_vtop->r=get_reg(S, RC_FLOAT));
21532153 o(S, 0xEE000A10|(r<<12)|(r2<<16)); /* fmsr */
21542154 r2|=r2<<12;
2155− if(!(S->vtop->type.t & VT_UNSIGNED))
2155+ if(!(S->tccgen_vtop->type.t & VT_UNSIGNED))
21562156 r2|=0x80; /* fuitoX -> fsituX */
21572157 o(S, 0xEEB80A40|r2|T2CPR(t)); /* fYitoX*/
21582158 #else
2159− r2=fpr(S, S->vtop->r=get_reg(S, RC_FLOAT));
2159+ r2=fpr(S, S->tccgen_vtop->r=get_reg(S, RC_FLOAT));
21602160 if((t & VT_BTYPE) != VT_FLOAT)
21612161 dsize=0x80; /* flts -> fltd */
21622162 o(S, 0xEE000110|dsize|(r2<<16)|(r<<12)); /* flts */
2163− if((S->vtop->type.t & (VT_UNSIGNED|VT_BTYPE)) == (VT_UNSIGNED|VT_INT)) {
2163+ if((S->tccgen_vtop->type.t & (VT_UNSIGNED|VT_BTYPE)) == (VT_UNSIGNED|VT_INT)) {
21642164 uint32_t off = 0;
21652165 o(S, 0xE3500000|(r<<12)); /* cmp */
21662166 r=fpr(S, get_reg(S, RC_FLOAT));
21672167 if(last_itod_magic) {
2168− off=S->ind+8-last_itod_magic;
2168+ off=S->tccgen_ind+8-last_itod_magic;
21692169 off/=4;
21702170 if(off>255)
21712171 off=0;
@@ -2173,7 +2173,7 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 1 unmodified line
21732173 o(S, 0xBD1F0100|(r<<12)|off); /* ldflts */
21742174 if(!off) {
21752175 o(S, 0xEA000000); /* b */
2176− last_itod_magic=S->ind;
2176+ last_itod_magic=S->tccgen_ind;
21772177 o(S, 0x4F800000); /* 4294967296.0f */
21782178 }
21792179 o(S, 0xBE000100|dsize|(r2<<16)|(r2<<12)|r); /* adflt */
@@ -2185,14 +2185,14 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 5 unmodified lines
21852185 CType *func_type = 0;
21862186 if((t & VT_BTYPE) == VT_FLOAT) {
21872187 func_type = &S->armgen_func_float_type;
2188− if(S->vtop->type.t & VT_UNSIGNED)
2188+ if(S->tccgen_vtop->type.t & VT_UNSIGNED)
21892189 func=TOK___floatundisf;
21902190 else
21912191 func=TOK___floatdisf;
21922192 #if LDOUBLE_SIZE != 8
21932193 } else if((t & VT_BTYPE) == VT_LDOUBLE) {
21942194 func_type = &S->armgen_func_ldouble_type;
2195− if(S->vtop->type.t & VT_UNSIGNED)
2195+ if(S->tccgen_vtop->type.t & VT_UNSIGNED)
21962196 func=TOK___floatundixf;
21972197 else
21982198 func=TOK___floatdixf;
@@ -2201,7 +2201,7 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 2 unmodified lines
22012201 } else if((t & VT_BTYPE) == VT_DOUBLE || (t & VT_BTYPE) == VT_LDOUBLE) {
22022202 #endif
22032203 func_type = &S->armgen_func_double_type;
2204− if(S->vtop->type.t & VT_UNSIGNED)
2204+ if(S->tccgen_vtop->type.t & VT_UNSIGNED)
22052205 func=TOK___floatundidf;
22062206 else
22072207 func=TOK___floatdidf;
@@ -2211,27 +2211,27 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 3 unmodified lines
22112211 vswap(S);
22122212 gfunc_call(S, 1);
22132213 vpushi(S, 0);
2214− S->vtop->r=TREG_F0;
2214+ S->tccgen_vtop->r=TREG_F0;
22152215 return;
22162216 }
22172217 }
2218− tcc_error(S, "unimplemented gen_cvt_itof %x!",S->vtop->type.t);
2218+ tcc_error(S, "unimplemented gen_cvt_itof %x!",S->tccgen_vtop->type.t);
22192219 }
22202220
22212221 /* convert fp to int 't' type */
2222−void gen_cvt_ftoi(TCCState *S, int t)
2222+void gen_cvt_ftoi(TCCState* S, int t)
22232223 {
22242224 uint32_t r, r2;
22252225 int u, func = 0;
22262226 u=t&VT_UNSIGNED;
22272227 t&=VT_BTYPE;
2228− r2=S->vtop->type.t & VT_BTYPE;
2228+ r2=S->tccgen_vtop->type.t & VT_BTYPE;
22292229 if(t==VT_INT) {
22302230 #ifdef TCC_ARM_VFP
22312231 r=vfpr(S, gv(S, RC_FLOAT));
22322232 u=u?0:0x10000;
22332233 o(S, 0xEEBC0AC0|(r<<12)|r|T2CPR(r2)|u); /* ftoXizY */
2234− r2=intr(S, S->vtop->r=get_reg(S, RC_INT));
2234+ r2=intr(S, S->tccgen_vtop->r=get_reg(S, RC_INT));
22352235 o(S, 0xEE100A10|(r<<16)|(r2<<12));
22362236 return;
22372237 #else
@@ -2248,7 +2248,7 @@ void gen_cvt_ftoi(TCCState *S, int t) · 10 unmodified lines
22482248 func=TOK___fixunsdfsi;
22492249 } else {
22502250 r=fpr(S, gv(S, RC_FLOAT));
2251− r2=intr(S, S->vtop->r=get_reg(S, RC_INT));
2251+ r2=intr(S, S->tccgen_vtop->r=get_reg(S, RC_INT));
22522252 o(S, 0xEE100170|(r2<<12)|r);
22532253 return;
22542254 }
@@ -2271,20 +2271,20 @@ void gen_cvt_ftoi(TCCState *S, int t) · 16 unmodified lines
22712271 gfunc_call(S, 1);
22722272 vpushi(S, 0);
22732273 if(t == VT_LLONG)
2274− S->vtop->r2 = REG_IRE2;
2275− S->vtop->r = REG_IRET;
2274+ S->tccgen_vtop->r2 = REG_IRE2;
2275+ S->tccgen_vtop->r = REG_IRET;
22762276 return;
22772277 }
22782278 tcc_error(S, "unimplemented gen_cvt_ftoi!");
22792279 }
22802280
22812281 /* convert from one floating point type to another */
2282−void gen_cvt_ftof(TCCState *S, int t)
2282+void gen_cvt_ftof(TCCState* S, int t)
22832283 {
22842284 #ifdef TCC_ARM_VFP
2285− if(((S->vtop->type.t & VT_BTYPE) == VT_FLOAT) != ((t & VT_BTYPE) == VT_FLOAT)) {
2285+ if(((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FLOAT) != ((t & VT_BTYPE) == VT_FLOAT)) {
22862286 uint32_t r = vfpr(S, gv(S, RC_FLOAT));
2287− o(S, 0xEEB70AC0|(r<<12)|r|T2CPR(S->vtop->type.t));
2287+ o(S, 0xEEB70AC0|(r<<12)|r|T2CPR(S->tccgen_vtop->type.t));
22882288 }
22892289 #else
22902290 /* all we have to do on i386 and FPA ARM is to put the float in a register */
@@ -2293,16 +2293,16 @@ void gen_cvt_ftof(TCCState *S, int t) · 2 unmodified lines
22932293 }
22942294
22952295 /* increment tcov counter */
2296−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv)
2296+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv)
22972297 {
22982298 int r1, r2;
22992299
23002300 vpushv(S, sv);
2301− S->vtop->r = r1 = get_reg(S, RC_INT);
2301+ S->tccgen_vtop->r = r1 = get_reg(S, RC_INT);
23022302 r2 = get_reg(S, RC_INT);
23032303 o(S, 0xE59F0000 | (intr(S, r1)<<12)); // ldr r1,[pc]
23042304 o(S, 0xEA000000); // b $+4
2305− greloc(S, cur_text_section, sv->sym, S->ind, R_ARM_REL32);
2305+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind, R_ARM_REL32);
23062306 o(S, -12);
23072307 o(S, 0xe080000f | (intr(S, r1)<<16) | (intr(S, r1)<<12)); // add r1,r1,pc
23082308 o(S, 0xe5900000 | (intr(S, r1)<<16) | (intr(S, r2)<<12)); // ldr r2, [r1]
@@ -2316,14 +2316,14 @@ ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv) · 7 unmodified lines
23162316 }
23172317
23182318 /* computed goto support */
2319−void ggoto(TCCState *S)
2319+void ggoto(TCCState* S)
23202320 {
23212321 gcall_or_jmp(S, 1);
2322− S->vtop--;
2322+ S->tccgen_vtop--;
23232323 }
23242324
23252325 /* Save the stack pointer onto the stack and return the location of its address */
2326−ST_FUNC void gen_vla_sp_save(TCCState *S, int addr) {
2326+ST_FUNC void gen_vla_sp_save(TCCState* S, int addr) {
23272327 SValue v;
23282328 v.type.t = VT_PTR;
23292329 v.r = VT_LOCAL | VT_LVAL;
@@ -2332,7 +2332,7 @@ ST_FUNC void gen_vla_sp_save(TCCState *S, int addr) { · 2 unmodified lines
23322332 }
23332333
23342334 /* Restore the SP from a location on the stack */
2335−ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr) {
2335+ST_FUNC void gen_vla_sp_restore(TCCState* S, int addr) {
23362336 SValue v;
23372337 v.type.t = VT_PTR;
23382338 v.r = VT_LOCAL | VT_LVAL;
@@ -2341,11 +2341,11 @@ ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr) { · 2 unmodified lines
23412341 }
23422342
23432343 /* Subtract from the stack pointer, and push the resulting value onto the stack */
2344−ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) {
2344+ST_FUNC void gen_vla_alloc(TCCState* S, CType *type, int align) {
23452345 int r;
23462346 #if defined(CONFIG_TCC_BCHECK)
23472347 if (S->do_bounds_check)
2348− vpushv(S, S->vtop);
2348+ vpushv(S, S->tccgen_vtop);
23492349 #endif
23502350 r = intr(S, gv(S, RC_INT));
23512351 #if defined(CONFIG_TCC_BCHECK)
@@ -2367,8 +2367,8 @@ ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) { · 15 unmodified lines
23672367 #if defined(CONFIG_TCC_BCHECK)
23682368 if (S->do_bounds_check) {
23692369 vpushi(S, 0);
2370− S->vtop->r = TREG_R0;
2371− o(S, 0xe1a0000d | (S->vtop->r << 12)); // mov r0,sp
2370+ S->tccgen_vtop->r = TREG_R0;
2371+ o(S, 0xe1a0000d | (S->tccgen_vtop->r << 12)); // mov r0,sp
23722372 vswap(S);
23732373 vpush_helper_func(S, TOK___bound_new_region);
23742374 vrott(S, 3);
arm64-asm.c+23−23
@@ -9,9 +9,9 @@ · 8 unmodified lines
99 #define CONFIG_TCC_ASM
1010 #define NB_ASM_REGS 16
1111
12−ST_FUNC void g(TCCState *S, int c);
13−ST_FUNC void gen_le16(TCCState *S, int c);
14−ST_FUNC void gen_le32(TCCState *S, int c);
12+ST_FUNC void g(TCCState* S, int c);
13+ST_FUNC void gen_le16(TCCState* S, int c);
14+ST_FUNC void gen_le32(TCCState* S, int c);
1515
1616 /*************************************************************/
1717 #else
@@ -19,74 +19,74 @@ ST_FUNC void gen_le32(TCCState *S, int c); · 1 unmodified line
1919 #define USING_GLOBALS
2020 #include "tcc.h"
2121
22−static void asm_error(TCCState *S)
22+static void asm_error(void)
2323 {
24− tcc_error(S, "ARM asm not implemented.");
24+ tcc_error("ARM asm not implemented.");
2525 }
2626
2727 /* XXX: make it faster ? */
28−ST_FUNC void g(TCCState *S, int c)
28+ST_FUNC void g(TCCState* S, int c)
2929 {
3030 int ind1;
31− if (S->nocode_wanted)
31+ if (nocode_wanted)
3232 return;
33− ind1 = S->ind + 1;
33+ ind1 = ind + 1;
3434 if (ind1 > cur_text_section->data_allocated)
35− section_realloc(S, cur_text_section, ind1);
36− cur_text_section->data[S->ind] = c;
37− S->ind = ind1;
35+ section_realloc(cur_text_section, ind1);
36+ cur_text_section->data[ind] = c;
37+ ind = ind1;
3838 }
3939
40−ST_FUNC void gen_le16 (TCCState *S, int i)
40+ST_FUNC void gen_le16 (TCCState* S, int i)
4141 {
4242 g(S, i);
4343 g(S, i>>8);
4444 }
4545
46−ST_FUNC void gen_le32 (TCCState *S, int i)
46+ST_FUNC void gen_le32 (TCCState* S, int i)
4747 {
4848 gen_le16(S, i);
4949 gen_le16(S, i>>16);
5050 }
5151
52−ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe)
52+ST_FUNC void gen_expr32(TCCState* S, ExprValue *pe)
5353 {
5454 gen_le32(S, pe->v);
5555 }
5656
5757 ST_FUNC void asm_opcode(TCCState *S, int opcode)
5858 {
59− asm_error(S);
59+ asm_error();
6060 }
6161
62−ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str, SValue *sv, int modifier)
62+ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier)
6363 {
64− asm_error(S);
64+ asm_error();
6565 }
6666
6767 /* generate prolog and epilog code for asm statement */
68−ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands,
68+ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands,
6969 int nb_outputs, int is_output,
7070 uint8_t *clobber_regs,
7171 int out_reg)
7272 {
7373 }
7474
75−ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands,
75+ST_FUNC void asm_compute_constraints(ASMOperand *operands,
7676 int nb_operands, int nb_outputs,
7777 const uint8_t *clobber_regs,
7878 int *pout_reg)
7979 {
8080 }
8181
82−ST_FUNC void asm_clobber(TCCState *S, uint8_t *clobber_regs, const char *str)
82+ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str)
8383 {
84− asm_error(S);
84+ asm_error();
8585 }
8686
87−ST_FUNC int asm_parse_regvar (TCCState *S, int t)
87+ST_FUNC int asm_parse_regvar (int t)
8888 {
89− asm_error(S);
89+ asm_error();
9090 return -1;
9191 }
9292
arm64-gen.c+142−142
@@ -107,13 +107,13 @@ static uint32_t fltr(int r) · 106 unmodified lines
107107 // Add an instruction to text section:
108108 ST_FUNC void o(TCCState *S, unsigned int c)
109109 {
110− int ind1 = S->ind + 4;
111− if (S->nocode_wanted)
110+ int ind1 = S->tccgen_ind + 4;
111+ if (S->tccgen_nocode_wanted)
112112 return;
113113 if (ind1 > cur_text_section->data_allocated)
114114 section_realloc(S, cur_text_section, ind1);
115− write32le(cur_text_section->data + S->ind, c);
116− S->ind = ind1;
115+ write32le(cur_text_section->data + S->tccgen_ind, c);
116+ S->tccgen_ind = ind1;
117117 }
118118
119119 static int arm64_encode_bimm64(uint64_t x)
@@ -452,9 +452,9 @@ static void arm64_strv(TCCState *S, int sz_, int dst, int bas, uint64_t off) · 332 unmodified lines
452452
453453 static void arm64_sym(TCCState *S, int r, Sym *sym, unsigned long addend)
454454 {
455− greloca(S, cur_text_section, sym, S->ind, R_AARCH64_ADR_GOT_PAGE, 0);
455+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_AARCH64_ADR_GOT_PAGE, 0);
456456 o(S, 0x90000000 | r); // adrp xr, #sym
457− greloca(S, cur_text_section, sym, S->ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
457+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
458458 o(S, 0xf9400000 | r | (r << 5)); // ld xr,[xr, #sym]
459459 if (addend) {
460460 // add xr, xr, #addend
@@ -654,14 +654,14 @@ ST_FUNC void store(TCCState *S, int r, SValue *sv) · 193 unmodified lines
654654
655655 static void arm64_gen_bl_or_b(TCCState *S, int b)
656656 {
657− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && (S->vtop->r & VT_SYM)) {
658− greloca(S, cur_text_section, S->vtop->sym, S->ind,
657+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && (S->tccgen_vtop->r & VT_SYM)) {
658+ greloca(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind,
659659 b ? R_AARCH64_JUMP26 : R_AARCH64_CALL26, 0);
660660 o(S, 0x14000000 | (uint32_t)!b << 31); // b/bl .
661661 }
662662 else {
663663 #ifdef CONFIG_TCC_BCHECK
664− S->vtop->r &= ~VT_MUSTBOUND;
664+ S->tccgen_vtop->r &= ~VT_MUSTBOUND;
665665 #endif
666666 o(S, 0xd61f0000 | (uint32_t)!b << 21 | intr(S, gv(S, RC_R30)) << 5); // br/blr
667667 }
@@ -673,7 +673,7 @@ static void gen_bounds_call(TCCState *S, int v) · 5 unmodified lines
673673 {
674674 Sym *sym = external_helper_sym(S, v);
675675
676− greloca(S, cur_text_section, sym, S->ind, R_AARCH64_CALL26, 0);
676+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_AARCH64_CALL26, 0);
677677 o(S, 0x94000000); // bl
678678 }
679679
@@ -681,7 +681,7 @@ static void gen_bounds_prolog(TCCState *S) · 1 unmodified line
681681 {
682682 /* leave some room for bound checking code */
683683 S->func_bound_offset = lbounds_section->data_offset;
684− S->func_bound_ind = S->ind;
684+ S->func_bound_ind = S->tccgen_ind;
685685 S->func_bound_add_epilog = 0;
686686 o(S, 0xd503201f); /* nop -> mov x0, lbound section pointer */
687687 o(S, 0xd503201f);
@@ -703,27 +703,27 @@ static void gen_bounds_epilog(TCCState *S) · 15 unmodified lines
703703 bounds_ptr = section_ptr_add(S, lbounds_section, sizeof(addr_t));
704704 *bounds_ptr = 0;
705705
706− sym_data = get_sym_ref(S, &S->char_pointer_type, lbounds_section,
706+ sym_data = get_sym_ref(S, &S->tccgen_char_pointer_type, lbounds_section,
707707 S->func_bound_offset, lbounds_section->data_offset);
708708
709709 /* generate bound local allocation */
710710 if (offset_modified) {
711− saved_ind = S->ind;
712− S->ind = S->func_bound_ind;
713− greloca(S, cur_text_section, sym_data, S->ind, R_AARCH64_ADR_GOT_PAGE, 0);
711+ saved_ind = S->tccgen_ind;
712+ S->tccgen_ind = S->func_bound_ind;
713+ greloca(S, cur_text_section, sym_data, S->tccgen_ind, R_AARCH64_ADR_GOT_PAGE, 0);
714714 o(S, 0x90000000 | 0); // adrp x0, #sym_data
715− greloca(S, cur_text_section, sym_data, S->ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
715+ greloca(S, cur_text_section, sym_data, S->tccgen_ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
716716 o(S, 0xf9400000 | 0 | (0 << 5)); // ld x0,[x0, #sym_data]
717717 gen_bounds_call(S, TOK___bound_local_new);
718− S->ind = saved_ind;
718+ S->tccgen_ind = saved_ind;
719719 }
720720
721721 /* generate bound check local freeing */
722722 o(S, 0xf81f0fe0); /* str x0, [sp, #-16]! */
723723 o(S, 0x3c9f0fe0); /* str q0, [sp, #-16]! */
724− greloca(S, cur_text_section, sym_data, S->ind, R_AARCH64_ADR_GOT_PAGE, 0);
724+ greloca(S, cur_text_section, sym_data, S->tccgen_ind, R_AARCH64_ADR_GOT_PAGE, 0);
725725 o(S, 0x90000000 | 0); // adrp x0, #sym_data
726− greloca(S, cur_text_section, sym_data, S->ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
726+ greloca(S, cur_text_section, sym_data, S->tccgen_ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
727727 o(S, 0xf9400000 | 0 | (0 << 5)); // ld x0,[x0, #sym_data]
728728 gen_bounds_call(S, TOK___bound_local_delete);
729729 o(S, 0x3cc107e0); /* ldr q0, [sp], #16 */
@@ -977,7 +977,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 247 unmodified lines
977977 gbound_args(S, nb_args);
978978 #endif
979979
980− return_type = &S->vtop[-nb_args].type.ref->type;
980+ return_type = &S->tccgen_vtop[-nb_args].type.ref->type;
981981 if ((return_type->t & VT_BTYPE) == VT_STRUCT)
982982 --nb_args;
983983
@@ -987,14 +987,14 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 3 unmodified lines
987987
988988 t[0] = return_type;
989989 for (i = 0; i < nb_args; i++)
990− t[nb_args - i] = &S->vtop[-i].type;
990+ t[nb_args - i] = &S->tccgen_vtop[-i].type;
991991
992992 stack = arm64_pcs(nb_args, t, a);
993993
994994 // Allocate space for structs replaced by pointer:
995995 for (i = nb_args; i; i--)
996996 if (a[i] & 1) {
997− SValue *arg = &S->vtop[i - nb_args];
997+ SValue *arg = &S->tccgen_vtop[i - nb_args];
998998 int align, size = type_size(&arg->type, &align);
999999 assert((arg->type.t & VT_BTYPE) == VT_STRUCT);
10001000 stack = (stack + align - 1) & -align;
@@ -1005,7 +1005,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 4 unmodified lines
10051005 stack = (stack + 15) >> 4 << 4;
10061006
10071007 /* fetch cpu flag before generating any code */
1008− if ((S->vtop->r & VT_VALMASK) == VT_CMP)
1008+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_CMP)
10091009 gv(S, RC_INT);
10101010
10111011 if (stack >= 0x1000000) // 16Mb
@@ -1017,13 +1017,13 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 5 unmodified lines
10171017
10181018 // First pass: set all values on stack
10191019 for (i = nb_args; i; i--) {
1020− vpushv(S, S->vtop - nb_args + i);
1020+ vpushv(S, S->tccgen_vtop - nb_args + i);
10211021
10221022 if (a[i] & 1) {
10231023 // struct replaced by pointer
10241024 int r = get_reg(S, RC_INT);
10251025 arm64_spoff(S, intr(S, r), a1[i]);
1026− vset(S, &S->vtop->type, r | VT_LVAL, 0);
1026+ vset(S, &S->tccgen_vtop->type, r | VT_LVAL, 0);
10271027 vswap(S);
10281028 vstore(S);
10291029 if (a[i] >= 32) {
@@ -1035,36 +1035,36 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 5 unmodified lines
10351035 }
10361036 else if (a[i] >= 32) {
10371037 // value on stack
1038− if ((S->vtop->type.t & VT_BTYPE) == VT_STRUCT) {
1038+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_STRUCT) {
10391039 int r = get_reg(S, RC_INT);
10401040 arm64_spoff(S, intr(S, r), a[i] - 32);
1041− vset(S, &S->vtop->type, r | VT_LVAL, 0);
1041+ vset(S, &S->tccgen_vtop->type, r | VT_LVAL, 0);
10421042 vswap(S);
10431043 vstore(S);
10441044 }
1045− else if (is_float(S->vtop->type.t)) {
1045+ else if (is_float(S->tccgen_vtop->type.t)) {
10461046 gv(S, RC_FLOAT);
1047− arm64_strv(S, arm64_type_size(S->vtop[0].type.t),
1048− fltr(S->vtop[0].r), 31, a[i] - 32);
1047+ arm64_strv(S, arm64_type_size(S->tccgen_vtop[0].type.t),
1048+ fltr(S->tccgen_vtop[0].r), 31, a[i] - 32);
10491049 }
10501050 else {
10511051 gv(S, RC_INT);
1052− arm64_strx(S, arm64_type_size(S->vtop[0].type.t),
1053− intr(S, S->vtop[0].r), 31, a[i] - 32);
1052+ arm64_strx(S, arm64_type_size(S->tccgen_vtop[0].type.t),
1053+ intr(S, S->tccgen_vtop[0].r), 31, a[i] - 32);
10541054 }
10551055 }
10561056
1057− --S->vtop;
1057+ --S->tccgen_vtop;
10581058 }
10591059
10601060 // Second pass: assign values to registers
1061− for (i = nb_args; i; i--, S->vtop--) {
1061+ for (i = nb_args; i; i--, S->tccgen_vtop--) {
10621062 if (a[i] < 16 && !(a[i] & 1)) {
10631063 // value in general-purpose registers
1064− if ((S->vtop->type.t & VT_BTYPE) == VT_STRUCT) {
1065− int align, size = type_size(&S->vtop->type, &align);
1064+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_STRUCT) {
1065+ int align, size = type_size(&S->tccgen_vtop->type, &align);
10661066 if (size) {
1067− S->vtop->type.t = VT_PTR;
1067+ S->tccgen_vtop->type.t = VT_PTR;
10681068 gaddrof(S);
10691069 gv(S, RC_R(a[i] / 2));
10701070 arm64_ldrs(S, a[i] / 2, size);
@@ -1078,9 +1078,9 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 7 unmodified lines
10781078 arm64_spoff(S, a[i] / 2, a1[i]);
10791079 else if (a[i] < 32) {
10801080 // value in floating-point registers
1081− if ((S->vtop->type.t & VT_BTYPE) == VT_STRUCT) {
1082− uint32_t j, sz, n = arm64_hfa(&S->vtop->type, &sz);
1083− S->vtop->type.t = VT_PTR;
1081+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_STRUCT) {
1082+ uint32_t j, sz, n = arm64_hfa(&S->tccgen_vtop->type, &sz);
1083+ S->tccgen_vtop->type.t = VT_PTR;
10841084 gaddrof(S);
10851085 gv(S, RC_R30);
10861086 for (j = 0; j < n; j++)
@@ -1098,7 +1098,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 11 unmodified lines
10981098 if (a[0] == 1) {
10991099 // indirect return: set x8 and discard the stack value
11001100 gv(S, RC_R(8));
1101− --S->vtop;
1101+ --S->tccgen_vtop;
11021102 }
11031103 else
11041104 // return in registers: keep the address for after the call
@@ -1107,7 +1107,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 2 unmodified lines
11071107
11081108 save_regs(S, 0);
11091109 arm64_gen_bl_or_b(S, 0);
1110− --S->vtop;
1110+ --S->tccgen_vtop;
11111111 if (stack & 0xfff)
11121112 o(S, 0x910003ff | (stack & 0xfff) << 10); // add sp,sp,#(n)
11131113 if (stack >> 12)
@@ -1119,7 +1119,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 5 unmodified lines
11191119 if (bt == VT_STRUCT && !(a[0] & 1)) {
11201120 // A struct was returned in registers, so write it out:
11211121 gv(S, RC_R(8));
1122− --S->vtop;
1122+ --S->tccgen_vtop;
11231123 if (a[0] == 0) {
11241124 int align, size = type_size(return_type, &align);
11251125 assert(size <= 16);
@@ -1220,11 +1220,11 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 94 unmodified lines
12201220 tcc_free(S, t);
12211221
12221222 o(S, 0x910003fd); // mov x29,sp
1223− arm64_func_sub_sp_offset = S->ind;
1223+ arm64_func_sub_sp_offset = S->tccgen_ind;
12241224 // In gfunc_epilog these will be replaced with code to decrement SP:
12251225 o(S, 0xd503201f); // nop
12261226 o(S, 0xd503201f); // nop
1227− S->loc = 0;
1227+ S->tccgen_loc = 0;
12281228 #ifdef CONFIG_TCC_BCHECK
12291229 if (S->do_bounds_check)
12301230 gen_bounds_prolog(S);
@@ -1234,7 +1234,7 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 3 unmodified lines
12341234 ST_FUNC void gen_va_start(TCCState *S)
12351235 {
12361236 int r;
1237− --S->vtop; // we don't need the "arg"
1237+ --S->tccgen_vtop; // we don't need the "arg"
12381238 gaddrof(S);
12391239 r = intr(S, gv(S, RC_INT));
12401240
@@ -1264,7 +1264,7 @@ ST_FUNC void gen_va_start(TCCState *S) · 23 unmodified lines
12641264 arm64_movimm(S, 30, arm64_func_va_list_vr_offs);
12651265 o(S, 0xb9001c1e | r << 5); // str w30,[x(r),#28]
12661266
1267− --S->vtop;
1267+ --S->tccgen_vtop;
12681268 }
12691269
12701270 ST_FUNC void gen_va_arg(TCCState *S, CType *t)
@@ -1281,7 +1281,7 @@ ST_FUNC void gen_va_arg(TCCState *S, CType *t) · 10 unmodified lines
12811281 gaddrof(S);
12821282 r0 = intr(S, gv(S, RC_INT));
12831283 r1 = get_reg(S, RC_INT);
1284− S->vtop[0].r = r1 | VT_LVAL;
1284+ S->tccgen_vtop[0].r = r1 | VT_LVAL;
12851285 r1 = intr(S, r1);
12861286
12871287 if (!hfa) {
@@ -1310,7 +1310,7 @@ ST_FUNC void gen_va_arg(TCCState *S, CType *t) · 22 unmodified lines
13101310 uint32_t b1, b2;
13111311 o(S, 0xb9401c1e | r0 << 5); // ldr w30,[x(r0),#28] // __vr_offs
13121312 o(S, 0x310003c0 | r1 | rsz << 10); // adds w(r1),w30,#(rsz)
1313− b1 = S->ind; o(S, 0x5400000d); // b.le lab1
1313+ b1 = S->tccgen_ind; o(S, 0x5400000d); // b.le lab1
13141314 o(S, 0xf9400000 | r1 | r0 << 5); // ldr x(r1),[x(r0)] // __stack
13151315 if (fsize == 16) {
13161316 o(S, 0x91003c00 | r1 | r1 << 5); // add x(r1),x(r1),#15
@@ -1318,9 +1318,9 @@ ST_FUNC void gen_va_arg(TCCState *S, CType *t) · 1 unmodified line
13181318 }
13191319 o(S, 0x9100001e | r1 << 5 | ssz << 10); // add x30,x(r1),#(ssz)
13201320 o(S, 0xf900001e | r0 << 5); // str x30,[x(r0)] // __stack
1321− b2 = S->ind; o(S, 0x14000000); // b lab2
1321+ b2 = S->tccgen_ind; o(S, 0x14000000); // b lab2
13221322 // lab1:
1323− write32le(cur_text_section->data + b1, 0x5400000d | (S->ind - b1) << 3);
1323+ write32le(cur_text_section->data + b1, 0x5400000d | (S->tccgen_ind - b1) << 3);
13241324 o(S, 0xb9001c00 | r1 | r0 << 5); // str w(r1),[x(r0),#28] // __vr_offs
13251325 o(S, 0xf9400800 | r1 | r0 << 5); // ldr x(r1),[x(r0),#16] // __vr_top
13261326 if (hfa == 1 || fsize == 16)
@@ -1328,9 +1328,9 @@ ST_FUNC void gen_va_arg(TCCState *S, CType *t) · 1 unmodified line
13281328 else {
13291329 // We need to change the layout of this HFA.
13301330 // Get some space on the stack using global variable "loc":
1331− S->loc = (S->loc - size) & -(uint32_t)align;
1331+ S->tccgen_loc = (S->tccgen_loc - size) & -(uint32_t)align;
13321332 o(S, 0x8b3ec000 | 30 | r1 << 5); // add x30,x(r1),w30,sxtw
1333− arm64_movimm(S, r1, S->loc);
1333+ arm64_movimm(S, r1, S->tccgen_loc);
13341334 o(S, 0x8b0003a0 | r1 | r1 << 16); // add x(r1),x29,x(r1)
13351335 o(S, 0x4c402bdc | (uint32_t)fsize << 7 |
13361336 (uint32_t)(hfa == 2) << 15 |
@@ -1340,7 +1340,7 @@ ST_FUNC void gen_va_arg(TCCState *S, CType *t) · 3 unmodified lines
13401340 (uint32_t)(hfa != 3) << 21); // st(hfa) {v28.(s|d),...}[0],[x(r1)]
13411341 }
13421342 // lab2:
1343− write32le(cur_text_section->data + b2, 0x14000000 | (S->ind - b2) >> 2);
1343+ write32le(cur_text_section->data + b2, 0x14000000 | (S->tccgen_ind - b2) >> 2);
13441344 }
13451345 }
13461346
@@ -1380,7 +1380,7 @@ ST_FUNC void gfunc_return(TCCState *S, CType *func_type) · 33 unmodified lines
13801380 }
13811381 case 16:
13821382 if ((func_type->t & VT_BTYPE) == VT_STRUCT) {
1383− uint32_t j, sz, n = arm64_hfa(&S->vtop->type, &sz);
1383+ uint32_t j, sz, n = arm64_hfa(&S->tccgen_vtop->type, &sz);
13841384 gaddrof(S);
13851385 gv(S, RC_R(0));
13861386 for (j = 0; j < n; j++)
@@ -1394,7 +1394,7 @@ ST_FUNC void gfunc_return(TCCState *S, CType *func_type) · 7 unmodified lines
13941394 default:
13951395 assert(0);
13961396 }
1397− S->vtop--;
1397+ S->tccgen_vtop--;
13981398 }
13991399
14001400 ST_FUNC void gfunc_epilog(TCCState *S)
@@ -1404,10 +1404,10 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 3 unmodified lines
14041404 gen_bounds_epilog(S);
14051405 #endif
14061406
1407− if (S->loc) {
1407+ if (S->tccgen_loc) {
14081408 // Insert instructions to subtract size of stack frame from SP.
14091409 unsigned char *ptr = cur_text_section->data + arm64_func_sub_sp_offset;
1410− uint64_t diff = (-S->loc + 15) & ~15;
1410+ uint64_t diff = (-S->tccgen_loc + 15) & ~15;
14111411 if (!(diff >> 24)) {
14121412 if (diff & 0xfff) // sub sp,sp,#(diff & 0xfff)
14131413 write32le(ptr, 0xd10003ff | (diff & 0xfff) << 10);
@@ -1452,8 +1452,8 @@ ST_FUNC void gen_fill_nops(TCCState *S, int bytes) · 38 unmodified lines
14521452 // Generate forward branch to label:
14531453 ST_FUNC int gjmp(TCCState *S, int t)
14541454 {
1455− int r = S->ind;
1456− if (S->nocode_wanted)
1455+ int r = S->tccgen_ind;
1456+ if (S->tccgen_nocode_wanted)
14571457 return t;
14581458 o(S, t);
14591459 return r;
@@ -1462,8 +1462,8 @@ ST_FUNC int gjmp(TCCState *S, int t) · 2 unmodified lines
14621462 // Generate branch to known address:
14631463 ST_FUNC void gjmp_addr(TCCState *S, int a)
14641464 {
1465− assert(a - S->ind + 0x8000000 < 0x10000000);
1466− o(S, 0x14000000 | ((a - S->ind) >> 2 & 0x3ffffff));
1465+ assert(a - S->tccgen_ind + 0x8000000 < 0x10000000);
1466+ o(S, 0x14000000 | ((a - S->tccgen_ind) >> 2 & 0x3ffffff));
14671467 }
14681468
14691469 ST_FUNC int gjmp_append(TCCState *S, int n, int t)
@@ -1483,7 +1483,7 @@ ST_FUNC int gjmp_append(TCCState *S, int n, int t) · 13 unmodified lines
14831483 void arm64_vset_VT_CMP(TCCState *S, int op)
14841484 {
14851485 if (op >= TOK_ULT && op <= TOK_GT) {
1486− S->vtop->cmp_r = S->vtop->r;
1486+ S->tccgen_vtop->cmp_r = S->tccgen_vtop->r;
14871487 vset_VT_CMP(S, 0x80);
14881488 }
14891489 }
@@ -1505,16 +1505,16 @@ static void arm64_load_cmp(TCCState *S, int r, SValue *sv) · 15 unmodified lines
15051505
15061506 ST_FUNC int gjmp_cond(TCCState *S, int op, int t)
15071507 {
1508− int bt = S->vtop->type.t & VT_BTYPE;
1508+ int bt = S->tccgen_vtop->type.t & VT_BTYPE;
15091509
15101510 int inv = op & 1;
1511− S->vtop->r = S->vtop->cmp_r;
1511+ S->tccgen_vtop->r = S->tccgen_vtop->cmp_r;
15121512
15131513 if (bt == VT_LDOUBLE) {
15141514 uint32_t a, b, f = fltr(gv(S, RC_FLOAT));
15151515 a = get_reg(S, RC_INT);
15161516 vpushi(S, 0);
1517− S->vtop[0].r = a;
1517+ S->tccgen_vtop[0].r = a;
15181518 b = get_reg(S, RC_INT);
15191519 a = intr(S, a);
15201520 b = intr(S, b);
@@ -1522,7 +1522,7 @@ ST_FUNC int gjmp_cond(TCCState *S, int op, int t) · 1 unmodified line
15221522 o(S, 0x4e183c00 | b | f << 5); // mov x(b),v(f).d[1]
15231523 o(S, 0xaa000400 | a | a << 5 | b << 16); // orr x(a),x(a),x(b),lsl #1
15241524 o(S, 0xb4000040 | a | !!inv << 24); // cbz/cbnz x(a),.+8
1525− --S->vtop;
1525+ --S->tccgen_vtop;
15261526 }
15271527 else if (bt == VT_FLOAT || bt == VT_DOUBLE) {
15281528 uint32_t a = fltr(gv(S, RC_FLOAT));
@@ -1639,20 +1639,20 @@ static void arm64_gen_opil(TCCState *S, int op, uint32_t l) · 110 unmodified lines
16391639 uint64_t val;
16401640 int rev = 1;
16411641
1642− if (arm64_iconst(0, &S->vtop[0])) {
1642+ if (arm64_iconst(0, &S->tccgen_vtop[0])) {
16431643 vswap(S);
16441644 rev = 0;
16451645 }
1646− if (arm64_iconst(&val, &S->vtop[-1])) {
1646+ if (arm64_iconst(&val, &S->tccgen_vtop[-1])) {
16471647 gv(S, RC_INT);
1648− a = intr(S, S->vtop[0].r);
1649− --S->vtop;
1648+ a = intr(S, S->tccgen_vtop[0].r);
1649+ --S->tccgen_vtop;
16501650 x = get_reg(S, RC_INT);
1651− ++S->vtop;
1651+ ++S->tccgen_vtop;
16521652 if (arm64_gen_opic(S, op, l, rev, val, intr(S, x), a)) {
1653− S->vtop[0].r = x;
1653+ S->tccgen_vtop[0].r = x;
16541654 vswap(S);
1655− --S->vtop;
1655+ --S->tccgen_vtop;
16561656 return;
16571657 }
16581658 }
@@ -1661,13 +1661,13 @@ static void arm64_gen_opil(TCCState *S, int op, uint32_t l) · 2 unmodified lines
16611661 }
16621662
16631663 gv2(S, RC_INT, RC_INT);
1664− assert(S->vtop[-1].r < VT_CONST && S->vtop[0].r < VT_CONST);
1665− a = intr(S, S->vtop[-1].r);
1666− b = intr(S, S->vtop[0].r);
1667− S->vtop -= 2;
1664+ assert(S->tccgen_vtop[-1].r < VT_CONST && S->tccgen_vtop[0].r < VT_CONST);
1665+ a = intr(S, S->tccgen_vtop[-1].r);
1666+ b = intr(S, S->tccgen_vtop[0].r);
1667+ S->tccgen_vtop -= 2;
16681668 x = get_reg(S, RC_INT);
1669− ++S->vtop;
1670− S->vtop[0].r = x;
1669+ ++S->tccgen_vtop;
1670+ S->tccgen_vtop[0].r = x;
16711671 x = intr(S, x);
16721672
16731673 switch (op) {
@@ -1768,7 +1768,7 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 94 unmodified lines
17681768 arm64_vset_VT_CMP(S, op);
17691769 }
17701770
1771−ST_FUNC void gen_opl(TCCState *S, int op)
1771+ST_FUNC void gen_opl(TCCState* S, int op)
17721772 {
17731773 arm64_gen_opil(S, op, 1);
17741774 arm64_vset_VT_CMP(S, op);
@@ -1778,8 +1778,8 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 3 unmodified lines
17781778 {
17791779 uint32_t x, a, b, dbl;
17801780
1781− if (S->vtop[0].type.t == VT_LDOUBLE) {
1782− CType type = S->vtop[0].type;
1781+ if (S->tccgen_vtop[0].type.t == VT_LDOUBLE) {
1782+ CType type = S->tccgen_vtop[0].type;
17831783 int func = 0;
17841784 int cond = -1;
17851785 switch (op) {
@@ -1799,9 +1799,9 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 13 unmodified lines
17991799 vrott(S, 3);
18001800 gfunc_call(S, 2);
18011801 vpushi(S, 0);
1802− S->vtop->r = cond < 0 ? REG_FRET : REG_IRET;
1802+ S->tccgen_vtop->r = cond < 0 ? REG_FRET : REG_IRET;
18031803 if (cond < 0)
1804− S->vtop->type = type;
1804+ S->tccgen_vtop->type = type;
18051805 else {
18061806 o(S, 0x7100001f); // cmp w0,#0
18071807 o(S, 0x1a9f07e0 | (uint32_t)cond << 12); // cset w0,(cond)
@@ -1809,24 +1809,24 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 1 unmodified line
18091809 return;
18101810 }
18111811
1812− dbl = S->vtop[0].type.t != VT_FLOAT;
1812+ dbl = S->tccgen_vtop[0].type.t != VT_FLOAT;
18131813 gv2(S, RC_FLOAT, RC_FLOAT);
1814− assert(S->vtop[-1].r < VT_CONST && S->vtop[0].r < VT_CONST);
1815− a = fltr(S->vtop[-1].r);
1816− b = fltr(S->vtop[0].r);
1817− S->vtop -= 2;
1814+ assert(S->tccgen_vtop[-1].r < VT_CONST && S->tccgen_vtop[0].r < VT_CONST);
1815+ a = fltr(S->tccgen_vtop[-1].r);
1816+ b = fltr(S->tccgen_vtop[0].r);
1817+ S->tccgen_vtop -= 2;
18181818 switch (op) {
18191819 case TOK_EQ: case TOK_NE:
18201820 case TOK_LT: case TOK_GE: case TOK_LE: case TOK_GT:
18211821 x = get_reg(S, RC_INT);
1822− ++S->vtop;
1823− S->vtop[0].r = x;
1822+ ++S->tccgen_vtop;
1823+ S->tccgen_vtop[0].r = x;
18241824 x = intr(S, x);
18251825 break;
18261826 default:
18271827 x = get_reg(S, RC_FLOAT);
1828− ++S->vtop;
1829− S->vtop[0].r = x;
1828+ ++S->tccgen_vtop;
1829+ S->tccgen_vtop[0].r = x;
18301830 x = fltr(x);
18311831 break;
18321832 }
@@ -1894,7 +1894,7 @@ ST_FUNC void gen_cvt_csti(TCCState *S, int t) · 61 unmodified lines
18941894 ST_FUNC void gen_cvt_itof(TCCState *S, int t)
18951895 {
18961896 if (t == VT_LDOUBLE) {
1897− int f = S->vtop->type.t;
1897+ int f = S->tccgen_vtop->type.t;
18981898 int func = (f & VT_BTYPE) == VT_LLONG ?
18991899 (f & VT_UNSIGNED ? TOK___floatunditf : TOK___floatditf) :
19001900 (f & VT_UNSIGNED ? TOK___floatunsitf : TOK___floatsitf);
@@ -1902,18 +1902,18 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 1 unmodified line
19021902 vrott(S, 2);
19031903 gfunc_call(S, 1);
19041904 vpushi(S, 0);
1905− S->vtop->type.t = t;
1906− S->vtop->r = REG_FRET;
1905+ S->tccgen_vtop->type.t = t;
1906+ S->tccgen_vtop->r = REG_FRET;
19071907 return;
19081908 }
19091909 else {
19101910 int d, n = intr(S, gv(S, RC_INT));
1911− int s = !(S->vtop->type.t & VT_UNSIGNED);
1912− uint32_t l = ((S->vtop->type.t & VT_BTYPE) == VT_LLONG);
1913− --S->vtop;
1911+ int s = !(S->tccgen_vtop->type.t & VT_UNSIGNED);
1912+ uint32_t l = ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG);
1913+ --S->tccgen_vtop;
19141914 d = get_reg(S, RC_FLOAT);
1915− ++S->vtop;
1916− S->vtop[0].r = d;
1915+ ++S->tccgen_vtop;
1916+ S->tccgen_vtop[0].r = d;
19171917 o(S, 0x1e220000 | (uint32_t)!s << 16 |
19181918 (uint32_t)(t != VT_FLOAT) << 22 | fltr(d) |
19191919 l << 31 | n << 5); // [us]cvtf [sd](d),[wx](n)
@@ -1922,7 +1922,7 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 2 unmodified lines
19221922
19231923 ST_FUNC void gen_cvt_ftoi(TCCState *S, int t)
19241924 {
1925− if ((S->vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
1925+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
19261926 int func = (t & VT_BTYPE) == VT_LLONG ?
19271927 (t & VT_UNSIGNED ? TOK___fixunstfdi : TOK___fixtfdi) :
19281928 (t & VT_UNSIGNED ? TOK___fixunstfsi : TOK___fixtfsi);
@@ -1930,17 +1930,17 @@ ST_FUNC void gen_cvt_ftoi(TCCState *S, int t) · 1 unmodified line
19301930 vrott(S, 2);
19311931 gfunc_call(S, 1);
19321932 vpushi(S, 0);
1933− S->vtop->type.t = t;
1934− S->vtop->r = REG_IRET;
1933+ S->tccgen_vtop->type.t = t;
1934+ S->tccgen_vtop->r = REG_IRET;
19351935 return;
19361936 }
19371937 else {
19381938 int d, n = fltr(gv(S, RC_FLOAT));
1939− uint32_t l = ((S->vtop->type.t & VT_BTYPE) != VT_FLOAT);
1940− --S->vtop;
1939+ uint32_t l = ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_FLOAT);
1940+ --S->tccgen_vtop;
19411941 d = get_reg(S, RC_INT);
1942− ++S->vtop;
1943− S->vtop[0].r = d;
1942+ ++S->tccgen_vtop;
1943+ S->tccgen_vtop[0].r = d;
19441944 o(S, 0x1e380000 |
19451945 (uint32_t)!!(t & VT_UNSIGNED) << 16 |
19461946 (uint32_t)((t & VT_BTYPE) == VT_LLONG) << 31 | intr(S, d) |
@@ -1950,7 +1950,7 @@ ST_FUNC void gen_cvt_ftoi(TCCState *S, int t) · 3 unmodified lines
19501950
19511951 ST_FUNC void gen_cvt_ftof(TCCState *S, int t)
19521952 {
1953− int f = S->vtop[0].type.t & VT_BTYPE;
1953+ int f = S->tccgen_vtop[0].type.t & VT_BTYPE;
19541954 assert(t == VT_FLOAT || t == VT_DOUBLE || t == VT_LDOUBLE);
19551955 assert(f == VT_FLOAT || f == VT_DOUBLE || f == VT_LDOUBLE);
19561956 if (t == f)
@@ -1964,18 +1964,18 @@ ST_FUNC void gen_cvt_ftof(TCCState *S, int t) · 7 unmodified lines
19641964 vrott(S, 2);
19651965 gfunc_call(S, 1);
19661966 vpushi(S, 0);
1967− S->vtop->type.t = t;
1968− S->vtop->r = REG_FRET;
1967+ S->tccgen_vtop->type.t = t;
1968+ S->tccgen_vtop->r = REG_FRET;
19691969 }
19701970 else {
19711971 int x, a;
19721972 gv(S, RC_FLOAT);
1973− assert(S->vtop[0].r < VT_CONST);
1974− a = fltr(S->vtop[0].r);
1975− --S->vtop;
1973+ assert(S->tccgen_vtop[0].r < VT_CONST);
1974+ a = fltr(S->tccgen_vtop[0].r);
1975+ --S->tccgen_vtop;
19761976 x = get_reg(S, RC_FLOAT);
1977− ++S->vtop;
1978− S->vtop[0].r = x;
1977+ ++S->tccgen_vtop;
1978+ S->tccgen_vtop[0].r = x;
19791979 x = fltr(x);
19801980
19811981 if (f == VT_FLOAT)
@@ -1986,16 +1986,16 @@ ST_FUNC void gen_cvt_ftof(TCCState *S, int t) · 4 unmodified lines
19861986 }
19871987
19881988 /* increment tcov counter */
1989−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv)
1989+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv)
19901990 {
19911991 int r1, r2;
19921992
19931993 vpushv(S, sv);
1994− S->vtop->r = r1 = get_reg(S, RC_INT);
1994+ S->tccgen_vtop->r = r1 = get_reg(S, RC_INT);
19951995 r2 = get_reg(S, RC_INT);
1996− greloca(S, cur_text_section, sv->sym, S->ind, R_AARCH64_ADR_GOT_PAGE, 0);
1996+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind, R_AARCH64_ADR_GOT_PAGE, 0);
19971997 o(S, 0x90000000 | r1); // adrp r1, #sym
1998− greloca(S, cur_text_section, sv->sym, S->ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
1998+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind, R_AARCH64_LD64_GOT_LO12_NC, 0);
19991999 o(S, 0xf9400000 | r1 | (r1 << 5)); // ld xr,[xr, #sym]
20002000 o(S, 0xf9400000 | (intr(S, r1)<<5) | intr(S, r2)); // ldr r2, [r1]
20012001 o(S, 0x91000400 | (intr(S, r2)<<5) | intr(S, r2)); // add r2, r2, #1
@@ -2006,7 +2006,7 @@ ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv) · 4 unmodified lines
20062006 ST_FUNC void ggoto(TCCState *S)
20072007 {
20082008 arm64_gen_bl_or_b(S, 1);
2009− --S->vtop;
2009+ --S->tccgen_vtop;
20102010 }
20112011
20122012 ST_FUNC void gen_clear_cache(TCCState *S)
@@ -2014,17 +2014,17 @@ ST_FUNC void gen_clear_cache(TCCState *S) · 1 unmodified line
20142014 uint32_t beg, end, dsz, isz, p, lab1, b1;
20152015 gv2(S, RC_INT, RC_INT);
20162016 vpushi(S, 0);
2017− S->vtop->r = get_reg(S, RC_INT);
2017+ S->tccgen_vtop->r = get_reg(S, RC_INT);
20182018 vpushi(S, 0);
2019− S->vtop->r = get_reg(S, RC_INT);
2019+ S->tccgen_vtop->r = get_reg(S, RC_INT);
20202020 vpushi(S, 0);
2021− S->vtop->r = get_reg(S, RC_INT);
2022− beg = intr(S, S->vtop[-4].r); // x0
2023− end = intr(S, S->vtop[-3].r); // x1
2024− dsz = intr(S, S->vtop[-2].r); // x2
2025− isz = intr(S, S->vtop[-1].r); // x3
2026− p = intr(S, S->vtop[0].r); // x4
2027− S->vtop -= 5;
2021+ S->tccgen_vtop->r = get_reg(S, RC_INT);
2022+ beg = intr(S, S->tccgen_vtop[-4].r); // x0
2023+ end = intr(S, S->tccgen_vtop[-3].r); // x1
2024+ dsz = intr(S, S->tccgen_vtop[-2].r); // x2
2025+ isz = intr(S, S->tccgen_vtop[-1].r); // x3
2026+ p = intr(S, S->tccgen_vtop[0].r); // x4
2027+ S->tccgen_vtop -= 5;
20282028
20292029 o(S, 0xd53b0020 | isz); // mrs x(isz),ctr_el0
20302030 o(S, 0x52800080 | p); // mov w(p),#4
@@ -2034,23 +2034,23 @@ ST_FUNC void gen_clear_cache(TCCState *S) · 3 unmodified lines
20342034 o(S, 0x1ac02000 | isz | p << 5 | isz << 16); // lsl w(isz),w(p),w(isz)
20352035 o(S, 0x51000400 | p | dsz << 5); // sub w(p),w(dsz),#1
20362036 o(S, 0x8a240004 | p | beg << 5 | p << 16); // bic x(p),x(beg),x(p)
2037− b1 = S->ind; o(S, 0x14000000); // b
2038− lab1 = S->ind;
2037+ b1 = S->tccgen_ind; o(S, 0x14000000); // b
2038+ lab1 = S->tccgen_ind;
20392039 o(S, 0xd50b7b20 | p); // dc cvau,x(p)
20402040 o(S, 0x8b000000 | p | p << 5 | dsz << 16); // add x(p),x(p),x(dsz)
2041− write32le(cur_text_section->data + b1, 0x14000000 | (S->ind - b1) >> 2);
2041+ write32le(cur_text_section->data + b1, 0x14000000 | (S->tccgen_ind - b1) >> 2);
20422042 o(S, 0xeb00001f | p << 5 | end << 16); // cmp x(p),x(end)
2043− o(S, 0x54ffffa3 | ((lab1 - S->ind) << 3 & 0xffffe0)); // b.cc lab1
2043+ o(S, 0x54ffffa3 | ((lab1 - S->tccgen_ind) << 3 & 0xffffe0)); // b.cc lab1
20442044 o(S, 0xd5033b9f); // dsb ish
20452045 o(S, 0x51000400 | p | isz << 5); // sub w(p),w(isz),#1
20462046 o(S, 0x8a240004 | p | beg << 5 | p << 16); // bic x(p),x(beg),x(p)
2047− b1 = S->ind; o(S, 0x14000000); // b
2048− lab1 = S->ind;
2047+ b1 = S->tccgen_ind; o(S, 0x14000000); // b
2048+ lab1 = S->tccgen_ind;
20492049 o(S, 0xd50b7520 | p); // ic ivau,x(p)
20502050 o(S, 0x8b000000 | p | p << 5 | isz << 16); // add x(p),x(p),x(isz)
2051− write32le(cur_text_section->data + b1, 0x14000000 | (S->ind - b1) >> 2);
2051+ write32le(cur_text_section->data + b1, 0x14000000 | (S->tccgen_ind - b1) >> 2);
20522052 o(S, 0xeb00001f | p << 5 | end << 16); // cmp x(p),x(end)
2053− o(S, 0x54ffffa3 | ((lab1 - S->ind) << 3 & 0xffffe0)); // b.cc lab1
2053+ o(S, 0x54ffffa3 | ((lab1 - S->tccgen_ind) << 3 & 0xffffe0)); // b.cc lab1
20542054 o(S, 0xd5033b9f); // dsb ish
20552055 o(S, 0xd5033fdf); // isb
20562056 }
@@ -2074,7 +2074,7 @@ ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) { · 17 unmodified lines
20742074 uint32_t r;
20752075 #if defined(CONFIG_TCC_BCHECK)
20762076 if (S->do_bounds_check)
2077− vpushv(S, S->vtop);
2077+ vpushv(S, S->tccgen_vtop);
20782078 #endif
20792079 r = intr(S, gv(S, RC_INT));
20802080 #if defined(CONFIG_TCC_BCHECK)
@@ -2089,8 +2089,8 @@ ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) { · 8 unmodified lines
20892089 #if defined(CONFIG_TCC_BCHECK)
20902090 if (S->do_bounds_check) {
20912091 vpushi(S, 0);
2092− S->vtop->r = TREG_R(0);
2093− o(S, 0x910003e0 | S->vtop->r); // mov r0,sp
2092+ S->tccgen_vtop->r = TREG_R(0);
2093+ o(S, 0x910003e0 | S->tccgen_vtop->r); // mov r0,sp
20942094 vswap(S);
20952095 vpush_helper_func(S, TOK___bound_new_region);
20962096 vrott(S, 3);
c67-gen.c+183−183
@@ -186,27 +186,27 @@ static int C67_compare_reg; · 185 unmodified lines
186186 FILE *f = NULL;
187187 #endif
188188
189−void C67_g(TCCState *S, int c)
189+void C67_g(TCCState* S, int c)
190190 {
191191 int ind1;
192− if (S->nocode_wanted)
192+ if (S->tccgen_nocode_wanted)
193193 return;
194194 #ifdef ASSEMBLY_LISTING_C67
195195 fprintf(f, " %08X", c);
196196 #endif
197− ind1 = S->ind + 4;
197+ ind1 = S->tccgen_ind + 4;
198198 if (ind1 > (int) cur_text_section->data_allocated)
199199 section_realloc(S, cur_text_section, ind1);
200− cur_text_section->data[S->ind] = c & 0xff;
201− cur_text_section->data[S->ind + 1] = (c >> 8) & 0xff;
202− cur_text_section->data[S->ind + 2] = (c >> 16) & 0xff;
203− cur_text_section->data[S->ind + 3] = (c >> 24) & 0xff;
204− S->ind = ind1;
200+ cur_text_section->data[S->tccgen_ind] = c & 0xff;
201+ cur_text_section->data[S->tccgen_ind + 1] = (c >> 8) & 0xff;
202+ cur_text_section->data[S->tccgen_ind + 2] = (c >> 16) & 0xff;
203+ cur_text_section->data[S->tccgen_ind + 3] = (c >> 24) & 0xff;
204+ S->tccgen_ind = ind1;
205205 }
206206
207207
208208 /* output a symbol and patch all calls to it */
209−void gsym_addr(TCCState *S, int t, int a)
209+void gsym_addr(TCCState* S, int t, int a)
210210 {
211211 int n, *ptr;
212212 while (t) {
@@ -220,7 +220,7 @@ void gsym_addr(TCCState *S, int t, int a) · 7 unmodified lines
220220
221221 // define a label that will be relocated
222222
223− sym = get_sym_ref(S, &S->char_pointer_type, cur_text_section, a, 0);
223+ sym = get_sym_ref(S, &S->tccgen_char_pointer_type, cur_text_section, a, 0);
224224 greloc(S, cur_text_section, sym, t, R_C60LO16);
225225 greloc(S, cur_text_section, sym, t + 4, R_C60HI16);
226226
@@ -255,7 +255,7 @@ int ConvertRegToRegClass(int r) · 28 unmodified lines
255255
256256 // map TCC reg to C67 reg number
257257
258−int C67_map_regn(TCCState *S, int r)
258+int C67_map_regn(TCCState* S, int r)
259259 {
260260 if (r == 0) // normal tcc regs
261261 return 0x2; // A2
@@ -296,7 +296,7 @@ int C67_map_regn(TCCState *S, int r) · 34 unmodified lines
296296 // tcc reg 1 -> A3 -> X
297297 // tcc reg B2 -> 3
298298
299−int C67_map_regc(TCCState *S, int r)
299+int C67_map_regc(TCCState* S, int r)
300300 {
301301 if (r == 0) // normal tcc regs
302302 return 0x5;
@@ -317,7 +317,7 @@ int C67_map_regc(TCCState *S, int r) · 14 unmodified lines
317317
318318 // map TCC reg to C67 reg side A or B
319319
320−int C67_map_regs(TCCState *S, int r)
320+int C67_map_regs(TCCState* S, int r)
321321 {
322322 if (r == 0) // normal tcc regs
323323 return 0x0;
@@ -345,7 +345,7 @@ int C67_map_regs(TCCState *S, int r) · 21 unmodified lines
345345 return 0;
346346 }
347347
348−int C67_map_S12(TCCState *S, char *s)
348+int C67_map_S12(TCCState* S, char *s)
349349 {
350350 if (strstr(s, ".S1") != NULL)
351351 return 0;
@@ -357,7 +357,7 @@ int C67_map_S12(TCCState *S, char *s) · 5 unmodified lines
357357 return 0;
358358 }
359359
360−int C67_map_D12(TCCState *S, char *s)
360+int C67_map_D12(TCCState* S, char *s)
361361 {
362362 if (strstr(s, ".D1") != NULL)
363363 return 0;
@@ -371,7 +371,7 @@ int C67_map_D12(TCCState *S, char *s) · 7 unmodified lines
371371
372372
373373
374−void C67_asm(TCCState *S, const char *s, int a, int b, int c)
374+void C67_asm(TCCState* S, const char *s, int a, int b, int c)
375375 {
376376 BOOL xpath;
377377
@@ -1195,189 +1195,189 @@ void C67_asm(TCCState *S, const char *s, int a, int b, int c) · 817 unmodified lines
11951195
11961196 //r=reg to load, fr=from reg, symbol for relocation, constant
11971197
1198−void C67_MVKL(TCCState *S, int r, int fc)
1198+void C67_MVKL(TCCState* S, int r, int fc)
11991199 {
12001200 C67_asm(S, "MVKL.", fc, r, 0);
12011201 }
12021202
1203−void C67_MVKH(TCCState *S, int r, int fc)
1203+void C67_MVKH(TCCState* S, int r, int fc)
12041204 {
12051205 C67_asm(S, "MVKH.", fc, r, 0);
12061206 }
12071207
1208−void C67_STB_SP_A0(TCCState *S, int r)
1208+void C67_STB_SP_A0(TCCState* S, int r)
12091209 {
12101210 C67_asm(S, "STB.D *+SP[A0]", r, 0, 0); // STB r,*+SP[A0]
12111211 }
12121212
1213−void C67_STH_SP_A0(TCCState *S, int r)
1213+void C67_STH_SP_A0(TCCState* S, int r)
12141214 {
12151215 C67_asm(S, "STH.D *+SP[A0]", r, 0, 0); // STH r,*+SP[A0]
12161216 }
12171217
1218−void C67_STW_SP_A0(TCCState *S, int r)
1218+void C67_STW_SP_A0(TCCState* S, int r)
12191219 {
12201220 C67_asm(S, "STW.D *+SP[A0]", r, 0, 0); // STW r,*+SP[A0]
12211221 }
12221222
1223−void C67_STB_PTR(TCCState *S, int r, int r2)
1223+void C67_STB_PTR(TCCState* S, int r, int r2)
12241224 {
12251225 C67_asm(S, "STB.D *", r, r2, 0); // STB r, *r2
12261226 }
12271227
1228−void C67_STH_PTR(TCCState *S, int r, int r2)
1228+void C67_STH_PTR(TCCState* S, int r, int r2)
12291229 {
12301230 C67_asm(S, "STH.D *", r, r2, 0); // STH r, *r2
12311231 }
12321232
1233−void C67_STW_PTR(TCCState *S, int r, int r2)
1233+void C67_STW_PTR(TCCState* S, int r, int r2)
12341234 {
12351235 C67_asm(S, "STW.D *", r, r2, 0); // STW r, *r2
12361236 }
12371237
1238−void C67_STW_PTR_PRE_INC(TCCState *S, int r, int r2, int n)
1238+void C67_STW_PTR_PRE_INC(TCCState* S, int r, int r2, int n)
12391239 {
12401240 C67_asm(S, "STW.D +*", r, r2, n); // STW r, *+r2
12411241 }
12421242
1243−void C67_PUSH(TCCState *S, int r)
1243+void C67_PUSH(TCCState* S, int r)
12441244 {
12451245 C67_asm(S, "STW.D SP POST DEC", r, 0, 0); // STW r,*SP--
12461246 }
12471247
1248−void C67_LDW_SP_A0(TCCState *S, int r)
1248+void C67_LDW_SP_A0(TCCState* S, int r)
12491249 {
12501250 C67_asm(S, "LDW.D *+SP[A0]", r, 0, 0); // LDW *+SP[A0],r
12511251 }
12521252
1253−void C67_LDDW_SP_A0(TCCState *S, int r)
1253+void C67_LDDW_SP_A0(TCCState* S, int r)
12541254 {
12551255 C67_asm(S, "LDDW.D *+SP[A0]", r, 0, 0); // LDDW *+SP[A0],r
12561256 }
12571257
1258−void C67_LDH_SP_A0(TCCState *S, int r)
1258+void C67_LDH_SP_A0(TCCState* S, int r)
12591259 {
12601260 C67_asm(S, "LDH.D *+SP[A0]", r, 0, 0); // LDH *+SP[A0],r
12611261 }
12621262
1263−void C67_LDB_SP_A0(TCCState *S, int r)
1263+void C67_LDB_SP_A0(TCCState* S, int r)
12641264 {
12651265 C67_asm(S, "LDB.D *+SP[A0]", r, 0, 0); // LDB *+SP[A0],r
12661266 }
12671267
1268−void C67_LDHU_SP_A0(TCCState *S, int r)
1268+void C67_LDHU_SP_A0(TCCState* S, int r)
12691269 {
12701270 C67_asm(S, "LDHU.D *+SP[A0]", r, 0, 0); // LDHU *+SP[A0],r
12711271 }
12721272
1273−void C67_LDBU_SP_A0(TCCState *S, int r)
1273+void C67_LDBU_SP_A0(TCCState* S, int r)
12741274 {
12751275 C67_asm(S, "LDBU.D *+SP[A0]", r, 0, 0); // LDBU *+SP[A0],r
12761276 }
12771277
1278−void C67_LDW_PTR(TCCState *S, int r, int r2)
1278+void C67_LDW_PTR(TCCState* S, int r, int r2)
12791279 {
12801280 C67_asm(S, "LDW.D *", r, r2, 0); // LDW *r,r2
12811281 }
12821282
1283−void C67_LDDW_PTR(TCCState *S, int r, int r2)
1283+void C67_LDDW_PTR(TCCState* S, int r, int r2)
12841284 {
12851285 C67_asm(S, "LDDW.D *", r, r2, 0); // LDDW *r,r2
12861286 }
12871287
1288−void C67_LDH_PTR(TCCState *S, int r, int r2)
1288+void C67_LDH_PTR(TCCState* S, int r, int r2)
12891289 {
12901290 C67_asm(S, "LDH.D *", r, r2, 0); // LDH *r,r2
12911291 }
12921292
1293−void C67_LDB_PTR(TCCState *S, int r, int r2)
1293+void C67_LDB_PTR(TCCState* S, int r, int r2)
12941294 {
12951295 C67_asm(S, "LDB.D *", r, r2, 0); // LDB *r,r2
12961296 }
12971297
1298−void C67_LDHU_PTR(TCCState *S, int r, int r2)
1298+void C67_LDHU_PTR(TCCState* S, int r, int r2)
12991299 {
13001300 C67_asm(S, "LDHU.D *", r, r2, 0); // LDHU *r,r2
13011301 }
13021302
1303−void C67_LDBU_PTR(TCCState *S, int r, int r2)
1303+void C67_LDBU_PTR(TCCState* S, int r, int r2)
13041304 {
13051305 C67_asm(S, "LDBU.D *", r, r2, 0); // LDBU *r,r2
13061306 }
13071307
1308−void C67_LDW_PTR_PRE_INC(TCCState *S, int r, int r2)
1308+void C67_LDW_PTR_PRE_INC(TCCState* S, int r, int r2)
13091309 {
13101310 C67_asm(S, "LDW.D +*", r, r2, 0); // LDW *+r,r2
13111311 }
13121312
1313−void C67_POP(TCCState *S, int r)
1313+void C67_POP(TCCState* S, int r)
13141314 {
13151315 C67_asm(S, "LDW.D SP PRE INC", r, 0, 0); // LDW *++SP,r
13161316 }
13171317
1318−void C67_POP_DW(TCCState *S, int r)
1318+void C67_POP_DW(TCCState* S, int r)
13191319 {
13201320 C67_asm(S, "LDDW.D SP PRE INC", r, 0, 0); // LDDW *++SP,r
13211321 }
13221322
1323−void C67_CMPLT(TCCState *S, int s1, int s2, int dst)
1323+void C67_CMPLT(TCCState* S, int s1, int s2, int dst)
13241324 {
13251325 C67_asm(S, "CMPLT.L1", s1, s2, dst);
13261326 }
13271327
1328−void C67_CMPGT(TCCState *S, int s1, int s2, int dst)
1328+void C67_CMPGT(TCCState* S, int s1, int s2, int dst)
13291329 {
13301330 C67_asm(S, "CMPGT.L1", s1, s2, dst);
13311331 }
13321332
1333−void C67_CMPEQ(TCCState *S, int s1, int s2, int dst)
1333+void C67_CMPEQ(TCCState* S, int s1, int s2, int dst)
13341334 {
13351335 C67_asm(S, "CMPEQ.L1", s1, s2, dst);
13361336 }
13371337
1338−void C67_CMPLTU(TCCState *S, int s1, int s2, int dst)
1338+void C67_CMPLTU(TCCState* S, int s1, int s2, int dst)
13391339 {
13401340 C67_asm(S, "CMPLTU.L1", s1, s2, dst);
13411341 }
13421342
1343−void C67_CMPGTU(TCCState *S, int s1, int s2, int dst)
1343+void C67_CMPGTU(TCCState* S, int s1, int s2, int dst)
13441344 {
13451345 C67_asm(S, "CMPGTU.L1", s1, s2, dst);
13461346 }
13471347
13481348
1349−void C67_CMPLTSP(TCCState *S, int s1, int s2, int dst)
1349+void C67_CMPLTSP(TCCState* S, int s1, int s2, int dst)
13501350 {
13511351 C67_asm(S, "CMPLTSP.S1", s1, s2, dst);
13521352 }
13531353
1354−void C67_CMPGTSP(TCCState *S, int s1, int s2, int dst)
1354+void C67_CMPGTSP(TCCState* S, int s1, int s2, int dst)
13551355 {
13561356 C67_asm(S, "CMPGTSP.S1", s1, s2, dst);
13571357 }
13581358
1359−void C67_CMPEQSP(TCCState *S, int s1, int s2, int dst)
1359+void C67_CMPEQSP(TCCState* S, int s1, int s2, int dst)
13601360 {
13611361 C67_asm(S, "CMPEQSP.S1", s1, s2, dst);
13621362 }
13631363
1364−void C67_CMPLTDP(TCCState *S, int s1, int s2, int dst)
1364+void C67_CMPLTDP(TCCState* S, int s1, int s2, int dst)
13651365 {
13661366 C67_asm(S, "CMPLTDP.S1", s1, s2, dst);
13671367 }
13681368
1369−void C67_CMPGTDP(TCCState *S, int s1, int s2, int dst)
1369+void C67_CMPGTDP(TCCState* S, int s1, int s2, int dst)
13701370 {
13711371 C67_asm(S, "CMPGTDP.S1", s1, s2, dst);
13721372 }
13731373
1374−void C67_CMPEQDP(TCCState *S, int s1, int s2, int dst)
1374+void C67_CMPEQDP(TCCState* S, int s1, int s2, int dst)
13751375 {
13761376 C67_asm(S, "CMPEQDP.S1", s1, s2, dst);
13771377 }
13781378
13791379
1380−void C67_IREG_B_REG(TCCState *S, int inv, int r1, int r2) // [!R] B r2
1380+void C67_IREG_B_REG(TCCState* S, int inv, int r1, int r2) // [!R] B r2
13811381 {
13821382 C67_asm(S, "B.S2", inv, r1, r2);
13831383 }
@@ -1386,7 +1386,7 @@ void C67_IREG_B_REG(TCCState *S, int inv, int r1, int r2) // [!R] B r2 · 2 unmodified lines
13861386 // call with how many 32 bit words to skip
13871387 // (0 would branch to the branch instruction)
13881388
1389−void C67_B_DISP(TCCState *S, int disp) // B +2 Branch with constant displacement
1389+void C67_B_DISP(TCCState* S, int disp) // B +2 Branch with constant displacement
13901390 {
13911391 // Branch point is relative to the 8 word fetch packet
13921392 //
@@ -1395,152 +1395,152 @@ void C67_B_DISP(TCCState *S, int disp) // B +2 Branch with constant displacem · 2 unmodified lines
13951395 // so add in how many words into the fetch packet the branch is
13961396
13971397
1398− C67_asm(S, "B DISP", disp + ((S->ind & 31) >> 2), 0, 0);
1398+ C67_asm(S, "B DISP", disp + ((S->tccgen_ind & 31) >> 2), 0, 0);
13991399 }
14001400
1401−void C67_NOP(TCCState *S, int n)
1401+void C67_NOP(TCCState* S, int n)
14021402 {
14031403 C67_asm(S, "NOP", n, 0, 0);
14041404 }
14051405
1406−void C67_ADDK(TCCState *S, int n, int r)
1406+void C67_ADDK(TCCState* S, int n, int r)
14071407 {
14081408 ALWAYS_ASSERT(abs(n) < 32767);
14091409
14101410 C67_asm(S, "ADDK", n, r, 0);
14111411 }
14121412
1413−void C67_ADDK_PARALLEL(TCCState *S, int n, int r)
1413+void C67_ADDK_PARALLEL(TCCState* S, int n, int r)
14141414 {
14151415 ALWAYS_ASSERT(abs(n) < 32767);
14161416
14171417 C67_asm(S, "||ADDK", n, r, 0);
14181418 }
14191419
1420−void C67_Adjust_ADDK(TCCState *S, int *inst, int n)
1420+void C67_Adjust_ADDK(TCCState* S, int *inst, int n)
14211421 {
14221422 ALWAYS_ASSERT(abs(n) < 32767);
14231423
14241424 *inst = (*inst & (~(0xffff << 7))) | ((n & 0xffff) << 7);
14251425 }
14261426
1427−void C67_MV(TCCState *S, int r, int v)
1427+void C67_MV(TCCState* S, int r, int v)
14281428 {
14291429 C67_asm(S, "MV.L", 0, r, v);
14301430 }
14311431
14321432
1433−void C67_DPTRUNC(TCCState *S, int r, int v)
1433+void C67_DPTRUNC(TCCState* S, int r, int v)
14341434 {
14351435 C67_asm(S, "DPTRUNC.L", 0, r, v);
14361436 }
14371437
1438−void C67_SPTRUNC(TCCState *S, int r, int v)
1438+void C67_SPTRUNC(TCCState* S, int r, int v)
14391439 {
14401440 C67_asm(S, "SPTRUNC.L", 0, r, v);
14411441 }
14421442
1443−void C67_INTSP(TCCState *S, int r, int v)
1443+void C67_INTSP(TCCState* S, int r, int v)
14441444 {
14451445 C67_asm(S, "INTSP.L", 0, r, v);
14461446 }
14471447
1448−void C67_INTDP(TCCState *S, int r, int v)
1448+void C67_INTDP(TCCState* S, int r, int v)
14491449 {
14501450 C67_asm(S, "INTDP.L", 0, r, v);
14511451 }
14521452
1453−void C67_INTSPU(TCCState *S, int r, int v)
1453+void C67_INTSPU(TCCState* S, int r, int v)
14541454 {
14551455 C67_asm(S, "INTSPU.L", 0, r, v);
14561456 }
14571457
1458−void C67_INTDPU(TCCState *S, int r, int v)
1458+void C67_INTDPU(TCCState* S, int r, int v)
14591459 {
14601460 C67_asm(S, "INTDPU.L", 0, r, v);
14611461 }
14621462
1463−void C67_SPDP(TCCState *S, int r, int v)
1463+void C67_SPDP(TCCState* S, int r, int v)
14641464 {
14651465 C67_asm(S, "SPDP.L", 0, r, v);
14661466 }
14671467
1468−void C67_DPSP(TCCState *S, int r, int v) // note regs must be on the same side
1468+void C67_DPSP(TCCState* S, int r, int v) // note regs must be on the same side
14691469 {
14701470 C67_asm(S, "DPSP.L", 0, r, v);
14711471 }
14721472
1473−void C67_ADD(TCCState *S, int r, int v)
1473+void C67_ADD(TCCState* S, int r, int v)
14741474 {
14751475 C67_asm(S, "ADD.L", v, r, v);
14761476 }
14771477
1478−void C67_SUB(TCCState *S, int r, int v)
1478+void C67_SUB(TCCState* S, int r, int v)
14791479 {
14801480 C67_asm(S, "SUB.L", v, r, v);
14811481 }
14821482
1483−void C67_AND(TCCState *S, int r, int v)
1483+void C67_AND(TCCState* S, int r, int v)
14841484 {
14851485 C67_asm(S, "AND.L", v, r, v);
14861486 }
14871487
1488−void C67_OR(TCCState *S, int r, int v)
1488+void C67_OR(TCCState* S, int r, int v)
14891489 {
14901490 C67_asm(S, "OR.L", v, r, v);
14911491 }
14921492
1493−void C67_XOR(TCCState *S, int r, int v)
1493+void C67_XOR(TCCState* S, int r, int v)
14941494 {
14951495 C67_asm(S, "XOR.L", v, r, v);
14961496 }
14971497
1498−void C67_ADDSP(TCCState *S, int r, int v)
1498+void C67_ADDSP(TCCState* S, int r, int v)
14991499 {
15001500 C67_asm(S, "ADDSP.L", v, r, v);
15011501 }
15021502
1503−void C67_SUBSP(TCCState *S, int r, int v)
1503+void C67_SUBSP(TCCState* S, int r, int v)
15041504 {
15051505 C67_asm(S, "SUBSP.L", v, r, v);
15061506 }
15071507
1508−void C67_MPYSP(TCCState *S, int r, int v)
1508+void C67_MPYSP(TCCState* S, int r, int v)
15091509 {
15101510 C67_asm(S, "MPYSP.M", v, r, v);
15111511 }
15121512
1513−void C67_ADDDP(TCCState *S, int r, int v)
1513+void C67_ADDDP(TCCState* S, int r, int v)
15141514 {
15151515 C67_asm(S, "ADDDP.L", v, r, v);
15161516 }
15171517
1518−void C67_SUBDP(TCCState *S, int r, int v)
1518+void C67_SUBDP(TCCState* S, int r, int v)
15191519 {
15201520 C67_asm(S, "SUBDP.L", v, r, v);
15211521 }
15221522
1523−void C67_MPYDP(TCCState *S, int r, int v)
1523+void C67_MPYDP(TCCState* S, int r, int v)
15241524 {
15251525 C67_asm(S, "MPYDP.M", v, r, v);
15261526 }
15271527
1528−void C67_MPYI(TCCState *S, int r, int v)
1528+void C67_MPYI(TCCState* S, int r, int v)
15291529 {
15301530 C67_asm(S, "MPYI.M", v, r, v);
15311531 }
15321532
1533−void C67_SHL(TCCState *S, int r, int v)
1533+void C67_SHL(TCCState* S, int r, int v)
15341534 {
15351535 C67_asm(S, "SHL.S", r, v, v);
15361536 }
15371537
1538−void C67_SHRU(TCCState *S, int r, int v)
1538+void C67_SHRU(TCCState* S, int r, int v)
15391539 {
15401540 C67_asm(S, "SHRU.S", r, v, v);
15411541 }
15421542
1543−void C67_SHR(TCCState *S, int r, int v)
1543+void C67_SHR(TCCState* S, int r, int v)
15441544 {
15451545 C67_asm(S, "SHR.S", r, v, v);
15461546 }
@@ -1548,7 +1548,7 @@ void C67_SHR(TCCState *S, int r, int v) · 1 unmodified line
15481548
15491549
15501550 /* load 'r' from value 'sv' */
1551−void load(TCCState *S, int r, SValue * sv)
1551+void load(TCCState* S, int r, SValue * sv)
15521552 {
15531553 int v, t, ft, fc, fr, size = 0, element;
15541554 BOOL Unsigned = FALSE;
@@ -1625,8 +1625,8 @@ void load(TCCState *S, int r, SValue * sv) · 70 unmodified lines
16251625 C67_NOP(S, 4); // NOP 4
16261626 return;
16271627 } else if (fr & VT_SYM) {
1628− greloc(S, cur_text_section, sv->sym, S->ind, R_C60LO16); // rem the inst need to be patched
1629− greloc(S, cur_text_section, sv->sym, S->ind + 4, R_C60HI16);
1628+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind, R_C60LO16); // rem the inst need to be patched
1629+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind + 4, R_C60HI16);
16301630
16311631
16321632 C67_MVKL(S, C67_A0, fc); //r=reg to load, constant
@@ -1681,8 +1681,8 @@ void load(TCCState *S, int r, SValue * sv) · 48 unmodified lines
16811681 } else {
16821682 if (v == VT_CONST) {
16831683 if (fr & VT_SYM) {
1684− greloc(S, cur_text_section, sv->sym, S->ind, R_C60LO16); // rem the inst need to be patched
1685− greloc(S, cur_text_section, sv->sym, S->ind + 4, R_C60HI16);
1684+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind, R_C60LO16); // rem the inst need to be patched
1685+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind + 4, R_C60HI16);
16861686 }
16871687 C67_MVKL(S, r, fc); //r=reg to load, constant
16881688 C67_MVKH(S, r, fc); //r=reg to load, constant
@@ -1710,7 +1710,7 @@ void load(TCCState *S, int r, SValue * sv) · 21 unmodified lines
17101710
17111711
17121712 /* store register 'r' in lvalue 'v' */
1713−void store(TCCState *S, int r, SValue * v)
1713+void store(TCCState* S, int r, SValue * v)
17141714 {
17151715 int fr, bt, ft, fc, size, t, element;
17161716
@@ -1736,8 +1736,8 @@ void store(TCCState *S, int r, SValue * v) · 19 unmodified lines
17361736 /* constant memory reference */
17371737
17381738 if (v->r & VT_SYM) {
1739− greloc(S, cur_text_section, v->sym, S->ind, R_C60LO16); // rem the inst need to be patched
1740− greloc(S, cur_text_section, v->sym, S->ind + 4, R_C60HI16);
1739+ greloc(S, cur_text_section, v->sym, S->tccgen_ind, R_C60LO16); // rem the inst need to be patched
1740+ greloc(S, cur_text_section, v->sym, S->tccgen_ind + 4, R_C60HI16);
17411741 }
17421742 C67_MVKL(S, C67_A0, fc); //r=reg to load, constant
17431743 C67_MVKH(S, C67_A0, fc); //r=reg to load, constant
@@ -1813,20 +1813,20 @@ void store(TCCState *S, int r, SValue * v) · 69 unmodified lines
18131813 }
18141814
18151815 /* 'is_jmp' is '1' if it is a jump */
1816−static void gcall_or_jmp(TCCState *S, int is_jmp)
1816+static void gcall_or_jmp(TCCState* S, int is_jmp)
18171817 {
18181818 int r;
18191819 Sym *sym;
18201820
1821− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
1821+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
18221822 /* constant case */
1823− if (S->vtop->r & VT_SYM) {
1823+ if (S->tccgen_vtop->r & VT_SYM) {
18241824 /* relocation case */
18251825
18261826 // get add into A0, then start the jump B3
18271827
1828− greloc(S, cur_text_section, S->vtop->sym, S->ind, R_C60LO16); // rem the inst need to be patched
1829− greloc(S, cur_text_section, S->vtop->sym, S->ind + 4, R_C60HI16);
1828+ greloc(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind, R_C60LO16); // rem the inst need to be patched
1829+ greloc(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind + 4, R_C60HI16);
18301830
18311831 C67_MVKL(S, C67_A0, 0); //r=reg to load, constant
18321832 C67_MVKH(S, C67_A0, 0); //r=reg to load, constant
@@ -1837,9 +1837,9 @@ static void gcall_or_jmp(TCCState *S, int is_jmp) · 4 unmodified lines
18371837 } else {
18381838 // Call, must load return address into B3 during delay slots
18391839
1840− sym = get_sym_ref(S, &S->char_pointer_type, cur_text_section, S->ind + 12, 0); // symbol for return address
1841− greloc(S, cur_text_section, sym, S->ind, R_C60LO16); // rem the inst need to be patched
1842− greloc(S, cur_text_section, sym, S->ind + 4, R_C60HI16);
1840+ sym = get_sym_ref(S, &S->tccgen_char_pointer_type, cur_text_section, S->tccgen_ind + 12, 0); // symbol for return address
1841+ greloc(S, cur_text_section, sym, S->tccgen_ind, R_C60LO16); // rem the inst need to be patched
1842+ greloc(S, cur_text_section, sym, S->tccgen_ind + 4, R_C60HI16);
18431843 C67_MVKL(S, C67_B3, 0); //r=reg to load, constant
18441844 C67_MVKH(S, C67_B3, 0); //r=reg to load, constant
18451845 C67_NOP(S, 3); // put remaining NOPs
@@ -1858,9 +1858,9 @@ static void gcall_or_jmp(TCCState *S, int is_jmp) · 12 unmodified lines
18581858 } else {
18591859 // Call, must load return address into B3 during delay slots
18601860
1861− sym = get_sym_ref(S, &S->char_pointer_type, cur_text_section, S->ind + 12, 0); // symbol for return address
1862− greloc(S, cur_text_section, sym, S->ind, R_C60LO16); // rem the inst need to be patched
1863− greloc(S, cur_text_section, sym, S->ind + 4, R_C60HI16);
1861+ sym = get_sym_ref(S, &S->tccgen_char_pointer_type, cur_text_section, S->tccgen_ind + 12, 0); // symbol for return address
1862+ greloc(S, cur_text_section, sym, S->tccgen_ind, R_C60LO16); // rem the inst need to be patched
1863+ greloc(S, cur_text_section, sym, S->tccgen_ind + 4, R_C60HI16);
18641864 C67_MVKL(S, C67_B3, 0); //r=reg to load, constant
18651865 C67_MVKH(S, C67_B3, 0); //r=reg to load, constant
18661866 C67_NOP(S, 3); // put remaining NOPs
@@ -1877,7 +1877,7 @@ ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int · 10 unmodified lines
18771877
18781878 /* generate function call with address in (vtop->t, vtop->c) and free function
18791879 context. Stack entry is popped */
1880−void gfunc_call(TCCState *S, int nb_args)
1880+void gfunc_call(TCCState* S, int nb_args)
18811881 {
18821882 int i, r, size = 0;
18831883 int args_sizes[NoCallArgsPassedOnStack];
@@ -1888,18 +1888,18 @@ void gfunc_call(TCCState *S, int nb_args) · 4 unmodified lines
18881888 }
18891889
18901890 for (i = 0; i < nb_args; i++) {
1891− if ((S->vtop->type.t & VT_BTYPE) == VT_STRUCT) {
1891+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_STRUCT) {
18921892 ALWAYS_ASSERT(FALSE);
18931893 } else {
18941894 /* simple type (currently always same size) */
18951895 /* XXX: implicit cast ? */
18961896
18971897
1898− if ((S->vtop->type.t & VT_BTYPE) == VT_LLONG) {
1898+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG) {
18991899 tcc_error(S, "long long not supported");
1900− } else if ((S->vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
1900+ } else if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
19011901 tcc_error(S, "long double not supported");
1902− } else if ((S->vtop->type.t & VT_BTYPE) == VT_DOUBLE) {
1902+ } else if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_DOUBLE) {
19031903 size = 8;
19041904 } else {
19051905 size = 4;
@@ -1919,7 +1919,7 @@ void gfunc_call(TCCState *S, int nb_args) · 13 unmodified lines
19191919 }
19201920 args_sizes[i] = size;
19211921 }
1922− S->vtop--;
1922+ S->tccgen_vtop--;
19231923 }
19241924 // POP all the params on the stack into registers for the
19251925 // immediate call (in reverse order)
@@ -1932,7 +1932,7 @@ void gfunc_call(TCCState *S, int nb_args) · 6 unmodified lines
19321932 C67_POP(S, TREG_C67_A4 + i * 2);
19331933 }
19341934 gcall_or_jmp(S, 0);
1935− S->vtop--;
1935+ S->tccgen_vtop--;
19361936 }
19371937
19381938
@@ -1946,7 +1946,7 @@ void gfunc_call(TCCState *S, int nb_args) · 7 unmodified lines
19461946 // parameters are loaded and restored upon return (or if/when needed).
19471947
19481948 /* generate function prolog of type 't' */
1949−void gfunc_prolog(TCCState *S, Sym *func_sym)
1949+void gfunc_prolog(TCCState* S, Sym *func_sym)
19501950 {
19511951 CType *func_type = &func_sym->type;
19521952 int addr, align, size, func_call, i;
@@ -1997,11 +1997,11 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 44 unmodified lines
19971997
19981998 // place all the args passed in regs onto the stack
19991999
2000− S->loc = 0;
2000+ S->tccgen_loc = 0;
20012001 for (i = 0; i < NoOfCurFuncArgs; i++) {
20022002
2003− ParamLocOnStack[i] = S->loc; // remember where the param is
2004− S->loc += -8;
2003+ ParamLocOnStack[i] = S->tccgen_loc; // remember where the param is
2004+ S->tccgen_loc += -8;
20052005
20062006 C67_PUSH(S, TREG_C67_A4 + i * 2);
20072007
@@ -2010,9 +2010,9 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 2 unmodified lines
20102010 }
20112011 }
20122012
2013− TotalBytesPushedOnStack = -S->loc;
2013+ TotalBytesPushedOnStack = -S->tccgen_loc;
20142014
2015− func_sub_sp_offset = S->ind; // remember where we put the stack instruction
2015+ func_sub_sp_offset = S->tccgen_ind; // remember where we put the stack instruction
20162016 C67_ADDK(S, 0, C67_SP); // ADDK.L2 loc,SP (just put zero temporarily)
20172017
20182018 C67_PUSH(S, C67_A0);
@@ -2020,10 +2020,10 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 1 unmodified line
20202020 }
20212021
20222022 /* generate function epilog */
2023−void gfunc_epilog(TCCState *S)
2023+void gfunc_epilog(TCCState* S)
20242024 {
20252025 {
2026− int local = (-S->loc + 7) & -8; // stack must stay aligned to 8 bytes for LDDW instr
2026+ int local = (-S->tccgen_loc + 7) & -8; // stack must stay aligned to 8 bytes for LDDW instr
20272027 C67_POP(S, C67_B3);
20282028 C67_NOP(S, 4); // NOP wait for load
20292029 C67_IREG_B_REG(S, 0, C67_CREG_ZERO, C67_B3); // B.S2 B3
@@ -2036,7 +2036,7 @@ void gfunc_epilog(TCCState *S) · 6 unmodified lines
20362036 }
20372037 }
20382038
2039−ST_FUNC void gen_fill_nops(TCCState *S, int bytes)
2039+ST_FUNC void gen_fill_nops(TCCState* S, int bytes)
20402040 {
20412041 if ((bytes & 3))
20422042 tcc_error(S, "alignment of code section not multiple of 4");
@@ -2047,10 +2047,10 @@ ST_FUNC void gen_fill_nops(TCCState *S, int bytes) · 4 unmodified lines
20472047 }
20482048
20492049 /* generate a jump to a label */
2050−int gjmp(TCCState *S, int t)
2050+int gjmp(TCCState* S, int t)
20512051 {
2052− int ind1 = S->ind;
2053− if (S->nocode_wanted)
2052+ int ind1 = S->tccgen_ind;
2053+ if (S->tccgen_nocode_wanted)
20542054 return t;
20552055
20562056 C67_MVKL(S, C67_A0, t); //r=reg to load, constant
@@ -2061,7 +2061,7 @@ int gjmp(TCCState *S, int t) · 4 unmodified lines
20612061 }
20622062
20632063 /* generate a jump to a fixed address */
2064−void gjmp_addr(TCCState *S, int a)
2064+void gjmp_addr(TCCState* S, int a)
20652065 {
20662066 Sym *sym;
20672067 // I guess this routine is used for relative short
@@ -2070,24 +2070,24 @@ void gjmp_addr(TCCState *S, int a) · 2 unmodified lines
20702070
20712071 // define a label that will be relocated
20722072
2073− sym = get_sym_ref(S, &S->char_pointer_type, cur_text_section, a, 0);
2074− greloc(S, cur_text_section, sym, S->ind, R_C60LO16);
2075− greloc(S, cur_text_section, sym, S->ind + 4, R_C60HI16);
2073+ sym = get_sym_ref(S, &S->tccgen_char_pointer_type, cur_text_section, a, 0);
2074+ greloc(S, cur_text_section, sym, S->tccgen_ind, R_C60LO16);
2075+ greloc(S, cur_text_section, sym, S->tccgen_ind + 4, R_C60HI16);
20762076
20772077 gjmp(S, 0); // place a zero there later the symbol will be added to it
20782078 }
20792079
20802080 /* generate a test. set 'inv' to invert test. Stack entry is popped */
2081−ST_FUNC int gjmp_cond(TCCState *S, int op, int t)
2081+ST_FUNC int gjmp_cond(TCCState* S, int op, int t)
20822082 {
20832083 int ind1;
20842084 int inv = op & 1;
2085− if (S->nocode_wanted)
2085+ if (S->tccgen_nocode_wanted)
20862086 return t;
20872087
20882088 /* fast case : can jump directly since flags are set */
20892089 // C67 uses B2 sort of as flags register
2090− ind1 = S->ind;
2090+ ind1 = S->tccgen_ind;
20912091 C67_MVKL(S, C67_A0, t); //r=reg to load, constant
20922092 C67_MVKH(S, C67_A0, t); //r=reg to load, constant
20932093
@@ -2105,7 +2105,7 @@ ST_FUNC int gjmp_cond(TCCState *S, int op, int t) · 11 unmodified lines
21052105 return t;
21062106 }
21072107
2108−ST_FUNC int gjmp_append(TCCState *S, int n0, int t)
2108+ST_FUNC int gjmp_append(TCCState* S, int n0, int t)
21092109 {
21102110 if (n0) {
21112111 int n = n0, *p;
@@ -2129,7 +2129,7 @@ ST_FUNC int gjmp_append(TCCState *S, int n0, int t) · 17 unmodified lines
21292129 }
21302130
21312131 /* generate an integer binary operation */
2132−void gen_opi(TCCState *S, int op)
2132+void gen_opi(TCCState* S, int op)
21332133 {
21342134 int r, fr, opc, t;
21352135
@@ -2150,8 +2150,8 @@ void gen_opi(TCCState *S, int op) · 14 unmodified lines
21502150 else
21512151 gv2(S, RC_INT, RC_INT);
21522152
2153− r = S->vtop[-1].r;
2154− fr = S->vtop[0].r;
2153+ r = S->tccgen_vtop[-1].r;
2154+ fr = S->tccgen_vtop[0].r;
21552155
21562156 C67_compare_reg = C67_B2;
21572157
@@ -2199,7 +2199,7 @@ void gen_opi(TCCState *S, int op) · 41 unmodified lines
21992199 else
22002200 ALWAYS_ASSERT(FALSE);
22012201
2202− S->vtop--;
2202+ S->tccgen_vtop--;
22032203 if (op >= TOK_ULT && op <= TOK_GT)
22042204 vset_VT_CMP(S, 0x80);
22052205 break;
@@ -2225,33 +2225,33 @@ void gen_opi(TCCState *S, int op) · 19 unmodified lines
22252225 case '*':
22262226 case TOK_UMULL:
22272227 gv2(S, RC_INT, RC_INT);
2228− r = S->vtop[-1].r;
2229− fr = S->vtop[0].r;
2230− S->vtop--;
2228+ r = S->tccgen_vtop[-1].r;
2229+ fr = S->tccgen_vtop[0].r;
2230+ S->tccgen_vtop--;
22312231 C67_MPYI(S, fr, r); // 32 bit multiply fr,r,fr
22322232 C67_NOP(S, 8); // NOP 8 for worst case
22332233 break;
22342234 case TOK_SHL:
22352235 gv2(S, RC_INT_BSIDE, RC_INT_BSIDE); // shift amount must be on same side as dst
2236− r = S->vtop[-1].r;
2237− fr = S->vtop[0].r;
2238− S->vtop--;
2236+ r = S->tccgen_vtop[-1].r;
2237+ fr = S->tccgen_vtop[0].r;
2238+ S->tccgen_vtop--;
22392239 C67_SHL(S, fr, r); // arithmetic/logical shift
22402240 break;
22412241
22422242 case TOK_SHR:
22432243 gv2(S, RC_INT_BSIDE, RC_INT_BSIDE); // shift amount must be on same side as dst
2244− r = S->vtop[-1].r;
2245− fr = S->vtop[0].r;
2246− S->vtop--;
2244+ r = S->tccgen_vtop[-1].r;
2245+ fr = S->tccgen_vtop[0].r;
2246+ S->tccgen_vtop--;
22472247 C67_SHRU(S, fr, r); // logical shift
22482248 break;
22492249
22502250 case TOK_SAR:
22512251 gv2(S, RC_INT_BSIDE, RC_INT_BSIDE); // shift amount must be on same side as dst
2252− r = S->vtop[-1].r;
2253− fr = S->vtop[0].r;
2254− S->vtop--;
2252+ r = S->tccgen_vtop[-1].r;
2253+ fr = S->tccgen_vtop[0].r;
2254+ S->tccgen_vtop--;
22552255 C67_SHR(S, fr, r); // arithmetic shift
22562256 break;
22572257
@@ -2264,8 +2264,8 @@ void gen_opi(TCCState *S, int op) · 6 unmodified lines
22642264 vrott(S, 3);
22652265 gfunc_call(S, 2);
22662266 vpushi(S, 0);
2267− S->vtop->r = REG_IRET;
2268− S->vtop->r2 = VT_CONST;
2267+ S->tccgen_vtop->r = REG_IRET;
2268+ S->tccgen_vtop->r2 = VT_CONST;
22692269 break;
22702270 case TOK_UDIV:
22712271 case TOK_PDIV:
@@ -2287,7 +2287,7 @@ void gen_opi(TCCState *S, int op) · 15 unmodified lines
22872287 /* generate a floating point operation 'v = t1 op t2' instruction. The
22882288 two operands are guaranteed to have the same floating point type */
22892289 /* XXX: need to use ST1 too */
2290−void gen_opf(TCCState *S, int op)
2290+void gen_opf(TCCState* S, int op)
22912291 {
22922292 int ft, fc, fr, r;
22932293
@@ -2296,10 +2296,10 @@ void gen_opf(TCCState *S, int op) · 2 unmodified lines
22962296 else
22972297 gv2(S, RC_FLOAT, RC_FLOAT); // make sure src2 is on b side
22982298
2299− ft = S->vtop->type.t;
2300− fc = S->vtop->c.i;
2301− r = S->vtop->r;
2302− fr = S->vtop[-1].r;
2299+ ft = S->tccgen_vtop->type.t;
2300+ fc = S->tccgen_vtop->c.i;
2301+ r = S->tccgen_vtop->r;
2302+ fr = S->tccgen_vtop[-1].r;
23032303
23042304
23052305 if ((ft & VT_BTYPE) == VT_LDOUBLE)
@@ -2307,8 +2307,8 @@ void gen_opf(TCCState *S, int op) · 1 unmodified line
23072307
23082308 if (op >= TOK_ULT && op <= TOK_GT) {
23092309
2310− r = S->vtop[-1].r;
2311− fr = S->vtop[0].r;
2310+ r = S->tccgen_vtop[-1].r;
2311+ fr = S->tccgen_vtop[0].r;
23122312
23132313 C67_compare_reg = C67_B2;
23142314
@@ -2367,7 +2367,7 @@ void gen_opf(TCCState *S, int op) · 52 unmodified lines
23672367 C67_ADDSP(S, r, fr); // ADD fr,r,fr
23682368 C67_NOP(S, 3);
23692369 }
2370− S->vtop--;
2370+ S->tccgen_vtop--;
23712371 } else if (op == '-') {
23722372 if ((ft & VT_BTYPE) == VT_DOUBLE) {
23732373 C67_SUBDP(S, r, fr); // SUB fr,r,fr
@@ -2376,7 +2376,7 @@ void gen_opf(TCCState *S, int op) · 2 unmodified lines
23762376 C67_SUBSP(S, r, fr); // SUB fr,r,fr
23772377 C67_NOP(S, 3);
23782378 }
2379− S->vtop--;
2379+ S->tccgen_vtop--;
23802380 } else if (op == '*') {
23812381 if ((ft & VT_BTYPE) == VT_DOUBLE) {
23822382 C67_MPYDP(S, r, fr); // MPY fr,r,fr
@@ -2385,7 +2385,7 @@ void gen_opf(TCCState *S, int op) · 2 unmodified lines
23852385 C67_MPYSP(S, r, fr); // MPY fr,r,fr
23862386 C67_NOP(S, 3);
23872387 }
2388− S->vtop--;
2388+ S->tccgen_vtop--;
23892389 } else if (op == '/') {
23902390 if ((ft & VT_BTYPE) == VT_DOUBLE) {
23912391 // must call intrinsic DP floating point divide
@@ -2395,8 +2395,8 @@ void gen_opf(TCCState *S, int op) · 3 unmodified lines
23952395 vrott(S, 3);
23962396 gfunc_call(S, 2);
23972397 vpushi(S, 0);
2398− S->vtop->r = REG_FRET;
2399− S->vtop->r2 = REG_IRE2;
2398+ S->tccgen_vtop->r = REG_FRET;
2399+ S->tccgen_vtop->r2 = REG_IRE2;
24002400
24012401 } else {
24022402 // must call intrinsic SP floating point divide
@@ -2406,8 +2406,8 @@ void gen_opf(TCCState *S, int op) · 3 unmodified lines
24062406 vrott(S, 3);
24072407 gfunc_call(S, 2);
24082408 vpushi(S, 0);
2409− S->vtop->r = REG_FRET;
2410− S->vtop->r2 = VT_CONST;
2409+ S->tccgen_vtop->r = REG_FRET;
2410+ S->tccgen_vtop->r2 = VT_CONST;
24112411 }
24122412 } else
24132413 ALWAYS_ASSERT(FALSE);
@@ -2419,12 +2419,12 @@ void gen_opf(TCCState *S, int op) · 5 unmodified lines
24192419
24202420 /* convert integers to fp 't' type. Must handle 'int', 'unsigned int'
24212421 and 'long long' cases. */
2422−void gen_cvt_itof(TCCState *S, int t)
2422+void gen_cvt_itof(TCCState* S, int t)
24232423 {
24242424 int r;
24252425
24262426 gv(S, RC_INT);
2427− r = S->vtop->r;
2427+ r = S->tccgen_vtop->r;
24282428
24292429 if ((t & VT_BTYPE) == VT_DOUBLE) {
24302430 if (t & VT_UNSIGNED)
@@ -2433,31 +2433,31 @@ void gen_cvt_itof(TCCState *S, int t) · 2 unmodified lines
24332433 C67_INTDP(S, r, r);
24342434
24352435 C67_NOP(S, 4);
2436− S->vtop->type.t = VT_DOUBLE;
2436+ S->tccgen_vtop->type.t = VT_DOUBLE;
24372437 } else {
24382438 if (t & VT_UNSIGNED)
24392439 C67_INTSPU(S, r, r);
24402440 else
24412441 C67_INTSP(S, r, r);
24422442 C67_NOP(S, 3);
2443− S->vtop->type.t = VT_FLOAT;
2443+ S->tccgen_vtop->type.t = VT_FLOAT;
24442444 }
24452445
24462446 }
24472447
24482448 /* convert fp to int 't' type */
24492449 /* XXX: handle long long case */
2450−void gen_cvt_ftoi(TCCState *S, int t)
2450+void gen_cvt_ftoi(TCCState* S, int t)
24512451 {
24522452 int r;
24532453
24542454 gv(S, RC_FLOAT);
2455− r = S->vtop->r;
2455+ r = S->tccgen_vtop->r;
24562456
24572457 if (t != VT_INT)
24582458 tcc_error(S, "long long not supported");
24592459 else {
2460− if ((S->vtop->type.t & VT_BTYPE) == VT_DOUBLE) {
2460+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_DOUBLE) {
24612461 C67_DPTRUNC(S, r, r);
24622462 C67_NOP(S, 3);
24632463 } else {
@@ -2465,36 +2465,36 @@ void gen_cvt_ftoi(TCCState *S, int t) · 1 unmodified line
24652465 C67_NOP(S, 3);
24662466 }
24672467
2468− S->vtop->type.t = VT_INT;
2468+ S->tccgen_vtop->type.t = VT_INT;
24692469
24702470 }
24712471 }
24722472
24732473 /* convert from one floating point type to another */
2474−void gen_cvt_ftof(TCCState *S, int t)
2474+void gen_cvt_ftof(TCCState* S, int t)
24752475 {
24762476 int r, r2;
24772477
2478− if ((S->vtop->type.t & VT_BTYPE) == VT_DOUBLE &&
2478+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_DOUBLE &&
24792479 (t & VT_BTYPE) == VT_FLOAT) {
24802480 // convert double to float
24812481
24822482 gv(S, RC_FLOAT); // get it in a register pair
24832483
2484− r = S->vtop->r;
2484+ r = S->tccgen_vtop->r;
24852485
24862486 C67_DPSP(S, r, r); // convert it to SP same register
24872487 C67_NOP(S, 3);
24882488
2489− S->vtop->type.t = VT_FLOAT;
2490− S->vtop->r2 = VT_CONST; // set this as unused
2491− } else if ((S->vtop->type.t & VT_BTYPE) == VT_FLOAT &&
2489+ S->tccgen_vtop->type.t = VT_FLOAT;
2490+ S->tccgen_vtop->r2 = VT_CONST; // set this as unused
2491+ } else if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FLOAT &&
24922492 (t & VT_BTYPE) == VT_DOUBLE) {
24932493 // convert float to double
24942494
24952495 gv(S, RC_FLOAT); // get it in a register
24962496
2497− r = S->vtop->r;
2497+ r = S->tccgen_vtop->r;
24982498
24992499 if (r == TREG_EAX) { // make sure the paired reg is avail
25002500 r2 = get_reg(S, RC_ECX);
@@ -2508,32 +2508,32 @@ void gen_cvt_ftof(TCCState *S, int t) · 7 unmodified lines
25082508 C67_SPDP(S, r, r); // convert it to DP same register
25092509 C67_NOP(S, 1);
25102510
2511− S->vtop->type.t = VT_DOUBLE;
2512− S->vtop->r2 = r2; // set this as unused
2511+ S->tccgen_vtop->type.t = VT_DOUBLE;
2512+ S->tccgen_vtop->r2 = r2; // set this as unused
25132513 } else {
25142514 ALWAYS_ASSERT(FALSE);
25152515 }
25162516 }
25172517
25182518 /* computed goto support */
2519−void ggoto(TCCState *S)
2519+void ggoto(TCCState* S)
25202520 {
25212521 gcall_or_jmp(S, 1);
2522− S->vtop--;
2522+ S->tccgen_vtop--;
25232523 }
25242524
25252525 /* Save the stack pointer onto the stack and return the location of its address */
2526−ST_FUNC void gen_vla_sp_save(TCCState *S, int addr) {
2526+ST_FUNC void gen_vla_sp_save(TCCState* S, int addr) {
25272527 tcc_error(S, "variable length arrays unsupported for this target");
25282528 }
25292529
25302530 /* Restore the SP from a location on the stack */
2531−ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr) {
2531+ST_FUNC void gen_vla_sp_restore(TCCState* S, int addr) {
25322532 tcc_error(S, "variable length arrays unsupported for this target");
25332533 }
25342534
25352535 /* Subtract from the stack pointer, and push the resulting value onto the stack */
2536−ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) {
2536+ST_FUNC void gen_vla_alloc(TCCState* S, CType *type, int align) {
25372537 tcc_error(S, "variable length arrays unsupported for this target");
25382538 }
25392539
i386-asm.c+52−52
@@ -282,7 +282,7 @@ static inline int get_reg_shift(TCCState *S) · 281 unmodified lines
282282 static int asm_parse_numeric_reg(TCCState *S, int t, unsigned int *type)
283283 {
284284 int reg = -1;
285− if (t >= TOK_IDENT && t < S->tok_ident) {
285+ if (t >= TOK_IDENT && t < S->tccpp_tok_ident) {
286286 const char *s = S->tccpp_table_ident[t - TOK_IDENT]->str;
287287 char c;
288288 *type = OP_REG64;
@@ -318,24 +318,24 @@ static int asm_parse_numeric_reg(TCCState *S, int t, unsigned int *type) · 29 unmodified lines
318318 }
319319 #endif
320320
321−static int asm_parse_reg(TCCState *S, unsigned int *type)
321+static int asm_parse_reg(TCCState* S, unsigned int *type)
322322 {
323323 int reg = 0;
324324 *type = 0;
325− if (S->tok != '%')
325+ if (S->tccpp_tok != '%')
326326 goto error_32;
327327 next(S);
328− if (S->tok >= TOK_ASM_eax && S->tok <= TOK_ASM_edi) {
329− reg = S->tok - TOK_ASM_eax;
328+ if (S->tccpp_tok >= TOK_ASM_eax && S->tccpp_tok <= TOK_ASM_edi) {
329+ reg = S->tccpp_tok - TOK_ASM_eax;
330330 *type = OP_REG32;
331331 #ifdef TCC_TARGET_X86_64
332− } else if (S->tok >= TOK_ASM_rax && S->tok <= TOK_ASM_rdi) {
333− reg = S->tok - TOK_ASM_rax;
332+ } else if (S->tccpp_tok >= TOK_ASM_rax && S->tccpp_tok <= TOK_ASM_rdi) {
333+ reg = S->tccpp_tok - TOK_ASM_rax;
334334 *type = OP_REG64;
335− } else if (S->tok == TOK_ASM_rip) {
335+ } else if (S->tccpp_tok == TOK_ASM_rip) {
336336 reg = -2; /* Probably should use different escape code. */
337337 *type = OP_REG64;
338− } else if ((reg = asm_parse_numeric_reg(S, S->tok, type)) >= 0
338+ } else if ((reg = asm_parse_numeric_reg(S, S->tccpp_tok, type)) >= 0
339339 && (*type == OP_REG32 || *type == OP_REG64)) {
340340 ;
341341 #endif
@@ -354,15 +354,15 @@ static void parse_operand(TCCState *S, Operand *op) · 12 unmodified lines
354354 const char *p;
355355
356356 indir = 0;
357− if (S->tok == '*') {
357+ if (S->tccpp_tok == '*') {
358358 next(S);
359359 indir = OP_INDIR;
360360 }
361361
362− if (S->tok == '%') {
362+ if (S->tccpp_tok == '%') {
363363 next(S);
364− if (S->tok >= TOK_ASM_al && S->tok <= TOK_ASM_db7) {
365− reg = S->tok - TOK_ASM_al;
364+ if (S->tccpp_tok >= TOK_ASM_al && S->tccpp_tok <= TOK_ASM_db7) {
365+ reg = S->tccpp_tok - TOK_ASM_al;
366366 op->type = 1 << (reg >> 3); /* WARNING: do not change constant order */
367367 op->reg = reg & 7;
368368 if ((op->type & OP_REG) && op->reg == TREG_XAX)
@@ -371,21 +371,21 @@ static void parse_operand(TCCState *S, Operand *op) · 2 unmodified lines
371371 op->type |= OP_CL;
372372 else if (op->type == OP_REG16 && op->reg == TREG_XDX)
373373 op->type |= OP_DX;
374− } else if (S->tok >= TOK_ASM_dr0 && S->tok <= TOK_ASM_dr7) {
374+ } else if (S->tccpp_tok >= TOK_ASM_dr0 && S->tccpp_tok <= TOK_ASM_dr7) {
375375 op->type = OP_DB;
376− op->reg = S->tok - TOK_ASM_dr0;
377− } else if (S->tok >= TOK_ASM_es && S->tok <= TOK_ASM_gs) {
376+ op->reg = S->tccpp_tok - TOK_ASM_dr0;
377+ } else if (S->tccpp_tok >= TOK_ASM_es && S->tccpp_tok <= TOK_ASM_gs) {
378378 op->type = OP_SEG;
379− op->reg = S->tok - TOK_ASM_es;
380− } else if (S->tok == TOK_ASM_st) {
379+ op->reg = S->tccpp_tok - TOK_ASM_es;
380+ } else if (S->tccpp_tok == TOK_ASM_st) {
381381 op->type = OP_ST;
382382 op->reg = 0;
383383 next(S);
384− if (S->tok == '(') {
384+ if (S->tccpp_tok == '(') {
385385 next(S);
386− if (S->tok != TOK_PPNUM)
386+ if (S->tccpp_tok != TOK_PPNUM)
387387 goto reg_error;
388− p = S->tokc.str.data;
388+ p = S->tccpp_tokc.str.data;
389389 reg = p[0] - '0';
390390 if ((unsigned)reg >= 8 || p[1] != '\0')
391391 goto reg_error;
@@ -397,19 +397,19 @@ static void parse_operand(TCCState *S, Operand *op) · 5 unmodified lines
397397 op->type |= OP_ST0;
398398 goto no_skip;
399399 #ifdef TCC_TARGET_X86_64
400− } else if (S->tok >= TOK_ASM_spl && S->tok <= TOK_ASM_dil) {
400+ } else if (S->tccpp_tok >= TOK_ASM_spl && S->tccpp_tok <= TOK_ASM_dil) {
401401 op->type = OP_REG8 | OP_REG8_LOW;
402− op->reg = 4 + S->tok - TOK_ASM_spl;
403− } else if ((op->reg = asm_parse_numeric_reg(S, S->tok, &op->type)) >= 0) {
402+ op->reg = 4 + S->tccpp_tok - TOK_ASM_spl;
403+ } else if ((op->reg = asm_parse_numeric_reg(S, S->tccpp_tok, &op->type)) >= 0) {
404404 ;
405405 #endif
406406 } else {
407407 reg_error:
408− tcc_error(S, "unknown register %%%s", get_tok_str(S, S->tok, &S->tokc));
408+ tcc_error(S, "unknown register %%%s", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
409409 }
410410 next(S);
411411 no_skip: ;
412− } else if (S->tok == '$') {
412+ } else if (S->tccpp_tok == '$') {
413413 /* constant value */
414414 next(S);
415415 asm_expr(S, &e);
@@ -433,19 +433,19 @@ static void parse_operand(TCCState *S, Operand *op) · 17 unmodified lines
433433 op->reg = -1;
434434 op->reg2 = -1;
435435 op->shift = 0;
436− if (S->tok != '(') {
436+ if (S->tccpp_tok != '(') {
437437 asm_expr(S, &e);
438438 op->e = e;
439439 } else {
440440 next(S);
441− if (S->tok == '%') {
441+ if (S->tccpp_tok == '%') {
442442 unget_tok(S, '(');
443443 op->e.v = 0;
444444 op->e.sym = NULL;
445445 } else {
446446 /* bracketed offset expression */
447447 asm_expr(S, &e);
448− if (S->tok != ')')
448+ if (S->tccpp_tok != ')')
449449 expect(S, ")");
450450 next(S);
451451 op->e.v = e.v;
@@ -453,18 +453,18 @@ static void parse_operand(TCCState *S, Operand *op) · 1 unmodified line
453453 }
454454 op->e.pcrel = 0;
455455 }
456− if (S->tok == '(') {
456+ if (S->tccpp_tok == '(') {
457457 unsigned int type = 0;
458458 next(S);
459− if (S->tok != ',') {
459+ if (S->tccpp_tok != ',') {
460460 op->reg = asm_parse_reg(S, &type);
461461 }
462− if (S->tok == ',') {
462+ if (S->tccpp_tok == ',') {
463463 next(S);
464− if (S->tok != ',') {
464+ if (S->tccpp_tok != ',') {
465465 op->reg2 = asm_parse_reg(S, &type);
466466 }
467− if (S->tok == ',') {
467+ if (S->tccpp_tok == ',') {
468468 next(S);
469469 op->shift = get_reg_shift(S);
470470 }
@@ -480,7 +480,7 @@ static void parse_operand(TCCState *S, Operand *op) · 9 unmodified lines
480480 }
481481
482482 /* XXX: unify with C code output ? */
483−ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe)
483+ST_FUNC void gen_expr32(TCCState* S, ExprValue *pe)
484484 {
485485 if (pe->pcrel)
486486 /* If PC-relative, always set VT_SYM, even without symbol,
@@ -491,14 +491,14 @@ ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe) · 4 unmodified lines
491491 }
492492
493493 #ifdef TCC_TARGET_X86_64
494−ST_FUNC void gen_expr64(TCCState *S, ExprValue *pe)
494+ST_FUNC void gen_expr64(TCCState* S, ExprValue *pe)
495495 {
496496 gen_addr64(S, pe->sym ? VT_SYM : 0, pe->sym, pe->v);
497497 }
498498 #endif
499499
500500 /* XXX: unify with C code output ? */
501−static void gen_disp32(TCCState *S, ExprValue *pe)
501+static void gen_disp32(TCCState* S, ExprValue *pe)
502502 {
503503 Sym *sym = pe->sym;
504504 ElfSym *esym = elfsym(S, sym);
@@ -507,7 +507,7 @@ static void gen_disp32(TCCState *S, ExprValue *pe) · 2 unmodified lines
507507 that the TCC compiler behaves differently here because
508508 it always outputs a relocation to ease (future) code
509509 elimination in the linker */
510− gen_le32(S, pe->v + esym->st_value - S->ind - 4);
510+ gen_le32(S, pe->v + esym->st_value - S->tccgen_ind - 4);
511511 } else {
512512 if (sym && sym->type.t == VT_VOID) {
513513 sym->type.t = VT_FUNC;
@@ -518,7 +518,7 @@ static void gen_disp32(TCCState *S, ExprValue *pe) · 4 unmodified lines
518518 }
519519
520520 /* generate the modrm operand */
521−static inline int asm_modrm(TCCState *S, int reg, Operand *op)
521+static inline int asm_modrm(TCCState* S, int reg, Operand *op)
522522 {
523523 int mod, reg1, reg2, sib_reg1;
524524
@@ -538,7 +538,7 @@ static inline int asm_modrm(TCCState *S, int reg, Operand *op) · 13 unmodified lines
538538 ExprValue *pe = &op->e;
539539 g(S, 0x05 + (reg << 3));
540540 gen_addrpc32(S, pe->sym ? VT_SYM : 0, pe->sym, pe->v);
541− return S->ind;
541+ return S->tccgen_ind;
542542 #endif
543543 } else {
544544 sib_reg1 = op->reg;
@@ -581,7 +581,7 @@ static inline int asm_modrm(TCCState *S, int reg, Operand *op) · 36 unmodified lines
581581 #define REX_X 0x42
582582 #define REX_B 0x41
583583
584−static void asm_rex(TCCState *S, int width64, Operand *ops, int nb_ops, int *op_type,
584+static void asm_rex(TCCState* S, int width64, Operand *ops, int nb_ops, int *op_type,
585585 int regi, int rmi)
586586 {
587587 unsigned char rex = width64 ? 0x48 : 0;
@@ -705,13 +705,13 @@ ST_FUNC void asm_opcode(TCCState *S, int opcode) · 117 unmodified lines
705705 seg_prefix = 0;
706706 alltypes = 0;
707707 for(;;) {
708− if (S->tok == ';' || S->tok == TOK_LINEFEED)
708+ if (S->tccpp_tok == ';' || S->tccpp_tok == TOK_LINEFEED)
709709 break;
710710 if (nb_ops >= MAX_OPERANDS) {
711711 tcc_error(S, "incorrect number of operands");
712712 }
713713 parse_operand(S, pop);
714− if (S->tok == ':') {
714+ if (S->tccpp_tok == ':') {
715715 if (pop->type != OP_SEG || seg_prefix)
716716 tcc_error(S, "incorrect prefix");
717717 seg_prefix = segment_prefixes[pop->reg];
@@ -723,7 +723,7 @@ ST_FUNC void asm_opcode(TCCState *S, int opcode) · 5 unmodified lines
723723 }
724724 pop++;
725725 nb_ops++;
726− if (S->tok != ',')
726+ if (S->tccpp_tok != ',')
727727 break;
728728 next(S);
729729 }
@@ -1038,7 +1038,7 @@ again: · 308 unmodified lines
10381038 esym = elfsym(S, ops[0].e.sym);
10391039 if (!esym || esym->st_shndx != cur_text_section->sh_num)
10401040 goto no_short_jump;
1041− jmp_disp = ops[0].e.v + esym->st_value - S->ind - 2 - (v >= 0xff);
1041+ jmp_disp = ops[0].e.v + esym->st_value - S->tccgen_ind - 2 - (v >= 0xff);
10421042 if (jmp_disp == (int8_t)jmp_disp) {
10431043 /* OK to generate jump */
10441044 ops[0].e.sym = 0;
@@ -1136,12 +1136,12 @@ again: · 91 unmodified lines
11361136
11371137 /* after immediate operands, adjust pc-relative address */
11381138 if (pc)
1139− add32le(cur_text_section->data + pc - 4, pc - S->ind);
1139+ add32le(cur_text_section->data + pc - 4, pc - S->tccgen_ind);
11401140 }
11411141
11421142 /* return the constraint priority (we allocate first the lowest
11431143 numbered constraints) */
1144−static inline int constraint_priority(TCCState *S, const char *str)
1144+static inline int constraint_priority(TCCState* S, const char *str)
11451145 {
11461146 int priority, c, pr;
11471147
@@ -1200,7 +1200,7 @@ static const char *skip_constraint_modifiers(const char *p) · 52 unmodified lines
12001200
12011201 /* If T (a token) is of the form "%reg" returns the register
12021202 number and type, otherwise return -1. */
1203−ST_FUNC int asm_parse_regvar (TCCState *S, int t)
1203+ST_FUNC int asm_parse_regvar (TCCState* S, int t)
12041204 {
12051205 const char *s;
12061206 Operand op;
@@ -1225,7 +1225,7 @@ ST_FUNC int asm_parse_regvar (TCCState *S, int t) · 18 unmodified lines
12251225
12261226 #define is_reg_allocated(reg) (regs_allocated[reg] & reg_mask)
12271227
1228−ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands,
1228+ST_FUNC void asm_compute_constraints(TCCState* S, ASMOperand *operands,
12291229 int nb_operands, int nb_outputs,
12301230 const uint8_t *clobber_regs,
12311231 int *pout_reg)
@@ -1471,7 +1471,7 @@ ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands, · 239 unmodified lines
14711471 #endif
14721472 }
14731473
1474−ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str,
1474+ST_FUNC void subst_asm_operand(TCCState* S, CString *add_str,
14751475 SValue *sv, int modifier)
14761476 {
14771477 int r, reg, size, val;
@@ -1593,7 +1593,7 @@ ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str, · 115 unmodified lines
15931593 }
15941594
15951595 /* generate prolog and epilog code for asm statement */
1596−ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands,
1596+ST_FUNC void asm_gen_code(TCCState* S, ASMOperand *operands, int nb_operands,
15971597 int nb_outputs, int is_output,
15981598 uint8_t *clobber_regs,
15991599 int out_reg)
@@ -1697,7 +1697,7 @@ ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands, · 97 unmodified lines
16971697 }
16981698 }
16991699
1700−ST_FUNC void asm_clobber(TCCState *S, uint8_t *clobber_regs, const char *str)
1700+ST_FUNC void asm_clobber(TCCState* S, uint8_t *clobber_regs, const char *str)
17011701 {
17021702 int reg;
17031703 #ifdef TCC_TARGET_X86_64
i386-gen.c+129−129
@@ -100,24 +100,24 @@ ST_DATA const int reg_classes[NB_REGS] = { · 99 unmodified lines
100100 static unsigned long func_sub_sp_offset;
101101 static int func_ret_sub;
102102 #ifdef CONFIG_TCC_BCHECK
103−static void gen_bounds_prolog(TCCState *S);
104−static void gen_bounds_epilog(TCCState *S);
103+static void gen_bounds_prolog(TCCState* S);
104+static void gen_bounds_epilog(TCCState* S);
105105 #endif
106106
107107 /* XXX: make it faster ? */
108−ST_FUNC void g(TCCState *S, int c)
108+ST_FUNC void g(TCCState* S, int c)
109109 {
110110 int ind1;
111− if (S->nocode_wanted)
111+ if (S->tccgen_nocode_wanted)
112112 return;
113− ind1 = S->ind + 1;
113+ ind1 = S->tccgen_ind + 1;
114114 if (ind1 > cur_text_section->data_allocated)
115115 section_realloc(S, cur_text_section, ind1);
116− cur_text_section->data[S->ind] = c;
117− S->ind = ind1;
116+ cur_text_section->data[S->tccgen_ind] = c;
117+ S->tccgen_ind = ind1;
118118 }
119119
120−ST_FUNC void o(TCCState *S, unsigned int c)
120+ST_FUNC void o(TCCState* S, unsigned int c)
121121 {
122122 while (c) {
123123 g(S, c);
@@ -125,13 +125,13 @@ ST_FUNC void o(TCCState *S, unsigned int c) · 1 unmodified line
125125 }
126126 }
127127
128−ST_FUNC void gen_le16(TCCState *S, int v)
128+ST_FUNC void gen_le16(TCCState* S, int v)
129129 {
130130 g(S, v);
131131 g(S, v >> 8);
132132 }
133133
134−ST_FUNC void gen_le32(TCCState *S, int c)
134+ST_FUNC void gen_le32(TCCState* S, int c)
135135 {
136136 g(S, c);
137137 g(S, c >> 8);
@@ -140,7 +140,7 @@ ST_FUNC void gen_le32(TCCState *S, int c) · 2 unmodified lines
140140 }
141141
142142 /* output a symbol and patch all calls to it */
143−ST_FUNC void gsym_addr(TCCState *S, int t, int a)
143+ST_FUNC void gsym_addr(TCCState* S, int t, int a)
144144 {
145145 while (t) {
146146 unsigned char *ptr = cur_text_section->data + t;
@@ -151,18 +151,18 @@ ST_FUNC void gsym_addr(TCCState *S, int t, int a) · 4 unmodified lines
151151 }
152152
153153 /* instruction + 4 bytes data. Return the address of the data */
154−static int oad(TCCState *S, int c, int s)
154+static int oad(TCCState* S, int c, int s)
155155 {
156156 int t;
157− if (S->nocode_wanted)
157+ if (S->tccgen_nocode_wanted)
158158 return s;
159159 o(S, c);
160− t = S->ind;
160+ t = S->tccgen_ind;
161161 gen_le32(S, s);
162162 return t;
163163 }
164164
165−ST_FUNC void gen_fill_nops(TCCState *S, int bytes)
165+ST_FUNC void gen_fill_nops(TCCState* S, int bytes)
166166 {
167167 while (bytes--)
168168 g(S, 0x90);
@@ -172,23 +172,23 @@ ST_FUNC void gen_fill_nops(TCCState *S, int bytes) · 3 unmodified lines
172172 #define gjmp2(s, instr,lbl) oad(s, instr,lbl)
173173
174174 /* output constant with relocation if 'r & VT_SYM' is true */
175−ST_FUNC void gen_addr32(TCCState *S, int r, Sym *sym, int c)
175+ST_FUNC void gen_addr32(TCCState* S, int r, Sym *sym, int c)
176176 {
177177 if (r & VT_SYM)
178− greloc(S, cur_text_section, sym, S->ind, R_386_32);
178+ greloc(S, cur_text_section, sym, S->tccgen_ind, R_386_32);
179179 gen_le32(S, c);
180180 }
181181
182−ST_FUNC void gen_addrpc32(TCCState *S, int r, Sym *sym, int c)
182+ST_FUNC void gen_addrpc32(TCCState* S, int r, Sym *sym, int c)
183183 {
184184 if (r & VT_SYM)
185− greloc(S, cur_text_section, sym, S->ind, R_386_PC32);
185+ greloc(S, cur_text_section, sym, S->tccgen_ind, R_386_PC32);
186186 gen_le32(S, c - 4);
187187 }
188188
189189 /* generate a modrm reference. 'op_reg' contains the additional 3
190190 opcode bits */
191−static void gen_modrm(TCCState *S, int op_reg, int r, Sym *sym, int c)
191+static void gen_modrm(TCCState* S, int op_reg, int r, Sym *sym, int c)
192192 {
193193 op_reg = op_reg << 3;
194194 if ((r & VT_VALMASK) == VT_CONST) {
@@ -210,7 +210,7 @@ static void gen_modrm(TCCState *S, int op_reg, int r, Sym *sym, int c) · 15 unmodified lines
210210 }
211211
212212 /* load 'r' from value 'sv' */
213−ST_FUNC void load(TCCState *S, int r, SValue *sv)
213+ST_FUNC void load(TCCState* S, int r, SValue *sv)
214214 {
215215 int v, t, ft, fc, fr;
216216 SValue v1;
@@ -290,7 +290,7 @@ ST_FUNC void load(TCCState *S, int r, SValue *sv) · 73 unmodified lines
290290 }
291291
292292 /* store register 'r' in lvalue 'v' */
293−ST_FUNC void store(TCCState *S, int r, SValue *v)
293+ST_FUNC void store(TCCState* S, int r, SValue *v)
294294 {
295295 int fr, bt, ft, fc;
296296
@@ -332,7 +332,7 @@ ST_FUNC void store(TCCState *S, int r, SValue *v) · 35 unmodified lines
332332 }
333333 }
334334
335−static void gadd_sp(TCCState *S, int val)
335+static void gadd_sp(TCCState* S, int val)
336336 {
337337 if (val == (char)val) {
338338 o(S, 0xc483);
@@ -343,24 +343,24 @@ static void gadd_sp(TCCState *S, int val) · 4 unmodified lines
343343 }
344344
345345 #if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_PE
346−static void gen_static_call(TCCState *S, int v)
346+static void gen_static_call(TCCState* S, int v)
347347 {
348348 Sym *sym;
349349
350350 sym = external_helper_sym(S, v);
351351 oad(S, 0xe8, -4);
352− greloc(S, cur_text_section, sym, S->ind-4, R_386_PC32);
352+ greloc(S, cur_text_section, sym, S->tccgen_ind-4, R_386_PC32);
353353 }
354354 #endif
355355
356356 /* 'is_jmp' is '1' if it is a jump */
357−static void gcall_or_jmp(TCCState *S, int is_jmp)
357+static void gcall_or_jmp(TCCState* S, int is_jmp)
358358 {
359359 int r;
360− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && (S->vtop->r & VT_SYM)) {
360+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && (S->tccgen_vtop->r & VT_SYM)) {
361361 /* constant and relocation case */
362− greloc(S, cur_text_section, S->vtop->sym, S->ind + 1, R_386_PC32);
363− oad(S, 0xe8 + is_jmp, S->vtop->c.i - 4); /* call/jmp im */
362+ greloc(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind + 1, R_386_PC32);
363+ oad(S, 0xe8 + is_jmp, S->tccgen_vtop->c.i - 4); /* call/jmp im */
364364 } else {
365365 /* otherwise, indirect call */
366366 r = gv(S, RC_INT);
@@ -402,7 +402,7 @@ ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int · 35 unmodified lines
402402 /* Generate function call. The function address is pushed first, then
403403 all the parameters in call order. This functions pops all the
404404 parameters and the function address. */
405−ST_FUNC void gfunc_call(TCCState *S, int nb_args)
405+ST_FUNC void gfunc_call(TCCState* S, int nb_args)
406406 {
407407 int size, align, r, args_size, i, func_call;
408408 Sym *func_sym;
@@ -414,8 +414,8 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 5 unmodified lines
414414
415415 args_size = 0;
416416 for(i = 0;i < nb_args; i++) {
417− if ((S->vtop->type.t & VT_BTYPE) == VT_STRUCT) {
418− size = type_size(&S->vtop->type, &align);
417+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_STRUCT) {
418+ size = type_size(&S->tccgen_vtop->type, &align);
419419 /* align to stack align size */
420420 size = (size + 3) & ~3;
421421 /* allocate the necessary size on stack */
@@ -434,15 +434,15 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 12 unmodified lines
434434 r = get_reg(S, RC_INT);
435435 o(S, 0xe089 + (r << 8)); /* mov %esp, r */
436436 }
437− vset(S, &S->vtop->type, r | VT_LVAL, 0);
437+ vset(S, &S->tccgen_vtop->type, r | VT_LVAL, 0);
438438 vswap(S);
439439 vstore(S);
440440 args_size += size;
441− } else if (is_float(S->vtop->type.t)) {
441+ } else if (is_float(S->tccgen_vtop->type.t)) {
442442 gv(S, RC_FLOAT); /* only one float register */
443− if ((S->vtop->type.t & VT_BTYPE) == VT_FLOAT)
443+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FLOAT)
444444 size = 4;
445− else if ((S->vtop->type.t & VT_BTYPE) == VT_DOUBLE)
445+ else if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_DOUBLE)
446446 size = 8;
447447 else
448448 size = 12;
@@ -458,19 +458,19 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 9 unmodified lines
458458 /* simple type (currently always same size) */
459459 /* XXX: implicit cast ? */
460460 r = gv(S, RC_INT);
461− if ((S->vtop->type.t & VT_BTYPE) == VT_LLONG) {
461+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG) {
462462 size = 8;
463− o(S, 0x50 + S->vtop->r2); /* push r */
463+ o(S, 0x50 + S->tccgen_vtop->r2); /* push r */
464464 } else {
465465 size = 4;
466466 }
467467 o(S, 0x50 + r); /* push r */
468468 args_size += size;
469469 }
470− S->vtop--;
470+ S->tccgen_vtop--;
471471 }
472472 save_regs(S, 0); /* save used temporary registers */
473− func_sym = S->vtop->type.ref;
473+ func_sym = S->tccgen_vtop->type.ref;
474474 func_call = func_sym->f.func_call;
475475 /* fast call case */
476476 if ((func_call >= FUNC_FASTCALL1 && func_call <= FUNC_FASTCALL3) ||
@@ -493,7 +493,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 16 unmodified lines
493493 }
494494 }
495495 #if !defined(TCC_TARGET_PE) && !TARGETOS_FreeBSD || TARGETOS_OpenBSD
496− else if ((S->vtop->type.ref->type.t & VT_BTYPE) == VT_STRUCT)
496+ else if ((S->tccgen_vtop->type.ref->type.t & VT_BTYPE) == VT_STRUCT)
497497 args_size -= 4;
498498 #endif
499499
@@ -501,7 +501,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 1 unmodified line
501501
502502 if (args_size && func_call != FUNC_STDCALL && func_call != FUNC_FASTCALLW)
503503 gadd_sp(S, args_size);
504− S->vtop--;
504+ S->tccgen_vtop--;
505505 }
506506
507507 #ifdef TCC_TARGET_PE
@@ -511,7 +511,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 3 unmodified lines
511511 #endif
512512
513513 /* generate function prolog of type 't' */
514−ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym)
514+ST_FUNC void gfunc_prolog(TCCState* S, Sym *func_sym)
515515 {
516516 CType *func_type = &func_sym->type;
517517 int addr, align, size, func_call, fastcall_nb_regs;
@@ -523,7 +523,7 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 5 unmodified lines
523523 sym = func_type->ref;
524524 func_call = sym->f.func_call;
525525 addr = 8;
526− S->loc = 0;
526+ S->tccgen_loc = 0;
527527 S->tccgen_func_vc = 0;
528528
529529 if (func_call >= FUNC_FASTCALL1 && func_call <= FUNC_FASTCALL3) {
@@ -538,8 +538,8 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 8 unmodified lines
538538 }
539539 param_index = 0;
540540
541− S->ind += FUNC_PROLOG_SIZE;
542− func_sub_sp_offset = S->ind;
541+ S->tccgen_ind += FUNC_PROLOG_SIZE;
542+ func_sub_sp_offset = S->tccgen_ind;
543543 /* if the function returns a structure, then add an
544544 implicit pointer parameter */
545545 #if defined(TCC_TARGET_PE) || TARGETOS_FreeBSD || TARGETOS_OpenBSD
@@ -567,10 +567,10 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 21 unmodified lines
567567 #endif
568568 if (param_index < fastcall_nb_regs) {
569569 /* save FASTCALL register */
570− S->loc -= 4;
570+ S->tccgen_loc -= 4;
571571 o(S, 0x89); /* movl */
572− gen_modrm(S, fastcall_regs_ptr[param_index], VT_LOCAL, NULL, S->loc);
573− param_addr = S->loc;
572+ gen_modrm(S, fastcall_regs_ptr[param_index], VT_LOCAL, NULL, S->tccgen_loc);
573+ param_addr = S->tccgen_loc;
574574 } else {
575575 param_addr = addr;
576576 addr += size;
@@ -595,7 +595,7 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 18 unmodified lines
595595 }
596596
597597 /* generate function epilog */
598−ST_FUNC void gfunc_epilog(TCCState *S)
598+ST_FUNC void gfunc_epilog(TCCState* S)
599599 {
600600 addr_t v, saved_ind;
601601
@@ -605,7 +605,7 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 3 unmodified lines
605605 #endif
606606
607607 /* align local size to word & save local variables */
608− v = (-S->loc + 3) & -4;
608+ v = (-S->tccgen_loc + 3) & -4;
609609
610610 #if USE_EBX
611611 o(S, 0x8b);
@@ -620,8 +620,8 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 8 unmodified lines
620620 g(S, func_ret_sub);
621621 g(S, func_ret_sub >> 8);
622622 }
623− saved_ind = S->ind;
624− S->ind = func_sub_sp_offset - FUNC_PROLOG_SIZE;
623+ saved_ind = S->tccgen_ind;
624+ S->tccgen_ind = func_sub_sp_offset - FUNC_PROLOG_SIZE;
625625 #ifdef TCC_TARGET_PE
626626 if (v >= 4096) {
627627 oad(S, 0xb8, v); /* mov stacksize, %eax */
@@ -637,33 +637,33 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 9 unmodified lines
637637 #endif
638638 }
639639 o(S, 0x53 * USE_EBX); /* push ebx */
640− S->ind = saved_ind;
640+ S->tccgen_ind = saved_ind;
641641 }
642642
643643 /* generate a jump to a label */
644−ST_FUNC int gjmp(TCCState *S, int t)
644+ST_FUNC int gjmp(TCCState* S, int t)
645645 {
646646 return gjmp2(S, 0xe9, t);
647647 }
648648
649649 /* generate a jump to a fixed address */
650−ST_FUNC void gjmp_addr(TCCState *S, int a)
650+ST_FUNC void gjmp_addr(TCCState* S, int a)
651651 {
652652 int r;
653− r = a - S->ind - 2;
653+ r = a - S->tccgen_ind - 2;
654654 if (r == (char)r) {
655655 g(S, 0xeb);
656656 g(S, r);
657657 } else {
658− oad(S, 0xe9, a - S->ind - 5);
658+ oad(S, 0xe9, a - S->tccgen_ind - 5);
659659 }
660660 }
661661
662662 #if 0
663663 /* generate a jump to a fixed address */
664−ST_FUNC void gjmp_cond_addr(TCCState *S, int a, int op)
664+ST_FUNC void gjmp_cond_addr(TCCState* S, int a, int op)
665665 {
666− int r = a - S->ind - 2;
666+ int r = a - S->tccgen_ind - 2;
667667 if (r == (char)r)
668668 g(S, op - 32), g(r);
669669 else
@@ -671,7 +671,7 @@ ST_FUNC void gjmp_cond_addr(TCCState *S, int a, int op) · 1 unmodified line
671671 }
672672 #endif
673673
674−ST_FUNC int gjmp_append(TCCState *S, int n, int t)
674+ST_FUNC int gjmp_append(TCCState* S, int n, int t)
675675 {
676676 void *p;
677677 /* insert vtop->c jump list in t */
@@ -685,14 +685,14 @@ ST_FUNC int gjmp_append(TCCState *S, int n, int t) · 7 unmodified lines
685685 return t;
686686 }
687687
688−ST_FUNC int gjmp_cond(TCCState *S, int op, int t)
688+ST_FUNC int gjmp_cond(TCCState* S, int op, int t)
689689 {
690690 g(S, 0x0f);
691691 t = gjmp2(S, op - 16, t);
692692 return t;
693693 }
694694
695−ST_FUNC void gen_opi(TCCState *S, int op)
695+ST_FUNC void gen_opi(TCCState* S, int op)
696696 {
697697 int r, fr, opc, c;
698698
@@ -701,12 +701,12 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 2 unmodified lines
701701 case TOK_ADDC1: /* add with carry generation */
702702 opc = 0;
703703 gen_op8:
704− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
704+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
705705 /* constant case */
706706 vswap(S);
707707 r = gv(S, RC_INT);
708708 vswap(S);
709− c = S->vtop->c.i;
709+ c = S->tccgen_vtop->c.i;
710710 if (c == (char)c) {
711711 /* generate inc and dec for smaller code */
712712 if ((c == 1 || c == -1) && (op == '+' || op == '-')) {
@@ -723,12 +723,12 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 10 unmodified lines
723723 }
724724 } else {
725725 gv2(S, RC_INT, RC_INT);
726− r = S->vtop[-1].r;
727− fr = S->vtop[0].r;
726+ r = S->tccgen_vtop[-1].r;
727+ fr = S->tccgen_vtop[0].r;
728728 o(S, (opc << 3) | 0x01);
729729 o(S, 0xc0 + r + fr * 8);
730730 }
731− S->vtop--;
731+ S->tccgen_vtop--;
732732 if (op >= TOK_ULT && op <= TOK_GT)
733733 vset_VT_CMP(S, op);
734734 break;
@@ -753,9 +753,9 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 18 unmodified lines
753753 goto gen_op8;
754754 case '*':
755755 gv2(S, RC_INT, RC_INT);
756− r = S->vtop[-1].r;
757− fr = S->vtop[0].r;
758− S->vtop--;
756+ r = S->tccgen_vtop[-1].r;
757+ fr = S->tccgen_vtop[0].r;
758+ S->tccgen_vtop--;
759759 o(S, 0xaf0f); /* imul fr, r */
760760 o(S, 0xc0 + fr + r * 8);
761761 break;
@@ -769,23 +769,23 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 7 unmodified lines
769769 opc = 7;
770770 gen_shift:
771771 opc = 0xc0 | (opc << 3);
772− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
772+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
773773 /* constant case */
774774 vswap(S);
775775 r = gv(S, RC_INT);
776776 vswap(S);
777− c = S->vtop->c.i & 0x1f;
777+ c = S->tccgen_vtop->c.i & 0x1f;
778778 o(S, 0xc1); /* shl/shr/sar $xxx, r */
779779 o(S, opc | r);
780780 g(S, c);
781781 } else {
782782 /* we generate the shift in ecx */
783783 gv2(S, RC_INT, RC_ECX);
784− r = S->vtop[-1].r;
784+ r = S->tccgen_vtop[-1].r;
785785 o(S, 0xd3); /* shl/shr/sar %cl, r */
786786 o(S, opc | r);
787787 }
788− S->vtop--;
788+ S->tccgen_vtop--;
789789 break;
790790 case '/':
791791 case TOK_UDIV:
@@ -796,16 +796,16 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 4 unmodified lines
796796 /* first operand must be in eax */
797797 /* XXX: need better constraint for second operand */
798798 gv2(S, RC_EAX, RC_ECX);
799− r = S->vtop[-1].r;
800− fr = S->vtop[0].r;
801− S->vtop--;
799+ r = S->tccgen_vtop[-1].r;
800+ fr = S->tccgen_vtop[0].r;
801+ S->tccgen_vtop--;
802802 save_reg(S, TREG_EDX);
803803 /* save EAX too if used otherwise */
804804 save_reg_upstack(S, TREG_EAX, 1);
805805 if (op == TOK_UMULL) {
806806 o(S, 0xf7); /* mul fr */
807807 o(S, 0xe0 + fr);
808− S->vtop->r2 = TREG_EDX;
808+ S->tccgen_vtop->r2 = TREG_EDX;
809809 r = TREG_EAX;
810810 } else {
811811 if (op == TOK_UDIV || op == TOK_UMOD) {
@@ -820,7 +820,7 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 8 unmodified lines
820820 else
821821 r = TREG_EAX;
822822 }
823− S->vtop->r = r;
823+ S->tccgen_vtop->r = r;
824824 break;
825825 default:
826826 opc = 7;
@@ -831,7 +831,7 @@ ST_FUNC void gen_opi(TCCState *S, int op) · 4 unmodified lines
831831 /* generate a floating point operation 'v = t1 op t2' instruction. The
832832 two operands are guaranteed to have the same floating point type */
833833 /* XXX: need to use ST1 too */
834−ST_FUNC void gen_opf(TCCState *S, int op)
834+ST_FUNC void gen_opf(TCCState* S, int op)
835835 {
836836 int a, ft, fc, swapped, r;
837837
@@ -842,17 +842,17 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 4 unmodified lines
842842 }
843843
844844 /* convert constants to memory references */
845− if ((S->vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
845+ if ((S->tccgen_vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
846846 vswap(S);
847847 gv(S, RC_FLOAT);
848848 vswap(S);
849849 }
850− if ((S->vtop[0].r & (VT_VALMASK | VT_LVAL)) == VT_CONST)
850+ if ((S->tccgen_vtop[0].r & (VT_VALMASK | VT_LVAL)) == VT_CONST)
851851 gv(S, RC_FLOAT);
852852
853853 /* must put at least one value in the floating point register */
854− if ((S->vtop[-1].r & VT_LVAL) &&
855− (S->vtop[0].r & VT_LVAL)) {
854+ if ((S->tccgen_vtop[-1].r & VT_LVAL) &&
855+ (S->tccgen_vtop[0].r & VT_LVAL)) {
856856 vswap(S);
857857 gv(S, RC_FLOAT);
858858 vswap(S);
@@ -860,13 +860,13 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 1 unmodified line
860860 swapped = 0;
861861 /* swap the stack if needed so that t1 is the register and t2 is
862862 the memory reference */
863− if (S->vtop[-1].r & VT_LVAL) {
863+ if (S->tccgen_vtop[-1].r & VT_LVAL) {
864864 vswap(S);
865865 swapped = 1;
866866 }
867867 if (op >= TOK_ULT && op <= TOK_GT) {
868868 /* load on stack second operand */
869− load(S, TREG_ST0, S->vtop);
869+ load(S, TREG_ST0, S->tccgen_vtop);
870870 save_reg(S, TREG_EAX); /* eax is used by FP comparison code */
871871 if (op == TOK_GE || op == TOK_GT)
872872 swapped = !swapped;
@@ -893,12 +893,12 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 20 unmodified lines
893893 o(S, 0x45c4f6); /* test $0x45, %ah */
894894 op = TOK_EQ;
895895 }
896− S->vtop--;
896+ S->tccgen_vtop--;
897897 vset_VT_CMP(S, op);
898898 } else {
899899 /* no memory reference possible for long double operations */
900− if ((S->vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
901− load(S, TREG_ST0, S->vtop);
900+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
901+ load(S, TREG_ST0, S->tccgen_vtop);
902902 swapped = !swapped;
903903 }
904904
@@ -921,14 +921,14 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 16 unmodified lines
921921 a++;
922922 break;
923923 }
924− ft = S->vtop->type.t;
925− fc = S->vtop->c.i;
924+ ft = S->tccgen_vtop->type.t;
925+ fc = S->tccgen_vtop->c.i;
926926 if ((ft & VT_BTYPE) == VT_LDOUBLE) {
927927 o(S, 0xde); /* fxxxp %st, %st(1) */
928928 o(S, 0xc1 + (a << 3));
929929 } else {
930930 /* if saved lvalue, then we must reload it */
931− r = S->vtop->r;
931+ r = S->tccgen_vtop->r;
932932 if ((r & VT_VALMASK) == VT_LLOCAL) {
933933 SValue v1;
934934 r = get_reg(S, RC_INT);
@@ -944,48 +944,48 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 9 unmodified lines
944944 o(S, 0xdc);
945945 else
946946 o(S, 0xd8);
947− gen_modrm(S, a, r, S->vtop->sym, fc);
947+ gen_modrm(S, a, r, S->tccgen_vtop->sym, fc);
948948 }
949− S->vtop--;
949+ S->tccgen_vtop--;
950950 }
951951 }
952952
953953 /* convert integers to fp 't' type. Must handle 'int', 'unsigned int'
954954 and 'long long' cases. */
955−ST_FUNC void gen_cvt_itof(TCCState *S, int t)
955+ST_FUNC void gen_cvt_itof(TCCState* S, int t)
956956 {
957957 save_reg(S, TREG_ST0);
958958 gv(S, RC_INT);
959− if ((S->vtop->type.t & VT_BTYPE) == VT_LLONG) {
959+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG) {
960960 /* signed long long to float/double/long double (unsigned case
961961 is handled generically) */
962− o(S, 0x50 + S->vtop->r2); /* push r2 */
963− o(S, 0x50 + (S->vtop->r & VT_VALMASK)); /* push r */
962+ o(S, 0x50 + S->tccgen_vtop->r2); /* push r2 */
963+ o(S, 0x50 + (S->tccgen_vtop->r & VT_VALMASK)); /* push r */
964964 o(S, 0x242cdf); /* fildll (%esp) */
965965 o(S, 0x08c483); /* add $8, %esp */
966− S->vtop->r2 = VT_CONST;
967− } else if ((S->vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
966+ S->tccgen_vtop->r2 = VT_CONST;
967+ } else if ((S->tccgen_vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
968968 (VT_INT | VT_UNSIGNED)) {
969969 /* unsigned int to float/double/long double */
970970 o(S, 0x6a); /* push $0 */
971971 g(S, 0x00);
972− o(S, 0x50 + (S->vtop->r & VT_VALMASK)); /* push r */
972+ o(S, 0x50 + (S->tccgen_vtop->r & VT_VALMASK)); /* push r */
973973 o(S, 0x242cdf); /* fildll (%esp) */
974974 o(S, 0x08c483); /* add $8, %esp */
975975 } else {
976976 /* int to float/double/long double */
977− o(S, 0x50 + (S->vtop->r & VT_VALMASK)); /* push r */
977+ o(S, 0x50 + (S->tccgen_vtop->r & VT_VALMASK)); /* push r */
978978 o(S, 0x2404db); /* fildl (%esp) */
979979 o(S, 0x04c483); /* add $4, %esp */
980980 }
981− S->vtop->r2 = VT_CONST;
982− S->vtop->r = TREG_ST0;
981+ S->tccgen_vtop->r2 = VT_CONST;
982+ S->tccgen_vtop->r = TREG_ST0;
983983 }
984984
985985 /* convert fp to int 't' type */
986−ST_FUNC void gen_cvt_ftoi(TCCState *S, int t)
986+ST_FUNC void gen_cvt_ftoi(TCCState* S, int t)
987987 {
988− int bt = S->vtop->type.t & VT_BTYPE;
988+ int bt = S->tccgen_vtop->type.t & VT_BTYPE;
989989 if (bt == VT_FLOAT)
990990 vpush_helper_func(S, TOK___fixsfdi);
991991 else if (bt == VT_LDOUBLE)
@@ -995,20 +995,20 @@ ST_FUNC void gen_cvt_ftoi(TCCState *S, int t) · 3 unmodified lines
995995 vswap(S);
996996 gfunc_call(S, 1);
997997 vpushi(S, 0);
998− S->vtop->r = REG_IRET;
998+ S->tccgen_vtop->r = REG_IRET;
999999 if ((t & VT_BTYPE) == VT_LLONG)
1000− S->vtop->r2 = REG_IRE2;
1000+ S->tccgen_vtop->r2 = REG_IRE2;
10011001 }
10021002
10031003 /* convert from one floating point type to another */
1004−ST_FUNC void gen_cvt_ftof(TCCState *S, int t)
1004+ST_FUNC void gen_cvt_ftof(TCCState* S, int t)
10051005 {
10061006 /* all we have to do on i386 is to put the float in a register */
10071007 gv(S, RC_FLOAT);
10081008 }
10091009
10101010 /* char/short to int conversion */
1011−ST_FUNC void gen_cvt_csti(TCCState *S, int t)
1011+ST_FUNC void gen_cvt_csti(TCCState* S, int t)
10121012 {
10131013 int r, sz, xl;
10141014 r = gv(S, RC_INT);
@@ -1021,39 +1021,39 @@ ST_FUNC void gen_cvt_csti(TCCState *S, int t) · 6 unmodified lines
10211021 }
10221022
10231023 /* increment tcov counter */
1024−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv)
1024+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv)
10251025 {
10261026 o(S, 0x0583); /* addl $1, xxx */
1027− greloc(S, cur_text_section, sv->sym, S->ind, R_386_32);
1027+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind, R_386_32);
10281028 gen_le32(S, 0);
10291029 o(S, 1);
10301030 o(S, 0x1583); /* addcl $0, xxx */
1031− greloc(S, cur_text_section, sv->sym, S->ind, R_386_32);
1031+ greloc(S, cur_text_section, sv->sym, S->tccgen_ind, R_386_32);
10321032 gen_le32(S, 4);
10331033 g(S, 0);
10341034 }
10351035
10361036 /* computed goto support */
1037−ST_FUNC void ggoto(TCCState *S)
1037+ST_FUNC void ggoto(TCCState* S)
10381038 {
10391039 gcall_or_jmp(S, 1);
1040− S->vtop--;
1040+ S->tccgen_vtop--;
10411041 }
10421042
10431043 /* bound check support functions */
10441044 #ifdef CONFIG_TCC_BCHECK
10451045
1046−static void gen_bounds_prolog(TCCState *S)
1046+static void gen_bounds_prolog(TCCState* S)
10471047 {
10481048 /* leave some room for bound checking code */
10491049 S->func_bound_offset = lbounds_section->data_offset;
1050− S->func_bound_ind = S->ind;
1050+ S->func_bound_ind = S->tccgen_ind;
10511051 S->func_bound_add_epilog = 0;
10521052 oad(S, 0xb8, 0); /* lbound section pointer */
10531053 oad(S, 0xb8, 0); /* call to function */
10541054 }
10551055
1056−static void gen_bounds_epilog(TCCState *S)
1056+static void gen_bounds_epilog(TCCState* S)
10571057 {
10581058 addr_t saved_ind;
10591059 addr_t *bounds_ptr;
@@ -1067,22 +1067,22 @@ static void gen_bounds_epilog(TCCState *S) · 7 unmodified lines
10671067 bounds_ptr = section_ptr_add(S, lbounds_section, sizeof(addr_t));
10681068 *bounds_ptr = 0;
10691069
1070− sym_data = get_sym_ref(S, &S->char_pointer_type, lbounds_section,
1070+ sym_data = get_sym_ref(S, &S->tccgen_char_pointer_type, lbounds_section,
10711071 S->func_bound_offset, lbounds_section->data_offset);
10721072
10731073 /* generate bound local allocation */
10741074 if (offset_modified) {
1075− saved_ind = S->ind;
1076− S->ind = S->func_bound_ind;
1077− greloc(S, cur_text_section, sym_data, S->ind + 1, R_386_32);
1078− S->ind = S->ind + 5;
1075+ saved_ind = S->tccgen_ind;
1076+ S->tccgen_ind = S->func_bound_ind;
1077+ greloc(S, cur_text_section, sym_data, S->tccgen_ind + 1, R_386_32);
1078+ S->tccgen_ind = S->tccgen_ind + 5;
10791079 gen_static_call(S, TOK___bound_local_new);
1080− S->ind = saved_ind;
1080+ S->tccgen_ind = saved_ind;
10811081 }
10821082
10831083 /* generate bound check local freeing */
10841084 o(S, 0x5250); /* save returned value, if any */
1085− greloc(S, cur_text_section, sym_data, S->ind + 1, R_386_32);
1085+ greloc(S, cur_text_section, sym_data, S->tccgen_ind + 1, R_386_32);
10861086 oad(S, 0xb8, 0); /* mov %eax, xxx */
10871087 gen_static_call(S, TOK___bound_local_delete);
10881088 o(S, 0x585a); /* restore returned value, if any */
@@ -1090,20 +1090,20 @@ static void gen_bounds_epilog(TCCState *S) · 1 unmodified line
10901090 #endif
10911091
10921092 /* Save the stack pointer onto the stack */
1093−ST_FUNC void gen_vla_sp_save(TCCState *S, int addr) {
1093+ST_FUNC void gen_vla_sp_save(TCCState* S, int addr) {
10941094 /* mov %esp,addr(%ebp)*/
10951095 o(S, 0x89);
10961096 gen_modrm(S, TREG_ESP, VT_LOCAL, NULL, addr);
10971097 }
10981098
10991099 /* Restore the SP from a location on the stack */
1100−ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr) {
1100+ST_FUNC void gen_vla_sp_restore(TCCState* S, int addr) {
11011101 o(S, 0x8b);
11021102 gen_modrm(S, TREG_ESP, VT_LOCAL, NULL, addr);
11031103 }
11041104
11051105 /* Subtract from the stack pointer, and push the resulting value onto the stack */
1106−ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) {
1106+ST_FUNC void gen_vla_alloc(TCCState* S, CType *type, int align) {
11071107 int use_call = 0;
11081108
11091109 #if defined(CONFIG_TCC_BCHECK)
libtcc.c+22−22
@@ -233,7 +233,7 @@ PUB_FUNC char *tcc_fileextension (const char *name) · 232 unmodified lines
233233 return e ? e : strchr(b, 0);
234234 }
235235
236−ST_FUNC char *tcc_load_text(TCCState *S, int fd)
236+ST_FUNC char *tcc_load_text(TCCState* S, int fd)
237237 {
238238 int len = lseek(fd, 0, SEEK_END);
239239 char *buf = load_data(S, fd, 0, len + 1);
@@ -275,12 +275,12 @@ PUB_FUNC void *tcc_mallocz_base(unsigned long size) · 35 unmodified lines
275275
276276 #ifndef MEM_DEBUG
277277
278−PUB_FUNC void tcc_free(TCCState *S, void *ptr)
278+PUB_FUNC void tcc_free(TCCState* S, void *ptr)
279279 {
280280 free(ptr);
281281 }
282282
283−PUB_FUNC void *tcc_malloc(TCCState *S, unsigned long size)
283+PUB_FUNC void *tcc_malloc(TCCState* S, unsigned long size)
284284 {
285285 void *ptr;
286286 ptr = malloc(size);
@@ -289,7 +289,7 @@ PUB_FUNC void *tcc_malloc(TCCState *S, unsigned long size) · 2 unmodified lines
289289 return ptr;
290290 }
291291
292−PUB_FUNC void *tcc_mallocz(TCCState *S, unsigned long size)
292+PUB_FUNC void *tcc_mallocz(TCCState* S, unsigned long size)
293293 {
294294 void *ptr;
295295 ptr = tcc_malloc(S, size);
@@ -298,7 +298,7 @@ PUB_FUNC void *tcc_mallocz(TCCState *S, unsigned long size) · 2 unmodified lines
298298 return ptr;
299299 }
300300
301−PUB_FUNC void *tcc_realloc(TCCState *S, void *ptr, unsigned long size)
301+PUB_FUNC void *tcc_realloc(TCCState* S, void *ptr, unsigned long size)
302302 {
303303 void *ptr1;
304304 ptr1 = realloc(ptr, size);
@@ -307,7 +307,7 @@ PUB_FUNC void *tcc_realloc(TCCState *S, void *ptr, unsigned long size) · 2 unmodified lines
307307 return ptr1;
308308 }
309309
310−PUB_FUNC char *tcc_strdup(TCCState *S, const char *str)
310+PUB_FUNC char *tcc_strdup(TCCState* S, const char *str)
311311 {
312312 char *ptr;
313313 ptr = tcc_malloc(S, strlen(str) + 1);
@@ -361,7 +361,7 @@ static mem_debug_header_t *malloc_check(void *ptr, const char *msg) · 47 unmodified lines
361361 return header;
362362 }
363363
364−PUB_FUNC void *tcc_malloc_debug(TCCState *S, unsigned long size, const char *file, int line)
364+PUB_FUNC void *tcc_malloc_debug(TCCState* S, unsigned long size, const char *file, int line)
365365 {
366366 int ofs;
367367 mem_debug_header_t *header;
@@ -392,7 +392,7 @@ PUB_FUNC void *tcc_malloc_debug(TCCState *S, unsigned long size, const char *fil · 24 unmodified lines
392392 return MEM_USER_PTR(header);
393393 }
394394
395−PUB_FUNC void tcc_free_debug(TCCState *S, void *ptr)
395+PUB_FUNC void tcc_free_debug(TCCState* S, void *ptr)
396396 {
397397 mem_debug_header_t *header;
398398 if (!ptr)
@@ -409,7 +409,7 @@ PUB_FUNC void tcc_free_debug(TCCState *S, void *ptr) · 10 unmodified lines
409409 free(header);
410410 }
411411
412−PUB_FUNC void *tcc_mallocz_debug(TCCState *S, unsigned long size, const char *file, int line)
412+PUB_FUNC void *tcc_mallocz_debug(TCCState* S, unsigned long size, const char *file, int line)
413413 {
414414 void *ptr;
415415 ptr = tcc_malloc_debug(S, size,file,line);
@@ -417,7 +417,7 @@ PUB_FUNC void *tcc_mallocz_debug(TCCState *S, unsigned long size, const char *fi · 1 unmodified line
417417 return ptr;
418418 }
419419
420−PUB_FUNC void *tcc_realloc_debug(TCCState *S, void *ptr, unsigned long size, const char *file, int line)
420+PUB_FUNC void *tcc_realloc_debug(TCCState* S, void *ptr, unsigned long size, const char *file, int line)
421421 {
422422 mem_debug_header_t *header;
423423 int mem_debug_chain_update = 0;
@@ -443,7 +443,7 @@ PUB_FUNC void *tcc_realloc_debug(TCCState *S, void *ptr, unsigned long size, con · 19 unmodified lines
443443 return MEM_USER_PTR(header);
444444 }
445445
446−PUB_FUNC char *tcc_strdup_debug(TCCState *S, const char *str, const char *file, int line)
446+PUB_FUNC char *tcc_strdup_debug(TCCState* S, const char *str, const char *file, int line)
447447 {
448448 char *ptr;
449449 ptr = tcc_malloc_debug(S, strlen(str) + 1, file, line);
@@ -532,7 +532,7 @@ int vio_close(vio_fd *fd) { · 82 unmodified lines
532532 /********************************************************/
533533 /* dynarrays */
534534
535−ST_FUNC void dynarray_add(TCCState *S, void *ptab, int *nb_ptr, void *data)
535+ST_FUNC void dynarray_add(TCCState* S, void *ptab, int *nb_ptr, void *data)
536536 {
537537 int nb, nb_alloc;
538538 void **pp;
@@ -552,7 +552,7 @@ ST_FUNC void dynarray_add(TCCState *S, void *ptab, int *nb_ptr, void *data) · 13 unmodified lines
552552 *nb_ptr = nb;
553553 }
554554
555−ST_FUNC void dynarray_reset(TCCState *S, void *pp, int *n)
555+ST_FUNC void dynarray_reset(TCCState* S, void *pp, int *n)
556556 {
557557 void **p;
558558 for (p = *(void***)pp; *n; ++p, --*n)
@@ -608,7 +608,7 @@ static void tcc_split_path(TCCState *S, void *p_ary, int *p_nb_ary, const char * · 49 unmodified lines
608608 /* error1() modes */
609609 enum { ERROR_WARN, ERROR_NOABORT, ERROR_ERROR };
610610
611−static void error1(TCCState *S, int mode, const char *fmt, va_list ap)
611+static void error1(TCCState* S, int mode, const char *fmt, va_list ap)
612612 {
613613 BufferedFile **pf, *f;
614614 CString cs;
@@ -650,7 +650,7 @@ static void error1(TCCState *S, int mode, const char *fmt, va_list ap) · 35 unmodified lines
650650 cstr_printf(S, &cs, "In file included from %s:%d:\n",
651651 (*pf)->filename, (*pf)->line_num);
652652 cstr_printf(S, &cs, "%s:%d: ",
653− f->filename, (*pf)->line_num - !!(S->tok_flags & TOK_FLAG_BOL));
653+ f->filename, (*pf)->line_num - !!(S->tccpp_tok_flags & TOK_FLAG_BOL));
654654 } else if (S->current_filename) {
655655 cstr_printf(S, &cs, "%s: ", S->current_filename);
656656 }
@@ -699,7 +699,7 @@ LIBTCCAPI void *tcc_get_error_opaque(TCCState *S) · 42 unmodified lines
699699 }
700700
701701 /* error without aborting current compilation */
702−PUB_FUNC void _tcc_error_noabort(TCCState *S, const char *fmt, ...)
702+PUB_FUNC void _tcc_error_noabort(TCCState* S, const char *fmt, ...)
703703 {
704704 va_list ap;
705705 va_start(ap, fmt);
@@ -707,14 +707,14 @@ PUB_FUNC void _tcc_error_noabort(TCCState *S, const char *fmt, ...) · 1 unmodified line
707707 va_end(ap);
708708 }
709709
710−PUB_FUNC void _tcc_error(TCCState *S, const char *fmt, ...)
710+PUB_FUNC void _tcc_error(TCCState* S, const char *fmt, ...)
711711 {
712712 va_list ap;
713713 va_start(ap, fmt);
714714 for (;;) error1(S, ERROR_ERROR, fmt, ap);
715715 }
716716
717−PUB_FUNC void _tcc_warning(TCCState *S, const char *fmt, ...)
717+PUB_FUNC void _tcc_warning(TCCState* S, const char *fmt, ...)
718718 {
719719 va_list ap;
720720 va_start(ap, fmt);
@@ -744,10 +744,10 @@ ST_FUNC void tcc_open_bf(TCCState *S, const char *filename, int initlen) · 23 unmodified lines
744744 bf->fd = -1;
745745 bf->prev = S->tccpp_file;
746746 S->tccpp_file = bf;
747− S->tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
747+ S->tccpp_tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
748748 }
749749
750−ST_FUNC void tcc_close(TCCState *S)
750+ST_FUNC void tcc_close(TCCState* S)
751751 {
752752 BufferedFile *bf = S->tccpp_file;
753753 if (bf->fd > 0) {
@@ -1388,7 +1388,7 @@ static const char *skip_linker_arg(const char **str) · 634 unmodified lines
13881388 return s2;
13891389 }
13901390
1391−static void copy_linker_arg(TCCState *S, char **pp, const char *s, int sep)
1391+static void copy_linker_arg(TCCState* S, char **pp, const char *s, int sep)
13921392 {
13931393 const char *q = s;
13941394 char *p = *pp;
@@ -1723,7 +1723,7 @@ static void args_parser_add_file(TCCState *S, const char* filename, int filetype · 328 unmodified lines
17231723 dynarray_add(S, &S->files, &S->nb_files, f);
17241724 }
17251725
1726−static int args_parser_make_argv(TCCState *S, const char *r, int *argc, char ***argv)
1726+static int args_parser_make_argv(TCCState* S, const char *r, int *argc, char ***argv)
17271727 {
17281728 int ret = 0, q, c;
17291729 CString str;
riscv64-asm.c+37−37
@@ -9,9 +9,9 @@ · 8 unmodified lines
99 #define CONFIG_TCC_ASM
1010 #define NB_ASM_REGS 32
1111
12−ST_FUNC void g(TCCState *S, int c);
13−ST_FUNC void gen_le16(TCCState *S, int c);
14−ST_FUNC void gen_le32(TCCState *S, int c);
12+ST_FUNC void g(TCCState* S, int c);
13+ST_FUNC void gen_le16(TCCState* S, int c);
14+ST_FUNC void gen_le32(TCCState* S, int c);
1515
1616 /*************************************************************/
1717 #else
@@ -20,44 +20,44 @@ ST_FUNC void gen_le32(TCCState *S, int c); · 2 unmodified lines
2020 #include "tcc.h"
2121
2222 /* XXX: make it faster ? */
23−ST_FUNC void g(TCCState *S, int c)
23+ST_FUNC void g(TCCState* S, int c)
2424 {
2525 int ind1;
26− if (S->nocode_wanted)
26+ if (S->tccgen_nocode_wanted)
2727 return;
28− ind1 = S->ind + 1;
28+ ind1 = S->tccgen_ind + 1;
2929 if (ind1 > cur_text_section->data_allocated)
3030 section_realloc(S, cur_text_section, ind1);
31− cur_text_section->data[S->ind] = c;
32− S->ind = ind1;
31+ cur_text_section->data[S->tccgen_ind] = c;
32+ S->tccgen_ind = ind1;
3333 }
3434
35−ST_FUNC void gen_le16 (TCCState *S, int i)
35+ST_FUNC void gen_le16 (TCCState* S, int i)
3636 {
3737 g(S, i);
3838 g(S, i>>8);
3939 }
4040
41−ST_FUNC void gen_le32 (TCCState *S, int i)
41+ST_FUNC void gen_le32 (TCCState* S, int i)
4242 {
4343 int ind1;
44− if (S->nocode_wanted)
44+ if (S->tccgen_nocode_wanted)
4545 return;
46− ind1 = S->ind + 4;
46+ ind1 = S->tccgen_ind + 4;
4747 if (ind1 > cur_text_section->data_allocated)
4848 section_realloc(S, cur_text_section, ind1);
49− cur_text_section->data[S->ind++] = i & 0xFF;
50− cur_text_section->data[S->ind++] = (i >> 8) & 0xFF;
51− cur_text_section->data[S->ind++] = (i >> 16) & 0xFF;
52− cur_text_section->data[S->ind++] = (i >> 24) & 0xFF;
49+ cur_text_section->data[S->tccgen_ind++] = i & 0xFF;
50+ cur_text_section->data[S->tccgen_ind++] = (i >> 8) & 0xFF;
51+ cur_text_section->data[S->tccgen_ind++] = (i >> 16) & 0xFF;
52+ cur_text_section->data[S->tccgen_ind++] = (i >> 24) & 0xFF;
5353 }
5454
55−ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe)
55+ST_FUNC void gen_expr32(TCCState* S, ExprValue *pe)
5656 {
5757 gen_le32(S, pe->v);
5858 }
5959
60−static void asm_emit_opcode(TCCState *S, uint32_t opcode) {
60+static void asm_emit_opcode(TCCState* S, uint32_t opcode) {
6161 gen_le32(S, opcode);
6262 }
6363
@@ -128,12 +128,12 @@ static void parse_operand(TCCState *S, Operand *op) · 64 unmodified lines
128128
129129 op->type = 0;
130130
131− if ((reg = asm_parse_regvar(S, S->tok)) != -1) {
131+ if ((reg = asm_parse_regvar(S, S->tccpp_tok)) != -1) {
132132 next(S); // skip register name
133133 op->type = OP_REG;
134134 op->reg = (uint8_t) reg;
135135 return;
136− } else if (S->tok == '$') {
136+ } else if (S->tccpp_tok == '$') {
137137 /* constant value */
138138 next(S); // skip '#' or '$'
139139 }
@@ -207,11 +207,11 @@ static void asm_emit_u(TCCState *S, int token, uint32_t opcode, const Operand* r · 67 unmodified lines
207207 gen_le32(S, opcode | ENCODE_RD(rd->reg) | (rs2->e.v << 12));
208208 }
209209
210−static void asm_binary_opcode(TCCState *S, int token)
210+static void asm_binary_opcode(TCCState* S, int token)
211211 {
212212 Operand ops[2];
213213 parse_operand(S, &ops[0]);
214− if (S->tok == ',')
214+ if (S->tccpp_tok == ',')
215215 next(S);
216216 else
217217 expect(S, "','");
@@ -230,7 +230,7 @@ static void asm_binary_opcode(TCCState *S, int token) · 12 unmodified lines
230230 }
231231
232232 /* caller: Add funct3, funct7 into opcode */
233−static void asm_emit_r(TCCState *S, int token, uint32_t opcode, const Operand* rd, const Operand* rs1, const Operand* rs2)
233+static void asm_emit_r(TCCState* S, int token, uint32_t opcode, const Operand* rd, const Operand* rs1, const Operand* rs2)
234234 {
235235 if (rd->type != OP_REG) {
236236 tcc_error(S, "'%s': Expected destination operand that is a register", get_tok_str(S, token, NULL));
@@ -255,7 +255,7 @@ static void asm_emit_r(TCCState *S, int token, uint32_t opcode, const Operand* r · 18 unmodified lines
255255 }
256256
257257 /* caller: Add funct3 into opcode */
258−static void asm_emit_i(TCCState *S, int token, uint32_t opcode, const Operand* rd, const Operand* rs1, const Operand* rs2)
258+static void asm_emit_i(TCCState* S, int token, uint32_t opcode, const Operand* rd, const Operand* rs1, const Operand* rs2)
259259 {
260260 if (rd->type != OP_REG) {
261261 tcc_error(S, "'%s': Expected destination operand that is a register", get_tok_str(S, token, NULL));
@@ -283,12 +283,12 @@ static void asm_shift_opcode(TCCState *S, int token) · 21 unmodified lines
283283 {
284284 Operand ops[3];
285285 parse_operand(S, &ops[0]);
286− if (S->tok == ',')
286+ if (S->tccpp_tok == ',')
287287 next(S);
288288 else
289289 expect(S, "','");
290290 parse_operand(S, &ops[1]);
291− if (S->tok == ',')
291+ if (S->tccpp_tok == ',')
292292 next(S);
293293 else
294294 expect(S, "','");
@@ -336,16 +336,16 @@ static void asm_shift_opcode(TCCState *S, int token) · 41 unmodified lines
336336 }
337337 }
338338
339−static void asm_data_processing_opcode(TCCState *S, int token)
339+static void asm_data_processing_opcode(TCCState* S, int token)
340340 {
341341 Operand ops[3];
342342 parse_operand(S, &ops[0]);
343− if (S->tok == ',')
343+ if (S->tccpp_tok == ',')
344344 next(S);
345345 else
346346 expect(S, "','");
347347 parse_operand(S, &ops[1]);
348− if (S->tok == ',')
348+ if (S->tccpp_tok == ',')
349349 next(S);
350350 else
351351 expect(S, "','");
@@ -414,7 +414,7 @@ static void asm_data_processing_opcode(TCCState *S, int token) · 62 unmodified lines
414414 }
415415
416416 /* caller: Add funct3 to opcode */
417−static void asm_emit_s(TCCState *S, int token, uint32_t opcode, const Operand* rs1, const Operand* rs2, const Operand* imm)
417+static void asm_emit_s(TCCState* S, int token, uint32_t opcode, const Operand* rs1, const Operand* rs2, const Operand* imm)
418418 {
419419 if (rs1->type != OP_REG) {
420420 tcc_error(S, "'%s': Expected first source operand that is a register", get_tok_str(S, token, NULL));
@@ -442,7 +442,7 @@ static void asm_emit_s(TCCState *S, int token, uint32_t opcode, const Operand* r · 21 unmodified lines
442442 }
443443 }
444444
445−static void asm_data_transfer_opcode(TCCState *S, int token)
445+static void asm_data_transfer_opcode(TCCState* S, int token)
446446 {
447447 Operand ops[3];
448448 parse_operand(S, &ops[0]);
@@ -450,7 +450,7 @@ static void asm_data_transfer_opcode(TCCState *S, int token) · 1 unmodified line
450450 expect(S, "register");
451451 return;
452452 }
453− if (S->tok == ',')
453+ if (S->tccpp_tok == ',')
454454 next(S);
455455 else
456456 expect(S, "','");
@@ -459,7 +459,7 @@ static void asm_data_transfer_opcode(TCCState *S, int token) · 2 unmodified lines
459459 expect(S, "register");
460460 return;
461461 }
462− if (S->tok == ',')
462+ if (S->tccpp_tok == ',')
463463 next(S);
464464 else
465465 expect(S, "','");
@@ -511,7 +511,7 @@ static void asm_data_transfer_opcode(TCCState *S, int token) · 45 unmodified lines
511511 }
512512 }
513513
514−static void asm_branch_opcode(TCCState *S, int token)
514+static void asm_branch_opcode(TCCState* S, int token)
515515 {
516516 // Branch (RS1,RS2,IMM); SB-format
517517 uint32_t opcode = (0x18 << 2) | 3;
@@ -522,7 +522,7 @@ static void asm_branch_opcode(TCCState *S, int token) · 4 unmodified lines
522522 expect(S, "register");
523523 return;
524524 }
525− if (S->tok == ',')
525+ if (S->tccpp_tok == ',')
526526 next(S);
527527 else
528528 expect(S, "','");
@@ -531,7 +531,7 @@ static void asm_branch_opcode(TCCState *S, int token) · 2 unmodified lines
531531 expect(S, "register");
532532 return;
533533 }
534− if (S->tok == ',')
534+ if (S->tccpp_tok == ',')
535535 next(S);
536536 else
537537 expect(S, "','");
@@ -709,7 +709,7 @@ ST_FUNC void asm_clobber(TCCState *S, uint8_t *clobber_regs, const char *str) · 171 unmodified lines
709709 clobber_regs[reg] = 1;
710710 }
711711
712−ST_FUNC int asm_parse_regvar (TCCState *S, int t)
712+ST_FUNC int asm_parse_regvar (TCCState* S, int t)
713713 {
714714 if (t >= TOK_ASM_x0 && t <= TOK_ASM_pc) { /* register name */
715715 switch (t) {
riscv64-gen.c+197−197
@@ -100,37 +100,37 @@ static int is_freg(int r) · 99 unmodified lines
100100 return r >= 8 && r < 16;
101101 }
102102
103−ST_FUNC void o(TCCState *S, unsigned int c)
103+ST_FUNC void o(TCCState* S, unsigned int c)
104104 {
105− int ind1 = S->ind + 4;
106− if (S->nocode_wanted)
105+ int ind1 = S->tccgen_ind + 4;
106+ if (S->tccgen_nocode_wanted)
107107 return;
108108 if (ind1 > cur_text_section->data_allocated)
109109 section_realloc(S, cur_text_section, ind1);
110− write32le(cur_text_section->data + S->ind, c);
111− S->ind = ind1;
110+ write32le(cur_text_section->data + S->tccgen_ind, c);
111+ S->tccgen_ind = ind1;
112112 }
113113
114−static void EIu(TCCState *S, uint32_t opcode, uint32_t func3,
114+static void EIu(TCCState* S, uint32_t opcode, uint32_t func3,
115115 uint32_t rd, uint32_t rs1, uint32_t imm)
116116 {
117117 o(S, opcode | (func3 << 12) | (rd << 7) | (rs1 << 15) | (imm << 20));
118118 }
119119
120−static void ER(TCCState *S, uint32_t opcode, uint32_t func3,
120+static void ER(TCCState* S, uint32_t opcode, uint32_t func3,
121121 uint32_t rd, uint32_t rs1, uint32_t rs2, uint32_t func7)
122122 {
123123 o(S, opcode | func3 << 12 | rd << 7 | rs1 << 15 | rs2 << 20 | func7 << 25);
124124 }
125125
126−static void EI(TCCState *S, uint32_t opcode, uint32_t func3,
126+static void EI(TCCState* S, uint32_t opcode, uint32_t func3,
127127 uint32_t rd, uint32_t rs1, uint32_t imm)
128128 {
129129 assert(! ((imm + (1 << 11)) >> 12));
130130 EIu(S, opcode, func3, rd, rs1, imm);
131131 }
132132
133−static void ES(TCCState *S, uint32_t opcode, uint32_t func3,
133+static void ES(TCCState* S, uint32_t opcode, uint32_t func3,
134134 uint32_t rs1, uint32_t rs2, uint32_t imm)
135135 {
136136 assert(! ((imm + (1 << 11)) >> 12));
@@ -139,7 +139,7 @@ static void ES(TCCState *S, uint32_t opcode, uint32_t func3, · 2 unmodified lines
139139 }
140140
141141 // Patch all branches in list pointed to by t to branch to a:
142−ST_FUNC void gsym_addr(TCCState *S, int t_, int a_)
142+ST_FUNC void gsym_addr(TCCState* S, int t_, int a_)
143143 {
144144 uint32_t t = t_;
145145 uint32_t a = a_;
@@ -158,7 +158,7 @@ ST_FUNC void gsym_addr(TCCState *S, int t_, int a_) · 12 unmodified lines
158158 }
159159 }
160160
161−static int load_symofs(TCCState *S, int r, SValue *sv, int forstore)
161+static int load_symofs(TCCState* S, int r, SValue *sv, int forstore)
162162 {
163163 int rr, doload = 0;
164164 int fc = sv->c.i, v = sv->r & VT_VALMASK;
@@ -166,21 +166,21 @@ static int load_symofs(TCCState *S, int r, SValue *sv, int forstore) · 1 unmodified line
166166 Sym label = {0};
167167 assert(v == VT_CONST);
168168 if (sv->sym->type.t & VT_STATIC) { // XXX do this per linker relax
169− greloca(S, cur_text_section, sv->sym, S->ind,
169+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind,
170170 R_RISCV_PCREL_HI20, sv->c.i);
171171 sv->c.i = 0;
172172 } else {
173173 if (((unsigned)fc + (1 << 11)) >> 12)
174174 tcc_error(S, "unimp: large addend for global address (0x%lx)", (long)sv->c.i);
175− greloca(S, cur_text_section, sv->sym, S->ind,
175+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind,
176176 R_RISCV_GOT_HI20, 0);
177177 doload = 1;
178178 }
179179 label.type.t = VT_VOID | VT_STATIC;
180− put_extern_sym(S, &label, cur_text_section, S->ind, 0);
180+ put_extern_sym(S, &label, cur_text_section, S->tccgen_ind, 0);
181181 rr = is_ireg(r) ? ireg(r) : 5;
182182 o(S, 0x17 | (rr << 7)); // auipc RR, 0 %pcrel_hi(sym)+addend
183− greloca(S, cur_text_section, &label, S->ind,
183+ greloca(S, cur_text_section, &label, S->tccgen_ind,
184184 doload || !forstore
185185 ? R_RISCV_PCREL_LO12_I : R_RISCV_PCREL_LO12_S, 0);
186186 if (doload) {
@@ -201,7 +201,7 @@ static int load_symofs(TCCState *S, int r, SValue *sv, int forstore) · 14 unmodified lines
201201 return rr;
202202 }
203203
204−static void load_large_constant(TCCState *S, int rr, int fc, uint32_t pi)
204+static void load_large_constant(TCCState* S, int rr, int fc, uint32_t pi)
205205 {
206206 if (fc < 0)
207207 pi++;
@@ -215,7 +215,7 @@ static void load_large_constant(TCCState *S, int rr, int fc, uint32_t pi) · 7 unmodified lines
215215 EI(S, 0x13, 1, rr, rr, 8); // slli RR, RR, 8
216216 }
217217
218−ST_FUNC void load(TCCState *S, int r, SValue *sv)
218+ST_FUNC void load(TCCState* S, int r, SValue *sv)
219219 {
220220 int fr = sv->r;
221221 int v = fr & VT_VALMASK;
@@ -314,9 +314,9 @@ ST_FUNC void load(TCCState *S, int r, SValue *sv) · 92 unmodified lines
314314 | (func7 << 25)); // fmv.{w.x, x.w, d.x, x.d} RR, VR
315315 }
316316 } else if (v == VT_CMP) {
317− int op = S->vtop->cmp_op;
318− int a = S->vtop->cmp_r & 0xff;
319− int b = (S->vtop->cmp_r >> 8) & 0xff;
317+ int op = S->tccgen_vtop->cmp_op;
318+ int a = S->tccgen_vtop->cmp_r & 0xff;
319+ int b = (S->tccgen_vtop->cmp_r >> 8) & 0xff;
320320 int inv = 0;
321321 switch (op) {
322322 case TOK_ULT:
@@ -353,14 +353,14 @@ ST_FUNC void load(TCCState *S, int r, SValue *sv) · 30 unmodified lines
353353 int t = v & 1;
354354 assert(is_ireg(r));
355355 EI(S, 0x13, 0, rr, 0, t); // addi RR, x0, t
356− gjmp_addr(S, S->ind + 8);
356+ gjmp_addr(S, S->tccgen_ind + 8);
357357 gsym(S, fc);
358358 EI(S, 0x13, 0, rr, 0, t ^ 1); // addi RR, x0, !t
359359 } else
360360 tcc_error(S, "unimp: load(non-const)");
361361 }
362362
363−ST_FUNC void store(TCCState *S, int r, SValue *sv)
363+ST_FUNC void store(TCCState* S, int r, SValue *sv)
364364 {
365365 int fr = sv->r & VT_VALMASK;
366366 int rr = is_ireg(r) ? ireg(r) : freg(r), ptrreg;
@@ -403,22 +403,22 @@ ST_FUNC void store(TCCState *S, int r, SValue *sv) · 36 unmodified lines
403403 ptrreg, rr, fc); // RR, fc(base)
404404 }
405405
406−static void gcall_or_jmp(TCCState *S, int docall)
406+static void gcall_or_jmp(TCCState* S, int docall)
407407 {
408408 int tr = docall ? 1 : 5; // ra or t0
409− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
410− ((S->vtop->r & VT_SYM) && S->vtop->c.i == (int)S->vtop->c.i)) {
409+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
410+ ((S->tccgen_vtop->r & VT_SYM) && S->tccgen_vtop->c.i == (int)S->tccgen_vtop->c.i)) {
411411 /* constant symbolic case -> simple relocation */
412− greloca(S, cur_text_section, S->vtop->sym, S->ind,
413− R_RISCV_CALL_PLT, (int)S->vtop->c.i);
412+ greloca(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind,
413+ R_RISCV_CALL_PLT, (int)S->tccgen_vtop->c.i);
414414 o(S, 0x17 | (tr << 7)); // auipc TR, 0 %call(func)
415415 EI(S, 0x67, 0, tr, tr, 0);// jalr TR, r(TR)
416− } else if (S->vtop->r < VT_CONST) {
417− int r = ireg(S->vtop->r);
416+ } else if (S->tccgen_vtop->r < VT_CONST) {
417+ int r = ireg(S->tccgen_vtop->r);
418418 EI(S, 0x67, 0, tr, r, 0); // jalr TR, 0(R)
419419 } else {
420420 int r = TREG_RA;
421− load(S, r, S->vtop);
421+ load(S, r, S->tccgen_vtop);
422422 r = ireg(r);
423423 EI(S, 0x67, 0, tr, r, 0); // jalr TR, 0(R)
424424 }
@@ -426,20 +426,20 @@ static void gcall_or_jmp(TCCState *S, int docall) · 1 unmodified line
426426
427427 #if defined(CONFIG_TCC_BCHECK)
428428
429−static void gen_bounds_call(TCCState *S, int v)
429+static void gen_bounds_call(TCCState* S, int v)
430430 {
431431 Sym *sym = external_helper_sym(S, v);
432432
433− greloca(S, cur_text_section, sym, S->ind, R_RISCV_CALL_PLT, 0);
433+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_RISCV_CALL_PLT, 0);
434434 o(S, 0x17 | (1 << 7)); // auipc TR, 0 %call(func)
435435 EI(S, 0x67, 0, 1, 1, 0); // jalr TR, r(TR)
436436 }
437437
438−static void gen_bounds_prolog(TCCState *S)
438+static void gen_bounds_prolog(TCCState* S)
439439 {
440440 /* leave some room for bound checking code */
441441 S->func_bound_offset = lbounds_section->data_offset;
442− S->func_bound_ind = S->ind;
442+ S->func_bound_ind = S->tccgen_ind;
443443 S->func_bound_add_epilog = 0;
444444 o(S, 0x00000013); /* ld a0,#lbound section pointer */
445445 o(S, 0x00000013);
@@ -447,7 +447,7 @@ static void gen_bounds_prolog(TCCState *S) · 1 unmodified line
447447 o(S, 0x00000013);
448448 }
449449
450−static void gen_bounds_epilog(TCCState *S)
450+static void gen_bounds_epilog(TCCState* S)
451451 {
452452 addr_t saved_ind;
453453 addr_t *bounds_ptr;
@@ -463,31 +463,31 @@ static void gen_bounds_epilog(TCCState *S) · 9 unmodified lines
463463 bounds_ptr = section_ptr_add(S, lbounds_section, sizeof(addr_t));
464464 *bounds_ptr = 0;
465465
466− sym_data = get_sym_ref(S, &S->char_pointer_type, lbounds_section,
466+ sym_data = get_sym_ref(S, &S->tccgen_char_pointer_type, lbounds_section,
467467 S->func_bound_offset, lbounds_section->data_offset);
468468
469469 label.type.t = VT_VOID | VT_STATIC;
470470 /* generate bound local allocation */
471471 if (offset_modified) {
472− saved_ind = S->ind;
473− S->ind = S->func_bound_ind;
474− put_extern_sym(S, &label, cur_text_section, S->ind, 0);
475− greloca(S, cur_text_section, sym_data, S->ind, R_RISCV_GOT_HI20, 0);
472+ saved_ind = S->tccgen_ind;
473+ S->tccgen_ind = S->func_bound_ind;
474+ put_extern_sym(S, &label, cur_text_section, S->tccgen_ind, 0);
475+ greloca(S, cur_text_section, sym_data, S->tccgen_ind, R_RISCV_GOT_HI20, 0);
476476 o(S, 0x17 | (10 << 7)); // auipc a0, 0 %pcrel_hi(sym)+addend
477− greloca(S, cur_text_section, &label, S->ind, R_RISCV_PCREL_LO12_I, 0);
477+ greloca(S, cur_text_section, &label, S->tccgen_ind, R_RISCV_PCREL_LO12_I, 0);
478478 EI(S, 0x03, 3, 10, 10, 0); // ld a0, 0(a0)
479479 gen_bounds_call(S, TOK___bound_local_new);
480− S->ind = saved_ind;
480+ S->tccgen_ind = saved_ind;
481481 label.c = 0; /* force new local ELF symbol */
482482 }
483483
484484 /* generate bound check local freeing */
485485 o(S, 0xe02a1101); /* addi sp,sp,-32 sd a0,0(sp) */
486486 o(S, 0xa82ae42e); /* sd a1,8(sp) fsd fa0,16(sp) */
487− put_extern_sym(S, &label, cur_text_section, S->ind, 0);
488− greloca(S, cur_text_section, sym_data, S->ind, R_RISCV_GOT_HI20, 0);
487+ put_extern_sym(S, &label, cur_text_section, S->tccgen_ind, 0);
488+ greloca(S, cur_text_section, sym_data, S->tccgen_ind, R_RISCV_GOT_HI20, 0);
489489 o(S, 0x17 | (10 << 7)); // auipc a0, 0 %pcrel_hi(sym)+addend
490− greloca(S, cur_text_section, &label, S->ind, R_RISCV_PCREL_LO12_I, 0);
490+ greloca(S, cur_text_section, &label, S->tccgen_ind, R_RISCV_PCREL_LO12_I, 0);
491491 EI(S, 0x03, 3, 10, 10, 0); // ld a0, 0(a0)
492492 gen_bounds_call(S, TOK___bound_local_delete);
493493 o(S, 0x65a26502); /* ld a0,0(sp) ld a1,8(sp) */
@@ -540,7 +540,7 @@ static void reg_pass(CType *type, int *prc, int *fieldofs, int named) · 46 unmodified lines
540540 }
541541 }
542542
543−ST_FUNC void gfunc_call(TCCState *S, int nb_args)
543+ST_FUNC void gfunc_call(TCCState* S, int nb_args)
544544 {
545545 int i, align, size, areg[2];
546546 int *info = tcc_malloc(S, (nb_args + 1) * sizeof (int));
@@ -556,11 +556,11 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 9 unmodified lines
556556
557557 areg[0] = 0; /* int arg regs */
558558 areg[1] = 8; /* float arg regs */
559− sa = S->vtop[-nb_args].type.ref->next;
559+ sa = S->tccgen_vtop[-nb_args].type.ref->next;
560560 for (i = 0; i < nb_args; i++) {
561561 int nregs, byref = 0, tempofs;
562562 int prc[3], fieldofs[3];
563− sv = &S->vtop[1 + i - nb_args];
563+ sv = &S->tccgen_vtop[1 + i - nb_args];
564564 sv->type.t &= ~VT_ARRAY; // XXX this should be done in tccgen.c
565565 size = type_size(&sv->type, &align);
566566 if (size > 16) {
@@ -617,7 +617,7 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 50 unmodified lines
617617 stack_add = stack_adj + tempspace;
618618
619619 /* fetch cpu flag before generating any code */
620− if ((S->vtop->r & VT_VALMASK) == VT_CMP)
620+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_CMP)
621621 gv(S, RC_INT);
622622
623623 if (stack_add) {
@@ -631,15 +631,15 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 7 unmodified lines
631631 for (i = ofs = 0; i < nb_args; i++) {
632632 if (info[i] & (64 | 32)) {
633633 vrotb(S, nb_args - i);
634− size = type_size(&S->vtop->type, &align);
634+ size = type_size(&S->tccgen_vtop->type, &align);
635635 if (info[i] & 64) {
636− vset(S, &S->char_pointer_type, TREG_SP, 0);
636+ vset(S, &S->tccgen_char_pointer_type, TREG_SP, 0);
637637 vpushi(S, stack_adj + (info[i] >> 7));
638638 gen_op(S, '+');
639− vpushv(S, S->vtop); // this replaces the old argument
639+ vpushv(S, S->tccgen_vtop); // this replaces the old argument
640640 vrott(S, 3);
641641 indir(S);
642− S->vtop->type = S->vtop[-1].type;
642+ S->tccgen_vtop->type = S->tccgen_vtop[-1].type;
643643 vswap(S);
644644 vstore(S);
645645 vpop(S);
@@ -649,18 +649,18 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 3 unmodified lines
649649 if (align < XLEN)
650650 align = XLEN;
651651 /* Once we support offseted regs we can do this:
652− vset(S, &S->vtop->type, TREG_SP | VT_LVAL, ofs);
652+ vset(S, &S->tccgen_vtop->type, TREG_SP | VT_LVAL, ofs);
653653 to construct the lvalue for the outgoing stack slot,
654654 until then we have to jump through hoops. */
655− vset(S, &S->char_pointer_type, TREG_SP, 0);
655+ vset(S, &S->tccgen_char_pointer_type, TREG_SP, 0);
656656 ofs = (ofs + align - 1) & -align;
657657 vpushi(S, ofs);
658658 gen_op(S, '+');
659659 indir(S);
660− S->vtop->type = S->vtop[-1].type;
660+ S->tccgen_vtop->type = S->tccgen_vtop[-1].type;
661661 vswap(S);
662662 vstore(S);
663− S->vtop->r = S->vtop->r2 = VT_CONST; // this arg is done
663+ S->tccgen_vtop->r = S->tccgen_vtop->r2 = VT_CONST; // this arg is done
664664 ofs += size;
665665 }
666666 vrott(S, nb_args - i);
@@ -680,11 +680,11 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 13 unmodified lines
680680 r2 = r2 & 64 ? 0 : (r2 >> 7) & 31;
681681 assert(r2 <= 16);
682682 vrotb(S, i+1);
683− origtype = S->vtop->type;
684− size = type_size(&S->vtop->type, &align);
683+ origtype = S->tccgen_vtop->type;
684+ size = type_size(&S->tccgen_vtop->type, &align);
685685 if (size == 0)
686686 goto done;
687− loadt = S->vtop->type.t & VT_BTYPE;
687+ loadt = S->tccgen_vtop->type.t & VT_BTYPE;
688688 if (loadt == VT_STRUCT) {
689689 loadt = (ii >> 12) & VT_BTYPE;
690690 }
@@ -697,18 +697,18 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 6 unmodified lines
697697 r2--;
698698 } else if (r2) {
699699 test_lvalue(S);
700− vpushv(S, S->vtop);
700+ vpushv(S, S->tccgen_vtop);
701701 }
702− S->vtop->type.t = loadt | (S->vtop->type.t & VT_UNSIGNED);
702+ S->tccgen_vtop->type.t = loadt | (S->tccgen_vtop->type.t & VT_UNSIGNED);
703703 gv(S, r < 8 ? RC_R(r) : RC_F(r - 8));
704− S->vtop->type = origtype;
704+ S->tccgen_vtop->type = origtype;
705705
706706 if (r2 && loadt != VT_LDOUBLE) {
707707 r2--;
708708 assert(r2 < 16 || r2 == TREG_RA);
709709 vswap(S);
710710 gaddrof(S);
711− S->vtop->type = S->char_pointer_type;
711+ S->tccgen_vtop->type = S->tccgen_char_pointer_type;
712712 vpushi(S, ii >> 20);
713713 #ifdef CONFIG_TCC_BCHECK
714714 if ((origtype.t & VT_BTYPE) == VT_STRUCT)
@@ -719,27 +719,27 @@ ST_FUNC void gfunc_call(TCCState *S, int nb_args) · 4 unmodified lines
719719 S->do_bounds_check = bc_save;
720720 #endif
721721 indir(S);
722− S->vtop->type = origtype;
723− loadt = S->vtop->type.t & VT_BTYPE;
722+ S->tccgen_vtop->type = origtype;
723+ loadt = S->tccgen_vtop->type.t & VT_BTYPE;
724724 if (loadt == VT_STRUCT) {
725725 loadt = (ii >> 16) & VT_BTYPE;
726726 }
727727 save_reg_upstack(S, r2, 1);
728− S->vtop->type.t = loadt | (S->vtop->type.t & VT_UNSIGNED);
729− load(S, r2, S->vtop);
728+ S->tccgen_vtop->type.t = loadt | (S->tccgen_vtop->type.t & VT_UNSIGNED);
729+ load(S, r2, S->tccgen_vtop);
730730 assert(r2 < VT_CONST);
731− S->vtop--;
732− S->vtop->r2 = r2;
731+ S->tccgen_vtop--;
732+ S->tccgen_vtop->r2 = r2;
733733 }
734734 if (info[nb_args - 1 - i] & 16) {
735− ES(S, 0x23, 3, 2, ireg(S->vtop->r2), splitofs); // sd t0, ofs(sp)
736− S->vtop->r2 = VT_CONST;
737− } else if (loadt == VT_LDOUBLE && S->vtop->r2 != r2) {
738− assert(S->vtop->r2 <= 7 && r2 <= 7);
735+ ES(S, 0x23, 3, 2, ireg(S->tccgen_vtop->r2), splitofs); // sd t0, ofs(sp)
736+ S->tccgen_vtop->r2 = VT_CONST;
737+ } else if (loadt == VT_LDOUBLE && S->tccgen_vtop->r2 != r2) {
738+ assert(S->tccgen_vtop->r2 <= 7 && r2 <= 7);
739739 /* XXX we'd like to have 'gv' move directly into
740740 the right class instead of us fixing it up. */
741− EI(S, 0x13, 0, ireg(r2), ireg(S->vtop->r2), 0); // mv Ra+1, RR2
742− S->vtop->r2 = r2;
741+ EI(S, 0x13, 0, ireg(r2), ireg(S->tccgen_vtop->r2), 0); // mv Ra+1, RR2
742+ S->tccgen_vtop->r2 = r2;
743743 }
744744 done:
745745 vrott(S, i+1);
@@ -748,7 +748,7 @@ done: · 2 unmodified lines
748748 vrotb(S, nb_args + 1);
749749 save_regs(S, nb_args + 1);
750750 gcall_or_jmp(S, 1);
751− S->vtop -= nb_args + 1;
751+ S->tccgen_vtop -= nb_args + 1;
752752 if (stack_add) {
753753 if (stack_add >= 0x1000) {
754754 o(S, 0x37 | (5 << 7) | (stack_add & 0xfffff000)); //lui t0, upper(v)
@@ -763,7 +763,7 @@ done: · 8 unmodified lines
763763
764764 static int func_sub_sp_offset, num_va_regs, func_va_list_ofs;
765765
766−ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym)
766+ST_FUNC void gfunc_prolog(TCCState* S, Sym *func_sym)
767767 {
768768 CType *func_type = &func_sym->type;
769769 int i, addr, align, size;
@@ -773,9 +773,9 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 3 unmodified lines
773773 CType *type;
774774
775775 sym = func_type->ref;
776− S->loc = -16; // for ra and s0
777− func_sub_sp_offset = S->ind;
778− S->ind += 5 * 4;
776+ S->tccgen_loc = -16; // for ra and s0
777+ func_sub_sp_offset = S->tccgen_ind;
778+ S->tccgen_ind += 5 * 4;
779779
780780 areg[0] = 0, areg[1] = 0;
781781 addr = 0;
@@ -783,9 +783,9 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 1 unmodified line
783783 implicit pointer parameter */
784784 size = type_size(&S->tccgen_func_vt, &align);
785785 if (size > 2 * XLEN) {
786− S->loc -= 8;
787− S->tccgen_func_vc = S->loc;
788− ES(S, 0x23, 3, 8, 10 + areg[0]++, S->loc); // sd a0, loc(s0)
786+ S->tccgen_loc -= 8;
787+ S->tccgen_func_vc = S->tccgen_loc;
788+ ES(S, 0x23, 3, 8, 10 + areg[0]++, S->tccgen_loc); // sd a0, loc(s0)
789789 }
790790 /* define parameters */
791791 while ((sym = sym->next) != NULL) {
@@ -795,7 +795,7 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 3 unmodified lines
795795 type = &sym->type;
796796 size = type_size(type, &align);
797797 if (size > 2 * XLEN) {
798− type = &S->char_pointer_type;
798+ type = &S->tccgen_char_pointer_type;
799799 size = align = byref = 8;
800800 }
801801 reg_pass(type, prc, fieldofs, 1);
@@ -810,18 +810,18 @@ ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym) · 8 unmodified lines
810810 param_addr = addr;
811811 addr += size;
812812 } else {
813− S->loc -= regcount * 8; // XXX could reserve only 'size' bytes
814− param_addr = S->loc;
813+ S->tccgen_loc -= regcount * 8; // XXX could reserve only 'size' bytes
814+ param_addr = S->tccgen_loc;
815815 for (i = 0; i < regcount; i++) {
816816 if (areg[prc[1+i] - 1] >= 8) {
817817 assert(i == 1 && regcount == 2 && !(addr & 7));
818818 EI(S, 0x03, 3, 5, 8, addr); // ld t0, addr(s0)
819819 addr += 8;
820− ES(S, 0x23, 3, 8, 5, S->loc + i*8); // sd t0, loc(s0)
820+ ES(S, 0x23, 3, 8, 5, S->tccgen_loc + i*8); // sd t0, loc(s0)
821821 } else if (prc[1+i] == RC_FLOAT) {
822− ES(S, 0x27, (size / regcount) == 4 ? 2 : 3, 8, 10 + areg[1]++, S->loc + (fieldofs[i+1] >> 4)); // fs[wd] FAi, loc(s0)
822+ ES(S, 0x27, (size / regcount) == 4 ? 2 : 3, 8, 10 + areg[1]++, S->tccgen_loc + (fieldofs[i+1] >> 4)); // fs[wd] FAi, loc(s0)
823823 } else {
824− ES(S, 0x23, 3, 8, 10 + areg[0]++, S->loc + i*8); // sd aX, loc(s0) // XXX
824+ ES(S, 0x23, 3, 8, 10 + areg[0]++, S->tccgen_loc + i*8); // sd aX, loc(s0) // XXX
825825 }
826826 }
827827 }
@@ -864,22 +864,22 @@ ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, · 36 unmodified lines
864864 return nregs;
865865 }
866866
867−ST_FUNC void arch_transfer_ret_regs(TCCState *S, int aftercall)
867+ST_FUNC void arch_transfer_ret_regs(TCCState* S, int aftercall)
868868 {
869869 int prc[3], fieldofs[3];
870− reg_pass(&S->vtop->type, prc, fieldofs, 1);
870+ reg_pass(&S->tccgen_vtop->type, prc, fieldofs, 1);
871871 assert(prc[0] == 2 && prc[1] != prc[2] && !(fieldofs[1] >> 4));
872− assert(S->vtop->r == (VT_LOCAL | VT_LVAL));
873− vpushv(S, S->vtop);
874− S->vtop->type.t = fieldofs[1] & VT_BTYPE;
875− (aftercall ? store : load)(S, prc[1] == RC_INT ? REG_IRET : REG_FRET, S->vtop);
876− S->vtop->c.i += fieldofs[2] >> 4;
877− S->vtop->type.t = fieldofs[2] & VT_BTYPE;
878− (aftercall ? store : load)(S, prc[2] == RC_INT ? REG_IRET : REG_FRET, S->vtop);
879− S->vtop--;
872+ assert(S->tccgen_vtop->r == (VT_LOCAL | VT_LVAL));
873+ vpushv(S, S->tccgen_vtop);
874+ S->tccgen_vtop->type.t = fieldofs[1] & VT_BTYPE;
875+ (aftercall ? store : load)(S, prc[1] == RC_INT ? REG_IRET : REG_FRET, S->tccgen_vtop);
876+ S->tccgen_vtop->c.i += fieldofs[2] >> 4;
877+ S->tccgen_vtop->type.t = fieldofs[2] & VT_BTYPE;
878+ (aftercall ? store : load)(S, prc[2] == RC_INT ? REG_IRET : REG_FRET, S->tccgen_vtop);
879+ S->tccgen_vtop--;
880880 }
881881
882−ST_FUNC void gfunc_epilog(TCCState *S)
882+ST_FUNC void gfunc_epilog(TCCState* S)
883883 {
884884 int v, saved_ind, d, large_ofs_ind;
885885
@@ -888,8 +888,8 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 2 unmodified lines
888888 gen_bounds_epilog(S);
889889 #endif
890890
891− S->loc = (S->loc - num_va_regs * 8);
892− d = v = (-S->loc + 15) & -16;
891+ S->tccgen_loc = (S->tccgen_loc - num_va_regs * 8);
892+ d = v = (-S->tccgen_loc + 15) & -16;
893893
894894 if (v >= (1 << 11)) {
895895 d = 16;
@@ -901,7 +901,7 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 5 unmodified lines
901901 EI(S, 0x03, 3, 8, 2, d - 16 - num_va_regs * 8); // ld s0, v-16(sp)
902902 EI(S, 0x13, 0, 2, 2, d); // addi sp, sp, v
903903 EI(S, 0x67, 0, 0, 1, 0); // jalr x0, 0(x1), aka ret
904− large_ofs_ind = S->ind;
904+ large_ofs_ind = S->tccgen_ind;
905905 if (v >= (1 << 11)) {
906906 EI(S, 0x13, 0, 8, 2, d - num_va_regs * 8); // addi s0, sp, d
907907 o(S, 0x37 | (5 << 7) | ((0x800 + (v-16)) & 0xfffff000)); //lui t0, upper(v)
@@ -909,9 +909,9 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 1 unmodified line
909909 ER(S, 0x33, 0, 2, 2, 5, 0x20); // sub sp, sp, t0
910910 gjmp_addr(S, func_sub_sp_offset + 5*4);
911911 }
912− saved_ind = S->ind;
912+ saved_ind = S->tccgen_ind;
913913
914− S->ind = func_sub_sp_offset;
914+ S->tccgen_ind = func_sub_sp_offset;
915915 EI(S, 0x13, 0, 2, 2, -d); // addi sp, sp, -d
916916 ES(S, 0x23, 3, 2, 1, d - 8 - num_va_regs * 8); // sd ra, d-8(sp)
917917 ES(S, 0x23, 3, 2, 8, d - 16 - num_va_regs * 8); // sd s0, d-16(sp)
@@ -919,18 +919,18 @@ ST_FUNC void gfunc_epilog(TCCState *S) · 1 unmodified line
919919 EI(S, 0x13, 0, 8, 2, d - num_va_regs * 8); // addi s0, sp, d
920920 else
921921 gjmp_addr(S, large_ofs_ind);
922− if ((S->ind - func_sub_sp_offset) != 5*4)
922+ if ((S->tccgen_ind - func_sub_sp_offset) != 5*4)
923923 EI(S, 0x13, 0, 0, 0, 0); // addi x0, x0, 0 == nop
924− S->ind = saved_ind;
924+ S->tccgen_ind = saved_ind;
925925 }
926926
927927 ST_FUNC void gen_va_start(TCCState *S)
928928 {
929− S->vtop--;
930− vset(S, &S->char_pointer_type, VT_LOCAL, func_va_list_ofs);
929+ S->tccgen_vtop--;
930+ vset(S, &S->tccgen_char_pointer_type, VT_LOCAL, func_va_list_ofs);
931931 }
932932
933−ST_FUNC void gen_fill_nops(TCCState *S, int bytes)
933+ST_FUNC void gen_fill_nops(TCCState* S, int bytes)
934934 {
935935 if ((bytes & 3))
936936 tcc_error(S, "alignment of code section not multiple of 4");
@@ -941,18 +941,18 @@ ST_FUNC void gen_fill_nops(TCCState *S, int bytes) · 4 unmodified lines
941941 }
942942
943943 // Generate forward branch to label:
944−ST_FUNC int gjmp(TCCState *S, int t)
944+ST_FUNC int gjmp(TCCState* S, int t)
945945 {
946− if (S->nocode_wanted)
946+ if (S->tccgen_nocode_wanted)
947947 return t;
948948 o(S, t);
949− return S->ind - 4;
949+ return S->tccgen_ind - 4;
950950 }
951951
952952 // Generate branch to known address:
953−ST_FUNC void gjmp_addr(TCCState *S, int a)
953+ST_FUNC void gjmp_addr(TCCState* S, int a)
954954 {
955− uint32_t r = a - S->ind, imm;
955+ uint32_t r = a - S->tccgen_ind, imm;
956956 if ((r + (1 << 21)) & ~((1U << 22) - 2)) {
957957 o(S, 0x17 | (5 << 7) | (((r + 0x800) & 0xfffff000))); // lui RR, up(r)
958958 r = (int)r << 20 >> 20;
@@ -966,11 +966,11 @@ ST_FUNC void gjmp_addr(TCCState *S, int a) · 7 unmodified lines
966966 }
967967 }
968968
969−ST_FUNC int gjmp_cond(TCCState *S, int op, int t)
969+ST_FUNC int gjmp_cond(TCCState* S, int op, int t)
970970 {
971971 int tmp;
972− int a = S->vtop->cmp_r & 0xff;
973− int b = (S->vtop->cmp_r >> 8) & 0xff;
972+ int a = S->tccgen_vtop->cmp_r & 0xff;
973+ int b = (S->tccgen_vtop->cmp_r >> 8) & 0xff;
974974 switch (op) {
975975 case TOK_ULT: op = 6; break;
976976 case TOK_UGE: op = 7; break;
@@ -987,7 +987,7 @@ ST_FUNC int gjmp_cond(TCCState *S, int op, int t) · 10 unmodified lines
987987 return gjmp(S, t);
988988 }
989989
990−ST_FUNC int gjmp_append(TCCState *S, int n, int t)
990+ST_FUNC int gjmp_append(TCCState* S, int n, int t)
991991 {
992992 void *p;
993993 /* insert jump list n into t */
@@ -1001,22 +1001,22 @@ ST_FUNC int gjmp_append(TCCState *S, int n, int t) · 7 unmodified lines
10011001 return t;
10021002 }
10031003
1004−static void gen_opil(TCCState *S, int op, int ll)
1004+static void gen_opil(TCCState* S, int op, int ll)
10051005 {
10061006 int a, b, d;
10071007 int func3 = 0;
10081008 ll = ll ? 0 : 8;
1009− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
1010− int fc = S->vtop->c.i;
1011− if (fc == S->vtop->c.i && !(((unsigned)fc + (1 << 11)) >> 12)) {
1009+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
1010+ int fc = S->tccgen_vtop->c.i;
1011+ if (fc == S->tccgen_vtop->c.i && !(((unsigned)fc + (1 << 11)) >> 12)) {
10121012 int cll = 0;
10131013 int m = ll ? 31 : 63;
10141014 vswap(S);
10151015 gv(S, RC_INT);
1016− a = ireg(S->vtop[0].r);
1017− --S->vtop;
1016+ a = ireg(S->tccgen_vtop[0].r);
1017+ --S->tccgen_vtop;
10181018 d = get_reg(S, RC_INT);
1019− ++S->vtop;
1019+ ++S->tccgen_vtop;
10201020 vswap(S);
10211021 switch (op) {
10221022 case '-':
@@ -1028,12 +1028,12 @@ static void gen_opil(TCCState *S, int op, int ll) · 5 unmodified lines
10281028 cll = ll;
10291029 do_cop:
10301030 EI(S, 0x13 | cll, func3, ireg(d), a, fc);
1031− --S->vtop;
1031+ --S->tccgen_vtop;
10321032 if (op >= TOK_ULT && op <= TOK_GT) {
10331033 vset_VT_CMP(S, TOK_NE);
1034− S->vtop->cmp_r = ireg(d) | 0 << 8;
1034+ S->tccgen_vtop->cmp_r = ireg(d) | 0 << 8;
10351035 } else
1036− S->vtop[0].r = d;
1036+ S->tccgen_vtop[0].r = d;
10371037 return;
10381038 case TOK_LE:
10391039 if (fc >= (1 << 11) - 1)
@@ -1057,33 +1057,33 @@ static void gen_opil(TCCState *S, int op, int ll) · 17 unmodified lines
10571057 case TOK_GE: /* -> TOK_LT */
10581058 case TOK_GT: /* -> TOK_LE */
10591059 gen_opil(S, op - 1, !ll);
1060− S->vtop->cmp_op ^= 1;
1060+ S->tccgen_vtop->cmp_op ^= 1;
10611061 return;
10621062
10631063 case TOK_NE:
10641064 case TOK_EQ:
10651065 if (fc)
1066− gen_opil(S, '-', !ll), a = ireg(S->vtop++->r);
1067− --S->vtop;
1066+ gen_opil(S, '-', !ll), a = ireg(S->tccgen_vtop++->r);
1067+ --S->tccgen_vtop;
10681068 vset_VT_CMP(S, op);
1069− S->vtop->cmp_r = a | 0 << 8;
1069+ S->tccgen_vtop->cmp_r = a | 0 << 8;
10701070 return;
10711071 }
10721072 }
10731073 }
10741074 gv2(S, RC_INT, RC_INT);
1075− a = ireg(S->vtop[-1].r);
1076− b = ireg(S->vtop[0].r);
1077− S->vtop -= 2;
1075+ a = ireg(S->tccgen_vtop[-1].r);
1076+ b = ireg(S->tccgen_vtop[0].r);
1077+ S->tccgen_vtop -= 2;
10781078 d = get_reg(S, RC_INT);
1079− S->vtop++;
1080− S->vtop[0].r = d;
1079+ S->tccgen_vtop++;
1080+ S->tccgen_vtop[0].r = d;
10811081 d = ireg(d);
10821082 switch (op) {
10831083 default:
10841084 if (op >= TOK_ULT && op <= TOK_GT) {
10851085 vset_VT_CMP(S, op);
1086− S->vtop->cmp_r = a | b << 8;
1086+ S->tccgen_vtop->cmp_r = a | b << 8;
10871087 break;
10881088 }
10891089 tcc_error(S, "implement me: %s(%s)", __FUNCTION__, get_tok_str(S, op, NULL));
@@ -1132,21 +1132,21 @@ static void gen_opil(TCCState *S, int op, int ll) · 42 unmodified lines
11321132 }
11331133 }
11341134
1135−ST_FUNC void gen_opi(TCCState *S, int op)
1135+ST_FUNC void gen_opi(TCCState* S, int op)
11361136 {
11371137 gen_opil(S, op, 0);
11381138 }
11391139
1140−ST_FUNC void gen_opl(TCCState *S, int op)
1140+ST_FUNC void gen_opl(TCCState* S, int op)
11411141 {
11421142 gen_opil(S, op, 1);
11431143 }
11441144
1145−ST_FUNC void gen_opf(TCCState *S, int op)
1145+ST_FUNC void gen_opf(TCCState* S, int op)
11461146 {
11471147 int rs1, rs2, rd, dbl, invert;
1148− if (S->vtop[0].type.t == VT_LDOUBLE) {
1149− CType type = S->vtop[0].type;
1148+ if (S->tccgen_vtop[0].type.t == VT_LDOUBLE) {
1149+ CType type = S->tccgen_vtop[0].type;
11501150 int func = 0;
11511151 int cond = -1;
11521152 switch (op) {
@@ -1166,10 +1166,10 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 13 unmodified lines
11661166 vrott(S, 3);
11671167 gfunc_call(S, 2);
11681168 vpushi(S, 0);
1169− S->vtop->r = REG_IRET;
1170− S->vtop->r2 = cond < 0 ? TREG_R(1) : VT_CONST;
1169+ S->tccgen_vtop->r = REG_IRET;
1170+ S->tccgen_vtop->r2 = cond < 0 ? TREG_R(1) : VT_CONST;
11711171 if (cond < 0)
1172− S->vtop->type = type;
1172+ S->tccgen_vtop->type = type;
11731173 else {
11741174 vpushi(S, 0);
11751175 gen_opil(S, op, 1);
@@ -1178,11 +1178,11 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 2 unmodified lines
11781178 }
11791179
11801180 gv2(S, RC_FLOAT, RC_FLOAT);
1181− assert(S->vtop->type.t == VT_DOUBLE || S->vtop->type.t == VT_FLOAT);
1182− dbl = S->vtop->type.t == VT_DOUBLE;
1183− rs1 = freg(S->vtop[-1].r);
1184− rs2 = freg(S->vtop->r);
1185− S->vtop--;
1181+ assert(S->tccgen_vtop->type.t == VT_DOUBLE || S->tccgen_vtop->type.t == VT_FLOAT);
1182+ dbl = S->tccgen_vtop->type.t == VT_DOUBLE;
1183+ rs1 = freg(S->tccgen_vtop[-1].r);
1184+ rs2 = freg(S->tccgen_vtop->r);
1185+ S->tccgen_vtop--;
11861186 invert = 0;
11871187 switch(op) {
11881188 default:
@@ -1191,7 +1191,7 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 2 unmodified lines
11911191 op = 0; // fadd
11921192 arithop:
11931193 rd = get_reg(S, RC_FLOAT);
1194− S->vtop->r = rd;
1194+ S->tccgen_vtop->r = rd;
11951195 rd = freg(rd);
11961196 ER(S, 0x53, 7, rd, rs1, rs2, dbl | (op << 2)); // fop.[sd] RD, RS1, RS2 (dyn rm)
11971197 break;
@@ -1208,7 +1208,7 @@ ST_FUNC void gen_opf(TCCState *S, int op) · 10 unmodified lines
12081208 op = 2; // EQ
12091209 cmpop:
12101210 rd = get_reg(S, RC_INT);
1211− S->vtop->r = rd;
1211+ S->tccgen_vtop->r = rd;
12121212 rd = ireg(rd);
12131213 ER(S, 0x53, op, rd, rs1, rs2, dbl | 0x50); // fcmp.[sd] RD, RS1, RS2 (op == eq/lt/le)
12141214 if (invert)
@@ -1241,11 +1241,11 @@ ST_FUNC void gen_cvt_sxtw(TCCState *S) · 26 unmodified lines
12411241 Let's try to not do anything here. */
12421242 }
12431243
1244−ST_FUNC void gen_cvt_itof(TCCState *S, int t)
1244+ST_FUNC void gen_cvt_itof(TCCState* S, int t)
12451245 {
12461246 int rr = ireg(gv(S, RC_INT)), dr;
1247− int u = S->vtop->type.t & VT_UNSIGNED;
1248− int l = (S->vtop->type.t & VT_BTYPE) == VT_LLONG;
1247+ int u = S->tccgen_vtop->type.t & VT_UNSIGNED;
1248+ int l = (S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG;
12491249 if (t == VT_LDOUBLE) {
12501250 int func = l ?
12511251 (u ? TOK___floatunditf : TOK___floatditf) :
@@ -1254,22 +1254,22 @@ ST_FUNC void gen_cvt_itof(TCCState *S, int t) · 2 unmodified lines
12541254 vrott(S, 2);
12551255 gfunc_call(S, 1);
12561256 vpushi(S, 0);
1257− S->vtop->type.t = t;
1258− S->vtop->r = REG_IRET;
1259− S->vtop->r2 = TREG_R(1);
1257+ S->tccgen_vtop->type.t = t;
1258+ S->tccgen_vtop->r = REG_IRET;
1259+ S->tccgen_vtop->r2 = TREG_R(1);
12601260 } else {
1261− S->vtop--;
1261+ S->tccgen_vtop--;
12621262 dr = get_reg(S, RC_FLOAT);
1263− S->vtop++;
1264− S->vtop->r = dr;
1263+ S->tccgen_vtop++;
1264+ S->tccgen_vtop->r = dr;
12651265 dr = freg(dr);
12661266 EIu(S, 0x53, 7, dr, rr, ((0x68 | (t == VT_DOUBLE ? 1 : 0)) << 5) | (u ? 1 : 0) | (l ? 2 : 0)); // fcvt.[sd].[wl][u]
12671267 }
12681268 }
12691269
1270−ST_FUNC void gen_cvt_ftoi(TCCState *S, int t)
1270+ST_FUNC void gen_cvt_ftoi(TCCState* S, int t)
12711271 {
1272− int ft = S->vtop->type.t & VT_BTYPE;
1272+ int ft = S->tccgen_vtop->type.t & VT_BTYPE;
12731273 int l = (t & VT_BTYPE) == VT_LLONG;
12741274 int u = t & VT_UNSIGNED;
12751275 if (ft == VT_LDOUBLE) {
@@ -1280,22 +1280,22 @@ ST_FUNC void gen_cvt_ftoi(TCCState *S, int t) · 4 unmodified lines
12801280 vrott(S, 2);
12811281 gfunc_call(S, 1);
12821282 vpushi(S, 0);
1283− S->vtop->type.t = t;
1284− S->vtop->r = REG_IRET;
1283+ S->tccgen_vtop->type.t = t;
1284+ S->tccgen_vtop->r = REG_IRET;
12851285 } else {
12861286 int rr = freg(gv(S, RC_FLOAT)), dr;
1287− S->vtop--;
1287+ S->tccgen_vtop--;
12881288 dr = get_reg(S, RC_INT);
1289− S->vtop++;
1290− S->vtop->r = dr;
1289+ S->tccgen_vtop++;
1290+ S->tccgen_vtop->r = dr;
12911291 dr = ireg(dr);
12921292 EIu(S, 0x53, 1, dr, rr, ((0x60 | (ft == VT_DOUBLE ? 1 : 0)) << 5) | (u ? 1 : 0) | (l ? 2 : 0)); // fcvt.[wl][u].[sd] rtz
12931293 }
12941294 }
12951295
1296−ST_FUNC void gen_cvt_ftof(TCCState *S, int dt)
1296+ST_FUNC void gen_cvt_ftof(TCCState* S, int dt)
12971297 {
1298− int st = S->vtop->type.t & VT_BTYPE, rs, rd;
1298+ int st = S->tccgen_vtop->type.t & VT_BTYPE, rs, rd;
12991299 dt &= VT_BTYPE;
13001300 if (st == dt)
13011301 return;
@@ -1312,21 +1312,21 @@ ST_FUNC void gen_cvt_ftof(TCCState *S, int dt) · 10 unmodified lines
13121312 gv(S, RC_F(0));
13131313 else {
13141314 gv(S, RC_R(0));
1315− assert(S->vtop->r2 < 7);
1316− if (S->vtop->r2 != 1 + S->vtop->r) {
1317− EI(S, 0x13, 0, ireg(S->vtop->r) + 1, ireg(S->vtop->r2), 0); // mv Ra+1, RR2
1318− S->vtop->r2 = 1 + S->vtop->r;
1315+ assert(S->tccgen_vtop->r2 < 7);
1316+ if (S->tccgen_vtop->r2 != 1 + S->tccgen_vtop->r) {
1317+ EI(S, 0x13, 0, ireg(S->tccgen_vtop->r) + 1, ireg(S->tccgen_vtop->r2), 0); // mv Ra+1, RR2
1318+ S->tccgen_vtop->r2 = 1 + S->tccgen_vtop->r;
13191319 }
13201320 }
13211321 vpush_helper_func(S, func);
13221322 gcall_or_jmp(S, 1);
1323− S->vtop -= 2;
1323+ S->tccgen_vtop -= 2;
13241324 vpushi(S, 0);
1325− S->vtop->type.t = dt;
1325+ S->tccgen_vtop->type.t = dt;
13261326 if (dt == VT_LDOUBLE)
1327− S->vtop->r = REG_IRET, S->vtop->r2 = REG_IRET+1;
1327+ S->tccgen_vtop->r = REG_IRET, S->tccgen_vtop->r2 = REG_IRET+1;
13281328 else
1329− S->vtop->r = REG_FRET;
1329+ S->tccgen_vtop->r = REG_FRET;
13301330 } else {
13311331 assert (dt == VT_FLOAT || dt == VT_DOUBLE);
13321332 assert (st == VT_FLOAT || st == VT_DOUBLE);
@@ -1336,59 +1336,59 @@ ST_FUNC void gen_cvt_ftof(TCCState *S, int dt) · 3 unmodified lines
13361336 EI(S, 0x53, 0, freg(rd), freg(rs), 0x21 << 5); // fcvt.d.s RD, RS (no rm)
13371337 else
13381338 EI(S, 0x53, 7, freg(rd), freg(rs), (0x20 << 5) | 1); // fcvt.s.d RD, RS (dyn rm)
1339− S->vtop->r = rd;
1339+ S->tccgen_vtop->r = rd;
13401340 }
13411341 }
13421342
13431343 /* increment tcov counter */
1344−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv)
1344+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv)
13451345 {
13461346 int r1, r2;
13471347 Sym label = {0};
13481348 label.type.t = VT_VOID | VT_STATIC;
13491349
13501350 vpushv(S, sv);
1351− S->vtop->r = r1 = get_reg(S, RC_INT);
1351+ S->tccgen_vtop->r = r1 = get_reg(S, RC_INT);
13521352 r2 = get_reg(S, RC_INT);
13531353 r1 = ireg(r1);
13541354 r2 = ireg(r2);
1355− greloca(S, cur_text_section, sv->sym, S->ind, R_RISCV_PCREL_HI20, 0);
1356− put_extern_sym(S, &label, cur_text_section, S->ind, 0);
1355+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind, R_RISCV_PCREL_HI20, 0);
1356+ put_extern_sym(S, &label, cur_text_section, S->tccgen_ind, 0);
13571357 o(S, 0x17 | (r1 << 7)); // auipc RR, 0 %pcrel_hi(sym)
1358− greloca(S, cur_text_section, &label, S->ind, R_RISCV_PCREL_LO12_I, 0);
1358+ greloca(S, cur_text_section, &label, S->tccgen_ind, R_RISCV_PCREL_LO12_I, 0);
13591359 EI(S, 0x03, 3, r2, r1, 0); // ld r2, x[r1]
13601360 EI(S, 0x13, 0, r2, r2, 1); // addi r2, r2, #1
1361− greloca(S, cur_text_section, sv->sym, S->ind, R_RISCV_PCREL_HI20, 0);
1361+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind, R_RISCV_PCREL_HI20, 0);
13621362 label.c = 0; /* force new local ELF symbol */
1363− put_extern_sym(S, &label, cur_text_section, S->ind, 0);
1363+ put_extern_sym(S, &label, cur_text_section, S->tccgen_ind, 0);
13641364 o(S, 0x17 | (r1 << 7)); // auipc RR, 0 %pcrel_hi(sym)
1365− greloca(S, cur_text_section, &label, S->ind, R_RISCV_PCREL_LO12_S, 0);
1365+ greloca(S, cur_text_section, &label, S->tccgen_ind, R_RISCV_PCREL_LO12_S, 0);
13661366 ES(S, 0x23, 3, r1, r2, 0); // sd r2, [r1]
13671367 vpop(S);
13681368 }
13691369
1370−ST_FUNC void ggoto(TCCState *S)
1370+ST_FUNC void ggoto(TCCState* S)
13711371 {
13721372 gcall_or_jmp(S, 0);
1373− S->vtop--;
1373+ S->tccgen_vtop--;
13741374 }
13751375
1376−ST_FUNC void gen_vla_sp_save(TCCState *S, int addr)
1376+ST_FUNC void gen_vla_sp_save(TCCState* S, int addr)
13771377 {
13781378 ES(S, 0x23, 3, 8, 2, addr); // sd sp, fc(s0)
13791379 }
13801380
1381−ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr)
1381+ST_FUNC void gen_vla_sp_restore(TCCState* S, int addr)
13821382 {
13831383 EI(S, 0x03, 3, 2, 8, addr); // ld sp, fc(s0)
13841384 }
13851385
1386−ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align)
1386+ST_FUNC void gen_vla_alloc(TCCState* S, CType *type, int align)
13871387 {
13881388 int rr;
13891389 #if defined(CONFIG_TCC_BCHECK)
13901390 if (S->do_bounds_check)
1391− vpushv(S, S->vtop);
1391+ vpushv(S, S->tccgen_vtop);
13921392 #endif
13931393 rr = ireg(gv(S, RC_INT));
13941394 #if defined(CONFIG_TCC_BCHECK)
@@ -1403,7 +1403,7 @@ ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) · 8 unmodified lines
14031403 #if defined(CONFIG_TCC_BCHECK)
14041404 if (S->do_bounds_check) {
14051405 vpushi(S, 0);
1406− S->vtop->r = TREG_R(0);
1406+ S->tccgen_vtop->r = TREG_R(0);
14071407 o(S, 0x00010513); /* mv a0,sp */
14081408 vswap(S);
14091409 vpush_helper_func(S, TOK___bound_new_region);
tcc.h+164−163
@@ -1074,21 +1074,21 @@ struct TCCState { · 1073 unmodified lines
10741074 /* ------------ tccpp.c ------------ */
10751075
10761076 struct BufferedFile *tccpp_file;
1077− int tccpp_ch, tok;
1078− CValue tokc;
1077+ int tccpp_ch, tccpp_tok;
1078+ CValue tccpp_tokc;
10791079 const int *tccpp_macro_ptr;
10801080 int tccpp_parse_flags;
1081− int tok_flags;
1082− CString tokcstr; /* current parsed string, if any */
1081+ int tccpp_tok_flags;
1082+ CString tccpp_tokcstr; /* current parsed string, if any */
10831083 CString tccpp_cstr_buf;
10841084 CString tccpp_macro_equal_buf;
1085− TokenString tokstr_buf;
1085+ TokenString tccpp_tokstr_buf;
10861086 TokenString *tccpp_macro_stack;
10871087
10881088 /* display benchmark infos */
10891089 int tccpp_total_lines;
10901090 int tccpp_total_bytes;
1091− int tok_ident;
1091+ int tccpp_tok_ident;
10921092 TokenSym **tccpp_table_ident;
10931093
10941094 int *tccpp_macro_ptr_allocated;
@@ -1096,7 +1096,7 @@ struct TCCState { · 1 unmodified line
10961096 int tccpp_unget_saved_buffer[TOK_MAX_SIZE + 1];
10971097 int tccpp_unget_buffer_enabled;
10981098 TokenSym *tccpp_hash_ident[TOK_HASH_SIZE];
1099− char token_buf[STRING_MAX_SIZE + 1];
1099+ char tccpp_token_buf[STRING_MAX_SIZE + 1];
11001100 /* true if isid(c) || isnum(c) */
11011101 unsigned char tccpp_isidnum_table[256-CH_EOF];
11021102
@@ -1105,8 +1105,8 @@ struct TCCState { · 2 unmodified lines
11051105 int tccpp_pp_expr;
11061106 int tccpp_pp_counter;
11071107
1108− TinyAlloc *toksym_alloc;
1109− TinyAlloc *tokstr_alloc;
1108+ TinyAlloc *tccpp_toksym_alloc;
1109+ TinyAlloc *tccpp_tokstr_alloc;
11101110
11111111 /*----------- tccasm.c --------*/
11121112 Section *tccasm_last_text_section; /* to handle .previous asm directive */
@@ -1114,18 +1114,18 @@ struct TCCState { · 1 unmodified line
11141114 /* ------------ tccgen.c ------------ */
11151115
11161116 Sym *tccgen_global_stack;
1117− Sym *local_stack;
1118− Sym *local_label_stack;
1117+ Sym *tccgen_local_stack;
1118+ Sym *tccgen_local_label_stack;
11191119 Sym *tccgen_global_label_stack;
11201120 Sym *tccgen_define_stack;
1121− CType tccgen_int_type, tccgen_func_old_type, tccgen_char_type, char_pointer_type;
1122− SValue *vtop;
1121+ CType tccgen_int_type, tccgen_func_old_type, tccgen_char_type, tccgen_char_pointer_type;
1122+ SValue *tccgen_vtop;
11231123 SValue tccgen__vstack[1 + VSTACK_SIZE];
1124− int tccgen_rsym, tccgen_anon_sym, ind, loc;
1124+ int tccgen_rsym, tccgen_anon_sym, tccgen_ind, tccgen_loc;
11251125 char tccgen_debug_modes;
11261126
11271127 int tccgen_const_wanted; /* true if constant wanted */
1128− int nocode_wanted; /* true if no code generation wanted for an expression */
1128+ int tccgen_nocode_wanted; /* true if no code generation wanted for an expression */
11291129 int tccgen_global_expr; /* true if compound literals must be allocated globally (used during initializers parsing */
11301130 CType tccgen_func_vt; /* current function return type (used by return instruction) */
11311131 int tccgen_func_var; /* true if current function is variadic */
@@ -1136,7 +1136,7 @@ struct TCCState { · 4 unmodified lines
11361136 void **tccgen_sym_pools;
11371137 int tccgen_nb_sym_pools;
11381138 Sym *tccgen_all_cleanups, *tccgen_pending_gotos;
1139− int local_scope;
1139+ int tccgen_local_scope;
11401140 int tccgen_in_sizeof;
11411141 int tccgen_in_generic;
11421142 int tccgen_section_sym;
@@ -1155,7 +1155,7 @@ struct TCCState { · 12 unmodified lines
11551155 int tccgen_debug_next_type;
11561156 debug_hash_t *tccgen_debug_hash;
11571157 int tccgen_n_debug_hash;
1158− debug_info_t *debug_info, *debug_info_root;
1158+ debug_info_t *tccgen_debug_info, *tccgen_debug_info_root;
11591159
11601160 unsigned char tccgen_prec[256];
11611161
@@ -1374,22 +1374,22 @@ PUB_FUNC void tcc_free_base(void *ptr); · 212 unmodified lines
13741374 PUB_FUNC void *tcc_malloc_base(unsigned long size);
13751375 PUB_FUNC void *tcc_mallocz_base(unsigned long size);
13761376 #ifndef MEM_DEBUG
1377−PUB_FUNC void tcc_free(TCCState *S, void *ptr);
1378−PUB_FUNC void *tcc_malloc(TCCState *S, unsigned long size);
1379−PUB_FUNC void *tcc_mallocz(TCCState *S, unsigned long size);
1380−PUB_FUNC void *tcc_realloc(TCCState *S, void *ptr, unsigned long size);
1381−PUB_FUNC char *tcc_strdup(TCCState *S, const char *str);
1377+PUB_FUNC void tcc_free(TCCState* S, void *ptr);
1378+PUB_FUNC void *tcc_malloc(TCCState* S, unsigned long size);
1379+PUB_FUNC void *tcc_mallocz(TCCState* S, unsigned long size);
1380+PUB_FUNC void *tcc_realloc(TCCState* S, void *ptr, unsigned long size);
1381+PUB_FUNC char *tcc_strdup(TCCState* S, const char *str);
13821382 #else
13831383 #define tcc_free(s, ptr) tcc_free_debug(s, ptr)
13841384 #define tcc_malloc(s, size) tcc_malloc_debug(s, size, __FILE__, __LINE__)
13851385 #define tcc_mallocz(s, size) tcc_mallocz_debug(s, size, __FILE__, __LINE__)
13861386 #define tcc_realloc(s, ptr, size) tcc_realloc_debug(s, ptr, size, __FILE__, __LINE__)
13871387 #define tcc_strdup(s, str) tcc_strdup_debug(s, str, __FILE__, __LINE__)
1388−PUB_FUNC void tcc_free_debug(TCCState *S, void *ptr);
1389−PUB_FUNC void *tcc_malloc_debug(TCCState *S, unsigned long size, const char *file, int line);
1390−PUB_FUNC void *tcc_mallocz_debug(TCCState *S, unsigned long size, const char *file, int line);
1391−PUB_FUNC void *tcc_realloc_debug(TCCState *S, void *ptr, unsigned long size, const char *file, int line);
1392−PUB_FUNC char *tcc_strdup_debug(TCCState *S, const char *str, const char *file, int line);
1388+PUB_FUNC void tcc_free_debug(TCCState* S, void *ptr);
1389+PUB_FUNC void *tcc_malloc_debug(TCCState* S, unsigned long size, const char *file, int line);
1390+PUB_FUNC void *tcc_mallocz_debug(TCCState* S, unsigned long size, const char *file, int line);
1391+PUB_FUNC void *tcc_realloc_debug(TCCState* S, void *ptr, unsigned long size, const char *file, int line);
1392+PUB_FUNC char *tcc_strdup_debug(TCCState* S, const char *str, const char *file, int line);
13931393 #endif
13941394
13951395 #define free(p) use_tcc_free(S, p)
@@ -1397,22 +1397,22 @@ PUB_FUNC char *tcc_strdup_debug(TCCState *S, const char *str, const char *file, · 1 unmodified line
13971397 #define realloc(p, s) use_tcc_realloc(S, p, s)
13981398 #undef strdup
13991399 #define strdup(s) use_tcc_strdup(S, s)
1400−PUB_FUNC void _tcc_error_noabort(TCCState *S, const char *fmt, ...) PRINTF_LIKE(2,3);
1401−PUB_FUNC NORETURN void _tcc_error(TCCState *S, const char *fmt, ...) PRINTF_LIKE(2,3);
1402−PUB_FUNC void _tcc_warning(TCCState *S, const char *fmt, ...) PRINTF_LIKE(2,3);
1400+PUB_FUNC void _tcc_error_noabort(TCCState* S, const char *fmt, ...) PRINTF_LIKE(2,3);
1401+PUB_FUNC NORETURN void _tcc_error(TCCState* S, const char *fmt, ...) PRINTF_LIKE(2,3);
1402+PUB_FUNC void _tcc_warning(TCCState* S, const char *fmt, ...) PRINTF_LIKE(2,3);
14031403 #define tcc_internal_error(S, msg) tcc_error(S, "internal compiler error\n"\
14041404 "%s:%d: in %s(): " msg, __FILE__,__LINE__,__FUNCTION__)
14051405
14061406 /* other utilities */
1407−ST_FUNC void dynarray_add(TCCState *S, void *ptab, int *nb_ptr, void *data);
1408−ST_FUNC void dynarray_reset(TCCState *S, void *pp, int *n);
1409−ST_INLN void cstr_ccat(TCCState *S, CString *cstr, int ch);
1410−ST_FUNC void cstr_cat(TCCState *S, CString *cstr, const char *str, int len);
1411−ST_FUNC void cstr_wccat(TCCState *S, CString *cstr, int ch);
1412−ST_FUNC void cstr_new(TCCState *S, CString *cstr);
1413−ST_FUNC void cstr_free(TCCState *S, CString *cstr);
1414−ST_FUNC int cstr_printf(TCCState *S, CString *cs, const char *fmt, ...) PRINTF_LIKE(3,4);
1415−ST_FUNC int cstr_vprintf(TCCState *S, CString *cstr, const char *fmt, va_list ap);
1407+ST_FUNC void dynarray_add(TCCState* S, void *ptab, int *nb_ptr, void *data);
1408+ST_FUNC void dynarray_reset(TCCState* S, void *pp, int *n);
1409+ST_INLN void cstr_ccat(TCCState* S, CString *cstr, int ch);
1410+ST_FUNC void cstr_cat(TCCState* S, CString *cstr, const char *str, int len);
1411+ST_FUNC void cstr_wccat(TCCState* S, CString *cstr, int ch);
1412+ST_FUNC void cstr_new(TCCState* S, CString *cstr);
1413+ST_FUNC void cstr_free(TCCState* S, CString *cstr);
1414+ST_FUNC int cstr_printf(TCCState* S, CString *cs, const char *fmt, ...) PRINTF_LIKE(3,4);
1415+ST_FUNC int cstr_vprintf(TCCState* S, CString *cstr, const char *fmt, va_list ap);
14161416 ST_FUNC void cstr_reset(CString *cstr);
14171417
14181418 ST_FUNC void tcc_open_bf(TCCState *S, const char *filename, int initlen);
@@ -1499,36 +1499,36 @@ enum line_macro_output_format { · 80 unmodified lines
14991499 LINE_MACRO_OUTPUT_FORMAT_P10 = 11
15001500 };
15011501
1502−ST_FUNC TokenSym *tok_alloc(TCCState *S, const char *str, int len);
1503−ST_FUNC int tok_alloc_const(TCCState *S, const char *str);
1504−ST_FUNC const char *get_tok_str(TCCState *S, int v, CValue *cv);
1505−ST_FUNC void begin_macro(TCCState *S, TokenString *str, int alloc);
1506−ST_FUNC void end_macro(TCCState *S);
1507−ST_FUNC int set_idnum(TCCState *S, int c, int val);
1502+ST_FUNC TokenSym *tok_alloc(TCCState* S, const char *str, int len);
1503+ST_FUNC int tok_alloc_const(TCCState* S, const char *str);
1504+ST_FUNC const char *get_tok_str(TCCState* S, int v, CValue *cv);
1505+ST_FUNC void begin_macro(TCCState* S, TokenString *str, int alloc);
1506+ST_FUNC void end_macro(TCCState* S);
1507+ST_FUNC int set_idnum(TCCState* S, int c, int val);
15081508 ST_INLN void tok_str_new(TokenString *s);
1509−ST_FUNC TokenString *tok_str_alloc(TCCState *S);
1510−ST_FUNC void tok_str_free(TCCState *S, TokenString *s);
1511−ST_FUNC void tok_str_free_str(TCCState *S, int *str);
1512−ST_FUNC void tok_str_add(TCCState *S, TokenString *s, int t);
1513−ST_FUNC void tok_str_add_tok(TCCState *S, TokenString *s);
1514−ST_INLN void define_push(TCCState *S, int v, int macro_type, int *str, Sym *first_arg);
1515−ST_FUNC void define_undef(TCCState *S, Sym *s);
1516−ST_INLN Sym *define_find(TCCState *S, int v);
1517−ST_FUNC void free_defines(TCCState *S, Sym *b);
1518−ST_FUNC Sym *label_find(TCCState *S, int v);
1519−ST_FUNC Sym *label_push(TCCState *S, Sym **ptop, int v, int flags);
1520−ST_FUNC void label_pop(TCCState *S, Sym **ptop, Sym *slast, int keep);
1521−ST_FUNC void parse_define(TCCState *S);
1522−ST_FUNC void preprocess(TCCState *S, int is_bof);
1523−ST_FUNC void next(TCCState *S);
1524−ST_INLN void unget_tok(TCCState *S, int last_tok);
1509+ST_FUNC TokenString *tok_str_alloc(TCCState* S);
1510+ST_FUNC void tok_str_free(TCCState* S, TokenString *s);
1511+ST_FUNC void tok_str_free_str(TCCState* S, int *str);
1512+ST_FUNC void tok_str_add(TCCState* S, TokenString *s, int t);
1513+ST_FUNC void tok_str_add_tok(TCCState* S, TokenString *s);
1514+ST_INLN void define_push(TCCState* S, int v, int macro_type, int *str, Sym *first_arg);
1515+ST_FUNC void define_undef(TCCState* S, Sym *s);
1516+ST_INLN Sym *define_find(TCCState* S, int v);
1517+ST_FUNC void free_defines(TCCState* S, Sym *b);
1518+ST_FUNC Sym *label_find(TCCState* S, int v);
1519+ST_FUNC Sym *label_push(TCCState* S, Sym **ptop, int v, int flags);
1520+ST_FUNC void label_pop(TCCState* S, Sym **ptop, Sym *slast, int keep);
1521+ST_FUNC void parse_define(TCCState* S);
1522+ST_FUNC void preprocess(TCCState* S, int is_bof);
1523+ST_FUNC void next(TCCState* S);
1524+ST_INLN void unget_tok(TCCState* S, int last_tok);
15251525 ST_FUNC void preprocess_start(TCCState *S, int filetype);
15261526 ST_FUNC void preprocess_end(TCCState *S);
15271527 ST_FUNC void tccpp_new(TCCState *S);
15281528 ST_FUNC void tccpp_delete(TCCState *S);
15291529 ST_FUNC int tcc_preprocess(TCCState *S);
1530−ST_FUNC void skip(TCCState *S, int c);
1531−ST_FUNC NORETURN void expect(TCCState *S, const char *msg);
1530+ST_FUNC void skip(TCCState* S, int c);
1531+ST_FUNC NORETURN void expect(TCCState* S, const char *msg);
15321532
15331533 /* space excluding newline */
15341534 static inline int is_space(int ch) {
@@ -1559,76 +1559,77 @@ ST_FUNC void tcc_debug_putfile(TCCState *S, const char *filename); · 24 unmodified lines
15591559 ST_FUNC void tccgen_init(TCCState *S);
15601560 ST_FUNC int tccgen_compile(TCCState *S);
15611561 ST_FUNC void tccgen_finish(TCCState *S);
1562−ST_FUNC void check_vstack(TCCState *S);
1562+ST_FUNC void check_vstack(TCCState* S);
15631563
15641564 ST_INLN int is_float(int t);
15651565 ST_FUNC int ieee_finite(double d);
15661566 ST_FUNC int exact_log2p1(int i);
1567−ST_FUNC void test_lvalue(TCCState *S);
1567+ST_FUNC void test_lvalue(TCCState* S);
15681568
1569−ST_FUNC ElfSym *elfsym(TCCState *S, Sym *);
1570−ST_FUNC void update_storage(TCCState *S, Sym *sym);
1571−ST_FUNC void put_extern_sym2(TCCState *S, Sym *sym, int sh_num, addr_t value, unsigned long size, int can_add_underscore);
1572−ST_FUNC void put_extern_sym(TCCState *S, Sym *sym, Section *section, addr_t value, unsigned long size);
1569+ST_FUNC ElfSym *elfsym(TCCState* S, Sym *);
1570+ST_FUNC void update_storage(TCCState* S, Sym *sym);
1571+ST_FUNC void put_extern_sym2(TCCState* S, Sym *sym, int sh_num, addr_t value, unsigned long size, int can_add_underscore);
1572+ST_FUNC void put_extern_sym(TCCState* S, Sym *sym, Section *section, addr_t value, unsigned long size);
15731573 #if PTR_SIZE == 4
1574−ST_FUNC void greloc(TCCState *S, Section *s, Sym *sym, unsigned long offset, int type);
1574+ST_FUNC void greloc(TCCState* S, Section *s, Sym *sym, unsigned long offset, int type);
15751575 #endif
1576−ST_FUNC void greloca(TCCState *S, Section *s, Sym *sym, unsigned long offset, int type, addr_t addend);
1576+ST_FUNC void greloca(TCCState* S, Section *s, Sym *sym, unsigned long offset, int type, addr_t addend);
15771577
1578−ST_INLN void sym_free(TCCState *S, Sym *sym);
1579−ST_FUNC Sym *sym_push(TCCState *S, int v, CType *type, int r, int c);
1580−ST_FUNC void sym_pop(TCCState *S, Sym **ptop, Sym *b, int keep);
1581−ST_FUNC Sym *sym_push2(TCCState *S, Sym **ps, int v, int t, int c);
1578+ST_INLN void sym_free(TCCState* S, Sym *sym);
1579+ST_FUNC Sym *sym_push(TCCState* S, int v, CType *type, int r, int c);
1580+ST_FUNC void sym_pop(TCCState* S, Sym **ptop, Sym *b, int keep);
1581+ST_FUNC Sym *sym_push2(TCCState* S, Sym **ps, int v, int t, int c);
15821582 ST_FUNC Sym *sym_find2(Sym *s, int v);
1583−ST_INLN Sym *sym_find(TCCState *S, int v);
1584−ST_INLN Sym *struct_find(TCCState *S, int v);
1585−
1586−ST_FUNC Sym *global_identifier_push(TCCState *S, int v, int t, int c);
1587−ST_FUNC Sym *external_global_sym(TCCState *S, int v, CType *type);
1588−ST_FUNC Sym *external_helper_sym(TCCState *S, int v);
1589−ST_FUNC void vpush_helper_func(TCCState *S, int v);
1590−ST_FUNC void vset(TCCState *S, CType *type, int r, int v);
1591−ST_FUNC void vset_VT_CMP(TCCState *S, int op);
1592−ST_FUNC void vpushi(TCCState *S, int v);
1593−ST_FUNC void vpushv(TCCState *S, SValue *v);
1594−ST_FUNC void vpushsym(TCCState *S, CType *type, Sym *sym);
1595−ST_FUNC void vswap(TCCState *S);
1596−ST_FUNC void vrote(TCCState *S, SValue *e, int n);
1597−ST_FUNC void vrott(TCCState *S, int n);
1598−ST_FUNC void vrotb(TCCState *S, int n);
1599−ST_FUNC void vpop(TCCState *S);
1583+ST_INLN Sym *sym_find(TCCState* S, int v);
1584+ST_INLN Sym *struct_find(TCCState* S, int v);
1585+
1586+ST_FUNC Sym *global_identifier_push(TCCState* S, int v, int t, int c);
1587+ST_FUNC Sym *external_global_sym(TCCState* S, int v, CType *type);
1588+ST_FUNC Sym *external_helper_sym(TCCState* S, int v);
1589+ST_FUNC void vpush_helper_func(TCCState* S, int v);
1590+ST_FUNC void vset(TCCState* S, CType *type, int r, int v);
1591+ST_FUNC void vset_VT_CMP(TCCState* S, int op);
1592+ST_FUNC void vpushi(TCCState* S, int v);
1593+ST_FUNC void vpushv(TCCState* S, SValue *v);
1594+ST_FUNC void vpushsym(TCCState* S, CType *type, Sym *sym);
1595+ST_FUNC void vswap(TCCState* S);
1596+ST_FUNC void vrote(TCCState* S, SValue *e, int n);
1597+ST_FUNC void vrott(TCCState* S, int n);
1598+ST_FUNC void vrotb(TCCState* S, int n);
1599+ST_FUNC void vpop(TCCState* S);
16001600 #if PTR_SIZE == 4
1601−ST_FUNC void lexpand(TCCState *S);
1601+ST_FUNC void lexpand(TCCState* S);
16021602 #endif
16031603 #ifdef TCC_TARGET_ARM
1604−ST_FUNC int get_reg_ex(TCCState *S, int rc, int rc2);
1605−#endif
1606−ST_FUNC void save_reg(TCCState *S, int r);
1607−ST_FUNC void save_reg_upstack(TCCState *S, int r, int n);
1608−ST_FUNC int get_reg(TCCState *S, int rc);
1609−ST_FUNC void save_regs(TCCState *S, int n);
1610−ST_FUNC void gaddrof(TCCState *S);
1611−ST_FUNC int gv(TCCState *S, int rc);
1612−ST_FUNC void gv2(TCCState *S, int rc1, int rc2);
1613−ST_FUNC void gen_op(TCCState *S, int op);
1604+ST_FUNC int get_reg_ex(TCCState* S, int rc, int rc2);
1605+#endif
1606+ST_FUNC void save_reg(TCCState* S, int r);
1607+ST_FUNC void save_reg_upstack(TCCState* S, int r, int n);
1608+ST_FUNC int get_reg(TCCState* S, int rc);
1609+ST_FUNC void save_regs(TCCState* S, int n);
1610+ST_FUNC void gaddrof(TCCState* S);
1611+ST_FUNC int gv(TCCState* S, int rc);
1612+ST_FUNC void gv2(TCCState* S, int rc1, int rc2);
1613+ST_FUNC void gen_op(TCCState* S, int op);
16141614 ST_FUNC int type_size(CType *type, int *a);
1615−ST_FUNC void mk_pointer(TCCState *S, CType *type);
1616−ST_FUNC void vstore(TCCState *S);
1617−ST_FUNC void inc(TCCState *S, int post, int c);
1618−ST_FUNC void parse_mult_str (TCCState *S, CString *astr, const char *msg);
1619−ST_FUNC void parse_asm_str(TCCState *S, CString *astr);
1620−ST_FUNC void indir(TCCState *S);
1621−ST_FUNC void unary(TCCState *S);
1622−ST_FUNC void gexpr(TCCState *S);
1623−ST_FUNC int expr_const(TCCState *S);
1615+ST_FUNC void mk_pointer(TCCState* S, CType *type);
1616+ST_FUNC void vstore(TCCState* S);
1617+ST_FUNC void inc(TCCState* S, int post, int c);
1618+ST_FUNC void parse_mult_str (TCCState* S, CString *astr, const char *msg);
1619+ST_FUNC void parse_asm_str(TCCState* S, CString *astr);
1620+ST_FUNC void indir(TCCState* S);
1621+ST_FUNC void unary(TCCState* S);
1622+ST_FUNC void gexpr(TCCState* S);
1623+ST_FUNC int expr_const(TCCState* S);
16241624 #if defined CONFIG_TCC_BCHECK || defined TCC_TARGET_C67
1625−ST_FUNC Sym *get_sym_ref(TCCState *S, CType *type, Section *sec, unsigned long offset, unsigned long size);
1625+ST_FUNC Sym *get_sym_ref(TCCState* S, CType *type, Section *sec, unsigned long offset, unsigned long size);
16261626 #endif
16271627 #if defined TCC_TARGET_X86_64 && !defined TCC_TARGET_PE
16281628 ST_FUNC int classify_x86_64_va_arg(CType *ty);
16291629 #endif
16301630 #ifdef CONFIG_TCC_BCHECK
1631−ST_FUNC void gbound_args(TCCState *S, int nb_args);
1631+ST_FUNC void gbound_args(TCCState* S, int nb_args);
1632+ST_DATA int func_bound_add_epilog;
16321633 #endif
16331634
16341635 /* ------------ tccelf.c ------------ */
@@ -1656,14 +1657,14 @@ ST_FUNC void tccelf_end_file(TCCState *S); · 21 unmodified lines
16561657 ST_FUNC void tccelf_bounds_new(TCCState *S);
16571658 #endif
16581659 ST_FUNC Section *new_section(TCCState *S, const char *name, int sh_type, int sh_flags);
1659−ST_FUNC void section_realloc(TCCState *S, Section *sec, unsigned long new_size);
1660−ST_FUNC size_t section_add(TCCState *S, Section *sec, addr_t size, int align);
1661−ST_FUNC void *section_ptr_add(TCCState *S, Section *sec, addr_t size);
1660+ST_FUNC void section_realloc(TCCState* S, Section *sec, unsigned long new_size);
1661+ST_FUNC size_t section_add(TCCState* S, Section *sec, addr_t size, int align);
1662+ST_FUNC void *section_ptr_add(TCCState* S, Section *sec, addr_t size);
16621663 ST_FUNC Section *find_section(TCCState *S, const char *name);
16631664 ST_FUNC Section *new_symtab(TCCState *S, const char *symtab_name, int sh_type, int sh_flags, const char *strtab_name, const char *hash_name, int hash_sh_flags);
16641665
1665−ST_FUNC int put_elf_str(TCCState *S, Section *s, const char *sym);
1666−ST_FUNC int put_elf_sym(TCCState *S, Section *s, addr_t value, unsigned long size, int info, int other, int shndx, const char *name);
1666+ST_FUNC int put_elf_str(TCCState* S, Section *s, const char *sym);
1667+ST_FUNC int put_elf_sym(TCCState* S, Section *s, addr_t value, unsigned long size, int info, int other, int shndx, const char *name);
16671668 ST_FUNC int set_elf_sym(Section *S, addr_t value, unsigned long size, int info, int other, int shndx, const char *name);
16681669 ST_FUNC int find_elf_sym(Section *S, const char *name);
16691670 ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset, int type, int symbol);
@@ -1678,7 +1679,7 @@ ST_FUNC void relocate_syms(TCCState *S, Section *symtab, int do_resolve); · 8 unmodified lines
16781679 ST_FUNC void relocate_sections(TCCState *S);
16791680
16801681 ST_FUNC ssize_t full_read(int fd, void *buf, size_t count);
1681−ST_FUNC void *load_data(TCCState *S, int fd, unsigned long file_offset, unsigned long size);
1682+ST_FUNC void *load_data(TCCState* S, int fd, unsigned long file_offset, unsigned long size);
16821683 ST_FUNC int tcc_object_type(int fd, ElfW(Ehdr) *h);
16831684 ST_FUNC int tcc_load_object_file(TCCState *S, int fd, unsigned long file_offset);
16841685 ST_FUNC int tcc_load_archive(TCCState *S, int fd, int alacarte);
@@ -1732,31 +1733,31 @@ ST_FUNC void relocate(TCCState *S, ElfW_Rel *rel, int type, unsigned char *ptr, · 47 unmodified lines
17321733 ST_DATA const char * const target_machine_defs;
17331734 ST_DATA const int reg_classes[NB_REGS];
17341735
1735−ST_FUNC void gsym_addr(TCCState *S, int t, int a);
1736−ST_FUNC void gsym(TCCState *S, int t);
1736+ST_FUNC void gsym_addr(TCCState* S, int t, int a);
1737+ST_FUNC void gsym(TCCState* S, int t);
17371738 ST_FUNC void load(TCCState *S, int r, SValue *sv);
17381739 ST_FUNC void store(TCCState *S, int r, SValue *v);
17391740 ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *align, int *regsize);
17401741 ST_FUNC void gfunc_call(TCCState *S, int nb_args);
17411742 ST_FUNC void gfunc_prolog(TCCState *S, Sym *func_sym);
17421743 ST_FUNC void gfunc_epilog(TCCState *S);
1743−ST_FUNC void gen_fill_nops(TCCState *S, int);
1744−ST_FUNC int gjmp(TCCState *S, int t);
1745−ST_FUNC void gjmp_addr(TCCState *S, int a);
1746−ST_FUNC int gjmp_cond(TCCState *S, int op, int t);
1744+ST_FUNC void gen_fill_nops(TCCState* S, int);
1745+ST_FUNC int gjmp(TCCState* S, int t);
1746+ST_FUNC void gjmp_addr(TCCState* S, int a);
1747+ST_FUNC int gjmp_cond(TCCState* S, int op, int t);
17471748 ST_FUNC int gjmp_append(TCCState *S, int n, int t);
1748−ST_FUNC void gen_opi(TCCState *S, int op);
1749−ST_FUNC void gen_opf(TCCState *S, int op);
1749+ST_FUNC void gen_opi(TCCState* S, int op);
1750+ST_FUNC void gen_opf(TCCState* S, int op);
17501751 ST_FUNC void gen_cvt_ftoi(TCCState *S, int t);
17511752 ST_FUNC void gen_cvt_itof(TCCState *S, int t);
17521753 ST_FUNC void gen_cvt_ftof(TCCState *S, int t);
17531754 ST_FUNC void ggoto(TCCState *S);
17541755 #ifndef TCC_TARGET_C67
1755−ST_FUNC void o(TCCState *S, unsigned int c);
1756+ST_FUNC void o(TCCState* S, unsigned int c);
17561757 #endif
1757−ST_FUNC void gen_vla_sp_save(TCCState *S, int addr);
1758−ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr);
1759−ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align);
1758+ST_FUNC void gen_vla_sp_save(TCCState* S, int addr);
1759+ST_FUNC void gen_vla_sp_restore(TCCState* S, int addr);
1760+ST_FUNC void gen_vla_alloc(TCCState* S, CType *type, int align);
17601761
17611762 static inline uint16_t read16le(unsigned char *p) {
17621763 return p[0] | (uint16_t)p[1] << 8;
@@ -1785,26 +1786,26 @@ static inline void add64le(unsigned char *p, int64_t x) { · 22 unmodified lines
17851786
17861787 /* ------------ i386-gen.c ------------ */
17871788 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 || defined TCC_TARGET_ARM
1788−ST_FUNC void g(TCCState *S, int c);
1789−ST_FUNC void gen_le16(TCCState *S, int c);
1790−ST_FUNC void gen_le32(TCCState *S, int c);
1789+ST_FUNC void g(TCCState* S, int c);
1790+ST_FUNC void gen_le16(TCCState* S, int c);
1791+ST_FUNC void gen_le32(TCCState* S, int c);
17911792 #endif
17921793 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
1793−ST_FUNC void gen_addr32(TCCState *S, int r, Sym *sym, int c);
1794−ST_FUNC void gen_addrpc32(TCCState *S, int r, Sym *sym, int c);
1795−ST_FUNC void gen_cvt_csti(TCCState *S, int t);
1796−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv);
1794+ST_FUNC void gen_addr32(TCCState* S, int r, Sym *sym, int c);
1795+ST_FUNC void gen_addrpc32(TCCState* S, int r, Sym *sym, int c);
1796+ST_FUNC void gen_cvt_csti(TCCState* S, int t);
1797+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv);
17971798 #endif
17981799
17991800 /* ------------ x86_64-gen.c ------------ */
18001801 #ifdef TCC_TARGET_X86_64
1801−ST_FUNC void gen_addr64(TCCState *S, int r, Sym *sym, int64_t c);
1802−ST_FUNC void gen_opl(TCCState *S, int op);
1802+ST_FUNC void gen_addr64(TCCState* S, int r, Sym *sym, int64_t c);
1803+ST_FUNC void gen_opl(TCCState* S, int op);
18031804 #ifdef TCC_TARGET_PE
1804−ST_FUNC void gen_vla_result(TCCState *S, int addr);
1805+ST_FUNC void gen_vla_result(TCCState* S, int addr);
18051806 #endif
18061807 ST_FUNC void gen_cvt_sxtw(TCCState *S);
1807−ST_FUNC void gen_cvt_csti(TCCState *S, int t);
1808+ST_FUNC void gen_cvt_csti(TCCState* S, int t);
18081809 #endif
18091810
18101811 /* ------------ arm-gen.c ------------ */
@@ -1813,29 +1814,29 @@ ST_FUNC void gen_cvt_csti(TCCState *S, int t); · 2 unmodified lines
18131814 PUB_FUNC const char *default_elfinterp(TCCState *S);
18141815 #endif
18151816 ST_FUNC void arm_init(TCCState *S);
1816−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv);
1817+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv);
18171818 #endif
18181819
18191820 /* ------------ arm64-gen.c ------------ */
18201821 #ifdef TCC_TARGET_ARM64
1821−ST_FUNC void gen_opl(TCCState *S, int op);
1822+ST_FUNC void gen_opl(TCCState* S, int op);
18221823 ST_FUNC void gfunc_return(TCCState *S, CType *func_type);
18231824 ST_FUNC void gen_va_start(TCCState *S);
18241825 ST_FUNC void gen_va_arg(TCCState *S, CType *t);
18251826 ST_FUNC void gen_clear_cache(TCCState *S);
18261827 ST_FUNC void gen_cvt_sxtw(TCCState *S);
18271828 ST_FUNC void gen_cvt_csti(TCCState *S, int t);
1828−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv);
1829+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv);
18291830 #endif
18301831
18311832 /* ------------ riscv64-gen.c ------------ */
18321833 #ifdef TCC_TARGET_RISCV64
1833−ST_FUNC void gen_opl(TCCState *S, int op);
1834+ST_FUNC void gen_opl(TCCState* S, int op);
18341835 //ST_FUNC void gfunc_return(TCCState *S, CType *func_type);
18351836 ST_FUNC void gen_va_start(TCCState *S);
1836−ST_FUNC void arch_transfer_ret_regs(TCCState *S, int);
1837+ST_FUNC void arch_transfer_ret_regs(TCCState* S, int);
18371838 ST_FUNC void gen_cvt_sxtw(TCCState *S);
1838−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv);
1839+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv);
18391840 #endif
18401841
18411842 /* ------------ c67-gen.c ------------ */
@@ -1850,25 +1851,25 @@ ST_FUNC int tcc_load_coff(TCCState *S, int fd); · 8 unmodified lines
18501851 #endif
18511852
18521853 /* ------------ tccasm.c ------------ */
1853−ST_FUNC void asm_instr(TCCState *S);
1854−ST_FUNC void asm_global_instr(TCCState *S);
1854+ST_FUNC void asm_instr(TCCState* S);
1855+ST_FUNC void asm_global_instr(TCCState* S);
18551856 ST_FUNC int tcc_assemble(TCCState *S, int do_preprocess);
18561857 #ifdef CONFIG_TCC_ASM
1857−ST_FUNC int find_constraint(TCCState *S, ASMOperand *operands, int nb_operands, const char *name, const char **pp);
1858−ST_FUNC Sym* get_asm_sym(TCCState *S, int name, Sym *csym);
1858+ST_FUNC int find_constraint(TCCState* S, ASMOperand *operands, int nb_operands, const char *name, const char **pp);
1859+ST_FUNC Sym* get_asm_sym(TCCState* S, int name, Sym *csym);
18591860 ST_FUNC void asm_expr(TCCState *S, ExprValue *pe);
18601861 ST_FUNC int asm_int_expr(TCCState *S);
18611862 /* ------------ i386-asm.c ------------ */
1862−ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe);
1863+ST_FUNC void gen_expr32(TCCState* S, ExprValue *pe);
18631864 #ifdef TCC_TARGET_X86_64
1864−ST_FUNC void gen_expr64(TCCState *S, ExprValue *pe);
1865+ST_FUNC void gen_expr64(TCCState* S, ExprValue *pe);
18651866 #endif
18661867 ST_FUNC void asm_opcode(TCCState *S, int opcode);
1867−ST_FUNC int asm_parse_regvar(TCCState *S, int t);
1868−ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);
1869−ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str, SValue *sv, int modifier);
1870−ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands, int nb_outputs, int is_output, uint8_t *clobber_regs, int out_reg);
1871−ST_FUNC void asm_clobber(TCCState *S, uint8_t *clobber_regs, const char *str);
1868+ST_FUNC int asm_parse_regvar(TCCState* S, int t);
1869+ST_FUNC void asm_compute_constraints(TCCState* S, ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);
1870+ST_FUNC void subst_asm_operand(TCCState* S, CString *add_str, SValue *sv, int modifier);
1871+ST_FUNC void asm_gen_code(TCCState* S, ASMOperand *operands, int nb_operands, int nb_outputs, int is_output, uint8_t *clobber_regs, int out_reg);
1872+ST_FUNC void asm_clobber(TCCState* S, uint8_t *clobber_regs, const char *str);
18721873 #endif
18731874
18741875 /* ------------ tccpe.c -------------- */
@@ -1880,9 +1881,9 @@ ST_FUNC int pe_putimport(TCCState *S, int dllindex, const char *name, addr_t val · 5 unmodified lines
18801881 ST_FUNC SValue *pe_getimport(TCCState * S, SValue *sv, SValue *v2);
18811882 #endif
18821883 #ifdef TCC_TARGET_X86_64
1883−ST_FUNC void pe_add_unwind_data(TCCState *S, unsigned start, unsigned end, unsigned stack);
1884+ST_FUNC void pe_add_unwind_data(TCCState* S, unsigned start, unsigned end, unsigned stack);
18841885 #endif
1885−PUB_FUNC int tcc_get_dllexports(TCCState *S, const char *filename, char **pp);
1886+PUB_FUNC int tcc_get_dllexports(TCCState* S, const char *filename, char **pp);
18861887 /* symbol properties stored in Elf32_Sym->st_other */
18871888 # define ST_PE_EXPORT 0x10
18881889 # define ST_PE_IMPORT 0x20
@@ -1896,7 +1897,7 @@ ST_FUNC int macho_output_file(TCCState * S, const char *filename); · 7 unmodified lines
18961897 ST_FUNC int macho_load_dll(TCCState *S, int fd, const char *filename, int lev);
18971898 ST_FUNC int macho_load_tbd(TCCState *S, int fd, const char *filename, int lev);
18981899 #ifdef TCC_IS_NATIVE
1899−ST_FUNC void tcc_add_macos_sdkpath(TCCState *S);
1900+ST_FUNC void tcc_add_macos_sdkpath(TCCState* S);
19001901 ST_FUNC const char* macho_tbd_soname(const char* filename);
19011902 #endif
19021903 #endif
tccasm.c+123−123
@@ -39,7 +39,7 @@ static Sym* asm_new_label1(TCCState *S, int label, int is_local, int sh_num, int · 38 unmodified lines
3939 the global C symbol table to track ASM names as well, so we need to
4040 transform those into ones that don't conflict with a C name,
4141 so prepend a '.' for them, but force the ELF asm name to be set. */
42−static int asm2cname(TCCState *S, int v, int *addeddot)
42+static int asm2cname(TCCState* S, int v, int *addeddot)
4343 {
4444 const char *name;
4545 *addeddot = 0;
@@ -59,7 +59,7 @@ static int asm2cname(TCCState *S, int v, int *addeddot) · 13 unmodified lines
5959 return v;
6060 }
6161
62−static Sym *asm_label_find(TCCState *S, int v)
62+static Sym *asm_label_find(TCCState* S, int v)
6363 {
6464 Sym *sym;
6565 int addeddot;
@@ -70,7 +70,7 @@ static Sym *asm_label_find(TCCState *S, int v) · 4 unmodified lines
7070 return sym;
7171 }
7272
73−static Sym *asm_label_push(TCCState *S, int v)
73+static Sym *asm_label_push(TCCState* S, int v)
7474 {
7575 int addeddot, v2 = asm2cname(S, v, &addeddot);
7676 /* We always add VT_EXTERN, for sym definition that's tentative
@@ -92,7 +92,7 @@ static Sym *asm_label_push(TCCState *S, int v) · 15 unmodified lines
9292 are anonymous in C, in this case CSYM can be used to transfer
9393 all information from that symbol to the (possibly newly created)
9494 asm symbol. */
95−ST_FUNC Sym* get_asm_sym(TCCState *S, int name, Sym *csym)
95+ST_FUNC Sym* get_asm_sym(TCCState* S, int name, Sym *csym)
9696 {
9797 Sym *sym = asm_label_find(S, name);
9898 if (!sym) {
@@ -122,9 +122,9 @@ static void asm_expr_unary(TCCState *S, ExprValue *pe) · 23 unmodified lines
122122 uint64_t n;
123123 const char *p;
124124
125− switch(S->tok) {
125+ switch(S->tccpp_tok) {
126126 case TOK_PPNUM:
127− p = S->tokc.str.data;
127+ p = S->tccpp_tokc.str.data;
128128 n = strtoull(p, (char **)&p, 0);
129129 if (*p == 'b' || *p == 'f') {
130130 /* backward or forward label */
@@ -161,7 +161,7 @@ static void asm_expr_unary(TCCState *S, ExprValue *pe) · 30 unmodified lines
161161 break;
162162 case '-':
163163 case '~':
164− op = S->tok;
164+ op = S->tccpp_tok;
165165 next(S);
166166 asm_expr_unary(S, pe);
167167 if (pe->sym)
@@ -173,7 +173,7 @@ static void asm_expr_unary(TCCState *S, ExprValue *pe) · 5 unmodified lines
173173 break;
174174 case TOK_CCHAR:
175175 case TOK_LCHAR:
176− pe->v = S->tokc.i;
176+ pe->v = S->tccpp_tokc.i;
177177 pe->sym = NULL;
178178 pe->pcrel = 0;
179179 next(S);
@@ -184,16 +184,16 @@ static void asm_expr_unary(TCCState *S, ExprValue *pe) · 4 unmodified lines
184184 skip(S, ')');
185185 break;
186186 case '.':
187− pe->v = S->ind;
187+ pe->v = S->tccgen_ind;
188188 pe->sym = asm_section_sym(S, cur_text_section);
189189 pe->pcrel = 0;
190190 next(S);
191191 break;
192192 default:
193− if (S->tok >= TOK_IDENT) {
193+ if (S->tccpp_tok >= TOK_IDENT) {
194194 ElfSym *esym;
195195 /* label case : if the label was not found, add one */
196− sym = get_asm_sym(S, S->tok, NULL);
196+ sym = get_asm_sym(S, S->tccpp_tok, NULL);
197197 esym = elfsym(S, sym);
198198 if (esym && esym->st_shndx == SHN_ABS) {
199199 /* if absolute symbol, no need to put a symbol value */
@@ -207,7 +207,7 @@ static void asm_expr_unary(TCCState *S, ExprValue *pe) · 7 unmodified lines
207207 }
208208 next(S);
209209 } else {
210− tcc_error(S, "bad expression syntax [%s]", get_tok_str(S, S->tok, &S->tokc));
210+ tcc_error(S, "bad expression syntax [%s]", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
211211 }
212212 break;
213213 }
@@ -220,7 +220,7 @@ static void asm_expr_prod(TCCState *S, ExprValue *pe) · 6 unmodified lines
220220
221221 asm_expr_unary(S, pe);
222222 for(;;) {
223− op = S->tok;
223+ op = S->tccpp_tok;
224224 if (op != '*' && op != '/' && op != '%' &&
225225 op != TOK_SHL && op != TOK_SAR)
226226 break;
@@ -262,7 +262,7 @@ static void asm_expr_logic(TCCState *S, ExprValue *pe) · 35 unmodified lines
262262
263263 asm_expr_prod(S, pe);
264264 for(;;) {
265− op = S->tok;
265+ op = S->tccpp_tok;
266266 if (op != '&' && op != '|' && op != '^')
267267 break;
268268 next(S);
@@ -291,7 +291,7 @@ static inline void asm_expr_sum(TCCState *S, ExprValue *pe) · 22 unmodified lines
291291
292292 asm_expr_logic(S, pe);
293293 for(;;) {
294− op = S->tok;
294+ op = S->tccpp_tok;
295295 if (op != '+' && op != '-')
296296 break;
297297 next(S);
@@ -323,7 +323,7 @@ static inline void asm_expr_sum(TCCState *S, ExprValue *pe) · 25 unmodified lines
323323 } else if (esym2->st_shndx == cur_text_section->sh_num) {
324324 /* When subtracting a defined symbol in current section
325325 this actually makes the value PC-relative. */
326− pe->v -= esym2->st_value - S->ind - 4;
326+ pe->v -= esym2->st_value - S->tccgen_ind - 4;
327327 pe->pcrel = 1;
328328 e2.sym = NULL;
329329 } else {
@@ -342,7 +342,7 @@ static inline void asm_expr_cmp(TCCState *S, ExprValue *pe) · 12 unmodified lines
342342
343343 asm_expr_sum(S, pe);
344344 for(;;) {
345− op = S->tok;
345+ op = S->tccpp_tok;
346346 if (op != TOK_EQ && op != TOK_NE
347347 && (op > TOK_GT || op < TOK_ULE))
348348 break;
@@ -428,7 +428,7 @@ static Sym* asm_new_label1(TCCState *S, int label, int is_local, · 79 unmodified lines
428428
429429 static Sym* asm_new_label(TCCState *S, int label, int is_local)
430430 {
431− return asm_new_label1(S, label, is_local, cur_text_section->sh_num, S->ind);
431+ return asm_new_label1(S, label, is_local, cur_text_section->sh_num, S->tccgen_ind);
432432 }
433433
434434 /* Set the value of LABEL to that of some expression (possibly
@@ -452,9 +452,9 @@ static Sym* set_symbol(TCCState *S, int label) · 17 unmodified lines
452452
453453 static void use_section1(TCCState *S, Section *sec)
454454 {
455− cur_text_section->data_offset = S->ind;
455+ cur_text_section->data_offset = S->tccgen_ind;
456456 cur_text_section = sec;
457− S->ind = cur_text_section->data_offset;
457+ S->tccgen_ind = cur_text_section->data_offset;
458458 }
459459
460460 static void use_section(TCCState *S, const char *name)
@@ -488,13 +488,13 @@ static void asm_parse_directive(TCCState *S, int global) · 27 unmodified lines
488488
489489 /* assembler directive */
490490 sec = cur_text_section;
491− switch(S->tok) {
491+ switch(S->tccpp_tok) {
492492 case TOK_ASMDIR_align:
493493 case TOK_ASMDIR_balign:
494494 case TOK_ASMDIR_p2align:
495495 case TOK_ASMDIR_skip:
496496 case TOK_ASMDIR_space:
497− tok1 = S->tok;
497+ tok1 = S->tccpp_tok;
498498 next(S);
499499 n = asm_int_expr(S);
500500 if (tok1 == TOK_ASMDIR_p2align)
@@ -507,8 +507,8 @@ static void asm_parse_directive(TCCState *S, int global) · 6 unmodified lines
507507 if (tok1 == TOK_ASMDIR_align || tok1 == TOK_ASMDIR_balign) {
508508 if (n < 0 || (n & (n-1)) != 0)
509509 tcc_error(S, "alignment must be a positive power of two");
510− offset = (S->ind + n - 1) & -n;
511− size = offset - S->ind;
510+ offset = (S->tccgen_ind + n - 1) & -n;
511+ size = offset - S->tccgen_ind;
512512 /* the section must have a compatible alignment */
513513 if (sec->sh_addralign < n)
514514 sec->sh_addralign = n;
@@ -518,17 +518,17 @@ static void asm_parse_directive(TCCState *S, int global) · 3 unmodified lines
518518 size = n;
519519 }
520520 v = 0;
521− if (S->tok == ',') {
521+ if (S->tccpp_tok == ',') {
522522 next(S);
523523 v = asm_int_expr(S);
524524 }
525525 zero_pad:
526526 if (sec->sh_type != SHT_NOBITS) {
527− sec->data_offset = S->ind;
527+ sec->data_offset = S->tccgen_ind;
528528 ptr = section_ptr_add(S, sec, size);
529529 memset(ptr, v, size);
530530 }
531− S->ind += size;
531+ S->tccgen_ind += size;
532532 break;
533533 case TOK_ASMDIR_quad:
534534 #ifdef TCC_TARGET_X86_64
@@ -540,8 +540,8 @@ static void asm_parse_directive(TCCState *S, int global) · 5 unmodified lines
540540 uint64_t vl;
541541 const char *p;
542542
543− p = S->tokc.str.data;
544− if (S->tok != TOK_PPNUM) {
543+ p = S->tccpp_tokc.str.data;
544+ if (S->tccpp_tok != TOK_PPNUM) {
545545 error_constant:
546546 tcc_error(S, "64 bit constant");
547547 }
@@ -554,9 +554,9 @@ static void asm_parse_directive(TCCState *S, int global) · 6 unmodified lines
554554 gen_le32(S, vl);
555555 gen_le32(S, vl >> 32);
556556 } else {
557− S->ind += 8;
557+ S->tccgen_ind += 8;
558558 }
559− if (S->tok != ',')
559+ if (S->tccpp_tok != ',')
560560 break;
561561 next(S);
562562 }
@@ -593,9 +593,9 @@ static void asm_parse_directive(TCCState *S, int global) · 30 unmodified lines
593593 gen_le16(S, e.v);
594594 }
595595 } else {
596− S->ind += size;
596+ S->tccgen_ind += size;
597597 }
598− if (S->tok != ',')
598+ if (S->tccpp_tok != ',')
599599 break;
600600 next(S);
601601 }
@@ -612,7 +612,7 @@ static void asm_parse_directive(TCCState *S, int global) · 10 unmodified lines
612612 }
613613 size = 1;
614614 val = 0;
615− if (S->tok == ',') {
615+ if (S->tccpp_tok == ',') {
616616 next(S);
617617 size = asm_int_expr(S);
618618 if (size < 0) {
@@ -621,7 +621,7 @@ static void asm_parse_directive(TCCState *S, int global) · 2 unmodified lines
621621 }
622622 if (size > 8)
623623 size = 8;
624− if (S->tok == ',') {
624+ if (S->tccpp_tok == ',') {
625625 next(S);
626626 val = asm_int_expr(S);
627627 }
@@ -649,8 +649,8 @@ static void asm_parse_directive(TCCState *S, int global) · 21 unmodified lines
649649 next(S);
650650 repeat = asm_int_expr(S);
651651 init_str = tok_str_alloc(S);
652− while (next(S), S->tok != TOK_ASMDIR_endr) {
653− if (S->tok == CH_EOF)
652+ while (next(S), S->tccpp_tok != TOK_ASMDIR_endr) {
653+ if (S->tccpp_tok == CH_EOF)
654654 tcc_error(S, "we at end of file, .endr not found");
655655 tok_str_add_tok(S, init_str);
656656 }
@@ -680,31 +680,31 @@ static void asm_parse_directive(TCCState *S, int global) · 23 unmodified lines
680680 expect(S, "constant or same-section symbol");
681681 n += esym->st_value;
682682 }
683− if (n < S->ind)
683+ if (n < S->tccgen_ind)
684684 tcc_error(S, "attempt to .org backwards");
685685 v = 0;
686− size = n - S->ind;
686+ size = n - S->tccgen_ind;
687687 goto zero_pad;
688688 }
689689 break;
690690 case TOK_ASMDIR_set:
691691 next(S);
692− tok1 = S->tok;
692+ tok1 = S->tccpp_tok;
693693 next(S);
694694 /* Also accept '.set stuff', but don't do anything with this.
695695 It's used in GAS to set various features like '.set mips16'. */
696− if (S->tok == ',')
696+ if (S->tccpp_tok == ',')
697697 set_symbol(S, tok1);
698698 break;
699699 case TOK_ASMDIR_globl:
700700 case TOK_ASMDIR_global:
701701 case TOK_ASMDIR_weak:
702702 case TOK_ASMDIR_hidden:
703− tok1 = S->tok;
703+ tok1 = S->tccpp_tok;
704704 do {
705705 Sym *sym;
706706 next(S);
707− sym = get_asm_sym(S, S->tok, NULL);
707+ sym = get_asm_sym(S, S->tccpp_tok, NULL);
708708 if (tok1 != TOK_ASMDIR_hidden)
709709 sym->type.t &= ~VT_STATIC;
710710 if (tok1 == TOK_ASMDIR_weak)
@@ -713,7 +713,7 @@ static void asm_parse_directive(TCCState *S, int global) · 2 unmodified lines
713713 sym->a.visibility = STV_HIDDEN;
714714 update_storage(S, sym);
715715 next(S);
716− } while (S->tok == ',');
716+ } while (S->tccpp_tok == ',');
717717 break;
718718 case TOK_ASMDIR_string:
719719 case TOK_ASMDIR_ascii:
@@ -722,21 +722,21 @@ static void asm_parse_directive(TCCState *S, int global) · 2 unmodified lines
722722 const uint8_t *p;
723723 int i, size, t;
724724
725− t = S->tok;
725+ t = S->tccpp_tok;
726726 next(S);
727727 for(;;) {
728− if (S->tok != TOK_STR)
728+ if (S->tccpp_tok != TOK_STR)
729729 expect(S, "string constant");
730− p = S->tokc.str.data;
731− size = S->tokc.str.size;
730+ p = S->tccpp_tokc.str.data;
731+ size = S->tccpp_tokc.str.size;
732732 if (t == TOK_ASMDIR_ascii && size > 0)
733733 size--;
734734 for(i = 0; i < size; i++)
735735 g(S, p[i]);
736736 next(S);
737− if (S->tok == ',') {
737+ if (S->tccpp_tok == ',') {
738738 next(S);
739− } else if (S->tok != TOK_STR) {
739+ } else if (S->tccpp_tok != TOK_STR) {
740740 break;
741741 }
742742 }
@@ -747,10 +747,10 @@ static void asm_parse_directive(TCCState *S, int global) · 4 unmodified lines
747747 case TOK_ASMDIR_bss:
748748 {
749749 char sname[64];
750− tok1 = S->tok;
750+ tok1 = S->tccpp_tok;
751751 n = 0;
752752 next(S);
753− if (S->tok != ';' && S->tok != TOK_LINEFEED) {
753+ if (S->tccpp_tok != ';' && S->tccpp_tok != TOK_LINEFEED) {
754754 n = asm_int_expr(S);
755755 next(S);
756756 }
@@ -767,10 +767,10 @@ static void asm_parse_directive(TCCState *S, int global) · 10 unmodified lines
767767
768768 filename[0] = '\0';
769769 next(S);
770− if (S->tok == TOK_STR)
771− pstrcat(filename, sizeof(filename), S->tokc.str.data);
770+ if (S->tccpp_tok == TOK_STR)
771+ pstrcat(filename, sizeof(filename), S->tccpp_tokc.str.data);
772772 else
773− pstrcat(filename, sizeof(filename), get_tok_str(S, S->tok, NULL));
773+ pstrcat(filename, sizeof(filename), get_tok_str(S, S->tccpp_tok, NULL));
774774 tcc_warning_c(warn_unsupported)(S, "ignoring .file %s", filename);
775775 next(S);
776776 }
@@ -781,10 +781,10 @@ static void asm_parse_directive(TCCState *S, int global) · 4 unmodified lines
781781
782782 ident[0] = '\0';
783783 next(S);
784− if (S->tok == TOK_STR)
785− pstrcat(ident, sizeof(ident), S->tokc.str.data);
784+ if (S->tccpp_tok == TOK_STR)
785+ pstrcat(ident, sizeof(ident), S->tccpp_tokc.str.data);
786786 else
787− pstrcat(ident, sizeof(ident), get_tok_str(S, S->tok, NULL));
787+ pstrcat(ident, sizeof(ident), get_tok_str(S, S->tccpp_tok, NULL));
788788 tcc_warning_c(warn_unsupported)(S, "ignoring .ident %s", ident);
789789 next(S);
790790 }
@@ -794,15 +794,15 @@ static void asm_parse_directive(TCCState *S, int global) · 3 unmodified lines
794794 Sym *sym;
795795
796796 next(S);
797− sym = asm_label_find(S, S->tok);
797+ sym = asm_label_find(S, S->tccpp_tok);
798798 if (!sym) {
799− tcc_error(S, "label not found: %s", get_tok_str(S, S->tok, NULL));
799+ tcc_error(S, "label not found: %s", get_tok_str(S, S->tccpp_tok, NULL));
800800 }
801801 /* XXX .size name,label2-label1 */
802− tcc_warning_c(warn_unsupported)(S, "ignoring .size %s,*", get_tok_str(S, S->tok, NULL));
802+ tcc_warning_c(warn_unsupported)(S, "ignoring .size %s,*", get_tok_str(S, S->tccpp_tok, NULL));
803803 next(S);
804804 skip(S, ',');
805− while (S->tok != TOK_LINEFEED && S->tok != ';' && S->tok != CH_EOF) {
805+ while (S->tccpp_tok != TOK_LINEFEED && S->tccpp_tok != ';' && S->tccpp_tok != CH_EOF) {
806806 next(S);
807807 }
808808 }
@@ -813,15 +813,15 @@ static void asm_parse_directive(TCCState *S, int global) · 4 unmodified lines
813813 const char *newtype;
814814
815815 next(S);
816− sym = get_asm_sym(S, S->tok, NULL);
816+ sym = get_asm_sym(S, S->tccpp_tok, NULL);
817817 next(S);
818818 skip(S, ',');
819− if (S->tok == TOK_STR) {
820− newtype = S->tokc.str.data;
819+ if (S->tccpp_tok == TOK_STR) {
820+ newtype = S->tccpp_tokc.str.data;
821821 } else {
822− if (S->tok == '@' || S->tok == '%')
822+ if (S->tccpp_tok == '@' || S->tccpp_tok == '%')
823823 next(S);
824− newtype = get_tok_str(S, S->tok, NULL);
824+ newtype = get_tok_str(S, S->tccpp_tok, NULL);
825825 }
826826
827827 if (!strcmp(newtype, "function") || !strcmp(newtype, "STT_FUNC")) {
@@ -839,26 +839,26 @@ static void asm_parse_directive(TCCState *S, int global) · 11 unmodified lines
839839 char sname[256];
840840 int old_nb_section = S->nb_sections;
841841
842− tok1 = S->tok;
842+ tok1 = S->tccpp_tok;
843843 /* XXX: support more options */
844844 next(S);
845845 sname[0] = '\0';
846− while (S->tok != ';' && S->tok != TOK_LINEFEED && S->tok != ',') {
847− if (S->tok == TOK_STR)
848− pstrcat(sname, sizeof(sname), S->tokc.str.data);
846+ while (S->tccpp_tok != ';' && S->tccpp_tok != TOK_LINEFEED && S->tccpp_tok != ',') {
847+ if (S->tccpp_tok == TOK_STR)
848+ pstrcat(sname, sizeof(sname), S->tccpp_tokc.str.data);
849849 else
850− pstrcat(sname, sizeof(sname), get_tok_str(S, S->tok, NULL));
850+ pstrcat(sname, sizeof(sname), get_tok_str(S, S->tccpp_tok, NULL));
851851 next(S);
852852 }
853− if (S->tok == ',') {
853+ if (S->tccpp_tok == ',') {
854854 /* skip section options */
855855 next(S);
856− if (S->tok != TOK_STR)
856+ if (S->tccpp_tok != TOK_STR)
857857 expect(S, "string constant");
858858 next(S);
859− if (S->tok == ',') {
859+ if (S->tccpp_tok == ',') {
860860 next(S);
861− if (S->tok == '@' || S->tok == '%')
861+ if (S->tccpp_tok == '@' || S->tccpp_tok == '%')
862862 next(S);
863863 next(S);
864864 }
@@ -911,7 +911,7 @@ static void asm_parse_directive(TCCState *S, int global) · 46 unmodified lines
911911 break;
912912 #endif
913913 default:
914− tcc_error(S, "unknown assembler directive '.%s'", get_tok_str(S, S->tok, NULL));
914+ tcc_error(S, "unknown assembler directive '.%s'", get_tok_str(S, S->tccpp_tok, NULL));
915915 break;
916916 }
917917 }
@@ -928,20 +928,20 @@ static int tcc_assemble_internal(TCCState *S, int do_preprocess, int global) · 10 unmodified lines
928928 S->tccpp_parse_flags |= PARSE_FLAG_PREPROCESS;
929929 for(;;) {
930930 next(S);
931− if (S->tok == TOK_EOF)
931+ if (S->tccpp_tok == TOK_EOF)
932932 break;
933933 S->tccpp_parse_flags |= PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */
934934 redo:
935− if (S->tok == '#') {
935+ if (S->tccpp_tok == '#') {
936936 /* horrible gas comment */
937− while (S->tok != TOK_LINEFEED)
937+ while (S->tccpp_tok != TOK_LINEFEED)
938938 next(S);
939− } else if (S->tok >= TOK_ASMDIR_FIRST && S->tok <= TOK_ASMDIR_LAST) {
939+ } else if (S->tccpp_tok >= TOK_ASMDIR_FIRST && S->tccpp_tok <= TOK_ASMDIR_LAST) {
940940 asm_parse_directive(S, global);
941− } else if (S->tok == TOK_PPNUM) {
941+ } else if (S->tccpp_tok == TOK_PPNUM) {
942942 const char *p;
943943 int n;
944− p = S->tokc.str.data;
944+ p = S->tccpp_tokc.str.data;
945945 n = strtoul(p, (char **)&p, 10);
946946 if (*p != '\0')
947947 expect(S, "':'");
@@ -950,16 +950,16 @@ static int tcc_assemble_internal(TCCState *S, int do_preprocess, int global) · 2 unmodified lines
950950 next(S);
951951 skip(S, ':');
952952 goto redo;
953− } else if (S->tok >= TOK_IDENT) {
953+ } else if (S->tccpp_tok >= TOK_IDENT) {
954954 /* instruction or label */
955− opcode = S->tok;
955+ opcode = S->tccpp_tok;
956956 next(S);
957− if (S->tok == ':') {
957+ if (S->tccpp_tok == ':') {
958958 /* new label */
959959 asm_new_label(S, opcode, 0);
960960 next(S);
961961 goto redo;
962− } else if (S->tok == '=') {
962+ } else if (S->tccpp_tok == '=') {
963963 set_symbol(S, opcode);
964964 goto redo;
965965 } else {
@@ -967,7 +967,7 @@ static int tcc_assemble_internal(TCCState *S, int do_preprocess, int global) · 1 unmodified line
967967 }
968968 }
969969 /* end of line */
970− if (S->tok != ';' && S->tok != TOK_LINEFEED)
970+ if (S->tccpp_tok != ';' && S->tccpp_tok != TOK_LINEFEED)
971971 expect(S, "end of line");
972972 S->tccpp_parse_flags &= ~PARSE_FLAG_LINEFEED; /* XXX: suppress that hack */
973973 }
@@ -983,10 +983,10 @@ ST_FUNC int tcc_assemble(TCCState *S, int do_preprocess) · 9 unmodified lines
983983 tcc_debug_start(S);
984984 /* default section is text */
985985 cur_text_section = text_section;
986− S->ind = cur_text_section->data_offset;
987− S->nocode_wanted = 0;
986+ S->tccgen_ind = cur_text_section->data_offset;
987+ S->tccgen_nocode_wanted = 0;
988988 ret = tcc_assemble_internal(S, do_preprocess, 1);
989− cur_text_section->data_offset = S->ind;
989+ cur_text_section->data_offset = S->tccgen_ind;
990990 tcc_debug_end(S);
991991 return ret;
992992 }
@@ -1017,7 +1017,7 @@ static void tcc_assemble_inline(TCCState *S, char *str, int len, int global) · 24 unmodified lines
10171017 /* find a constraint by its number or id (gcc 3 extended
10181018 syntax). return -1 if not found. Return in *pp in char after the
10191019 constraint */
1020−ST_FUNC int find_constraint(TCCState *S, ASMOperand *operands, int nb_operands,
1020+ST_FUNC int find_constraint(TCCState* S, ASMOperand *operands, int nb_operands,
10211021 const char *name, const char **pp)
10221022 {
10231023 int index;
@@ -1055,7 +1055,7 @@ ST_FUNC int find_constraint(TCCState *S, ASMOperand *operands, int nb_operands, · 31 unmodified lines
10551055 return index;
10561056 }
10571057
1058−static void subst_asm_operands(TCCState *S, ASMOperand *operands, int nb_operands,
1058+static void subst_asm_operands(TCCState* S, ASMOperand *operands, int nb_operands,
10591059 CString *out_str, CString *in_str)
10601060 {
10611061 int c, index, modifier;
@@ -1101,13 +1101,13 @@ static void subst_asm_operands(TCCState *S, ASMOperand *operands, int nb_operand · 39 unmodified lines
11011101 }
11021102
11031103
1104−static void parse_asm_operands(TCCState *S, ASMOperand *operands, int *nb_operands_ptr,
1104+static void parse_asm_operands(TCCState* S, ASMOperand *operands, int *nb_operands_ptr,
11051105 int is_output)
11061106 {
11071107 ASMOperand *op;
11081108 int nb_operands;
11091109
1110− if (S->tok != ':') {
1110+ if (S->tccpp_tok != ':') {
11111111 nb_operands = *nb_operands_ptr;
11121112 for(;;) {
11131113 CString astr;
@@ -1115,11 +1115,11 @@ static void parse_asm_operands(TCCState *S, ASMOperand *operands, int *nb_operan · 1 unmodified line
11151115 tcc_error(S, "too many asm operands");
11161116 op = &operands[nb_operands++];
11171117 op->id = 0;
1118− if (S->tok == '[') {
1118+ if (S->tccpp_tok == '[') {
11191119 next(S);
1120− if (S->tok < TOK_IDENT)
1120+ if (S->tccpp_tok < TOK_IDENT)
11211121 expect(S, "identifier");
1122− op->id = S->tok;
1122+ op->id = S->tccpp_tok;
11231123 next(S);
11241124 skip(S, ']');
11251125 }
@@ -1130,23 +1130,23 @@ static void parse_asm_operands(TCCState *S, ASMOperand *operands, int *nb_operan · 4 unmodified lines
11301130 skip(S, '(');
11311131 gexpr(S);
11321132 if (is_output) {
1133− if (!(S->vtop->type.t & VT_ARRAY))
1133+ if (!(S->tccgen_vtop->type.t & VT_ARRAY))
11341134 test_lvalue(S);
11351135 } else {
11361136 /* we want to avoid LLOCAL case, except when the 'm'
11371137 constraint is used. Note that it may come from
11381138 register storage, so we need to convert (reg)
11391139 case */
1140− if ((S->vtop->r & VT_LVAL) &&
1141− ((S->vtop->r & VT_VALMASK) == VT_LLOCAL ||
1142− (S->vtop->r & VT_VALMASK) < VT_CONST) &&
1140+ if ((S->tccgen_vtop->r & VT_LVAL) &&
1141+ ((S->tccgen_vtop->r & VT_VALMASK) == VT_LLOCAL ||
1142+ (S->tccgen_vtop->r & VT_VALMASK) < VT_CONST) &&
11431143 !strchr(op->constraint, 'm')) {
11441144 gv(S, RC_INT);
11451145 }
11461146 }
1147− op->vt = S->vtop;
1147+ op->vt = S->tccgen_vtop;
11481148 skip(S, ')');
1149− if (S->tok == ',') {
1149+ if (S->tccpp_tok == ',') {
11501150 next(S);
11511151 } else {
11521152 break;
@@ -1157,7 +1157,7 @@ static void parse_asm_operands(TCCState *S, ASMOperand *operands, int *nb_operan · 4 unmodified lines
11571157 }
11581158
11591159 /* parse the GCC asm() instruction */
1160−ST_FUNC void asm_instr(TCCState *S)
1160+ST_FUNC void asm_instr(TCCState* S)
11611161 {
11621162 CString astr, astr1;
11631163 ASMOperand operands[MAX_ASM_OPERANDS];
@@ -1167,7 +1167,7 @@ ST_FUNC void asm_instr(TCCState *S) · 3 unmodified lines
11671167
11681168 /* since we always generate the asm() instruction, we can ignore
11691169 volatile */
1170− if (S->tok == TOK_VOLATILE1 || S->tok == TOK_VOLATILE2 || S->tok == TOK_VOLATILE3) {
1170+ if (S->tccpp_tok == TOK_VOLATILE1 || S->tccpp_tok == TOK_VOLATILE2 || S->tccpp_tok == TOK_VOLATILE3) {
11711171 next(S);
11721172 }
11731173 parse_asm_str(S, &astr);
@@ -1175,27 +1175,27 @@ ST_FUNC void asm_instr(TCCState *S) · 1 unmodified line
11751175 nb_outputs = 0;
11761176 must_subst = 0;
11771177 memset(clobber_regs, 0, sizeof(clobber_regs));
1178− if (S->tok == ':') {
1178+ if (S->tccpp_tok == ':') {
11791179 next(S);
11801180 must_subst = 1;
11811181 /* output args */
11821182 parse_asm_operands(S, operands, &nb_operands, 1);
11831183 nb_outputs = nb_operands;
1184− if (S->tok == ':') {
1184+ if (S->tccpp_tok == ':') {
11851185 next(S);
1186− if (S->tok != ')') {
1186+ if (S->tccpp_tok != ')') {
11871187 /* input args */
11881188 parse_asm_operands(S, operands, &nb_operands, 0);
1189− if (S->tok == ':') {
1189+ if (S->tccpp_tok == ':') {
11901190 /* clobber list */
11911191 /* XXX: handle registers */
11921192 next(S);
11931193 for(;;) {
1194− if (S->tok != TOK_STR)
1194+ if (S->tccpp_tok != TOK_STR)
11951195 expect(S, "string constant");
1196− asm_clobber(S, clobber_regs, S->tokc.str.data);
1196+ asm_clobber(S, clobber_regs, S->tccpp_tokc.str.data);
11971197 next(S);
1198− if (S->tok == ',') {
1198+ if (S->tccpp_tok == ',') {
11991199 next(S);
12001200 } else {
12011201 break;
@@ -1208,7 +1208,7 @@ ST_FUNC void asm_instr(TCCState *S) · 6 unmodified lines
12081208 skip(S, ')');
12091209 /* NOTE: we do not eat the ';' so that we can restore the current
12101210 token after the assembler parsing */
1211− if (S->tok != ';')
1211+ if (S->tccpp_tok != ';')
12121212 expect(S, "';'");
12131213
12141214 /* save all values in the memory */
@@ -1264,37 +1264,37 @@ ST_FUNC void asm_instr(TCCState *S) · 49 unmodified lines
12641264 cstr_free(S, &astr1);
12651265 }
12661266
1267−ST_FUNC void asm_global_instr(TCCState *S)
1267+ST_FUNC void asm_global_instr(TCCState* S)
12681268 {
12691269 CString astr;
1270− int saved_nocode_wanted = S->nocode_wanted;
1270+ int saved_nocode_wanted = S->tccgen_nocode_wanted;
12711271
12721272 /* Global asm blocks are always emitted. */
1273− S->nocode_wanted = 0;
1273+ S->tccgen_nocode_wanted = 0;
12741274 next(S);
12751275 parse_asm_str(S, &astr);
12761276 skip(S, ')');
12771277 /* NOTE: we do not eat the ';' so that we can restore the current
12781278 token after the assembler parsing */
1279− if (S->tok != ';')
1279+ if (S->tccpp_tok != ';')
12801280 expect(S, "';'");
12811281
12821282 #ifdef ASM_DEBUG
12831283 printf("asm_global: \"%s\"\n", (char *)astr.data);
12841284 #endif
12851285 cur_text_section = text_section;
1286− S->ind = cur_text_section->data_offset;
1286+ S->tccgen_ind = cur_text_section->data_offset;
12871287
12881288 /* assemble the string with tcc internal assembler */
12891289 tcc_assemble_inline(S, astr.data, astr.size - 1, 1);
12901290
1291− cur_text_section->data_offset = S->ind;
1291+ cur_text_section->data_offset = S->tccgen_ind;
12921292
12931293 /* restore the current C token */
12941294 next(S);
12951295
12961296 cstr_free(S, &astr);
1297− S->nocode_wanted = saved_nocode_wanted;
1297+ S->tccgen_nocode_wanted = saved_nocode_wanted;
12981298 }
12991299
13001300 /********************************************************/
@@ -1304,12 +1304,12 @@ ST_FUNC int tcc_assemble(TCCState *S, int do_preprocess) · 3 unmodified lines
13041304 tcc_error(S, "asm not supported");
13051305 }
13061306
1307−ST_FUNC void asm_instr(TCCState *S)
1307+ST_FUNC void asm_instr(S)
13081308 {
13091309 tcc_error(S, "inline asm() not supported");
13101310 }
13111311
1312−ST_FUNC void asm_global_instr(TCCState *S)
1312+ST_FUNC void asm_global_instr(S)
13131313 {
13141314 tcc_error(S, "inline asm() not supported");
13151315 }
tccelf.c+10−10
@@ -107,7 +107,7 @@ ST_FUNC void tccelf_stab_new(TCCState *S) · 106 unmodified lines
107107 put_stabs(S, "", 0, 0, 0, 0);
108108 }
109109
110−static void free_section(TCCState *S, Section *s)
110+static void free_section(TCCState* S, Section *s)
111111 {
112112 tcc_free(S, s->data);
113113 }
@@ -284,7 +284,7 @@ ST_FUNC Section *new_symtab(TCCState *S, · 170 unmodified lines
284284 }
285285
286286 /* realloc section and set its content to zero */
287−ST_FUNC void section_realloc(TCCState *S, Section *sec, unsigned long new_size)
287+ST_FUNC void section_realloc(TCCState* S, Section *sec, unsigned long new_size)
288288 {
289289 unsigned long size;
290290 unsigned char *data;
@@ -302,7 +302,7 @@ ST_FUNC void section_realloc(TCCState *S, Section *sec, unsigned long new_size) · 11 unmodified lines
302302
303303 /* reserve at least 'size' bytes aligned per 'align' in section
304304 'sec' from current offset, and return the aligned offset */
305−ST_FUNC size_t section_add(TCCState *S, Section *sec, addr_t size, int align)
305+ST_FUNC size_t section_add(TCCState* S, Section *sec, addr_t size, int align)
306306 {
307307 size_t offset, offset1;
308308
@@ -318,7 +318,7 @@ ST_FUNC size_t section_add(TCCState *S, Section *sec, addr_t size, int align) · 9 unmodified lines
318318
319319 /* reserve at least 'size' bytes in section 'sec' from
320320 sec->data_offset. */
321−ST_FUNC void *section_ptr_add(TCCState *S, Section *sec, addr_t size)
321+ST_FUNC void *section_ptr_add(TCCState* S, Section *sec, addr_t size)
322322 {
323323 size_t offset = section_add(S, sec, size, 1);
324324 return sec->data + offset;
@@ -326,7 +326,7 @@ ST_FUNC void *section_ptr_add(TCCState *S, Section *sec, addr_t size) · 1 unmodified line
326326
327327 #ifndef ELF_OBJ_ONLY
328328 /* reserve at least 'size' bytes from section start */
329−static void section_reserve(TCCState *S, Section *sec, unsigned long size)
329+static void section_reserve(TCCState* S, Section *sec, unsigned long size)
330330 {
331331 if (size > sec->data_allocated)
332332 section_realloc(S, sec, size);
@@ -357,7 +357,7 @@ ST_FUNC Section *find_section(TCCState *S, const char *name) · 24 unmodified lines
357357
358358 /* ------------------------------------------------------------------------- */
359359
360−ST_FUNC int put_elf_str(TCCState *S, Section *s, const char *sym)
360+ST_FUNC int put_elf_str(TCCState* S, Section *s, const char *sym)
361361 {
362362 int offset, len;
363363 char *ptr;
@@ -386,7 +386,7 @@ static unsigned long elf_hash(const unsigned char *name) · 22 unmodified lines
386386
387387 /* rebuild hash table of section s */
388388 /* NOTE: we do factorize the hash table code to go faster */
389−static void rebuild_hash(TCCState *S, Section *s, unsigned int nb_buckets)
389+static void rebuild_hash(TCCState* S, Section *s, unsigned int nb_buckets)
390390 {
391391 ElfW(Sym) *sym;
392392 int *ptr, *hash, nb_syms, sym_index, h;
@@ -422,7 +422,7 @@ static void rebuild_hash(TCCState *S, Section *s, unsigned int nb_buckets) · 29 unmodified lines
422422 }
423423
424424 /* return the symbol number */
425−ST_FUNC int put_elf_sym(TCCState *S, Section *s, addr_t value, unsigned long size,
425+ST_FUNC int put_elf_sym(TCCState* S, Section *s, addr_t value, unsigned long size,
426426 int info, int other, int shndx, const char *name)
427427 {
428428 int name_offset, sym_index;
@@ -2082,7 +2082,7 @@ static int layout_sections(TCCState *S, ElfW(Phdr) *phdr, · 1653 unmodified lines
20822082 }
20832083
20842084 /* put dynamic tag */
2085−static void put_dt(TCCState *S, Section *dynamic, int dt, addr_t val)
2085+static void put_dt(TCCState* S, Section *dynamic, int dt, addr_t val)
20862086 {
20872087 ElfW(Dyn) *dyn;
20882088 dyn = section_ptr_add(S, dynamic, sizeof(ElfW(Dyn)));
@@ -2827,7 +2827,7 @@ ST_FUNC ssize_t full_read(int fd, void *buf, size_t count) { · 738 unmodified lines
28272827 }
28282828 }
28292829
2830−ST_FUNC void *load_data(TCCState *S, int fd, unsigned long file_offset, unsigned long size)
2830+ST_FUNC void *load_data(TCCState* S, int fd, unsigned long file_offset, unsigned long size)
28312831 {
28322832 void *data;
28332833
tccgen.c+901−901
@@ -33,22 +33,22 @@ · 32 unmodified lines
3333 #define vstack (S->tccgen__vstack + 1)
3434
3535 #define unevalmask 0xffff /* unevaluated subexpression */
36−#define NODATA_WANTED (S->nocode_wanted > 0) /* no static data output wanted either */
37−#define STATIC_DATA_WANTED (S->nocode_wanted & 0xC0000000) /* only static data output */
36+#define NODATA_WANTED (S->tccgen_nocode_wanted > 0) /* no static data output wanted either */
37+#define STATIC_DATA_WANTED (S->tccgen_nocode_wanted & 0xC0000000) /* only static data output */
3838
3939 /* Automagical code suppression ----> */
40−#define CODE_OFF() (S->nocode_wanted |= 0x20000000)
41−#define CODE_ON() (S->nocode_wanted &= ~0x20000000)
40+#define CODE_OFF() (S->tccgen_nocode_wanted |= 0x20000000)
41+#define CODE_ON() (S->tccgen_nocode_wanted &= ~0x20000000)
4242
43−static void tcc_tcov_block_begin(TCCState *S);
43+static void tcc_tcov_block_begin(TCCState* S);
4444
4545 /* Clear 'nocode_wanted' at label if it was used */
46−ST_FUNC void gsym(TCCState *S, int t) { if (t) { gsym_addr(S, t, S->ind); CODE_ON(); }}
47−static int gind(TCCState *S) { int t = S->ind; CODE_ON(); if (S->tccgen_debug_modes) tcc_tcov_block_begin(S); return t; }
46+ST_FUNC void gsym(TCCState* S, int t) { if (t) { gsym_addr(S, t, S->tccgen_ind); CODE_ON(); }}
47+static int gind(TCCState* S) { int t = S->tccgen_ind; CODE_ON(); if (S->tccgen_debug_modes) tcc_tcov_block_begin(S); return t; }
4848
4949 /* Set 'nocode_wanted' after unconditional jumps */
50−static void gjmp_addr_acs(TCCState *S, int t) { gjmp_addr(S, t); CODE_OFF(); }
51−static int gjmp_acs(TCCState *S, int t) { t = gjmp(S, t); CODE_OFF(); return t; }
50+static void gjmp_addr_acs(TCCState* S, int t) { gjmp_addr(S, t); CODE_OFF(); }
51+static int gjmp_acs(TCCState* S, int t) { t = gjmp(S, t); CODE_OFF(); return t; }
5252
5353 /* These are #undef'd at the end of this file */
5454 #define gjmp_addr gjmp_addr_acs
@@ -74,7 +74,7 @@ typedef struct { · 19 unmodified lines
7474
7575 #if 1
7676 #define precedence_parser
77−static void init_prec(TCCState *S);
77+static void init_prec(TCCState* S);
7878 #endif
7979
8080 /********************************************************/
@@ -129,33 +129,33 @@ static const struct { · 48 unmodified lines
129129 };
130130
131131 /********************************************************/
132−static void gen_cast(TCCState *S, CType *type);
133−static void gen_cast_s(TCCState *S, int t);
132+static void gen_cast(TCCState* S, CType *type);
133+static void gen_cast_s(TCCState* S, int t);
134134 static inline CType *pointed_type(CType *type);
135135 static int is_compatible_types(CType *type1, CType *type2);
136−static int parse_btype(TCCState *S, CType *type, AttributeDef *ad);
137−static CType *type_decl(TCCState *S, CType *type, AttributeDef *ad, int *v, int td);
138−static void parse_expr_type(TCCState *S, CType *type);
139−static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c);
140−static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned long c, int flags);
141−static void block(TCCState *S, int is_expr);
142−static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
143−static void decl(TCCState *S, int l);
144−static int decl0(TCCState *S, int l, int is_for_loop_init, Sym *);
145−static void expr_eq(TCCState *S);
146−static void vla_runtime_type_size(TCCState *S, CType *type, int *a);
136+static int parse_btype(TCCState* S, CType *type, AttributeDef *ad);
137+static CType *type_decl(TCCState* S, CType *type, AttributeDef *ad, int *v, int td);
138+static void parse_expr_type(TCCState* S, CType *type);
139+static void init_putv(TCCState* S, init_params *p, CType *type, unsigned long c);
140+static void decl_initializer(TCCState* S, init_params *p, CType *type, unsigned long c, int flags);
141+static void block(TCCState* S, int is_expr);
142+static void decl_initializer_alloc(TCCState* S, CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
143+static void decl(TCCState* S, int l);
144+static int decl0(TCCState* S, int l, int is_for_loop_init, Sym *);
145+static void expr_eq(TCCState* S);
146+static void vla_runtime_type_size(TCCState* S, CType *type, int *a);
147147 static int is_compatible_unqualified_types(CType *type1, CType *type2);
148−static inline int64_t expr_const64(TCCState *S);
149−static void vpush64(TCCState *S, int ty, unsigned long long v);
150−static void vpush(TCCState *S, CType *type);
151−static int gvtst(TCCState *S, int inv, int t);
148+static inline int64_t expr_const64(TCCState* S);
149+static void vpush64(TCCState* S, int ty, unsigned long long v);
150+static void vpush(TCCState* S, CType *type);
151+static int gvtst(TCCState* S, int inv, int t);
152152 static void gen_inline_functions(TCCState *S);
153153 static void free_inline_functions(TCCState *S);
154−static void skip_or_save_block(TCCState *S, TokenString **str);
155−static void gv_dup(TCCState *S);
156−static int get_temp_local_var(TCCState *S, int size,int align);
154+static void skip_or_save_block(TCCState* S, TokenString **str);
155+static void gv_dup(TCCState* S);
156+static int get_temp_local_var(TCCState* S, int size,int align);
157157 static void clear_temp_local_var_list();
158−static void cast_error(TCCState *S, CType *st, CType *dt);
158+static void cast_error(TCCState* S, CType *st, CType *dt);
159159
160160 ST_INLN int is_float(int t)
161161 {
@@ -284,17 +284,17 @@ ST_FUNC int ieee_finite(double d) · 122 unmodified lines
284284 # define TCC_IS_NATIVE_387
285285 #endif
286286
287−ST_FUNC void test_lvalue(TCCState *S)
287+ST_FUNC void test_lvalue(TCCState* S)
288288 {
289− if (!(S->vtop->r & VT_LVAL))
289+ if (!(S->tccgen_vtop->r & VT_LVAL))
290290 expect(S, "lvalue");
291291 }
292292
293−ST_FUNC void check_vstack(TCCState *S)
293+ST_FUNC void check_vstack(TCCState* S)
294294 {
295− if (S->vtop != vstack - 1)
295+ if (S->tccgen_vtop != vstack - 1)
296296 tcc_error(S, "internal compiler error: vstack leak (%d)",
297− (int)(S->vtop - vstack + 1));
297+ (int)(S->tccgen_vtop - vstack + 1));
298298 }
299299
300300 /* ------------------------------------------------------------------------- */
@@ -305,7 +305,7 @@ void pv (const char *lbl, int a, int b) · 4 unmodified lines
305305 {
306306 int i;
307307 for (i = a; i < a + b; ++i) {
308− SValue *p = &S->vtop[-i];
308+ SValue *p = &S->tccgen_vtop[-i];
309309 printf("%s vtop[-%d] : type.t:%04x r:%04x r2:%04x c.i:%d\n",
310310 lbl, i, p->type.t, p->r, p->r2, (int)p->c.i);
311311 }
@@ -371,7 +371,7 @@ static BufferedFile* put_new_file(TCCState *S) · 59 unmodified lines
371371 if (f->filename[0] == ':')
372372 f = f->prev;
373373 if (f && S->tccgen_new_file) {
374− put_stabs_r(S, f->filename, N_SOL, 0, 0, S->ind, text_section, S->tccgen_section_sym);
374+ put_stabs_r(S, f->filename, N_SOL, 0, 0, S->tccgen_ind, text_section, S->tccgen_section_sym);
375375 S->tccgen_new_file = S->tccgen_last_line_num = 0;
376376 }
377377 return f;
@@ -414,10 +414,10 @@ static void tcc_debug_line(TCCState *S) · 36 unmodified lines
414414 || S->tccgen_last_line_num == f->line_num)
415415 return;
416416 if (S->tccgen_func_ind != -1) {
417− put_stabn(S, N_SLINE, 0, f->line_num, S->ind - S->tccgen_func_ind);
417+ put_stabn(S, N_SLINE, 0, f->line_num, S->tccgen_ind - S->tccgen_func_ind);
418418 } else {
419419 /* from tcc_assemble */
420− put_stabs_r(S, NULL, N_SLINE, 0, f->line_num, S->ind, text_section, S->tccgen_section_sym);
420+ put_stabs_r(S, NULL, N_SLINE, 0, f->line_num, S->tccgen_ind, text_section, S->tccgen_section_sym);
421421 }
422422 S->tccgen_last_line_num = f->line_num;
423423 }
@@ -427,12 +427,12 @@ static void tcc_debug_stabs (TCCState *S, const char *str, int type, unsigned lo · 3 unmodified lines
427427 {
428428 struct debug_sym *s;
429429
430− if (S->debug_info) {
431− S->debug_info->sym =
432− (struct debug_sym *)tcc_realloc (S, S->debug_info->sym,
430+ if (S->tccgen_debug_info) {
431+ S->tccgen_debug_info->sym =
432+ (struct debug_sym *)tcc_realloc (S, S->tccgen_debug_info->sym,
433433 sizeof(struct debug_sym) *
434− (S->debug_info->n_sym + 1));
435− s = S->debug_info->sym + S->debug_info->n_sym++;
434+ (S->tccgen_debug_info->n_sym + 1));
435+ s = S->tccgen_debug_info->sym + S->tccgen_debug_info->n_sym++;
436436 s->type = type;
437437 s->value = value;
438438 s->str = tcc_strdup(S, str);
@@ -454,25 +454,25 @@ static void tcc_debug_stabn(TCCState *S, int type, int value) · 15 unmodified lines
454454 (debug_info_t *) tcc_mallocz(S, sizeof (*info));
455455
456456 info->start = value;
457− info->parent = S->debug_info;
458− if (S->debug_info) {
459− if (S->debug_info->child) {
460− if (S->debug_info->child->last)
461− S->debug_info->child->last->next = info;
457+ info->parent = S->tccgen_debug_info;
458+ if (S->tccgen_debug_info) {
459+ if (S->tccgen_debug_info->child) {
460+ if (S->tccgen_debug_info->child->last)
461+ S->tccgen_debug_info->child->last->next = info;
462462 else
463− S->debug_info->child->next = info;
464− S->debug_info->child->last = info;
463+ S->tccgen_debug_info->child->next = info;
464+ S->tccgen_debug_info->child->last = info;
465465 }
466466 else
467− S->debug_info->child = info;
467+ S->tccgen_debug_info->child = info;
468468 }
469469 else
470− S->debug_info_root = info;
471− S->debug_info = info;
470+ S->tccgen_debug_info_root = info;
471+ S->tccgen_debug_info = info;
472472 }
473473 else {
474− S->debug_info->end = value;
475− S->debug_info = S->debug_info->parent;
474+ S->tccgen_debug_info->end = value;
475+ S->tccgen_debug_info = S->tccgen_debug_info->parent;
476476 }
477477 }
478478
@@ -644,9 +644,9 @@ static void tcc_debug_funcstart(TCCState *S, Sym *sym) · 165 unmodified lines
644644 BufferedFile *f;
645645 if (!S->do_debug)
646646 return;
647− S->debug_info_root = NULL;
648− S->debug_info = NULL;
649− tcc_debug_stabn(S, N_LBRAC, S->ind - S->tccgen_func_ind);
647+ S->tccgen_debug_info_root = NULL;
648+ S->tccgen_debug_info = NULL;
649+ tcc_debug_stabn(S, N_LBRAC, S->tccgen_ind - S->tccgen_func_ind);
650650 if (!(f = put_new_file(S)))
651651 return;
652652 cstr_new (S, &debug_str);
@@ -664,7 +664,7 @@ static void tcc_debug_funcend(TCCState *S, int size) · 11 unmodified lines
664664 if (!S->do_debug)
665665 return;
666666 tcc_debug_stabn(S, N_RBRAC, size);
667− tcc_debug_finish (S, S->debug_info_root);
667+ tcc_debug_finish (S, S->tccgen_debug_info_root);
668668 }
669669
670670
@@ -682,7 +682,7 @@ static void tcc_debug_extern_sym(TCCState *S, Sym *sym, int sh_num, int sym_bind · 11 unmodified lines
682682 cstr_new (S, &str);
683683 cstr_printf (S, &str, "%s:%c",
684684 get_tok_str(S, sym->v, NULL),
685− sym_bind == STB_GLOBAL ? 'G' : S->local_scope ? 'V' : 'S'
685+ sym_bind == STB_GLOBAL ? 'G' : S->tccgen_local_scope ? 'V' : 'S'
686686 );
687687 tcc_get_debug_info(S, sym, &str);
688688 if (sym_bind == STB_GLOBAL)
@@ -712,16 +712,16 @@ static void tcc_debug_typedef(TCCState *S, Sym *sym) · 23 unmodified lines
712712 /* ------------------------------------------------------------------------- */
713713 /* for section layout see lib/tcov.c */
714714
715−static void tcc_tcov_block_end(TCCState *S, int line);
715+static void tcc_tcov_block_end(TCCState* S, int line);
716716
717−static void tcc_tcov_block_begin(TCCState *S)
717+static void tcc_tcov_block_begin(TCCState* S)
718718 {
719719 SValue sv;
720720 void *ptr;
721721 unsigned long last_offset = S->tccgen_tcov_data.offset;
722722
723723 tcc_tcov_block_end (S, 0);
724− if (S->test_coverage == 0 || S->nocode_wanted)
724+ if (S->test_coverage == 0 || S->tccgen_nocode_wanted)
725725 return;
726726
727727 if (S->tccgen_tcov_data.last_file_name == 0 ||
@@ -767,7 +767,7 @@ static void tcc_tcov_block_begin(TCCState *S) · 39 unmodified lines
767767 ptr = section_ptr_add(S, tcov_section, 8);
768768 write64le (ptr, S->tccpp_file->line_num);
769769 }
770− if (S->ind == S->tccgen_tcov_data.ind && S->tccgen_tcov_data.line == S->tccpp_file->line_num)
770+ if (S->tccgen_ind == S->tccgen_tcov_data.ind && S->tccgen_tcov_data.line == S->tccpp_file->line_num)
771771 S->tccgen_tcov_data.offset = last_offset;
772772 else {
773773 Sym label = {0};
@@ -793,11 +793,11 @@ static void tcc_tcov_block_begin(TCCState *S) · 19 unmodified lines
793793 vpop(S);
794794 #endif
795795 S->tccgen_tcov_data.offset = (unsigned char *)ptr - tcov_section->data;
796− S->tccgen_tcov_data.ind = S->ind;
796+ S->tccgen_tcov_data.ind = S->tccgen_ind;
797797 }
798798 }
799799
800−static void tcc_tcov_block_end(TCCState *S, int line)
800+static void tcc_tcov_block_end(TCCState* S, int line)
801801 {
802802 if (S->test_coverage == 0)
803803 return;
@@ -810,7 +810,7 @@ static void tcc_tcov_block_end(TCCState *S, int line) · 6 unmodified lines
810810 }
811811 }
812812
813−static void tcc_tcov_check_line(TCCState *S, int start)
813+static void tcc_tcov_check_line(TCCState* S, int start)
814814 {
815815 if (S->test_coverage == 0)
816816 return;
@@ -825,7 +825,7 @@ static void tcc_tcov_check_line(TCCState *S, int start) · 8 unmodified lines
825825 }
826826 }
827827
828−static void tcc_tcov_start(TCCState *S)
828+static void tcc_tcov_start(TCCState* S)
829829 {
830830 if (S->test_coverage == 0)
831831 return;
@@ -837,7 +837,7 @@ static void tcc_tcov_start(TCCState *S) · 5 unmodified lines
837837 }
838838 }
839839
840−static void tcc_tcov_end(TCCState *S)
840+static void tcc_tcov_end(TCCState* S)
841841 {
842842 if (S->test_coverage == 0)
843843 return;
@@ -851,8 +851,8 @@ static void tcc_tcov_end(TCCState *S) · 7 unmodified lines
851851 /* initialize vstack and types. This must be done also for tcc -E */
852852 ST_FUNC void tccgen_init(TCCState *S)
853853 {
854− S->vtop = vstack - 1;
855− memset(S->vtop, 0, sizeof *S->vtop);
854+ S->tccgen_vtop = vstack - 1;
855+ memset(S->tccgen_vtop, 0, sizeof *S->tccgen_vtop);
856856
857857 /* define some often used types */
858858 S->tccgen_int_type.t = VT_INT;
@@ -860,8 +860,8 @@ ST_FUNC void tccgen_init(TCCState *S) · 1 unmodified line
860860 S->tccgen_char_type.t = VT_BYTE;
861861 if (S->char_is_unsigned)
862862 S->tccgen_char_type.t |= VT_UNSIGNED;
863− S->char_pointer_type = S->tccgen_char_type;
864− mk_pointer(S, &S->char_pointer_type);
863+ S->tccgen_char_pointer_type = S->tccgen_char_type;
864+ mk_pointer(S, &S->tccgen_char_pointer_type);
865865
866866 S->tccgen_func_old_type.t = VT_FUNC;
867867 S->tccgen_func_old_type.ref = sym_push(S, SYM_FIELD, &S->tccgen_int_type, 0, 0);
@@ -880,8 +880,8 @@ ST_FUNC int tccgen_compile(TCCState *S) · 12 unmodified lines
880880 S->tccgen_anon_sym = SYM_FIRST_ANOM;
881881 S->tccgen_section_sym = 0;
882882 S->tccgen_const_wanted = 0;
883− S->nocode_wanted = 0x80000000;
884− S->local_scope = 0;
883+ S->tccgen_nocode_wanted = 0x80000000;
884+ S->tccgen_local_scope = 0;
885885 S->tccgen_debug_modes = S->do_debug | S->test_coverage << 1;
886886
887887 tcc_debug_start(S);
@@ -908,7 +908,7 @@ ST_FUNC void tccgen_finish(TCCState *S) · 20 unmodified lines
908908 cstr_free(S, &S->tccgen_initstr);
909909 free_inline_functions(S);
910910 sym_pop(S, &S->tccgen_global_stack, NULL, 0);
911− sym_pop(S, &S->local_stack, NULL, 0);
911+ sym_pop(S, &S->tccgen_local_stack, NULL, 0);
912912 /* free preprocessor macros */
913913 free_defines(S, NULL);
914914 /* free sym_pools */
@@ -917,7 +917,7 @@ ST_FUNC void tccgen_finish(TCCState *S) · 2 unmodified lines
917917 }
918918
919919 /* ------------------------------------------------------------------------- */
920−ST_FUNC ElfSym *elfsym(TCCState *S, Sym *s)
920+ST_FUNC ElfSym *elfsym(TCCState* S, Sym *s)
921921 {
922922 if (!s || !s->c)
923923 return NULL;
@@ -925,7 +925,7 @@ ST_FUNC ElfSym *elfsym(TCCState *S, Sym *s) · 1 unmodified line
925925 }
926926
927927 /* apply storage attributes to Elf symbol */
928−ST_FUNC void update_storage(TCCState *S, Sym *sym)
928+ST_FUNC void update_storage(TCCState* S, Sym *sym)
929929 {
930930 ElfSym *esym;
931931 int sym_bind, old_sym_bind;
@@ -971,7 +971,7 @@ ST_FUNC void update_storage(TCCState *S, Sym *sym) · 39 unmodified lines
971971 /* update sym->c so that it points to an external symbol in section
972972 'section' with value 'value' */
973973
974−ST_FUNC void put_extern_sym2(TCCState *S, Sym *sym, int sh_num,
974+ST_FUNC void put_extern_sym2(TCCState* S, Sym *sym, int sh_num,
975975 addr_t value, unsigned long size,
976976 int can_add_underscore)
977977 {
@@ -1039,7 +1039,7 @@ ST_FUNC void put_extern_sym2(TCCState *S, Sym *sym, int sh_num, · 61 unmodified lines
10391039 update_storage(S, sym);
10401040 }
10411041
1042−ST_FUNC void put_extern_sym(TCCState *S, Sym *sym, Section *section,
1042+ST_FUNC void put_extern_sym(TCCState* S, Sym *sym, Section *section,
10431043 addr_t value, unsigned long size)
10441044 {
10451045 int sh_num = section ? section->sh_num : SHN_UNDEF;
@@ -1047,12 +1047,12 @@ ST_FUNC void put_extern_sym(TCCState *S, Sym *sym, Section *section, · 1 unmodified line
10471047 }
10481048
10491049 /* add a new relocation entry to symbol 'sym' in section 's' */
1050−ST_FUNC void greloca(TCCState *S, Section *s, Sym *sym, unsigned long offset, int type,
1050+ST_FUNC void greloca(TCCState* S, Section *s, Sym *sym, unsigned long offset, int type,
10511051 addr_t addend)
10521052 {
10531053 int c = 0;
10541054
1055− if (S->nocode_wanted && s == cur_text_section)
1055+ if (S->tccgen_nocode_wanted && s == cur_text_section)
10561056 return;
10571057
10581058 if (sym) {
@@ -1066,7 +1066,7 @@ ST_FUNC void greloca(TCCState *S, Section *s, Sym *sym, unsigned long offset, in · 7 unmodified lines
10661066 }
10671067
10681068 #if PTR_SIZE == 4
1069−ST_FUNC void greloc(TCCState *S, Section *s, Sym *sym, unsigned long offset, int type)
1069+ST_FUNC void greloc(TCCState* S, Section *s, Sym *sym, unsigned long offset, int type)
10701070 {
10711071 greloca(S, s, sym, offset, type, 0);
10721072 }
@@ -1074,7 +1074,7 @@ ST_FUNC void greloc(TCCState *S, Section *s, Sym *sym, unsigned long offset, int · 1 unmodified line
10741074
10751075 /* ------------------------------------------------------------------------- */
10761076 /* symbol allocator */
1077−static Sym *__sym_malloc(TCCState *S)
1077+static Sym *__sym_malloc(TCCState* S)
10781078 {
10791079 Sym *sym_pool, *sym, *last_sym;
10801080 int i;
@@ -1093,7 +1093,7 @@ static Sym *__sym_malloc(TCCState *S) · 12 unmodified lines
10931093 return last_sym;
10941094 }
10951095
1096−static inline Sym *sym_malloc(TCCState *S)
1096+static inline Sym *sym_malloc(TCCState* S)
10971097 {
10981098 Sym *sym;
10991099 #ifndef SYM_DEBUG
@@ -1108,7 +1108,7 @@ static inline Sym *sym_malloc(TCCState *S) · 8 unmodified lines
11081108 #endif
11091109 }
11101110
1111−ST_INLN void sym_free(TCCState *S, Sym *sym)
1111+ST_INLN void sym_free(TCCState* S, Sym *sym)
11121112 {
11131113 #ifndef SYM_DEBUG
11141114 sym->next = S->tccgen_sym_free_first;
@@ -1119,7 +1119,7 @@ ST_INLN void sym_free(TCCState *S, Sym *sym) · 4 unmodified lines
11191119 }
11201120
11211121 /* push, without hashing */
1122−ST_FUNC Sym *sym_push2(TCCState *S, Sym **ps, int v, int t, int c)
1122+ST_FUNC Sym *sym_push2(TCCState* S, Sym **ps, int v, int t, int c)
11231123 {
11241124 Sym *s;
11251125
@@ -1149,19 +1149,19 @@ ST_FUNC Sym *sym_find2(Sym *s, int v) · 23 unmodified lines
11491149 }
11501150
11511151 /* structure lookup */
1152−ST_INLN Sym *struct_find(TCCState *S, int v)
1152+ST_INLN Sym *struct_find(TCCState* S, int v)
11531153 {
11541154 v -= TOK_IDENT;
1155− if ((unsigned)v >= (unsigned)(S->tok_ident - TOK_IDENT))
1155+ if ((unsigned)v >= (unsigned)(S->tccpp_tok_ident - TOK_IDENT))
11561156 return NULL;
11571157 return S->tccpp_table_ident[v]->sym_struct;
11581158 }
11591159
11601160 /* find an identifier */
1161−ST_INLN Sym *sym_find(TCCState *S, int v)
1161+ST_INLN Sym *sym_find(TCCState* S, int v)
11621162 {
11631163 v -= TOK_IDENT;
1164− if ((unsigned)v >= (unsigned)(S->tok_ident - TOK_IDENT))
1164+ if ((unsigned)v >= (unsigned)(S->tccpp_tok_ident - TOK_IDENT))
11651165 return NULL;
11661166 return S->tccpp_table_ident[v]->sym_identifier;
11671167 }
@@ -1175,13 +1175,13 @@ static int sym_scope(Sym *s) · 7 unmodified lines
11751175 }
11761176
11771177 /* push a given symbol on the symbol stack */
1178−ST_FUNC Sym *sym_push(TCCState *S, int v, CType *type, int r, int c)
1178+ST_FUNC Sym *sym_push(TCCState* S, int v, CType *type, int r, int c)
11791179 {
11801180 Sym *s, **ps;
11811181 TokenSym *ts;
11821182
1183− if (S->local_stack)
1184− ps = &S->local_stack;
1183+ if (S->tccgen_local_stack)
1184+ ps = &S->tccgen_local_stack;
11851185 else
11861186 ps = &S->tccgen_global_stack;
11871187 s = sym_push2(S, ps, v, type->t, c);
@@ -1198,7 +1198,7 @@ ST_FUNC Sym *sym_push(TCCState *S, int v, CType *type, int r, int c) · 10 unmodified lines
11981198 ps = &ts->sym_identifier;
11991199 s->prev_tok = *ps;
12001200 *ps = s;
1201− s->sym_scope = S->local_scope;
1201+ s->sym_scope = S->tccgen_local_scope;
12021202 if (s->prev_tok && sym_scope(s->prev_tok) == s->sym_scope)
12031203 tcc_error(S, "redeclaration of '%s'",
12041204 get_tok_str(S, v & ~SYM_STRUCT, NULL));
@@ -1207,7 +1207,7 @@ ST_FUNC Sym *sym_push(TCCState *S, int v, CType *type, int r, int c) · 2 unmodified lines
12071207 }
12081208
12091209 /* push a global identifier */
1210−ST_FUNC Sym *global_identifier_push(TCCState *S, int v, int t, int c)
1210+ST_FUNC Sym *global_identifier_push(TCCState* S, int v, int t, int c)
12111211 {
12121212 Sym *s, **ps;
12131213 s = sym_push2(S, &S->tccgen_global_stack, v, t, c);
@@ -1227,7 +1227,7 @@ ST_FUNC Sym *global_identifier_push(TCCState *S, int v, int t, int c) · 13 unmodified lines
12271227
12281228 /* pop symbols until top reaches 'b'. If KEEP is non-zero don't really
12291229 pop them yet from the list, but do remove them from the token array. */
1230−ST_FUNC void sym_pop(TCCState *S, Sym **ptop, Sym *b, int keep)
1230+ST_FUNC void sym_pop(TCCState* S, Sym **ptop, Sym *b, int keep)
12311231 {
12321232 Sym *s, *ss, **ps;
12331233 TokenSym *ts;
@@ -1256,7 +1256,7 @@ ST_FUNC void sym_pop(TCCState *S, Sym **ptop, Sym *b, int keep) · 22 unmodified lines
12561256 }
12571257
12581258 /* ------------------------------------------------------------------------- */
1259−static void vcheck_cmp(TCCState *S)
1259+static void vcheck_cmp(TCCState* S)
12601260 {
12611261 /* cannot let cpu flags if other instruction are generated. Also
12621262 avoid leaving VT_JMP anywhere except on the top of the stack
@@ -1270,38 +1270,38 @@ static void vcheck_cmp(TCCState *S) · 7 unmodified lines
12701270 again, so that the VT_CMP/VT_JMP value will be in vtop
12711271 when code is unsuppressed again. */
12721272
1273− if (S->vtop->r == VT_CMP && !S->nocode_wanted)
1273+ if (S->tccgen_vtop->r == VT_CMP && !S->tccgen_nocode_wanted)
12741274 gv(S, RC_INT);
12751275 }
12761276
1277−static void vsetc(TCCState *S, CType *type, int r, CValue *vc)
1277+static void vsetc(TCCState* S, CType *type, int r, CValue *vc)
12781278 {
1279− if (S->vtop >= vstack + (VSTACK_SIZE - 1))
1279+ if (S->tccgen_vtop >= vstack + (VSTACK_SIZE - 1))
12801280 tcc_error(S, "memory full (vstack)");
12811281 vcheck_cmp(S);
1282− S->vtop++;
1283− S->vtop->type = *type;
1284− S->vtop->r = r;
1285− S->vtop->r2 = VT_CONST;
1286− S->vtop->c = *vc;
1287− S->vtop->sym = NULL;
1282+ S->tccgen_vtop++;
1283+ S->tccgen_vtop->type = *type;
1284+ S->tccgen_vtop->r = r;
1285+ S->tccgen_vtop->r2 = VT_CONST;
1286+ S->tccgen_vtop->c = *vc;
1287+ S->tccgen_vtop->sym = NULL;
12881288 }
12891289
1290−ST_FUNC void vswap(TCCState *S)
1290+ST_FUNC void vswap(TCCState* S)
12911291 {
12921292 SValue tmp;
12931293
12941294 vcheck_cmp(S);
1295− tmp = S->vtop[0];
1296− S->vtop[0] = S->vtop[-1];
1297− S->vtop[-1] = tmp;
1295+ tmp = S->tccgen_vtop[0];
1296+ S->tccgen_vtop[0] = S->tccgen_vtop[-1];
1297+ S->tccgen_vtop[-1] = tmp;
12981298 }
12991299
13001300 /* pop stack value */
1301−ST_FUNC void vpop(TCCState *S)
1301+ST_FUNC void vpop(TCCState* S)
13021302 {
13031303 int v;
1304− v = S->vtop->r & VT_VALMASK;
1304+ v = S->tccgen_vtop->r & VT_VALMASK;
13051305 #if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
13061306 /* for x86, we need to pop the FP stack */
13071307 if (v == TREG_ST0) {
@@ -1310,20 +1310,20 @@ ST_FUNC void vpop(TCCState *S) · 2 unmodified lines
13101310 #endif
13111311 if (v == VT_CMP) {
13121312 /* need to put correct jump if && or || without test */
1313− gsym(S, S->vtop->jtrue);
1314− gsym(S, S->vtop->jfalse);
1313+ gsym(S, S->tccgen_vtop->jtrue);
1314+ gsym(S, S->tccgen_vtop->jfalse);
13151315 }
1316− S->vtop--;
1316+ S->tccgen_vtop--;
13171317 }
13181318
13191319 /* push constant of type "type" with useless value */
1320−static void vpush(TCCState *S, CType *type)
1320+static void vpush(TCCState* S, CType *type)
13211321 {
13221322 vset(S, type, VT_CONST, 0);
13231323 }
13241324
13251325 /* push arbitrary 64bit constant */
1326−static void vpush64(TCCState *S, int ty, unsigned long long v)
1326+static void vpush64(TCCState* S, int ty, unsigned long long v)
13271327 {
13281328 CValue cval;
13291329 CType ctype;
@@ -1334,31 +1334,31 @@ static void vpush64(TCCState *S, int ty, unsigned long long v) · 4 unmodified lines
13341334 }
13351335
13361336 /* push integer constant */
1337−ST_FUNC void vpushi(TCCState *S, int v)
1337+ST_FUNC void vpushi(TCCState* S, int v)
13381338 {
13391339 vpush64(S, VT_INT, v);
13401340 }
13411341
13421342 /* push a pointer sized constant */
1343−static void vpushs(TCCState *S, addr_t v)
1343+static void vpushs(TCCState* S, addr_t v)
13441344 {
13451345 vpush64(S, VT_SIZE_T, v);
13461346 }
13471347
13481348 /* push long long constant */
1349−static inline void vpushll(TCCState *S, long long v)
1349+static inline void vpushll(TCCState* S, long long v)
13501350 {
13511351 vpush64(S, VT_LLONG, v);
13521352 }
13531353
1354−ST_FUNC void vset(TCCState *S, CType *type, int r, int v)
1354+ST_FUNC void vset(TCCState* S, CType *type, int r, int v)
13551355 {
13561356 CValue cval;
13571357 cval.i = v;
13581358 vsetc(S, type, r, &cval);
13591359 }
13601360
1361−static void vseti(TCCState *S, int r, int v)
1361+static void vseti(TCCState* S, int r, int v)
13621362 {
13631363 CType type;
13641364 type.t = VT_INT;
@@ -1366,38 +1366,38 @@ static void vseti(TCCState *S, int r, int v) · 1 unmodified line
13661366 vset(S, &type, r, v);
13671367 }
13681368
1369−ST_FUNC void vpushv(TCCState *S, SValue *v)
1369+ST_FUNC void vpushv(TCCState* S, SValue *v)
13701370 {
1371− if (S->vtop >= vstack + (VSTACK_SIZE - 1))
1371+ if (S->tccgen_vtop >= vstack + (VSTACK_SIZE - 1))
13721372 tcc_error(S, "memory full (vstack)");
1373− S->vtop++;
1374− *S->vtop = *v;
1373+ S->tccgen_vtop++;
1374+ *S->tccgen_vtop = *v;
13751375 }
13761376
1377−static void vdup(TCCState *S)
1377+static void vdup(TCCState* S)
13781378 {
1379− vpushv(S, S->vtop);
1379+ vpushv(S, S->tccgen_vtop);
13801380 }
13811381
13821382 /* rotate n first stack elements to the bottom
13831383 I1 ... In -> I2 ... In I1 [top is right]
13841384 */
1385−ST_FUNC void vrotb(TCCState *S, int n)
1385+ST_FUNC void vrotb(TCCState* S, int n)
13861386 {
13871387 int i;
13881388 SValue tmp;
13891389
13901390 vcheck_cmp(S);
1391− tmp = S->vtop[-n + 1];
1391+ tmp = S->tccgen_vtop[-n + 1];
13921392 for(i=-n+1;i!=0;i++)
1393− S->vtop[i] = S->vtop[i+1];
1394− S->vtop[0] = tmp;
1393+ S->tccgen_vtop[i] = S->tccgen_vtop[i+1];
1394+ S->tccgen_vtop[0] = tmp;
13951395 }
13961396
13971397 /* rotate the n elements before entry e towards the top
13981398 I1 ... In ... -> In I1 ... I(n-1) ... [top is right]
13991399 */
1400−ST_FUNC void vrote(TCCState *S, SValue *e, int n)
1400+ST_FUNC void vrote(TCCState* S, SValue *e, int n)
14011401 {
14021402 int i;
14031403 SValue tmp;
@@ -1412,68 +1412,68 @@ ST_FUNC void vrote(TCCState *S, SValue *e, int n) · 8 unmodified lines
14121412 /* rotate n first stack elements to the top
14131413 I1 ... In -> In I1 ... I(n-1) [top is right]
14141414 */
1415−ST_FUNC void vrott(TCCState *S, int n)
1415+ST_FUNC void vrott(TCCState* S, int n)
14161416 {
1417− vrote(S, S->vtop, n);
1417+ vrote(S, S->tccgen_vtop, n);
14181418 }
14191419
14201420 /* ------------------------------------------------------------------------- */
14211421 /* vtop->r = VT_CMP means CPU-flags have been set from comparison or test. */
14221422
14231423 /* called from generators to set the result from relational ops */
1424−ST_FUNC void vset_VT_CMP(TCCState *S, int op)
1424+ST_FUNC void vset_VT_CMP(TCCState* S, int op)
14251425 {
1426− S->vtop->r = VT_CMP;
1427− S->vtop->cmp_op = op;
1428− S->vtop->jfalse = 0;
1429− S->vtop->jtrue = 0;
1426+ S->tccgen_vtop->r = VT_CMP;
1427+ S->tccgen_vtop->cmp_op = op;
1428+ S->tccgen_vtop->jfalse = 0;
1429+ S->tccgen_vtop->jtrue = 0;
14301430 }
14311431
14321432 /* called once before asking generators to load VT_CMP to a register */
1433−static void vset_VT_JMP(TCCState *S)
1433+static void vset_VT_JMP(TCCState* S)
14341434 {
1435− int op = S->vtop->cmp_op;
1435+ int op = S->tccgen_vtop->cmp_op;
14361436
1437− if (S->vtop->jtrue || S->vtop->jfalse) {
1437+ if (S->tccgen_vtop->jtrue || S->tccgen_vtop->jfalse) {
14381438 /* we need to jump to 'mov $0,%R' or 'mov $1,%R' */
14391439 int inv = op & (op < 2); /* small optimization */
14401440 vseti(S, VT_JMP+inv, gvtst(S, inv, 0));
14411441 } else {
14421442 /* otherwise convert flags (rsp. 0/1) to register */
1443− S->vtop->c.i = op;
1443+ S->tccgen_vtop->c.i = op;
14441444 if (op < 2) /* doesn't seem to happen */
1445− S->vtop->r = VT_CONST;
1445+ S->tccgen_vtop->r = VT_CONST;
14461446 }
14471447 }
14481448
14491449 /* Set CPU Flags, doesn't yet jump */
1450−static void gvtst_set(TCCState *S, int inv, int t)
1450+static void gvtst_set(TCCState* S, int inv, int t)
14511451 {
14521452 int *p;
14531453
1454− if (S->vtop->r != VT_CMP) {
1454+ if (S->tccgen_vtop->r != VT_CMP) {
14551455 vpushi(S, 0);
14561456 gen_op(S, TOK_NE);
1457− if (S->vtop->r != VT_CMP) /* must be VT_CONST then */
1458− vset_VT_CMP(S, S->vtop->c.i != 0);
1457+ if (S->tccgen_vtop->r != VT_CMP) /* must be VT_CONST then */
1458+ vset_VT_CMP(S, S->tccgen_vtop->c.i != 0);
14591459 }
14601460
1461− p = inv ? &S->vtop->jfalse : &S->vtop->jtrue;
1461+ p = inv ? &S->tccgen_vtop->jfalse : &S->tccgen_vtop->jtrue;
14621462 *p = gjmp_append(S, *p, t);
14631463 }
14641464
14651465 /* Generate value test
14661466 *
14671467 * Generate a test for any value (jump, comparison and integers) */
1468−static int gvtst(TCCState *S, int inv, int t)
1468+static int gvtst(TCCState* S, int inv, int t)
14691469 {
14701470 int op, x, u;
14711471
14721472 gvtst_set(S, inv, t);
1473− t = S->vtop->jtrue, u = S->vtop->jfalse;
1473+ t = S->tccgen_vtop->jtrue, u = S->tccgen_vtop->jfalse;
14741474 if (inv)
14751475 x = u, u = t, t = x;
1476− op = S->vtop->cmp_op;
1476+ op = S->tccgen_vtop->cmp_op;
14771477
14781478 /* jump to the wanted target */
14791479 if (op > 1)
@@ -1483,20 +1483,20 @@ static int gvtst(TCCState *S, int inv, int t) · 3 unmodified lines
14831483 /* resolve complementary jumps to here */
14841484 gsym(S, u);
14851485
1486− S->vtop--;
1486+ S->tccgen_vtop--;
14871487 return t;
14881488 }
14891489
14901490 /* generate a zero or nozero test */
1491−static void gen_test_zero(TCCState *S, int op)
1491+static void gen_test_zero(TCCState* S, int op)
14921492 {
1493− if (S->vtop->r == VT_CMP) {
1493+ if (S->tccgen_vtop->r == VT_CMP) {
14941494 int j;
14951495 if (op == TOK_EQ) {
1496− j = S->vtop->jfalse;
1497− S->vtop->jfalse = S->vtop->jtrue;
1498− S->vtop->jtrue = j;
1499− S->vtop->cmp_op ^= 1;
1496+ j = S->tccgen_vtop->jfalse;
1497+ S->tccgen_vtop->jfalse = S->tccgen_vtop->jtrue;
1498+ S->tccgen_vtop->jtrue = j;
1499+ S->tccgen_vtop->cmp_op ^= 1;
15001500 }
15011501 } else {
15021502 vpushi(S, 0);
@@ -1506,16 +1506,16 @@ static void gen_test_zero(TCCState *S, int op) · 3 unmodified lines
15061506
15071507 /* ------------------------------------------------------------------------- */
15081508 /* push a symbol value of TYPE */
1509−ST_FUNC void vpushsym(TCCState *S, CType *type, Sym *sym)
1509+ST_FUNC void vpushsym(TCCState* S, CType *type, Sym *sym)
15101510 {
15111511 CValue cval;
15121512 cval.i = 0;
15131513 vsetc(S, type, VT_CONST | VT_SYM, &cval);
1514− S->vtop->sym = sym;
1514+ S->tccgen_vtop->sym = sym;
15151515 }
15161516
15171517 /* Return a static symbol pointing to a section */
1518−ST_FUNC Sym *get_sym_ref(TCCState *S, CType *type, Section *sec, unsigned long offset, unsigned long size)
1518+ST_FUNC Sym *get_sym_ref(TCCState* S, CType *type, Section *sec, unsigned long offset, unsigned long size)
15191519 {
15201520 int v;
15211521 Sym *sym;
@@ -1528,13 +1528,13 @@ ST_FUNC Sym *get_sym_ref(TCCState *S, CType *type, Section *sec, unsigned long o · 6 unmodified lines
15281528 }
15291529
15301530 /* push a reference to a section offset by adding a dummy symbol */
1531−static void vpush_ref(TCCState *S, CType *type, Section *sec, unsigned long offset, unsigned long size)
1531+static void vpush_ref(TCCState* S, CType *type, Section *sec, unsigned long offset, unsigned long size)
15321532 {
15331533 vpushsym(S, type, get_sym_ref(S, type, sec, offset, size));
15341534 }
15351535
15361536 /* define a new external reference to a symbol 'v' of type 'u' */
1537−ST_FUNC Sym *external_global_sym(TCCState *S, int v, CType *type)
1537+ST_FUNC Sym *external_global_sym(TCCState* S, int v, CType *type)
15381538 {
15391539 Sym *s;
15401540
@@ -1553,14 +1553,14 @@ ST_FUNC Sym *external_global_sym(TCCState *S, int v, CType *type) · 12 unmodified lines
15531553
15541554 /* create an external reference with no specific type similar to asm labels.
15551555 This avoids type conflicts if the symbol is used from C too */
1556−ST_FUNC Sym *external_helper_sym(TCCState *S, int v)
1556+ST_FUNC Sym *external_helper_sym(TCCState* S, int v)
15571557 {
15581558 CType ct = { VT_ASM_FUNC, NULL };
15591559 return external_global_sym(S, v, &ct);
15601560 }
15611561
15621562 /* push a reference to an helper function (such as memmove) */
1563−ST_FUNC void vpush_helper_func(TCCState *S, int v)
1563+ST_FUNC void vpush_helper_func(TCCState* S, int v)
15641564 {
15651565 vpushsym(S, &S->tccgen_func_old_type, external_helper_sym(S, v));
15661566 }
@@ -1618,7 +1618,7 @@ static void merge_attr(AttributeDef *ad, AttributeDef *ad1) · 51 unmodified lines
16181618 }
16191619
16201620 /* Merge some type attributes. */
1621−static void patch_type(TCCState *S, Sym *sym, CType *type)
1621+static void patch_type(TCCState* S, Sym *sym, CType *type)
16221622 {
16231623 if (!(type->t & VT_EXTERN) || IS_ENUM_VAL(sym->type.t)) {
16241624 if (!(sym->type.t & VT_EXTERN))
@@ -1681,7 +1681,7 @@ static void patch_type(TCCState *S, Sym *sym, CType *type) · 56 unmodified lines
16811681 }
16821682
16831683 /* Merge some storage attributes. */
1684−static void patch_storage(TCCState *S, Sym *sym, AttributeDef *ad, CType *type)
1684+static void patch_storage(TCCState* S, Sym *sym, AttributeDef *ad, CType *type)
16851685 {
16861686 if (type)
16871687 patch_type(S, sym, type);
@@ -1698,7 +1698,7 @@ static void patch_storage(TCCState *S, Sym *sym, AttributeDef *ad, CType *type) · 10 unmodified lines
16981698 }
16991699
17001700 /* copy sym to other stack */
1701−static Sym *sym_copy(TCCState *S, Sym *s0, Sym **ps)
1701+static Sym *sym_copy(TCCState* S, Sym *s0, Sym **ps)
17021702 {
17031703 Sym *s;
17041704 s = sym_malloc(S), *s = *s0;
@@ -1711,7 +1711,7 @@ static Sym *sym_copy(TCCState *S, Sym *s0, Sym **ps) · 6 unmodified lines
17111711 }
17121712
17131713 /* copy s->type.ref to stack 'ps' for VT_FUNC and VT_PTR */
1714−static void sym_copy_ref(TCCState *S, Sym *s, Sym **ps)
1714+static void sym_copy_ref(TCCState* S, Sym *s, Sym **ps)
17151715 {
17161716 int bt = s->type.t & VT_BTYPE;
17171717 if (bt == VT_FUNC || bt == VT_PTR || (bt == VT_STRUCT && s->sym_scope)) {
@@ -1725,7 +1725,7 @@ static void sym_copy_ref(TCCState *S, Sym *s, Sym **ps) · 7 unmodified lines
17251725 }
17261726
17271727 /* define a new external reference to a symbol 'v' */
1728−static Sym *external_sym(TCCState *S, int v, CType *type, int r, AttributeDef *ad)
1728+static Sym *external_sym(TCCState* S, int v, CType *type, int r, AttributeDef *ad)
17291729 {
17301730 Sym *s;
17311731
@@ -1742,44 +1742,44 @@ static Sym *external_sym(TCCState *S, int v, CType *type, int r, AttributeDef *a · 10 unmodified lines
17421742 s->asm_label = ad->asm_label;
17431743 s->type.ref = type->ref;
17441744 /* copy type to the global stack */
1745− if (S->local_stack)
1745+ if (S->tccgen_local_stack)
17461746 sym_copy_ref(S, s, &S->tccgen_global_stack);
17471747 } else {
17481748 patch_storage(S, s, ad, type);
17491749 }
17501750 /* push variables on local_stack if any */
1751− if (S->local_stack && (s->type.t & VT_BTYPE) != VT_FUNC)
1752− s = sym_copy(S, s, &S->local_stack);
1751+ if (S->tccgen_local_stack && (s->type.t & VT_BTYPE) != VT_FUNC)
1752+ s = sym_copy(S, s, &S->tccgen_local_stack);
17531753 return s;
17541754 }
17551755
17561756 /* save registers up to (vtop - n) stack entry */
1757−ST_FUNC void save_regs(TCCState *S, int n)
1757+ST_FUNC void save_regs(TCCState* S, int n)
17581758 {
17591759 SValue *p, *p1;
1760− for(p = vstack, p1 = S->vtop - n; p <= p1; p++)
1760+ for(p = vstack, p1 = S->tccgen_vtop - n; p <= p1; p++)
17611761 save_reg(S, p->r);
17621762 }
17631763
17641764 /* save r to the memory stack, and mark it as being free */
1765−ST_FUNC void save_reg(TCCState *S, int r)
1765+ST_FUNC void save_reg(TCCState* S, int r)
17661766 {
17671767 save_reg_upstack(S, r, 0);
17681768 }
17691769
17701770 /* save r to the memory stack, and mark it as being free,
17711771 if seen up to (vtop - n) stack entry */
1772−ST_FUNC void save_reg_upstack(TCCState *S, int r, int n)
1772+ST_FUNC void save_reg_upstack(TCCState* S, int r, int n)
17731773 {
17741774 int l, size, align, bt;
17751775 SValue *p, *p1, sv;
17761776
17771777 if ((r &= VT_VALMASK) >= VT_CONST)
17781778 return;
1779− if (S->nocode_wanted)
1779+ if (S->tccgen_nocode_wanted)
17801780 return;
17811781 l = 0;
1782− for(p = vstack, p1 = S->vtop - n; p <= p1; p++) {
1782+ for(p = vstack, p1 = S->tccgen_vtop - n; p <= p1; p++) {
17831783 if ((p->r & VT_VALMASK) == r || p->r2 == r) {
17841784 /* must save value on stack if not already done */
17851785 if (!l) {
@@ -1825,7 +1825,7 @@ ST_FUNC void save_reg_upstack(TCCState *S, int r, int n) · 39 unmodified lines
18251825 #ifdef TCC_TARGET_ARM
18261826 /* find a register of class 'rc2' with at most one reference on stack.
18271827 * If none, call get_reg(rc) */
1828−ST_FUNC int get_reg_ex(TCCState *S, int rc, int rc2)
1828+ST_FUNC int get_reg_ex(TCCState* S, int rc, int rc2)
18291829 {
18301830 int r;
18311831 SValue *p;
@@ -1834,7 +1834,7 @@ ST_FUNC int get_reg_ex(TCCState *S, int rc, int rc2) · 2 unmodified lines
18341834 if (reg_classes[r] & rc2) {
18351835 int n;
18361836 n=0;
1837− for(p = vstack; p <= S->vtop; p++) {
1837+ for(p = vstack; p <= S->tccgen_vtop; p++) {
18381838 if ((p->r & VT_VALMASK) == r ||
18391839 p->r2 == r)
18401840 n++;
@@ -1848,7 +1848,7 @@ ST_FUNC int get_reg_ex(TCCState *S, int rc, int rc2) · 7 unmodified lines
18481848 #endif
18491849
18501850 /* find a free register of class 'rc'. If none, save one register */
1851−ST_FUNC int get_reg(TCCState *S, int rc)
1851+ST_FUNC int get_reg(TCCState* S, int rc)
18521852 {
18531853 int r;
18541854 SValue *p;
@@ -1856,9 +1856,9 @@ ST_FUNC int get_reg(TCCState *S, int rc) · 1 unmodified line
18561856 /* find a free register */
18571857 for(r=0;r<NB_REGS;r++) {
18581858 if (reg_classes[r] & rc) {
1859− if (S->nocode_wanted)
1859+ if (S->tccgen_nocode_wanted)
18601860 return r;
1861− for(p=vstack;p<=S->vtop;p++) {
1861+ for(p=vstack;p<=S->tccgen_vtop;p++) {
18621862 if ((p->r & VT_VALMASK) == r ||
18631863 p->r2 == r)
18641864 goto notfound;
@@ -1871,7 +1871,7 @@ ST_FUNC int get_reg(TCCState *S, int rc) · 6 unmodified lines
18711871 /* no register left : free the first one on the stack (VERY
18721872 IMPORTANT to start from the bottom to ensure that we don't
18731873 spill registers used in gen_opi()) */
1874− for(p=vstack;p<=S->vtop;p++) {
1874+ for(p=vstack;p<=S->tccgen_vtop;p++) {
18751875 /* look at second register (if long long) */
18761876 r = p->r2;
18771877 if (r < VT_CONST && (reg_classes[r] & rc))
@@ -1888,7 +1888,7 @@ ST_FUNC int get_reg(TCCState *S, int rc) · 10 unmodified lines
18881888 }
18891889
18901890 /* find a free temporary local variable (return the offset on stack) match the size and align. If none, add new temporary stack variable*/
1891−static int get_temp_local_var(TCCState *S, int size,int align){
1891+static int get_temp_local_var(TCCState* S, int size,int align){
18921892 int i;
18931893 temp_local_variable_t *temp_var;
18941894 int found_var;
@@ -1904,7 +1904,7 @@ static int get_temp_local_var(TCCState *S, int size,int align){ · 9 unmodified lines
19041904 }
19051905 /*check if temp_var is free*/
19061906 free=1;
1907− for(p=vstack;p<=S->vtop;p++) {
1907+ for(p=vstack;p<=S->tccgen_vtop;p++) {
19081908 r=p->r&VT_VALMASK;
19091909 if(r==VT_LOCAL||r==VT_LLOCAL){
19101910 if(p->c.i==temp_var->location){
@@ -1920,26 +1920,26 @@ static int get_temp_local_var(TCCState *S, int size,int align){ · 9 unmodified lines
19201920 }
19211921 }
19221922 if(!found){
1923− S->loc = (S->loc - size) & -align;
1923+ S->tccgen_loc = (S->tccgen_loc - size) & -align;
19241924 if(S->tccgen_nb_temp_local_vars<MAX_TEMP_LOCAL_VARIABLE_NUMBER){
19251925 temp_var=&S->tccgen_arr_temp_local_vars[i];
1926− temp_var->location=S->loc;
1926+ temp_var->location=S->tccgen_loc;
19271927 temp_var->size=size;
19281928 temp_var->align=align;
19291929 S->tccgen_nb_temp_local_vars++;
19301930 }
1931− found_var=S->loc;
1931+ found_var=S->tccgen_loc;
19321932 }
19331933 return found_var;
19341934 }
19351935
1936−static void clear_temp_local_var_list(TCCState *S){
1936+static void clear_temp_local_var_list(TCCState* S){
19371937 S->tccgen_nb_temp_local_vars=0;
19381938 }
19391939
19401940 /* move register 's' (of type 't') to 'r', and flush previous value of r to memory
19411941 if needed */
1942−static void move_reg(TCCState *S, int r, int s, int t)
1942+static void move_reg(TCCState* S, int r, int s, int t)
19431943 {
19441944 SValue sv;
19451945
@@ -1954,49 +1954,49 @@ static void move_reg(TCCState *S, int r, int s, int t) · 8 unmodified lines
19541954 }
19551955
19561956 /* get address of vtop (vtop MUST BE an lvalue) */
1957−ST_FUNC void gaddrof(TCCState *S)
1957+ST_FUNC void gaddrof(TCCState* S)
19581958 {
1959− S->vtop->r &= ~VT_LVAL;
1959+ S->tccgen_vtop->r &= ~VT_LVAL;
19601960 /* tricky: if saved lvalue, then we can go back to lvalue */
1961− if ((S->vtop->r & VT_VALMASK) == VT_LLOCAL)
1962− S->vtop->r = (S->vtop->r & ~VT_VALMASK) | VT_LOCAL | VT_LVAL;
1961+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_LLOCAL)
1962+ S->tccgen_vtop->r = (S->tccgen_vtop->r & ~VT_VALMASK) | VT_LOCAL | VT_LVAL;
19631963 }
19641964
19651965 #ifdef CONFIG_TCC_BCHECK
19661966 /* generate a bounded pointer addition */
1967−static void gen_bounded_ptr_add(TCCState *S)
1967+static void gen_bounded_ptr_add(TCCState* S)
19681968 {
1969− int save = (S->vtop[-1].r & VT_VALMASK) == VT_LOCAL;
1969+ int save = (S->tccgen_vtop[-1].r & VT_VALMASK) == VT_LOCAL;
19701970 if (save) {
1971− vpushv(S, &S->vtop[-1]);
1971+ vpushv(S, &S->tccgen_vtop[-1]);
19721972 vrott(S, 3);
19731973 }
19741974 vpush_helper_func(S, TOK___bound_ptr_add);
19751975 vrott(S, 3);
19761976 gfunc_call(S, 2);
1977− S->vtop -= save;
1977+ S->tccgen_vtop -= save;
19781978 vpushi(S, 0);
19791979 /* returned pointer is in REG_IRET */
1980− S->vtop->r = REG_IRET | VT_BOUNDED;
1981− if (S->nocode_wanted)
1980+ S->tccgen_vtop->r = REG_IRET | VT_BOUNDED;
1981+ if (S->tccgen_nocode_wanted)
19821982 return;
19831983 /* relocation offset of the bounding function call point */
1984− S->vtop->c.i = (cur_text_section->reloc->data_offset - sizeof(ElfW_Rel));
1984+ S->tccgen_vtop->c.i = (cur_text_section->reloc->data_offset - sizeof(ElfW_Rel));
19851985 }
19861986
19871987 /* patch pointer addition in vtop so that pointer dereferencing is
19881988 also tested */
1989−static void gen_bounded_ptr_deref(TCCState *S)
1989+static void gen_bounded_ptr_deref(TCCState* S)
19901990 {
19911991 addr_t func;
19921992 int size, align;
19931993 ElfW_Rel *rel;
19941994 Sym *sym;
19951995
1996− if (S->nocode_wanted)
1996+ if (S->tccgen_nocode_wanted)
19971997 return;
19981998
1999− size = type_size(&S->vtop->type, &align);
1999+ size = type_size(&S->tccgen_vtop->type, &align);
20002000 switch(size) {
20012001 case 1: func = TOK___bound_ptr_indir1; break;
20022002 case 2: func = TOK___bound_ptr_indir2; break;
@@ -2013,28 +2013,28 @@ static void gen_bounded_ptr_deref(TCCState *S) · 10 unmodified lines
20132013 put_extern_sym(S, sym, NULL, 0, 0);
20142014 /* patch relocation */
20152015 /* XXX: find a better solution ? */
2016− rel = (ElfW_Rel *)(cur_text_section->reloc->data + S->vtop->c.i);
2016+ rel = (ElfW_Rel *)(cur_text_section->reloc->data + S->tccgen_vtop->c.i);
20172017 rel->r_info = ELFW(R_INFO)(sym->c, ELFW(R_TYPE)(rel->r_info));
20182018 }
20192019
20202020 /* generate lvalue bound code */
2021−static void gbound(TCCState *S)
2021+static void gbound(TCCState* S)
20222022 {
20232023 CType type1;
20242024
2025− S->vtop->r &= ~VT_MUSTBOUND;
2025+ S->tccgen_vtop->r &= ~VT_MUSTBOUND;
20262026 /* if lvalue, then use checking code before dereferencing */
2027− if (S->vtop->r & VT_LVAL) {
2027+ if (S->tccgen_vtop->r & VT_LVAL) {
20282028 /* if not VT_BOUNDED value, then make one */
2029− if (!(S->vtop->r & VT_BOUNDED)) {
2029+ if (!(S->tccgen_vtop->r & VT_BOUNDED)) {
20302030 /* must save type because we must set it to int to get pointer */
2031− type1 = S->vtop->type;
2032− S->vtop->type.t = VT_PTR;
2031+ type1 = S->tccgen_vtop->type;
2032+ S->tccgen_vtop->type.t = VT_PTR;
20332033 gaddrof(S);
20342034 vpushi(S, 0);
20352035 gen_bounded_ptr_add(S);
2036− S->vtop->r |= VT_LVAL;
2037− S->vtop->type = type1;
2036+ S->tccgen_vtop->r |= VT_LVAL;
2037+ S->tccgen_vtop->type = type1;
20382038 }
20392039 /* then check for dereferencing */
20402040 gen_bounded_ptr_deref(S);
@@ -2043,19 +2043,19 @@ static void gbound(TCCState *S) · 2 unmodified lines
20432043
20442044 /* we need to call __bound_ptr_add before we start to load function
20452045 args into registers */
2046−ST_FUNC void gbound_args(TCCState *S, int nb_args)
2046+ST_FUNC void gbound_args(TCCState* S, int nb_args)
20472047 {
20482048 int i, v;
20492049 SValue *sv;
20502050
20512051 for (i = 1; i <= nb_args; ++i)
2052− if (S->vtop[1 - i].r & VT_MUSTBOUND) {
2052+ if (S->tccgen_vtop[1 - i].r & VT_MUSTBOUND) {
20532053 vrotb(S, i);
20542054 gbound(S);
20552055 vrott(S, i);
20562056 }
20572057
2058− sv = S->vtop - nb_args;
2058+ sv = S->tccgen_vtop - nb_args;
20592059 if (sv->r & VT_SYM) {
20602060 v = sv->sym->v;
20612061 if (v == TOK_setjmp
@@ -2082,7 +2082,7 @@ ST_FUNC void gbound_args(TCCState *S, int nb_args) · 20 unmodified lines
20822082 }
20832083
20842084 /* Add bounds for local symbols from S to E (via ->prev) */
2085−static void add_local_bounds(TCCState *S, Sym *s, Sym *e)
2085+static void add_local_bounds(TCCState* S, Sym *s, Sym *e)
20862086 {
20872087 for (; s != e; s = s->prev) {
20882088 if (!s->v || (s->r & VT_VALMASK) != VT_LOCAL)
@@ -2103,32 +2103,32 @@ static void add_local_bounds(TCCState *S, Sym *s, Sym *e) · 14 unmodified lines
21032103 #endif
21042104
21052105 /* Wrapper around sym_pop, that potentially also registers local bounds. */
2106−static void pop_local_syms(TCCState *S, Sym *b, int keep)
2106+static void pop_local_syms(TCCState* S, Sym *b, int keep)
21072107 {
21082108 #ifdef CONFIG_TCC_BCHECK
2109− if (S->do_bounds_check && !keep && (S->local_scope || !S->tccgen_func_var))
2110− add_local_bounds(S, S->local_stack, b);
2109+ if (S->do_bounds_check && !keep && (S->tccgen_local_scope || !S->tccgen_func_var))
2110+ add_local_bounds(S, S->tccgen_local_stack, b);
21112111 #endif
21122112 if (S->tccgen_debug_modes)
2113− tcc_add_debug_info (S, !S->local_scope, S->local_stack, b);
2114− sym_pop(S, &S->local_stack, b, keep);
2113+ tcc_add_debug_info (S, !S->tccgen_local_scope, S->tccgen_local_stack, b);
2114+ sym_pop(S, &S->tccgen_local_stack, b, keep);
21152115 }
21162116
2117−static void incr_bf_adr(TCCState *S, int o)
2117+static void incr_bf_adr(TCCState* S, int o)
21182118 {
2119− S->vtop->type = S->char_pointer_type;
2119+ S->tccgen_vtop->type = S->tccgen_char_pointer_type;
21202120 gaddrof(S);
21212121 vpushs(S, o);
21222122 gen_op(S, '+');
2123− S->vtop->type.t = VT_BYTE | VT_UNSIGNED;
2124− S->vtop->r |= VT_LVAL;
2123+ S->tccgen_vtop->type.t = VT_BYTE | VT_UNSIGNED;
2124+ S->tccgen_vtop->r |= VT_LVAL;
21252125 }
21262126
21272127 /* single-byte load mode for packed or otherwise unaligned bitfields */
2128−static void load_packed_bf(TCCState *S, CType *type, int bit_pos, int bit_size)
2128+static void load_packed_bf(TCCState* S, CType *type, int bit_pos, int bit_size)
21292129 {
21302130 int n, o, bits;
2131− save_reg_upstack(S, S->vtop->r, 1);
2131+ save_reg_upstack(S, S->tccgen_vtop->r, 1);
21322132 vpush64(S, type->t & VT_BTYPE, 0); // B X
21332133 bits = 0, o = bit_pos >> 3, bit_pos &= 7;
21342134 do {
@@ -2158,12 +2158,12 @@ static void load_packed_bf(TCCState *S, CType *type, int bit_pos, int bit_size) · 23 unmodified lines
21582158 }
21592159
21602160 /* single-byte store mode for packed or otherwise unaligned bitfields */
2161−static void store_packed_bf(TCCState *S, int bit_pos, int bit_size)
2161+static void store_packed_bf(TCCState* S, int bit_pos, int bit_size)
21622162 {
21632163 int bits, n, o, m, c;
2164− c = (S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
2164+ c = (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
21652165 vswap(S); // X B
2166− save_reg_upstack(S, S->vtop->r, 1);
2166+ save_reg_upstack(S, S->tccgen_vtop->r, 1);
21672167 bits = 0, o = bit_pos >> 3, bit_pos &= 7;
21682168 do {
21692169 incr_bf_adr(S, o); // X B
@@ -2180,12 +2180,12 @@ static void store_packed_bf(TCCState *S, int bit_pos, int bit_size) · 10 unmodified lines
21802180 if (n < 8) {
21812181 m = ((1 << n) - 1) << bit_pos;
21822182 vpushi(S, m), gen_op(S, '&'); // X B V1
2183− vpushv(S, S->vtop-1); // X B V1 B
2183+ vpushv(S, S->tccgen_vtop-1); // X B V1 B
21842184 vpushi(S, m & 0x80 ? ~m & 0x7f : ~m);
21852185 gen_op(S, '&'); // X B V1 B1
21862186 gen_op(S, '|'); // X B V2
21872187 }
2188− vdup(S), S->vtop[-1] = S->vtop[-2]; // X B B V2
2188+ vdup(S), S->tccgen_vtop[-1] = S->tccgen_vtop[-2]; // X B B V2
21892189 vstore(S), vpop(S); // X B
21902190 bits += n, bit_size -= n, bit_pos = 0, o = 1;
21912191 } while (bit_size);
@@ -2208,28 +2208,28 @@ static int adjust_bf(SValue *sv, int bit_pos, int bit_size) · 16 unmodified lines
22082208 /* store vtop a register belonging to class 'rc'. lvalues are
22092209 converted to values. Cannot be used if cannot be converted to
22102210 register value (such as structures). */
2211−ST_FUNC int gv(TCCState *S, int rc)
2211+ST_FUNC int gv(TCCState* S, int rc)
22122212 {
22132213 int r, r2, r_ok, r2_ok, rc2, bt;
22142214 int bit_pos, bit_size, size, align;
22152215
22162216 /* NOTE: get_reg can modify vstack[] */
2217− if (S->vtop->type.t & VT_BITFIELD) {
2217+ if (S->tccgen_vtop->type.t & VT_BITFIELD) {
22182218 CType type;
22192219
2220− bit_pos = BIT_POS(S->vtop->type.t);
2221− bit_size = BIT_SIZE(S->vtop->type.t);
2220+ bit_pos = BIT_POS(S->tccgen_vtop->type.t);
2221+ bit_size = BIT_SIZE(S->tccgen_vtop->type.t);
22222222 /* remove bit field info to avoid loops */
2223− S->vtop->type.t &= ~VT_STRUCT_MASK;
2223+ S->tccgen_vtop->type.t &= ~VT_STRUCT_MASK;
22242224
22252225 type.ref = NULL;
2226− type.t = S->vtop->type.t & VT_UNSIGNED;
2227− if ((S->vtop->type.t & VT_BTYPE) == VT_BOOL)
2226+ type.t = S->tccgen_vtop->type.t & VT_UNSIGNED;
2227+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_BOOL)
22282228 type.t |= VT_UNSIGNED;
22292229
2230− r = adjust_bf(S->vtop, bit_pos, bit_size);
2230+ r = adjust_bf(S->tccgen_vtop, bit_pos, bit_size);
22312231
2232− if ((S->vtop->type.t & VT_BTYPE) == VT_LLONG)
2232+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG)
22332233 type.t |= VT_LLONG;
22342234 else
22352235 type.t |= VT_INT;
@@ -2249,27 +2249,27 @@ ST_FUNC int gv(TCCState *S, int rc) · 13 unmodified lines
22492249 }
22502250 r = gv(S, rc);
22512251 } else {
2252− if (is_float(S->vtop->type.t) &&
2253− (S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
2252+ if (is_float(S->tccgen_vtop->type.t) &&
2253+ (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
22542254 /* CPUs usually cannot use float constants, so we store them
22552255 generically in data segment */
22562256 init_params p = { rodata_section };
22572257 unsigned long offset;
2258− size = type_size(&S->vtop->type, &align);
2258+ size = type_size(&S->tccgen_vtop->type, &align);
22592259 if (NODATA_WANTED)
22602260 size = 0, align = 1;
22612261 offset = section_add(S, p.sec, size, align);
2262− vpush_ref(S, &S->vtop->type, p.sec, offset, size);
2262+ vpush_ref(S, &S->tccgen_vtop->type, p.sec, offset, size);
22632263 vswap(S);
2264− init_putv(S, &p, &S->vtop->type, offset);
2265− S->vtop->r |= VT_LVAL;
2264+ init_putv(S, &p, &S->tccgen_vtop->type, offset);
2265+ S->tccgen_vtop->r |= VT_LVAL;
22662266 }
22672267 #ifdef CONFIG_TCC_BCHECK
2268− if (S->vtop->r & VT_MUSTBOUND)
2268+ if (S->tccgen_vtop->r & VT_MUSTBOUND)
22692269 gbound(S);
22702270 #endif
22712271
2272− bt = S->vtop->type.t & VT_BTYPE;
2272+ bt = S->tccgen_vtop->type.t & VT_BTYPE;
22732273
22742274 #ifdef TCC_TARGET_RISCV64
22752275 /* XXX mega hack */
@@ -2282,91 +2282,91 @@ ST_FUNC int gv(TCCState *S, int rc) · 6 unmodified lines
22822282 - constant
22832283 - lvalue (need to dereference pointer)
22842284 - already a register, but not in the right class */
2285− r = S->vtop->r & VT_VALMASK;
2286− r_ok = !(S->vtop->r & VT_LVAL) && (r < VT_CONST) && (reg_classes[r] & rc);
2287− r2_ok = !rc2 || ((S->vtop->r2 < VT_CONST) && (reg_classes[S->vtop->r2] & rc2));
2285+ r = S->tccgen_vtop->r & VT_VALMASK;
2286+ r_ok = !(S->tccgen_vtop->r & VT_LVAL) && (r < VT_CONST) && (reg_classes[r] & rc);
2287+ r2_ok = !rc2 || ((S->tccgen_vtop->r2 < VT_CONST) && (reg_classes[S->tccgen_vtop->r2] & rc2));
22882288
22892289 if (!r_ok || !r2_ok) {
22902290 if (!r_ok)
22912291 r = get_reg(S, rc);
22922292 if (rc2) {
22932293 int load_type = (bt == VT_QFLOAT) ? VT_DOUBLE : VT_PTRDIFF_T;
2294− int original_type = S->vtop->type.t;
2294+ int original_type = S->tccgen_vtop->type.t;
22952295
22962296 /* two register type load :
22972297 expand to two words temporarily */
2298− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
2298+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
22992299 /* load constant */
2300− unsigned long long ll = S->vtop->c.i;
2301− S->vtop->c.i = ll; /* first word */
2302− load(S, r, S->vtop);
2303− S->vtop->r = r; /* save register value */
2300+ unsigned long long ll = S->tccgen_vtop->c.i;
2301+ S->tccgen_vtop->c.i = ll; /* first word */
2302+ load(S, r, S->tccgen_vtop);
2303+ S->tccgen_vtop->r = r; /* save register value */
23042304 vpushi(S, ll >> 32); /* second word */
2305− } else if (S->vtop->r & VT_LVAL) {
2305+ } else if (S->tccgen_vtop->r & VT_LVAL) {
23062306 /* We do not want to modifier the long long pointer here.
23072307 So we save any other instances down the stack */
2308− save_reg_upstack(S, S->vtop->r, 1);
2308+ save_reg_upstack(S, S->tccgen_vtop->r, 1);
23092309 /* load from memory */
2310− S->vtop->type.t = load_type;
2311− load(S, r, S->vtop);
2310+ S->tccgen_vtop->type.t = load_type;
2311+ load(S, r, S->tccgen_vtop);
23122312 vdup(S);
2313− S->vtop[-1].r = r; /* save register value */
2313+ S->tccgen_vtop[-1].r = r; /* save register value */
23142314 /* increment pointer to get second word */
2315− S->vtop->type.t = VT_PTRDIFF_T;
2315+ S->tccgen_vtop->type.t = VT_PTRDIFF_T;
23162316 gaddrof(S);
23172317 vpushs(S, PTR_SIZE);
23182318 gen_op(S, '+');
2319− S->vtop->r |= VT_LVAL;
2320− S->vtop->type.t = load_type;
2319+ S->tccgen_vtop->r |= VT_LVAL;
2320+ S->tccgen_vtop->type.t = load_type;
23212321 } else {
23222322 /* move registers */
23232323 if (!r_ok)
2324− load(S, r, S->vtop);
2325− if (r2_ok && S->vtop->r2 < VT_CONST)
2324+ load(S, r, S->tccgen_vtop);
2325+ if (r2_ok && S->tccgen_vtop->r2 < VT_CONST)
23262326 goto done;
23272327 vdup(S);
2328− S->vtop[-1].r = r; /* save register value */
2329− S->vtop->r = S->vtop[-1].r2;
2328+ S->tccgen_vtop[-1].r = r; /* save register value */
2329+ S->tccgen_vtop->r = S->tccgen_vtop[-1].r2;
23302330 }
23312331 /* Allocate second register. Here we rely on the fact that
23322332 get_reg() tries first to free r2 of an SValue. */
23332333 r2 = get_reg(S, rc2);
2334− load(S, r2, S->vtop);
2334+ load(S, r2, S->tccgen_vtop);
23352335 vpop(S);
23362336 /* write second register */
2337− S->vtop->r2 = r2;
2337+ S->tccgen_vtop->r2 = r2;
23382338 done:
2339− S->vtop->type.t = original_type;
2339+ S->tccgen_vtop->type.t = original_type;
23402340 } else {
2341− if (S->vtop->r == VT_CMP)
2341+ if (S->tccgen_vtop->r == VT_CMP)
23422342 vset_VT_JMP(S);
23432343 /* one register type load */
2344− load(S, r, S->vtop);
2344+ load(S, r, S->tccgen_vtop);
23452345 }
23462346 }
2347− S->vtop->r = r;
2347+ S->tccgen_vtop->r = r;
23482348 #ifdef TCC_TARGET_C67
23492349 /* uses register pairs for doubles */
23502350 if (bt == VT_DOUBLE)
2351− S->vtop->r2 = r+1;
2351+ S->tccgen_vtop->r2 = r+1;
23522352 #endif
23532353 }
23542354 return r;
23552355 }
23562356
23572357 /* generate vtop[-1] and vtop[0] in resp. classes rc1 and rc2 */
2358−ST_FUNC void gv2(TCCState *S, int rc1, int rc2)
2358+ST_FUNC void gv2(TCCState* S, int rc1, int rc2)
23592359 {
23602360 /* generate more generic register first. But VT_JMP or VT_CMP
23612361 values must be generated first in all cases to avoid possible
23622362 reload errors */
2363− if (S->vtop->r != VT_CMP && rc1 <= rc2) {
2363+ if (S->tccgen_vtop->r != VT_CMP && rc1 <= rc2) {
23642364 vswap(S);
23652365 gv(S, rc1);
23662366 vswap(S);
23672367 gv(S, rc2);
23682368 /* test if reload is needed for first register */
2369− if ((S->vtop[-1].r & VT_VALMASK) >= VT_CONST) {
2369+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) >= VT_CONST) {
23702370 vswap(S);
23712371 gv(S, rc1);
23722372 vswap(S);
@@ -2377,7 +2377,7 @@ ST_FUNC void gv2(TCCState *S, int rc1, int rc2) · 4 unmodified lines
23772377 gv(S, rc1);
23782378 vswap(S);
23792379 /* test if reload is needed for first register */
2380− if ((S->vtop[0].r & VT_VALMASK) >= VT_CONST) {
2380+ if ((S->tccgen_vtop[0].r & VT_VALMASK) >= VT_CONST) {
23812381 gv(S, rc2);
23822382 }
23832383 }
@@ -2385,50 +2385,50 @@ ST_FUNC void gv2(TCCState *S, int rc1, int rc2) · 1 unmodified line
23852385
23862386 #if PTR_SIZE == 4
23872387 /* expand 64bit on stack in two ints */
2388−ST_FUNC void lexpand(TCCState *S)
2388+ST_FUNC void lexpand(TCCState* S)
23892389 {
23902390 int u, v;
2391− u = S->vtop->type.t & (VT_DEFSIGN | VT_UNSIGNED);
2392− v = S->vtop->r & (VT_VALMASK | VT_LVAL);
2391+ u = S->tccgen_vtop->type.t & (VT_DEFSIGN | VT_UNSIGNED);
2392+ v = S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL);
23932393 if (v == VT_CONST) {
23942394 vdup(S);
2395− S->vtop[0].c.i >>= 32;
2395+ S->tccgen_vtop[0].c.i >>= 32;
23962396 } else if (v == (VT_LVAL|VT_CONST) || v == (VT_LVAL|VT_LOCAL)) {
23972397 vdup(S);
2398− S->vtop[0].c.i += 4;
2398+ S->tccgen_vtop[0].c.i += 4;
23992399 } else {
24002400 gv(S, RC_INT);
24012401 vdup(S);
2402− S->vtop[0].r = S->vtop[-1].r2;
2403− S->vtop[0].r2 = S->vtop[-1].r2 = VT_CONST;
2402+ S->tccgen_vtop[0].r = S->tccgen_vtop[-1].r2;
2403+ S->tccgen_vtop[0].r2 = S->tccgen_vtop[-1].r2 = VT_CONST;
24042404 }
2405− S->vtop[0].type.t = S->vtop[-1].type.t = VT_INT | u;
2405+ S->tccgen_vtop[0].type.t = S->tccgen_vtop[-1].type.t = VT_INT | u;
24062406 }
24072407 #endif
24082408
24092409 #if PTR_SIZE == 4
24102410 /* build a long long from two ints */
2411−static void lbuild(TCCState *S, int t)
2411+static void lbuild(TCCState* S, int t)
24122412 {
24132413 gv2(S, RC_INT, RC_INT);
2414− S->vtop[-1].r2 = S->vtop[0].r;
2415− S->vtop[-1].type.t = t;
2414+ S->tccgen_vtop[-1].r2 = S->tccgen_vtop[0].r;
2415+ S->tccgen_vtop[-1].type.t = t;
24162416 vpop(S);
24172417 }
24182418 #endif
24192419
24202420 /* convert stack entry to register and duplicate its value in another
24212421 register */
2422−static void gv_dup(TCCState *S)
2422+static void gv_dup(TCCState* S)
24232423 {
24242424 int t, rc, r;
24252425
2426− t = S->vtop->type.t;
2426+ t = S->tccgen_vtop->type.t;
24272427 #if PTR_SIZE == 4
24282428 if ((t & VT_BTYPE) == VT_LLONG) {
24292429 if (t & VT_BITFIELD) {
24302430 gv(S, RC_INT);
2431− t = S->vtop->type.t;
2431+ t = S->tccgen_vtop->type.t;
24322432 }
24332433 lexpand(S);
24342434 gv_dup(S);
@@ -2451,13 +2451,13 @@ static void gv_dup(TCCState *S) · 16 unmodified lines
24512451 gv(S, rc);
24522452 r = get_reg(S, rc);
24532453 vdup(S);
2454− load(S, r, S->vtop);
2455− S->vtop->r = r;
2454+ load(S, r, S->tccgen_vtop);
2455+ S->tccgen_vtop->r = r;
24562456 }
24572457
24582458 #if PTR_SIZE == 4
24592459 /* generate CPU independent (unsigned) long long operations */
2460−static void gen_opl(TCCState *S, int op)
2460+static void gen_opl(TCCState* S, int op)
24612461 {
24622462 int t, a, b, op1, c, i;
24632463 int func;
@@ -2489,8 +2489,8 @@ static void gen_opl(TCCState *S, int op) · 25 unmodified lines
24892489 vrott(S, 3);
24902490 gfunc_call(S, 2);
24912491 vpushi(S, 0);
2492− S->vtop->r = reg_iret;
2493− S->vtop->r2 = reg_lret;
2492+ S->tccgen_vtop->r = reg_iret;
2493+ S->tccgen_vtop->r2 = reg_lret;
24942494 break;
24952495 case '^':
24962496 case '&':
@@ -2499,33 +2499,33 @@ static void gen_opl(TCCState *S, int op) · 2 unmodified lines
24992499 case '+':
25002500 case '-':
25012501 //pv("gen_opl A",0,2);
2502− t = S->vtop->type.t;
2502+ t = S->tccgen_vtop->type.t;
25032503 vswap(S);
25042504 lexpand(S);
25052505 vrotb(S, 3);
25062506 lexpand(S);
25072507 /* stack: L1 H1 L2 H2 */
2508− tmp = S->vtop[0];
2509− S->vtop[0] = S->vtop[-3];
2510− S->vtop[-3] = tmp;
2511− tmp = S->vtop[-2];
2512− S->vtop[-2] = S->vtop[-3];
2513− S->vtop[-3] = tmp;
2508+ tmp = S->tccgen_vtop[0];
2509+ S->tccgen_vtop[0] = S->tccgen_vtop[-3];
2510+ S->tccgen_vtop[-3] = tmp;
2511+ tmp = S->tccgen_vtop[-2];
2512+ S->tccgen_vtop[-2] = S->tccgen_vtop[-3];
2513+ S->tccgen_vtop[-3] = tmp;
25142514 vswap(S);
25152515 /* stack: H1 H2 L1 L2 */
25162516 //pv("gen_opl B",0,4);
25172517 if (op == '*') {
2518− vpushv(S, S->vtop - 1);
2519− vpushv(S, S->vtop - 1);
2518+ vpushv(S, S->tccgen_vtop - 1);
2519+ vpushv(S, S->tccgen_vtop - 1);
25202520 gen_op(S, TOK_UMULL);
25212521 lexpand(S);
25222522 /* stack: H1 H2 L1 L2 ML MH */
25232523 for(i=0;i<4;i++)
25242524 vrotb(S, 6);
25252525 /* stack: ML MH H1 H2 L1 L2 */
2526− tmp = S->vtop[0];
2527− S->vtop[0] = S->vtop[-2];
2528− S->vtop[-2] = tmp;
2526+ tmp = S->tccgen_vtop[0];
2527+ S->tccgen_vtop[0] = S->tccgen_vtop[-2];
2528+ S->tccgen_vtop[-2] = tmp;
25292529 /* stack: ML MH H1 L2 H2 L1 */
25302530 gen_op(S, '*');
25312531 vrotb(S, 3);
@@ -2560,13 +2560,13 @@ static void gen_opl(TCCState *S, int op) · 28 unmodified lines
25602560 case TOK_SAR:
25612561 case TOK_SHR:
25622562 case TOK_SHL:
2563− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
2564− t = S->vtop[-1].type.t;
2563+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
2564+ t = S->tccgen_vtop[-1].type.t;
25652565 vswap(S);
25662566 lexpand(S);
25672567 vrotb(S, 3);
25682568 /* stack: L H shift */
2569− c = (int)S->vtop->c.i;
2569+ c = (int)S->tccgen_vtop->c.i;
25702570 /* constant: simpler */
25712571 /* NOTE: all comments are for SHL. the other cases are
25722572 done by swapping words */
@@ -2629,15 +2629,15 @@ static void gen_opl(TCCState *S, int op) · 56 unmodified lines
26292629 break;
26302630 default:
26312631 /* compare operations */
2632− t = S->vtop->type.t;
2632+ t = S->tccgen_vtop->type.t;
26332633 vswap(S);
26342634 lexpand(S);
26352635 vrotb(S, 3);
26362636 lexpand(S);
26372637 /* stack: L1 H1 L2 H2 */
2638− tmp = S->vtop[-1];
2639− S->vtop[-1] = S->vtop[-2];
2640− S->vtop[-2] = tmp;
2638+ tmp = S->tccgen_vtop[-1];
2639+ S->tccgen_vtop[-1] = S->tccgen_vtop[-2];
2640+ S->tccgen_vtop[-2] = tmp;
26412641 /* stack: L1 L2 H1 H2 */
26422642 save_regs(S, 4);
26432643 /* compare high */
@@ -2701,10 +2701,10 @@ static int gen_opic_lt(uint64_t a, uint64_t b) · 57 unmodified lines
27012701
27022702 /* handle integer constant optimizations and various machine
27032703 independent opt */
2704−static void gen_opic(TCCState *S, int op)
2704+static void gen_opic(TCCState* S, int op)
27052705 {
2706− SValue *v1 = S->vtop - 1;
2707− SValue *v2 = S->vtop;
2706+ SValue *v1 = S->tccgen_vtop - 1;
2707+ SValue *v2 = S->tccgen_vtop;
27082708 int t1 = v1->type.t & VT_BTYPE;
27092709 int t2 = v2->type.t & VT_BTYPE;
27102710 int c1 = (v1->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
@@ -2736,7 +2736,7 @@ static void gen_opic(TCCState *S, int op) · 25 unmodified lines
27362736 case TOK_UMOD:
27372737 /* if division by zero, generate explicit division */
27382738 if (l2 == 0) {
2739− if (S->tccgen_const_wanted && !(S->nocode_wanted & unevalmask))
2739+ if (S->tccgen_const_wanted && !(S->tccgen_nocode_wanted & unevalmask))
27402740 tcc_error(S, "division by zero in constant");
27412741 goto general_case;
27422742 }
@@ -2773,7 +2773,7 @@ static void gen_opic(TCCState *S, int op) · 30 unmodified lines
27732773 l1 = ((uint32_t)l1 |
27742774 (v1->type.t & VT_UNSIGNED ? 0 : -(l1 & 0x80000000)));
27752775 v1->c.i = l1;
2776− S->vtop--;
2776+ S->tccgen_vtop--;
27772777 } else {
27782778 /* if commutative ops, put c2 as constant */
27792779 if (c1 && (op == '+' || op == '&' || op == '^' ||
@@ -2787,7 +2787,7 @@ static void gen_opic(TCCState *S, int op) · 7 unmodified lines
27872787 (op == TOK_SHL || op == TOK_SHR || op == TOK_SAR)) ||
27882788 (l1 == -1 && op == TOK_SAR))) {
27892789 /* treat (0 << x), (0 >> x) and (-1 >> x) as constant */
2790− S->vtop--;
2790+ S->tccgen_vtop--;
27912791 } else if (!S->tccgen_const_wanted &&
27922792 c2 && ((l2 == 0 && (op == '&' || op == '*')) ||
27932793 (op == '|' &&
@@ -2795,9 +2795,9 @@ static void gen_opic(TCCState *S, int op) · 1 unmodified line
27952795 (l2 == 1 && (op == '%' || op == TOK_UMOD)))) {
27962796 /* treat (x & 0), (x * 0), (x | -1) and (x % 1) as constant */
27972797 if (l2 == 1)
2798− S->vtop->c.i = 0;
2798+ S->tccgen_vtop->c.i = 0;
27992799 vswap(S);
2800− S->vtop--;
2800+ S->tccgen_vtop--;
28012801 } else if (c2 && (((op == '*' || op == '/' || op == TOK_UDIV ||
28022802 op == TOK_PDIV) &&
28032803 l2 == 1) ||
@@ -2807,7 +2807,7 @@ static void gen_opic(TCCState *S, int op) · 3 unmodified lines
28072807 (op == '&' &&
28082808 (l2 == -1 || (l2 == 0xFFFFFFFF && t2 != VT_LLONG))))) {
28092809 /* filter out NOP operations like x*1, x-0, x&-1... */
2810− S->vtop--;
2810+ S->tccgen_vtop--;
28112811 } else if (c2 && (op == '*' || op == TOK_PDIV || op == TOK_UDIV)) {
28122812 /* try to use shifts instead of muls or divs */
28132813 if (l2 > 0 && (l2 & (l2 - 1)) == 0) {
@@ -2816,7 +2816,7 @@ static void gen_opic(TCCState *S, int op) · 2 unmodified lines
28162816 l2 >>= 1;
28172817 n++;
28182818 }
2819− S->vtop->c.i = n;
2819+ S->tccgen_vtop->c.i = n;
28202820 if (op == '*')
28212821 op = TOK_SHL;
28222822 else if (op == TOK_PDIV)
@@ -2826,18 +2826,18 @@ static void gen_opic(TCCState *S, int op) · 3 unmodified lines
28262826 }
28272827 goto general_case;
28282828 } else if (c2 && (op == '+' || op == '-') &&
2829− (((S->vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == (VT_CONST | VT_SYM))
2830− || (S->vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) {
2829+ (((S->tccgen_vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == (VT_CONST | VT_SYM))
2830+ || (S->tccgen_vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) {
28312831 /* symbol + constant case */
28322832 if (op == '-')
28332833 l2 = -l2;
2834− l2 += S->vtop[-1].c.i;
2834+ l2 += S->tccgen_vtop[-1].c.i;
28352835 /* The backends can't always deal with addends to symbols
28362836 larger than +-1<<31. Don't construct such. */
28372837 if ((int)l2 != l2)
28382838 goto general_case;
2839− S->vtop--;
2840− S->vtop->c.i = l2;
2839+ S->tccgen_vtop--;
2840+ S->tccgen_vtop->c.i = l2;
28412841 } else {
28422842 general_case:
28432843 /* call low level op generator */
@@ -2853,14 +2853,14 @@ static void gen_opic(TCCState *S, int op) · 9 unmodified lines
28532853 #if defined TCC_TARGET_X86_64 || defined TCC_TARGET_I386
28542854 # define gen_negf gen_opf
28552855 #elif defined TCC_TARGET_ARM
2856−void gen_negf(TCCState *S, int op)
2856+void gen_negf(TCCState* S, int op)
28572857 {
28582858 /* arm will detect 0-x and replace by vneg */
28592859 vpushi(S, 0), vswap(S), gen_op(S, '-');
28602860 }
28612861 #else
28622862 /* XXX: implement in gen_opf() for other backends too */
2863−void gen_negf(TCCState *S, int op)
2863+void gen_negf(TCCState* S, int op)
28642864 {
28652865 /* In IEEE negate(x) isn't subtract(0,x). Without NaNs it's
28662866 subtract(-0, x), but with them it's really a sign flip
@@ -2870,8 +2870,8 @@ void gen_negf(TCCState *S, int op) · 3 unmodified lines
28702870
28712871 int align, size, bt;
28722872
2873− size = type_size(&S->vtop->type, &align);
2874− bt = S->vtop->type.t & VT_BTYPE;
2873+ size = type_size(&S->tccgen_vtop->type, &align);
2874+ bt = S->tccgen_vtop->type.t & VT_BTYPE;
28752875 save_reg(S, gv(S, RC_TYPE(bt)));
28762876 vdup(S);
28772877 incr_bf_adr(S, size - 1);
@@ -2884,7 +2884,7 @@ void gen_negf(TCCState *S, int op) · 6 unmodified lines
28842884 #endif
28852885
28862886 /* generate a floating point operation with constant propagation */
2887−static void gen_opif(TCCState *S, int op)
2887+static void gen_opif(TCCState* S, int op)
28882888 {
28892889 int c1, c2;
28902890 SValue *v1, *v2;
@@ -2894,8 +2894,8 @@ static void gen_opif(TCCState *S, int op) · 3 unmodified lines
28942894 #endif
28952895 long double f1, f2;
28962896
2897− v1 = S->vtop - 1;
2898− v2 = S->vtop;
2897+ v1 = S->tccgen_vtop - 1;
2898+ v2 = S->tccgen_vtop;
28992899 if (op == TOK_NEG)
29002900 v1 = v2;
29012901
@@ -2948,7 +2948,7 @@ static void gen_opif(TCCState *S, int op) · 46 unmodified lines
29482948 default:
29492949 goto general_case;
29502950 }
2951− S->vtop--;
2951+ S->tccgen_vtop--;
29522952 unary_result:
29532953 /* XXX: overflow test ? */
29542954 if (v1->type.t == VT_FLOAT) {
@@ -2972,7 +2972,7 @@ static void gen_opif(TCCState *S, int op) · 17 unmodified lines
29722972 printed in the type */
29732973 /* XXX: union */
29742974 /* XXX: add array and function pointers */
2975−static void type_to_str(TCCState *S, char *buf, int buf_size,
2975+static void type_to_str(TCCState* S, char *buf, int buf_size,
29762976 CType *type, const char *varstr)
29772977 {
29782978 int bt, v, t;
@@ -3107,7 +3107,7 @@ static void type_to_str(TCCState *S, char *buf, int buf_size, · 128 unmodified lines
31073107 no_var: ;
31083108 }
31093109
3110−static void type_incompatibility_error(TCCState *S, CType* st, CType* dt, const char* fmt)
3110+static void type_incompatibility_error(TCCState* S, CType* st, CType* dt, const char* fmt)
31113111 {
31123112 char buf1[256], buf2[256];
31133113 type_to_str(S, buf1, sizeof(buf1), st, NULL);
@@ -3115,7 +3115,7 @@ static void type_incompatibility_error(TCCState *S, CType* st, CType* dt, const · 1 unmodified line
31153115 tcc_error(S, fmt, buf1, buf2);
31163116 }
31173117
3118−static void type_incompatibility_warning(TCCState *S, CType* st, CType* dt, const char* fmt)
3118+static void type_incompatibility_warning(TCCState* S, CType* st, CType* dt, const char* fmt)
31193119 {
31203120 char buf1[256], buf2[256];
31213121 type_to_str(S, buf1, sizeof(buf1), st, NULL);
@@ -3129,7 +3129,7 @@ static int pointed_size(CType *type) · 7 unmodified lines
31293129 return type_size(pointed_type(type), &align);
31303130 }
31313131
3132−static void vla_runtime_pointed_size(TCCState *S, CType *type)
3132+static void vla_runtime_pointed_size(TCCState* S, CType *type)
31333133 {
31343134 int align;
31353135 vla_runtime_type_size(S, pointed_type(type), &align);
@@ -3226,7 +3226,7 @@ static int compare_types(CType *type1, CType *type2, int unqualified) · 90 unmodified lines
32263226
32273227 /* Check if OP1 and OP2 can be "combined" with operation OP, the combined
32283228 type is stored in DEST if non-null (except for pointer plus/minus) . */
3229−static int combine_types(TCCState *S, CType *dest, SValue *op1, SValue *op2, int op)
3229+static int combine_types(TCCState* S, CType *dest, SValue *op1, SValue *op2, int op)
32303230 {
32313231 CType *type1 = &op1->type, *type2 = &op2->type, type;
32323232 int t1 = type1->t, t2 = type2->t, bt1 = t1 & VT_BTYPE, bt2 = t2 & VT_BTYPE;
@@ -3343,30 +3343,30 @@ static int combine_types(TCCState *S, CType *dest, SValue *op1, SValue *op2, int · 110 unmodified lines
33433343 }
33443344
33453345 /* generic gen_op: handles types problems */
3346−ST_FUNC void gen_op(TCCState *S, int op)
3346+ST_FUNC void gen_op(TCCState* S, int op)
33473347 {
33483348 int u, t1, t2, bt1, bt2, t;
33493349 CType type1, combtype;
33503350
33513351 redo:
3352− t1 = S->vtop[-1].type.t;
3353− t2 = S->vtop[0].type.t;
3352+ t1 = S->tccgen_vtop[-1].type.t;
3353+ t2 = S->tccgen_vtop[0].type.t;
33543354 bt1 = t1 & VT_BTYPE;
33553355 bt2 = t2 & VT_BTYPE;
33563356
33573357 if (bt1 == VT_FUNC || bt2 == VT_FUNC) {
33583358 if (bt2 == VT_FUNC) {
3359− mk_pointer(S, &S->vtop->type);
3359+ mk_pointer(S, &S->tccgen_vtop->type);
33603360 gaddrof(S);
33613361 }
33623362 if (bt1 == VT_FUNC) {
33633363 vswap(S);
3364− mk_pointer(S, &S->vtop->type);
3364+ mk_pointer(S, &S->tccgen_vtop->type);
33653365 gaddrof(S);
33663366 vswap(S);
33673367 }
33683368 goto redo;
3369− } else if (!combine_types(S, &combtype, S->vtop - 1, S->vtop, op)) {
3369+ } else if (!combine_types(S, &combtype, S->tccgen_vtop - 1, S->tccgen_vtop, op)) {
33703370 tcc_error_noabort(S, "invalid operand types for binary operation");
33713371 vpop(S);
33723372 } else if (bt1 == VT_PTR || bt2 == VT_PTR) {
@@ -3378,14 +3378,14 @@ redo: · 5 unmodified lines
33783378 if (bt1 == VT_PTR && bt2 == VT_PTR) {
33793379 if (op != '-')
33803380 tcc_error(S, "cannot use pointers here");
3381− if (S->vtop[-1].type.t & VT_VLA) {
3382− vla_runtime_pointed_size(S, &S->vtop[-1].type);
3381+ if (S->tccgen_vtop[-1].type.t & VT_VLA) {
3382+ vla_runtime_pointed_size(S, &S->tccgen_vtop[-1].type);
33833383 } else {
3384− vpushi(S, pointed_size(&S->vtop[-1].type));
3384+ vpushi(S, pointed_size(&S->tccgen_vtop[-1].type));
33853385 }
33863386 vrott(S, 3);
33873387 gen_opic(S, op);
3388− S->vtop->type.t = VT_PTRDIFF_T;
3388+ S->tccgen_vtop->type.t = VT_PTRDIFF_T;
33893389 vswap(S);
33903390 gen_op(S, TOK_PDIV);
33913391 } else {
@@ -3398,15 +3398,15 @@ redo: · 6 unmodified lines
33983398 t = t1, t1 = t2, t2 = t;
33993399 }
34003400 #if PTR_SIZE == 4
3401− if ((S->vtop[0].type.t & VT_BTYPE) == VT_LLONG)
3401+ if ((S->tccgen_vtop[0].type.t & VT_BTYPE) == VT_LLONG)
34023402 /* XXX: truncate here because gen_opl can't handle ptr + long long */
34033403 gen_cast_s(S, VT_INT);
34043404 #endif
3405− type1 = S->vtop[-1].type;
3406− if (S->vtop[-1].type.t & VT_VLA)
3407− vla_runtime_pointed_size(S, &S->vtop[-1].type);
3405+ type1 = S->tccgen_vtop[-1].type;
3406+ if (S->tccgen_vtop[-1].type.t & VT_VLA)
3407+ vla_runtime_pointed_size(S, &S->tccgen_vtop[-1].type);
34083408 else {
3409− u = pointed_size(&S->vtop[-1].type);
3409+ u = pointed_size(&S->tccgen_vtop[-1].type);
34103410 if (u < 0)
34113411 tcc_error(S, "unknown array element size");
34123412 #if PTR_SIZE == 8
@@ -3434,7 +3434,7 @@ redo: · 21 unmodified lines
34343434 }
34353435 type1.t &= ~VT_ARRAY;
34363436 /* put again type if gen_opic() swaped operands */
3437− S->vtop->type = type1;
3437+ S->tccgen_vtop->type = type1;
34383438 }
34393439 } else {
34403440 /* floats can only be used for a few operations */
@@ -3483,23 +3483,23 @@ redo: · 42 unmodified lines
34833483 gen_opic(S, op);
34843484 if (TOK_ISCOND(op)) {
34853485 /* relational op: the result is an int */
3486− S->vtop->type.t = VT_INT;
3486+ S->tccgen_vtop->type.t = VT_INT;
34873487 } else {
3488− S->vtop->type.t = t;
3488+ S->tccgen_vtop->type.t = t;
34893489 }
34903490 }
34913491 // Make sure that we have converted to an rvalue:
3492− if (S->vtop->r & VT_LVAL)
3493− gv(S, is_float(S->vtop->type.t & VT_BTYPE) ? RC_FLOAT : RC_INT);
3492+ if (S->tccgen_vtop->r & VT_LVAL)
3493+ gv(S, is_float(S->tccgen_vtop->type.t & VT_BTYPE) ? RC_FLOAT : RC_INT);
34943494 }
34953495
34963496 #if defined TCC_TARGET_ARM64 || defined TCC_TARGET_RISCV64 || defined TCC_TARGET_ARM
34973497 #define gen_cvt_itof1 gen_cvt_itof
34983498 #else
34993499 /* generic itof for unsigned long long case */
3500−static void gen_cvt_itof1(TCCState *S, int t)
3500+static void gen_cvt_itof1(TCCState* S, int t)
35013501 {
3502− if ((S->vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
3502+ if ((S->tccgen_vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
35033503 (VT_LLONG | VT_UNSIGNED)) {
35043504
35053505 if (t == VT_FLOAT)
@@ -3513,7 +3513,7 @@ static void gen_cvt_itof1(TCCState *S, int t) · 7 unmodified lines
35133513 vrott(S, 2);
35143514 gfunc_call(S, 1);
35153515 vpushi(S, 0);
3516− PUT_R_RET(S->vtop, t);
3516+ PUT_R_RET(S->tccgen_vtop, t);
35173517 } else {
35183518 gen_cvt_itof(S, t);
35193519 }
@@ -3524,12 +3524,12 @@ static void gen_cvt_itof1(TCCState *S, int t) · 4 unmodified lines
35243524 #define gen_cvt_ftoi1 gen_cvt_ftoi
35253525 #else
35263526 /* generic ftoi for unsigned long long case */
3527−static void gen_cvt_ftoi1(TCCState *S, int t)
3527+static void gen_cvt_ftoi1(TCCState* S, int t)
35283528 {
35293529 int st;
35303530 if (t == (VT_LLONG | VT_UNSIGNED)) {
35313531 /* not handled natively */
3532− st = S->vtop->type.t & VT_BTYPE;
3532+ st = S->tccgen_vtop->type.t & VT_BTYPE;
35333533 if (st == VT_FLOAT)
35343534 vpush_helper_func(S, TOK___fixunssfdi);
35353535 #if LDOUBLE_SIZE != 8
@@ -3541,7 +3541,7 @@ static void gen_cvt_ftoi1(TCCState *S, int t) · 5 unmodified lines
35413541 vrott(S, 2);
35423542 gfunc_call(S, 1);
35433543 vpushi(S, 0);
3544− PUT_R_RET(S->vtop, t);
3544+ PUT_R_RET(S->tccgen_vtop, t);
35453545 } else {
35463546 gen_cvt_ftoi(S, t);
35473547 }
@@ -3549,17 +3549,17 @@ static void gen_cvt_ftoi1(TCCState *S, int t) · 1 unmodified line
35493549 #endif
35503550
35513551 /* special delayed cast for char/short */
3552−static void force_charshort_cast(TCCState *S)
3552+static void force_charshort_cast(TCCState* S)
35533553 {
3554− int sbt = BFGET(S->vtop->r, VT_MUSTCAST) == 2 ? VT_LLONG : VT_INT;
3555− int dbt = S->vtop->type.t;
3556− S->vtop->r &= ~VT_MUSTCAST;
3557− S->vtop->type.t = sbt;
3554+ int sbt = BFGET(S->tccgen_vtop->r, VT_MUSTCAST) == 2 ? VT_LLONG : VT_INT;
3555+ int dbt = S->tccgen_vtop->type.t;
3556+ S->tccgen_vtop->r &= ~VT_MUSTCAST;
3557+ S->tccgen_vtop->type.t = sbt;
35583558 gen_cast_s(S, dbt == VT_BOOL ? VT_BYTE|VT_UNSIGNED : dbt);
3559− S->vtop->type.t = dbt;
3559+ S->tccgen_vtop->type.t = dbt;
35603560 }
35613561
3562−static void gen_cast_s(TCCState *S, int t)
3562+static void gen_cast_s(TCCState* S, int t)
35633563 {
35643564 CType type;
35653565 type.t = t;
@@ -3568,21 +3568,21 @@ static void gen_cast_s(TCCState *S, int t) · 2 unmodified lines
35683568 }
35693569
35703570 /* cast 'vtop' to 'type'. Casting to bitfields is forbidden. */
3571−static void gen_cast(TCCState *S, CType *type)
3571+static void gen_cast(TCCState* S, CType *type)
35723572 {
35733573 int sbt, dbt, sf, df, c;
35743574 int dbt_bt, sbt_bt, ds, ss, bits, trunc;
35753575
35763576 /* special delayed cast for char/short */
3577− if (S->vtop->r & VT_MUSTCAST)
3577+ if (S->tccgen_vtop->r & VT_MUSTCAST)
35783578 force_charshort_cast(S);
35793579
35803580 /* bitfields first get cast to ints */
3581− if (S->vtop->type.t & VT_BITFIELD)
3581+ if (S->tccgen_vtop->type.t & VT_BITFIELD)
35823582 gv(S, RC_INT);
35833583
35843584 dbt = type->t & (VT_BTYPE | VT_UNSIGNED);
3585− sbt = S->vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
3585+ sbt = S->tccgen_vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
35863586 if (sbt == VT_FUNC)
35873587 sbt = VT_PTR;
35883588
@@ -3596,71 +3596,71 @@ again: · 7 unmodified lines
35963596 goto done;
35973597 if (sbt_bt == VT_VOID) {
35983598 error:
3599− cast_error(S, &S->vtop->type, type);
3599+ cast_error(S, &S->tccgen_vtop->type, type);
36003600 }
36013601
3602− c = (S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
3602+ c = (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
36033603 #if !defined TCC_IS_NATIVE && !defined TCC_IS_NATIVE_387
3604− c &= (dbt != VT_LDOUBLE) | !!S->nocode_wanted;
3604+ c &= (dbt != VT_LDOUBLE) | !!S->tccgen_nocode_wanted;
36053605 #endif
36063606 if (c) {
36073607 /* constant case: we can do it now */
36083608 /* XXX: in ISOC, cannot do it if error in convert */
36093609 if (sbt == VT_FLOAT)
3610− S->vtop->c.ld = S->vtop->c.f;
3610+ S->tccgen_vtop->c.ld = S->tccgen_vtop->c.f;
36113611 else if (sbt == VT_DOUBLE)
3612− S->vtop->c.ld = S->vtop->c.d;
3612+ S->tccgen_vtop->c.ld = S->tccgen_vtop->c.d;
36133613
36143614 if (df) {
36153615 if (sbt_bt == VT_LLONG) {
3616− if ((sbt & VT_UNSIGNED) || !(S->vtop->c.i >> 63))
3617− S->vtop->c.ld = S->vtop->c.i;
3616+ if ((sbt & VT_UNSIGNED) || !(S->tccgen_vtop->c.i >> 63))
3617+ S->tccgen_vtop->c.ld = S->tccgen_vtop->c.i;
36183618 else
3619− S->vtop->c.ld = -(long double)-S->vtop->c.i;
3619+ S->tccgen_vtop->c.ld = -(long double)-S->tccgen_vtop->c.i;
36203620 } else if(!sf) {
3621− if ((sbt & VT_UNSIGNED) || !(S->vtop->c.i >> 31))
3622− S->vtop->c.ld = (uint32_t)S->vtop->c.i;
3621+ if ((sbt & VT_UNSIGNED) || !(S->tccgen_vtop->c.i >> 31))
3622+ S->tccgen_vtop->c.ld = (uint32_t)S->tccgen_vtop->c.i;
36233623 else
3624− S->vtop->c.ld = -(long double)-(uint32_t)S->vtop->c.i;
3624+ S->tccgen_vtop->c.ld = -(long double)-(uint32_t)S->tccgen_vtop->c.i;
36253625 }
36263626
36273627 if (dbt == VT_FLOAT)
3628− S->vtop->c.f = (float)S->vtop->c.ld;
3628+ S->tccgen_vtop->c.f = (float)S->tccgen_vtop->c.ld;
36293629 else if (dbt == VT_DOUBLE)
3630− S->vtop->c.d = (double)S->vtop->c.ld;
3630+ S->tccgen_vtop->c.d = (double)S->tccgen_vtop->c.ld;
36313631 } else if (sf && dbt == VT_BOOL) {
3632− S->vtop->c.i = (S->vtop->c.ld != 0);
3632+ S->tccgen_vtop->c.i = (S->tccgen_vtop->c.ld != 0);
36333633 } else {
36343634 if(sf)
3635− S->vtop->c.i = S->vtop->c.ld;
3635+ S->tccgen_vtop->c.i = S->tccgen_vtop->c.ld;
36363636 else if (sbt_bt == VT_LLONG || (PTR_SIZE == 8 && sbt == VT_PTR))
36373637 ;
36383638 else if (sbt & VT_UNSIGNED)
3639− S->vtop->c.i = (uint32_t)S->vtop->c.i;
3639+ S->tccgen_vtop->c.i = (uint32_t)S->tccgen_vtop->c.i;
36403640 else
3641− S->vtop->c.i = ((uint32_t)S->vtop->c.i | -(S->vtop->c.i & 0x80000000));
3641+ S->tccgen_vtop->c.i = ((uint32_t)S->tccgen_vtop->c.i | -(S->tccgen_vtop->c.i & 0x80000000));
36423642
36433643 if (dbt_bt == VT_LLONG || (PTR_SIZE == 8 && dbt == VT_PTR))
36443644 ;
36453645 else if (dbt == VT_BOOL)
3646− S->vtop->c.i = (S->vtop->c.i != 0);
3646+ S->tccgen_vtop->c.i = (S->tccgen_vtop->c.i != 0);
36473647 else {
36483648 uint32_t m = dbt_bt == VT_BYTE ? 0xff :
36493649 dbt_bt == VT_SHORT ? 0xffff :
36503650 0xffffffff;
3651− S->vtop->c.i &= m;
3651+ S->tccgen_vtop->c.i &= m;
36523652 if (!(dbt & VT_UNSIGNED))
3653− S->vtop->c.i |= -(S->vtop->c.i & ((m >> 1) + 1));
3653+ S->tccgen_vtop->c.i |= -(S->tccgen_vtop->c.i & ((m >> 1) + 1));
36543654 }
36553655 }
36563656 goto done;
36573657
36583658 } else if (dbt == VT_BOOL
3659− && (S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM))
3659+ && (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM))
36603660 == (VT_CONST | VT_SYM)) {
36613661 /* addresses are considered non-zero (see tcctest.c:sinit23) */
3662− S->vtop->r = VT_CONST;
3663− S->vtop->c.i = 1;
3662+ S->tccgen_vtop->r = VT_CONST;
3663+ S->tccgen_vtop->c.i = 1;
36643664 goto done;
36653665 }
36663666
@@ -3707,7 +3707,7 @@ error: · 40 unmodified lines
37073707 tcc_warning(S, "cast between pointer and integer of different size");
37083708 if (sbt_bt == VT_PTR) {
37093709 /* put integer type to allow logical operations below */
3710− S->vtop->type.t = (PTR_SIZE == 8 ? VT_LLONG : VT_INT);
3710+ S->tccgen_vtop->type.t = (PTR_SIZE == 8 ? VT_LLONG : VT_INT);
37113711 }
37123712 }
37133713
@@ -3716,7 +3716,7 @@ error: · 2 unmodified lines
37163716 change the type and read it still later. */
37173717 #define ALLOW_SUBTYPE_ACCESS 1
37183718
3719− if (ALLOW_SUBTYPE_ACCESS && (S->vtop->r & VT_LVAL)) {
3719+ if (ALLOW_SUBTYPE_ACCESS && (S->tccgen_vtop->r & VT_LVAL)) {
37203720 /* value still in memory */
37213721 if (ds <= ss)
37223722 goto done;
@@ -3786,7 +3786,7 @@ error: · 63 unmodified lines
37863786 #endif
37873787 bits = (ss - ds) * 8;
37883788 /* for unsigned, gen_op will convert SAR to SHR */
3789− S->vtop->type.t = (ss == 8 ? VT_LLONG : VT_INT) | (dbt & VT_UNSIGNED);
3789+ S->tccgen_vtop->type.t = (ss == 8 ? VT_LLONG : VT_INT) | (dbt & VT_UNSIGNED);
37903790 vpushi(S, bits);
37913791 gen_op(S, TOK_SHL);
37923792 vpushi(S, bits - trunc);
@@ -3795,8 +3795,8 @@ error: · 2 unmodified lines
37953795 gen_op(S, TOK_SHR);
37963796 }
37973797 done:
3798− S->vtop->type = *type;
3799− S->vtop->type.t &= ~ ( VT_CONSTANT | VT_VOLATILE | VT_ARRAY );
3798+ S->tccgen_vtop->type = *type;
3799+ S->tccgen_vtop->type.t &= ~ ( VT_CONSTANT | VT_VOLATILE | VT_ARRAY );
38003800 }
38013801
38023802 /* return type size as known at compile time. Put alignment at 'a' */
@@ -3866,7 +3866,7 @@ ST_FUNC int type_size(CType *type, int *a) · 63 unmodified lines
38663866
38673867 /* push type size as known at runtime time on top of value stack. Put
38683868 alignment at 'a' */
3869−ST_FUNC void vla_runtime_type_size(TCCState *S, CType *type, int *a)
3869+ST_FUNC void vla_runtime_type_size(TCCState* S, CType *type, int *a)
38703870 {
38713871 if (type->t & VT_VLA) {
38723872 type_size(&type->ref->type, a);
@@ -3883,7 +3883,7 @@ static inline CType *pointed_type(CType *type) · 10 unmodified lines
38833883 }
38843884
38853885 /* modify type so that its it is a pointer to type. */
3886−ST_FUNC void mk_pointer(TCCState *S, CType *type)
3886+ST_FUNC void mk_pointer(TCCState* S, CType *type)
38873887 {
38883888 Sym *s;
38893889 s = sym_push(S, SYM_FIELD, type, 0, -1);
@@ -3906,18 +3906,18 @@ static int is_compatible_unqualified_types(CType *type1, CType *type2) · 16 unmodified lines
39063906 return compare_types(type1,type2,1);
39073907 }
39083908
3909−static void cast_error(TCCState *S, CType *st, CType *dt)
3909+static void cast_error(TCCState* S, CType *st, CType *dt)
39103910 {
39113911 type_incompatibility_error(S, st, dt, "cannot convert '%s' to '%s'");
39123912 }
39133913
39143914 /* verify type compatibility to store vtop in 'dt' type */
3915−static void verify_assign_cast(TCCState *S, CType *dt)
3915+static void verify_assign_cast(TCCState* S, CType *dt)
39163916 {
39173917 CType *st, *type1, *type2;
39183918 int dbt, sbt, qualwarn, lvl;
39193919
3920− st = &S->vtop->type; /* source type */
3920+ st = &S->tccgen_vtop->type; /* source type */
39213921 dbt = dt->t & VT_BTYPE;
39223922 sbt = st->t & VT_BTYPE;
39233923 if (dt->t & VT_CONSTANT)
@@ -3930,7 +3930,7 @@ static void verify_assign_cast(TCCState *S, CType *dt) · 6 unmodified lines
39303930 case VT_PTR:
39313931 /* special cases for pointers */
39323932 /* '0' can also be a pointer */
3933− if (is_null_pointer(S->vtop))
3933+ if (is_null_pointer(S->tccgen_vtop))
39343934 break;
39353935 /* accept implicit pointer to integer cast with warning */
39363936 if (is_integer_btype(sbt)) {
@@ -3997,36 +3997,36 @@ static void verify_assign_cast(TCCState *S, CType *dt) · 60 unmodified lines
39973997 }
39983998 }
39993999
4000−static void gen_assign_cast(TCCState *S, CType *dt)
4000+static void gen_assign_cast(TCCState* S, CType *dt)
40014001 {
40024002 verify_assign_cast(S, dt);
40034003 gen_cast(S, dt);
40044004 }
40054005
40064006 /* store vtop in lvalue pushed on stack */
4007−ST_FUNC void vstore(TCCState *S)
4007+ST_FUNC void vstore(TCCState* S)
40084008 {
40094009 int sbt, dbt, ft, r, size, align, bit_size, bit_pos, delayed_cast;
40104010
4011− ft = S->vtop[-1].type.t;
4012− sbt = S->vtop->type.t & VT_BTYPE;
4011+ ft = S->tccgen_vtop[-1].type.t;
4012+ sbt = S->tccgen_vtop->type.t & VT_BTYPE;
40134013 dbt = ft & VT_BTYPE;
40144014
4015− verify_assign_cast(S, &S->vtop[-1].type);
4015+ verify_assign_cast(S, &S->tccgen_vtop[-1].type);
40164016
40174017 if (sbt == VT_STRUCT) {
40184018 /* if structure, only generate pointer */
40194019 /* structure assignment : generate memcpy */
40204020 /* XXX: optimize if small size */
4021− size = type_size(&S->vtop->type, &align);
4021+ size = type_size(&S->tccgen_vtop->type, &align);
40224022
40234023 /* destination */
40244024 vswap(S);
40254025 #ifdef CONFIG_TCC_BCHECK
4026− if (S->vtop->r & VT_MUSTBOUND)
4026+ if (S->tccgen_vtop->r & VT_MUSTBOUND)
40274027 gbound(S); /* check would be wrong after gaddrof() */
40284028 #endif
4029− S->vtop->type.t = VT_PTR;
4029+ S->tccgen_vtop->type.t = VT_PTR;
40304030 gaddrof(S);
40314031
40324032 /* address of memcpy() */
@@ -4042,12 +4042,12 @@ ST_FUNC void vstore(TCCState *S) · 9 unmodified lines
40424042
40434043 vswap(S);
40444044 /* source */
4045− vpushv(S, S->vtop - 2);
4045+ vpushv(S, S->tccgen_vtop - 2);
40464046 #ifdef CONFIG_TCC_BCHECK
4047− if (S->vtop->r & VT_MUSTBOUND)
4047+ if (S->tccgen_vtop->r & VT_MUSTBOUND)
40484048 gbound(S);
40494049 #endif
4050− S->vtop->type.t = VT_PTR;
4050+ S->tccgen_vtop->type.t = VT_PTR;
40514051 gaddrof(S);
40524052 /* type size */
40534053 vpushi(S, size);
@@ -4058,21 +4058,21 @@ ST_FUNC void vstore(TCCState *S) · 4 unmodified lines
40584058 /* bitfield store handling */
40594059
40604060 /* save lvalue as expression result (example: s.b = s.a = n;) */
4061− vdup(S), S->vtop[-1] = S->vtop[-2];
4061+ vdup(S), S->tccgen_vtop[-1] = S->tccgen_vtop[-2];
40624062
40634063 bit_pos = BIT_POS(ft);
40644064 bit_size = BIT_SIZE(ft);
40654065 /* remove bit field info to avoid loops */
4066− S->vtop[-1].type.t = ft & ~VT_STRUCT_MASK;
4066+ S->tccgen_vtop[-1].type.t = ft & ~VT_STRUCT_MASK;
40674067
40684068 if (dbt == VT_BOOL) {
4069− gen_cast(S, &S->vtop[-1].type);
4070− S->vtop[-1].type.t = (S->vtop[-1].type.t & ~VT_BTYPE) | (VT_BYTE | VT_UNSIGNED);
4069+ gen_cast(S, &S->tccgen_vtop[-1].type);
4070+ S->tccgen_vtop[-1].type.t = (S->tccgen_vtop[-1].type.t & ~VT_BTYPE) | (VT_BYTE | VT_UNSIGNED);
40714071 }
4072− r = adjust_bf(S->vtop - 1, bit_pos, bit_size);
4072+ r = adjust_bf(S->tccgen_vtop - 1, bit_pos, bit_size);
40734073 if (dbt != VT_BOOL) {
4074− gen_cast(S, &S->vtop[-1].type);
4075− dbt = S->vtop[-1].type.t & VT_BTYPE;
4074+ gen_cast(S, &S->tccgen_vtop[-1].type);
4075+ dbt = S->tccgen_vtop[-1].type.t & VT_BTYPE;
40764076 }
40774077 if (r == VT_STRUCT) {
40784078 store_packed_bf(S, bit_pos, bit_size);
@@ -4106,25 +4106,25 @@ ST_FUNC void vstore(TCCState *S) · 27 unmodified lines
41064106 vpop(S);
41074107 }
41084108 } else if (dbt == VT_VOID) {
4109− --S->vtop;
4109+ --S->tccgen_vtop;
41104110 } else {
41114111 /* optimize char/short casts */
41124112 delayed_cast = 0;
41134113 if ((dbt == VT_BYTE || dbt == VT_SHORT)
41144114 && is_integer_btype(sbt)
41154115 ) {
4116− if ((S->vtop->r & VT_MUSTCAST)
4116+ if ((S->tccgen_vtop->r & VT_MUSTCAST)
41174117 && btype_size(dbt) > btype_size(sbt)
41184118 )
41194119 force_charshort_cast(S);
41204120 delayed_cast = 1;
41214121 } else {
4122− gen_cast(S, &S->vtop[-1].type);
4122+ gen_cast(S, &S->tccgen_vtop[-1].type);
41234123 }
41244124
41254125 #ifdef CONFIG_TCC_BCHECK
41264126 /* bound check case */
4127− if (S->vtop[-1].r & VT_MUSTBOUND) {
4127+ if (S->tccgen_vtop[-1].r & VT_MUSTBOUND) {
41284128 vswap(S);
41294129 gbound(S);
41304130 vswap(S);
@@ -4133,51 +4133,51 @@ ST_FUNC void vstore(TCCState *S) · 2 unmodified lines
41334133 gv(S, RC_TYPE(dbt)); /* generate value */
41344134
41354135 if (delayed_cast) {
4136− S->vtop->r |= BFVAL(VT_MUSTCAST, (sbt == VT_LLONG) + 1);
4136+ S->tccgen_vtop->r |= BFVAL(VT_MUSTCAST, (sbt == VT_LLONG) + 1);
41374137 //tcc_warning(S, "deley cast %x -> %x", sbt, dbt);
4138− S->vtop->type.t = ft & VT_TYPE;
4138+ S->tccgen_vtop->type.t = ft & VT_TYPE;
41394139 }
41404140
41414141 /* if lvalue was saved on stack, must read it */
4142− if ((S->vtop[-1].r & VT_VALMASK) == VT_LLOCAL) {
4142+ if ((S->tccgen_vtop[-1].r & VT_VALMASK) == VT_LLOCAL) {
41434143 SValue sv;
41444144 r = get_reg(S, RC_INT);
41454145 sv.type.t = VT_PTRDIFF_T;
41464146 sv.r = VT_LOCAL | VT_LVAL;
4147− sv.c.i = S->vtop[-1].c.i;
4147+ sv.c.i = S->tccgen_vtop[-1].c.i;
41484148 load(S, r, &sv);
4149− S->vtop[-1].r = r | VT_LVAL;
4149+ S->tccgen_vtop[-1].r = r | VT_LVAL;
41504150 }
41514151
4152− r = S->vtop->r & VT_VALMASK;
4152+ r = S->tccgen_vtop->r & VT_VALMASK;
41534153 /* two word case handling :
41544154 store second register at word + 4 (or +8 for x86-64) */
41554155 if (USING_TWO_WORDS(dbt)) {
41564156 int load_type = (dbt == VT_QFLOAT) ? VT_DOUBLE : VT_PTRDIFF_T;
4157− S->vtop[-1].type.t = load_type;
4158− store(S, r, S->vtop - 1);
4157+ S->tccgen_vtop[-1].type.t = load_type;
4158+ store(S, r, S->tccgen_vtop - 1);
41594159 vswap(S);
41604160 /* convert to int to increment easily */
4161− S->vtop->type.t = VT_PTRDIFF_T;
4161+ S->tccgen_vtop->type.t = VT_PTRDIFF_T;
41624162 gaddrof(S);
41634163 vpushs(S, PTR_SIZE);
41644164 gen_op(S, '+');
4165− S->vtop->r |= VT_LVAL;
4165+ S->tccgen_vtop->r |= VT_LVAL;
41664166 vswap(S);
4167− S->vtop[-1].type.t = load_type;
4167+ S->tccgen_vtop[-1].type.t = load_type;
41684168 /* XXX: it works because r2 is spilled last ! */
4169− store(S, S->vtop->r2, S->vtop - 1);
4169+ store(S, S->tccgen_vtop->r2, S->tccgen_vtop - 1);
41704170 } else {
41714171 /* single word */
4172− store(S, r, S->vtop - 1);
4172+ store(S, r, S->tccgen_vtop - 1);
41734173 }
41744174 vswap(S);
4175− S->vtop--; /* NOT vpop() because on x86 it would flush the fp stack */
4175+ S->tccgen_vtop--; /* NOT vpop() because on x86 it would flush the fp stack */
41764176 }
41774177 }
41784178
41794179 /* post defines POST/PRE add. c is the token ++ or -- */
4180−ST_FUNC void inc(TCCState *S, int post, int c)
4180+ST_FUNC void inc(TCCState* S, int post, int c)
41814181 {
41824182 test_lvalue(S);
41834183 vdup(S); /* save lvalue */
@@ -4194,15 +4194,15 @@ ST_FUNC void inc(TCCState *S, int post, int c) · 10 unmodified lines
41944194 vpop(S); /* if post op, return saved value */
41954195 }
41964196
4197−ST_FUNC void parse_mult_str (TCCState *S, CString *astr, const char *msg)
4197+ST_FUNC void parse_mult_str (TCCState* S, CString *astr, const char *msg)
41984198 {
41994199 /* read the string */
4200− if (S->tok != TOK_STR)
4200+ if (S->tccpp_tok != TOK_STR)
42014201 expect(S, msg);
42024202 cstr_new(S, astr);
4203− while (S->tok == TOK_STR) {
4203+ while (S->tccpp_tok == TOK_STR) {
42044204 /* XXX: add \0 handling too ? */
4205− cstr_cat(S, astr, S->tokc.str.data, -1);
4205+ cstr_cat(S, astr, S->tccpp_tokc.str.data, -1);
42064206 next(S);
42074207 }
42084208 cstr_ccat(S, astr, '\0');
@@ -4227,21 +4227,21 @@ ST_FUNC int exact_log2p1(int i) · 18 unmodified lines
42274227 }
42284228
42294229 /* Parse __attribute__((...)) GNUC extension. */
4230−static void parse_attribute(TCCState *S, AttributeDef *ad)
4230+static void parse_attribute(TCCState* S, AttributeDef *ad)
42314231 {
42324232 int t, n;
42334233 CString astr;
42344234
42354235 redo:
4236− if (S->tok != TOK_ATTRIBUTE1 && S->tok != TOK_ATTRIBUTE2)
4236+ if (S->tccpp_tok != TOK_ATTRIBUTE1 && S->tccpp_tok != TOK_ATTRIBUTE2)
42374237 return;
42384238 next(S);
42394239 skip(S, '(');
42404240 skip(S, '(');
4241− while (S->tok != ')') {
4242− if (S->tok < TOK_IDENT)
4241+ while (S->tccpp_tok != ')') {
4242+ if (S->tccpp_tok < TOK_IDENT)
42434243 expect(S, "attribute name");
4244− t = S->tok;
4244+ t = S->tccpp_tok;
42454245 next(S);
42464246 switch(t) {
42474247 case TOK_CLEANUP1:
@@ -4250,13 +4250,13 @@ redo: · 2 unmodified lines
42504250 Sym *s;
42514251
42524252 skip(S, '(');
4253− s = sym_find(S, S->tok);
4253+ s = sym_find(S, S->tccpp_tok);
42544254 if (!s) {
42554255 tcc_warning_c(warn_implicit_function_declaration)(S,
4256− "implicit declaration of function '%s'", get_tok_str(S, S->tok, &S->tokc));
4257− s = external_global_sym(S, S->tok, &S->tccgen_func_old_type);
4256+ "implicit declaration of function '%s'", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
4257+ s = external_global_sym(S, S->tccpp_tok, &S->tccgen_func_old_type);
42584258 } else if ((s->type.t & VT_BTYPE) != VT_FUNC)
4259− tcc_error(S, "'%s' is not declared as function", get_tok_str(S, S->tok, &S->tokc));
4259+ tcc_error(S, "'%s' is not declared as function", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
42604260 ad->cleanup_func = s;
42614261 next(S);
42624262 skip(S, ')');
@@ -4311,7 +4311,7 @@ redo: · 48 unmodified lines
43114311 break;
43124312 case TOK_ALIGNED1:
43134313 case TOK_ALIGNED2:
4314− if (S->tok == '(') {
4314+ if (S->tccpp_tok == '(') {
43154315 next(S);
43164316 n = expr_const(S);
43174317 if (n <= 0 || (n & (n - 1)) != 0)
@@ -4372,7 +4372,7 @@ redo: · 54 unmodified lines
43724372 #endif
43734373 case TOK_MODE:
43744374 skip(S, '(');
4375− switch(S->tok) {
4375+ switch(S->tccpp_tok) {
43764376 case TOK_MODE_DI:
43774377 ad->attr_mode = VT_LLONG + 1;
43784378 break;
@@ -4387,7 +4387,7 @@ redo: · 8 unmodified lines
43874387 ad->attr_mode = VT_INT + 1;
43884388 break;
43894389 default:
4390− tcc_warning(S, "__mode__(%s) not supported\n", get_tok_str(S, S->tok, NULL));
4390+ tcc_warning(S, "__mode__(%s) not supported\n", get_tok_str(S, S->tccpp_tok, NULL));
43914391 break;
43924392 }
43934393 next(S);
@@ -4405,19 +4405,19 @@ redo: · 11 unmodified lines
44054405 default:
44064406 tcc_warning_c(warn_unsupported)(S, "'%s' attribute ignored", get_tok_str(S, t, NULL));
44074407 /* skip parameters */
4408− if (S->tok == '(') {
4408+ if (S->tccpp_tok == '(') {
44094409 int parenthesis = 0;
44104410 do {
4411− if (S->tok == '(')
4411+ if (S->tccpp_tok == '(')
44124412 parenthesis++;
4413− else if (S->tok == ')')
4413+ else if (S->tccpp_tok == ')')
44144414 parenthesis--;
44154415 next(S);
4416− } while (parenthesis && S->tok != -1);
4416+ } while (parenthesis && S->tccpp_tok != -1);
44174417 }
44184418 break;
44194419 }
4420− if (S->tok != ',')
4420+ if (S->tccpp_tok != ',')
44214421 break;
44224422 next(S);
44234423 }
@@ -4446,7 +4446,7 @@ static Sym * find_field (CType *type, int v, int *cumofs) · 22 unmodified lines
44464446 return s;
44474447 }
44484448
4449−static void check_fields (TCCState *S, CType *type, int check)
4449+static void check_fields (TCCState* S, CType *type, int check)
44504450 {
44514451 Sym *s = type->ref;
44524452
@@ -4462,7 +4462,7 @@ static void check_fields (TCCState *S, CType *type, int check) · 9 unmodified lines
44624462 }
44634463 }
44644464
4465−static void struct_layout(TCCState *S, CType *type, AttributeDef *ad)
4465+static void struct_layout(TCCState* S, CType *type, AttributeDef *ad)
44664466 {
44674467 int size, align, maxalign, offset, c, bit_pos, bit_size;
44684468 int packed, a, bt, prevbt, prev_bit_size;
@@ -4712,7 +4712,7 @@ static void struct_layout(TCCState *S, CType *type, AttributeDef *ad) · 243 unmodified lines
47124712 }
47134713
47144714 /* enum/struct/union declaration. u is VT_ENUM/VT_STRUCT/VT_UNION */
4715−static void struct_decl(TCCState *S, CType *type, int u)
4715+static void struct_decl(TCCState* S, CType *type, int u)
47164716 {
47174717 int v, c, size, align, flexible;
47184718 int bit_size, bsize, bt;
@@ -4723,14 +4723,14 @@ static void struct_decl(TCCState *S, CType *type, int u) · 4 unmodified lines
47234723 memset(&ad, 0, sizeof ad);
47244724 next(S);
47254725 parse_attribute(S, &ad);
4726− if (S->tok != '{') {
4727− v = S->tok;
4726+ if (S->tccpp_tok != '{') {
4727+ v = S->tccpp_tok;
47284728 next(S);
47294729 /* struct already defined ? return it */
47304730 if (v < TOK_IDENT)
47314731 expect(S, "struct/union/enum name");
47324732 s = struct_find(S, v);
4733− if (s && (s->sym_scope == S->local_scope || S->tok != '{')) {
4733+ if (s && (s->sym_scope == S->tccgen_local_scope || S->tccpp_tok != '{')) {
47344734 if (u == s->type.t)
47354735 goto do_decl;
47364736 if (u == VT_ENUM && IS_ENUM(s->type.t))
@@ -4750,7 +4750,7 @@ do_decl: · 13 unmodified lines
47504750 type->t = s->type.t;
47514751 type->ref = s;
47524752
4753− if (S->tok == '{') {
4753+ if (S->tccpp_tok == '{') {
47544754 next(S);
47554755 if (s->c != -1)
47564756 tcc_error(S, "struct/union/enum already defined");
@@ -4765,15 +4765,15 @@ do_decl: · 8 unmodified lines
47654765 /* enum symbols have static storage */
47664766 t.t = VT_INT|VT_STATIC|VT_ENUM_VAL;
47674767 for(;;) {
4768− v = S->tok;
4768+ v = S->tccpp_tok;
47694769 if (v < TOK_UIDENT)
47704770 expect(S, "identifier");
47714771 ss = sym_find(S, v);
4772− if (ss && !S->local_stack)
4772+ if (ss && !S->tccgen_local_stack)
47734773 tcc_error(S, "redefinition of enumerator '%s'",
47744774 get_tok_str(S, v, NULL));
47754775 next(S);
4776− if (S->tok == '=') {
4776+ if (S->tccpp_tok == '=') {
47774777 next(S);
47784778 ll = expr_const64(S);
47794779 }
@@ -4784,12 +4784,12 @@ do_decl: · 4 unmodified lines
47844784 nl = ll;
47854785 if (ll > pl)
47864786 pl = ll;
4787− if (S->tok != ',')
4787+ if (S->tccpp_tok != ',')
47884788 break;
47894789 next(S);
47904790 ll++;
47914791 /* NOTE: we accept a trailing comma */
4792− if (S->tok == '}')
4792+ if (S->tccpp_tok == '}')
47934793 break;
47944794 }
47954795 skip(S, '}');
@@ -4819,7 +4819,7 @@ do_decl: · 23 unmodified lines
48194819 } else {
48204820 c = 0;
48214821 flexible = 0;
4822− while (S->tok != '}') {
4822+ while (S->tccpp_tok != '}') {
48234823 if (!parse_btype(S, &btype, &ad1)) {
48244824 skip(S, ';');
48254825 continue;
@@ -4831,8 +4831,8 @@ do_decl: · 5 unmodified lines
48314831 bit_size = -1;
48324832 v = 0;
48334833 type1 = btype;
4834− if (S->tok != ':') {
4835− if (S->tok != ';')
4834+ if (S->tccpp_tok != ':') {
4835+ if (S->tccpp_tok != ';')
48364836 type_decl(S, &type1, &ad1, &v, TYPE_DIRECT);
48374837 if (v == 0) {
48384838 if ((type1.t & VT_BTYPE) != VT_STRUCT)
@@ -4858,7 +4858,7 @@ do_decl: · 19 unmodified lines
48584858 tcc_error(S, "invalid type for '%s'",
48594859 get_tok_str(S, v, NULL));
48604860 }
4861− if (S->tok == ':') {
4861+ if (S->tccpp_tok == ':') {
48624862 next(S);
48634863 bit_size = expr_const(S);
48644864 /* XXX: handle v = 0 case for messages */
@@ -4913,7 +4913,7 @@ do_decl: · 48 unmodified lines
49134913 *ps = ss;
49144914 ps = &ss->next;
49154915 }
4916− if (S->tok == ';' || S->tok == TOK_EOF)
4916+ if (S->tccpp_tok == ';' || S->tccpp_tok == TOK_EOF)
49174917 break;
49184918 skip(S, ',');
49194919 }
@@ -4939,7 +4939,7 @@ static void sym_to_attr(AttributeDef *ad, Sym *s) · 19 unmodified lines
49394939
49404940 /* Add type qualifiers to a type. If the type is an array then the qualifiers
49414941 are added to the element type, copied because it could be a typedef. */
4942−static void parse_btype_qualify(TCCState *S, CType *type, int qualifiers)
4942+static void parse_btype_qualify(TCCState* S, CType *type, int qualifiers)
49434943 {
49444944 while (type->t & VT_ARRAY) {
49454945 type->ref = sym_push(S, SYM_FIELD, &type->ref->type, 0, type->ref->c);
@@ -4951,7 +4951,7 @@ static void parse_btype_qualify(TCCState *S, CType *type, int qualifiers) · 5 unmodified lines
49514951 /* return 0 if no type declaration. otherwise, return the basic type
49524952 and skip it.
49534953 */
4954−static int parse_btype(TCCState *S, CType *type, AttributeDef *ad)
4954+static int parse_btype(TCCState* S, CType *type, AttributeDef *ad)
49554955 {
49564956 int t, u, bt, st, type_found, typespec_found, g, n;
49574957 Sym *s;
@@ -4965,7 +4965,7 @@ static int parse_btype(TCCState *S, CType *type, AttributeDef *ad) · 7 unmodified lines
49654965 type->ref = NULL;
49664966
49674967 while(1) {
4968− switch(S->tok) {
4968+ switch(S->tccpp_tok) {
49694969 case TOK_EXTENSION:
49704970 /* currently, we really ignore extension */
49714971 next(S);
@@ -5072,7 +5072,7 @@ static int parse_btype(TCCState *S, CType *type, AttributeDef *ad) · 100 unmodified lines
50725072 type->t = t;
50735073 parse_btype_qualify(S, type, VT_ATOMIC);
50745074 t = type->t;
5075− if (S->tok == '(') {
5075+ if (S->tccpp_tok == '(') {
50765076 parse_expr_type(S, &type1);
50775077 /* remove all storage modifiers except typedef */
50785078 type1.t &= ~(VT_STORAGE&~VT_TYPEDEF);
@@ -5170,12 +5170,12 @@ static int parse_btype(TCCState *S, CType *type, AttributeDef *ad) · 91 unmodified lines
51705170 default:
51715171 if (typespec_found)
51725172 goto the_end;
5173− s = sym_find(S, S->tok);
5173+ s = sym_find(S, S->tccpp_tok);
51745174 if (!s || !(s->type.t & VT_TYPEDEF))
51755175 goto the_end;
51765176
5177− n = S->tok, next(S);
5178− if (S->tok == ':' && !S->tccgen_in_generic) {
5177+ n = S->tccpp_tok, next(S);
5178+ if (S->tccpp_tok == ':' && !S->tccgen_in_generic) {
51795179 /* ignore if it's a label */
51805180 unget_tok(S, n);
51815181 goto the_end;
@@ -5215,7 +5215,7 @@ the_end: · 33 unmodified lines
52155215
52165216 /* convert a function parameter type (array to pointer and function to
52175217 function pointer) */
5218−static inline void convert_parameter_type(TCCState *S, CType *pt)
5218+static inline void convert_parameter_type(TCCState* S, CType *pt)
52195219 {
52205220 /* remove const and volatile qualifiers (XXX: const could be used
52215221 to indicate a const function parameter */
@@ -5227,14 +5227,14 @@ static inline void convert_parameter_type(TCCState *S, CType *pt) · 5 unmodified lines
52275227 }
52285228 }
52295229
5230−ST_FUNC void parse_asm_str(TCCState *S, CString *astr)
5230+ST_FUNC void parse_asm_str(TCCState* S, CString *astr)
52315231 {
52325232 skip(S, '(');
52335233 parse_mult_str(S, astr, "string constant");
52345234 }
52355235
52365236 /* Parse an asm label and return the token */
5237−static int asm_label_instr(TCCState *S)
5237+static int asm_label_instr(TCCState* S)
52385238 {
52395239 int v;
52405240 CString astr;
@@ -5250,19 +5250,19 @@ static int asm_label_instr(TCCState *S) · 9 unmodified lines
52505250 return v;
52515251 }
52525252
5253−static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, int td)
5253+static int post_type(TCCState* S, CType *type, AttributeDef *ad, int storage, int td)
52545254 {
52555255 int n, l, t1, arg_size, align, unused_align;
52565256 Sym **plast, *s, *first;
52575257 AttributeDef ad1;
52585258 CType pt;
52595259
5260− if (S->tok == '(') {
5260+ if (S->tccpp_tok == '(') {
52615261 /* function type, or recursive declarator (return if so) */
52625262 next(S);
52635263 if (td && !(td & TYPE_ABSTRACT))
52645264 return 0;
5265− if (S->tok == ')')
5265+ if (S->tccpp_tok == ')')
52665266 l = 0;
52675267 else if (parse_btype(S, &pt, &ad1))
52685268 l = FUNC_NEW;
@@ -5278,13 +5278,13 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 9 unmodified lines
52785278 for(;;) {
52795279 /* read param name and compute offset */
52805280 if (l != FUNC_OLD) {
5281− if ((pt.t & VT_BTYPE) == VT_VOID && S->tok == ')')
5281+ if ((pt.t & VT_BTYPE) == VT_VOID && S->tccpp_tok == ')')
52825282 break;
52835283 type_decl(S, &pt, &ad1, &n, TYPE_DIRECT | TYPE_ABSTRACT);
52845284 if ((pt.t & VT_BTYPE) == VT_VOID)
52855285 tcc_error(S, "parameter declared as void");
52865286 } else {
5287− n = S->tok;
5287+ n = S->tccpp_tok;
52885288 if (n < TOK_UIDENT)
52895289 expect(S, "identifier");
52905290 pt.t = VT_VOID; /* invalid type */
@@ -5296,10 +5296,10 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 5 unmodified lines
52965296 s = sym_push(S, n | SYM_FIELD, &pt, 0, 0);
52975297 *plast = s;
52985298 plast = &s->next;
5299− if (S->tok == ')')
5299+ if (S->tccpp_tok == ')')
53005300 break;
53015301 skip(S, ',');
5302− if (l == FUNC_NEW && S->tok == TOK_DOTS) {
5302+ if (l == FUNC_NEW && S->tccpp_tok == TOK_DOTS) {
53035303 l = FUNC_ELLIPSIS;
53045304 next(S);
53055305 break;
@@ -5317,7 +5317,7 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 11 unmodified lines
53175317 /* some ancient pre-K&R C allows a function to return an array
53185318 and the array brackets to be put after the arguments, such
53195319 that "int c()[]" means something like "int[] c()" */
5320− if (S->tok == '[') {
5320+ if (S->tccpp_tok == '[') {
53215321 next(S);
53225322 skip(S, ']'); /* only handle simple "[]" */
53235323 mk_pointer(S, type);
@@ -5331,15 +5331,15 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 7 unmodified lines
53315331 s->next = first;
53325332 type->t = VT_FUNC;
53335333 type->ref = s;
5334− } else if (S->tok == '[') {
5335− int saved_nocode_wanted = S->nocode_wanted;
5334+ } else if (S->tccpp_tok == '[') {
5335+ int saved_nocode_wanted = S->tccgen_nocode_wanted;
53365336 /* array definition */
53375337 next(S);
53385338 while (1) {
53395339 /* XXX The optional type-quals and static should only be accepted
53405340 in parameter decls. The '*' as well, and then even only
53415341 in prototypes (not function defs). */
5342− switch (S->tok) {
5342+ switch (S->tccpp_tok) {
53435343 case TOK_RESTRICT1: case TOK_RESTRICT2: case TOK_RESTRICT3:
53445344 case TOK_CONST1:
53455345 case TOK_VOLATILE1:
@@ -5354,23 +5354,23 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 8 unmodified lines
53545354 }
53555355 n = -1;
53565356 t1 = 0;
5357− if (S->tok != ']') {
5358− if (!S->local_stack || (storage & VT_STATIC))
5357+ if (S->tccpp_tok != ']') {
5358+ if (!S->tccgen_local_stack || (storage & VT_STATIC))
53595359 vpushi(S, expr_const(S));
53605360 else {
53615361 /* VLAs (which can only happen with local_stack && !VT_STATIC)
53625362 length must always be evaluated, even under nocode_wanted,
53635363 so that its size slot is initialized (e.g. under sizeof
53645364 or typeof). */
5365− S->nocode_wanted = 0;
5365+ S->tccgen_nocode_wanted = 0;
53665366 gexpr(S);
53675367 }
5368− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
5369− n = S->vtop->c.i;
5368+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
5369+ n = S->tccgen_vtop->c.i;
53705370 if (n < 0)
53715371 tcc_error(S, "invalid array size");
53725372 } else {
5373− if (!is_integer_btype(S->vtop->type.t & VT_BTYPE))
5373+ if (!is_integer_btype(S->tccgen_vtop->type.t & VT_BTYPE))
53745374 tcc_error(S, "size of variable length array should be an integer");
53755375 n = 0;
53765376 t1 = VT_VLA;
@@ -5391,9 +5391,9 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 14 unmodified lines
53915391 if (t1 & VT_VLA) {
53925392 if (n < 0)
53935393 tcc_error(S, "need explicit inner array size in VLAs");
5394− S->loc -= type_size(&S->tccgen_int_type, &align);
5395− S->loc &= -align;
5396− n = S->loc;
5394+ S->tccgen_loc -= type_size(&S->tccgen_int_type, &align);
5395+ S->tccgen_loc &= -align;
5396+ n = S->tccgen_loc;
53975397
53985398 vla_runtime_type_size(S, type, &align);
53995399 gen_op(S, '*');
@@ -5403,7 +5403,7 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 3 unmodified lines
54035403 }
54045404 if (n != -1)
54055405 vpop(S);
5406− S->nocode_wanted = saved_nocode_wanted;
5406+ S->tccgen_nocode_wanted = saved_nocode_wanted;
54075407
54085408 /* we push an anonymous symbol which will contain the array
54095409 element type */
@@ -5421,7 +5421,7 @@ static int post_type(TCCState *S, CType *type, AttributeDef *ad, int storage, in · 11 unmodified lines
54215421 type_decl(). If this (possibly abstract) declarator is a pointer chain
54225422 it returns the innermost pointed to type (equals *type, but is a different
54235423 pointer), otherwise returns type itself, that's used for recursive calls. */
5424−static CType *type_decl(TCCState *S, CType *type, AttributeDef *ad, int *v, int td)
5424+static CType *type_decl(TCCState* S, CType *type, AttributeDef *ad, int *v, int td)
54255425 {
54265426 CType *post, *ret;
54275427 int qualifiers, storage;
@@ -5431,11 +5431,11 @@ static CType *type_decl(TCCState *S, CType *type, AttributeDef *ad, int *v, int · 3 unmodified lines
54315431 type->t &= ~VT_STORAGE;
54325432 post = ret = type;
54335433
5434− while (S->tok == '*') {
5434+ while (S->tccpp_tok == '*') {
54355435 qualifiers = 0;
54365436 redo:
54375437 next(S);
5438− switch(S->tok) {
5438+ switch(S->tccpp_tok) {
54395439 case TOK__Atomic:
54405440 qualifiers |= VT_ATOMIC;
54415441 goto redo;
@@ -5466,7 +5466,7 @@ static CType *type_decl(TCCState *S, CType *type, AttributeDef *ad, int *v, int · 24 unmodified lines
54665466 ret = pointed_type(type);
54675467 }
54685468
5469− if (S->tok == '(') {
5469+ if (S->tccpp_tok == '(') {
54705470 /* This is possibly a parameter type list for abstract declarators
54715471 ('int ()'), use post_type for testing this. */
54725472 if (!post_type(S, type, ad, 0, td)) {
@@ -5479,9 +5479,9 @@ static CType *type_decl(TCCState *S, CType *type, AttributeDef *ad, int *v, int · 6 unmodified lines
54795479 skip(S, ')');
54805480 } else
54815481 goto abstract;
5482− } else if (S->tok >= TOK_IDENT && (td & TYPE_DIRECT)) {
5482+ } else if (S->tccpp_tok >= TOK_IDENT && (td & TYPE_DIRECT)) {
54835483 /* type identifier */
5484− *v = S->tok;
5484+ *v = S->tccpp_tok;
54855485 next(S);
54865486 } else {
54875487 abstract:
@@ -5496,30 +5496,30 @@ static CType *type_decl(TCCState *S, CType *type, AttributeDef *ad, int *v, int · 8 unmodified lines
54965496 }
54975497
54985498 /* indirection with full error checking and bound check */
5499−ST_FUNC void indir(TCCState *S)
5499+ST_FUNC void indir(TCCState* S)
55005500 {
5501− if ((S->vtop->type.t & VT_BTYPE) != VT_PTR) {
5502− if ((S->vtop->type.t & VT_BTYPE) == VT_FUNC)
5501+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_PTR) {
5502+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FUNC)
55035503 return;
55045504 expect(S, "pointer");
55055505 }
5506− if (S->vtop->r & VT_LVAL)
5506+ if (S->tccgen_vtop->r & VT_LVAL)
55075507 gv(S, RC_INT);
5508− S->vtop->type = *pointed_type(&S->vtop->type);
5508+ S->tccgen_vtop->type = *pointed_type(&S->tccgen_vtop->type);
55095509 /* Arrays and functions are never lvalues */
5510− if (!(S->vtop->type.t & (VT_ARRAY | VT_VLA))
5511− && (S->vtop->type.t & VT_BTYPE) != VT_FUNC) {
5512− S->vtop->r |= VT_LVAL;
5510+ if (!(S->tccgen_vtop->type.t & (VT_ARRAY | VT_VLA))
5511+ && (S->tccgen_vtop->type.t & VT_BTYPE) != VT_FUNC) {
5512+ S->tccgen_vtop->r |= VT_LVAL;
55135513 /* if bound checking, the referenced pointer must be checked */
55145514 #ifdef CONFIG_TCC_BCHECK
55155515 if (S->do_bounds_check)
5516− S->vtop->r |= VT_MUSTBOUND;
5516+ S->tccgen_vtop->r |= VT_MUSTBOUND;
55175517 #endif
55185518 }
55195519 }
55205520
55215521 /* pass a parameter to a function and do type checking and casting */
5522−static void gfunc_param_typed(TCCState *S, Sym *func, Sym *arg)
5522+static void gfunc_param_typed(TCCState* S, Sym *func, Sym *arg)
55235523 {
55245524 int func_type;
55255525 CType type;
@@ -5528,13 +5528,13 @@ static void gfunc_param_typed(TCCState *S, Sym *func, Sym *arg) · 2 unmodified lines
55285528 if (func_type == FUNC_OLD ||
55295529 (func_type == FUNC_ELLIPSIS && arg == NULL)) {
55305530 /* default casting : only need to convert float to double */
5531− if ((S->vtop->type.t & VT_BTYPE) == VT_FLOAT) {
5531+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FLOAT) {
55325532 gen_cast_s(S, VT_DOUBLE);
5533− } else if (S->vtop->type.t & VT_BITFIELD) {
5534− type.t = S->vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
5535− type.ref = S->vtop->type.ref;
5533+ } else if (S->tccgen_vtop->type.t & VT_BITFIELD) {
5534+ type.t = S->tccgen_vtop->type.t & (VT_BTYPE | VT_UNSIGNED);
5535+ type.ref = S->tccgen_vtop->type.ref;
55365536 gen_cast(S, &type);
5537− } else if (S->vtop->r & VT_MUSTCAST) {
5537+ } else if (S->tccgen_vtop->r & VT_MUSTCAST) {
55385538 force_charshort_cast(S);
55395539 }
55405540 } else if (arg == NULL) {
@@ -5547,18 +5547,18 @@ static void gfunc_param_typed(TCCState *S, Sym *func, Sym *arg) · 6 unmodified lines
55475547 }
55485548
55495549 /* parse an expression and return its type without any side effect. */
5550−static void expr_type(TCCState *S, CType *type, void (*expr_fn)(TCCState *S))
5550+static void expr_type(TCCState* S, CType *type, void (*expr_fn)(TCCState* S))
55515551 {
5552− S->nocode_wanted++;
5552+ S->tccgen_nocode_wanted++;
55535553 expr_fn(S);
5554− *type = S->vtop->type;
5554+ *type = S->tccgen_vtop->type;
55555555 vpop(S);
5556− S->nocode_wanted--;
5556+ S->tccgen_nocode_wanted--;
55575557 }
55585558
55595559 /* parse an expression of the form '(type)' or '(expr)' and return its
55605560 type */
5561−static void parse_expr_type(TCCState *S, CType *type)
5561+static void parse_expr_type(TCCState* S, CType *type)
55625562 {
55635563 int n;
55645564 AttributeDef ad;
@@ -5572,7 +5572,7 @@ static void parse_expr_type(TCCState *S, CType *type) · 7 unmodified lines
55725572 skip(S, ')');
55735573 }
55745574
5575−static void parse_type(TCCState *S, CType *type)
5575+static void parse_type(TCCState* S, CType *type)
55765576 {
55775577 AttributeDef ad;
55785578 int n;
@@ -5583,12 +5583,12 @@ static void parse_type(TCCState *S, CType *type) · 4 unmodified lines
55835583 type_decl(S, type, &ad, &n, TYPE_ABSTRACT);
55845584 }
55855585
5586−static void parse_builtin_params(TCCState *S, int nc, const char *args)
5586+static void parse_builtin_params(TCCState* S, int nc, const char *args)
55875587 {
55885588 char c, sep = '(';
55895589 CType type;
55905590 if (nc)
5591− S->nocode_wanted++;
5591+ S->tccgen_nocode_wanted++;
55925592 next(S);
55935593 if (*args == 0)
55945594 skip(S, sep);
@@ -5631,10 +5631,10 @@ static void parse_builtin_params(TCCState *S, int nc, const char *args) · 36 unmodified lines
56315631 }
56325632 skip(S, ')');
56335633 if (nc)
5634− S->nocode_wanted--;
5634+ S->tccgen_nocode_wanted--;
56355635 }
56365636
5637−static void parse_atomic(TCCState *S, int atok)
5637+static void parse_atomic(TCCState* S, int atok)
56385638 {
56395639 int size, align, arg;
56405640 CType *atom, *atom_ptr, ct = {0};
@@ -5675,7 +5675,7 @@ static void parse_atomic(TCCState *S, int atok) · 34 unmodified lines
56755675 switch (template[arg]) {
56765676 case 'a':
56775677 case 'A':
5678− atom_ptr = &S->vtop->type;
5678+ atom_ptr = &S->tccgen_vtop->type;
56795679 if ((atom_ptr->t & VT_BTYPE) != VT_PTR)
56805680 expect(S, "pointer");
56815681 atom = pointed_type(atom_ptr);
@@ -5692,8 +5692,8 @@ static void parse_atomic(TCCState *S, int atok) · 10 unmodified lines
56925692 break;
56935693
56945694 case 'p':
5695− if ((S->vtop->type.t & VT_BTYPE) != VT_PTR
5696− || type_size(pointed_type(&S->vtop->type), &align) != size)
5695+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_PTR
5696+ || type_size(pointed_type(&S->tccgen_vtop->type), &align) != size)
56975697 tcc_error(S, "pointer target type mismatch in argument %d", arg + 1);
56985698 gen_assign_cast(S, atom_ptr);
56995699 break;
@@ -5730,17 +5730,17 @@ static void parse_atomic(TCCState *S, int atok) · 30 unmodified lines
57305730 gfunc_call(S, arg);
57315731
57325732 vpush(S, &ct);
5733− PUT_R_RET(S->vtop, ct.t);
5733+ PUT_R_RET(S->tccgen_vtop, ct.t);
57345734 if (ct.t == VT_BOOL) {
57355735 #ifdef PROMOTE_RET
5736− S->vtop->r |= BFVAL(VT_MUSTCAST, 1);
5736+ S->tccgen_vtop->r |= BFVAL(VT_MUSTCAST, 1);
57375737 #else
5738− S->vtop->type.t = VT_INT;
5738+ S->tccgen_vtop->type.t = VT_INT;
57395739 #endif
57405740 }
57415741 }
57425742
5743−ST_FUNC void unary(TCCState *S)
5743+ST_FUNC void unary(TCCState* S)
57445744 {
57455745 int n, t, align, size, r, sizeof_caller;
57465746 CType type;
@@ -5757,7 +5757,7 @@ ST_FUNC void unary(TCCState *S) · 10 unmodified lines
57575757 /* XXX: GCC 2.95.3 does not generate a table although it should be
57585758 better here */
57595759 tok_next:
5760− switch(S->tok) {
5760+ switch(S->tccpp_tok) {
57615761 case TOK_EXTENSION:
57625762 next(S);
57635763 goto tok_next;
@@ -5771,7 +5771,7 @@ ST_FUNC void unary(TCCState *S) · 7 unmodified lines
57715771 t = VT_INT;
57725772 push_tokc:
57735773 type.t = t;
5774− vsetc(S, &type, VT_CONST, &S->tokc);
5774+ vsetc(S, &type, VT_CONST, &S->tccpp_tokc);
57755775 next(S);
57765776 break;
57775777 case TOK_CUINT:
@@ -5849,7 +5849,7 @@ ST_FUNC void unary(TCCState *S) · 71 unmodified lines
58495849 type_decl(S, &type, &ad, &n, TYPE_ABSTRACT);
58505850 skip(S, ')');
58515851 /* check ISOC99 compound literal */
5852− if (S->tok == '{') {
5852+ if (S->tccpp_tok == '{') {
58535853 /* data is allocated locally by default */
58545854 if (S->tccgen_global_expr)
58555855 r = VT_CONST;
@@ -5868,11 +5868,11 @@ ST_FUNC void unary(TCCState *S) · 12 unmodified lines
58685868 unary(S);
58695869 gen_cast(S, &type);
58705870 }
5871− } else if (S->tok == '{') {
5872− int saved_nocode_wanted = S->nocode_wanted;
5873− if (S->tccgen_const_wanted && !(S->nocode_wanted & unevalmask))
5871+ } else if (S->tccpp_tok == '{') {
5872+ int saved_nocode_wanted = S->tccgen_nocode_wanted;
5873+ if (S->tccgen_const_wanted && !(S->tccgen_nocode_wanted & unevalmask))
58745874 expect(S, "constant");
5875− if (0 == S->local_scope)
5875+ if (0 == S->tccgen_local_scope)
58765876 tcc_error(S, "statement expression outside of function");
58775877 /* save all registers */
58785878 save_regs(S, 0);
@@ -5882,7 +5882,7 @@ ST_FUNC void unary(TCCState *S) · 3 unmodified lines
58825882 outside, so any reactivation of code emission (from labels
58835883 or loop heads) can be disabled again after the end of it. */
58845884 block(S, 1);
5885− S->nocode_wanted = saved_nocode_wanted;
5885+ S->tccgen_nocode_wanted = saved_nocode_wanted;
58865886 skip(S, ')');
58875887 } else {
58885888 gexpr(S);
@@ -5902,12 +5902,12 @@ ST_FUNC void unary(TCCState *S) · 13 unmodified lines
59025902 functions are not lvalues, we only have to handle it
59035903 there and in function calls. */
59045904 /* arrays can also be used although they are not lvalues */
5905− if ((S->vtop->type.t & VT_BTYPE) != VT_FUNC &&
5906− !(S->vtop->type.t & VT_ARRAY))
5905+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_FUNC &&
5906+ !(S->tccgen_vtop->type.t & VT_ARRAY))
59075907 test_lvalue(S);
5908− if (S->vtop->sym)
5909− S->vtop->sym->a.addrtaken = 1;
5910− mk_pointer(S, &S->vtop->type);
5908+ if (S->tccgen_vtop->sym)
5909+ S->tccgen_vtop->sym->a.addrtaken = 1;
5910+ mk_pointer(S, &S->tccgen_vtop->type);
59115911 gaddrof(S);
59125912 break;
59135913 case '!':
@@ -5924,12 +5924,12 @@ ST_FUNC void unary(TCCState *S) · 10 unmodified lines
59245924 case '+':
59255925 next(S);
59265926 unary(S);
5927− if ((S->vtop->type.t & VT_BTYPE) == VT_PTR)
5927+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_PTR)
59285928 tcc_error(S, "pointer not accepted for unary plus");
59295929 /* In order to force cast, we add zero, except for floating point
59305930 where we really need an noop (otherwise -0.0 will be transformed
59315931 into +0.0). */
5932− if (!is_float(S->vtop->type.t)) {
5932+ if (!is_float(S->tccgen_vtop->type.t)) {
59335933 vpushi(S, 0);
59345934 gen_op(S, '+');
59355935 }
@@ -5938,13 +5938,13 @@ ST_FUNC void unary(TCCState *S) · 2 unmodified lines
59385938 case TOK_ALIGNOF1:
59395939 case TOK_ALIGNOF2:
59405940 case TOK_ALIGNOF3:
5941− t = S->tok;
5941+ t = S->tccpp_tok;
59425942 next(S);
59435943 S->tccgen_in_sizeof++;
59445944 expr_type(S, &type, unary); /* Perform a in_sizeof = 0; */
59455945 s = NULL;
5946− if (S->vtop[1].r & VT_SYM)
5947− s = S->vtop[1].sym; /* hack: accessing previous vtop */
5946+ if (S->tccgen_vtop[1].r & VT_SYM)
5947+ s = S->tccgen_vtop[1].sym; /* hack: accessing previous vtop */
59485948 size = type_size(&type, &align);
59495949 if (s && s->a.aligned)
59505950 align = 1 << (s->a.aligned - 1);
@@ -5959,7 +5959,7 @@ ST_FUNC void unary(TCCState *S) · 8 unmodified lines
59595959 } else {
59605960 vpushs(S, align);
59615961 }
5962− S->vtop->type.t |= VT_UNSIGNED;
5962+ S->tccgen_vtop->type.t |= VT_UNSIGNED;
59635963 break;
59645964
59655965 case TOK_builtin_expect:
@@ -5969,10 +5969,10 @@ ST_FUNC void unary(TCCState *S) · 3 unmodified lines
59695969 break;
59705970 case TOK_builtin_types_compatible_p:
59715971 parse_builtin_params(S, 0, "tt");
5972− S->vtop[-1].type.t &= ~(VT_CONSTANT | VT_VOLATILE);
5973− S->vtop[0].type.t &= ~(VT_CONSTANT | VT_VOLATILE);
5974− n = is_compatible_types(&S->vtop[-1].type, &S->vtop[0].type);
5975− S->vtop -= 2;
5972+ S->tccgen_vtop[-1].type.t &= ~(VT_CONSTANT | VT_VOLATILE);
5973+ S->tccgen_vtop[0].type.t &= ~(VT_CONSTANT | VT_VOLATILE);
5974+ n = is_compatible_types(&S->tccgen_vtop[-1].type, &S->tccgen_vtop[0].type);
5975+ S->tccgen_vtop -= 2;
59765976 vpushi(S, n);
59775977 break;
59785978 case TOK_builtin_choose_expr:
@@ -5983,46 +5983,46 @@ ST_FUNC void unary(TCCState *S) · 4 unmodified lines
59835983 c = expr_const64(S);
59845984 skip(S, ',');
59855985 if (!c) {
5986− S->nocode_wanted++;
5986+ S->tccgen_nocode_wanted++;
59875987 }
59885988 expr_eq(S);
59895989 if (!c) {
59905990 vpop(S);
5991− S->nocode_wanted--;
5991+ S->tccgen_nocode_wanted--;
59925992 }
59935993 skip(S, ',');
59945994 if (c) {
5995− S->nocode_wanted++;
5995+ S->tccgen_nocode_wanted++;
59965996 }
59975997 expr_eq(S);
59985998 if (c) {
59995999 vpop(S);
6000− S->nocode_wanted--;
6000+ S->tccgen_nocode_wanted--;
60016001 }
60026002 skip(S, ')');
60036003 }
60046004 break;
60056005 case TOK_builtin_constant_p:
60066006 parse_builtin_params(S, 1, "e");
6007− n = (S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
6008− !((S->vtop->r & VT_SYM) && S->vtop->sym->a.addrtaken);
6009− S->vtop--;
6007+ n = (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
6008+ !((S->tccgen_vtop->r & VT_SYM) && S->tccgen_vtop->sym->a.addrtaken);
6009+ S->tccgen_vtop--;
60106010 vpushi(S, n);
60116011 break;
60126012 case TOK_builtin_frame_address:
60136013 case TOK_builtin_return_address:
60146014 {
6015− int tok1 = S->tok;
6015+ int tok1 = S->tccpp_tok;
60166016 int level;
60176017 next(S);
60186018 skip(S, '(');
6019− if (S->tok != TOK_CINT) {
6019+ if (S->tccpp_tok != TOK_CINT) {
60206020 tcc_error(S, "%s only takes positive integers",
60216021 tok1 == TOK_builtin_return_address ?
60226022 "__builtin_return_address" :
60236023 "__builtin_frame_address");
60246024 }
6025− level = (uint32_t)S->tokc.i;
6025+ level = (uint32_t)S->tccpp_tokc.i;
60266026 next(S);
60276027 skip(S, ')');
60286028 type.t = VT_VOID;
@@ -6033,7 +6033,7 @@ ST_FUNC void unary(TCCState *S) · 4 unmodified lines
60336033 vpushi(S, 2*PTR_SIZE);
60346034 gen_op(S, '-');
60356035 #endif
6036− mk_pointer(S, &S->vtop->type);
6036+ mk_pointer(S, &S->tccgen_vtop->type);
60376037 indir(S); /* -> parent frame */
60386038 }
60396039 if (tok1 == TOK_builtin_return_address) {
@@ -6048,7 +6048,7 @@ ST_FUNC void unary(TCCState *S) · 8 unmodified lines
60486048 vpushi(S, PTR_SIZE);
60496049 gen_op(S, '+');
60506050 #endif
6051− mk_pointer(S, &S->vtop->type);
6051+ mk_pointer(S, &S->tccgen_vtop->type);
60526052 indir(S);
60536053 }
60546054 }
@@ -6056,7 +6056,7 @@ ST_FUNC void unary(TCCState *S) · 1 unmodified line
60566056 #ifdef TCC_TARGET_RISCV64
60576057 case TOK_builtin_va_start:
60586058 parse_builtin_params(S, 0, "ee");
6059− r = S->vtop->r & VT_VALMASK;
6059+ r = S->tccgen_vtop->r & VT_VALMASK;
60606060 if (r == VT_LLOCAL)
60616061 r = VT_LOCAL;
60626062 if (r != VT_LOCAL)
@@ -6069,20 +6069,20 @@ ST_FUNC void unary(TCCState *S) · 6 unmodified lines
60696069 #ifdef TCC_TARGET_PE
60706070 case TOK_builtin_va_start:
60716071 parse_builtin_params(S, 0, "ee");
6072− r = S->vtop->r & VT_VALMASK;
6072+ r = S->tccgen_vtop->r & VT_VALMASK;
60736073 if (r == VT_LLOCAL)
60746074 r = VT_LOCAL;
60756075 if (r != VT_LOCAL)
60766076 tcc_error(S, "__builtin_va_start expects a local variable");
6077− S->vtop->r = r;
6078− S->vtop->type = S->char_pointer_type;
6079− S->vtop->c.i += 8;
6077+ S->tccgen_vtop->r = r;
6078+ S->tccgen_vtop->type = S->tccgen_char_pointer_type;
6079+ S->tccgen_vtop->c.i += 8;
60806080 vstore(S);
60816081 break;
60826082 #else
60836083 case TOK_builtin_va_arg_types:
60846084 parse_builtin_params(S, 0, "t");
6085− vpushi(S, classify_x86_64_va_arg(&S->vtop->type));
6085+ vpushi(S, classify_x86_64_va_arg(&S->tccgen_vtop->type));
60866086 vswap(S);
60876087 vpop(S);
60886088 break;
@@ -6095,23 +6095,23 @@ ST_FUNC void unary(TCCState *S) · 6 unmodified lines
60956095 //xx check types
60966096 gen_va_start(S);
60976097 vpushi(S, 0);
6098− S->vtop->type.t = VT_VOID;
6098+ S->tccgen_vtop->type.t = VT_VOID;
60996099 break;
61006100 }
61016101 case TOK_builtin_va_arg: {
61026102 parse_builtin_params(S, 0, "et");
6103− type = S->vtop->type;
6103+ type = S->tccgen_vtop->type;
61046104 vpop(S);
61056105 //xx check types
61066106 gen_va_arg(S, &type);
6107− S->vtop->type = type;
6107+ S->tccgen_vtop->type = type;
61086108 break;
61096109 }
61106110 case TOK___arm64_clear_cache: {
61116111 parse_builtin_params(S, 0, "ee");
61126112 gen_clear_cache(S);
61136113 vpushi(S, 0);
6114− S->vtop->type.t = VT_VOID;
6114+ S->tccgen_vtop->type.t = VT_VOID;
61156115 break;
61166116 }
61176117 #endif
@@ -6126,13 +6126,13 @@ ST_FUNC void unary(TCCState *S) · 8 unmodified lines
61266126 case TOK___atomic_fetch_or:
61276127 case TOK___atomic_fetch_xor:
61286128 case TOK___atomic_fetch_and:
6129− parse_atomic(S, S->tok);
6129+ parse_atomic(S, S->tccpp_tok);
61306130 break;
61316131
61326132 /* pre operations */
61336133 case TOK_INC:
61346134 case TOK_DEC:
6135− t = S->tok;
6135+ t = S->tccpp_tok;
61366136 next(S);
61376137 unary(S);
61386138 inc(S, 0, t);
@@ -6140,7 +6140,7 @@ ST_FUNC void unary(TCCState *S) · 1 unmodified line
61406140 case '-':
61416141 next(S);
61426142 unary(S);
6143− if (is_float(S->vtop->type.t)) {
6143+ if (is_float(S->tccgen_vtop->type.t)) {
61446144 gen_opif(S, TOK_NEG);
61456145 } else {
61466146 vpushi(S, 0);
@@ -6153,11 +6153,11 @@ ST_FUNC void unary(TCCState *S) · 6 unmodified lines
61536153 goto tok_identifier;
61546154 next(S);
61556155 /* allow to take the address of a label */
6156− if (S->tok < TOK_UIDENT)
6156+ if (S->tccpp_tok < TOK_UIDENT)
61576157 expect(S, "label identifier");
6158− s = label_find(S, S->tok);
6158+ s = label_find(S, S->tccpp_tok);
61596159 if (!s) {
6160− s = label_push(S, &S->tccgen_global_label_stack, S->tok, LABEL_FORWARD);
6160+ s = label_push(S, &S->tccgen_global_label_stack, S->tccpp_tok, LABEL_FORWARD);
61616161 } else {
61626162 if (s->r == LABEL_DECLARED)
61636163 s->r = LABEL_FORWARD;
@@ -6191,7 +6191,7 @@ ST_FUNC void unary(TCCState *S) · 27 unmodified lines
61916191 for (;;) {
61926192 learn = 0;
61936193 skip(S, ',');
6194− if (S->tok == TOK_DEFAULT) {
6194+ if (S->tccpp_tok == TOK_DEFAULT) {
61956195 if (has_default)
61966196 tcc_error(S, "too many 'default'");
61976197 has_default = 1;
@@ -6224,7 +6224,7 @@ ST_FUNC void unary(TCCState *S) · 26 unmodified lines
62246224 } else {
62256225 skip_or_save_block(S, NULL);
62266226 }
6227− if (S->tok == ')')
6227+ if (S->tccpp_tok == ')')
62286228 break;
62296229 }
62306230 if (!str) {
@@ -6235,7 +6235,7 @@ ST_FUNC void unary(TCCState *S) · 4 unmodified lines
62356235 begin_macro(S, str, 1);
62366236 next(S);
62376237 expr_eq(S);
6238− if (S->tok != TOK_EOF)
6238+ if (S->tccpp_tok != TOK_EOF)
62396239 expect(S, ",");
62406240 end_macro(S);
62416241 next(S);
@@ -6246,7 +6246,7 @@ ST_FUNC void unary(TCCState *S) · 4 unmodified lines
62466246 n = 0x7fc00000;
62476247 special_math_val:
62486248 vpushi(S, n);
6249− S->vtop->type.t = VT_FLOAT;
6249+ S->tccgen_vtop->type.t = VT_FLOAT;
62506250 next(S);
62516251 break;
62526252 case TOK___SNAN__:
@@ -6258,14 +6258,14 @@ special_math_val: · 5 unmodified lines
62586258
62596259 default:
62606260 tok_identifier:
6261− t = S->tok;
6261+ t = S->tccpp_tok;
62626262 next(S);
62636263 if (t < TOK_UIDENT)
62646264 expect(S, "identifier");
62656265 s = sym_find(S, t);
62666266 if (!s || IS_ASM_SYM(s)) {
62676267 const char *name = get_tok_str(S, t, NULL);
6268− if (S->tok != '(')
6268+ if (S->tccpp_tok != '(')
62696269 tcc_error(S, "'%s' undeclared", name);
62706270 /* for simple function calls, we tolerate undeclared
62716271 external reference to int() function */
@@ -6284,84 +6284,84 @@ special_math_val: · 12 unmodified lines
62846284 /* Point to s as backpointer (even without r&VT_SYM).
62856285 Will be used by at least the x86 inline asm parser for
62866286 regvars. */
6287− S->vtop->sym = s;
6287+ S->tccgen_vtop->sym = s;
62886288
62896289 if (r & VT_SYM) {
6290− S->vtop->c.i = 0;
6290+ S->tccgen_vtop->c.i = 0;
62916291 } else if (r == VT_CONST && IS_ENUM_VAL(s->type.t)) {
6292− S->vtop->c.i = s->enum_val;
6292+ S->tccgen_vtop->c.i = s->enum_val;
62936293 }
62946294 break;
62956295 }
62966296
62976297 /* post operations */
62986298 while (1) {
6299− if (S->tok == TOK_INC || S->tok == TOK_DEC) {
6300− inc(S, 1, S->tok);
6299+ if (S->tccpp_tok == TOK_INC || S->tccpp_tok == TOK_DEC) {
6300+ inc(S, 1, S->tccpp_tok);
63016301 next(S);
6302− } else if (S->tok == '.' || S->tok == TOK_ARROW || S->tok == TOK_CDOUBLE) {
6302+ } else if (S->tccpp_tok == '.' || S->tccpp_tok == TOK_ARROW || S->tccpp_tok == TOK_CDOUBLE) {
63036303 int qualifiers, cumofs = 0;
63046304 /* field */
6305− if (S->tok == TOK_ARROW)
6305+ if (S->tccpp_tok == TOK_ARROW)
63066306 indir(S);
6307− qualifiers = S->vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
6307+ qualifiers = S->tccgen_vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
63086308 test_lvalue(S);
63096309 gaddrof(S);
63106310 /* expect pointer on structure */
6311− if ((S->vtop->type.t & VT_BTYPE) != VT_STRUCT)
6311+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_STRUCT)
63126312 expect(S, "struct or union");
6313− if (S->tok == TOK_CDOUBLE)
6313+ if (S->tccpp_tok == TOK_CDOUBLE)
63146314 expect(S, "field name");
63156315 next(S);
6316− if (S->tok == TOK_CINT || S->tok == TOK_CUINT)
6316+ if (S->tccpp_tok == TOK_CINT || S->tccpp_tok == TOK_CUINT)
63176317 expect(S, "field name");
6318− s = find_field(&S->vtop->type, S->tok, &cumofs);
6318+ s = find_field(&S->tccgen_vtop->type, S->tccpp_tok, &cumofs);
63196319 if (!s)
6320− tcc_error(S, "field not found: %s", get_tok_str(S, S->tok & ~SYM_FIELD, &S->tokc));
6320+ tcc_error(S, "field not found: %s", get_tok_str(S, S->tccpp_tok & ~SYM_FIELD, &S->tccpp_tokc));
63216321 /* add field offset to pointer */
6322− S->vtop->type = S->char_pointer_type; /* change type to 'char *' */
6322+ S->tccgen_vtop->type = S->tccgen_char_pointer_type; /* change type to 'char *' */
63236323 vpushi(S, cumofs + s->c);
63246324 gen_op(S, '+');
63256325 /* change type to field type, and set to lvalue */
6326− S->vtop->type = s->type;
6327− S->vtop->type.t |= qualifiers;
6326+ S->tccgen_vtop->type = s->type;
6327+ S->tccgen_vtop->type.t |= qualifiers;
63286328 /* an array is never an lvalue */
6329− if (!(S->vtop->type.t & VT_ARRAY)) {
6330− S->vtop->r |= VT_LVAL;
6329+ if (!(S->tccgen_vtop->type.t & VT_ARRAY)) {
6330+ S->tccgen_vtop->r |= VT_LVAL;
63316331 #ifdef CONFIG_TCC_BCHECK
63326332 /* if bound checking, the referenced pointer must be checked */
63336333 if (S->do_bounds_check)
6334− S->vtop->r |= VT_MUSTBOUND;
6334+ S->tccgen_vtop->r |= VT_MUSTBOUND;
63356335 #endif
63366336 }
63376337 next(S);
6338− } else if (S->tok == '[') {
6338+ } else if (S->tccpp_tok == '[') {
63396339 next(S);
63406340 gexpr(S);
63416341 gen_op(S, '+');
63426342 indir(S);
63436343 skip(S, ']');
6344− } else if (S->tok == '(') {
6344+ } else if (S->tccpp_tok == '(') {
63456345 SValue ret;
63466346 Sym *sa;
63476347 int nb_args, ret_nregs, ret_align, regsize, variadic;
63486348
63496349 /* function call */
6350− if ((S->vtop->type.t & VT_BTYPE) != VT_FUNC) {
6350+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_FUNC) {
63516351 /* pointer test (no array accepted) */
6352− if ((S->vtop->type.t & (VT_BTYPE | VT_ARRAY)) == VT_PTR) {
6353− S->vtop->type = *pointed_type(&S->vtop->type);
6354− if ((S->vtop->type.t & VT_BTYPE) != VT_FUNC)
6352+ if ((S->tccgen_vtop->type.t & (VT_BTYPE | VT_ARRAY)) == VT_PTR) {
6353+ S->tccgen_vtop->type = *pointed_type(&S->tccgen_vtop->type);
6354+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_FUNC)
63556355 goto error_func;
63566356 } else {
63576357 error_func:
63586358 expect(S, "function pointer");
63596359 }
63606360 } else {
6361− S->vtop->r &= ~VT_LVAL; /* no lvalue */
6361+ S->tccgen_vtop->r &= ~VT_LVAL; /* no lvalue */
63626362 }
63636363 /* get return type */
6364− s = S->vtop->type.ref;
6364+ s = S->tccgen_vtop->type.ref;
63656365 next(S);
63666366 sa = s->next; /* first parameter */
63676367 nb_args = regsize = 0;
@@ -6383,19 +6383,19 @@ special_math_val: · 15 unmodified lines
63836383 while (size & (size - 1))
63846384 size = (size | (size - 1)) + 1;
63856385 #endif
6386− S->loc = (S->loc - size) & -align;
6386+ S->tccgen_loc = (S->tccgen_loc - size) & -align;
63876387 ret.type = s->type;
63886388 ret.r = VT_LOCAL | VT_LVAL;
63896389 /* pass it as 'int' to avoid structure arg passing
63906390 problems */
6391− vseti(S, VT_LOCAL, S->loc);
6391+ vseti(S, VT_LOCAL, S->tccgen_loc);
63926392 #ifdef CONFIG_TCC_BCHECK
63936393 if (S->do_bounds_check)
6394− --S->loc;
6394+ --S->tccgen_loc;
63956395 #endif
6396− ret.c = S->vtop->c;
6396+ ret.c = S->tccgen_vtop->c;
63976397 if (ret_nregs < 0)
6398− S->vtop--;
6398+ S->tccgen_vtop--;
63996399 else
64006400 nb_args++;
64016401 }
@@ -6409,14 +6409,14 @@ special_math_val: · 7 unmodified lines
64096409 ret.c.i = 0;
64106410 PUT_R_RET(&ret, ret.type.t);
64116411 }
6412− if (S->tok != ')') {
6412+ if (S->tccpp_tok != ')') {
64136413 for(;;) {
64146414 expr_eq(S);
64156415 gfunc_param_typed(S, s, sa);
64166416 nb_args++;
64176417 if (sa)
64186418 sa = sa->next;
6419− if (S->tok == ')')
6419+ if (S->tccpp_tok == ')')
64206420 break;
64216421 skip(S, ',');
64226422 }
@@ -6435,7 +6435,7 @@ special_math_val: · 12 unmodified lines
64356435 /* return value */
64366436 for (r = ret.r + ret_nregs + !ret_nregs; r-- > ret.r;) {
64376437 vsetc(S, &ret.type, r, &ret.c);
6438− S->vtop->r2 = ret.r2; /* Loop only happens when r2 is VT_CONST */
6438+ S->tccgen_vtop->r2 = ret.r2; /* Loop only happens when r2 is VT_CONST */
64396439 }
64406440
64416441 /* handle packed struct return */
@@ -6447,14 +6447,14 @@ special_math_val: · 5 unmodified lines
64476447 space. Assume register size is power of 2. */
64486448 if (regsize > align)
64496449 align = regsize;
6450− S->loc = (S->loc - size) & -align;
6451− addr = S->loc;
6450+ S->tccgen_loc = (S->tccgen_loc - size) & -align;
6451+ addr = S->tccgen_loc;
64526452 offset = 0;
64536453 for (;;) {
64546454 vset(S, &ret.type, VT_LOCAL | VT_LVAL, addr + offset);
64556455 vswap(S);
64566456 vstore(S);
6457− S->vtop--;
6457+ S->tccgen_vtop--;
64586458 if (--ret_nregs == 0)
64596459 break;
64606460 offset += regsize;
@@ -6470,9 +6470,9 @@ special_math_val: · 9 unmodified lines
64706470 t = s->type.t & VT_BTYPE;
64716471 if (t == VT_BYTE || t == VT_SHORT || t == VT_BOOL) {
64726472 #ifdef PROMOTE_RET
6473− S->vtop->r |= BFVAL(VT_MUSTCAST, 1);
6473+ S->tccgen_vtop->r |= BFVAL(VT_MUSTCAST, 1);
64746474 #else
6475− S->vtop->type.t = VT_INT;
6475+ S->tccgen_vtop->type.t = VT_INT;
64766476 #endif
64776477 }
64786478 }
@@ -6494,7 +6494,7 @@ static void expr_prod(void) · 15 unmodified lines
64946494 int t;
64956495
64966496 unary(S);
6497− while ((t = Stok) == '*' || t == '/' || t == '%') {
6497+ while ((t = Stccpp_tok) == '*' || t == '/' || t == '%') {
64986498 next(S);
64996499 unary(S);
65006500 gen_op(S, t);
@@ -6506,7 +6506,7 @@ static void expr_sum(void) · 5 unmodified lines
65066506 int t;
65076507
65086508 expr_prod();
6509− while ((t = Stok) == '+' || t == '-') {
6509+ while ((t = Stccpp_tok) == '+' || t == '-') {
65106510 next(S);
65116511 expr_prod();
65126512 gen_op(S, t);
@@ -6518,7 +6518,7 @@ static void expr_shift(void) · 5 unmodified lines
65186518 int t;
65196519
65206520 expr_sum();
6521− while ((t = Stok) == TOK_SHL || t == TOK_SAR) {
6521+ while ((t = Stccpp_tok) == TOK_SHL || t == TOK_SAR) {
65226522 next(S);
65236523 expr_sum();
65246524 gen_op(S, t);
@@ -6530,7 +6530,7 @@ static void expr_cmp(void) · 5 unmodified lines
65306530 int t;
65316531
65326532 expr_shift();
6533− while (((t = Stok) >= TOK_ULE && t <= TOK_GT) ||
6533+ while (((t = Stccpp_tok) >= TOK_ULE && t <= TOK_GT) ||
65346534 t == TOK_ULT || t == TOK_UGE) {
65356535 next(S);
65366536 expr_shift();
@@ -6543,7 +6543,7 @@ static void expr_cmpeq(void) · 6 unmodified lines
65436543 int t;
65446544
65456545 expr_cmp();
6546− while ((t = Stok) == TOK_EQ || t == TOK_NE) {
6546+ while ((t = Stccpp_tok) == TOK_EQ || t == TOK_NE) {
65476547 next(S);
65486548 expr_cmp();
65496549 gen_op(S, t);
@@ -6553,7 +6553,7 @@ static void expr_cmpeq(void) · 3 unmodified lines
65536553 static void expr_and(void)
65546554 {
65556555 expr_cmpeq();
6556− while (Stok == '&') {
6556+ while (Stccpp_tok == '&') {
65576557 next(S);
65586558 expr_cmpeq();
65596559 gen_op(S, '&');
@@ -6563,7 +6563,7 @@ static void expr_and(void) · 3 unmodified lines
65636563 static void expr_xor(void)
65646564 {
65656565 expr_and();
6566− while (Stok == '^') {
6566+ while (Stccpp_tok == '^') {
65676567 next(S);
65686568 expr_and();
65696569 gen_op(S, '^');
@@ -6573,7 +6573,7 @@ static void expr_xor(void) · 3 unmodified lines
65736573 static void expr_or(void)
65746574 {
65756575 expr_xor();
6576− while (Stok == '|') {
6576+ while (Stccpp_tok == '|') {
65776577 next(S);
65786578 expr_xor();
65796579 gen_op(S, '|');
@@ -6585,15 +6585,15 @@ static void expr_landor(S, int op); · 5 unmodified lines
65856585 static void expr_land(void)
65866586 {
65876587 expr_or();
6588− if (Stok == TOK_LAND)
6589− expr_landor(S, Stok);
6588+ if (Stccpp_tok == TOK_LAND)
6589+ expr_landor(S, Stccpp_tok);
65906590 }
65916591
65926592 static void expr_lor(void)
65936593 {
65946594 expr_land();
6595− if (Stok == TOK_LOR)
6596− expr_landor(S, Stok);
6595+ if (Stccpp_tok == TOK_LOR)
6596+ expr_landor(S, Stccpp_tok);
65976597 }
65986598
65996599 # define expr_landor_next(op) op == TOK_LAND ? expr_or() : expr_land()
@@ -6620,7 +6620,7 @@ static int precedence(int tok) · 20 unmodified lines
66206620 return 0;
66216621 }
66226622 }
6623−static void init_prec(TCCState *S)
6623+static void init_prec(TCCState* S)
66246624 {
66256625 int i;
66266626 for (i = 0; i < 256; i++)
@@ -6628,22 +6628,22 @@ static void init_prec(TCCState *S) · 1 unmodified line
66286628 }
66296629 #define precedence(i) ((unsigned)i < 256 ? S->tccgen_prec[i] : 0)
66306630
6631−static void expr_landor(TCCState *S, int op);
6631+static void expr_landor(TCCState* S, int op);
66326632
6633−static void expr_infix(TCCState *S, int p)
6633+static void expr_infix(TCCState* S, int p)
66346634 {
6635− int t = S->tok, p2;
6635+ int t = S->tccpp_tok, p2;
66366636 while ((p2 = precedence(t)) >= p) {
66376637 if (t == TOK_LOR || t == TOK_LAND) {
66386638 expr_landor(S, t);
66396639 } else {
66406640 next(S);
66416641 unary(S);
6642− if (precedence(S->tok) > p2)
6642+ if (precedence(S->tccpp_tok) > p2)
66436643 expr_infix(S, p2 + 1);
66446644 gen_op(S, t);
66456645 }
6646− t = S->tok;
6646+ t = S->tccpp_tok;
66476647 }
66486648 }
66496649 #endif
@@ -6651,20 +6651,20 @@ static void expr_infix(TCCState *S, int p) · 1 unmodified line
66516651 /* Assuming vtop is a value used in a conditional context
66526652 (i.e. compared with zero) return 0 if it's false, 1 if
66536653 true and -1 if it can't be statically determined. */
6654−static int condition_3way(TCCState *S)
6654+static int condition_3way(TCCState* S)
66556655 {
66566656 int c = -1;
6657− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
6658− (!(S->vtop->r & VT_SYM) || !S->vtop->sym->a.weak)) {
6657+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
6658+ (!(S->tccgen_vtop->r & VT_SYM) || !S->tccgen_vtop->sym->a.weak)) {
66596659 vdup(S);
66606660 gen_cast_s(S, VT_BOOL);
6661− c = S->vtop->c.i;
6661+ c = S->tccgen_vtop->c.i;
66626662 vpop(S);
66636663 }
66646664 return c;
66656665 }
66666666
6667−static void expr_landor(TCCState *S, int op)
6667+static void expr_landor(TCCState* S, int op)
66686668 {
66696669 int t = 0, cc = 1, f = 0, i = op == TOK_LAND, c;
66706670 for(;;) {
@@ -6672,8 +6672,8 @@ static void expr_landor(TCCState *S, int op) · 1 unmodified line
66726672 if (c < 0)
66736673 save_regs(S, 1), cc = 0;
66746674 else if (c != i)
6675− S->nocode_wanted++, f = 1;
6676− if (S->tok != op)
6675+ S->tccgen_nocode_wanted++, f = 1;
6676+ if (S->tccpp_tok != op)
66776677 break;
66786678 if (c < 0)
66796679 t = gvtst(S, i, t);
@@ -6686,7 +6686,7 @@ static void expr_landor(TCCState *S, int op) · 6 unmodified lines
66866686 vpop(S);
66876687 vpushi(S, i ^ f);
66886688 gsym(S, t);
6689− S->nocode_wanted -= f;
6689+ S->tccgen_nocode_wanted -= f;
66906690 } else {
66916691 gvtst_set(S, i, t);
66926692 }
@@ -6702,7 +6702,7 @@ static int is_cond_bool(SValue *sv) · 9 unmodified lines
67026702 return 0;
67036703 }
67046704
6705−static void expr_cond(TCCState *S)
6705+static void expr_cond(TCCState* S)
67066706 {
67076707 int tt, u, r1, r2, rc, t1, t2, islv, c, g;
67086708 SValue sv;
@@ -6710,10 +6710,10 @@ static void expr_cond(TCCState *S) · 1 unmodified line
67106710 int ncw_prev;
67116711
67126712 expr_lor();
6713− if (S->tok == '?') {
6713+ if (S->tccpp_tok == '?') {
67146714 next(S);
67156715 c = condition_3way(S);
6716− g = (S->tok == ':' && gnu_ext);
6716+ g = (S->tccpp_tok == ':' && gnu_ext);
67176717 tt = 0;
67186718 if (!g) {
67196719 if (c < 0) {
@@ -6730,16 +6730,16 @@ static void expr_cond(TCCState *S) · 10 unmodified lines
67306730 tt = gvtst(S, 0, 0);
67316731 }
67326732
6733− ncw_prev = S->nocode_wanted;
6733+ ncw_prev = S->tccgen_nocode_wanted;
67346734 if (c == 0)
6735− S->nocode_wanted++;
6735+ S->tccgen_nocode_wanted++;
67366736 if (!g)
67376737 gexpr(S);
67386738
6739− if ((S->vtop->type.t & VT_BTYPE) == VT_FUNC)
6740− mk_pointer(S, &S->vtop->type);
6741− sv = *S->vtop; /* save value to handle it later */
6742− S->vtop--; /* no vpop so that FP stack is not flushed */
6739+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FUNC)
6740+ mk_pointer(S, &S->tccgen_vtop->type);
6741+ sv = *S->tccgen_vtop; /* save value to handle it later */
6742+ S->tccgen_vtop--; /* no vpop so that FP stack is not flushed */
67436743
67446744 if (g) {
67456745 u = tt;
@@ -6749,13 +6749,13 @@ static void expr_cond(TCCState *S) · 3 unmodified lines
67496749 } else
67506750 u = 0;
67516751
6752− S->nocode_wanted = ncw_prev;
6752+ S->tccgen_nocode_wanted = ncw_prev;
67536753 if (c == 1)
6754− S->nocode_wanted++;
6754+ S->tccgen_nocode_wanted++;
67556755 skip(S, ':');
67566756 expr_cond(S);
67576757
6758− if (c < 0 && is_cond_bool(S->vtop) && is_cond_bool(&sv)) {
6758+ if (c < 0 && is_cond_bool(S->tccgen_vtop) && is_cond_bool(&sv)) {
67596759 /* optimize "if (f ? a > b : c || d) ..." for example, where normally
67606760 "a < b" and "c || d" would be forced to "(int)0/1" first, whereas
67616761 this code jumps directly to the if's then/else branches. */
@@ -6766,29 +6766,29 @@ static void expr_cond(TCCState *S) · 4 unmodified lines
67666766 /* combine jump targets of 2nd op with VT_CMP of 1st op */
67676767 gvtst_set(S, 0, t1);
67686768 gvtst_set(S, 1, t2);
6769− S->nocode_wanted = ncw_prev;
6769+ S->tccgen_nocode_wanted = ncw_prev;
67706770 // tcc_warning(S, "two conditions expr_cond");
67716771 return;
67726772 }
67736773
6774− if ((S->vtop->type.t & VT_BTYPE) == VT_FUNC)
6775− mk_pointer(S, &S->vtop->type);
6774+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_FUNC)
6775+ mk_pointer(S, &S->tccgen_vtop->type);
67766776
67776777 /* cast operands to correct type according to ISOC rules */
6778− if (!combine_types(S, &type, &sv, S->vtop, '?'))
6779− type_incompatibility_error(S, &sv.type, &S->vtop->type,
6778+ if (!combine_types(S, &type, &sv, S->tccgen_vtop, '?'))
6779+ type_incompatibility_error(S, &sv.type, &S->tccgen_vtop->type,
67806780 "type mismatch in conditional expression (have '%s' and '%s')");
67816781 /* keep structs lvalue by transforming `(expr ? a : b)` to `*(expr ? &a : &b)` so
67826782 that `(expr ? a : b).mem` does not error with "lvalue expected" */
6783− islv = (S->vtop->r & VT_LVAL) && (sv.r & VT_LVAL) && VT_STRUCT == (type.t & VT_BTYPE);
6783+ islv = (S->tccgen_vtop->r & VT_LVAL) && (sv.r & VT_LVAL) && VT_STRUCT == (type.t & VT_BTYPE);
67846784
67856785 /* now we convert second operand */
67866786 if (c != 1) {
67876787 gen_cast(S, &type);
67886788 if (islv) {
6789− mk_pointer(S, &S->vtop->type);
6789+ mk_pointer(S, &S->tccgen_vtop->type);
67906790 gaddrof(S);
6791− } else if (VT_STRUCT == (S->vtop->type.t & VT_BTYPE))
6791+ } else if (VT_STRUCT == (S->tccgen_vtop->type.t & VT_BTYPE))
67926792 gaddrof(S);
67936793 }
67946794
@@ -6804,24 +6804,24 @@ static void expr_cond(TCCState *S) · 9 unmodified lines
68046804 tt = gjmp(S, 0);
68056805 }
68066806 gsym(S, u);
6807− S->nocode_wanted = ncw_prev;
6807+ S->tccgen_nocode_wanted = ncw_prev;
68086808
68096809 /* this is horrible, but we must also convert first
68106810 operand */
68116811 if (c != 0) {
6812− *S->vtop = sv;
6812+ *S->tccgen_vtop = sv;
68136813 gen_cast(S, &type);
68146814 if (islv) {
6815− mk_pointer(S, &S->vtop->type);
6815+ mk_pointer(S, &S->tccgen_vtop->type);
68166816 gaddrof(S);
6817− } else if (VT_STRUCT == (S->vtop->type.t & VT_BTYPE))
6817+ } else if (VT_STRUCT == (S->tccgen_vtop->type.t & VT_BTYPE))
68186818 gaddrof(S);
68196819 }
68206820
68216821 if (c < 0) {
68226822 r1 = gv(S, rc);
68236823 move_reg(S, r2, r1, islv ? VT_PTR : type.t);
6824− S->vtop->r = r2;
6824+ S->tccgen_vtop->r = r2;
68256825 gsym(S, tt);
68266826 }
68276827
@@ -6830,12 +6830,12 @@ static void expr_cond(TCCState *S) · 2 unmodified lines
68306830 }
68316831 }
68326832
6833−static void expr_eq(TCCState *S)
6833+static void expr_eq(TCCState* S)
68346834 {
68356835 int t;
68366836
68376837 expr_cond(S);
6838− if ((t = S->tok) == '=' || TOK_ASSIGN(t)) {
6838+ if ((t = S->tccpp_tok) == '=' || TOK_ASSIGN(t)) {
68396839 test_lvalue(S);
68406840 next(S);
68416841 if (t == '=') {
@@ -6849,11 +6849,11 @@ static void expr_eq(TCCState *S) · 7 unmodified lines
68496849 }
68506850 }
68516851
6852−ST_FUNC void gexpr(TCCState *S)
6852+ST_FUNC void gexpr(TCCState* S)
68536853 {
68546854 while (1) {
68556855 expr_eq(S);
6856− if (S->tok != ',')
6856+ if (S->tccpp_tok != ',')
68576857 break;
68586858 vpop(S);
68596859 next(S);
@@ -6861,30 +6861,30 @@ ST_FUNC void gexpr(TCCState *S) · 1 unmodified line
68616861 }
68626862
68636863 /* parse a constant expression and return value in vtop. */
6864−static void expr_const1(TCCState *S)
6864+static void expr_const1(TCCState* S)
68656865 {
68666866 S->tccgen_const_wanted++;
6867− S->nocode_wanted += unevalmask + 1;
6867+ S->tccgen_nocode_wanted += unevalmask + 1;
68686868 expr_cond(S);
6869− S->nocode_wanted -= unevalmask + 1;
6869+ S->tccgen_nocode_wanted -= unevalmask + 1;
68706870 S->tccgen_const_wanted--;
68716871 }
68726872
68736873 /* parse an integer constant and return its value. */
6874−static inline int64_t expr_const64(TCCState *S)
6874+static inline int64_t expr_const64(TCCState* S)
68756875 {
68766876 int64_t c;
68776877 expr_const1(S);
6878− if ((S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST)
6878+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST)
68796879 expect(S, "constant expression");
6880− c = S->vtop->c.i;
6880+ c = S->tccgen_vtop->c.i;
68816881 vpop(S);
68826882 return c;
68836883 }
68846884
68856885 /* parse an integer constant and return its value.
68866886 Complain if it doesn't fit 32bit (signed or unsigned). */
6887−ST_FUNC int expr_const(TCCState *S)
6887+ST_FUNC int expr_const(TCCState* S)
68886888 {
68896889 int c;
68906890 int64_t wc = expr_const64(S);
@@ -6898,7 +6898,7 @@ ST_FUNC int expr_const(TCCState *S) · 7 unmodified lines
68986898 /* return from function */
68996899
69006900 #ifndef TCC_TARGET_ARM64
6901−static void gfunc_return(TCCState *S, CType *func_type)
6901+static void gfunc_return(TCCState* S, CType *func_type)
69026902 {
69036903 if ((func_type->t & VT_BTYPE) == VT_STRUCT) {
69046904 CType type, ret_type;
@@ -6923,11 +6923,11 @@ static void gfunc_return(TCCState *S, CType *func_type) · 18 unmodified lines
69236923 /* returning structure packed into registers */
69246924 int size, addr, align, rc;
69256925 size = type_size(func_type,&align);
6926− if ((S->vtop->r != (VT_LOCAL | VT_LVAL) ||
6927− (S->vtop->c.i & (ret_align-1)))
6926+ if ((S->tccgen_vtop->r != (VT_LOCAL | VT_LVAL) ||
6927+ (S->tccgen_vtop->c.i & (ret_align-1)))
69286928 && (align & (ret_align-1))) {
6929− S->loc = (S->loc - size) & -ret_align;
6930− addr = S->loc;
6929+ S->tccgen_loc = (S->tccgen_loc - size) & -ret_align;
6930+ addr = S->tccgen_loc;
69316931 type = *func_type;
69326932 vset(S, &type, VT_LOCAL | VT_LVAL, addr);
69336933 vswap(S);
@@ -6935,7 +6935,7 @@ static void gfunc_return(TCCState *S, CType *func_type) · 1 unmodified line
69356935 vpop(S);
69366936 vset(S, &ret_type, VT_LOCAL | VT_LVAL, addr);
69376937 }
6938− S->vtop->type = ret_type;
6938+ S->tccgen_vtop->type = ret_type;
69396939 rc = RC_RET(ret_type.t);
69406940 if (ret_nregs == 1)
69416941 gv(S, rc);
@@ -6950,18 +6950,18 @@ static void gfunc_return(TCCState *S, CType *func_type) · 8 unmodified lines
69506950 registers, their classes are consecutive values of the
69516951 suite s(n) = 2^n */
69526952 rc <<= 1;
6953− S->vtop->c.i += regsize;
6953+ S->tccgen_vtop->c.i += regsize;
69546954 }
69556955 }
69566956 }
69576957 } else {
69586958 gv(S, RC_RET(func_type->t));
69596959 }
6960− S->vtop--; /* NOT vpop() because on x86 it would flush the fp stack */
6960+ S->tccgen_vtop--; /* NOT vpop() because on x86 it would flush the fp stack */
69616961 }
69626962 #endif
69636963
6964−static void check_func_return(TCCState *S)
6964+static void check_func_return(TCCState* S)
69656965 {
69666966 if ((S->tccgen_func_vt.t & VT_BTYPE) == VT_VOID)
69676967 return;
@@ -6993,16 +6993,16 @@ static int case_cmpu(const void *pa, const void *pb) · 25 unmodified lines
69936993 return a < b ? -1 : a > b;
69946994 }
69956995
6996−static void gtst_addr(TCCState *S, int t, int a)
6996+static void gtst_addr(TCCState* S, int t, int a)
69976997 {
69986998 gsym_addr(S, gvtst(S, 0, t), a);
69996999 }
70007000
7001−static void gcase(TCCState *S, struct case_t **base, int len, int *bsym)
7001+static void gcase(TCCState* S, struct case_t **base, int len, int *bsym)
70027002 {
70037003 struct case_t *p;
70047004 int e;
7005− int ll = (S->vtop->type.t & VT_BTYPE) == VT_LLONG;
7005+ int ll = (S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG;
70067006 while (len > 8) {
70077007 /* binary search */
70087008 p = base[len/2];
@@ -7057,7 +7057,7 @@ static void gcase(TCCState *S, struct case_t **base, int len, int *bsym) · 48 unmodified lines
70577057 /* ------------------------------------------------------------------------- */
70587058 /* __attribute__((cleanup(fn))) */
70597059
7060−static void try_call_scope_cleanup(TCCState *S, Sym *stop)
7060+static void try_call_scope_cleanup(TCCState* S, Sym *stop)
70617061 {
70627062 Sym *cls = S->tccgen_cur_scope->cl.s;
70637063
@@ -7067,14 +7067,14 @@ static void try_call_scope_cleanup(TCCState *S, Sym *stop) · 3 unmodified lines
70677067
70687068 vpushsym(S, &fs->type, fs);
70697069 vset(S, &vs->type, vs->r, vs->c);
7070− S->vtop->sym = vs;
7071− mk_pointer(S, &S->vtop->type);
7070+ S->tccgen_vtop->sym = vs;
7071+ mk_pointer(S, &S->tccgen_vtop->type);
70727072 gaddrof(S);
70737073 gfunc_call(S, 1);
70747074 }
70757075 }
70767076
7077−static void try_call_cleanup_goto(TCCState *S, Sym *cleanupstate)
7077+static void try_call_cleanup_goto(TCCState* S, Sym *cleanupstate)
70787078 {
70797079 Sym *oc, *cc;
70807080 int ocd, ccd;
@@ -7095,7 +7095,7 @@ static void try_call_cleanup_goto(TCCState *S, Sym *cleanupstate) · 14 unmodified lines
70957095 }
70967096
70977097 /* call 'func' for each __attribute__((cleanup(func))) */
7098−static void block_cleanup(TCCState *S, scope_t *o)
7098+static void block_cleanup(TCCState* S, scope_t *o)
70997099 {
71007100 int jmp = 0;
71017101 Sym *g, **pg;
@@ -7143,7 +7143,7 @@ static void vla_leave(TCCState * S, scope_t *o) · 41 unmodified lines
71437143 /* ------------------------------------------------------------------------- */
71447144 /* local scopes */
71457145
7146−static void new_scope(TCCState *S, scope_t *o)
7146+static void new_scope(TCCState* S, scope_t *o)
71477147 {
71487148 /* copy and link previous scope */
71497149 *o = *S->tccgen_cur_scope;
@@ -7152,15 +7152,15 @@ static void new_scope(TCCState *S, scope_t *o) · 2 unmodified lines
71527152 S->tccgen_cur_scope->vla.num = 0;
71537153
71547154 /* record local declaration stack position */
7155− o->lstk = S->local_stack;
7156− o->llstk = S->local_label_stack;
7157− ++S->local_scope;
7155+ o->lstk = S->tccgen_local_stack;
7156+ o->llstk = S->tccgen_local_label_stack;
7157+ ++S->tccgen_local_scope;
71587158
71597159 if (S->tccgen_debug_modes)
7160− tcc_debug_stabn(S, N_LBRAC, S->ind - S->tccgen_func_ind);
7160+ tcc_debug_stabn(S, N_LBRAC, S->tccgen_ind - S->tccgen_func_ind);
71617161 }
71627162
7163−static void prev_scope(TCCState *S, scope_t *o, int is_expr)
7163+static void prev_scope(TCCState* S, scope_t *o, int is_expr)
71647164 {
71657165 vla_leave(S, o->prev);
71667166
@@ -7168,7 +7168,7 @@ static void prev_scope(TCCState *S, scope_t *o, int is_expr) · 1 unmodified line
71687168 block_cleanup(S, o->prev);
71697169
71707170 /* pop locally defined labels */
7171− label_pop(S, &S->local_label_stack, o->llstk, is_expr);
7171+ label_pop(S, &S->tccgen_local_label_stack, o->llstk, is_expr);
71727172
71737173 /* In the is_expr case (a statement expression is finished here),
71747174 vtop might refer to symbols on the local_stack. Either via the
@@ -7181,14 +7181,14 @@ static void prev_scope(TCCState *S, scope_t *o, int is_expr) · 6 unmodified lines
71817181 /* pop locally defined symbols */
71827182 pop_local_syms(S, o->lstk, is_expr);
71837183 S->tccgen_cur_scope = o->prev;
7184− --S->local_scope;
7184+ --S->tccgen_local_scope;
71857185
71867186 if (S->tccgen_debug_modes)
7187− tcc_debug_stabn(S, N_RBRAC, S->ind - S->tccgen_func_ind);
7187+ tcc_debug_stabn(S, N_RBRAC, S->tccgen_ind - S->tccgen_func_ind);
71887188 }
71897189
71907190 /* leave a scope via break/continue(/goto) */
7191−static void leave_scope(TCCState *S, scope_t *o)
7191+static void leave_scope(TCCState* S, scope_t *o)
71927192 {
71937193 if (!o)
71947194 return;
@@ -7199,7 +7199,7 @@ static void leave_scope(TCCState *S, scope_t *o) · 4 unmodified lines
71997199 /* ------------------------------------------------------------------------- */
72007200 /* call block from 'for do while' loops */
72017201
7202−static void lblock(TCCState *S, int *bsym, int *csym)
7202+static void lblock(TCCState* S, int *bsym, int *csym)
72037203 {
72047204 scope_t *lo = S->tccgen_loop_scope, *co = S->tccgen_cur_scope;
72057205 int *b = co->bsym, *c = co->csym;
@@ -7216,7 +7216,7 @@ static void lblock(TCCState *S, int *bsym, int *csym) · 10 unmodified lines
72167216 }
72177217 }
72187218
7219−static void block(TCCState *S, int is_expr)
7219+static void block(TCCState* S, int is_expr)
72207220 {
72217221 int a, b, c, d, e, t;
72227222 scope_t o;
@@ -7225,11 +7225,11 @@ static void block(TCCState *S, int is_expr) · 2 unmodified lines
72257225 if (is_expr) {
72267226 /* default return value is (void) */
72277227 vpushi(S, 0);
7228− S->vtop->type.t = VT_VOID;
7228+ S->tccgen_vtop->type.t = VT_VOID;
72297229 }
72307230
72317231 again:
7232− t = S->tok;
7232+ t = S->tccpp_tok;
72337233 /* If the token carries a value, next() might destroy it. Only with
72347234 invalid code such as f(){"123"4;} */
72357235 if (TOK_HAS_VALUE(t))
@@ -7245,7 +7245,7 @@ again: · 9 unmodified lines
72457245 skip(S, ')');
72467246 a = gvtst(S, 1, 0);
72477247 block(S, 0);
7248− if (S->tok == TOK_ELSE) {
7248+ if (S->tccpp_tok == TOK_ELSE) {
72497249 d = gjmp(S, 0);
72507250 gsym(S, a);
72517251 next(S);
@@ -7271,20 +7271,20 @@ again: · 19 unmodified lines
72717271 new_scope(S, &o);
72727272
72737273 /* handle local labels declarations */
7274− while (S->tok == TOK_LABEL) {
7274+ while (S->tccpp_tok == TOK_LABEL) {
72757275 do {
72767276 next(S);
7277− if (S->tok < TOK_UIDENT)
7277+ if (S->tccpp_tok < TOK_UIDENT)
72787278 expect(S, "label identifier");
7279− label_push(S, &S->local_label_stack, S->tok, LABEL_DECLARED);
7279+ label_push(S, &S->tccgen_local_label_stack, S->tccpp_tok, LABEL_DECLARED);
72807280 next(S);
7281− } while (S->tok == ',');
7281+ } while (S->tccpp_tok == ',');
72827282 skip(S, ';');
72837283 }
72847284
7285− while (S->tok != '}') {
7285+ while (S->tccpp_tok != '}') {
72867286 decl(S, VT_LOCAL);
7287− if (S->tok != '}') {
7287+ if (S->tccpp_tok != '}') {
72887288 if (is_expr)
72897289 vpop(S);
72907290 block(S, is_expr);
@@ -7292,21 +7292,21 @@ again: · 1 unmodified line
72927292 }
72937293
72947294 prev_scope(S, &o, is_expr);
7295− if (S->local_scope)
7295+ if (S->tccgen_local_scope)
72967296 next(S);
7297− else if (!S->nocode_wanted)
7297+ else if (!S->tccgen_nocode_wanted)
72987298 check_func_return(S);
72997299
73007300 } else if (t == TOK_RETURN) {
73017301 b = (S->tccgen_func_vt.t & VT_BTYPE) != VT_VOID;
7302− if (S->tok != ';') {
7302+ if (S->tccpp_tok != ';') {
73037303 gexpr(S);
73047304 if (b) {
73057305 gen_assign_cast(S, &S->tccgen_func_vt);
73067306 } else {
7307− if (S->vtop->type.t != VT_VOID)
7307+ if (S->tccgen_vtop->type.t != VT_VOID)
73087308 tcc_warning(S, "void function returns a value");
7309− S->vtop--;
7309+ S->tccgen_vtop--;
73107310 }
73117311 } else if (b) {
73127312 tcc_warning(S, "'return' with no value");
@@ -7317,7 +7317,7 @@ again: · 4 unmodified lines
73177317 gfunc_return(S, &S->tccgen_func_vt);
73187318 skip(S, ';');
73197319 /* jump unless last stmt in top-level block */
7320− if (S->tok != '}' || S->local_scope != 1)
7320+ if (S->tccpp_tok != '}' || S->tccgen_local_scope != 1)
73217321 S->tccgen_rsym = gjmp(S, S->tccgen_rsym);
73227322 if (S->tccgen_debug_modes)
73237323 tcc_tcov_block_end (S, S->tccgen_tcov_data.line);
@@ -7346,7 +7346,7 @@ again: · 22 unmodified lines
73467346 new_scope(S, &o);
73477347
73487348 skip(S, '(');
7349− if (S->tok != ';') {
7349+ if (S->tccpp_tok != ';') {
73507350 /* c99 for-loop init decl? */
73517351 if (!decl0(S, VT_LOCAL, 1, NULL)) {
73527352 /* no, regular for-loop init expr */
@@ -7357,12 +7357,12 @@ again: · 4 unmodified lines
73577357 skip(S, ';');
73587358 a = b = 0;
73597359 c = d = gind(S);
7360− if (S->tok != ';') {
7360+ if (S->tccpp_tok != ';') {
73617361 gexpr(S);
73627362 a = gvtst(S, 1, 0);
73637363 }
73647364 skip(S, ';');
7365− if (S->tok != ')') {
7365+ if (S->tccpp_tok != ')') {
73667366 e = gjmp(S, 0);
73677367 d = gind(S);
73687368 gexpr(S);
@@ -7403,7 +7403,7 @@ again: · 34 unmodified lines
74037403 skip(S, '(');
74047404 gexpr(S);
74057405 skip(S, ')');
7406− sw->sv = *S->vtop--; /* save switch value */
7406+ sw->sv = *S->tccgen_vtop--; /* save switch value */
74077407
74087408 a = 0;
74097409 b = gjmp(S, 0); /* jump to first case */
@@ -7443,7 +7443,7 @@ again: · 33 unmodified lines
74437443 if (!S->tccgen_cur_switch)
74447444 expect(S, "switch");
74457445 cr->v1 = cr->v2 = expr_const64(S);
7446− if (gnu_ext && S->tok == TOK_DOTS) {
7446+ if (gnu_ext && S->tccpp_tok == TOK_DOTS) {
74477447 next(S);
74487448 cr->v2 = expr_const64(S);
74497449 if ((!(S->tccgen_cur_switch->sv.type.t & VT_UNSIGNED) && cr->v2 < cr->v1)
@@ -7471,25 +7471,25 @@ again: · 21 unmodified lines
74717471 } else if (t == TOK_GOTO) {
74727472 if (S->tccgen_cur_scope->vla.num)
74737473 vla_restore(S, S->tccgen_cur_scope->vla.locorig);
7474− if (S->tok == '*' && gnu_ext) {
7474+ if (S->tccpp_tok == '*' && gnu_ext) {
74757475 /* computed goto */
74767476 next(S);
74777477 gexpr(S);
7478− if ((S->vtop->type.t & VT_BTYPE) != VT_PTR)
7478+ if ((S->tccgen_vtop->type.t & VT_BTYPE) != VT_PTR)
74797479 expect(S, "pointer");
74807480 ggoto(S);
74817481
7482− } else if (S->tok >= TOK_UIDENT) {
7483− s = label_find(S, S->tok);
7482+ } else if (S->tccpp_tok >= TOK_UIDENT) {
7483+ s = label_find(S, S->tccpp_tok);
74847484 /* put forward definition if needed */
74857485 if (!s)
7486− s = label_push(S, &S->tccgen_global_label_stack, S->tok, LABEL_FORWARD);
7486+ s = label_push(S, &S->tccgen_global_label_stack, S->tccpp_tok, LABEL_FORWARD);
74877487 else if (s->r == LABEL_DECLARED)
74887488 s->r = LABEL_FORWARD;
74897489
74907490 if (s->r & LABEL_FORWARD) {
74917491 /* start new goto chain for cleanups, linked via label->next */
7492− if (S->tccgen_cur_scope->cl.s && !S->nocode_wanted) {
7492+ if (S->tccgen_cur_scope->cl.s && !S->tccgen_nocode_wanted) {
74937493 sym_push2(S, &S->tccgen_pending_gotos, SYM_FIELD, 0, S->tccgen_cur_scope->cl.n);
74947494 S->tccgen_pending_gotos->prev_tok = s;
74957495 s = sym_push2(S, &s->next, SYM_FIELD, 0, 0);
@@ -7511,7 +7511,7 @@ again: · 15 unmodified lines
75117511 asm_instr(S);
75127512
75137513 } else {
7514− if (S->tok == ':' && t >= TOK_UIDENT) {
7514+ if (S->tccpp_tok == ':' && t >= TOK_UIDENT) {
75157515 /* label case */
75167516 next(S);
75177517 s = label_find(S, t);
@@ -7534,7 +7534,7 @@ again: · 16 unmodified lines
75347534
75357535 block_after_label:
75367536 vla_restore(S, S->tccgen_cur_scope->vla.loc);
7537− if (S->tok != '}')
7537+ if (S->tccpp_tok != '}')
75387538 goto again;
75397539 /* we accept this, but it is a mistake */
75407540 tcc_warning_c(warn_all)(S, "deprecated use of label at end of compound statement");
@@ -7565,16 +7565,16 @@ again: · 24 unmodified lines
75657565 with a '{'). If STR then allocates and stores the skipped tokens
75667566 in *STR. This doesn't check if () and {} are nested correctly,
75677567 i.e. "({)}" is accepted. */
7568−static void skip_or_save_block(TCCState *S, TokenString **str)
7568+static void skip_or_save_block(TCCState* S, TokenString **str)
75697569 {
7570− int braces = S->tok == '{';
7570+ int braces = S->tccpp_tok == '{';
75717571 int level = 0;
75727572 if (str)
75737573 *str = tok_str_alloc(S);
75747574
7575− while ((level > 0 || (S->tok != '}' && S->tok != ',' && S->tok != ';' && S->tok != ')'))) {
7575+ while ((level > 0 || (S->tccpp_tok != '}' && S->tccpp_tok != ',' && S->tccpp_tok != ';' && S->tccpp_tok != ')'))) {
75767576 int t;
7577− if (S->tok == TOK_EOF) {
7577+ if (S->tccpp_tok == TOK_EOF) {
75787578 if (str || level > 0)
75797579 tcc_error(S, "unexpected end of file");
75807580 else
@@ -7582,7 +7582,7 @@ static void skip_or_save_block(TCCState *S, TokenString **str) · 1 unmodified line
75827582 }
75837583 if (str)
75847584 tok_str_add_tok(S, *str);
7585− t = S->tok;
7585+ t = S->tccpp_tok;
75867586 next(S);
75877587 if (t == '{' || t == '(') {
75887588 level++;
@@ -7601,7 +7601,7 @@ static void skip_or_save_block(TCCState *S, TokenString **str) · 12 unmodified lines
76017601 #define EXPR_CONST 1
76027602 #define EXPR_ANY 2
76037603
7604−static void parse_init_elem(TCCState *S, int expr_type)
7604+static void parse_init_elem(TCCState* S, int expr_type)
76057605 {
76067606 int saved_global_expr;
76077607 switch(expr_type) {
@@ -7613,11 +7613,11 @@ static void parse_init_elem(TCCState *S, int expr_type) · 5 unmodified lines
76137613 S->tccgen_global_expr = saved_global_expr;
76147614 /* NOTE: symbols are accepted, as well as lvalue for anon symbols
76157615 (compound literals). */
7616− if (((S->vtop->r & (VT_VALMASK | VT_LVAL)) != VT_CONST
7617− && ((S->vtop->r & (VT_SYM|VT_LVAL)) != (VT_SYM|VT_LVAL)
7618− || S->vtop->sym->v < SYM_FIRST_ANOM))
7616+ if (((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) != VT_CONST
7617+ && ((S->tccgen_vtop->r & (VT_SYM|VT_LVAL)) != (VT_SYM|VT_LVAL)
7618+ || S->tccgen_vtop->sym->v < SYM_FIRST_ANOM))
76197619 #ifdef TCC_TARGET_PE
7620− || ((S->vtop->r & VT_SYM) && S->vtop->sym->a.dllimport)
7620+ || ((S->tccgen_vtop->r & VT_SYM) && S->tccgen_vtop->sym->a.dllimport)
76217621 #endif
76227622 )
76237623 tcc_error(S, "initializer element is not constant");
@@ -7629,10 +7629,10 @@ static void parse_init_elem(TCCState *S, int expr_type) · 5 unmodified lines
76297629 }
76307630
76317631 #if 1
7632−static void init_assert(TCCState *S, init_params *p, int offset)
7632+static void init_assert(TCCState* S, init_params *p, int offset)
76337633 {
76347634 if (p->sec ? !NODATA_WANTED && offset > p->sec->data_offset
7635− : !S->nocode_wanted && offset > p->local_offset)
7635+ : !S->tccgen_nocode_wanted && offset > p->local_offset)
76367636 tcc_internal_error(S, "initializer overflow");
76377637 }
76387638 #else
@@ -7640,7 +7640,7 @@ static void init_assert(TCCState *S, init_params *p, int offset) · 1 unmodified line
76407640 #endif
76417641
76427642 /* put zeros for variable based init */
7643−static void init_putz(TCCState *S, init_params *p, unsigned long c, int size)
7643+static void init_putz(TCCState* S, init_params *p, unsigned long c, int size)
76447644 {
76457645 init_assert(S, p, c + size);
76467646 if (p->sec) {
@@ -7685,7 +7685,7 @@ static void decl_design_delrels(Section *sec, int c, int size) · 38 unmodified lines
76857685 }
76867686 }
76877687
7688−static void decl_design_flex(TCCState *S, init_params *p, Sym *ref, int index)
7688+static void decl_design_flex(TCCState* S, init_params *p, Sym *ref, int index)
76897689 {
76907690 if (ref == p->flex_array_ref) {
76917691 if (index >= ref->c)
@@ -7700,7 +7700,7 @@ static void decl_design_flex(TCCState *S, init_params *p, Sym *ref, int index) · 8 unmodified lines
77007700 index. 'flags' is as in decl_initializer.
77017701 'al' contains the already initialized length of the
77027702 current container (starting at c). This returns the new length of that. */
7703−static int decl_designator(TCCState *S, init_params *p, CType *type, unsigned long c,
7703+static int decl_designator(TCCState* S, init_params *p, CType *type, unsigned long c,
77047704 Sym **cur_field, int flags, int al)
77057705 {
77067706 Sym *s, *f;
@@ -7713,21 +7713,21 @@ static int decl_designator(TCCState *S, init_params *p, CType *type, unsigned lo · 6 unmodified lines
77137713 if (flags & DIF_HAVE_ELEM)
77147714 goto no_designator;
77157715
7716− if (gnu_ext && S->tok >= TOK_UIDENT) {
7717− l = S->tok, next(S);
7718− if (S->tok == ':')
7716+ if (gnu_ext && S->tccpp_tok >= TOK_UIDENT) {
7717+ l = S->tccpp_tok, next(S);
7718+ if (S->tccpp_tok == ':')
77197719 goto struct_field;
77207720 unget_tok(S, l);
77217721 }
77227722
77237723 /* NOTE: we only support ranges for last designator */
7724− while (nb_elems == 1 && (S->tok == '[' || S->tok == '.')) {
7725− if (S->tok == '[') {
7724+ while (nb_elems == 1 && (S->tccpp_tok == '[' || S->tccpp_tok == '.')) {
7725+ if (S->tccpp_tok == '[') {
77267726 if (!(type->t & VT_ARRAY))
77277727 expect(S, "array type");
77287728 next(S);
77297729 index = index_last = expr_const(S);
7730− if (S->tok == TOK_DOTS && gnu_ext) {
7730+ if (S->tccpp_tok == TOK_DOTS && gnu_ext) {
77317731 next(S);
77327732 index_last = expr_const(S);
77337733 }
@@ -7745,7 +7745,7 @@ static int decl_designator(TCCState *S, init_params *p, CType *type, unsigned lo · 11 unmodified lines
77457745 } else {
77467746 int cumofs;
77477747 next(S);
7748− l = S->tok;
7748+ l = S->tccpp_tok;
77497749 struct_field:
77507750 next(S);
77517751 if ((type->t & VT_BTYPE) != VT_STRUCT)
@@ -7762,7 +7762,7 @@ static int decl_designator(TCCState *S, init_params *p, CType *type, unsigned lo · 10 unmodified lines
77627762 cur_field = NULL;
77637763 }
77647764 if (!cur_field) {
7765− if (S->tok == '=') {
7765+ if (S->tccpp_tok == '=') {
77667766 next(S);
77677767 } else if (!gnu_ext) {
77687768 expect(S, "=");
@@ -7830,7 +7830,7 @@ static int decl_designator(TCCState *S, init_params *p, CType *type, unsigned lo · 61 unmodified lines
78307830 }
78317831
78327832 /* store a value or an expression directly in global data or in local array */
7833−static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c)
7833+static void init_putv(TCCState* S, init_params *p, CType *type, unsigned long c)
78347834 {
78357835 int bt;
78367836 void *ptr;
@@ -7853,25 +7853,25 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 16 unmodified lines
78537853 gen_assign_cast(S, &dtype);
78547854 bt = type->t & VT_BTYPE;
78557855
7856− if ((S->vtop->r & VT_SYM)
7856+ if ((S->tccgen_vtop->r & VT_SYM)
78577857 && bt != VT_PTR
78587858 && (bt != (PTR_SIZE == 8 ? VT_LLONG : VT_INT)
78597859 || (type->t & VT_BITFIELD))
7860− && !((S->vtop->r & VT_CONST) && S->vtop->sym->v >= SYM_FIRST_ANOM)
7860+ && !((S->tccgen_vtop->r & VT_CONST) && S->tccgen_vtop->sym->v >= SYM_FIRST_ANOM)
78617861 )
78627862 tcc_error(S, "initializer element is not computable at load time");
78637863
78647864 if (NODATA_WANTED) {
7865− S->vtop--;
7865+ S->tccgen_vtop--;
78667866 return;
78677867 }
78687868
78697869 ptr = sec->data + c;
7870− val = S->vtop->c.i;
7870+ val = S->tccgen_vtop->c.i;
78717871
78727872 /* XXX: make code faster ? */
7873− if ((S->vtop->r & (VT_SYM|VT_CONST)) == (VT_SYM|VT_CONST) &&
7874− S->vtop->sym->v >= SYM_FIRST_ANOM &&
7873+ if ((S->tccgen_vtop->r & (VT_SYM|VT_CONST)) == (VT_SYM|VT_CONST) &&
7874+ S->tccgen_vtop->sym->v >= SYM_FIRST_ANOM &&
78757875 /* XXX This rejects compound literals like
78767876 '(void *){ptr}'. The problem is that '&sym' is
78777877 represented the same way, which would be ruled out
@@ -7882,14 +7882,14 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 4 unmodified lines
78827882 between '(void *){x}' and '&(void *){x}'. Ignore
78837883 pointer typed entities here. Hopefully no real code
78847884 will ever use compound literals with scalar type. */
7885− (S->vtop->type.t & VT_BTYPE) != VT_PTR) {
7885+ (S->tccgen_vtop->type.t & VT_BTYPE) != VT_PTR) {
78867886 /* These come from compound literals, memcpy stuff over. */
78877887 Section *ssec;
78887888 ElfSym *esym;
78897889 ElfW_Rel *rel;
7890− esym = elfsym(S, S->vtop->sym);
7890+ esym = elfsym(S, S->tccgen_vtop->sym);
78917891 ssec = S->sections[esym->st_shndx];
7892− memmove (ptr, ssec->data + esym->st_value + (int)S->vtop->c.i, size);
7892+ memmove (ptr, ssec->data + esym->st_value + (int)S->tccgen_vtop->c.i, size);
78937893 if (ssec->reloc) {
78947894 /* We need to copy over all memory contents, and that
78957895 includes relocations. Use the fact that relocs are
@@ -7919,8 +7919,8 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 23 unmodified lines
79197919 if (type->t & VT_BITFIELD) {
79207920 int bit_pos, bit_size, bits, n;
79217921 unsigned char *p, v, m;
7922− bit_pos = BIT_POS(S->vtop->type.t);
7923− bit_size = BIT_SIZE(S->vtop->type.t);
7922+ bit_pos = BIT_POS(S->tccgen_vtop->type.t);
7923+ bit_size = BIT_SIZE(S->tccgen_vtop->type.t);
79247924 p = (unsigned char*)ptr + (bit_pos >> 3);
79257925 bit_pos &= 7, bits = 0;
79267926 while (bit_size) {
@@ -7959,21 +7959,21 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 32 unmodified lines
79597959 In any case we avoid possibly random bytes 11 and 12.
79607960 */
79617961 if (sizeof (long double) >= 10)
7962− memcpy(ptr, &S->vtop->c.ld, 10);
7962+ memcpy(ptr, &S->tccgen_vtop->c.ld, 10);
79637963 #ifdef __TINYC__
79647964 else if (sizeof (long double) == sizeof (double))
7965− __asm__("fldl %1\nfstpt %0\n" : "=m" (*ptr) : "m" (S->vtop->c.ld));
7965+ __asm__("fldl %1\nfstpt %0\n" : "=m" (*ptr) : "m" (S->tccgen_vtop->c.ld));
79667966 #endif
7967− else if (S->vtop->c.ld == 0.0)
7967+ else if (S->tccgen_vtop->c.ld == 0.0)
79687968 ;
79697969 else
79707970 #endif
79717971 /* For other platforms it should work natively, but may not work
79727972 for cross compilers */
79737973 if (sizeof(long double) == LDOUBLE_SIZE)
7974− memcpy(ptr, &S->vtop->c.ld, LDOUBLE_SIZE);
7974+ memcpy(ptr, &S->tccgen_vtop->c.ld, LDOUBLE_SIZE);
79757975 else if (sizeof(double) == LDOUBLE_SIZE)
7976− memcpy(ptr, &S->vtop->c.ld, LDOUBLE_SIZE);
7976+ memcpy(ptr, &S->tccgen_vtop->c.ld, LDOUBLE_SIZE);
79777977 #ifndef TCC_CROSS_TEST
79787978 else
79797979 tcc_error(S, "can't cross compile long double constants");
@@ -7984,8 +7984,8 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 4 unmodified lines
79847984 /* intptr_t may need a reloc too, see tcctest.c:relocation_test() */
79857985 case VT_LLONG:
79867986 case VT_PTR:
7987− if (S->vtop->r & VT_SYM)
7988− greloca(S, sec, S->vtop->sym, c, R_DATA_PTR, val);
7987+ if (S->tccgen_vtop->r & VT_SYM)
7988+ greloca(S, sec, S->tccgen_vtop->sym, c, R_DATA_PTR, val);
79897989 else
79907990 write64le(ptr, val);
79917991 break;
@@ -7998,8 +7998,8 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 6 unmodified lines
79987998 break;
79997999 case VT_PTR:
80008000 case VT_INT:
8001− if (S->vtop->r & VT_SYM)
8002− greloc(S, sec, S->vtop->sym, c, R_DATA_PTR);
8001+ if (S->tccgen_vtop->r & VT_SYM)
8002+ greloc(S, sec, S->tccgen_vtop->sym, c, R_DATA_PTR);
80038003 write32le(ptr, val);
80048004 break;
80058005 #endif
@@ -8008,7 +8008,7 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 2 unmodified lines
80088008 break;
80098009 }
80108010 }
8011− S->vtop--;
8011+ S->tccgen_vtop--;
80128012 } else {
80138013 vset(S, &dtype, VT_LOCAL|VT_LVAL, c);
80148014 vswap(S);
@@ -8022,7 +8022,7 @@ static void init_putv(TCCState *S, init_params *p, CType *type, unsigned long c) · 7 unmodified lines
80228022 allocation. 'flags & DIF_FIRST' is true if array '{' must be read (multi
80238023 dimension implicit array init handling). 'flags & DIF_SIZE_ONLY' is true if
80248024 size only evaluation is wanted (only for arrays). */
8025−static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned long c, int flags)
8025+static void decl_initializer(TCCState* S, init_params *p, CType *type, unsigned long c, int flags)
80268026 {
80278027 int len, n, no_oblock, i;
80288028 int size1, align1;
@@ -8034,11 +8034,11 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 5 unmodified lines
80348034 if (S->tccgen_debug_modes && !p->sec)
80358035 tcc_debug_line(S), tcc_tcov_check_line (S, 1);
80368036
8037− if (!(flags & DIF_HAVE_ELEM) && S->tok != '{' &&
8037+ if (!(flags & DIF_HAVE_ELEM) && S->tccpp_tok != '{' &&
80388038 /* In case of strings we have special handling for arrays, so
80398039 don't consume them as initializer value (which would commit them
80408040 to some anonymous symbol). */
8041− S->tok != TOK_LSTR && S->tok != TOK_STR &&
8041+ S->tccpp_tok != TOK_LSTR && S->tccpp_tok != TOK_STR &&
80428042 !(flags & DIF_SIZE_ONLY)) {
80438043 parse_init_elem(S, !p->sec ? EXPR_ANY : EXPR_CONST);
80448044 flags |= DIF_HAVE_ELEM;
@@ -8049,13 +8049,13 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 4 unmodified lines
80498049 /* Use i_c_parameter_t, to strip toplevel qualifiers.
80508050 The source type might have VT_CONSTANT set, which is
80518051 of course assignable to non-const elements. */
8052− is_compatible_unqualified_types(type, &S->vtop->type)) {
8052+ is_compatible_unqualified_types(type, &S->tccgen_vtop->type)) {
80538053 goto init_putv;
80548054
80558055 } else if (type->t & VT_ARRAY) {
80568056 no_oblock = 1;
8057− if (((flags & DIF_FIRST) && S->tok != TOK_LSTR && S->tok != TOK_STR) ||
8058− S->tok == '{') {
8057+ if (((flags & DIF_FIRST) && S->tccpp_tok != TOK_LSTR && S->tccpp_tok != TOK_STR) ||
8058+ S->tccpp_tok == '{') {
80598059 skip(S, '{');
80608060 no_oblock = 0;
80618061 }
@@ -8067,34 +8067,34 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 5 unmodified lines
80678067
80688068 /* only parse strings here if correct type (otherwise: handle
80698069 them as ((w)char *) expressions */
8070− if ((S->tok == TOK_LSTR &&
8070+ if ((S->tccpp_tok == TOK_LSTR &&
80718071 #ifdef TCC_TARGET_PE
80728072 (t1->t & VT_BTYPE) == VT_SHORT && (t1->t & VT_UNSIGNED)
80738073 #else
80748074 (t1->t & VT_BTYPE) == VT_INT
80758075 #endif
8076− ) || (S->tok == TOK_STR && (t1->t & VT_BTYPE) == VT_BYTE)) {
8076+ ) || (S->tccpp_tok == TOK_STR && (t1->t & VT_BTYPE) == VT_BYTE)) {
80778077 len = 0;
80788078 cstr_reset(&S->tccgen_initstr);
8079− if (size1 != (S->tok == TOK_STR ? 1 : sizeof(nwchar_t)))
8079+ if (size1 != (S->tccpp_tok == TOK_STR ? 1 : sizeof(nwchar_t)))
80808080 tcc_error(S, "unhandled string literal merging");
8081− while (S->tok == TOK_STR || S->tok == TOK_LSTR) {
8081+ while (S->tccpp_tok == TOK_STR || S->tccpp_tok == TOK_LSTR) {
80828082 if (S->tccgen_initstr.size)
80838083 S->tccgen_initstr.size -= size1;
8084− if (S->tok == TOK_STR)
8085− len += S->tokc.str.size;
8084+ if (S->tccpp_tok == TOK_STR)
8085+ len += S->tccpp_tokc.str.size;
80868086 else
8087− len += S->tokc.str.size / sizeof(nwchar_t);
8087+ len += S->tccpp_tokc.str.size / sizeof(nwchar_t);
80888088 len--;
8089− cstr_cat(S, &S->tccgen_initstr, S->tokc.str.data, S->tokc.str.size);
8089+ cstr_cat(S, &S->tccgen_initstr, S->tccpp_tokc.str.data, S->tccpp_tokc.str.size);
80908090 next(S);
80918091 }
8092− if (S->tok != ')' && S->tok != '}' && S->tok != ',' && S->tok != ';'
8093− && S->tok != TOK_EOF) {
8092+ if (S->tccpp_tok != ')' && S->tccpp_tok != '}' && S->tccpp_tok != ',' && S->tccpp_tok != ';'
8093+ && S->tccpp_tok != TOK_EOF) {
80948094 /* Not a lone literal but part of a bigger expression. */
80958095 unget_tok(S, size1 == 1 ? TOK_STR : TOK_LSTR);
8096− S->tokc.str.size = S->tccgen_initstr.size;
8097− S->tokc.str.data = S->tccgen_initstr.data;
8096+ S->tccpp_tokc.str.size = S->tccgen_initstr.size;
8097+ S->tccpp_tokc.str.data = S->tccgen_initstr.data;
80988098 goto do_init_array;
80998099 }
81008100
@@ -8147,7 +8147,7 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 46 unmodified lines
81478147 }
81488148
81498149 len = 0;
8150− while (S->tok != '}' || (flags & DIF_HAVE_ELEM)) {
8150+ while (S->tccpp_tok != '}' || (flags & DIF_HAVE_ELEM)) {
81518151 len = decl_designator(S, p, type, c, &f, flags, len);
81528152 flags &= ~DIF_HAVE_ELEM;
81538153 if (type->t & VT_ARRAY) {
@@ -8166,7 +8166,7 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 12 unmodified lines
81668166 break;
81678167 }
81688168
8169− if (S->tok == '}')
8169+ if (S->tccpp_tok == '}')
81708170 break;
81718171 skip(S, ',');
81728172 }
@@ -8175,7 +8175,7 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 2 unmodified lines
81758175 skip(S, '}');
81768176 } else if ((type->t & VT_BTYPE) == VT_STRUCT) {
81778177 no_oblock = 1;
8178− if ((flags & DIF_FIRST) || S->tok == '{') {
8178+ if ((flags & DIF_FIRST) || S->tccpp_tok == '{') {
81798179 skip(S, '{');
81808180 no_oblock = 0;
81818181 }
@@ -8184,7 +8184,7 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 2 unmodified lines
81848184 n = s->c;
81858185 size1 = 1;
81868186 goto do_init_list;
8187− } else if (S->tok == '{') {
8187+ } else if (S->tccpp_tok == '{') {
81888188 if (flags & DIF_HAVE_ELEM)
81898189 skip(S, ';');
81908190 next(S);
@@ -8204,14 +8204,14 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 13 unmodified lines
82048204 /* This should happen only when we haven't parsed
82058205 the init element above for fear of committing a
82068206 string constant to memory too early. */
8207− if (S->tok != TOK_STR && S->tok != TOK_LSTR)
8207+ if (S->tccpp_tok != TOK_STR && S->tccpp_tok != TOK_LSTR)
82088208 expect(S, "string constant");
82098209 parse_init_elem(S, !p->sec ? EXPR_ANY : EXPR_CONST);
82108210 }
82118211 init_putv:
82128212 if (!p->sec && (flags & DIF_CLEAR) /* container was already zero'd */
8213− && (S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST
8214− && S->vtop->c.i == 0
8213+ && (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST
8214+ && S->tccgen_vtop->c.i == 0
82158215 && btype_size(type->t & VT_BTYPE) /* not for fp constants */
82168216 )
82178217 vpop(S);
@@ -8227,7 +8227,7 @@ static void decl_initializer(TCCState *S, init_params *p, CType *type, unsigned · 9 unmodified lines
82278227 are parsed. If 'v' is zero, then a reference to the new object
82288228 is put in the value stack. If 'has_init' is 2, a special parsing
82298229 is done to handle string constants. */
8230−static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, int r,
8230+static void decl_initializer_alloc(TCCState* S, CType *type, AttributeDef *ad, int r,
82318231 int has_init, int v, int scope)
82328232 {
82338233 int size, align, addr;
@@ -8236,7 +8236,7 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 2 unmodified lines
82368236 Section *sec;
82378237 Sym *flexible_array;
82388238 Sym *sym;
8239− int saved_nocode_wanted = S->nocode_wanted;
8239+ int saved_nocode_wanted = S->tccgen_nocode_wanted;
82408240 #ifdef CONFIG_TCC_BCHECK
82418241 int bcheck = S->do_bounds_check && !NODATA_WANTED;
82428242 #endif
@@ -8244,7 +8244,7 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 1 unmodified line
82448244
82458245 /* Always allocate static or global variables */
82468246 if (v && (r & VT_VALMASK) == VT_CONST)
8247− S->nocode_wanted |= 0x80000000;
8247+ S->tccgen_nocode_wanted |= 0x80000000;
82488248
82498249 flexible_array = NULL;
82508250 size = type_size(type, &align);
@@ -8280,7 +8280,7 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 29 unmodified lines
82808280 if (has_init == 2) {
82818281 /* only get strings */
82828282 init_str = tok_str_alloc(S);
8283− while (S->tok == TOK_STR || S->tok == TOK_LSTR) {
8283+ while (S->tccpp_tok == TOK_STR || S->tccpp_tok == TOK_LSTR) {
82848284 tok_str_add_tok(S, init_str);
82858285 next(S);
82868286 }
@@ -8327,16 +8327,16 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 40 unmodified lines
83278327 #ifdef CONFIG_TCC_BCHECK
83288328 if (bcheck && v) {
83298329 /* add padding between stack variables for bound checking */
8330− S->loc -= align;
8330+ S->tccgen_loc -= align;
83318331 }
83328332 #endif
8333− S->loc = (S->loc - size) & -align;
8334− addr = S->loc;
8333+ S->tccgen_loc = (S->tccgen_loc - size) & -align;
8334+ addr = S->tccgen_loc;
83358335 p.local_offset = addr + size;
83368336 #ifdef CONFIG_TCC_BCHECK
83378337 if (bcheck && v) {
83388338 /* add padding between stack variables for bound checking */
8339− S->loc -= align;
8339+ S->tccgen_loc -= align;
83408340 }
83418341 #endif
83428342 if (v) {
@@ -8422,8 +8422,8 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 79 unmodified lines
84228422 } else {
84238423 /* push global reference */
84248424 vpush_ref(S, type, sec, addr, size);
8425− sym = S->vtop->sym;
8426− S->vtop->r |= r;
8425+ sym = S->tccgen_vtop->sym;
8426+ S->tccgen_vtop->r |= r;
84278427 }
84288428
84298429 #ifdef CONFIG_TCC_BCHECK
@@ -8452,8 +8452,8 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 22 unmodified lines
84528452 if (S->tccgen_cur_scope->prev && S->tccgen_cur_scope->prev->vla.num) {
84538453 S->tccgen_cur_scope->vla.locorig = S->tccgen_cur_scope->prev->vla.loc;
84548454 } else {
8455− gen_vla_sp_save(S, S->loc -= PTR_SIZE);
8456− S->tccgen_cur_scope->vla.locorig = S->loc;
8455+ gen_vla_sp_save(S, S->tccgen_loc -= PTR_SIZE);
8456+ S->tccgen_cur_scope->vla.locorig = S->tccgen_loc;
84578457 }
84588458 }
84598459
@@ -8462,7 +8462,7 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 2 unmodified lines
84628462 #if defined TCC_TARGET_PE && defined TCC_TARGET_X86_64
84638463 /* on _WIN64, because of the function args scratch area, the
84648464 result of alloca differs from RSP and is returned in RAX. */
8465− gen_vla_result(S, addr), addr = (S->loc -= PTR_SIZE);
8465+ gen_vla_result(S, addr), addr = (S->tccgen_loc -= PTR_SIZE);
84668466 #endif
84678467 gen_vla_sp_save(S, addr);
84688468 S->tccgen_cur_scope->vla.loc = addr;
@@ -8483,64 +8483,64 @@ static void decl_initializer_alloc(TCCState *S, CType *type, AttributeDef *ad, i · 14 unmodified lines
84838483 next(S);
84848484 }
84858485
8486− S->nocode_wanted = saved_nocode_wanted;
8486+ S->tccgen_nocode_wanted = saved_nocode_wanted;
84878487 }
84888488
84898489 /* parse a function defined by symbol 'sym' and generate its code in
84908490 'cur_text_section' */
8491−static void gen_function(TCCState *S, Sym *sym)
8491+static void gen_function(TCCState* S, Sym *sym)
84928492 {
84938493 scope_t f = { 0 };
84948494 S->tccgen_cur_scope = S->tccgen_root_scope = &f;
8495− S->nocode_wanted = 0;
8496− S->ind = cur_text_section->data_offset;
8495+ S->tccgen_nocode_wanted = 0;
8496+ S->tccgen_ind = cur_text_section->data_offset;
84978497 if (sym->a.aligned) {
84988498 size_t newoff = section_add(S, cur_text_section, 0,
84998499 1 << (sym->a.aligned - 1));
8500− gen_fill_nops(S, newoff - S->ind);
8500+ gen_fill_nops(S, newoff - S->tccgen_ind);
85018501 }
85028502 /* NOTE: we patch the symbol size later */
8503− put_extern_sym(S, sym, cur_text_section, S->ind, 0);
8503+ put_extern_sym(S, sym, cur_text_section, S->tccgen_ind, 0);
85048504 if (sym->type.ref->f.func_ctor)
85058505 add_array (S, ".init_array", sym->c);
85068506 if (sym->type.ref->f.func_dtor)
85078507 add_array (S, ".fini_array", sym->c);
85088508
85098509 S->tccgen_funcname = get_tok_str(S, sym->v, NULL);
8510− S->tccgen_func_ind = S->ind;
8510+ S->tccgen_func_ind = S->tccgen_ind;
85118511 S->tccgen_func_vt = sym->type.ref->type;
85128512 S->tccgen_func_var = sym->type.ref->f.func_type == FUNC_ELLIPSIS;
85138513
85148514 /* put debug symbol */
85158515 tcc_debug_funcstart(S, sym);
85168516 /* push a dummy symbol to enable local sym storage */
8517− sym_push2(S, &S->local_stack, SYM_FIELD, 0, 0);
8518− S->local_scope = 1; /* for function parameters */
8517+ sym_push2(S, &S->tccgen_local_stack, SYM_FIELD, 0, 0);
8518+ S->tccgen_local_scope = 1; /* for function parameters */
85198519 gfunc_prolog(S, sym);
8520− S->local_scope = 0;
8520+ S->tccgen_local_scope = 0;
85218521 S->tccgen_rsym = 0;
85228522 clear_temp_local_var_list(S);
85238523 block(S, 0);
85248524 gsym(S, S->tccgen_rsym);
8525− S->nocode_wanted = 0;
8525+ S->tccgen_nocode_wanted = 0;
85268526 /* reset local stack */
85278527 pop_local_syms(S, NULL, 0);
85288528 gfunc_epilog(S);
8529− cur_text_section->data_offset = S->ind;
8530− S->local_scope = 0;
8529+ cur_text_section->data_offset = S->tccgen_ind;
8530+ S->tccgen_local_scope = 0;
85318531 label_pop(S, &S->tccgen_global_label_stack, NULL, 0);
85328532 sym_pop(S, &S->tccgen_all_cleanups, NULL, 0);
85338533 /* patch symbol size */
8534− elfsym(S, sym)->st_size = S->ind - S->tccgen_func_ind;
8534+ elfsym(S, sym)->st_size = S->tccgen_ind - S->tccgen_func_ind;
85358535 /* end of function */
8536− tcc_debug_funcend(S, S->ind - S->tccgen_func_ind);
8536+ tcc_debug_funcend(S, S->tccgen_ind - S->tccgen_func_ind);
85378537 /* It's better to crash than to generate wrong code */
85388538 cur_text_section = NULL;
85398539 S->tccgen_funcname = ""; /* for safety */
85408540 S->tccgen_func_vt.t = VT_VOID; /* for safety */
85418541 S->tccgen_func_var = 0; /* for safety */
8542− S->ind = 0; /* for safety */
8543− S->nocode_wanted = 0x80000000;
8542+ S->tccgen_ind = 0; /* for safety */
8543+ S->tccgen_nocode_wanted = 0x80000000;
85448544 check_vstack(S);
85458545 /* do this after funcend debug info */
85468546 next(S);
@@ -8591,7 +8591,7 @@ static void free_inline_functions(TCCState *S) · 44 unmodified lines
85918591
85928592 /* 'l' is VT_LOCAL or VT_CONST to define default storage type, or VT_CMP
85938593 if parsing old style parameter decl list (and FUNC_SYM is set then) */
8594−static int decl0(TCCState *S, int l, int is_for_loop_init, Sym *func_sym)
8594+static int decl0(TCCState* S, int l, int is_for_loop_init, Sym *func_sym)
85958595 {
85968596 int v, has_init, r, oldint;
85978597 CType type, btype;
@@ -8599,7 +8599,7 @@ static int decl0(TCCState *S, int l, int is_for_loop_init, Sym *func_sym) · 1 unmodified line
85998599 AttributeDef ad, adbase;
86008600
86018601 while (1) {
8602− if (S->tok == TOK_STATIC_ASSERT) {
8602+ if (S->tccpp_tok == TOK_STATIC_ASSERT) {
86038603 CString error_str;
86048604 int c;
86058605
@@ -8607,7 +8607,7 @@ static int decl0(TCCState *S, int l, int is_for_loop_init, Sym *func_sym) · 1 unmodified line
86078607 skip(S, '(');
86088608 c = expr_const(S);
86098609
8610− if (S->tok == ')') {
8610+ if (S->tccpp_tok == ')') {
86118611 if (!c)
86128612 tcc_error(S, "_Static_assert fail");
86138613 next(S);
@@ -8630,30 +8630,30 @@ static int decl0(TCCState *S, int l, int is_for_loop_init, Sym *func_sym) · 16 unmodified lines
86308630 if (is_for_loop_init)
86318631 return 0;
86328632 /* skip redundant ';' if not in old parameter decl scope */
8633− if (S->tok == ';' && l != VT_CMP) {
8633+ if (S->tccpp_tok == ';' && l != VT_CMP) {
86348634 next(S);
86358635 continue;
86368636 }
86378637 if (l != VT_CONST)
86388638 break;
8639− if (S->tok == TOK_ASM1 || S->tok == TOK_ASM2 || S->tok == TOK_ASM3) {
8639+ if (S->tccpp_tok == TOK_ASM1 || S->tccpp_tok == TOK_ASM2 || S->tccpp_tok == TOK_ASM3) {
86408640 /* global asm block */
86418641 asm_global_instr(S);
86428642 continue;
86438643 }
8644− if (S->tok >= TOK_UIDENT) {
8644+ if (S->tccpp_tok >= TOK_UIDENT) {
86458645 /* special test for old K&R protos without explicit int
86468646 type. Only accepted when defining global data */
86478647 btype.t = VT_INT;
86488648 oldint = 1;
86498649 } else {
8650− if (S->tok != TOK_EOF)
8650+ if (S->tccpp_tok != TOK_EOF)
86518651 expect(S, "declaration");
86528652 break;
86538653 }
86548654 }
86558655
8656− if (S->tok == ';') {
8656+ if (S->tccpp_tok == ';') {

65 more lines aren’t shown here.

tccmacho.c+7−7
@@ -249,7 +249,7 @@ struct macho { · 248 unmodified lines
249249 #define SHT_LINKEDIT (SHT_LOOS + 42)
250250 #define SHN_FROMDLL (SHN_LOOS + 2) /* Symbol is undefined, comes from a DLL */
251251
252−static void * add_lc(TCCState *S, struct macho *mo, uint32_t cmd, uint32_t cmdsize)
252+static void * add_lc(TCCState* S, struct macho *mo, uint32_t cmd, uint32_t cmdsize)
253253 {
254254 struct load_command *lc = tcc_mallocz(S, cmdsize);
255255 lc->cmd = cmd;
@@ -259,7 +259,7 @@ static void * add_lc(TCCState *S, struct macho *mo, uint32_t cmd, uint32_t cmdsi · 3 unmodified lines
259259 return lc;
260260 }
261261
262−static struct segment_command_64 * add_segment(TCCState *S, struct macho *mo, const char *name)
262+static struct segment_command_64 * add_segment(TCCState* S, struct macho *mo, const char *name)
263263 {
264264 struct segment_command_64 *sc = add_lc(S, mo, LC_SEGMENT_64, sizeof(*sc));
265265 strncpy(sc->segname, name, 16);
@@ -272,7 +272,7 @@ static struct segment_command_64 * get_segment(struct macho *mo, int i) · 6 unmodified lines
272272 return (struct segment_command_64 *) (mo->lc[mo->seg2lc[i]]);
273273 }
274274
275−static int add_section(TCCState *S, struct macho *mo, struct segment_command_64 **_seg, const char *name)
275+static int add_section(TCCState* S, struct macho *mo, struct segment_command_64 **_seg, const char *name)
276276 {
277277 struct segment_command_64 *seg = *_seg;
278278 int ret = seg->nsects;
@@ -293,7 +293,7 @@ static struct section_64 *get_section(struct segment_command_64 *seg, int i) · 14 unmodified lines
293293 return (struct section_64*)((char*)seg + sizeof(*seg)) + i;
294294 }
295295
296−static void * add_dylib(TCCState *S, struct macho *mo, char *name)
296+static void * add_dylib(TCCState* S, struct macho *mo, char *name)
297297 {
298298 struct dylib_command *lc;
299299 int sz = (sizeof(*lc) + strlen(name) + 1 + 7) & -8;
@@ -836,7 +836,7 @@ static uint32_t macho_swap32(uint32_t x) · 536 unmodified lines
836836 }
837837 #define SWAP(x) (swap ? macho_swap32(x) : (x))
838838
839−ST_FUNC int macho_add_dllref(TCCState *S, int lev, const char* soname)
839+ST_FUNC int macho_add_dllref(TCCState* S, int lev, const char* soname)
840840 {
841841 /* if the dll is already loaded, do not load it */
842842 DLLReference *dllref;
@@ -865,7 +865,7 @@ ST_FUNC int macho_add_dllref(TCCState *S, int lev, const char* soname) · 22 unmodified lines
865865 #ifdef TCC_IS_NATIVE
866866 /* Looks for the active developer SDK set by xcode-select (or the default
867867 one set during installation.) */
868−ST_FUNC void tcc_add_macos_sdkpath(TCCState *S)
868+ST_FUNC void tcc_add_macos_sdkpath(TCCState* s)
869869 {
870870 char *sdkroot = NULL, *pos = NULL;
871871 void* xcs = dlopen("libxcselect.dylib", RTLD_GLOBAL | RTLD_LAZY);
@@ -912,7 +912,7 @@ the_end: · 40 unmodified lines
912912 }
913913 #endif /* TCC_IS_NATIVE */
914914
915−ST_FUNC int macho_load_tbd(TCCState *S, int fd, const char* filename, int lev)
915+ST_FUNC int macho_load_tbd(TCCState* S, int fd, const char* filename, int lev)
916916 {
917917 char *soname, *data, *pos;
918918 int ret = -1;
tccpe.c+3−3
@@ -1492,7 +1492,7 @@ static void pe_print_sections(TCCState *S, const char *fname) · 1491 unmodified lines
14921492 /* helper function for load/store to insert one more indirection */
14931493
14941494 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
1495−ST_FUNC SValue *pe_getimport(TCCState *S, SValue *sv, SValue *v2)
1495+ST_FUNC SValue *pe_getimport(TCCState* S, SValue *sv, SValue *v2)
14961496 {
14971497 int r2;
14981498 if ((sv->r & (VT_VALMASK|VT_SYM)) != (VT_CONST|VT_SYM) || (sv->r2 != VT_CONST))
@@ -1512,7 +1512,7 @@ ST_FUNC SValue *pe_getimport(TCCState *S, SValue *sv, SValue *v2) · 13 unmodified lines
15121512 vpushv(S, v2);
15131513 vpushi(S, sv->c.i);
15141514 gen_opi(S, '+');
1515− *v2 = *S->vtop--;
1515+ *v2 = *S->tccgen_vtop--;
15161516 }
15171517 v2->type.t = sv->type.t;
15181518 v2->r |= sv->r & VT_LVAL;
@@ -1551,7 +1551,7 @@ static int read_mem(int fd, unsigned offset, void *buffer, unsigned len) · 32 unmodified lines
15511551
15521552 /* ------------------------------------------------------------- */
15531553
1554−static int get_dllexports(TCCState *S, int fd, char **pp)
1554+static int get_dllexports(TCCState* S, int fd, char **pp)
15551555 {
15561556 int l, i, n, n0, ret;
15571557 char *p;
tccpp.c+355−355
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 /* ------------------------------------------------------------------------- */
2828
29−static void tok_print(TCCState *S, const char *msg, const int *str);
29+static void tok_print(TCCState* S, const char *msg, const int *str);
3030
3131 static const char tcc_keywords[] =
3232 #define DEF(id, str) str "\0"
@@ -65,16 +65,16 @@ static const unsigned char tok_two_chars[] = · 32 unmodified lines
6565 0
6666 };
6767
68−static void next_nomacro(TCCState *S);
68+static void next_nomacro(TCCState* S);
6969
70−ST_FUNC void skip(TCCState *S, int c)
70+ST_FUNC void skip(TCCState* S, int c)
7171 {
72− if (S->tok != c)
73− tcc_error(S, "'%c' expected (got \"%s\")", c, get_tok_str(S, S->tok, &S->tokc));
72+ if (S->tccpp_tok != c)
73+ tcc_error(S, "'%c' expected (got \"%s\")", c, get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
7474 next(S);
7575 }
7676
77−ST_FUNC void expect(TCCState *S, const char *msg)
77+ST_FUNC void expect(TCCState* S, const char *msg)
7878 {
7979 tcc_error(S, "%s expected", msg);
8080 }
@@ -120,7 +120,7 @@ typedef struct tal_header_t { · 39 unmodified lines
120120
121121 /* ------------------------------------------------------------------------- */
122122
123−static TinyAlloc *tal_new(TCCState *S, TinyAlloc **pal, unsigned limit, unsigned size)
123+static TinyAlloc *tal_new(TCCState* S, TinyAlloc **pal, unsigned limit, unsigned size)
124124 {
125125 TinyAlloc *al = tcc_mallocz(S, sizeof(TinyAlloc));
126126 al->p = al->buffer = tcc_malloc(S, size);
@@ -130,7 +130,7 @@ static TinyAlloc *tal_new(TCCState *S, TinyAlloc **pal, unsigned limit, unsigned · 3 unmodified lines
130130 return al;
131131 }
132132
133−static void tal_delete(TCCState *S, TinyAlloc *al)
133+static void tal_delete(TCCState* S, TinyAlloc *al)
134134 {
135135 TinyAlloc *next;
136136
@@ -168,7 +168,7 @@ tail_call: · 31 unmodified lines
168168 goto tail_call;
169169 }
170170
171−static void tal_free_impl(TCCState *S, TinyAlloc *al, void *p TAL_DEBUG_PARAMS)
171+static void tal_free_impl(TCCState* S, TinyAlloc *al, void *p TAL_DEBUG_PARAMS)
172172 {
173173 if (!p)
174174 return;
@@ -195,7 +195,7 @@ tail_call: · 20 unmodified lines
195195 tcc_free(S, p);
196196 }
197197
198−static void *tal_realloc_impl(TCCState *S, TinyAlloc **pal, void *p, unsigned size TAL_DEBUG_PARAMS)
198+static void *tal_realloc_impl(TCCState* S, TinyAlloc **pal, void *p, unsigned size TAL_DEBUG_PARAMS)
199199 {
200200 tal_header_t *header;
201201 void *ret;
@@ -278,7 +278,7 @@ tail_call: · 76 unmodified lines
278278
279279 /* ------------------------------------------------------------------------- */
280280 /* CString handling */
281−static void cstr_realloc(TCCState *S, CString *cstr, int new_size)
281+static void cstr_realloc(TCCState* S, CString *cstr, int new_size)
282282 {
283283 int size;
284284
@@ -292,7 +292,7 @@ static void cstr_realloc(TCCState *S, CString *cstr, int new_size) · 7 unmodified lines
292292 }
293293
294294 /* add a byte */
295−ST_INLN void cstr_ccat(TCCState *S, CString *cstr, int ch)
295+ST_INLN void cstr_ccat(TCCState* S, CString *cstr, int ch)
296296 {
297297 int size;
298298 size = cstr->size + 1;
@@ -313,14 +313,14 @@ ST_INLN char *unicode_to_utf8 (char *b, uint32_t Uc) · 14 unmodified lines
313313 }
314314
315315 /* add a unicode character expanded into utf8 */
316−ST_INLN void cstr_u8cat(TCCState *S, CString *cstr, int ch)
316+ST_INLN void cstr_u8cat(TCCState* S, CString *cstr, int ch)
317317 {
318318 char buf[4], *e;
319319 e = unicode_to_utf8(buf, (uint32_t)ch);
320320 cstr_cat(S, cstr, buf, e - buf);
321321 }
322322
323−ST_FUNC void cstr_cat(TCCState *S, CString *cstr, const char *str, int len)
323+ST_FUNC void cstr_cat(TCCState* S, CString *cstr, const char *str, int len)
324324 {
325325 int size;
326326 if (len <= 0)
@@ -333,7 +333,7 @@ ST_FUNC void cstr_cat(TCCState *S, CString *cstr, const char *str, int len) · 6 unmodified lines
333333 }
334334
335335 /* add a wide char */
336−ST_FUNC void cstr_wccat(TCCState *S, CString *cstr, int ch)
336+ST_FUNC void cstr_wccat(TCCState* S, CString *cstr, int ch)
337337 {
338338 int size;
339339 size = cstr->size + sizeof(nwchar_t);
@@ -343,13 +343,13 @@ ST_FUNC void cstr_wccat(TCCState *S, CString *cstr, int ch) · 3 unmodified lines
343343 cstr->size = size;
344344 }
345345
346−ST_FUNC void cstr_new(TCCState *S, CString *cstr)
346+ST_FUNC void cstr_new(TCCState* S, CString *cstr)
347347 {
348348 memset(cstr, 0, sizeof(CString));
349349 }
350350
351351 /* free string and reset it to NULL */
352−ST_FUNC void cstr_free(TCCState *S, CString *cstr)
352+ST_FUNC void cstr_free(TCCState* S, CString *cstr)
353353 {
354354 tcc_free(S, cstr->data);
355355 cstr_new(S, cstr);
@@ -361,7 +361,7 @@ ST_FUNC void cstr_reset(CString *cstr) · 5 unmodified lines
361361 cstr->size = 0;
362362 }
363363
364−ST_FUNC int cstr_vprintf(TCCState *S, CString *cstr, const char *fmt, va_list ap)
364+ST_FUNC int cstr_vprintf(TCCState* S, CString *cstr, const char *fmt, va_list ap)
365365 {
366366 va_list v;
367367 int len, size = 80;
@@ -381,7 +381,7 @@ ST_FUNC int cstr_vprintf(TCCState *S, CString *cstr, const char *fmt, va_list ap · 13 unmodified lines
381381 return len;
382382 }
383383
384−ST_FUNC int cstr_printf(TCCState *S, CString *cstr, const char *fmt, ...)
384+ST_FUNC int cstr_printf(TCCState* S, CString *cstr, const char *fmt, ...)
385385 {
386386 va_list ap; int len;
387387 va_start(ap, fmt);
@@ -391,7 +391,7 @@ ST_FUNC int cstr_printf(TCCState *S, CString *cstr, const char *fmt, ...) · 3 unmodified lines
391391 }
392392
393393 /* XXX: unicode ? */
394−static void add_char(TCCState *S, CString *cstr, int c)
394+static void add_char(TCCState* S, CString *cstr, int c)
395395 {
396396 if (c == '\'' || c == '\"' || c == '\\') {
397397 /* XXX: could be more precise if char or string */
@@ -413,24 +413,24 @@ static void add_char(TCCState *S, CString *cstr, int c) · 15 unmodified lines
413413
414414 /* ------------------------------------------------------------------------- */
415415 /* allocate a new token */
416−static TokenSym *tok_alloc_new(TCCState *S, TokenSym **pts, const char *str, int len)
416+static TokenSym *tok_alloc_new(TCCState* S, TokenSym **pts, const char *str, int len)
417417 {
418418 TokenSym *ts, **ptable;
419419 int i;
420420
421− if (S->tok_ident >= SYM_FIRST_ANOM)
421+ if (S->tccpp_tok_ident >= SYM_FIRST_ANOM)
422422 tcc_error(S, "memory full (symbols)");
423423
424424 /* expand token table if needed */
425− i = S->tok_ident - TOK_IDENT;
425+ i = S->tccpp_tok_ident - TOK_IDENT;
426426 if ((i % TOK_ALLOC_INCR) == 0) {
427427 ptable = tcc_realloc(S, S->tccpp_table_ident, (i + TOK_ALLOC_INCR) * sizeof(TokenSym *));
428428 S->tccpp_table_ident = ptable;
429429 }
430430
431− ts = tal_realloc(S, S->toksym_alloc, 0, sizeof(TokenSym) + len);
431+ ts = tal_realloc(S, S->tccpp_toksym_alloc, 0, sizeof(TokenSym) + len);
432432 S->tccpp_table_ident[i] = ts;
433− ts->tok = S->tok_ident++;
433+ ts->tok = S->tccpp_tok_ident++;
434434 ts->sym_define = NULL;
435435 ts->sym_label = NULL;
436436 ts->sym_struct = NULL;
@@ -448,7 +448,7 @@ static TokenSym *tok_alloc_new(TCCState *S, TokenSym **pts, const char *str, int · 11 unmodified lines
448448
449449
450450 /* find a token and add it if not found */
451−ST_FUNC TokenSym *tok_alloc(TCCState *S, const char *str, int len)
451+ST_FUNC TokenSym *tok_alloc(TCCState* S, const char *str, int len)
452452 {
453453 TokenSym *ts, **pts;
454454 int i;
@@ -471,7 +471,7 @@ ST_FUNC TokenSym *tok_alloc(TCCState *S, const char *str, int len) · 16 unmodified lines
471471 return tok_alloc_new(S, pts, str, len);
472472 }
473473
474−ST_FUNC int tok_alloc_const(TCCState *S, const char *str)
474+ST_FUNC int tok_alloc_const(TCCState* S, const char *str)
475475 {
476476 return tok_alloc(S, str, strlen(str))->tok;
477477 }
@@ -479,7 +479,7 @@ ST_FUNC int tok_alloc_const(TCCState *S, const char *str) · 1 unmodified line
479479
480480 /* XXX: buffer overflow */
481481 /* XXX: float tokens */
482−ST_FUNC const char *get_tok_str(TCCState *S, int v, CValue *cv)
482+ST_FUNC const char *get_tok_str(TCCState* S, int v, CValue *cv)
483483 {
484484 char *p;
485485 int i, len;
@@ -578,7 +578,7 @@ ST_FUNC const char *get_tok_str(TCCState *S, int v, CValue *cv) · 92 unmodified lines
578578 *p++ = v;
579579 case 0: /* nameless anonymous symbol */
580580 *p = '\0';
581− } else if (v < S->tok_ident) {
581+ } else if (v < S->tccpp_tok_ident) {
582582 return S->tccpp_table_ident[v - TOK_IDENT]->str;
583583 } else if (v >= SYM_FIRST_ANOM) {
584584 /* special name for anonymous symbol */
@@ -594,7 +594,7 @@ ST_FUNC const char *get_tok_str(TCCState *S, int v, CValue *cv) · 9 unmodified lines
594594
595595 /* return the current character, handling end of block if necessary
596596 (but not stray) */
597−static int handle_eob(TCCState *S)
597+static int handle_eob(TCCState* S)
598598 {
599599 BufferedFile *bf = S->tccpp_file;
600600 int len;
@@ -627,7 +627,7 @@ static int handle_eob(TCCState *S) · 26 unmodified lines
627627 }
628628
629629 /* read next char from current input file and handle end of input buffer */
630−static inline void inp(TCCState *S)
630+static inline void inp(TCCState* S)
631631 {
632632 S->tccpp_ch = *(++(S->tccpp_file->buf_ptr));
633633 /* end of buffer/file handling */
@@ -636,7 +636,7 @@ static inline void inp(TCCState *S) · 2 unmodified lines
636636 }
637637
638638 /* handle '\[\r]\n' */
639−static int handle_stray_noerror(TCCState *S)
639+static int handle_stray_noerror(TCCState* S)
640640 {
641641 while (S->tccpp_ch == '\\') {
642642 inp(S);
@@ -657,7 +657,7 @@ static int handle_stray_noerror(TCCState *S) · 14 unmodified lines
657657 return 0;
658658 }
659659
660−static void handle_stray(TCCState *S)
660+static void handle_stray(TCCState* S)
661661 {
662662 if (handle_stray_noerror(S))
663663 tcc_error(S, "stray '\\' in program");
@@ -665,7 +665,7 @@ static void handle_stray(TCCState *S) · 1 unmodified line
665665
666666 /* skip the stray and handle the \\n case. Output an error if
667667 incorrect char after the stray */
668−static int handle_stray1(TCCState *S, uint8_t *p)
668+static int handle_stray1(TCCState* S, uint8_t *p)
669669 {
670670 int c;
671671
@@ -713,7 +713,7 @@ static int handle_stray1(TCCState *S, uint8_t *p) · 41 unmodified lines
713713 /* input with '\[\r]\n' handling. Note that this function cannot
714714 handle other characters after '\', so you cannot call it inside
715715 strings or comments */
716−static void minp(TCCState *S)
716+static void minp(TCCState* S)
717717 {
718718 inp(S);
719719 if (S->tccpp_ch == '\\')
@@ -721,7 +721,7 @@ static void minp(TCCState *S) · 1 unmodified line
721721 }
722722
723723 /* single line C++ comments */
724−static uint8_t *parse_line_comment(TCCState *S, uint8_t *p)
724+static uint8_t *parse_line_comment(TCCState* S, uint8_t *p)
725725 {
726726 int c;
727727
@@ -758,7 +758,7 @@ static uint8_t *parse_line_comment(TCCState *S, uint8_t *p) · 30 unmodified lines
758758 }
759759
760760 /* C comments */
761−static uint8_t *parse_comment(TCCState *S, uint8_t *p)
761+static uint8_t *parse_comment(TCCState* S, uint8_t *p)
762762 {
763763 int c;
764764
@@ -833,7 +833,7 @@ static uint8_t *parse_comment(TCCState *S, uint8_t *p) · 68 unmodified lines
833833 return p;
834834 }
835835
836−ST_FUNC int set_idnum(TCCState *S, int c, int val)
836+ST_FUNC int set_idnum(TCCState* S, int c, int val)
837837 {
838838 int prev = S->tccpp_isidnum_table[c - CH_EOF];
839839 S->tccpp_isidnum_table[c - CH_EOF] = val;
@@ -842,13 +842,13 @@ ST_FUNC int set_idnum(TCCState *S, int c, int val) · 2 unmodified lines
842842
843843 #define cinp minp
844844
845−static inline void skip_spaces(TCCState *S)
845+static inline void skip_spaces(TCCState* S)
846846 {
847847 while (S->tccpp_isidnum_table[S->tccpp_ch - CH_EOF] & IS_SPC)
848848 cinp(S);
849849 }
850850
851−static inline int check_space(TCCState *S, int t, int *spc)
851+static inline int check_space(TCCState* S, int t, int *spc)
852852 {
853853 if (t < 256 && (S->tccpp_isidnum_table[t - CH_EOF] & IS_SPC)) {
854854 if (*spc)
@@ -860,7 +860,7 @@ static inline int check_space(TCCState *S, int t, int *spc) · 5 unmodified lines
860860 }
861861
862862 /* parse a string without interpreting escapes */
863−static uint8_t *parse_pp_string(TCCState *S, uint8_t *p,
863+static uint8_t *parse_pp_string(TCCState* S, uint8_t *p,
864864 int sep, CString *str)
865865 {
866866 int c;
@@ -924,7 +924,7 @@ static uint8_t *parse_pp_string(TCCState *S, uint8_t *p, · 57 unmodified lines
924924
925925 /* skip block of text until #else, #elif or #endif. skip also pairs of
926926 #if/#endif */
927−static void preprocess_skip(TCCState *S)
927+static void preprocess_skip(TCCState* S)
928928 {
929929 int a, start_of_line, c, in_warn_or_error;
930930 uint8_t *p;
@@ -988,15 +988,15 @@ redo_start: · 57 unmodified lines
988988 next_nomacro(S);
989989 p = S->tccpp_file->buf_ptr;
990990 if (a == 0 &&
991− (S->tok == TOK_ELSE || S->tok == TOK_ELIF || S->tok == TOK_ENDIF))
991+ (S->tccpp_tok == TOK_ELSE || S->tccpp_tok == TOK_ELIF || S->tccpp_tok == TOK_ENDIF))
992992 goto the_end;
993− if (S->tok == TOK_IF || S->tok == TOK_IFDEF || S->tok == TOK_IFNDEF)
993+ if (S->tccpp_tok == TOK_IF || S->tccpp_tok == TOK_IFDEF || S->tccpp_tok == TOK_IFNDEF)
994994 a++;
995− else if (S->tok == TOK_ENDIF)
995+ else if (S->tccpp_tok == TOK_ENDIF)
996996 a--;
997− else if( S->tok == TOK_ERROR || S->tok == TOK_WARNING)
997+ else if( S->tccpp_tok == TOK_ERROR || S->tccpp_tok == TOK_WARNING)
998998 in_warn_or_error = 1;
999− else if (S->tok == TOK_LINEFEED)
999+ else if (S->tccpp_tok == TOK_LINEFEED)
10001000 goto redo_start;
10011001 else if (S->tccpp_parse_flags & PARSE_FLAG_ASM_FILE)
10021002 p = parse_line_comment(S, p - 1);
@@ -1062,34 +1062,34 @@ ST_INLN void tok_str_new(TokenString *s) · 59 unmodified lines
10621062 s->last_line_num = -1;
10631063 }
10641064
1065−ST_FUNC TokenString *tok_str_alloc(TCCState *S)
1065+ST_FUNC TokenString *tok_str_alloc(TCCState* S)
10661066 {
1067− TokenString *str = tal_realloc(S, S->tokstr_alloc, 0, sizeof *str);
1067+ TokenString *str = tal_realloc(S, S->tccpp_tokstr_alloc, 0, sizeof *str);
10681068 tok_str_new(str);
10691069 return str;
10701070 }
10711071
1072−ST_FUNC int *tok_str_dup(TCCState *S, TokenString *s)
1072+ST_FUNC int *tok_str_dup(TCCState* S, TokenString *s)
10731073 {
10741074 int *str;
10751075
1076− str = tal_realloc(S, S->tokstr_alloc, 0, s->len * sizeof(int));
1076+ str = tal_realloc(S, S->tccpp_tokstr_alloc, 0, s->len * sizeof(int));
10771077 memcpy(str, s->str, s->len * sizeof(int));
10781078 return str;
10791079 }
10801080
1081−ST_FUNC void tok_str_free_str(TCCState *S, int *str)
1081+ST_FUNC void tok_str_free_str(TCCState* S, int *str)
10821082 {
1083− tal_free(S, S->tokstr_alloc, str);
1083+ tal_free(S, S->tccpp_tokstr_alloc, str);
10841084 }
10851085
1086−ST_FUNC void tok_str_free(TCCState *S, TokenString *str)
1086+ST_FUNC void tok_str_free(TCCState* S, TokenString *str)
10871087 {
10881088 tok_str_free_str(S, str->str);
1089− tal_free(S, S->tokstr_alloc, str);
1089+ tal_free(S, S->tccpp_tokstr_alloc, str);
10901090 }
10911091
1092−ST_FUNC int *tok_str_realloc(TCCState *S, TokenString *s, int new_size)
1092+ST_FUNC int *tok_str_realloc(TCCState* S, TokenString *s, int new_size)
10931093 {
10941094 int *str, size;
10951095
@@ -1099,14 +1099,14 @@ ST_FUNC int *tok_str_realloc(TCCState *S, TokenString *s, int new_size) · 3 unmodified lines
10991099 while (size < new_size)
11001100 size = size * 2;
11011101 if (size > s->allocated_len) {
1102− str = tal_realloc(S, S->tokstr_alloc, s->str, size * sizeof(int));
1102+ str = tal_realloc(S, S->tccpp_tokstr_alloc, s->str, size * sizeof(int));
11031103 s->allocated_len = size;
11041104 s->str = str;
11051105 }
11061106 return s->str;
11071107 }
11081108
1109−ST_FUNC void tok_str_add(TCCState *S, TokenString *s, int t)
1109+ST_FUNC void tok_str_add(TCCState* S, TokenString *s, int t)
11101110 {
11111111 int len, *str;
11121112
@@ -1118,7 +1118,7 @@ ST_FUNC void tok_str_add(TCCState *S, TokenString *s, int t) · 5 unmodified lines
11181118 s->len = len;
11191119 }
11201120
1121−ST_FUNC void begin_macro(TCCState *S, TokenString *str, int alloc)
1121+ST_FUNC void begin_macro(TCCState* S, TokenString *str, int alloc)
11221122 {
11231123 str->alloc = alloc;
11241124 str->prev = S->tccpp_macro_stack;
@@ -1128,7 +1128,7 @@ ST_FUNC void begin_macro(TCCState *S, TokenString *str, int alloc) · 3 unmodified lines
11281128 S->tccpp_macro_stack = str;
11291129 }
11301130
1131−ST_FUNC void end_macro(TCCState *S)
1131+ST_FUNC void end_macro(TCCState* S)
11321132 {
11331133 TokenString *str = S->tccpp_macro_stack;
11341134 S->tccpp_macro_stack = str->prev;
@@ -1141,7 +1141,7 @@ ST_FUNC void end_macro(TCCState *S) · 6 unmodified lines
11411141 }
11421142 }
11431143
1144−static void tok_str_add2(TCCState *S, TokenString *s, int t, CValue *cv)
1144+static void tok_str_add2(TCCState* S, TokenString *s, int t, CValue *cv)
11451145 {
11461146 int len, *str;
11471147
@@ -1215,7 +1215,7 @@ static void tok_str_add2(TCCState *S, TokenString *s, int t, CValue *cv) · 67 unmodified lines
12151215 }
12161216
12171217 /* add the current parse token in token string 's' */
1218−ST_FUNC void tok_str_add_tok(TCCState *S, TokenString *s)
1218+ST_FUNC void tok_str_add_tok(TCCState* S, TokenString *s)
12191219 {
12201220 CValue cval;
12211221
@@ -1225,7 +1225,7 @@ ST_FUNC void tok_str_add_tok(TCCState *S, TokenString *s) · 3 unmodified lines
12251225 cval.i = s->last_line_num;
12261226 tok_str_add2(S, s, TOK_LINENUM, &cval);
12271227 }
1228− tok_str_add2(S, s, S->tok, &S->tokc);
1228+ tok_str_add2(S, s, S->tccpp_tok, &S->tccpp_tokc);
12291229 }
12301230
12311231 /* get a token from an integer array and increment pointer. */
@@ -1304,7 +1304,7 @@ static inline void tok_get(int *t, const int **pp, CValue *cv) · 72 unmodified lines
13041304 } while (0)
13051305 #endif
13061306
1307−static int macro_is_equal(TCCState *S, const int *a, const int *b)
1307+static int macro_is_equal(TCCState* S, const int *a, const int *b)
13081308 {
13091309 CValue cv;
13101310 int t;
@@ -1325,7 +1325,7 @@ static int macro_is_equal(TCCState *S, const int *a, const int *b) · 14 unmodified lines
13251325 }
13261326
13271327 /* defines handling */
1328−ST_INLN void define_push(TCCState *S, int v, int macro_type, int *str, Sym *first_arg)
1328+ST_INLN void define_push(TCCState* S, int v, int macro_type, int *str, Sym *first_arg)
13291329 {
13301330 Sym *s, *o;
13311331
@@ -1340,23 +1340,23 @@ ST_INLN void define_push(TCCState *S, int v, int macro_type, int *str, Sym *firs · 8 unmodified lines
13401340 }
13411341
13421342 /* undefined a define symbol. Its name is just set to zero */
1343−ST_FUNC void define_undef(TCCState *S, Sym *s)
1343+ST_FUNC void define_undef(TCCState* S, Sym *s)
13441344 {
13451345 int v = s->v;
1346− if (v >= TOK_IDENT && v < S->tok_ident)
1346+ if (v >= TOK_IDENT && v < S->tccpp_tok_ident)
13471347 S->tccpp_table_ident[v - TOK_IDENT]->sym_define = NULL;
13481348 }
13491349
1350−ST_INLN Sym *define_find(TCCState *S, int v)
1350+ST_INLN Sym *define_find(TCCState* S, int v)
13511351 {
13521352 v -= TOK_IDENT;
1353− if ((unsigned)v >= (unsigned)(S->tok_ident - TOK_IDENT))
1353+ if ((unsigned)v >= (unsigned)(S->tccpp_tok_ident - TOK_IDENT))
13541354 return NULL;
13551355 return S->tccpp_table_ident[v]->sym_define;
13561356 }
13571357
13581358 /* free define stack until top reaches 'b' */
1359−ST_FUNC void free_defines(TCCState *S, Sym *b)
1359+ST_FUNC void free_defines(TCCState* S, Sym *b)
13601360 {
13611361 while (S->tccgen_define_stack != b) {
13621362 Sym *top = S->tccgen_define_stack;
@@ -1368,15 +1368,15 @@ ST_FUNC void free_defines(TCCState *S, Sym *b) · 5 unmodified lines
13681368 }
13691369
13701370 /* label lookup */
1371−ST_FUNC Sym *label_find(TCCState *S, int v)
1371+ST_FUNC Sym *label_find(TCCState* S, int v)
13721372 {
13731373 v -= TOK_IDENT;
1374− if ((unsigned)v >= (unsigned)(S->tok_ident - TOK_IDENT))
1374+ if ((unsigned)v >= (unsigned)(S->tccpp_tok_ident - TOK_IDENT))
13751375 return NULL;
13761376 return S->tccpp_table_ident[v]->sym_label;
13771377 }
13781378
1379−ST_FUNC Sym *label_push(TCCState *S, Sym **ptop, int v, int flags)
1379+ST_FUNC Sym *label_push(TCCState* S, Sym **ptop, int v, int flags)
13801380 {
13811381 Sym *s, **ps;
13821382 s = sym_push2(S, ptop, v, 0, 0);
@@ -1395,7 +1395,7 @@ ST_FUNC Sym *label_push(TCCState *S, Sym **ptop, int v, int flags) · 12 unmodified lines
13951395
13961396 /* pop labels until element last is reached. Look if any labels are
13971397 undefined. Define symbols if '&&label' was used. */
1398−ST_FUNC void label_pop(TCCState *S, Sym **ptop, Sym *slast, int keep)
1398+ST_FUNC void label_pop(TCCState* S, Sym **ptop, Sym *slast, int keep)
13991399 {
14001400 Sym *s, *s1;
14011401 for(s = *ptop; s != slast; s = s1) {
@@ -1430,60 +1430,60 @@ static void maybe_run_test(TCCState *S) · 28 unmodified lines
14301430 const char *p;
14311431 if (S->include_stack_ptr != S->include_stack)
14321432 return;
1433− p = get_tok_str(S, S->tok, NULL);
1433+ p = get_tok_str(S, S->tccpp_tok, NULL);
14341434 if (0 != memcmp(p, "test_", 5))
14351435 return;
14361436 if (0 != --S->run_test)
14371437 return;
14381438 fprintf(S->ppfp, &"\n[%s]\n"[!(S->dflag & TCC_OPTION_d_32)], p), fflush(S->ppfp);
1439− define_push(S, S->tok, MACRO_OBJ, NULL, NULL);
1439+ define_push(S, S->tccpp_tok, MACRO_OBJ, NULL, NULL);
14401440 }
14411441
14421442 /* eval an expression for #if/#elif */
1443−static int expr_preprocess(TCCState *S)
1443+static int expr_preprocess(TCCState* S)
14441444 {
14451445 int c, t;
14461446 TokenString *str;
14471447
14481448 str = tok_str_alloc(S);
14491449 S->tccpp_pp_expr = 1;
1450− while (S->tok != TOK_LINEFEED && S->tok != TOK_EOF) {
1450+ while (S->tccpp_tok != TOK_LINEFEED && S->tccpp_tok != TOK_EOF) {
14511451 next(S); /* do macro subst */
14521452 redo:
1453− if (S->tok == TOK_DEFINED) {
1453+ if (S->tccpp_tok == TOK_DEFINED) {
14541454 next_nomacro(S);
1455− t = S->tok;
1455+ t = S->tccpp_tok;
14561456 if (t == '(')
14571457 next_nomacro(S);
1458− if (S->tok < TOK_IDENT)
1458+ if (S->tccpp_tok < TOK_IDENT)
14591459 expect(S, "identifier");
14601460 if (S->run_test)
14611461 maybe_run_test(S);
1462− c = define_find(S, S->tok) != 0;
1462+ c = define_find(S, S->tccpp_tok) != 0;
14631463 if (t == '(') {
14641464 next_nomacro(S);
1465− if (S->tok != ')')
1465+ if (S->tccpp_tok != ')')
14661466 expect(S, "')'");
14671467 }
1468− S->tok = TOK_CINT;
1469− S->tokc.i = c;
1470− } else if (1 && S->tok == TOK___HAS_INCLUDE) {
1468+ S->tccpp_tok = TOK_CINT;
1469+ S->tccpp_tokc.i = c;
1470+ } else if (1 && S->tccpp_tok == TOK___HAS_INCLUDE) {
14711471 next(S); /* XXX check if correct to use expansion */
14721472 skip(S, '(');
1473− while (S->tok != ')' && S->tok != TOK_EOF)
1473+ while (S->tccpp_tok != ')' && S->tccpp_tok != TOK_EOF)
14741474 next(S);
1475− if (S->tok != ')')
1475+ if (S->tccpp_tok != ')')
14761476 expect(S, "')'");
1477− S->tok = TOK_CINT;
1478− S->tokc.i = 0;
1479− } else if (S->tok >= TOK_IDENT) {
1477+ S->tccpp_tok = TOK_CINT;
1478+ S->tccpp_tokc.i = 0;
1479+ } else if (S->tccpp_tok >= TOK_IDENT) {
14801480 /* if undefined macro, replace with zero, check for func-like */
1481− t = S->tok;
1482− S->tok = TOK_CINT;
1483− S->tokc.i = 0;
1481+ t = S->tccpp_tok;
1482+ S->tccpp_tok = TOK_CINT;
1483+ S->tccpp_tokc.i = 0;
14841484 tok_str_add_tok(S, str);
14851485 next(S);
1486− if (S->tok == '(')
1486+ if (S->tccpp_tok == '(')
14871487 tcc_error(S, "function-like macro '%s' is not defined",
14881488 get_tok_str(S, t, NULL));
14891489 goto redo;
@@ -1503,15 +1503,15 @@ static int expr_preprocess(TCCState *S) · 13 unmodified lines
15031503
15041504
15051505 /* parse after #define */
1506−ST_FUNC void parse_define(TCCState *S)
1506+ST_FUNC void parse_define(TCCState* S)
15071507 {
15081508 Sym *s, *first, **ps;
15091509 int v, t, varg, is_vaargs, spc;
15101510 int saved_parse_flags = S->tccpp_parse_flags;
15111511
1512− v = S->tok;
1512+ v = S->tccpp_tok;
15131513 if (v < TOK_IDENT || v == TOK_DEFINED)
1514− tcc_error(S, "invalid macro name '%s'", get_tok_str(S, S->tok, &S->tokc));
1514+ tcc_error(S, "invalid macro name '%s'", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
15151515 /* XXX: should check if same macro (ANSI) */
15161516 first = NULL;
15171517 t = MACRO_OBJ;
@@ -1523,18 +1523,18 @@ ST_FUNC void parse_define(TCCState *S) · 5 unmodified lines
15231523 /* '(' must be just after macro definition for MACRO_FUNC */
15241524 next_nomacro(S);
15251525 S->tccpp_parse_flags &= ~PARSE_FLAG_SPACES;
1526− if (S->tok == '(') {
1526+ if (S->tccpp_tok == '(') {
15271527 int dotid = set_idnum(S, '.', 0);
15281528 next_nomacro(S);
15291529 ps = &first;
1530− if (S->tok != ')') for (;;) {
1531− varg = S->tok;
1530+ if (S->tccpp_tok != ')') for (;;) {
1531+ varg = S->tccpp_tok;
15321532 next_nomacro(S);
15331533 is_vaargs = 0;
15341534 if (varg == TOK_DOTS) {
15351535 varg = TOK___VA_ARGS__;
15361536 is_vaargs = 1;
1537− } else if (S->tok == TOK_DOTS && gnu_ext) {
1537+ } else if (S->tccpp_tok == TOK_DOTS && gnu_ext) {
15381538 is_vaargs = 1;
15391539 next_nomacro(S);
15401540 }
@@ -1544,9 +1544,9 @@ ST_FUNC void parse_define(TCCState *S) · 3 unmodified lines
15441544 s = sym_push2(S, &S->tccgen_define_stack, varg | SYM_FIELD, is_vaargs, 0);
15451545 *ps = s;
15461546 ps = &s->next;
1547− if (S->tok == ')')
1547+ if (S->tccpp_tok == ')')
15481548 break;
1549− if (S->tok != ',' || is_vaargs)
1549+ if (S->tccpp_tok != ',' || is_vaargs)
15501550 goto bad_list;
15511551 next_nomacro(S);
15521552 }
@@ -1556,7 +1556,7 @@ ST_FUNC void parse_define(TCCState *S) · 3 unmodified lines
15561556 set_idnum(S, '.', dotid);
15571557 }
15581558
1559− S->tokstr_buf.len = 0;
1559+ S->tccpp_tokstr_buf.len = 0;
15601560 spc = 2;
15611561 S->tccpp_parse_flags |= PARSE_FLAG_ACCEPT_STRAYS | PARSE_FLAG_SPACES | PARSE_FLAG_LINEFEED;
15621562 /* The body of a macro definition should be parsed such that identifiers
@@ -1564,33 +1564,33 @@ ST_FUNC void parse_define(TCCState *S) · 1 unmodified line
15641564 ID character in asm mode). But '#' should be retained instead of
15651565 regarded as line comment leader, so still don't set ASM_FILE
15661566 in parse_flags. */
1567− while (S->tok != TOK_LINEFEED && S->tok != TOK_EOF) {
1567+ while (S->tccpp_tok != TOK_LINEFEED && S->tccpp_tok != TOK_EOF) {
15681568 /* remove spaces around ## and after '#' */
1569− if (TOK_TWOSHARPS == S->tok) {
1569+ if (TOK_TWOSHARPS == S->tccpp_tok) {
15701570 if (2 == spc)
15711571 goto bad_twosharp;
15721572 if (1 == spc)
1573− --S->tokstr_buf.len;
1573+ --S->tccpp_tokstr_buf.len;
15741574 spc = 3;
1575− S->tok = TOK_PPJOIN;
1576− } else if ('#' == S->tok) {
1575+ S->tccpp_tok = TOK_PPJOIN;
1576+ } else if ('#' == S->tccpp_tok) {
15771577 spc = 4;
1578− } else if (check_space(S, S->tok, &spc)) {
1578+ } else if (check_space(S, S->tccpp_tok, &spc)) {
15791579 goto skip;
15801580 }
1581− tok_str_add2(S, &S->tokstr_buf, S->tok, &S->tokc);
1581+ tok_str_add2(S, &S->tccpp_tokstr_buf, S->tccpp_tok, &S->tccpp_tokc);
15821582 skip:
15831583 next_nomacro(S);
15841584 }
15851585
15861586 S->tccpp_parse_flags = saved_parse_flags;
15871587 if (spc == 1)
1588− --S->tokstr_buf.len; /* remove trailing space */
1589− tok_str_add(S, &S->tokstr_buf, 0);
1588+ --S->tccpp_tokstr_buf.len; /* remove trailing space */
1589+ tok_str_add(S, &S->tccpp_tokstr_buf, 0);
15901590 if (3 == spc)
15911591 bad_twosharp:
15921592 tcc_error(S, "'##' cannot appear at either end of macro");
1593− define_push(S, v, t, tok_str_dup(S, &S->tokstr_buf), first);
1593+ define_push(S, v, t, tok_str_dup(S, &S->tccpp_tokstr_buf), first);
15941594 }
15951595
15961596 static CachedInclude *search_cached_include(TCCState *S, const char *filename, int add)
@@ -1640,16 +1640,16 @@ static CachedInclude *search_cached_include(TCCState *S, const char *filename, i · 43 unmodified lines
16401640 static void pragma_parse(TCCState *S)
16411641 {
16421642 next_nomacro(S);
1643− if (S->tok == TOK_push_macro || S->tok == TOK_pop_macro) {
1644− int t = S->tok, v;
1643+ if (S->tccpp_tok == TOK_push_macro || S->tccpp_tok == TOK_pop_macro) {
1644+ int t = S->tccpp_tok, v;
16451645 Sym *s;
16461646
1647− if (next(S), S->tok != '(')
1647+ if (next(S), S->tccpp_tok != '(')
16481648 goto pragma_err;
1649− if (next(S), S->tok != TOK_STR)
1649+ if (next(S), S->tccpp_tok != TOK_STR)
16501650 goto pragma_err;
1651− v = tok_alloc(S, S->tokc.str.data, S->tokc.str.size - 1)->tok;
1652− if (next(S), S->tok != ')')
1651+ v = tok_alloc(S, S->tccpp_tokc.str.data, S->tccpp_tokc.str.size - 1)->tok;
1652+ if (next(S), S->tccpp_tok != ')')
16531653 goto pragma_err;
16541654 if (t == TOK_push_macro) {
16551655 while (NULL == (s = define_find(S, v)))
@@ -1668,7 +1668,7 @@ static void pragma_parse(TCCState *S) · 12 unmodified lines
16681668 tcc_warning(S, "unbalanced #pragma pop_macro");
16691669 S->tccpp_pp_debug_tok = t, S->tccpp_pp_debug_symv = v;
16701670
1671− } else if (S->tok == TOK_once) {
1671+ } else if (S->tccpp_tok == TOK_once) {
16721672 search_cached_include(S, S->tccpp_file->filename, 1)->once = S->tccpp_pp_once;
16731673
16741674 } else if (S->output_type == TCC_OUTPUT_PREPROCESS) {
@@ -1678,7 +1678,7 @@ static void pragma_parse(TCCState *S) · 3 unmodified lines
16781678 unget_tok(S, '#');
16791679 unget_tok(S, TOK_LINEFEED);
16801680
1681− } else if (S->tok == TOK_pack) {
1681+ } else if (S->tccpp_tok == TOK_pack) {
16821682 /* This may be:
16831683 #pragma pack(1) // set
16841684 #pragma pack() // reset to default
@@ -1687,7 +1687,7 @@ static void pragma_parse(TCCState *S) · 2 unmodified lines
16871687 #pragma pack(pop) // restore previous */
16881688 next(S);
16891689 skip(S, '(');
1690− if (S->tok == TOK_ASM_pop) {
1690+ if (S->tccpp_tok == TOK_ASM_pop) {
16911691 next(S);
16921692 if (S->pack_stack_ptr <= S->pack_stack) {
16931693 stk_error:
@@ -1696,19 +1696,19 @@ static void pragma_parse(TCCState *S) · 2 unmodified lines
16961696 S->pack_stack_ptr--;
16971697 } else {
16981698 int val = 0;
1699− if (S->tok != ')') {
1700− if (S->tok == TOK_ASM_push) {
1699+ if (S->tccpp_tok != ')') {
1700+ if (S->tccpp_tok == TOK_ASM_push) {
17011701 next(S);
17021702 if (S->pack_stack_ptr >= S->pack_stack + PACK_STACK_SIZE - 1)
17031703 goto stk_error;
17041704 val = *S->pack_stack_ptr++;
1705− if (S->tok != ',')
1705+ if (S->tccpp_tok != ',')
17061706 goto pack_set;
17071707 next(S);
17081708 }
1709− if (S->tok != TOK_CINT)
1709+ if (S->tccpp_tok != TOK_CINT)
17101710 goto pragma_err;
1711− val = S->tokc.i;
1711+ val = S->tccpp_tokc.i;
17121712 if (val < 1 || val > 16 || (val & (val - 1)) != 0)
17131713 goto pragma_err;
17141714 next(S);
@@ -1716,21 +1716,21 @@ static void pragma_parse(TCCState *S) · 1 unmodified line
17161716 pack_set:
17171717 *S->pack_stack_ptr = val;
17181718 }
1719− if (S->tok != ')')
1719+ if (S->tccpp_tok != ')')
17201720 goto pragma_err;
17211721
1722− } else if (S->tok == TOK_comment) {
1722+ } else if (S->tccpp_tok == TOK_comment) {
17231723 char *p; int t;
17241724 next(S);
17251725 skip(S, '(');
1726− t = S->tok;
1726+ t = S->tccpp_tok;
17271727 next(S);
17281728 skip(S, ',');
1729− if (S->tok != TOK_STR)
1729+ if (S->tccpp_tok != TOK_STR)
17301730 goto pragma_err;
1731− p = tcc_strdup(S, (char *)S->tokc.str.data);
1731+ p = tcc_strdup(S, (char *)S->tccpp_tokc.str.data);
17321732 next(S);
1733− if (S->tok != ')')
1733+ if (S->tccpp_tok != ')')
17341734 goto pragma_err;
17351735 if (t == TOK_lib) {
17361736 dynarray_add(S, &S->pragma_libs, &S->nb_pragma_libs, p);
@@ -1741,7 +1741,7 @@ static void pragma_parse(TCCState *S) · 4 unmodified lines
17411741 }
17421742
17431743 } else
1744− tcc_warning_c(warn_unsupported)(S, "#pragma %s ignored", get_tok_str(S, S->tok, &S->tokc));
1744+ tcc_warning_c(warn_unsupported)(S, "#pragma %s ignored", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
17451745 return;
17461746
17471747 pragma_err:
@@ -1750,7 +1750,7 @@ pragma_err: · 2 unmodified lines
17501750 }
17511751
17521752 /* is_bof is true if first non space token at beginning of file */
1753−ST_FUNC void preprocess(TCCState *S, int is_bof)
1753+ST_FUNC void preprocess(TCCState* S, int is_bof)
17541754 {
17551755 int i, c, n, saved_parse_flags;
17561756 char buf[1024], *q;
@@ -1766,18 +1766,18 @@ ST_FUNC void preprocess(TCCState *S, int is_bof) · 9 unmodified lines
17661766
17671767 next_nomacro(S);
17681768 redo:
1769− switch(S->tok) {
1769+ switch(S->tccpp_tok) {
17701770 case TOK_DEFINE:
1771− S->tccpp_pp_debug_tok = S->tok;
1771+ S->tccpp_pp_debug_tok = S->tccpp_tok;
17721772 next_nomacro(S);
1773− S->tccpp_pp_debug_symv = S->tok;
1773+ S->tccpp_pp_debug_symv = S->tccpp_tok;
17741774 parse_define(S);
17751775 break;
17761776 case TOK_UNDEF:
1777− S->tccpp_pp_debug_tok = S->tok;
1777+ S->tccpp_pp_debug_tok = S->tccpp_tok;
17781778 next_nomacro(S);
1779− S->tccpp_pp_debug_symv = S->tok;
1780− s = define_find(S, S->tok);
1779+ S->tccpp_pp_debug_symv = S->tccpp_tok;
1780+ s = define_find(S, S->tccpp_tok);
17811781 /* undefine symbol by putting an invalid name */
17821782 if (s)
17831783 define_undef(S, s);
@@ -1822,8 +1822,8 @@ ST_FUNC void preprocess(TCCState *S, int is_bof) · 38 unmodified lines
18221822 | (S->tccpp_parse_flags & PARSE_FLAG_ASM_FILE));
18231823 next(S);
18241824 buf[0] = '\0';
1825− while (S->tok != TOK_LINEFEED) {
1826− pstrcat(buf, sizeof(buf), get_tok_str(S, S->tok, &S->tokc));
1825+ while (S->tccpp_tok != TOK_LINEFEED) {
1826+ pstrcat(buf, sizeof(buf), get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
18271827 next(S);
18281828 }
18291829 len = strlen(buf);
@@ -1838,7 +1838,7 @@ ST_FUNC void preprocess(TCCState *S, int is_bof) · 8 unmodified lines
18381838
18391839 if (S->include_stack_ptr >= S->include_stack + INCLUDE_STACK_SIZE)
18401840 tcc_error(S,"#include recursion too deep");
1841− i = S->tok == TOK_INCLUDE_NEXT ? S->tccpp_file->include_next_index + 1 : 0;
1841+ i = S->tccpp_tok == TOK_INCLUDE_NEXT ? S->tccpp_file->include_next_index + 1 : 0;
18421842 n = 2 + S->nb_include_paths + S->nb_sysinclude_paths;
18431843 for (; i < n; ++i) {
18441844 char buf1[sizeof S->tccpp_file->filename];
@@ -1898,7 +1898,7 @@ ST_FUNC void preprocess(TCCState *S, int is_bof) · 53 unmodified lines
18981898 }
18991899 /* add include file debug info */
19001900 tcc_debug_bincl(S);
1901− S->tok_flags |= TOK_FLAG_BOF | TOK_FLAG_BOL;
1901+ S->tccpp_tok_flags |= TOK_FLAG_BOF | TOK_FLAG_BOL;
19021902 S->tccpp_ch = S->tccpp_file->buf_ptr[0];
19031903 goto the_end;
19041904 }
@@ -1915,17 +1915,17 @@ include_done: · 10 unmodified lines
19151915 c = 0;
19161916 do_ifdef:
19171917 next_nomacro(S);
1918− if (S->tok < TOK_IDENT)
1918+ if (S->tccpp_tok < TOK_IDENT)
19191919 tcc_error(S,"invalid argument for '#if%sdef'", c ? "n" : "");
19201920 if (is_bof) {
19211921 if (c) {
19221922 #ifdef INC_DEBUG
1923− printf("#ifndef %s\n", get_tok_str(S, S->tok, NULL));
1923+ printf("#ifndef %s\n", get_tok_str(S, S->tccpp_tok, NULL));
19241924 #endif
1925− S->tccpp_file->ifndef_macro = S->tok;
1925+ S->tccpp_file->ifndef_macro = S->tccpp_tok;
19261926 }
19271927 }
1928− c = (define_find(S, S->tok) != 0) ^ c;
1928+ c = (define_find(S, S->tccpp_tok) != 0) ^ c;
19291929 do_if:
19301930 if (S->ifdef_stack_ptr >= S->ifdef_stack + IFDEF_STACK_SIZE)
19311931 tcc_error(S,"memory full (ifdef)");
@@ -1973,31 +1973,31 @@ include_done: · 41 unmodified lines
19731973 /* need to set to zero to avoid false matches if another
19741974 #ifndef at middle of file */
19751975 S->tccpp_file->ifndef_macro = 0;
1976− while (S->tok != TOK_LINEFEED)
1976+ while (S->tccpp_tok != TOK_LINEFEED)
19771977 next_nomacro(S);
1978− S->tok_flags |= TOK_FLAG_ENDIF;
1978+ S->tccpp_tok_flags |= TOK_FLAG_ENDIF;
19791979 goto the_end;
19801980 }
19811981 break;
19821982 case TOK_PPNUM:
1983− n = strtoul((char*)S->tokc.str.data, &q, 10);
1983+ n = strtoul((char*)S->tccpp_tokc.str.data, &q, 10);
19841984 goto _line_num;
19851985 case TOK_LINE:
19861986 next(S);
1987− if (S->tok != TOK_CINT)
1987+ if (S->tccpp_tok != TOK_CINT)
19881988 _line_err:
19891989 tcc_error(S,"wrong #line format");
1990− n = S->tokc.i;
1990+ n = S->tccpp_tokc.i;
19911991 _line_num:
19921992 next(S);
1993− if (S->tok != TOK_LINEFEED) {
1994− if (S->tok == TOK_STR) {
1993+ if (S->tccpp_tok != TOK_LINEFEED) {
1994+ if (S->tccpp_tok == TOK_STR) {
19951995 if (S->tccpp_file->true_filename == S->tccpp_file->filename)
19961996 S->tccpp_file->true_filename = tcc_strdup(S, S->tccpp_file->filename);
19971997 /* prepend directory from real file */
19981998 pstrcpy(buf, sizeof buf, S->tccpp_file->true_filename);
19991999 *tcc_basename(buf) = 0;
2000− pstrcat(buf, sizeof buf, (char *)S->tokc.str.data);
2000+ pstrcat(buf, sizeof buf, (char *)S->tccpp_tokc.str.data);
20012001 tcc_debug_putfile(S, buf);
20022002 } else if (S->tccpp_parse_flags & PARSE_FLAG_ASM_FILE)
20032003 break;
@@ -2011,7 +2011,7 @@ include_done: · 7 unmodified lines
20112011 break;
20122012 case TOK_ERROR:
20132013 case TOK_WARNING:
2014− c = S->tok;
2014+ c = S->tccpp_tok;
20152015 S->tccpp_ch = S->tccpp_file->buf_ptr[0];
20162016 skip_spaces(S);
20172017 q = buf;
@@ -2039,23 +2039,23 @@ include_done: · 21 unmodified lines
20392039 /* ignore gas line comment in an 'S' file. */
20402040 if (saved_parse_flags & PARSE_FLAG_ASM_FILE)
20412041 goto ignore;
2042− if (S->tok == '!' && is_bof)
2042+ if (S->tccpp_tok == '!' && is_bof)
20432043 /* '!' is ignored at beginning to allow C scripts. */
20442044 goto ignore;
2045− tcc_warning(S,"Ignoring unknown preprocessing directive #%s", get_tok_str(S, S->tok, &S->tokc));
2045+ tcc_warning(S,"Ignoring unknown preprocessing directive #%s", get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
20462046 ignore:
20472047 S->tccpp_file->buf_ptr = parse_line_comment(S, S->tccpp_file->buf_ptr - 1);
20482048 goto the_end;
20492049 }
20502050 /* ignore other preprocess commands or #! for C scripts */
2051− while (S->tok != TOK_LINEFEED)
2051+ while (S->tccpp_tok != TOK_LINEFEED)
20522052 next_nomacro(S);
20532053 the_end:
20542054 S->tccpp_parse_flags = saved_parse_flags;
20552055 }
20562056
20572057 /* evaluate escape codes in a string. */
2058−static void parse_escape_string(TCCState *S, CString *outstr, const uint8_t *buf, int is_long)
2058+static void parse_escape_string(TCCState* S, CString *outstr, const uint8_t *buf, int is_long)
20592059 {
20602060 int c, n, i;
20612061 const uint8_t *p;
@@ -2232,7 +2232,7 @@ static void parse_escape_string(TCCState *S, CString *outstr, const uint8_t *buf · 170 unmodified lines
22322232 cstr_wccat(S, outstr, '\0');
22332233 }
22342234
2235−static void parse_string(TCCState *S, const char *s, int len)
2235+static void parse_string(TCCState* S, const char *s, int len)
22362236 {
22372237 uint8_t buf[1000], *p = buf;
22382238 int is_long, sep;
@@ -2246,8 +2246,8 @@ static void parse_string(TCCState *S, const char *s, int len) · 7 unmodified lines
22462246 memcpy(p, s, len);
22472247 p[len] = 0;
22482248
2249− cstr_reset(&S->tokcstr);
2250− parse_escape_string(S, &S->tokcstr, p, is_long);
2249+ cstr_reset(&S->tccpp_tokcstr);
2250+ parse_escape_string(S, &S->tccpp_tokcstr, p, is_long);
22512251 if (p != buf)
22522252 tcc_free(S, p);
22532253
@@ -2255,28 +2255,28 @@ static void parse_string(TCCState *S, const char *s, int len) · 1 unmodified line
22552255 int char_size, i, n, c;
22562256 /* XXX: make it portable */
22572257 if (!is_long)
2258− S->tok = TOK_CCHAR, char_size = 1;
2258+ S->tccpp_tok = TOK_CCHAR, char_size = 1;
22592259 else
2260− S->tok = TOK_LCHAR, char_size = sizeof(nwchar_t);
2261− n = S->tokcstr.size / char_size - 1;
2260+ S->tccpp_tok = TOK_LCHAR, char_size = sizeof(nwchar_t);
2261+ n = S->tccpp_tokcstr.size / char_size - 1;
22622262 if (n < 1)
22632263 tcc_error(S,"empty character constant");
22642264 if (n > 1)
22652265 tcc_warning_c(warn_all)(S,"multi-character character constant");
22662266 for (c = i = 0; i < n; ++i) {
22672267 if (is_long)
2268− c = ((nwchar_t *)S->tokcstr.data)[i];
2268+ c = ((nwchar_t *)S->tccpp_tokcstr.data)[i];
22692269 else
2270− c = (c << 8) | ((char *)S->tokcstr.data)[i];
2270+ c = (c << 8) | ((char *)S->tccpp_tokcstr.data)[i];
22712271 }
2272− S->tokc.i = c;
2272+ S->tccpp_tokc.i = c;
22732273 } else {
2274− S->tokc.str.size = S->tokcstr.size;
2275− S->tokc.str.data = S->tokcstr.data;
2274+ S->tccpp_tokc.str.size = S->tccpp_tokcstr.size;
2275+ S->tccpp_tokc.str.data = S->tccpp_tokcstr.data;
22762276 if (!is_long)
2277− S->tok = TOK_STR;
2277+ S->tccpp_tok = TOK_STR;
22782278 else
2279− S->tok = TOK_LSTR;
2279+ S->tccpp_tok = TOK_LSTR;
22802280 }
22812281 }
22822282
@@ -2305,7 +2305,7 @@ static void bn_zero(unsigned int *bn) · 22 unmodified lines
23052305
23062306 /* parse number in null terminated string 'p' and return it in the
23072307 current token */
2308−static void parse_number(TCCState *S, const char *p)
2308+static void parse_number(TCCState* S, const char *p)
23092309 {
23102310 int b, t, shift, frac_bits, s, exp_val, ch;
23112311 char *q;
@@ -2313,7 +2313,7 @@ static void parse_number(TCCState *S, const char *p) · 1 unmodified line
23132313 double d;
23142314
23152315 /* number */
2316− q = S->token_buf;
2316+ q = S->tccpp_token_buf;
23172317 ch = *p++;
23182318 t = ch;
23192319 ch = *p++;
@@ -2345,7 +2345,7 @@ static void parse_number(TCCState *S, const char *p) · 25 unmodified lines
23452345 break;
23462346 if (t >= b)
23472347 break;
2348− if (q >= S->token_buf + STRING_MAX_SIZE) {
2348+ if (q >= S->tccpp_token_buf + STRING_MAX_SIZE) {
23492349 num_too_long:
23502350 tcc_error(S,"number too long");
23512351 }
@@ -2367,7 +2367,7 @@ static void parse_number(TCCState *S, const char *p) · 15 unmodified lines
23672367 else
23682368 shift = 1;
23692369 bn_zero(bn);
2370− q = S->token_buf;
2370+ q = S->tccpp_token_buf;
23712371 while (1) {
23722372 t = *q++;
23732373 if (t == '\0') {
@@ -2428,45 +2428,45 @@ static void parse_number(TCCState *S, const char *p) · 54 unmodified lines
24282428 t = toup(ch);
24292429 if (t == 'F') {
24302430 ch = *p++;
2431− S->tok = TOK_CFLOAT;
2431+ S->tccpp_tok = TOK_CFLOAT;
24322432 /* float : should handle overflow */
2433− S->tokc.f = (float)d;
2433+ S->tccpp_tokc.f = (float)d;
24342434 } else if (t == 'L') {
24352435 ch = *p++;
24362436 #ifdef TCC_USING_DOUBLE_FOR_LDOUBLE
2437− S->tok = TOK_CDOUBLE;
2438− S->tokc.d = d;
2437+ S->tccpp_tok = TOK_CDOUBLE;
2438+ S->tccpp_tokc.d = d;
24392439 #else
2440− S->tok = TOK_CLDOUBLE;
2440+ S->tccpp_tok = TOK_CLDOUBLE;
24412441 /* XXX: not large enough */
2442− S->tokc.ld = (long double)d;
2442+ S->tccpp_tokc.ld = (long double)d;
24432443 #endif
24442444 } else {
2445− S->tok = TOK_CDOUBLE;
2446− S->tokc.d = d;
2445+ S->tccpp_tok = TOK_CDOUBLE;
2446+ S->tccpp_tokc.d = d;
24472447 }
24482448 } else {
24492449 /* decimal floats */
24502450 if (ch == '.') {
2451− if (q >= S->token_buf + STRING_MAX_SIZE)
2451+ if (q >= S->tccpp_token_buf + STRING_MAX_SIZE)
24522452 goto num_too_long;
24532453 *q++ = ch;
24542454 ch = *p++;
24552455 float_frac_parse:
24562456 while (ch >= '0' && ch <= '9') {
2457− if (q >= S->token_buf + STRING_MAX_SIZE)
2457+ if (q >= S->tccpp_token_buf + STRING_MAX_SIZE)
24582458 goto num_too_long;
24592459 *q++ = ch;
24602460 ch = *p++;
24612461 }
24622462 }
24632463 if (ch == 'e' || ch == 'E') {
2464− if (q >= S->token_buf + STRING_MAX_SIZE)
2464+ if (q >= S->tccpp_token_buf + STRING_MAX_SIZE)
24652465 goto num_too_long;
24662466 *q++ = ch;
24672467 ch = *p++;
24682468 if (ch == '-' || ch == '+') {
2469− if (q >= S->token_buf + STRING_MAX_SIZE)
2469+ if (q >= S->tccpp_token_buf + STRING_MAX_SIZE)
24702470 goto num_too_long;
24712471 *q++ = ch;
24722472 ch = *p++;
@@ -2474,7 +2474,7 @@ static void parse_number(TCCState *S, const char *p) · 1 unmodified line
24742474 if (ch < '0' || ch > '9')
24752475 expect(S, "exponent digits");
24762476 while (ch >= '0' && ch <= '9') {
2477− if (q >= S->token_buf + STRING_MAX_SIZE)
2477+ if (q >= S->tccpp_token_buf + STRING_MAX_SIZE)
24782478 goto num_too_long;
24792479 *q++ = ch;
24802480 ch = *p++;
@@ -2485,20 +2485,20 @@ static void parse_number(TCCState *S, const char *p) · 4 unmodified lines
24852485 errno = 0;
24862486 if (t == 'F') {
24872487 ch = *p++;
2488− S->tok = TOK_CFLOAT;
2489− S->tokc.f = strtof(S->token_buf, NULL);
2488+ S->tccpp_tok = TOK_CFLOAT;
2489+ S->tccpp_tokc.f = strtof(S->tccpp_token_buf, NULL);
24902490 } else if (t == 'L') {
24912491 ch = *p++;
24922492 #ifdef TCC_USING_DOUBLE_FOR_LDOUBLE
2493− S->tok = TOK_CDOUBLE;
2494− S->tokc.d = strtod(S->token_buf, NULL);
2493+ S->tccpp_tok = TOK_CDOUBLE;
2494+ S->tccpp_tokc.d = strtod(S->tccpp_token_buf, NULL);
24952495 #else
2496− S->tok = TOK_CLDOUBLE;
2497− S->tokc.ld = strtold(S->token_buf, NULL);
2496+ S->tccpp_tok = TOK_CLDOUBLE;
2497+ S->tccpp_tokc.ld = strtold(S->tccpp_token_buf, NULL);
24982498 #endif
24992499 } else {
2500− S->tok = TOK_CDOUBLE;
2501− S->tokc.d = strtod(S->token_buf, NULL);
2500+ S->tccpp_tok = TOK_CDOUBLE;
2501+ S->tccpp_tokc.d = strtod(S->tccpp_token_buf, NULL);
25022502 }
25032503 }
25042504 } else {
@@ -2508,7 +2508,7 @@ static void parse_number(TCCState *S, const char *p) · 3 unmodified lines
25082508
25092509 /* integer number */
25102510 *q = '\0';
2511− q = S->token_buf;
2511+ q = S->tccpp_token_buf;
25122512 if (b == 10 && *q == '0') {
25132513 b = 8;
25142514 q++;
@@ -2579,15 +2579,15 @@ static void parse_number(TCCState *S, const char *p) · 64 unmodified lines
25792579 if (ov)
25802580 tcc_warning(S, "integer constant overflow");
25812581
2582− S->tok = TOK_CINT;
2582+ S->tccpp_tok = TOK_CINT;
25832583 if (lcount) {
2584− S->tok = TOK_CLONG;
2584+ S->tccpp_tok = TOK_CLONG;
25852585 if (lcount == 2)
2586− S->tok = TOK_CLLONG;
2586+ S->tccpp_tok = TOK_CLLONG;
25872587 }
25882588 if (ucount)
2589− ++S->tok; /* TOK_CU... */
2590− S->tokc.i = n;
2589+ ++S->tccpp_tok; /* TOK_CU... */
2590+ S->tccpp_tokc.i = n;
25912591 }
25922592 if (ch)
25932593 tcc_error(S,"invalid number");
@@ -2599,14 +2599,14 @@ static void parse_number(TCCState *S, const char *p) · 5 unmodified lines
25992599 PEEKC(c, p); \
26002600 if (c == c2) { \
26012601 p++; \
2602− S->tok = tok2; \
2602+ S->tccpp_tok = tok2; \
26032603 } else { \
2604− S->tok = tok1; \
2604+ S->tccpp_tok = tok1; \
26052605 } \
26062606 break;
26072607
26082608 /* return next token without macro substitution */
2609−static inline void next_nomacro1(TCCState *S)
2609+static inline void next_nomacro1(TCCState* S)
26102610 {
26112611 int t, c, is_long, len;
26122612 TokenSym *ts;
@@ -2619,7 +2619,7 @@ static inline void next_nomacro1(TCCState *S) · 6 unmodified lines
26192619 switch(c) {
26202620 case ' ':
26212621 case '\t':
2622− S->tok = c;
2622+ S->tccpp_tok = c;
26232623 p++;
26242624 maybe_space:
26252625 if (S->tccpp_parse_flags & PARSE_FLAG_SPACES)
@@ -2642,30 +2642,30 @@ static inline void next_nomacro1(TCCState *S) · 16 unmodified lines
26422642 goto redo_no_start;
26432643 {
26442644 if ((S->tccpp_parse_flags & PARSE_FLAG_LINEFEED)
2645− && !(S->tok_flags & TOK_FLAG_EOF)) {
2646− S->tok_flags |= TOK_FLAG_EOF;
2647− S->tok = TOK_LINEFEED;
2645+ && !(S->tccpp_tok_flags & TOK_FLAG_EOF)) {
2646+ S->tccpp_tok_flags |= TOK_FLAG_EOF;
2647+ S->tccpp_tok = TOK_LINEFEED;
26482648 goto keep_tok_flags;
26492649 } else if (!(S->tccpp_parse_flags & PARSE_FLAG_PREPROCESS)) {
2650− S->tok = TOK_EOF;
2650+ S->tccpp_tok = TOK_EOF;
26512651 } else if (S->ifdef_stack_ptr != S->tccpp_file->ifdef_stack_ptr) {
26522652 tcc_error(S,"missing #endif");
26532653 } else if (S->include_stack_ptr == S->include_stack) {
26542654 /* no include left : end of file. */
2655− S->tok = TOK_EOF;
2655+ S->tccpp_tok = TOK_EOF;
26562656 } else {
2657− S->tok_flags &= ~TOK_FLAG_EOF;
2657+ S->tccpp_tok_flags &= ~TOK_FLAG_EOF;
26582658 /* pop include file */
26592659
26602660 /* test if previous '#endif' was after a #ifdef at
26612661 start of file */
2662− if (S->tok_flags & TOK_FLAG_ENDIF) {
2662+ if (S->tccpp_tok_flags & TOK_FLAG_ENDIF) {
26632663 #ifdef INC_DEBUG
26642664 printf("#endif %s\n", get_tok_str(S, S->tccpp_file->ifndef_macro_saved, NULL));
26652665 #endif
26662666 search_cached_include(S, S->tccpp_file->filename, 1)
26672667 ->ifndef_macro = S->tccpp_file->ifndef_macro_saved;
2668− S->tok_flags &= ~TOK_FLAG_ENDIF;
2668+ S->tccpp_tok_flags &= ~TOK_FLAG_ENDIF;
26692669 }
26702670
26712671 /* add end of include file debug info */
@@ -2675,7 +2675,7 @@ static inline void next_nomacro1(TCCState *S) · 3 unmodified lines
26752675 S->include_stack_ptr--;
26762676 p = S->tccpp_file->buf_ptr;
26772677 if (p == S->tccpp_file->buffer)
2678− S->tok_flags = TOK_FLAG_BOF|TOK_FLAG_BOL;
2678+ S->tccpp_tok_flags = TOK_FLAG_BOF|TOK_FLAG_BOL;
26792679 goto redo_no_start;
26802680 }
26812681 }
@@ -2683,27 +2683,27 @@ static inline void next_nomacro1(TCCState *S) · 1 unmodified line
26832683
26842684 case '\n':
26852685 S->tccpp_file->line_num++;
2686− S->tok_flags |= TOK_FLAG_BOL;
2686+ S->tccpp_tok_flags |= TOK_FLAG_BOL;
26872687 p++;
26882688 maybe_newline:
26892689 if (0 == (S->tccpp_parse_flags & PARSE_FLAG_LINEFEED))
26902690 goto redo_no_start;
2691− S->tok = TOK_LINEFEED;
2691+ S->tccpp_tok = TOK_LINEFEED;
26922692 goto keep_tok_flags;
26932693
26942694 case '#':
26952695 /* XXX: simplify */
26962696 PEEKC(c, p);
2697− if ((S->tok_flags & TOK_FLAG_BOL) &&
2697+ if ((S->tccpp_tok_flags & TOK_FLAG_BOL) &&
26982698 (S->tccpp_parse_flags & PARSE_FLAG_PREPROCESS)) {
26992699 S->tccpp_file->buf_ptr = p;
2700− preprocess(S, S->tok_flags & TOK_FLAG_BOF);
2700+ preprocess(S, S->tccpp_tok_flags & TOK_FLAG_BOF);
27012701 p = S->tccpp_file->buf_ptr;
27022702 goto maybe_newline;
27032703 } else {
27042704 if (c == '#') {
27052705 p++;
2706− S->tok = TOK_TWOSHARPS;
2706+ S->tccpp_tok = TOK_TWOSHARPS;
27072707 } else {
27082708 #if !defined(TCC_TARGET_ARM)
27092709 if (S->tccpp_parse_flags & PARSE_FLAG_ASM_FILE) {
@@ -2712,7 +2712,7 @@ maybe_newline: · 2 unmodified lines
27122712 } else
27132713 #endif
27142714 {
2715− S->tok = '#';
2715+ S->tccpp_tok = '#';
27162716 }
27172717 }
27182718 }
@@ -2765,19 +2765,19 @@ maybe_newline: · 46 unmodified lines
27652765 token_found: ;
27662766 } else {
27672767 /* slower case */
2768− cstr_reset(&S->tokcstr);
2769− cstr_cat(S, &S->tokcstr, (char *) p1, len);
2768+ cstr_reset(&S->tccpp_tokcstr);
2769+ cstr_cat(S, &S->tccpp_tokcstr, (char *) p1, len);
27702770 p--;
27712771 PEEKC(c, p);
27722772 parse_ident_slow:
27732773 while (S->tccpp_isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
27742774 {
2775− cstr_ccat(S, &S->tokcstr, c);
2775+ cstr_ccat(S, &S->tccpp_tokcstr, c);
27762776 PEEKC(c, p);
27772777 }
2778− ts = tok_alloc(S, S->tokcstr.data, S->tokcstr.size);
2778+ ts = tok_alloc(S, S->tccpp_tokcstr.data, S->tccpp_tokcstr.size);
27792779 }
2780− S->tok = ts->tok;
2780+ S->tccpp_tok = ts->tok;
27812781 break;
27822782 case 'L':
27832783 t = p[1];
@@ -2790,8 +2790,8 @@ maybe_newline: · 6 unmodified lines
27902790 is_long = 1;
27912791 goto str_const;
27922792 } else {
2793− cstr_reset(&S->tokcstr);
2794− cstr_ccat(S, &S->tokcstr, 'L');
2793+ cstr_reset(&S->tccpp_tokcstr);
2794+ cstr_ccat(S, &S->tccpp_tokcstr, 'L');
27952795 goto parse_ident_slow;
27962796 }
27972797 }
@@ -2805,27 +2805,27 @@ maybe_newline: · 7 unmodified lines
28052805 /* after the first digit, accept digits, alpha, '.' or sign if
28062806 prefixed by 'eEpP' */
28072807 parse_num:
2808− cstr_reset(&S->tokcstr);
2808+ cstr_reset(&S->tccpp_tokcstr);
28092809 for(;;) {
2810− cstr_ccat(S, &S->tokcstr, t);
2810+ cstr_ccat(S, &S->tccpp_tokcstr, t);
28112811 if (!((S->tccpp_isidnum_table[c - CH_EOF] & (IS_ID|IS_NUM))
28122812 || c == '.'
28132813 || ((c == '+' || c == '-')
28142814 && (((t == 'e' || t == 'E')
28152815 && !(S->tccpp_parse_flags & PARSE_FLAG_ASM_FILE
28162816 /* 0xe+1 is 3 tokens in asm */
2817− && ((char*)S->tokcstr.data)[0] == '0'
2818− && toup(((char*)S->tokcstr.data)[1]) == 'X'))
2817+ && ((char*)S->tccpp_tokcstr.data)[0] == '0'
2818+ && toup(((char*)S->tccpp_tokcstr.data)[1]) == 'X'))
28192819 || t == 'p' || t == 'P'))))
28202820 break;
28212821 t = c;
28222822 PEEKC(c, p);
28232823 }
28242824 /* We add a trailing '\0' to ease parsing */
2825− cstr_ccat(S, &S->tokcstr, '\0');
2826− S->tokc.str.size = S->tokcstr.size;
2827− S->tokc.str.data = S->tokcstr.data;
2828− S->tok = TOK_PPNUM;
2825+ cstr_ccat(S, &S->tccpp_tokcstr, '\0');
2826+ S->tccpp_tokc.str.size = S->tccpp_tokcstr.size;
2827+ S->tccpp_tokc.str.data = S->tccpp_tokcstr.data;
2828+ S->tccpp_tok = TOK_PPNUM;
28292829 break;
28302830
28312831 case '.':
@@ -2842,63 +2842,63 @@ maybe_newline: · 10 unmodified lines
28422842 PEEKC(c, p);
28432843 if (c == '.') {
28442844 p++;
2845− S->tok = TOK_DOTS;
2845+ S->tccpp_tok = TOK_DOTS;
28462846 } else {
28472847 *--p = '.'; /* may underflow into file->unget[] */
2848− S->tok = '.';
2848+ S->tccpp_tok = '.';
28492849 }
28502850 } else {
2851− S->tok = '.';
2851+ S->tccpp_tok = '.';
28522852 }
28532853 break;
28542854 case '\'':
28552855 case '\"':
28562856 is_long = 0;
28572857 str_const:
2858− cstr_reset(&S->tokcstr);
2858+ cstr_reset(&S->tccpp_tokcstr);
28592859 if (is_long)
2860− cstr_ccat(S, &S->tokcstr, 'L');
2861− cstr_ccat(S, &S->tokcstr, c);
2862− p = parse_pp_string(S, p, c, &S->tokcstr);
2863− cstr_ccat(S, &S->tokcstr, c);
2864− cstr_ccat(S, &S->tokcstr, '\0');
2865− S->tokc.str.size = S->tokcstr.size;
2866− S->tokc.str.data = S->tokcstr.data;
2867− S->tok = TOK_PPSTR;
2860+ cstr_ccat(S, &S->tccpp_tokcstr, 'L');
2861+ cstr_ccat(S, &S->tccpp_tokcstr, c);
2862+ p = parse_pp_string(S, p, c, &S->tccpp_tokcstr);
2863+ cstr_ccat(S, &S->tccpp_tokcstr, c);
2864+ cstr_ccat(S, &S->tccpp_tokcstr, '\0');
2865+ S->tccpp_tokc.str.size = S->tccpp_tokcstr.size;
2866+ S->tccpp_tokc.str.data = S->tccpp_tokcstr.data;
2867+ S->tccpp_tok = TOK_PPSTR;
28682868 break;
28692869
28702870 case '<':
28712871 PEEKC(c, p);
28722872 if (c == '=') {
28732873 p++;
2874− S->tok = TOK_LE;
2874+ S->tccpp_tok = TOK_LE;
28752875 } else if (c == '<') {
28762876 PEEKC(c, p);
28772877 if (c == '=') {
28782878 p++;
2879− S->tok = TOK_A_SHL;
2879+ S->tccpp_tok = TOK_A_SHL;
28802880 } else {
2881− S->tok = TOK_SHL;
2881+ S->tccpp_tok = TOK_SHL;
28822882 }
28832883 } else {
2884− S->tok = TOK_LT;
2884+ S->tccpp_tok = TOK_LT;
28852885 }
28862886 break;
28872887 case '>':
28882888 PEEKC(c, p);
28892889 if (c == '=') {
28902890 p++;
2891− S->tok = TOK_GE;
2891+ S->tccpp_tok = TOK_GE;
28922892 } else if (c == '>') {
28932893 PEEKC(c, p);
28942894 if (c == '=') {
28952895 p++;
2896− S->tok = TOK_A_SAR;
2896+ S->tccpp_tok = TOK_A_SAR;
28972897 } else {
2898− S->tok = TOK_SAR;
2898+ S->tccpp_tok = TOK_SAR;
28992899 }
29002900 } else {
2901− S->tok = TOK_GT;
2901+ S->tccpp_tok = TOK_GT;
29022902 }
29032903 break;
29042904
@@ -2906,12 +2906,12 @@ maybe_newline: · 1 unmodified line
29062906 PEEKC(c, p);
29072907 if (c == '&') {
29082908 p++;
2909− S->tok = TOK_LAND;
2909+ S->tccpp_tok = TOK_LAND;
29102910 } else if (c == '=') {
29112911 p++;
2912− S->tok = TOK_A_AND;
2912+ S->tccpp_tok = TOK_A_AND;
29132913 } else {
2914− S->tok = '&';
2914+ S->tccpp_tok = '&';
29152915 }
29162916 break;
29172917
@@ -2919,12 +2919,12 @@ maybe_newline: · 1 unmodified line
29192919 PEEKC(c, p);
29202920 if (c == '|') {
29212921 p++;
2922− S->tok = TOK_LOR;
2922+ S->tccpp_tok = TOK_LOR;
29232923 } else if (c == '=') {
29242924 p++;
2925− S->tok = TOK_A_OR;
2925+ S->tccpp_tok = TOK_A_OR;
29262926 } else {
2927− S->tok = '|';
2927+ S->tccpp_tok = '|';
29282928 }
29292929 break;
29302930
@@ -2932,12 +2932,12 @@ maybe_newline: · 1 unmodified line
29322932 PEEKC(c, p);
29332933 if (c == '+') {
29342934 p++;
2935− S->tok = TOK_INC;
2935+ S->tccpp_tok = TOK_INC;
29362936 } else if (c == '=') {
29372937 p++;
2938− S->tok = TOK_A_ADD;
2938+ S->tccpp_tok = TOK_A_ADD;
29392939 } else {
2940− S->tok = '+';
2940+ S->tccpp_tok = '+';
29412941 }
29422942 break;
29432943
@@ -2945,15 +2945,15 @@ maybe_newline: · 1 unmodified line
29452945 PEEKC(c, p);
29462946 if (c == '-') {
29472947 p++;
2948− S->tok = TOK_DEC;
2948+ S->tccpp_tok = TOK_DEC;
29492949 } else if (c == '=') {
29502950 p++;
2951− S->tok = TOK_A_SUB;
2951+ S->tccpp_tok = TOK_A_SUB;
29522952 } else if (c == '>') {
29532953 p++;
2954− S->tok = TOK_ARROW;
2954+ S->tccpp_tok = TOK_ARROW;
29552955 } else {
2956− S->tok = '-';
2956+ S->tccpp_tok = '-';
29572957 }
29582958 break;
29592959
@@ -2969,17 +2969,17 @@ maybe_newline: · 9 unmodified lines
29692969 if (c == '*') {
29702970 p = parse_comment(S, p);
29712971 /* comments replaced by a blank */
2972− S->tok = ' ';
2972+ S->tccpp_tok = ' ';
29732973 goto maybe_space;
29742974 } else if (c == '/') {
29752975 p = parse_line_comment(S, p);
2976− S->tok = ' ';
2976+ S->tccpp_tok = ' ';
29772977 goto maybe_space;
29782978 } else if (c == '=') {
29792979 p++;
2980− S->tok = TOK_A_DIV;
2980+ S->tccpp_tok = TOK_A_DIV;
29812981 } else {
2982− S->tok = '/';
2982+ S->tccpp_tok = '/';
29832983 }
29842984 break;
29852985
@@ -2997,7 +2997,7 @@ maybe_newline: · 11 unmodified lines
29972997 case '~':
29982998 case '@': /* only used in assembler */
29992999 parse_simple:
3000− S->tok = c;
3000+ S->tccpp_tok = c;
30013001 p++;
30023002 break;
30033003 default:
@@ -3008,15 +3008,15 @@ maybe_newline: · 4 unmodified lines
30083008 tcc_error(S,"unrecognized character \\x%02x", c);
30093009 break;
30103010 }
3011− S->tok_flags = 0;
3011+ S->tccpp_tok_flags = 0;
30123012 keep_tok_flags:
30133013 S->tccpp_file->buf_ptr = p;
30143014 #if defined(PARSE_DEBUG)
3015− printf("token = %d %s\n", S->tok, get_tok_str(S, S->tok, &S->tokc));
3015+ printf("token = %d %s\n", S->tccpp_tok, get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc));
30163016 #endif
30173017 }
30183018
3019−static void macro_subst(TCCState *S,
3019+static void macro_subst(TCCState* S,
30203020 TokenString *tok_str,
30213021 Sym **nested_list,
30223022 const int *macro_str
@@ -3024,7 +3024,7 @@ static void macro_subst(TCCState *S, · 1 unmodified line
30243024
30253025 /* substitute arguments in replacement lists in macro_str by the values in
30263026 args (field d) and return allocated string */
3027−static int *macro_arg_subst(TCCState *S, Sym **nested_list, const int *macro_str, Sym *args)
3027+static int *macro_arg_subst(TCCState* S, Sym **nested_list, const int *macro_str, Sym *args)
30283028 {
30293029 int t, t0, t1, spc;
30303030 const int *st;
@@ -3142,7 +3142,7 @@ static char const ab_month_name[12][4] = · 111 unmodified lines
31423142 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
31433143 };
31443144
3145−static int paste_tokens(TCCState *S, int t1, CValue *v1, int t2, CValue *v2)
3145+static int paste_tokens(TCCState* S, int t1, CValue *v1, int t2, CValue *v2)
31463146 {
31473147 CString cstr;
31483148 int n, ret = 1;
@@ -3157,12 +3157,12 @@ static int paste_tokens(TCCState *S, int t1, CValue *v1, int t2, CValue *v2) · 8 unmodified lines
31573157
31583158 tcc_open_bf(S, ":paste:", cstr.size);
31593159 memcpy(S->tccpp_file->buffer, cstr.data, cstr.size);
3160− S->tok_flags = 0;
3160+ S->tccpp_tok_flags = 0;
31613161 for (;;) {
31623162 next_nomacro1(S);
31633163 if (0 == *S->tccpp_file->buf_ptr)
31643164 break;
3165− if (is_space(S->tok))
3165+ if (is_space(S->tccpp_tok))
31663166 continue;
31673167 tcc_warning(S, "pasting \"%.*s\" and \"%s\" does not give a valid"
31683168 " preprocessing token", n, (char *)cstr.data, (char*)cstr.data + n);
@@ -3177,7 +3177,7 @@ static int paste_tokens(TCCState *S, int t1, CValue *v1, int t2, CValue *v2) · 8 unmodified lines
31773177
31783178 /* handle the '##' operator. Return NULL if no '##' seen. Otherwise
31793179 return the resulting string (which must be freed). */
3180−static inline int *macro_twosharps(TCCState *S, const int *ptr0)
3180+static inline int *macro_twosharps(TCCState* S, const int *ptr0)
31813181 {
31823182 int t;
31833183 CValue cval;
@@ -3215,7 +3215,7 @@ static inline int *macro_twosharps(TCCState *S, const int *ptr0) · 31 unmodified lines
32153215 TOK_GET(&t1, &ptr, &cv1);
32163216 if (t != TOK_PLCHLDR || t1 != TOK_PLCHLDR) {
32173217 if (paste_tokens(S, t, &cval, t1, &cv1)) {
3218− t = S->tok, cval = S->tokc;
3218+ t = S->tccpp_tok, cval = S->tccpp_tokc;
32193219 } else {
32203220 tok_str_add2(S, &macro_str1, t, &cval);
32213221 t = t1, cval = cv1;
@@ -3238,7 +3238,7 @@ static inline int *macro_twosharps(TCCState *S, const int *ptr0) · 16 unmodified lines
32383238
32393239 /* peek or read [ws_str == NULL] next token from function macro call,
32403240 walking up macro levels up to the file if necessary */
3241−static int next_argstream(TCCState *S, Sym **nested_list, TokenString *ws_str)
3241+static int next_argstream(TCCState* S, Sym **nested_list, TokenString *ws_str)
32423242 {
32433243 int t;
32443244 const int *p;
@@ -3292,7 +3292,7 @@ static int next_argstream(TCCState *S, Sym **nested_list, TokenString *ws_str) · 47 unmodified lines
32923292 if (ws_str)
32933293 return t;
32943294 next_nomacro(S);
3295− return S->tok;
3295+ return S->tccpp_tok;
32963296 }
32973297 }
32983298
@@ -3300,7 +3300,7 @@ static int next_argstream(TCCState *S, Sym **nested_list, TokenString *ws_str) · 1 unmodified line
33003300 result to (tok_str,tok_len). 'nested_list' is the list of all
33013301 macros we got inside to avoid recursing. Return non zero if no
33023302 substitution needs to be done */
3303−static int macro_subst_tok(TCCState *S,
3303+static int macro_subst_tok(TCCState* S,
33043304 TokenString *tok_str,
33053305 Sym **nested_list,
33063306 Sym *s)
@@ -3315,22 +3315,22 @@ static int macro_subst_tok(TCCState *S, · 8 unmodified lines
33153315
33163316 /* if symbol is a macro, prepare substitution */
33173317 /* special macros */
3318− if (S->tok == TOK___LINE__ || S->tok == TOK___COUNTER__) {
3319− t = S->tok == TOK___LINE__ ? S->tccpp_file->line_num : S->tccpp_pp_counter++;
3318+ if (S->tccpp_tok == TOK___LINE__ || S->tccpp_tok == TOK___COUNTER__) {
3319+ t = S->tccpp_tok == TOK___LINE__ ? S->tccpp_file->line_num : S->tccpp_pp_counter++;
33203320 snprintf(buf, sizeof(buf), "%d", t);
33213321 cstrval = buf;
33223322 t1 = TOK_PPNUM;
33233323 goto add_cstr1;
3324− } else if (S->tok == TOK___FILE__) {
3324+ } else if (S->tccpp_tok == TOK___FILE__) {
33253325 cstrval = S->tccpp_file->filename;
33263326 goto add_cstr;
3327− } else if (S->tok == TOK___DATE__ || S->tok == TOK___TIME__) {
3327+ } else if (S->tccpp_tok == TOK___DATE__ || S->tccpp_tok == TOK___TIME__) {
33283328 time_t ti;
33293329 struct tm *tm;
33303330
33313331 time(&ti);
33323332 tm = localtime(&ti);
3333− if (S->tok == TOK___DATE__) {
3333+ if (S->tccpp_tok == TOK___DATE__) {
33343334 snprintf(buf, sizeof(buf), "%s %2d %d",
33353335 ab_month_name[tm->tm_mon], tm->tm_mday, tm->tm_year + 1900);
33363336 } else {
@@ -3369,7 +3369,7 @@ static int macro_subst_tok(TCCState *S, · 32 unmodified lines
33693369 * whitespace is intentionally not merged to preserve
33703370 * newlines. */
33713371 S->tccpp_parse_flags = saved_parse_flags;
3372− tok_str_add(S, tok_str, S->tok);
3372+ tok_str_add(S, tok_str, S->tccpp_tok);
33733373 if (S->tccpp_parse_flags & PARSE_FLAG_SPACES) {
33743374 int i;
33753375 for (i = 0; i < ws_str.len; i++)
@@ -3382,7 +3382,7 @@ static int macro_subst_tok(TCCState *S, · 6 unmodified lines
33823382 }
33833383 do {
33843384 next_nomacro(S); /* eat '(' */
3385− } while (S->tok == TOK_PLCHLDR || is_space(S->tok));
3385+ } while (S->tccpp_tok == TOK_PLCHLDR || is_space(S->tccpp_tok));
33863386
33873387 /* argument macro */
33883388 args = NULL;
@@ -3391,11 +3391,11 @@ static int macro_subst_tok(TCCState *S, · 2 unmodified lines
33913391 for(;;) {
33923392 do {
33933393 next_argstream(S, nested_list, NULL);
3394− } while (S->tok == TOK_PLCHLDR || is_space(S->tok) ||
3395− TOK_LINEFEED == S->tok);
3394+ } while (S->tccpp_tok == TOK_PLCHLDR || is_space(S->tccpp_tok) ||
3395+ TOK_LINEFEED == S->tccpp_tok);
33963396 empty_arg:
33973397 /* handle '()' case */
3398− if (!args && !sa && S->tok == ')')
3398+ if (!args && !sa && S->tccpp_tok == ')')
33993399 break;
34003400 if (!sa)
34013401 tcc_error(S,"macro '%s' used with too many args",
@@ -3404,18 +3404,18 @@ static int macro_subst_tok(TCCState *S, · 2 unmodified lines
34043404 parlevel = spc = 0;
34053405 /* NOTE: non zero sa->t indicates VA_ARGS */
34063406 while ((parlevel > 0 ||
3407− (S->tok != ')' &&
3408− (S->tok != ',' || sa->type.t)))) {
3409− if (S->tok == TOK_EOF || S->tok == 0)
3407+ (S->tccpp_tok != ')' &&
3408+ (S->tccpp_tok != ',' || sa->type.t)))) {
3409+ if (S->tccpp_tok == TOK_EOF || S->tccpp_tok == 0)
34103410 break;
3411− if (S->tok == '(')
3411+ if (S->tccpp_tok == '(')
34123412 parlevel++;
3413− else if (S->tok == ')')
3413+ else if (S->tccpp_tok == ')')
34143414 parlevel--;
3415− if (S->tok == TOK_LINEFEED)
3416− S->tok = ' ';
3417− if (!check_space(S, S->tok, &spc))
3418− tok_str_add2(S, &str, S->tok, &S->tokc);
3415+ if (S->tccpp_tok == TOK_LINEFEED)
3416+ S->tccpp_tok = ' ';
3417+ if (!check_space(S, S->tccpp_tok, &spc))
3418+ tok_str_add2(S, &str, S->tccpp_tok, &S->tccpp_tokc);
34193419 next_argstream(S, nested_list, NULL);
34203420 }
34213421 if (parlevel)
@@ -3426,14 +3426,14 @@ static int macro_subst_tok(TCCState *S, · 4 unmodified lines
34263426 sa1 = sym_push2(S, &args, sa->v & ~SYM_FIELD, sa->type.t, 0);
34273427 sa1->d = str.str;
34283428 sa = sa->next;
3429− if (S->tok == ')') {
3429+ if (S->tccpp_tok == ')') {
34303430 /* special case for gcc var args: add an empty
34313431 var arg argument if it is omitted */
34323432 if (sa && sa->type.t && gnu_ext)
34333433 goto empty_arg;
34343434 break;
34353435 }
3436− if (S->tok != ',')
3436+ if (S->tccpp_tok != ',')
34373437 expect(S, ",");
34383438 }
34393439 if (sa) {
@@ -3478,7 +3478,7 @@ static int macro_subst_tok(TCCState *S, · 38 unmodified lines
34783478 /* do macro substitution of macro_str and add result to
34793479 (tok_str,tok_len). 'nested_list' is the list of all macros we got
34803480 inside to avoid recursing. */
3481−static void macro_subst(TCCState *S,
3481+static void macro_subst(TCCState* S,
34823482 TokenString *tok_str,
34833483 Sym **nested_list,
34843484 const int *macro_str
@@ -3512,7 +3512,7 @@ static void macro_subst(TCCState *S, · 27 unmodified lines
35123512 str->str = (int*)macro_str;
35133513 begin_macro(S, str, 2);
35143514
3515− S->tok = t;
3515+ S->tccpp_tok = t;
35163516 macro_subst_tok(S, tok_str, nested_list, s);
35173517
35183518 if (S->tccpp_macro_stack != str) {
@@ -3546,16 +3546,16 @@ no_subst: · 27 unmodified lines
35463546
35473547 /* return next token without macro substitution. Can read input from
35483548 macro_ptr buffer */
3549−static void next_nomacro(TCCState *S)
3549+static void next_nomacro(TCCState* S)
35503550 {
35513551 int t;
35523552 if (S->tccpp_macro_ptr) {
35533553 redo:
35543554 t = *S->tccpp_macro_ptr;
35553555 if (TOK_HAS_VALUE(t)) {
3556− tok_get(&S->tok, &S->tccpp_macro_ptr, &S->tokc);
3556+ tok_get(&S->tccpp_tok, &S->tccpp_macro_ptr, &S->tccpp_tokc);
35573557 if (t == TOK_LINENUM) {
3558− S->tccpp_file->line_num = S->tokc.i;
3558+ S->tccpp_file->line_num = S->tccpp_tokc.i;
35593559 goto redo;
35603560 }
35613561 } else {
@@ -3565,7 +3565,7 @@ static void next_nomacro(TCCState *S) · 3 unmodified lines
35653565 && (S->tccpp_isidnum_table[t - CH_EOF] & IS_SPC))
35663566 goto redo;
35673567 }
3568− S->tok = t;
3568+ S->tccpp_tok = t;
35693569 }
35703570 } else {
35713571 next_nomacro1(S);
@@ -3573,12 +3573,12 @@ static void next_nomacro(TCCState *S) · 1 unmodified line
35733573 }
35743574
35753575 /* return next token with macro substitution */
3576−ST_FUNC void next(TCCState *S)
3576+ST_FUNC void next(TCCState* S)
35773577 {
35783578 int t;
35793579 redo:
35803580 next_nomacro(S);
3581− t = S->tok;
3581+ t = S->tccpp_tok;
35823582 if (S->tccpp_macro_ptr) {
35833583 if (!TOK_HAS_VALUE(t)) {
35843584 if (t == TOK_NOSUBST || t == TOK_PLCHLDR) {
@@ -3599,10 +3599,10 @@ ST_FUNC void next(TCCState *S) · 14 unmodified lines
35993599 Sym *s = define_find(S, t);
36003600 if (s) {
36013601 Sym *nested_list = NULL;
3602− S->tokstr_buf.len = 0;
3603− macro_subst_tok(S, &S->tokstr_buf, &nested_list, s);
3604− tok_str_add(S, &S->tokstr_buf, 0);
3605− begin_macro(S, &S->tokstr_buf, 0);
3602+ S->tccpp_tokstr_buf.len = 0;
3603+ macro_subst_tok(S, &S->tccpp_tokstr_buf, &nested_list, s);
3604+ tok_str_add(S, &S->tccpp_tokstr_buf, 0);
3605+ begin_macro(S, &S->tccpp_tokstr_buf, 0);
36063606 goto redo;
36073607 }
36083608 return;
@@ -3610,23 +3610,23 @@ ST_FUNC void next(TCCState *S) · 1 unmodified line
36103610 /* convert preprocessor tokens into C tokens */
36113611 if (t == TOK_PPNUM) {
36123612 if (S->tccpp_parse_flags & PARSE_FLAG_TOK_NUM)
3613− parse_number(S, (char *)S->tokc.str.data);
3613+ parse_number(S, (char *)S->tccpp_tokc.str.data);
36143614 } else if (t == TOK_PPSTR) {
36153615 if (S->tccpp_parse_flags & PARSE_FLAG_TOK_STR)
3616− parse_string(S, (char *)S->tokc.str.data, S->tokc.str.size - 1);
3616+ parse_string(S, (char *)S->tccpp_tokc.str.data, S->tccpp_tokc.str.size - 1);
36173617 }
36183618 }
36193619
36203620 /* push back current token and set current token to 'last_tok'. Only
36213621 identifier case handled for labels. */
3622−ST_INLN void unget_tok(TCCState *S, int last_tok)
3622+ST_INLN void unget_tok(TCCState* S, int last_tok)
36233623 {
36243624
36253625 TokenString *str = tok_str_alloc(S);
3626− tok_str_add2(S, str, S->tok, &S->tokc);
3626+ tok_str_add2(S, str, S->tccpp_tok, &S->tccpp_tokc);
36273627 tok_str_add(S, str, 0);
36283628 begin_macro(S, str, 1);
3629− S->tok = last_tok;
3629+ S->tccpp_tok = last_tok;
36303630 }
36313631
36323632 /* ------------------------------------------------------------------------- */
@@ -3658,7 +3658,7 @@ static const char * const target_os_defs = · 25 unmodified lines
36583658 #endif
36593659 ;
36603660
3661−static void putdef(TCCState *S, CString *cs, const char *p)
3661+static void putdef(TCCState* S, CString *cs, const char *p)
36623662 {
36633663 cstr_printf(S, cs, "#define %s%s\n", p, &" 1"[!!strchr(p, ' ')*2]);
36643664 }
@@ -3748,7 +3748,7 @@ ST_FUNC void preprocess_start(TCCState *S, int filetype) · 83 unmodified lines
37483748 }
37493749
37503750 S->tccpp_parse_flags = is_asm ? PARSE_FLAG_ASM_FILE : 0;
3751− S->tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
3751+ S->tccpp_tok_flags = TOK_FLAG_BOL | TOK_FLAG_BOF;
37523752 }
37533753
37543754 /* cleanup from error/setjmp */
@@ -3779,18 +3779,18 @@ ST_FUNC void tccpp_new(TCCState *S) · 24 unmodified lines
37793779 set_idnum(S, i, IS_ID);
37803780
37813781 /* init allocators */
3782− tal_new(S, &S->toksym_alloc, TOKSYM_TAL_LIMIT, TOKSYM_TAL_SIZE);
3783− tal_new(S, &S->tokstr_alloc, TOKSTR_TAL_LIMIT, TOKSTR_TAL_SIZE);
3782+ tal_new(S, &S->tccpp_toksym_alloc, TOKSYM_TAL_LIMIT, TOKSYM_TAL_SIZE);
3783+ tal_new(S, &S->tccpp_tokstr_alloc, TOKSTR_TAL_LIMIT, TOKSTR_TAL_SIZE);
37843784
37853785 memset(S->tccpp_hash_ident, 0, TOK_HASH_SIZE * sizeof(TokenSym *));
37863786 memset(S->cached_includes_hash, 0, sizeof S->cached_includes_hash);
37873787
37883788 cstr_new(S, &S->tccpp_cstr_buf);
37893789 cstr_realloc(S, &S->tccpp_cstr_buf, STRING_MAX_SIZE);
3790− tok_str_new(&S->tokstr_buf);
3791− tok_str_realloc(S, &S->tokstr_buf, TOKSTR_MAX_SIZE);
3790+ tok_str_new(&S->tccpp_tokstr_buf);
3791+ tok_str_realloc(S, &S->tccpp_tokstr_buf, TOKSTR_MAX_SIZE);
37923792
3793− S->tok_ident = TOK_IDENT;
3793+ S->tccpp_tok_ident = TOK_IDENT;
37943794 p = tcc_keywords;
37953795 while (*p) {
37963796 r = p;
@@ -3819,31 +3819,31 @@ ST_FUNC void tccpp_delete(TCCState *S) · 22 unmodified lines
38193819 dynarray_reset(S, &S->cached_includes, &S->nb_cached_includes);
38203820
38213821 /* free tokens */
3822− n = S->tok_ident - TOK_IDENT;
3822+ n = S->tccpp_tok_ident - TOK_IDENT;
38233823 if (n > total_idents)
38243824 total_idents = n;
38253825 for(i = 0; i < n; i++)
3826− tal_free(S, S->toksym_alloc, S->tccpp_table_ident[i]);
3826+ tal_free(S, S->tccpp_toksym_alloc, S->tccpp_table_ident[i]);
38273827 tcc_free(S, S->tccpp_table_ident);
38283828 S->tccpp_table_ident = NULL;
38293829
38303830 /* free static buffers */
3831− cstr_free(S, &S->tokcstr);
3831+ cstr_free(S, &S->tccpp_tokcstr);
38323832 cstr_free(S, &S->tccpp_cstr_buf);
38333833 cstr_free(S, &S->tccpp_macro_equal_buf);
3834− tok_str_free_str(S, S->tokstr_buf.str);
3834+ tok_str_free_str(S, S->tccpp_tokstr_buf.str);
38353835
38363836 /* free allocators */
3837− tal_delete(S, S->toksym_alloc);
3838− S->toksym_alloc = NULL;
3839− tal_delete(S, S->tokstr_alloc);
3840− S->tokstr_alloc = NULL;
3837+ tal_delete(S, S->tccpp_toksym_alloc);
3838+ S->tccpp_toksym_alloc = NULL;
3839+ tal_delete(S, S->tccpp_tokstr_alloc);
3840+ S->tccpp_tokstr_alloc = NULL;
38413841 }
38423842
38433843 /* ------------------------------------------------------------------------- */
38443844 /* tcc -E [-P[1]] [-dD} support */
38453845
3846−static void tok_print(TCCState *S, const char *msg, const int *str)
3846+static void tok_print(TCCState* S, const char *msg, const int *str)
38473847 {
38483848 FILE *fp;
38493849 int t, s = 0;
@@ -3939,7 +3939,7 @@ static void pp_debug_defines(TCCState *S) · 89 unmodified lines
39393939 static void pp_debug_builtins(TCCState *S)
39403940 {
39413941 int v;
3942− for (v = TOK_IDENT; v < S->tok_ident; ++v)
3942+ for (v = TOK_IDENT; v < S->tccpp_tok_ident; ++v)
39433943 define_print(S, v);
39443944 }
39453945
@@ -3984,7 +3984,7 @@ ST_FUNC int tcc_preprocess(TCCState *S) · 38 unmodified lines
39843984
39853985 if (S->do_bench) {
39863986 /* for PP benchmarks */
3987− do next(S); while (S->tok != TOK_EOF);
3987+ do next(S); while (S->tccpp_tok != TOK_EOF);
39883988 return 0;
39893989 }
39903990
@@ -4000,7 +4000,7 @@ ST_FUNC int tcc_preprocess(TCCState *S) · 9 unmodified lines
40004000 for (;;) {
40014001 iptr = S->include_stack_ptr;
40024002 next(S);
4003− if (S->tok == TOK_EOF)
4003+ if (S->tccpp_tok == TOK_EOF)
40044004 break;
40054005
40064006 level = S->include_stack_ptr - iptr;
@@ -4015,24 +4015,24 @@ ST_FUNC int tcc_preprocess(TCCState *S) · 8 unmodified lines
40154015 continue;
40164016 }
40174017
4018− if (is_space(S->tok)) {
4018+ if (is_space(S->tccpp_tok)) {
40194019 if (spcs < sizeof white - 1)
4020− white[spcs++] = S->tok;
4020+ white[spcs++] = S->tccpp_tok;
40214021 continue;
4022− } else if (S->tok == TOK_LINEFEED) {
4022+ } else if (S->tccpp_tok == TOK_LINEFEED) {
40234023 spcs = 0;
40244024 if (token_seen == TOK_LINEFEED)
40254025 continue;
40264026 ++S->tccpp_file->line_ref;
40274027 } else if (token_seen == TOK_LINEFEED) {
40284028 pp_line(S, S->tccpp_file, 0);
4029− } else if (spcs == 0 && pp_need_space(token_seen, S->tok)) {
4029+ } else if (spcs == 0 && pp_need_space(token_seen, S->tccpp_tok)) {
40304030 white[spcs++] = ' ';
40314031 }
40324032
40334033 white[spcs] = 0, fputs(white, S->ppfp), spcs = 0;
4034− fputs(p = get_tok_str(S, S->tok, &S->tokc), S->ppfp);
4035− token_seen = pp_check_he0xE(S->tok, p);
4034+ fputs(p = get_tok_str(S, S->tccpp_tok, &S->tccpp_tokc), S->ppfp);
4035+ token_seen = pp_check_he0xE(S->tccpp_tok, p);
40364036 }
40374037 return 0;
40384038 }
x86_64-gen.c+200−200
@@ -149,19 +149,19 @@ ST_DATA const int reg_classes[NB_REGS] = { · 148 unmodified lines
149149 };
150150
151151 /* XXX: make it faster ? */
152−ST_FUNC void g(TCCState *S, int c)
152+ST_FUNC void g(TCCState* S, int c)
153153 {
154154 int ind1;
155− if (S->nocode_wanted)
155+ if (S->tccgen_nocode_wanted)
156156 return;
157− ind1 = S->ind + 1;
157+ ind1 = S->tccgen_ind + 1;
158158 if (ind1 > cur_text_section->data_allocated)
159159 section_realloc(S, cur_text_section, ind1);
160− cur_text_section->data[S->ind] = c;
161− S->ind = ind1;
160+ cur_text_section->data[S->tccgen_ind] = c;
161+ S->tccgen_ind = ind1;
162162 }
163163
164−ST_FUNC void o(TCCState *S, unsigned int c)
164+ST_FUNC void o(TCCState* S, unsigned int c)
165165 {
166166 while (c) {
167167 g(S, c);
@@ -169,13 +169,13 @@ ST_FUNC void o(TCCState *S, unsigned int c) · 1 unmodified line
169169 }
170170 }
171171
172−ST_FUNC void gen_le16(TCCState *S, int v)
172+ST_FUNC void gen_le16(TCCState* S, int v)
173173 {
174174 g(S, v);
175175 g(S, v >> 8);
176176 }
177177
178−ST_FUNC void gen_le32(TCCState *S, int c)
178+ST_FUNC void gen_le32(TCCState* S, int c)
179179 {
180180 g(S, c);
181181 g(S, c >> 8);
@@ -183,7 +183,7 @@ ST_FUNC void gen_le32(TCCState *S, int c) · 1 unmodified line
183183 g(S, c >> 24);
184184 }
185185
186−ST_FUNC void gen_le64(TCCState *S, int64_t c)
186+ST_FUNC void gen_le64(TCCState* S, int64_t c)
187187 {
188188 g(S, c);
189189 g(S, c >> 8);
@@ -195,7 +195,7 @@ ST_FUNC void gen_le64(TCCState *S, int64_t c) · 5 unmodified lines
195195 g(S, c >> 56);
196196 }
197197
198−static void orex(TCCState *S, int ll, int r, int r2, int b)
198+static void orex(TCCState* S, int ll, int r, int r2, int b)
199199 {
200200 if ((r & VT_VALMASK) >= VT_CONST)
201201 r = 0;
@@ -207,7 +207,7 @@ static void orex(TCCState *S, int ll, int r, int r2, int b) · 5 unmodified lines
207207 }
208208
209209 /* output a symbol and patch all calls to it */
210−ST_FUNC void gsym_addr(TCCState *S, int t, int a)
210+ST_FUNC void gsym_addr(TCCState* S, int t, int a)
211211 {
212212 while (t) {
213213 unsigned char *ptr = cur_text_section->data + t;
@@ -228,10 +228,10 @@ static int is64_type(int t) · 14 unmodified lines
228228 static int oad(TCCState *S, int c, int s)
229229 {
230230 int t;
231− if (S->nocode_wanted)
231+ if (S->tccgen_nocode_wanted)
232232 return s;
233233 o(S, c);
234− t = S->ind;
234+ t = S->tccgen_ind;
235235 gen_le32(S, s);
236236 return t;
237237 }
@@ -242,7 +242,7 @@ static int oad(TCCState *S, int c, int s) · 4 unmodified lines
242242 ST_FUNC void gen_addr32(TCCState *S, int r, Sym *sym, int c)
243243 {
244244 if (r & VT_SYM)
245− greloca(S, cur_text_section, sym, S->ind, R_X86_64_32S, c), c=0;
245+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_X86_64_32S, c), c=0;
246246 gen_le32(S, c);
247247 }
248248
@@ -250,7 +250,7 @@ ST_FUNC void gen_addr32(TCCState *S, int r, Sym *sym, int c) · 1 unmodified line
250250 ST_FUNC void gen_addr64(TCCState *S, int r, Sym *sym, int64_t c)
251251 {
252252 if (r & VT_SYM)
253− greloca(S, cur_text_section, sym, S->ind, R_X86_64_64, c), c=0;
253+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_X86_64_64, c), c=0;
254254 gen_le64(S, c);
255255 }
256256
@@ -258,7 +258,7 @@ ST_FUNC void gen_addr64(TCCState *S, int r, Sym *sym, int64_t c) · 1 unmodified line
258258 ST_FUNC void gen_addrpc32(TCCState *S, int r, Sym *sym, int c)
259259 {
260260 if (r & VT_SYM)
261− greloca(S, cur_text_section, sym, S->ind, R_X86_64_PC32, c-4), c=4;
261+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_X86_64_PC32, c-4), c=4;
262262 gen_le32(S, c-4);
263263 }
264264
@@ -268,12 +268,12 @@ static void gen_gotpcrel(TCCState *S, int r, Sym *sym, int c) · 3 unmodified lines
268268 #ifdef TCC_TARGET_PE
269269 tcc_error(S, "internal error: no GOT on PE: %s %x %x | %02x %02x %02x\n",
270270 get_tok_str(S, sym->v, NULL), c, r,
271− cur_text_section->data[S->ind-3],
272− cur_text_section->data[S->ind-2],
273− cur_text_section->data[S->ind-1]
271+ cur_text_section->data[S->tccgen_ind-3],
272+ cur_text_section->data[S->tccgen_ind-2],
273+ cur_text_section->data[S->tccgen_ind-1]
274274 );
275275 #endif
276− greloca(S, cur_text_section, sym, S->ind, R_X86_64_GOTPCREL, -4);
276+ greloca(S, cur_text_section, sym, S->tccgen_ind, R_X86_64_GOTPCREL, -4);
277277 gen_le32(S, 0);
278278 if (c) {
279279 /* we use add c, %xxx for displacement */
@@ -482,7 +482,7 @@ void load(TCCState *S, int r, SValue *sv) · 202 unmodified lines
482482 } else if (v == VT_CMP) {
483483 if (fc & 0x100)
484484 {
485− v = S->vtop->cmp_r;
485+ v = S->tccgen_vtop->cmp_r;
486486 fc &= ~0x100;
487487 /* This was a float compare. If the parity bit is
488488 set the result was unordered, meaning false for everything
@@ -624,19 +624,19 @@ void store(TCCState *S, int r, SValue *v) · 135 unmodified lines
624624 static void gcall_or_jmp(TCCState *S, int is_jmp)
625625 {
626626 int r;
627− if ((S->vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
628− ((S->vtop->r & VT_SYM) && (S->vtop->c.i-4) == (int)(S->vtop->c.i-4))) {
627+ if ((S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST &&
628+ ((S->tccgen_vtop->r & VT_SYM) && (S->tccgen_vtop->c.i-4) == (int)(S->tccgen_vtop->c.i-4))) {
629629 /* constant symbolic case -> simple relocation */
630630 #ifdef TCC_TARGET_PE
631− greloca(S, cur_text_section, S->vtop->sym, S->ind + 1, R_X86_64_PC32, (int)(S->vtop->c.i-4));
631+ greloca(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind + 1, R_X86_64_PC32, (int)(S->tccgen_vtop->c.i-4));
632632 #else
633− greloca(S, cur_text_section, S->vtop->sym, S->ind + 1, R_X86_64_PLT32, (int)(S->vtop->c.i-4));
633+ greloca(S, cur_text_section, S->tccgen_vtop->sym, S->tccgen_ind + 1, R_X86_64_PLT32, (int)(S->tccgen_vtop->c.i-4));
634634 #endif
635635 oad(S, 0xe8 + is_jmp, 0); /* call/jmp im */
636636 } else {
637637 /* otherwise, indirect call */
638638 r = TREG_R11;
639− load(S, r, S->vtop);
639+ load(S, r, S->tccgen_vtop);
640640 o(S, 0x41); /* REX */
641641 o(S, 0xff); /* call/jmp *r */
642642 o(S, 0xd0 + REG_VALUE(r) + (is_jmp << 4));
@@ -650,9 +650,9 @@ static void gen_bounds_call(TCCState *S, int v) · 7 unmodified lines
650650 Sym *sym = external_helper_sym(S, v);
651651 oad(S, 0xe8, 0);
652652 #ifdef TCC_TARGET_PE
653− greloca(S, cur_text_section, sym, S->ind-4, R_X86_64_PC32, -4);
653+ greloca(S, cur_text_section, sym, S->tccgen_ind-4, R_X86_64_PC32, -4);
654654 #else
655− greloca(S, cur_text_section, sym, S->ind-4, R_X86_64_PLT32, -4);
655+ greloca(S, cur_text_section, sym, S->tccgen_ind-4, R_X86_64_PLT32, -4);
656656 #endif
657657 }
658658
@@ -666,7 +666,7 @@ static void gen_bounds_prolog(TCCState *S) · 7 unmodified lines
666666 {
667667 /* leave some room for bound checking code */
668668 S->func_bound_offset = lbounds_section->data_offset;
669− S->func_bound_ind = S->ind;
669+ S->func_bound_ind = S->tccgen_ind;
670670 S->func_bound_add_epilog = 0;
671671 o(S, 0x0d8d48 + ((TREG_FASTCALL_1 == TREG_RDI) * 0x300000)); /*lbound section pointer */
672672 gen_le32(S, 0);
@@ -687,22 +687,22 @@ static void gen_bounds_epilog(TCCState *S) · 14 unmodified lines
687687 bounds_ptr = section_ptr_add(S, lbounds_section, sizeof(addr_t));
688688 *bounds_ptr = 0;
689689
690− sym_data = get_sym_ref(S, &S->char_pointer_type, lbounds_section,
690+ sym_data = get_sym_ref(S, &S->tccgen_char_pointer_type, lbounds_section,
691691 S->func_bound_offset, lbounds_section->data_offset);
692692
693693 /* generate bound local allocation */
694694 if (offset_modified) {
695− saved_ind = S->ind;
696− S->ind = S->func_bound_ind;
697− greloca(S, cur_text_section, sym_data, S->ind + 3, R_X86_64_PC32, -4);
698− S->ind = S->ind + 7;
695+ saved_ind = S->tccgen_ind;
696+ S->tccgen_ind = S->func_bound_ind;
697+ greloca(S, cur_text_section, sym_data, S->tccgen_ind + 3, R_X86_64_PC32, -4);
698+ S->tccgen_ind = S->tccgen_ind + 7;
699699 gen_bounds_call(S, TOK___bound_local_new);
700− S->ind = saved_ind;
700+ S->tccgen_ind = saved_ind;
701701 }
702702
703703 /* generate bound check local freeing */
704704 o(S, 0x5250); /* save returned value, if any */
705− greloca(S, cur_text_section, sym_data, S->ind + 3, R_X86_64_PC32, -4);
705+ greloca(S, cur_text_section, sym_data, S->tccgen_ind + 3, R_X86_64_PC32, -4);
706706 o(S, 0x0d8d48 + ((TREG_FASTCALL_1 == TREG_RDI) * 0x300000)); /* lea xxx(%rip), %rcx/rdi */
707707 gen_le32(S, 0);
708708 gen_bounds_call(S, TOK___bound_local_delete);
@@ -731,7 +731,7 @@ static int arg_prepare_reg(int idx) { · 22 unmodified lines
731731 all the parameters in call order. This functions pops all the
732732 parameters and the function address. */
733733
734−static void gen_offs_sp(TCCState *S, int b, int r, int d)
734+static void gen_offs_sp(TCCState* S, int b, int r, int d)
735735 {
736736 orex(S, 1,0,r & 0x100 ? 0 : r, b);
737737 if (d == (char)d) {
@@ -783,7 +783,7 @@ static int gfunc_arg_size(CType *type) { · 45 unmodified lines
783783 return type_size(type, &align);
784784 }
785785
786−void gfunc_call(TCCState *S, int nb_args)
786+void gfunc_call(TCCState* S, int nb_args)
787787 {
788788 int size, r, args_size, i, d, bt, struct_size;
789789 int arg;
@@ -804,7 +804,7 @@ void gfunc_call(TCCState *S, int nb_args) · 14 unmodified lines
804804 SValue *sv;
805805
806806 --arg;
807− sv = &S->vtop[-i];
807+ sv = &S->tccgen_vtop[-i];
808808 bt = (sv->type.t & VT_BTYPE);
809809 size = gfunc_arg_size(&sv->type);
810810
@@ -823,7 +823,7 @@ void gfunc_call(TCCState *S, int nb_args) · 12 unmodified lines
823823 vset(S, &sv->type, r | VT_LVAL, 0);
824824 vpushv(S, sv);
825825 vstore(S);
826− --S->vtop;
826+ --S->tccgen_vtop;
827827 } else if (bt == VT_LDOUBLE) {
828828 gv(S, RC_ST0);
829829 gen_offs_sp(S, 0xdb, 0x107, struct_size);
@@ -839,9 +839,9 @@ void gfunc_call(TCCState *S, int nb_args) · 9 unmodified lines
839839
840840 for(i = 0; i < nb_args; i++) {
841841 --arg;
842− bt = (S->vtop->type.t & VT_BTYPE);
842+ bt = (S->tccgen_vtop->type.t & VT_BTYPE);
843843
844− size = gfunc_arg_size(&S->vtop->type);
844+ size = gfunc_arg_size(&S->tccgen_vtop->type);
845845 if (!using_regs(size)) {
846846 /* align to stack align size */
847847 size = (size + 15) & ~15;
@@ -855,7 +855,7 @@ void gfunc_call(TCCState *S, int nb_args) · 7 unmodified lines
855855 }
856856 struct_size += size;
857857 } else {
858− if (is_sse_float(S->vtop->type.t)) {
858+ if (is_sse_float(S->tccgen_vtop->type.t)) {
859859 if (S->nosse)
860860 tcc_error(S, "SSE disabled");
861861 if (arg >= REGN) {
@@ -873,8 +873,8 @@ void gfunc_call(TCCState *S, int nb_args) · 11 unmodified lines
873873 }
874874 } else {
875875 if (bt == VT_STRUCT) {
876− S->vtop->type.ref = NULL;
877− S->vtop->type.t = size > 4 ? VT_LLONG : size > 2 ? VT_INT
876+ S->tccgen_vtop->type.ref = NULL;
877+ S->tccgen_vtop->type.t = size > 4 ? VT_LLONG : size > 2 ? VT_INT
878878 : size > 1 ? VT_SHORT : VT_BYTE;
879879 }
880880
@@ -888,7 +888,7 @@ void gfunc_call(TCCState *S, int nb_args) · 7 unmodified lines
888888 }
889889 }
890890 }
891− S->vtop--;
891+ S->tccgen_vtop--;
892892 }
893893 save_regs(S, 0);
894894 /* Copy R10 and R11 into RCX and RDX, respectively */
@@ -901,7 +901,7 @@ void gfunc_call(TCCState *S, int nb_args) · 6 unmodified lines
901901
902902 gcall_or_jmp(S, 0);
903903
904− if ((S->vtop->r & VT_SYM) && S->vtop->sym->v == TOK_alloca) {
904+ if ((S->tccgen_vtop->r & VT_SYM) && S->tccgen_vtop->sym->v == TOK_alloca) {
905905 /* need to add the "func_scratch" area after alloca */
906906 o(S, 0x48); S->x86_64_gen_func_alloca = oad(S, 0x05, S->x86_64_gen_func_alloca); /* add $NN, %rax */
907907 #ifdef CONFIG_TCC_BCHECK
@@ -909,14 +909,14 @@ void gfunc_call(TCCState *S, int nb_args) · 1 unmodified line
909909 gen_bounds_call(S, TOK___bound_alloca_nr); /* new region */
910910 #endif
911911 }
912− S->vtop--;
912+ S->tccgen_vtop--;
913913 }
914914
915915
916916 #define FUNC_PROLOG_SIZE 11
917917
918918 /* generate function prolog of type 't' */
919−void gfunc_prolog(TCCState *S, Sym *func_sym)
919+void gfunc_prolog(TCCState* S, Sym *func_sym)
920920 {
921921 CType *func_type = &func_sym->type;
922922 int addr, reg_param_index, bt, size;
@@ -926,11 +926,11 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 3 unmodified lines
926926 S->x86_64_gen_func_ret_sub = 0;
927927 S->x86_64_gen_func_scratch = 32;
928928 S->x86_64_gen_func_alloca = 0;
929− S->loc = 0;
929+ S->tccgen_loc = 0;
930930
931931 addr = PTR_SIZE * 2;
932− S->ind += FUNC_PROLOG_SIZE;
933− S->x86_64_gen_func_sub_sp_offset = S->ind;
932+ S->tccgen_ind += FUNC_PROLOG_SIZE;
933+ S->x86_64_gen_func_sub_sp_offset = S->tccgen_ind;
934934 reg_param_index = 0;
935935
936936 sym = func_type->ref;
@@ -989,13 +989,13 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 52 unmodified lines
989989 }
990990
991991 /* generate function epilog */
992−void gfunc_epilog(TCCState *S)
992+void gfunc_epilog(TCCState* S)
993993 {
994994 int v, saved_ind;
995995
996996 /* align local size to word & save local variables */
997997 S->x86_64_gen_func_scratch = (S->x86_64_gen_func_scratch + 15) & -16;
998− S->loc = (S->loc & -16) - S->x86_64_gen_func_scratch;
998+ S->tccgen_loc = (S->tccgen_loc & -16) - S->x86_64_gen_func_scratch;
999999
10001000 #ifdef CONFIG_TCC_BCHECK
10011001 if (S->do_bounds_check)
@@ -1011,15 +1011,15 @@ void gfunc_epilog(TCCState *S) · 9 unmodified lines
10111011 g(S, S->x86_64_gen_func_ret_sub >> 8);
10121012 }
10131013
1014− saved_ind = S->ind;
1015− S->ind = S->x86_64_gen_func_sub_sp_offset - FUNC_PROLOG_SIZE;
1016− v = -S->loc;
1014+ saved_ind = S->tccgen_ind;
1015+ S->tccgen_ind = S->x86_64_gen_func_sub_sp_offset - FUNC_PROLOG_SIZE;
1016+ v = -S->tccgen_loc;
10171017
10181018 if (v >= 4096) {
10191019 Sym *sym = external_helper_sym(S, TOK___chkstk);
10201020 oad(S, 0xb8, v); /* mov stacksize, %eax */
10211021 oad(S, 0xe8, 0); /* call __chkstk, (does the stackframe too) */
1022− greloca(S, cur_text_section, sym, S->ind-4, R_X86_64_PC32, -4);
1022+ greloca(S, cur_text_section, sym, S->tccgen_ind-4, R_X86_64_PC32, -4);
10231023 o(S, 0x90); /* fill for FUNC_PROLOG_SIZE = 11 bytes */
10241024 } else {
10251025 o(S, 0xe5894855); /* push %rbp, mov %rsp, %rbp */
@@ -1031,13 +1031,13 @@ void gfunc_epilog(TCCState *S) · 5 unmodified lines
10311031 gsym_addr(S, S->x86_64_gen_func_alloca, -S->x86_64_gen_func_scratch);
10321032
10331033 cur_text_section->data_offset = saved_ind;
1034− pe_add_unwind_data(S, S->ind, saved_ind, v);
1035− S->ind = cur_text_section->data_offset;
1034+ pe_add_unwind_data(S, S->tccgen_ind, saved_ind, v);
1035+ S->tccgen_ind = cur_text_section->data_offset;
10361036 }
10371037
10381038 #else
10391039
1040−static void gadd_sp(TCCState *S, int val)
1040+static void gadd_sp(TCCState* S, int val)
10411041 {
10421042 if (val == (char)val) {
10431043 o(S, 0xc48348);
@@ -1216,7 +1216,7 @@ static int arg_prepare_reg(int idx) { · 172 unmodified lines
12161216 /* Generate function call. The function address is pushed first, then
12171217 all the parameters in call order. This functions pops all the
12181218 parameters and the function address. */
1219−void gfunc_call(TCCState *S, int nb_args)
1219+void gfunc_call(TCCState* S, int nb_args)
12201220 {
12211221 X86_64_Mode mode;
12221222 CType type;
@@ -1237,7 +1237,7 @@ void gfunc_call(TCCState *S, int nb_args) · 14 unmodified lines
12371237 to be done in a left-to-right pass over arguments. */
12381238 stack_adjust = 0;
12391239 for(i = nb_args - 1; i >= 0; i--) {
1240− mode = classify_x86_64_arg(&S->vtop[-i].type, NULL, &size, &align, &reg_count);
1240+ mode = classify_x86_64_arg(&S->tccgen_vtop[-i].type, NULL, &size, &align, &reg_count);
12411241 if (size == 0) continue;
12421242 if (mode == x86_64_mode_sse && nb_sse_args + reg_count <= 8) {
12431243 nb_sse_args += reg_count;
@@ -1261,7 +1261,7 @@ void gfunc_call(TCCState *S, int nb_args) · 17 unmodified lines
12611261 tcc_error(S, "SSE disabled but floating point arguments passed");
12621262
12631263 /* fetch cpu flag before generating any code */
1264− if ((S->vtop->r & VT_VALMASK) == VT_CMP)
1264+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_CMP)
12651265 gv(S, RC_INT);
12661266
12671267 /* for struct arguments, we need to call memcpy and the function
@@ -1272,7 +1272,7 @@ void gfunc_call(TCCState *S, int nb_args) · 4 unmodified lines
12721272 args_size = 0;
12731273 stack_adjust &= 15;
12741274 for (i = k = 0; i < nb_args;) {
1275− mode = classify_x86_64_arg(&S->vtop[-i].type, NULL, &size, &align, &reg_count);
1275+ mode = classify_x86_64_arg(&S->tccgen_vtop[-i].type, NULL, &size, &align, &reg_count);
12761276 if (size) {
12771277 if (!onstack[i + k]) {
12781278 ++i;
@@ -1293,7 +1293,7 @@ void gfunc_call(TCCState *S, int nb_args) · 14 unmodified lines
12931293
12941294 vrotb(S, i+1);
12951295
1296− switch (S->vtop->type.t & VT_BTYPE) {
1296+ switch (S->tccgen_vtop->type.t & VT_BTYPE) {
12971297 case VT_STRUCT:
12981298 /* allocate the necessary size on stack */
12991299 o(S, 0x48);
@@ -1302,7 +1302,7 @@ void gfunc_call(TCCState *S, int nb_args) · 2 unmodified lines
13021302 r = get_reg(S, RC_INT);
13031303 orex(S, 1, r, 0, 0x89); /* mov %rsp, r */
13041304 o(S, 0xe0 + REG_VALUE(r));
1305− vset(S, &S->vtop->type, r | VT_LVAL, 0);
1305+ vset(S, &S->tccgen_vtop->type, r | VT_LVAL, 0);
13061306 vswap(S);
13071307 vstore(S);
13081308 break;
@@ -1353,10 +1353,10 @@ void gfunc_call(TCCState *S, int nb_args) · 44 unmodified lines
13531353 assert(gen_reg <= REGN);
13541354 assert(sse_reg <= 8);
13551355 for(i = 0; i < nb_args; i++) {
1356− mode = classify_x86_64_arg(&S->vtop->type, &type, &size, &align, &reg_count);
1356+ mode = classify_x86_64_arg(&S->tccgen_vtop->type, &type, &size, &align, &reg_count);
13571357 if (size == 0) continue;
13581358 /* Alter stack entry type so that gv() knows how to treat it */
1359− S->vtop->type = type;
1359+ S->tccgen_vtop->type = type;
13601360 if (mode == x86_64_mode_sse) {
13611361 if (reg_count == 2) {
13621362 sse_reg -= 2;
@@ -1386,11 +1386,11 @@ void gfunc_call(TCCState *S, int nb_args) · 23 unmodified lines
13861386 o(S, 0xc0 + REG_VALUE(r) * 8 + REG_VALUE(d));
13871387 if (reg_count == 2) {
13881388 d = arg_prepare_reg(gen_reg+1);
1389− orex(S, 1,d,S->vtop->r2,0x89); /* mov */
1390− o(S, 0xc0 + REG_VALUE(S->vtop->r2) * 8 + REG_VALUE(d));
1389+ orex(S, 1,d,S->tccgen_vtop->r2,0x89); /* mov */
1390+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop->r2) * 8 + REG_VALUE(d));
13911391 }
13921392 }
1393− S->vtop--;
1393+ S->tccgen_vtop--;
13941394 }
13951395 assert(gen_reg == 0);
13961396 assert(sse_reg == 0);
@@ -1409,23 +1409,23 @@ void gfunc_call(TCCState *S, int nb_args) · 12 unmodified lines
14091409 }
14101410 }
14111411
1412− if (S->vtop->type.ref->f.func_type != FUNC_NEW) /* implies FUNC_OLD or FUNC_ELLIPSIS */
1412+ if (S->tccgen_vtop->type.ref->f.func_type != FUNC_NEW) /* implies FUNC_OLD or FUNC_ELLIPSIS */
14131413 oad(S, 0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */
14141414 gcall_or_jmp(S, 0);
14151415 if (args_size)
14161416 gadd_sp(S, args_size);
1417− S->vtop--;
1417+ S->tccgen_vtop--;
14181418 }
14191419
14201420 #define FUNC_PROLOG_SIZE 11
14211421
1422−static void push_arg_reg(TCCState *S, int i) {
1423− S->loc -= 8;
1424− gen_modrm64(S, 0x89, arg_regs[i], VT_LOCAL, NULL, S->loc);
1422+static void push_arg_reg(TCCState* S, int i) {
1423+ S->tccgen_loc -= 8;
1424+ gen_modrm64(S, 0x89, arg_regs[i], VT_LOCAL, NULL, S->tccgen_loc);
14251425 }
14261426
14271427 /* generate function prolog of type 't' */
1428−void gfunc_prolog(TCCState *S, Sym *func_sym)
1428+void gfunc_prolog(TCCState* S, Sym *func_sym)
14291429 {
14301430 CType *func_type = &func_sym->type;
14311431 X86_64_Mode mode, ret_mode;
@@ -1436,9 +1436,9 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 4 unmodified lines
14361436
14371437 sym = func_type->ref;
14381438 addr = PTR_SIZE * 2;
1439− S->loc = 0;
1440− S->ind += FUNC_PROLOG_SIZE;
1441− S->x86_64_gen_func_sub_sp_offset = S->ind;
1439+ S->tccgen_loc = 0;
1440+ S->tccgen_ind += FUNC_PROLOG_SIZE;
1441+ S->x86_64_gen_func_sub_sp_offset = S->tccgen_ind;
14421442 S->x86_64_gen_func_ret_sub = 0;
14431443 ret_mode = classify_x86_64_arg(&S->tccgen_func_vt, NULL, &size, &align, &reg_count);
14441444
@@ -1473,7 +1473,7 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 28 unmodified lines
14731473 }
14741474 }
14751475
1476− S->loc -= 24;
1476+ S->tccgen_loc -= 24;
14771477 /* movl $0x????????, -0x18(%rbp) */
14781478 o(S, 0xe845c7);
14791479 gen_le32(S, seen_reg_num * 8);
@@ -1493,14 +1493,14 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 13 unmodified lines
14931493
14941494 /* save all register passing arguments */
14951495 for (i = 0; i < 8; i++) {
1496− S->loc -= 16;
1496+ S->tccgen_loc -= 16;
14971497 if (!S->nosse) {
14981498 o(S, 0xd60f66); /* movq */
1499− gen_modrm(S, 7 - i, VT_LOCAL, NULL, S->loc);
1499+ gen_modrm(S, 7 - i, VT_LOCAL, NULL, S->tccgen_loc);
15001500 }
15011501 /* movq $0, loc+8(%rbp) */
15021502 o(S, 0x85c748);
1503− gen_le32(S, S->loc + 8);
1503+ gen_le32(S, S->tccgen_loc + 8);
15041504 gen_le32(S, 0);
15051505 }
15061506 for (i = 0; i < REGN; i++) {
@@ -1516,7 +1516,7 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 9 unmodified lines
15161516 implicit pointer parameter */
15171517 if (ret_mode == x86_64_mode_memory) {
15181518 push_arg_reg(S, reg_param_index);
1519− S->tccgen_func_vc = S->loc;
1519+ S->tccgen_func_vc = S->tccgen_loc;
15201520 reg_param_index++;
15211521 }
15221522 /* define parameters */
@@ -1529,8 +1529,8 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 6 unmodified lines
15291529 tcc_error(S, "SSE disabled but floating point arguments used");
15301530 if (sse_param_index + reg_count <= 8) {
15311531 /* save arguments passed by register */
1532− S->loc -= reg_count * 8;
1533− param_addr = S->loc;
1532+ S->tccgen_loc -= reg_count * 8;
1533+ param_addr = S->tccgen_loc;
15341534 for (i = 0; i < reg_count; ++i) {
15351535 o(S, 0xd60f66); /* movq */
15361536 gen_modrm(S, sse_param_index, VT_LOCAL, NULL, param_addr + i*8);
@@ -1553,8 +1553,8 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 16 unmodified lines
15531553 case x86_64_mode_integer: {
15541554 if (reg_param_index + reg_count <= REGN) {
15551555 /* save arguments passed by register */
1556− S->loc -= reg_count * 8;
1557− param_addr = S->loc;
1556+ S->tccgen_loc -= reg_count * 8;
1557+ param_addr = S->tccgen_loc;
15581558 for (i = 0; i < reg_count; ++i) {
15591559 gen_modrm64(S, 0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, param_addr + i*8);
15601560 ++reg_param_index;
@@ -1579,7 +1579,7 @@ void gfunc_prolog(TCCState *S, Sym *func_sym) · 18 unmodified lines
15791579 }
15801580
15811581 /* generate function epilog */
1582−void gfunc_epilog(TCCState *S)
1582+void gfunc_epilog(TCCState* S)
15831583 {
15841584 int v, saved_ind;
15851585
@@ -1596,39 +1596,39 @@ void gfunc_epilog(TCCState *S) · 10 unmodified lines
15961596 g(S, S->x86_64_gen_func_ret_sub >> 8);
15971597 }
15981598 /* align local size to word & save local variables */
1599− v = (-S->loc + 15) & -16;
1600− saved_ind = S->ind;
1601− S->ind = S->x86_64_gen_func_sub_sp_offset - FUNC_PROLOG_SIZE;
1599+ v = (-S->tccgen_loc + 15) & -16;
1600+ saved_ind = S->tccgen_ind;
1601+ S->tccgen_ind = S->x86_64_gen_func_sub_sp_offset - FUNC_PROLOG_SIZE;
16021602 o(S, 0xe5894855); /* push %rbp, mov %rsp, %rbp */
16031603 o(S, 0xec8148); /* sub rsp, stacksize */
16041604 gen_le32(S, v);
1605− S->ind = saved_ind;
1605+ S->tccgen_ind = saved_ind;
16061606 }
16071607
16081608 #endif /* not PE */
16091609
1610−ST_FUNC void gen_fill_nops(TCCState *S, int bytes)
1610+ST_FUNC void gen_fill_nops(TCCState* S, int bytes)
16111611 {
16121612 while (bytes--)
16131613 g(S, 0x90);
16141614 }
16151615
16161616 /* generate a jump to a label */
1617−int gjmp(TCCState *S, int t)
1617+int gjmp(TCCState* S, int t)
16181618 {
16191619 return gjmp2(S, 0xe9, t);
16201620 }
16211621
16221622 /* generate a jump to a fixed address */
1623−void gjmp_addr(TCCState *S, int a)
1623+void gjmp_addr(TCCState* S, int a)
16241624 {
16251625 int r;
1626− r = a - S->ind - 2;
1626+ r = a - S->tccgen_ind - 2;
16271627 if (r == (char)r) {
16281628 g(S, 0xeb);
16291629 g(S, r);
16301630 } else {
1631− oad(S, 0xe9, a - S->ind - 5);
1631+ oad(S, 0xe9, a - S->tccgen_ind - 5);
16321632 }
16331633 }
16341634
@@ -1646,7 +1646,7 @@ ST_FUNC int gjmp_append(TCCState *S, int n, int t) · 11 unmodified lines
16461646 return t;
16471647 }
16481648
1649−ST_FUNC int gjmp_cond(TCCState *S, int op, int t)
1649+ST_FUNC int gjmp_cond(TCCState* S, int op, int t)
16501650 {
16511651 if (op & 0x100)
16521652 {
@@ -1657,7 +1657,7 @@ ST_FUNC int gjmp_cond(TCCState *S, int op, int t) · 4 unmodified lines
16571657 Take care about inverting the test. We need to jump
16581658 to our target if the result was unordered and test wasn't NE,
16591659 otherwise if unordered we don't want to jump. */
1660− int v = S->vtop->cmp_r;
1660+ int v = S->tccgen_vtop->cmp_r;
16611661 op &= ~0x100;
16621662 if (op ^ v ^ (v != TOK_NE))
16631663 o(S, 0x067a); /* jp +6 */
@@ -1673,26 +1673,26 @@ ST_FUNC int gjmp_cond(TCCState *S, int op, int t) · 9 unmodified lines
16731673 }
16741674
16751675 /* generate an integer binary operation */
1676−void gen_opi(TCCState *S, int op)
1676+void gen_opi(TCCState* S, int op)
16771677 {
16781678 int r, fr, opc, c;
16791679 int ll, uu, cc;
16801680
1681− ll = is64_type(S->vtop[-1].type.t);
1682− uu = (S->vtop[-1].type.t & VT_UNSIGNED) != 0;
1683− cc = (S->vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
1681+ ll = is64_type(S->tccgen_vtop[-1].type.t);
1682+ uu = (S->tccgen_vtop[-1].type.t & VT_UNSIGNED) != 0;
1683+ cc = (S->tccgen_vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST;
16841684
16851685 switch(op) {
16861686 case '+':
16871687 case TOK_ADDC1: /* add with carry generation */
16881688 opc = 0;
16891689 gen_op8:
1690− if (cc && (!ll || (int)S->vtop->c.i == S->vtop->c.i)) {
1690+ if (cc && (!ll || (int)S->tccgen_vtop->c.i == S->tccgen_vtop->c.i)) {
16911691 /* constant case */
16921692 vswap(S);
16931693 r = gv(S, RC_INT);
16941694 vswap(S);
1695− c = S->vtop->c.i;
1695+ c = S->tccgen_vtop->c.i;
16961696 if (c == (char)c) {
16971697 /* XXX: generate inc and dec for smaller code ? */
16981698 orex(S, ll, r, 0, 0x83);
@@ -1704,12 +1704,12 @@ void gen_opi(TCCState *S, int op) · 5 unmodified lines
17041704 }
17051705 } else {
17061706 gv2(S, RC_INT, RC_INT);
1707− r = S->vtop[-1].r;
1708− fr = S->vtop[0].r;
1707+ r = S->tccgen_vtop[-1].r;
1708+ fr = S->tccgen_vtop[0].r;
17091709 orex(S, ll, r, fr, (opc << 3) | 0x01);
17101710 o(S, 0xc0 + REG_VALUE(r) + REG_VALUE(fr) * 8);
17111711 }
1712− S->vtop--;
1712+ S->tccgen_vtop--;
17131713 if (op >= TOK_ULT && op <= TOK_GT)
17141714 vset_VT_CMP(S, op);
17151715 break;
@@ -1734,11 +1734,11 @@ void gen_opi(TCCState *S, int op) · 18 unmodified lines
17341734 goto gen_op8;
17351735 case '*':
17361736 gv2(S, RC_INT, RC_INT);
1737− r = S->vtop[-1].r;
1738− fr = S->vtop[0].r;
1737+ r = S->tccgen_vtop[-1].r;
1738+ fr = S->tccgen_vtop[0].r;
17391739 orex(S, ll, fr, r, 0xaf0f); /* imul fr, r */
17401740 o(S, 0xc0 + REG_VALUE(fr) + REG_VALUE(r) * 8);
1741− S->vtop--;
1741+ S->tccgen_vtop--;
17421742 break;
17431743 case TOK_SHL:
17441744 opc = 4;
@@ -1757,15 +1757,15 @@ void gen_opi(TCCState *S, int op) · 12 unmodified lines
17571757 vswap(S);
17581758 orex(S, ll, r, 0, 0xc1); /* shl/shr/sar $xxx, r */
17591759 o(S, opc | REG_VALUE(r));
1760− g(S, S->vtop->c.i & (ll ? 63 : 31));
1760+ g(S, S->tccgen_vtop->c.i & (ll ? 63 : 31));
17611761 } else {
17621762 /* we generate the shift in ecx */
17631763 gv2(S, RC_INT, RC_RCX);
1764− r = S->vtop[-1].r;
1764+ r = S->tccgen_vtop[-1].r;
17651765 orex(S, ll, r, 0, 0xd3); /* shl/shr/sar %cl, r */
17661766 o(S, opc | REG_VALUE(r));
17671767 }
1768− S->vtop--;
1768+ S->tccgen_vtop--;
17691769 break;
17701770 case TOK_UDIV:
17711771 case TOK_UMOD:
@@ -1779,9 +1779,9 @@ void gen_opi(TCCState *S, int op) · 7 unmodified lines
17791779 /* first operand must be in eax */
17801780 /* XXX: need better constraint for second operand */
17811781 gv2(S, RC_RAX, RC_RCX);
1782− r = S->vtop[-1].r;
1783− fr = S->vtop[0].r;
1784− S->vtop--;
1782+ r = S->tccgen_vtop[-1].r;
1783+ fr = S->tccgen_vtop[0].r;
1784+ S->tccgen_vtop--;
17851785 save_reg(S, TREG_RDX);
17861786 orex(S, ll, 0, 0, uu ? 0xd231 : 0x99); /* xor %edx,%edx : cqto */
17871787 orex(S, ll, fr, 0, 0xf7); /* div fr, %eax */
@@ -1790,7 +1790,7 @@ void gen_opi(TCCState *S, int op) · 2 unmodified lines
17901790 r = TREG_RDX;
17911791 else
17921792 r = TREG_RAX;
1793− S->vtop->r = r;
1793+ S->tccgen_vtop->r = r;
17941794 break;
17951795 default:
17961796 opc = 7;
@@ -1798,25 +1798,25 @@ void gen_opi(TCCState *S, int op) · 1 unmodified line
17981798 }
17991799 }
18001800
1801−void gen_opl(TCCState *S, int op)
1801+void gen_opl(TCCState* S, int op)
18021802 {
18031803 gen_opi(S, op);
18041804 }
18051805
1806−void vpush_const(TCCState *S, int t, int v)
1806+void vpush_const(TCCState* S, int t, int v)
18071807 {
18081808 CType ctype = { t | VT_CONSTANT, 0 };
18091809 vpushsym(S, &ctype, external_global_sym(S, v, &ctype));
1810− S->vtop->r |= VT_LVAL;
1810+ S->tccgen_vtop->r |= VT_LVAL;
18111811 }
18121812
18131813 /* generate a floating point operation 'v = t1 op t2' instruction. The
18141814 two operands are guaranteed to have the same floating point type */
18151815 /* XXX: need to use ST1 too */
1816−void gen_opf(TCCState *S, int op)
1816+void gen_opf(TCCState* S, int op)
18171817 {
18181818 int a, ft, fc, swapped, r;
1819− int bt = S->vtop->type.t & VT_BTYPE;
1819+ int bt = S->tccgen_vtop->type.t & VT_BTYPE;
18201820 int float_type = bt == VT_LDOUBLE ? RC_ST0 : RC_FLOAT;
18211821
18221822 if (op == TOK_NEG) { /* unary minus */
@@ -1830,24 +1830,24 @@ void gen_opf(TCCState *S, int op) · 7 unmodified lines
18301830 if (bt == VT_DOUBLE)
18311831 o(S, 0x66);
18321832 /* xorp[sd] %xmm1, %xmm0 */
1833− o(S, 0xc0570f | (REG_VALUE(S->vtop[0].r) + REG_VALUE(S->vtop[-1].r)*8) << 16);
1834− S->vtop--;
1833+ o(S, 0xc0570f | (REG_VALUE(S->tccgen_vtop[0].r) + REG_VALUE(S->tccgen_vtop[-1].r)*8) << 16);
1834+ S->tccgen_vtop--;
18351835 }
18361836 return;
18371837 }
18381838
18391839 /* convert constants to memory references */
1840− if ((S->vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
1840+ if ((S->tccgen_vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
18411841 vswap(S);
18421842 gv(S, float_type);
18431843 vswap(S);
18441844 }
1845− if ((S->vtop[0].r & (VT_VALMASK | VT_LVAL)) == VT_CONST)
1845+ if ((S->tccgen_vtop[0].r & (VT_VALMASK | VT_LVAL)) == VT_CONST)
18461846 gv(S, float_type);
18471847
18481848 /* must put at least one value in the floating point register */
1849− if ((S->vtop[-1].r & VT_LVAL) &&
1850− (S->vtop[0].r & VT_LVAL)) {
1849+ if ((S->tccgen_vtop[-1].r & VT_LVAL) &&
1850+ (S->tccgen_vtop[0].r & VT_LVAL)) {
18511851 vswap(S);
18521852 gv(S, float_type);
18531853 vswap(S);
@@ -1855,14 +1855,14 @@ void gen_opf(TCCState *S, int op) · 1 unmodified line
18551855 swapped = 0;
18561856 /* swap the stack if needed so that t1 is the register and t2 is
18571857 the memory reference */
1858− if (S->vtop[-1].r & VT_LVAL) {
1858+ if (S->tccgen_vtop[-1].r & VT_LVAL) {
18591859 vswap(S);
18601860 swapped = 1;
18611861 }
1862− if ((S->vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
1862+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LDOUBLE) {
18631863 if (op >= TOK_ULT && op <= TOK_GT) {
18641864 /* load on stack second operand */
1865− load(S, TREG_ST0, S->vtop);
1865+ load(S, TREG_ST0, S->tccgen_vtop);
18661866 save_reg(S, TREG_RAX); /* eax is used by FP comparison code */
18671867 if (op == TOK_GE || op == TOK_GT)
18681868 swapped = !swapped;
@@ -1889,11 +1889,11 @@ void gen_opf(TCCState *S, int op) · 20 unmodified lines
18891889 o(S, 0x45c4f6); /* test $0x45, %ah */
18901890 op = TOK_EQ;
18911891 }
1892− S->vtop--;
1892+ S->tccgen_vtop--;
18931893 vset_VT_CMP(S, op);
18941894 } else {
18951895 /* no memory reference possible for long double operations */
1896− load(S, TREG_ST0, S->vtop);
1896+ load(S, TREG_ST0, S->tccgen_vtop);
18971897 swapped = !swapped;
18981898
18991899 switch(op) {
@@ -1915,17 +1915,17 @@ void gen_opf(TCCState *S, int op) · 15 unmodified lines
19151915 a++;
19161916 break;
19171917 }
1918− ft = S->vtop->type.t;
1919− fc = S->vtop->c.i;
1918+ ft = S->tccgen_vtop->type.t;
1919+ fc = S->tccgen_vtop->c.i;
19201920 o(S, 0xde); /* fxxxp %st, %st(1) */
19211921 o(S, 0xc1 + (a << 3));
1922− S->vtop--;
1922+ S->tccgen_vtop--;
19231923 }
19241924 } else {
19251925 if (op >= TOK_ULT && op <= TOK_GT) {
19261926 /* if saved lvalue, then we must reload it */
1927− r = S->vtop->r;
1928− fc = S->vtop->c.i;
1927+ r = S->tccgen_vtop->r;
1928+ fc = S->tccgen_vtop->c.i;
19291929 if ((r & VT_VALMASK) == VT_LLOCAL) {
19301930 SValue v1;
19311931 r = get_reg(S, RC_INT);
@@ -1934,7 +1934,7 @@ void gen_opf(TCCState *S, int op) · 2 unmodified lines
19341934 v1.c.i = fc;
19351935 load(S, r, &v1);
19361936 fc = 0;
1937− S->vtop->r = r = r | VT_LVAL;
1937+ S->tccgen_vtop->r = r = r | VT_LVAL;
19381938 }
19391939
19401940 if (op == TOK_EQ || op == TOK_NE) {
@@ -1953,26 +1953,26 @@ void gen_opf(TCCState *S, int op) · 12 unmodified lines
19531953 gv(S, RC_FLOAT);
19541954 vswap(S);
19551955 }
1956− assert(!(S->vtop[-1].r & VT_LVAL));
1956+ assert(!(S->tccgen_vtop[-1].r & VT_LVAL));
19571957
1958− if ((S->vtop->type.t & VT_BTYPE) == VT_DOUBLE)
1958+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_DOUBLE)
19591959 o(S, 0x66);
19601960 if (op == TOK_EQ || op == TOK_NE)
19611961 o(S, 0x2e0f); /* ucomisd */
19621962 else
19631963 o(S, 0x2f0f); /* comisd */
19641964
1965− if (S->vtop->r & VT_LVAL) {
1966− gen_modrm(S, S->vtop[-1].r, r, S->vtop->sym, fc);
1965+ if (S->tccgen_vtop->r & VT_LVAL) {
1966+ gen_modrm(S, S->tccgen_vtop[-1].r, r, S->tccgen_vtop->sym, fc);
19671967 } else {
1968− o(S, 0xc0 + REG_VALUE(S->vtop[0].r) + REG_VALUE(S->vtop[-1].r)*8);
1968+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop[0].r) + REG_VALUE(S->tccgen_vtop[-1].r)*8);
19691969 }
19701970
1971− S->vtop--;
1971+ S->tccgen_vtop--;
19721972 vset_VT_CMP(S, op | 0x100);
1973− S->vtop->cmp_r = op;
1973+ S->tccgen_vtop->cmp_r = op;
19741974 } else {
1975− assert((S->vtop->type.t & VT_BTYPE) != VT_LDOUBLE);
1975+ assert((S->tccgen_vtop->type.t & VT_BTYPE) != VT_LDOUBLE);
19761976 switch(op) {
19771977 default:
19781978 case '+':
@@ -1988,13 +1988,13 @@ void gen_opf(TCCState *S, int op) · 9 unmodified lines
19881988 a = 6;
19891989 break;
19901990 }
1991− ft = S->vtop->type.t;
1992− fc = S->vtop->c.i;
1991+ ft = S->tccgen_vtop->type.t;
1992+ fc = S->tccgen_vtop->c.i;
19931993 assert((ft & VT_BTYPE) != VT_LDOUBLE);
19941994
1995− r = S->vtop->r;
1995+ r = S->tccgen_vtop->r;
19961996 /* if saved lvalue, then we must reload it */
1997− if ((S->vtop->r & VT_VALMASK) == VT_LLOCAL) {
1997+ if ((S->tccgen_vtop->r & VT_VALMASK) == VT_LLOCAL) {
19981998 SValue v1;
19991999 r = get_reg(S, RC_INT);
20002000 v1.type.t = VT_PTR;
@@ -2002,12 +2002,12 @@ void gen_opf(TCCState *S, int op) · 1 unmodified line
20022002 v1.c.i = fc;
20032003 load(S, r, &v1);
20042004 fc = 0;
2005− S->vtop->r = r = r | VT_LVAL;
2005+ S->tccgen_vtop->r = r = r | VT_LVAL;
20062006 }
20072007
2008− assert(!(S->vtop[-1].r & VT_LVAL));
2008+ assert(!(S->tccgen_vtop[-1].r & VT_LVAL));
20092009 if (swapped) {
2010− assert(S->vtop->r & VT_LVAL);
2010+ assert(S->tccgen_vtop->r & VT_LVAL);
20112011 gv(S, RC_FLOAT);
20122012 vswap(S);
20132013 }
@@ -2020,66 +2020,66 @@ void gen_opf(TCCState *S, int op) · 6 unmodified lines
20202020 o(S, 0x0f);
20212021 o(S, 0x58 + a);
20222022
2023− if (S->vtop->r & VT_LVAL) {
2024− gen_modrm(S, S->vtop[-1].r, r, S->vtop->sym, fc);
2023+ if (S->tccgen_vtop->r & VT_LVAL) {
2024+ gen_modrm(S, S->tccgen_vtop[-1].r, r, S->tccgen_vtop->sym, fc);
20252025 } else {
2026− o(S, 0xc0 + REG_VALUE(S->vtop[0].r) + REG_VALUE(S->vtop[-1].r)*8);
2026+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop[0].r) + REG_VALUE(S->tccgen_vtop[-1].r)*8);
20272027 }
20282028
2029− S->vtop--;
2029+ S->tccgen_vtop--;
20302030 }
20312031 }
20322032 }
20332033
20342034 /* convert integers to fp 't' type. Must handle 'int', 'unsigned int'
20352035 and 'long long' cases. */
2036−void gen_cvt_itof(TCCState *S, int t)
2036+void gen_cvt_itof(TCCState* S, int t)
20372037 {
20382038 if ((t & VT_BTYPE) == VT_LDOUBLE) {
20392039 save_reg(S, TREG_ST0);
20402040 gv(S, RC_INT);
2041− if ((S->vtop->type.t & VT_BTYPE) == VT_LLONG) {
2041+ if ((S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG) {
20422042 /* signed long long to float/double/long double (unsigned case
20432043 is handled generically) */
2044− o(S, 0x50 + (S->vtop->r & VT_VALMASK)); /* push r */
2044+ o(S, 0x50 + (S->tccgen_vtop->r & VT_VALMASK)); /* push r */
20452045 o(S, 0x242cdf); /* fildll (%rsp) */
20462046 o(S, 0x08c48348); /* add $8, %rsp */
2047− } else if ((S->vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
2047+ } else if ((S->tccgen_vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
20482048 (VT_INT | VT_UNSIGNED)) {
20492049 /* unsigned int to float/double/long double */
20502050 o(S, 0x6a); /* push $0 */
20512051 g(S, 0x00);
2052− o(S, 0x50 + (S->vtop->r & VT_VALMASK)); /* push r */
2052+ o(S, 0x50 + (S->tccgen_vtop->r & VT_VALMASK)); /* push r */
20532053 o(S, 0x242cdf); /* fildll (%rsp) */
20542054 o(S, 0x10c48348); /* add $16, %rsp */
20552055 } else {
20562056 /* int to float/double/long double */
2057− o(S, 0x50 + (S->vtop->r & VT_VALMASK)); /* push r */
2057+ o(S, 0x50 + (S->tccgen_vtop->r & VT_VALMASK)); /* push r */
20582058 o(S, 0x2404db); /* fildl (%rsp) */
20592059 o(S, 0x08c48348); /* add $8, %rsp */
20602060 }
2061− S->vtop->r = TREG_ST0;
2061+ S->tccgen_vtop->r = TREG_ST0;
20622062 } else {
20632063 int r = get_reg(S, RC_FLOAT);
20642064 gv(S, RC_INT);
20652065 o(S, 0xf2 + ((t & VT_BTYPE) == VT_FLOAT?1:0));
2066− if ((S->vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
2066+ if ((S->tccgen_vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
20672067 (VT_INT | VT_UNSIGNED) ||
2068− (S->vtop->type.t & VT_BTYPE) == VT_LLONG) {
2068+ (S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG) {
20692069 o(S, 0x48); /* REX */
20702070 }
20712071 o(S, 0x2a0f);
2072− o(S, 0xc0 + (S->vtop->r & VT_VALMASK) + REG_VALUE(r)*8); /* cvtsi2sd */
2073− S->vtop->r = r;
2072+ o(S, 0xc0 + (S->tccgen_vtop->r & VT_VALMASK) + REG_VALUE(r)*8); /* cvtsi2sd */
2073+ S->tccgen_vtop->r = r;
20742074 }
20752075 }
20762076
20772077 /* convert from one floating point type to another */
2078−void gen_cvt_ftof(TCCState *S, int t)
2078+void gen_cvt_ftof(TCCState* S, int t)
20792079 {
20802080 int ft, bt, tbt;
20812081
2082− ft = S->vtop->type.t;
2082+ ft = S->tccgen_vtop->type.t;
20832083 bt = ft & VT_BTYPE;
20842084 tbt = t & VT_BTYPE;
20852085
@@ -2087,33 +2087,33 @@ void gen_cvt_ftof(TCCState *S, int t) · 1 unmodified line
20872087 gv(S, RC_FLOAT);
20882088 if (tbt == VT_DOUBLE) {
20892089 o(S, 0x140f); /* unpcklps */
2090− o(S, 0xc0 + REG_VALUE(S->vtop->r)*9);
2090+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop->r)*9);
20912091 o(S, 0x5a0f); /* cvtps2pd */
2092− o(S, 0xc0 + REG_VALUE(S->vtop->r)*9);
2092+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop->r)*9);
20932093 } else if (tbt == VT_LDOUBLE) {
20942094 save_reg(S, RC_ST0);
20952095 /* movss %xmm0,-0x10(%rsp) */
20962096 o(S, 0x110ff3);
2097− o(S, 0x44 + REG_VALUE(S->vtop->r)*8);
2097+ o(S, 0x44 + REG_VALUE(S->tccgen_vtop->r)*8);
20982098 o(S, 0xf024);
20992099 o(S, 0xf02444d9); /* flds -0x10(%rsp) */
2100− S->vtop->r = TREG_ST0;
2100+ S->tccgen_vtop->r = TREG_ST0;
21012101 }
21022102 } else if (bt == VT_DOUBLE) {
21032103 gv(S, RC_FLOAT);
21042104 if (tbt == VT_FLOAT) {
21052105 o(S, 0x140f66); /* unpcklpd */
2106− o(S, 0xc0 + REG_VALUE(S->vtop->r)*9);
2106+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop->r)*9);
21072107 o(S, 0x5a0f66); /* cvtpd2ps */
2108− o(S, 0xc0 + REG_VALUE(S->vtop->r)*9);
2108+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop->r)*9);
21092109 } else if (tbt == VT_LDOUBLE) {
21102110 save_reg(S, RC_ST0);
21112111 /* movsd %xmm0,-0x10(%rsp) */
21122112 o(S, 0x110ff2);
2113− o(S, 0x44 + REG_VALUE(S->vtop->r)*8);
2113+ o(S, 0x44 + REG_VALUE(S->tccgen_vtop->r)*8);
21142114 o(S, 0xf024);
21152115 o(S, 0xf02444dd); /* fldl -0x10(%rsp) */
2116− S->vtop->r = TREG_ST0;
2116+ S->tccgen_vtop->r = TREG_ST0;
21172117 }
21182118 } else {
21192119 int r;
@@ -2125,23 +2125,23 @@ void gen_cvt_ftof(TCCState *S, int t) · 5 unmodified lines
21252125 o(S, 0x100ff2);
21262126 o(S, 0x44 + REG_VALUE(r)*8);
21272127 o(S, 0xf024);
2128− S->vtop->r = r;
2128+ S->tccgen_vtop->r = r;
21292129 } else if (tbt == VT_FLOAT) {
21302130 o(S, 0xf0245cd9); /* fstps -0x10(%rsp) */
21312131 /* movss -0x10(%rsp),%xmm0 */
21322132 o(S, 0x100ff3);
21332133 o(S, 0x44 + REG_VALUE(r)*8);
21342134 o(S, 0xf024);
2135− S->vtop->r = r;
2135+ S->tccgen_vtop->r = r;
21362136 }
21372137 }
21382138 }
21392139
21402140 /* convert fp to int 't' type */
2141−void gen_cvt_ftoi(TCCState *S, int t)
2141+void gen_cvt_ftoi(TCCState* S, int t)
21422142 {
21432143 int ft, bt, size, r;
2144− ft = S->vtop->type.t;
2144+ ft = S->tccgen_vtop->type.t;
21452145 bt = ft & VT_BTYPE;
21462146 if (bt == VT_LDOUBLE) {
21472147 gen_cvt_ftof(S, VT_DOUBLE);
@@ -2163,12 +2163,12 @@ void gen_cvt_ftoi(TCCState *S, int t) · 15 unmodified lines
21632163 assert(0);
21642164 }
21652165 orex(S, size == 8, r, 0, 0x2c0f); /* cvttss2si or cvttsd2si */
2166− o(S, 0xc0 + REG_VALUE(S->vtop->r) + REG_VALUE(r)*8);
2167− S->vtop->r = r;
2166+ o(S, 0xc0 + REG_VALUE(S->tccgen_vtop->r) + REG_VALUE(r)*8);
2167+ S->tccgen_vtop->r = r;
21682168 }
21692169
21702170 // Generate sign extension from 32 to 64 bits:
2171−ST_FUNC void gen_cvt_sxtw(TCCState *S)
2171+ST_FUNC void gen_cvt_sxtw(TCCState* S)
21722172 {
21732173 int r = gv(S, RC_INT);
21742174 /* x86_64 specific: movslq */
@@ -2177,13 +2177,13 @@ ST_FUNC void gen_cvt_sxtw(TCCState *S) · 2 unmodified lines
21772177 }
21782178
21792179 /* char/short to int conversion */
2180−ST_FUNC void gen_cvt_csti(TCCState *S, int t)
2180+ST_FUNC void gen_cvt_csti(TCCState* S, int t)
21812181 {
21822182 int r, sz, xl, ll;
21832183 r = gv(S, RC_INT);
21842184 sz = !(t & VT_UNSIGNED);
21852185 xl = (t & VT_BTYPE) == VT_SHORT;
2186− ll = (S->vtop->type.t & VT_BTYPE) == VT_LLONG;
2186+ ll = (S->tccgen_vtop->type.t & VT_BTYPE) == VT_LLONG;
21872187 orex(S, ll, r, 0, 0xc0b60f /* mov[sz] %a[xl], %eax */
21882188 | (sz << 3 | xl) << 8
21892189 | (REG_VALUE(r) << 3 | REG_VALUE(r)) << 16
@@ -2191,42 +2191,42 @@ ST_FUNC void gen_cvt_csti(TCCState *S, int t) · 1 unmodified line
21912191 }
21922192
21932193 /* increment tcov counter */
2194−ST_FUNC void gen_increment_tcov (TCCState *S, SValue *sv)
2194+ST_FUNC void gen_increment_tcov (TCCState* S, SValue *sv)
21952195 {
21962196 o(S, 0x058348); /* addq $1, xxx(%rip) */
2197− greloca(S, cur_text_section, sv->sym, S->ind, R_X86_64_PC32, -5);
2197+ greloca(S, cur_text_section, sv->sym, S->tccgen_ind, R_X86_64_PC32, -5);
21982198 gen_le32(S, 0);
21992199 o(S, 1);
22002200 }
22012201
22022202 /* computed goto support */
2203−void ggoto(TCCState *S)
2203+void ggoto(TCCState* S)
22042204 {
22052205 gcall_or_jmp(S, 1);
2206− S->vtop--;
2206+ S->tccgen_vtop--;
22072207 }
22082208
22092209 /* Save the stack pointer onto the stack and return the location of its address */
2210−ST_FUNC void gen_vla_sp_save(TCCState *S, int addr) {
2210+ST_FUNC void gen_vla_sp_save(TCCState* S, int addr) {
22112211 /* mov %rsp,addr(%rbp)*/
22122212 gen_modrm64(S, 0x89, TREG_RSP, VT_LOCAL, NULL, addr);
22132213 }
22142214
22152215 /* Restore the SP from a location on the stack */
2216−ST_FUNC void gen_vla_sp_restore(TCCState *S, int addr) {
2216+ST_FUNC void gen_vla_sp_restore(TCCState* S, int addr) {
22172217 gen_modrm64(S, 0x8b, TREG_RSP, VT_LOCAL, NULL, addr);
22182218 }
22192219
22202220 #ifdef TCC_TARGET_PE
22212221 /* Save result of gen_vla_alloc onto the stack */
2222−ST_FUNC void gen_vla_result(TCCState *S, int addr) {
2222+ST_FUNC void gen_vla_result(TCCState* S, int addr) {
22232223 /* mov %rax,addr(%rbp)*/
22242224 gen_modrm64(S, 0x89, TREG_RAX, VT_LOCAL, NULL, addr);
22252225 }
22262226 #endif
22272227
22282228 /* Subtract from the stack pointer, and push the resulting value onto the stack */
2229−ST_FUNC void gen_vla_alloc(TCCState *S, CType *type, int align) {
2229+ST_FUNC void gen_vla_alloc(TCCState* S, CType *type, int align) {
22302230 int use_call = 0;
22312231
22322232 #if defined(CONFIG_TCC_BCHECK)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t