]>
Commit | Line | Data |
---|---|---|
56ed763e | 1 | --- gcc/gcc/gimplify.c 20 Jul 2005 01:18:18 -0000 2.142 |
0e42eb1f PS |
2 | +++ gcc/gcc/gimplify.c 24 Jul 2005 10:10:35 -0000 |
3 | @@ -298,6 +298,25 @@ | |
56ed763e PS |
4 | return lab; |
5 | } | |
6 | ||
56ed763e PS |
7 | +static tree |
8 | +gimplify_build_fold_addr_expr (tree t) | |
9 | +{ | |
10 | + if (TREE_CODE (t) == CONSTRUCTOR) | |
11 | + { | |
12 | + tree new_t; | |
13 | + tree new_var | |
0e42eb1f | 14 | + = create_tmp_var (TREE_TYPE (t), "ATP"); |
56ed763e PS |
15 | + TREE_ADDRESSABLE (new_var) = 1; |
16 | + TREE_READONLY (new_var) = 1; | |
17 | + DECL_INITIAL (new_var) = t; | |
18 | + new_t = build1 (DECL_EXPR, void_type_node, new_var); | |
19 | + t = build_fold_addr_expr (new_var); | |
20 | + t = build2 (COMPOUND_EXPR, TREE_TYPE (t), new_t, t); | |
21 | + return t; | |
22 | + } | |
23 | + return build_fold_addr_expr (t); | |
24 | +} | |
25 | + | |
26 | /* Create a new temporary name with PREFIX. Returns an identifier. */ | |
27 | ||
28 | static GTY(()) unsigned int tmp_var_id_num; | |
0e42eb1f | 29 | @@ -3224,9 +3243,10 @@ |
56ed763e PS |
30 | t = unshare_expr (t); |
31 | t = SUBSTITUTE_PLACEHOLDER_IN_EXPR (t, op0); | |
32 | args = tree_cons (NULL, t, NULL); | |
33 | - t = build_fold_addr_expr (op1); | |
0e42eb1f | 34 | + |
56ed763e PS |
35 | + t = gimplify_build_fold_addr_expr (op1); |
36 | args = tree_cons (NULL, t, args); | |
37 | - dest = build_fold_addr_expr (op0); | |
38 | + dest = gimplify_build_fold_addr_expr (op0); | |
39 | args = tree_cons (NULL, dest, args); | |
40 | t = implicit_built_in_decls[BUILT_IN_MEMCMP]; | |
41 | t = build_function_call_expr (t, args); | |
0e42eb1f | 42 | @@ -3443,7 +3463,7 @@ |
56ed763e | 43 | op0 = TREE_OPERAND (op0, 0); |
0e42eb1f PS |
44 | |
45 | *expr_p = fold_convert (TREE_TYPE (expr), | |
56ed763e | 46 | - build_fold_addr_expr (TREE_OPERAND (op0, 0))); |
0e42eb1f | 47 | + gimplify_build_fold_addr_expr (TREE_OPERAND (op0, 0))); |
56ed763e PS |
48 | ret = GS_OK; |
49 | break; | |
50 | ||
0e42eb1f PS |
51 | @@ -4473,7 +4493,7 @@ |
52 | /* An lvalue will do. Take the address of the expression, store it | |
53 | in a temporary, and replace the expression with an INDIRECT_REF of | |
54 | that temporary. */ | |
55 | - tmp = build_fold_addr_expr (*expr_p); | |
56 | + tmp = gimplify_build_fold_addr_expr (*expr_p); | |
57 | gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue); | |
58 | *expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp); | |
59 | } | |
56ed763e | 60 | --- gcc/gcc/ada/trans.c 20 Jul 2005 01:18:53 -0000 1.101 |
0e42eb1f PS |
61 | +++ gcc/gcc/ada/trans.c 24 Jul 2005 10:10:37 -0000 |
62 | @@ -3585,6 +3585,7 @@ | |
63 | else | |
64 | gnu_lhs = DECL_RESULT (current_function_decl); | |
65 | ||
66 | +#if 0 | |
67 | /* Do not remove the padding from GNU_RET_VAL if the inner | |
68 | type is self-referential since we want to allocate the fixed | |
69 | size in that case. */ | |
70 | @@ -3596,6 +3597,7 @@ | |
71 | && (CONTAINS_PLACEHOLDER_P | |
72 | (TYPE_SIZE (TREE_TYPE (gnu_ret_val))))) | |
73 | gnu_ret_val = TREE_OPERAND (gnu_ret_val, 0); | |
74 | +#endif | |
75 | ||
76 | if (TYPE_RETURNS_BY_REF_P (gnu_subprog_type) | |
77 | || By_Ref (gnat_node)) | |
78 | @@ -4549,28 +4551,6 @@ | |
56ed763e PS |
79 | *expr_p = TREE_OPERAND (*expr_p, 0); |
80 | return GS_OK; | |
81 | ||
82 | - case ADDR_EXPR: | |
83 | - /* If we're taking the address of a constant CONSTRUCTOR, force it to | |
84 | - be put into static memory. We know it's going to be readonly given | |
85 | - the semantics we have and it's required to be static memory in | |
86 | - the case when the reference is in an elaboration procedure. */ | |
87 | - if (TREE_CODE (TREE_OPERAND (expr, 0)) == CONSTRUCTOR | |
88 | - && TREE_CONSTANT (TREE_OPERAND (expr, 0))) | |
89 | - { | |
90 | - tree new_var | |
91 | - = create_tmp_var (TREE_TYPE (TREE_OPERAND (expr, 0)), "C"); | |
92 | - | |
93 | - TREE_READONLY (new_var) = 1; | |
94 | - TREE_STATIC (new_var) = 1; | |
95 | - TREE_ADDRESSABLE (new_var) = 1; | |
96 | - DECL_INITIAL (new_var) = TREE_OPERAND (expr, 0); | |
97 | - | |
98 | - TREE_OPERAND (expr, 0) = new_var; | |
99 | - recompute_tree_invarant_for_addr_expr (expr); | |
100 | - return GS_ALL_DONE; | |
101 | - } | |
102 | - return GS_UNHANDLED; | |
103 | - | |
104 | case COMPONENT_REF: | |
105 | /* We have a kludge here. If the FIELD_DECL is from a fat pointer and is | |
106 | from an early dummy type, replace it with the proper FIELD_DECL. */ | |
0e42eb1f | 107 | @@ -5361,7 +5341,7 @@ |
56ed763e PS |
108 | |
109 | case UNCONSTRAINED_ARRAY_REF: | |
110 | case INDIRECT_REF: | |
111 | - case CONSTRUCTOR: | |
0e42eb1f | 112 | +/* case CONSTRUCTOR:*/ |
56ed763e PS |
113 | case NULL_EXPR: |
114 | case SAVE_EXPR: | |
115 | return true; | |
116 | --- gcc/gcc/ada/utils2.c 20 Jul 2005 01:18:55 -0000 1.50 | |
0e42eb1f | 117 | +++ gcc/gcc/ada/utils2.c 24 Jul 2005 10:10:37 -0000 |
56ed763e PS |
118 | @@ -45,6 +45,8 @@ |
119 | #include "einfo.h" | |
120 | #include "ada-tree.h" | |
121 | #include "gigi.h" | |
122 | +#include "tree-gimple.h" | |
123 | +#include "toplev.h" | |
124 | ||
125 | static tree find_common_type (tree, tree); | |
126 | static bool contains_save_expr_p (tree); | |
0e42eb1f | 127 | @@ -1032,6 +1034,7 @@ |
56ed763e PS |
128 | tree operation_type = result_type; |
129 | tree result; | |
130 | bool side_effects = false; | |
131 | + tree before = NULL; | |
132 | ||
133 | if (operation_type | |
134 | && TREE_CODE (operation_type) == RECORD_TYPE | |
0e42eb1f | 135 | @@ -1150,6 +1153,22 @@ |
56ed763e PS |
136 | result); |
137 | break; | |
138 | } | |
139 | + else | |
140 | + { | |
0e42eb1f | 141 | + tree new_var = create_tmp_var_raw (type, "C"); |
56ed763e PS |
142 | + TREE_ADDRESSABLE (new_var) = 1; |
143 | + TREE_READONLY (new_var) = 1; | |
144 | + if (global_bindings_p ()) | |
145 | + TREE_STATIC (new_var) = 1; | |
146 | + DECL_INITIAL (new_var) = operand; | |
147 | + gnat_pushdecl (new_var, Empty); | |
0e42eb1f | 148 | + |
56ed763e PS |
149 | + if (global_bindings_p ()) |
150 | + rest_of_decl_compilation (new_var, 1, 0); | |
151 | + else | |
152 | + before = build1 (DECL_EXPR, void_type_node, new_var); | |
153 | + operand = new_var; | |
154 | + } | |
155 | ||
156 | goto common; | |
157 | ||
0e42eb1f | 158 | @@ -1198,6 +1217,9 @@ |
56ed763e PS |
159 | } |
160 | ||
161 | TREE_CONSTANT (result) = staticp (operand) || TREE_CONSTANT (operand); | |
162 | + if (before) | |
163 | + result = build2 (COMPOUND_EXPR, TREE_TYPE (result), before, | |
164 | + result); | |
165 | break; | |
166 | ||
167 | case INDIRECT_REF: |