OSDN Git Service

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