Remove outermost loop parameter.
[official-gcc/graphite-test-results.git] / gcc / cp / expr.c
blobef5d6be3c5b6f149c6c34f59e6ebd7cc588213b4
1 /* Convert language-specific tree expression to rtl instructions,
2 for GNU compiler.
3 Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
4 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
23 #include "config.h"
24 #include "system.h"
25 #include "coretypes.h"
26 #include "tm.h"
27 #include "tree.h"
28 #include "flags.h"
29 #include "cp-tree.h"
30 #include "toplev.h"
31 #include "except.h"
32 #include "tm_p.h"
34 /* Expand C++-specific constants. Currently, this means PTRMEM_CST. */
36 tree
37 cplus_expand_constant (tree cst)
39 switch (TREE_CODE (cst))
41 case PTRMEM_CST:
43 tree type = TREE_TYPE (cst);
44 tree member;
46 /* Find the member. */
47 member = PTRMEM_CST_MEMBER (cst);
49 if (TREE_CODE (member) == FIELD_DECL)
51 /* Find the offset for the field. */
52 cst = byte_position (member);
53 while (!same_type_p (DECL_CONTEXT (member),
54 TYPE_PTRMEM_CLASS_TYPE (type)))
56 /* The MEMBER must have been nestled within an
57 anonymous aggregate contained in TYPE. Find the
58 anonymous aggregate. */
59 member = lookup_anon_field (TYPE_PTRMEM_CLASS_TYPE (type),
60 DECL_CONTEXT (member));
61 cst = size_binop (PLUS_EXPR, cst, byte_position (member));
63 cst = fold (build_nop (type, cst));
65 else
67 tree delta;
68 tree pfn;
70 expand_ptrmemfunc_cst (cst, &delta, &pfn);
71 cst = build_ptrmemfunc1 (type, delta, pfn);
74 break;
76 default:
77 /* There's nothing to do. */
78 break;
81 return cst;
84 /* Called whenever an expression is used
85 in a rvalue context. */
87 tree
88 mark_rvalue_use (tree expr)
90 mark_exp_read (expr);
91 return expr;
94 /* Called whenever an expression is used
95 in a lvalue context. */
97 tree
98 mark_lvalue_use (tree expr)
100 mark_exp_read (expr);
101 return expr;
104 /* Called whenever an expression is used in a type use context. */
106 tree
107 mark_type_use (tree expr)
109 mark_exp_read (expr);
110 return expr;
113 /* Mark EXP as read, not just set, for set but not used -Wunused
114 warning purposes. */
116 void
117 mark_exp_read (tree exp)
119 if (exp == NULL)
120 return;
122 switch (TREE_CODE (exp))
124 case VAR_DECL:
125 case PARM_DECL:
126 DECL_READ_P (exp) = 1;
127 break;
128 case ARRAY_REF:
129 case COMPONENT_REF:
130 case MODIFY_EXPR:
131 case REALPART_EXPR:
132 case IMAGPART_EXPR:
133 CASE_CONVERT:
134 case ADDR_EXPR:
135 mark_exp_read (TREE_OPERAND (exp, 0));
136 break;
137 case COMPOUND_EXPR:
138 mark_exp_read (TREE_OPERAND (exp, 1));
139 break;
140 case COND_EXPR:
141 if (TREE_OPERAND (exp, 1))
142 mark_exp_read (TREE_OPERAND (exp, 1));
143 if (TREE_OPERAND (exp, 2))
144 mark_exp_read (TREE_OPERAND (exp, 2));
145 break;
146 default:
147 break;