Skip to content

Commit f7b8c21

Browse files
author
ebotcazou
committed
* gcc-interface/decl.c (elaborate_reference_1): Do not bother about
operand gcc-mirror#2 for COMPONENT_REF. * gcc-interface/utils2.c (gnat_save_expr): Likewise. (gnat_protect_expr): Likewise. (gnat_stabilize_reference_1): Likewise. (gnat_rewrite_reference): Do not bother about operand gcc-mirror#3 for ARRAY_REF. (get_inner_constant_reference): Likewise. (gnat_invariant_expr): Likewise. * gcc-interface/trans.c (fold_constant_decl_in_expr): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235701 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 773d09b commit f7b8c21

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

gcc/ada/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2016-05-02 Eric Botcazou <[email protected]>
2+
3+
* gcc-interface/decl.c (elaborate_reference_1): Do not bother about
4+
operand #2 for COMPONENT_REF.
5+
* gcc-interface/utils2.c (gnat_save_expr): Likewise.
6+
(gnat_protect_expr): Likewise.
7+
(gnat_stabilize_reference_1): Likewise.
8+
(gnat_rewrite_reference): Do not bother about operand #3 for ARRAY_REF.
9+
(get_inner_constant_reference): Likewise.
10+
(gnat_invariant_expr): Likewise.
11+
* gcc-interface/trans.c (fold_constant_decl_in_expr): Likewise.
12+
113
2016-05-02 Eric Botcazou <[email protected]>
214

315
* gcc-interface/trans.c (Range_to_gnu): New static function.

gcc/ada/gcc-interface/decl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6656,7 +6656,7 @@ elaborate_reference_1 (tree ref, void *data)
66566656
&& TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (ref, 0))))
66576657
return build3 (COMPONENT_REF, TREE_TYPE (ref),
66586658
elaborate_reference_1 (TREE_OPERAND (ref, 0), data),
6659-
TREE_OPERAND (ref, 1), TREE_OPERAND (ref, 2));
6659+
TREE_OPERAND (ref, 1), NULL_TREE);
66606660

66616661
sprintf (suffix, "EXP%d", ++er->n);
66626662
return

gcc/ada/gcc-interface/trans.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -955,14 +955,21 @@ fold_constant_decl_in_expr (tree exp)
955955

956956
return DECL_INITIAL (exp);
957957

958-
case BIT_FIELD_REF:
959958
case COMPONENT_REF:
960959
op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0));
961960
if (op0 == TREE_OPERAND (exp, 0))
962961
return exp;
963962

964-
return fold_build3 (code, TREE_TYPE (exp), op0, TREE_OPERAND (exp, 1),
965-
TREE_OPERAND (exp, 2));
963+
return fold_build3 (COMPONENT_REF, TREE_TYPE (exp), op0,
964+
TREE_OPERAND (exp, 1), NULL_TREE);
965+
966+
case BIT_FIELD_REF:
967+
op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0));
968+
if (op0 == TREE_OPERAND (exp, 0))
969+
return exp;
970+
971+
return fold_build3 (BIT_FIELD_REF, TREE_TYPE (exp), op0,
972+
TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2));
966973

967974
case ARRAY_REF:
968975
case ARRAY_RANGE_REF:
@@ -974,7 +981,7 @@ fold_constant_decl_in_expr (tree exp)
974981
return exp;
975982

976983
return fold (build4 (code, TREE_TYPE (exp), op0, TREE_OPERAND (exp, 1),
977-
TREE_OPERAND (exp, 2), TREE_OPERAND (exp, 3)));
984+
TREE_OPERAND (exp, 2), NULL_TREE));
978985

979986
case REALPART_EXPR:
980987
case IMAGPART_EXPR:

gcc/ada/gcc-interface/utils2.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,7 @@ gnat_save_expr (tree exp)
25102510
if (code == COMPONENT_REF
25112511
&& TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (exp, 0))))
25122512
return build3 (code, type, gnat_save_expr (TREE_OPERAND (exp, 0)),
2513-
TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2));
2513+
TREE_OPERAND (exp, 1), NULL_TREE);
25142514

25152515
return save_expr (exp);
25162516
}
@@ -2562,7 +2562,7 @@ gnat_protect_expr (tree exp)
25622562
if (code == COMPONENT_REF
25632563
&& TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (exp, 0))))
25642564
return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)),
2565-
TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2));
2565+
TREE_OPERAND (exp, 1), NULL_TREE);
25662566

25672567
/* If this is a fat pointer or a scalar, just make a SAVE_EXPR. Likewise
25682568
for a CALL_EXPR as large objects are returned via invisible reference
@@ -2610,7 +2610,7 @@ gnat_stabilize_reference_1 (tree e, void *data)
26102610
result
26112611
= build3 (code, type,
26122612
gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), data),
2613-
TREE_OPERAND (e, 1), TREE_OPERAND (e, 2));
2613+
TREE_OPERAND (e, 1), NULL_TREE);
26142614
/* If the expression has side-effects, then encase it in a SAVE_EXPR
26152615
so that it will only be evaluated once. */
26162616
/* The tcc_reference and tcc_comparison classes could be handled as
@@ -2718,7 +2718,7 @@ gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, tree *init)
27182718
gnat_rewrite_reference (TREE_OPERAND (ref, 0), func, data,
27192719
init),
27202720
func (TREE_OPERAND (ref, 1), data),
2721-
TREE_OPERAND (ref, 2), TREE_OPERAND (ref, 3));
2721+
TREE_OPERAND (ref, 2), NULL_TREE);
27222722
break;
27232723

27242724
case COMPOUND_EXPR:
@@ -2796,17 +2796,14 @@ get_inner_constant_reference (tree exp)
27962796
break;
27972797

27982798
case COMPONENT_REF:
2799-
if (TREE_OPERAND (exp, 2))
2800-
return NULL_TREE;
2801-
28022799
if (!TREE_CONSTANT (DECL_FIELD_OFFSET (TREE_OPERAND (exp, 1))))
28032800
return NULL_TREE;
28042801
break;
28052802

28062803
case ARRAY_REF:
28072804
case ARRAY_RANGE_REF:
28082805
{
2809-
if (TREE_OPERAND (exp, 2) || TREE_OPERAND (exp, 3))
2806+
if (TREE_OPERAND (exp, 2))
28102807
return NULL_TREE;
28112808

28122809
tree array_type = TREE_TYPE (TREE_OPERAND (exp, 0));
@@ -2934,16 +2931,12 @@ gnat_invariant_expr (tree expr)
29342931
switch (TREE_CODE (t))
29352932
{
29362933
case COMPONENT_REF:
2937-
if (TREE_OPERAND (t, 2))
2938-
return NULL_TREE;
29392934
invariant_p |= DECL_INVARIANT_P (TREE_OPERAND (t, 1));
29402935
break;
29412936

29422937
case ARRAY_REF:
29432938
case ARRAY_RANGE_REF:
2944-
if (!TREE_CONSTANT (TREE_OPERAND (t, 1))
2945-
|| TREE_OPERAND (t, 2)
2946-
|| TREE_OPERAND (t, 3))
2939+
if (!TREE_CONSTANT (TREE_OPERAND (t, 1)) || TREE_OPERAND (t, 2))
29472940
return NULL_TREE;
29482941
break;
29492942

0 commit comments

Comments
 (0)