OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [c-semantics.c] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* 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, 2003, 2004, 2005, 2007
5
   Free Software Foundation, Inc.
6
   Written by Benjamin Chelf (chelf@codesourcery.com).
7
 
8
This file is part of GCC.
9
 
10
GCC is free software; you can redistribute it and/or modify it under
11
the terms of the GNU General Public License as published by the Free
12
Software Foundation; either version 3, or (at your option) any later
13
version.
14
 
15
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
16
WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18
for more details.
19
 
20
You should have received a copy of the GNU General Public License
21
along with GCC; see the file COPYING3.  If not see
22
<http://www.gnu.org/licenses/>.  */
23
 
24
#include "config.h"
25
#include "system.h"
26
#include "coretypes.h"
27
#include "tm.h"
28
#include "tree.h"
29
#include "function.h"
30
#include "splay-tree.h"
31
#include "varray.h"
32
#include "c-common.h"
33
#include "except.h"
34
/* In order for the format checking to accept the C frontend
35
   diagnostic framework extensions, you must define this token before
36
   including toplev.h.  */
37
#define GCC_DIAG_STYLE __gcc_cdiag__
38
#include "toplev.h"
39
#include "flags.h"
40
#include "ggc.h"
41
#include "rtl.h"
42
#include "output.h"
43
#include "timevar.h"
44
#include "predict.h"
45
#include "tree-inline.h"
46
#include "tree-gimple.h"
47
#include "langhooks.h"
48
 
49
/* Create an empty statement tree rooted at T.  */
50
 
51
tree
52
push_stmt_list (void)
53
{
54
  tree t;
55
  t = alloc_stmt_list ();
56
  TREE_CHAIN (t) = cur_stmt_list;
57
  cur_stmt_list = t;
58
  return t;
59
}
60
 
61
/* Finish the statement tree rooted at T.  */
62
 
63
tree
64
pop_stmt_list (tree t)
65
{
66
  tree u = cur_stmt_list, chain;
67
 
68
  /* Pop statement lists until we reach the target level.  The extra
69
     nestings will be due to outstanding cleanups.  */
70
  while (1)
71
    {
72
      chain = TREE_CHAIN (u);
73
      TREE_CHAIN (u) = NULL_TREE;
74
      if (t == u)
75
        break;
76
      u = chain;
77
    }
78
  cur_stmt_list = chain;
79
 
80
  /* If the statement list is completely empty, just return it.  This is
81
     just as good small as build_empty_stmt, with the advantage that
82
     statement lists are merged when they appended to one another.  So
83
     using the STATEMENT_LIST avoids pathological buildup of EMPTY_STMT_P
84
     statements.  */
85
  if (TREE_SIDE_EFFECTS (t))
86
    {
87
      tree_stmt_iterator i = tsi_start (t);
88
 
89
      /* If the statement list contained exactly one statement, then
90
         extract it immediately.  */
91
      if (tsi_one_before_end_p (i))
92
        {
93
          u = tsi_stmt (i);
94
          tsi_delink (&i);
95
          free_stmt_list (t);
96
          t = u;
97
        }
98
    }
99
 
100
  return t;
101
}
102
 
103
/* Build a generic statement based on the given type of node and
104
   arguments. Similar to `build_nt', except that we set
105
   EXPR_LOCATION to be the current source location.  */
106
/* ??? This should be obsolete with the lineno_stmt productions
107
   in the grammar.  */
108
 
109
tree
110
build_stmt (enum tree_code code, ...)
111
{
112
  tree ret;
113
  int length, i;
114
  va_list p;
115
  bool side_effects;
116
 
117
  va_start (p, code);
118
 
119
  ret = make_node (code);
120
  TREE_TYPE (ret) = void_type_node;
121
  length = TREE_CODE_LENGTH (code);
122
  SET_EXPR_LOCATION (ret, input_location);
123
 
124
  /* TREE_SIDE_EFFECTS will already be set for statements with
125
     implicit side effects.  Here we make sure it is set for other
126
     expressions by checking whether the parameters have side
127
     effects.  */
128
 
129
  side_effects = false;
130
  for (i = 0; i < length; i++)
131
    {
132
      tree t = va_arg (p, tree);
133
      if (t && !TYPE_P (t))
134
        side_effects |= TREE_SIDE_EFFECTS (t);
135
      TREE_OPERAND (ret, i) = t;
136
    }
137
 
138
  TREE_SIDE_EFFECTS (ret) |= side_effects;
139
 
140
  va_end (p);
141
  return ret;
142
}
143
 
144
/* Let the back-end know about DECL.  */
145
 
146
void
147
emit_local_var (tree decl)
148
{
149
  /* Create RTL for this variable.  */
150
  if (!DECL_RTL_SET_P (decl))
151
    {
152
      if (DECL_HARD_REGISTER (decl))
153
        /* The user specified an assembler name for this variable.
154
           Set that up now.  */
155
        rest_of_decl_compilation (decl, 0, 0);
156
      else
157
        expand_decl (decl);
158
    }
159
}
160
 
161
/* Create a CASE_LABEL_EXPR tree node and return it.  */
162
 
163
tree
164
build_case_label (tree low_value, tree high_value, tree label_decl)
165
{
166
  return build_stmt (CASE_LABEL_EXPR, low_value, high_value, label_decl);
167
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.