]> gcc.gnu.org Git - gcc.git/blame - gcc/c-semantics.c
alpha.h (TARGET_SWITCHES): Turn on MASK_EXPLICIT_RELOCS if the assembler supports it.
[gcc.git] / gcc / c-semantics.c
CommitLineData
f2c5f623
BC
1/* This file contains the definitions and documentation for the common
2 tree codes used in the GNU C and C++ compilers (see c-common.def
3 for the standard codes).
4f78b9a8
RH
4 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
5 Written by Benjamin Chelf (chelf@codesourcery.com).
f2c5f623 6
1322177d 7This file is part of GCC.
f2c5f623 8
1322177d
LB
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 2, or (at your option) any later
12version.
f2c5f623 13
1322177d
LB
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17for more details.
f2c5f623
BC
18
19You should have received a copy of the GNU General Public License
1322177d
LB
20along with GCC; see the file COPYING. If not, write to the Free
21Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2202111-1307, USA. */
f2c5f623
BC
23
24#include "config.h"
25#include "system.h"
26#include "tree.h"
27#include "function.h"
28#include "splay-tree.h"
29#include "varray.h"
30#include "c-common.h"
31#include "except.h"
32#include "toplev.h"
33#include "flags.h"
34#include "ggc.h"
35#include "rtl.h"
d6684bc8 36#include "expr.h"
f2c5f623
BC
37#include "output.h"
38#include "timevar.h"
39
54f7877c
MM
40/* If non-NULL, the address of a language-specific function for
41 expanding statements. */
42void (*lang_expand_stmt) PARAMS ((tree));
43
8f17b5c5
MM
44/* If non-NULL, the address of a language-specific function for
45 expanding a DECL_STMT. After the language-independent cases are
46 handled, this function will be called. If this function is not
47 defined, it is assumed that declarations other than those for
48 variables and labels do not require any RTL generation. */
49void (*lang_expand_decl_stmt) PARAMS ((tree));
50
ae499cce
MM
51/* Create an empty statement tree rooted at T. */
52
53void
54begin_stmt_tree (t)
55 tree *t;
56{
57 /* We create a trivial EXPR_STMT so that last_tree is never NULL in
58 what follows. We remove the extraneous statement in
59 finish_stmt_tree. */
60 *t = build_nt (EXPR_STMT, void_zero_node);
61 last_tree = *t;
62 last_expr_type = NULL_TREE;
63}
64
65/* T is a statement. Add it to the statement-tree. */
66
56cb9733 67tree
ae499cce
MM
68add_stmt (t)
69 tree t;
70{
71 /* Add T to the statement-tree. */
72 TREE_CHAIN (last_tree) = t;
73 last_tree = t;
0ba8a114 74
ae499cce 75 /* When we expand a statement-tree, we must know whether or not the
0ba8a114 76 statements are full-expressions. We record that fact here. */
ae499cce 77 STMT_IS_FULL_EXPR_P (last_tree) = stmts_are_full_exprs_p ();
b850de4f
MM
78
79 /* Keep track of the number of statements in this function. */
80 if (current_function_decl)
81 ++DECL_NUM_STMTS (current_function_decl);
82
56cb9733 83 return t;
ae499cce
MM
84}
85
8f17b5c5
MM
86/* Create a declaration statement for the declaration given by the
87 DECL. */
88
89void
90add_decl_stmt (decl)
91 tree decl;
92{
93 tree decl_stmt;
94
95 /* We need the type to last until instantiation time. */
96 decl_stmt = build_stmt (DECL_STMT, decl);
97 add_stmt (decl_stmt);
98}
99
100/* Add a scope-statement to the statement-tree. BEGIN_P indicates
101 whether this statements opens or closes a scope. PARTIAL_P is true
102 for a partial scope, i.e, the scope that begins after a label when
103 an object that needs a cleanup is created. If BEGIN_P is nonzero,
104 returns a new TREE_LIST representing the top of the SCOPE_STMT
105 stack. The TREE_PURPOSE is the new SCOPE_STMT. If BEGIN_P is
106 zero, returns a TREE_LIST whose TREE_VALUE is the new SCOPE_STMT,
0ba8a114 107 and whose TREE_PURPOSE is the matching SCOPE_STMT with
8f17b5c5
MM
108 SCOPE_BEGIN_P set. */
109
110tree
111add_scope_stmt (begin_p, partial_p)
112 int begin_p;
113 int partial_p;
114{
de8e49f3 115 tree *stack_ptr = current_scope_stmt_stack ();
8f17b5c5 116 tree ss;
de8e49f3 117 tree top = *stack_ptr;
8f17b5c5
MM
118
119 /* Build the statement. */
120 ss = build_stmt (SCOPE_STMT, NULL_TREE);
121 SCOPE_BEGIN_P (ss) = begin_p;
122 SCOPE_PARTIAL_P (ss) = partial_p;
123
124 /* Keep the scope stack up to date. */
125 if (begin_p)
126 {
de8e49f3
NS
127 top = tree_cons (ss, NULL_TREE, top);
128 *stack_ptr = top;
8f17b5c5
MM
129 }
130 else
131 {
8f17b5c5 132 TREE_VALUE (top) = ss;
de8e49f3 133 *stack_ptr = TREE_CHAIN (top);
8f17b5c5
MM
134 }
135
136 /* Add the new statement to the statement-tree. */
137 add_stmt (ss);
138
139 return top;
140}
141
ae499cce
MM
142/* Finish the statement tree rooted at T. */
143
144void
145finish_stmt_tree (t)
146 tree *t;
147{
148 tree stmt;
149
150 /* Remove the fake extra statement added in begin_stmt_tree. */
151 stmt = TREE_CHAIN (*t);
152 *t = stmt;
153 last_tree = NULL_TREE;
154
8f17b5c5 155 if (cfun && stmt)
ae499cce
MM
156 {
157 /* The line-number recorded in the outermost statement in a function
158 is the line number of the end of the function. */
159 STMT_LINENO (stmt) = lineno;
160 STMT_LINENO_FOR_FN_P (stmt) = 1;
161 }
162}
163
0dfdeca6
BC
164/* Build a generic statement based on the given type of node and
165 arguments. Similar to `build_nt', except that we set
64094f6a
RH
166 STMT_LINENO to be the current line number. */
167/* ??? This should be obsolete with the lineno_stmt productions
168 in the grammar. */
0dfdeca6
BC
169
170tree
171build_stmt VPARAMS ((enum tree_code code, ...))
172{
b3694847
SS
173 tree t;
174 int length;
175 int i;
0dfdeca6 176
7a75edb7
AJ
177 VA_OPEN (p, code);
178 VA_FIXEDARG (p, enum tree_code, code);
0dfdeca6
BC
179
180 t = make_node (code);
181 length = TREE_CODE_LENGTH (code);
64094f6a 182 STMT_LINENO (t) = lineno;
0dfdeca6
BC
183
184 for (i = 0; i < length; i++)
185 TREE_OPERAND (t, i) = va_arg (p, tree);
186
7a75edb7 187 VA_CLOSE (p);
0dfdeca6
BC
188 return t;
189}
190
f2c5f623
BC
191/* Some statements, like for-statements or if-statements, require a
192 condition. This condition can be a declaration. If T is such a
193 declaration it is processed, and an expression appropriate to use
194 as the condition is returned. Otherwise, T itself is returned. */
195
196tree
197expand_cond (t)
198 tree t;
199{
200 if (t && TREE_CODE (t) == TREE_LIST)
201 {
202 expand_stmt (TREE_PURPOSE (t));
203 return TREE_VALUE (t);
204 }
205 else
206 return t;
207}
208
209/* Create RTL for the local static variable DECL. */
210
211void
212make_rtl_for_local_static (decl)
213 tree decl;
214{
215 const char *asmspec = NULL;
216
217 /* If we inlined this variable, we could see it's declaration
218 again. */
95ee998c 219 if (TREE_ASM_WRITTEN (decl))
f2c5f623
BC
220 return;
221
2c21b247
MM
222 /* If the DECL_ASSEMBLER_NAME is not the same as the DECL_NAME, then
223 either we already created RTL for this DECL (and since it was a
0a7394bc 224 local variable, its DECL_ASSEMBLER_NAME got hacked up to prevent
2c21b247
MM
225 clashes with other local statics with the same name by a previous
226 call to make_decl_rtl), or the user explicitly requested a
227 particular assembly name for this variable, using the GNU
228 extension for this purpose:
229
230 int i asm ("j");
231
232 There's no way to know which case we're in, here. But, it turns
233 out we're safe. If there's already RTL, then
234 rest_of_decl_compilation ignores the ASMSPEC parameter, so we
235 may as well not pass it in. If there isn't RTL, then we didn't
236 already create RTL, which means that the modification to
237 DECL_ASSEMBLER_NAME came only via the explicit extension. */
238 if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)
45dcf572 239 && !DECL_RTL_SET_P (decl))
2c21b247 240 asmspec = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
f2c5f623
BC
241
242 rest_of_decl_compilation (decl, asmspec, /*top_level=*/0, /*at_end=*/0);
243}
244
245/* Let the back-end know about DECL. */
246
247void
248emit_local_var (decl)
249 tree decl;
250{
251 /* Create RTL for this variable. */
19e7881c 252 if (!DECL_RTL_SET_P (decl))
f2c5f623 253 {
3645c4dc
RH
254 if (DECL_C_HARD_REGISTER (decl))
255 /* The user specified an assembler name for this variable.
256 Set that up now. */
f2c5f623
BC
257 rest_of_decl_compilation
258 (decl, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
259 /*top_level=*/0, /*at_end=*/0);
260 else
261 expand_decl (decl);
262 }
263
264 /* Actually do the initialization. */
265 if (stmts_are_full_exprs_p ())
266 expand_start_target_temps ();
267
268 expand_decl_init (decl);
269
270 if (stmts_are_full_exprs_p ())
271 expand_end_target_temps ();
272}
273
ec5c56db 274/* Helper for generating the RTL at the beginning of a scope. */
f2c5f623
BC
275
276void
277genrtl_do_pushlevel ()
278{
279 emit_line_note (input_filename, lineno);
280 clear_last_expr ();
281}
282
ec5c56db 283/* Generate the RTL for DESTINATION, which is a GOTO_STMT. */
f2c5f623
BC
284
285void
286genrtl_goto_stmt (destination)
287 tree destination;
288{
289 if (TREE_CODE (destination) == IDENTIFIER_NODE)
290 abort ();
291
292 /* We warn about unused labels with -Wunused. That means we have to
293 mark the used labels as used. */
294 if (TREE_CODE (destination) == LABEL_DECL)
295 TREE_USED (destination) = 1;
296
297 emit_line_note (input_filename, lineno);
298
299 if (TREE_CODE (destination) == LABEL_DECL)
300 {
301 label_rtx (destination);
302 expand_goto (destination);
303 }
304 else
305 expand_computed_goto (destination);
306}
307
ec5c56db 308/* Generate the RTL for EXPR, which is an EXPR_STMT. */
f2c5f623
BC
309
310void
311genrtl_expr_stmt (expr)
312 tree expr;
313{
314 if (expr != NULL_TREE)
315 {
316 emit_line_note (input_filename, lineno);
317
318 if (stmts_are_full_exprs_p ())
319 expand_start_target_temps ();
320
8f17b5c5
MM
321 if (expr != error_mark_node)
322 expand_expr_stmt (expr);
f2c5f623
BC
323
324 if (stmts_are_full_exprs_p ())
325 expand_end_target_temps ();
326 }
327}
328
ec5c56db 329/* Generate the RTL for T, which is a DECL_STMT. */
f2c5f623
BC
330
331void
332genrtl_decl_stmt (t)
333 tree t;
334{
335 tree decl;
336 emit_line_note (input_filename, lineno);
337 decl = DECL_STMT_DECL (t);
338 /* If this is a declaration for an automatic local
339 variable, initialize it. Note that we might also see a
340 declaration for a namespace-scope object (declared with
341 `extern'). We don't have to handle the initialization
342 of those objects here; they can only be declarations,
343 rather than definitions. */
344 if (TREE_CODE (decl) == VAR_DECL
345 && !TREE_STATIC (decl)
346 && !DECL_EXTERNAL (decl))
347 {
348 /* Let the back-end know about this variable. */
349 if (!anon_aggr_type_p (TREE_TYPE (decl)))
350 emit_local_var (decl);
351 else
352 expand_anon_union_decl (decl, NULL_TREE,
353 DECL_ANON_UNION_ELEMS (decl));
354 }
355 else if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
0ba8a114 356 make_rtl_for_local_static (decl);
8f17b5c5
MM
357 else if (TREE_CODE (decl) == LABEL_DECL
358 && C_DECLARED_LABEL_FLAG (decl))
359 declare_nonlocal_label (decl);
360 else if (lang_expand_decl_stmt)
361 (*lang_expand_decl_stmt) (t);
f2c5f623
BC
362}
363
ec5c56db 364/* Generate the RTL for T, which is an IF_STMT. */
f2c5f623
BC
365
366void
367genrtl_if_stmt (t)
368 tree t;
369{
370 tree cond;
371 genrtl_do_pushlevel ();
372 cond = expand_cond (IF_COND (t));
373 emit_line_note (input_filename, lineno);
374 expand_start_cond (cond, 0);
375 if (THEN_CLAUSE (t))
376 expand_stmt (THEN_CLAUSE (t));
377 if (ELSE_CLAUSE (t))
378 {
379 expand_start_else ();
380 expand_stmt (ELSE_CLAUSE (t));
381 }
382 expand_end_cond ();
383}
384
ec5c56db 385/* Generate the RTL for T, which is a WHILE_STMT. */
f2c5f623
BC
386
387void
388genrtl_while_stmt (t)
389 tree t;
390{
391 tree cond;
392 emit_nop ();
393 emit_line_note (input_filename, lineno);
394 expand_start_loop (1);
395 genrtl_do_pushlevel ();
396
397 cond = expand_cond (WHILE_COND (t));
398 emit_line_note (input_filename, lineno);
399 expand_exit_loop_if_false (0, cond);
57939159 400 genrtl_do_pushlevel ();
f2c5f623
BC
401
402 expand_stmt (WHILE_BODY (t));
403
404 expand_end_loop ();
405}
406
ec5c56db 407/* Generate the RTL for T, which is a DO_STMT. */
f2c5f623
BC
408
409void
410genrtl_do_stmt (t)
411 tree t;
412{
d599b81f
RH
413 tree cond = DO_COND (t);
414
415 /* Recognize the common special-case of do { ... } while (0) and do
416 not emit the loop widgetry in this case. In particular this
417 avoids cluttering the rtl with dummy loop notes, which can affect
418 alignment of adjacent labels. */
5f10ef5b 419 if (integer_zerop (cond))
f0de0c5d
RH
420 {
421 expand_start_null_loop ();
422 expand_stmt (DO_BODY (t));
423 expand_end_null_loop ();
424 }
d599b81f
RH
425 else
426 {
427 emit_nop ();
428 emit_line_note (input_filename, lineno);
429 expand_start_loop_continue_elsewhere (1);
f2c5f623 430
d599b81f 431 expand_stmt (DO_BODY (t));
f2c5f623 432
d599b81f
RH
433 expand_loop_continue_here ();
434 cond = expand_cond (cond);
435 emit_line_note (input_filename, lineno);
436 expand_exit_loop_if_false (0, cond);
437 expand_end_loop ();
438 }
f2c5f623
BC
439}
440
ec5c56db 441/* Build the node for a return statement and return it. */
0dfdeca6
BC
442
443tree
444build_return_stmt (expr)
445 tree expr;
446{
447 return (build_stmt (RETURN_STMT, expr));
448}
449
ec5c56db 450/* Generate the RTL for STMT, which is a RETURN_STMT. */
f2c5f623
BC
451
452void
56cb9733
MM
453genrtl_return_stmt (stmt)
454 tree stmt;
f2c5f623 455{
0d97bf4c
JM
456 tree expr;
457
07b2f2fd 458 expr = RETURN_EXPR (stmt);
56cb9733 459
f2c5f623 460 emit_line_note (input_filename, lineno);
56cb9733
MM
461 if (!expr)
462 expand_null_return ();
463 else
464 {
465 expand_start_target_temps ();
466 expand_return (expr);
467 expand_end_target_temps ();
468 }
f2c5f623
BC
469}
470
ec5c56db 471/* Generate the RTL for T, which is a FOR_STMT. */
f2c5f623
BC
472
473void
474genrtl_for_stmt (t)
475 tree t;
476{
f2c5f623 477 tree cond;
8f17b5c5
MM
478 const char *saved_filename;
479 int saved_lineno;
480
f2c5f623
BC
481 if (NEW_FOR_SCOPE_P (t))
482 genrtl_do_pushlevel ();
483
484 expand_stmt (FOR_INIT_STMT (t));
485
8f17b5c5 486 /* Expand the initialization. */
f2c5f623
BC
487 emit_nop ();
488 emit_line_note (input_filename, lineno);
489 expand_start_loop_continue_elsewhere (1);
490 genrtl_do_pushlevel ();
491 cond = expand_cond (FOR_COND (t));
8f17b5c5
MM
492
493 /* Save the filename and line number so that we expand the FOR_EXPR
494 we can reset them back to the saved values. */
495 saved_filename = input_filename;
496 saved_lineno = lineno;
497
498 /* Expand the condition. */
f2c5f623
BC
499 emit_line_note (input_filename, lineno);
500 if (cond)
501 expand_exit_loop_if_false (0, cond);
f2c5f623 502
8f17b5c5
MM
503 /* Expand the body. */
504 genrtl_do_pushlevel ();
f2c5f623
BC
505 expand_stmt (FOR_BODY (t));
506
8f17b5c5
MM
507 /* Expand the increment expression. */
508 input_filename = saved_filename;
509 lineno = saved_lineno;
f2c5f623
BC
510 emit_line_note (input_filename, lineno);
511 expand_loop_continue_here ();
8f17b5c5
MM
512 if (FOR_EXPR (t))
513 genrtl_expr_stmt (FOR_EXPR (t));
f2c5f623
BC
514 expand_end_loop ();
515}
516
ec5c56db 517/* Build a break statement node and return it. */
0dfdeca6
BC
518
519tree
520build_break_stmt ()
521{
522 return (build_stmt (BREAK_STMT));
523}
524
ec5c56db 525/* Generate the RTL for a BREAK_STMT. */
f2c5f623
BC
526
527void
528genrtl_break_stmt ()
529{
530 emit_line_note (input_filename, lineno);
531 if ( ! expand_exit_something ())
532 error ("break statement not within loop or switch");
533}
534
ec5c56db 535/* Build a continue statement node and return it. */
0dfdeca6
BC
536
537tree
538build_continue_stmt ()
539{
540 return (build_stmt (CONTINUE_STMT));
541}
542
ec5c56db 543/* Generate the RTL for a CONTINUE_STMT. */
f2c5f623
BC
544
545void
546genrtl_continue_stmt ()
547{
548 emit_line_note (input_filename, lineno);
549 if (! expand_continue_loop (0))
550 error ("continue statement not within a loop");
551}
552
ec5c56db 553/* Generate the RTL for T, which is a SCOPE_STMT. */
f2c5f623
BC
554
555void
556genrtl_scope_stmt (t)
557 tree t;
558{
7b2b3f29
MM
559 tree block = SCOPE_STMT_BLOCK (t);
560
f2c5f623
BC
561 if (!SCOPE_NO_CLEANUPS_P (t))
562 {
563 if (SCOPE_BEGIN_P (t))
7b2b3f29 564 expand_start_bindings_and_block (2 * SCOPE_NULLIFIED_P (t), block);
f2c5f623
BC
565 else if (SCOPE_END_P (t))
566 expand_end_bindings (NULL_TREE, !SCOPE_NULLIFIED_P (t), 0);
567 }
568 else if (!SCOPE_NULLIFIED_P (t))
569 {
570 rtx note = emit_note (NULL,
571 (SCOPE_BEGIN_P (t)
572 ? NOTE_INSN_BLOCK_BEG
573 : NOTE_INSN_BLOCK_END));
7b2b3f29
MM
574 NOTE_BLOCK (note) = block;
575 }
576
577 /* If we're at the end of a scope that contains inlined nested
578 functions, we have to decide whether or not to write them out. */
579 if (block && SCOPE_END_P (t))
580 {
581 tree fn;
582
583 for (fn = BLOCK_VARS (block); fn; fn = TREE_CHAIN (fn))
584 {
585 if (TREE_CODE (fn) == FUNCTION_DECL
586 && DECL_CONTEXT (fn) == current_function_decl
587 && !TREE_ASM_WRITTEN (fn)
588 && TREE_ADDRESSABLE (fn))
589 {
590 push_function_context ();
591 output_inline_function (fn);
592 pop_function_context ();
593 }
594 }
f2c5f623
BC
595 }
596}
597
ec5c56db 598/* Generate the RTL for T, which is a SWITCH_STMT. */
f2c5f623
BC
599
600void
601genrtl_switch_stmt (t)
602 tree t;
603{
604 tree cond;
605 genrtl_do_pushlevel ();
606
607 cond = expand_cond (SWITCH_COND (t));
56cb9733 608 if (cond == error_mark_node)
f2c5f623 609 /* The code is in error, but we don't want expand_end_case to
ec5c56db 610 crash. */
56cb9733 611 cond = boolean_false_node;
f2c5f623 612
56cb9733
MM
613 emit_line_note (input_filename, lineno);
614 expand_start_case (1, cond, TREE_TYPE (cond), "switch statement");
f2c5f623 615 expand_stmt (SWITCH_BODY (t));
f2c5f623
BC
616 expand_end_case (cond);
617}
618
ec5c56db 619/* Create a CASE_LABEL tree node and return it. */
0dfdeca6
BC
620
621tree
56cb9733 622build_case_label (low_value, high_value, label_decl)
0dfdeca6
BC
623 tree low_value;
624 tree high_value;
56cb9733 625 tree label_decl;
0dfdeca6 626{
56cb9733 627 return build_stmt (CASE_LABEL, low_value, high_value, label_decl);
0dfdeca6
BC
628}
629
630
ec5c56db 631/* Generate the RTL for a CASE_LABEL. */
f2c5f623
BC
632
633void
56cb9733
MM
634genrtl_case_label (case_label)
635 tree case_label;
f2c5f623 636{
56cb9733 637 tree duplicate;
8f17b5c5
MM
638 tree cleanup;
639
640 cleanup = last_cleanup_this_contour ();
641 if (cleanup)
642 {
643 static int explained = 0;
644 warning_with_decl (TREE_PURPOSE (cleanup),
645 "destructor needed for `%#D'");
646 warning ("where case label appears here");
647 if (!explained)
648 {
649 warning ("(enclose actions of previous case statements requiring destructors in their own scope.)");
650 explained = 1;
651 }
652 }
653
56cb9733
MM
654 add_case_node (CASE_LOW (case_label), CASE_HIGH (case_label),
655 CASE_LABEL_DECL (case_label), &duplicate);
f2c5f623
BC
656}
657
ec5c56db 658/* Generate the RTL for T, which is a COMPOUND_STMT. */
f2c5f623 659
4cf88f57
BC
660void
661genrtl_compound_stmt (t)
662 tree t;
f2c5f623 663{
91088ddb
JM
664#ifdef ENABLE_CHECKING
665 struct nesting *n = current_nesting_level ();
666#endif
667
f2c5f623 668 expand_stmt (COMPOUND_BODY (t));
91088ddb
JM
669
670#ifdef ENABLE_CHECKING
671 /* Make sure that we've pushed and popped the same number of levels. */
672 if (n != current_nesting_level ())
673 abort ();
674#endif
f2c5f623
BC
675}
676
ec5c56db 677/* Generate the RTL for an ASM_STMT. */
f2c5f623
BC
678
679void
680genrtl_asm_stmt (cv_qualifier, string, output_operands,
4f78b9a8 681 input_operands, clobbers, asm_input_p)
f2c5f623
BC
682 tree cv_qualifier;
683 tree string;
684 tree output_operands;
685 tree input_operands;
686 tree clobbers;
4f78b9a8 687 int asm_input_p;
f2c5f623 688{
f2c5f623
BC
689 if (cv_qualifier != NULL_TREE
690 && cv_qualifier != ridpointers[(int) RID_VOLATILE])
691 {
692 warning ("%s qualifier ignored on asm",
693 IDENTIFIER_POINTER (cv_qualifier));
694 cv_qualifier = NULL_TREE;
695 }
696
697 emit_line_note (input_filename, lineno);
4f78b9a8 698 if (asm_input_p)
f2c5f623 699 expand_asm (string);
4f78b9a8
RH
700 else
701 c_expand_asm_operands (string, output_operands, input_operands,
702 clobbers, cv_qualifier != NULL_TREE,
703 input_filename, lineno);
f2c5f623
BC
704}
705
ec5c56db 706/* Generate the RTL for a DECL_CLEANUP. */
f2c5f623
BC
707
708void
709genrtl_decl_cleanup (decl, cleanup)
710 tree decl;
711 tree cleanup;
712{
713 if (!decl || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node))
714 expand_decl_cleanup (decl, cleanup);
715}
716
54f7877c
MM
717/* We're about to expand T, a statement. Set up appropriate context
718 for the substitution. */
719
720void
721prep_stmt (t)
722 tree t;
723{
724 if (!STMT_LINENO_FOR_FN_P (t))
725 lineno = STMT_LINENO (t);
726 current_stmt_tree ()->stmts_are_full_exprs_p = STMT_IS_FULL_EXPR_P (t);
727}
728
4cf88f57 729/* Generate the RTL for the statement T, its substatements, and any
ec5c56db 730 other statements at its nesting level. */
4cf88f57 731
54f7877c 732void
f2c5f623
BC
733expand_stmt (t)
734 tree t;
735{
54f7877c
MM
736 while (t && t != error_mark_node)
737 {
738 int saved_stmts_are_full_exprs_p;
739
740 /* Set up context appropriately for handling this statement. */
741 saved_stmts_are_full_exprs_p = stmts_are_full_exprs_p ();
742 prep_stmt (t);
743
744 switch (TREE_CODE (t))
745 {
746 case RETURN_STMT:
56cb9733 747 genrtl_return_stmt (t);
54f7877c
MM
748 break;
749
750 case EXPR_STMT:
751 genrtl_expr_stmt (EXPR_STMT_EXPR (t));
752 break;
753
754 case DECL_STMT:
755 genrtl_decl_stmt (t);
756 break;
757
758 case FOR_STMT:
759 genrtl_for_stmt (t);
760 break;
761
762 case WHILE_STMT:
763 genrtl_while_stmt (t);
764 break;
765
766 case DO_STMT:
767 genrtl_do_stmt (t);
768 break;
769
770 case IF_STMT:
771 genrtl_if_stmt (t);
772 break;
773
774 case COMPOUND_STMT:
775 genrtl_compound_stmt (t);
776 break;
777
778 case BREAK_STMT:
779 genrtl_break_stmt ();
780 break;
781
782 case CONTINUE_STMT:
783 genrtl_continue_stmt ();
784 break;
785
786 case SWITCH_STMT:
787 genrtl_switch_stmt (t);
788 break;
789
790 case CASE_LABEL:
56cb9733 791 genrtl_case_label (t);
54f7877c
MM
792 break;
793
794 case LABEL_STMT:
795 expand_label (LABEL_STMT_LABEL (t));
796 break;
797
798 case GOTO_STMT:
799 genrtl_goto_stmt (GOTO_DESTINATION (t));
800 break;
801
802 case ASM_STMT:
803 genrtl_asm_stmt (ASM_CV_QUAL (t), ASM_STRING (t),
4f78b9a8
RH
804 ASM_OUTPUTS (t), ASM_INPUTS (t),
805 ASM_CLOBBERS (t), ASM_INPUT_P (t));
54f7877c
MM
806 break;
807
8f17b5c5
MM
808 case SCOPE_STMT:
809 genrtl_scope_stmt (t);
810 break;
811
54f7877c
MM
812 default:
813 if (lang_expand_stmt)
814 (*lang_expand_stmt) (t);
815 else
816 abort ();
817 break;
818 }
819
820 /* Restore saved state. */
e92044c3
RK
821 current_stmt_tree ()->stmts_are_full_exprs_p
822 = saved_stmts_are_full_exprs_p;
54f7877c
MM
823
824 /* Go on to the next statement in this scope. */
825 t = TREE_CHAIN (t);
826 }
f2c5f623 827}
4cf88f57 828
This page took 0.404582 seconds and 5 git commands to generate.