diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-05-02 07:46:05 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-05-02 07:46:05 +0000 |
commit | 552cc5904c9d064873df6f165c99ef798df5f701 (patch) | |
tree | a35710fb0fe0f1de07e28239a0d7129a910e6748 /gcc/ada | |
parent | 6b9933b9b483b37bbed0a83e6631fff8de14a1f8 (diff) | |
download | gcc-552cc5904c9d064873df6f165c99ef798df5f701.zip gcc-552cc5904c9d064873df6f165c99ef798df5f701.tar.gz gcc-552cc5904c9d064873df6f165c99ef798df5f701.tar.bz2 |
decl.c (elaborate_reference_1): Do not bother about operand #2 for COMPONENT_REF.
* gcc-interface/decl.c (elaborate_reference_1): Do not bother about
operand #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 #3 for ARRAY_REF.
(get_inner_constant_reference): Likewise.
(gnat_invariant_expr): Likewise.
* gcc-interface/trans.c (fold_constant_decl_in_expr): Likewise.
From-SVN: r235701
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 15 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils2.c | 19 |
4 files changed, 30 insertions, 18 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d512f0b..590ecee 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,17 @@ 2016-05-02 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (elaborate_reference_1): Do not bother about + operand #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 #3 for ARRAY_REF. + (get_inner_constant_reference): Likewise. + (gnat_invariant_expr): Likewise. + * gcc-interface/trans.c (fold_constant_decl_in_expr): Likewise. + +2016-05-02 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/trans.c (Range_to_gnu): New static function. (Raise_Error_to_gnu) <N_In>: Call it to translate the range. (gnat_to_gnu) <N_In>: Likewise. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 14bc128..f3d2b52 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6656,7 +6656,7 @@ elaborate_reference_1 (tree ref, void *data) && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (ref, 0)))) return build3 (COMPONENT_REF, TREE_TYPE (ref), elaborate_reference_1 (TREE_OPERAND (ref, 0), data), - TREE_OPERAND (ref, 1), TREE_OPERAND (ref, 2)); + TREE_OPERAND (ref, 1), NULL_TREE); sprintf (suffix, "EXP%d", ++er->n); return diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index d20b466..4febc04 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -955,14 +955,21 @@ fold_constant_decl_in_expr (tree exp) return DECL_INITIAL (exp); - case BIT_FIELD_REF: case COMPONENT_REF: op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0)); if (op0 == TREE_OPERAND (exp, 0)) return exp; - return fold_build3 (code, TREE_TYPE (exp), op0, TREE_OPERAND (exp, 1), - TREE_OPERAND (exp, 2)); + return fold_build3 (COMPONENT_REF, TREE_TYPE (exp), op0, + TREE_OPERAND (exp, 1), NULL_TREE); + + case BIT_FIELD_REF: + op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0)); + if (op0 == TREE_OPERAND (exp, 0)) + return exp; + + return fold_build3 (BIT_FIELD_REF, TREE_TYPE (exp), op0, + TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2)); case ARRAY_REF: case ARRAY_RANGE_REF: @@ -974,7 +981,7 @@ fold_constant_decl_in_expr (tree exp) return exp; return fold (build4 (code, TREE_TYPE (exp), op0, TREE_OPERAND (exp, 1), - TREE_OPERAND (exp, 2), TREE_OPERAND (exp, 3))); + TREE_OPERAND (exp, 2), NULL_TREE)); case REALPART_EXPR: case IMAGPART_EXPR: diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index d5dd436..67799df 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -2510,7 +2510,7 @@ gnat_save_expr (tree exp) if (code == COMPONENT_REF && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (exp, 0)))) return build3 (code, type, gnat_save_expr (TREE_OPERAND (exp, 0)), - TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2)); + TREE_OPERAND (exp, 1), NULL_TREE); return save_expr (exp); } @@ -2562,7 +2562,7 @@ gnat_protect_expr (tree exp) if (code == COMPONENT_REF && TYPE_IS_FAT_POINTER_P (TREE_TYPE (TREE_OPERAND (exp, 0)))) return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)), - TREE_OPERAND (exp, 1), TREE_OPERAND (exp, 2)); + TREE_OPERAND (exp, 1), NULL_TREE); /* If this is a fat pointer or a scalar, just make a SAVE_EXPR. Likewise for a CALL_EXPR as large objects are returned via invisible reference @@ -2610,7 +2610,7 @@ gnat_stabilize_reference_1 (tree e, void *data) result = build3 (code, type, gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), data), - TREE_OPERAND (e, 1), TREE_OPERAND (e, 2)); + TREE_OPERAND (e, 1), NULL_TREE); /* If the expression has side-effects, then encase it in a SAVE_EXPR so that it will only be evaluated once. */ /* 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) gnat_rewrite_reference (TREE_OPERAND (ref, 0), func, data, init), func (TREE_OPERAND (ref, 1), data), - TREE_OPERAND (ref, 2), TREE_OPERAND (ref, 3)); + TREE_OPERAND (ref, 2), NULL_TREE); break; case COMPOUND_EXPR: @@ -2796,9 +2796,6 @@ get_inner_constant_reference (tree exp) break; case COMPONENT_REF: - if (TREE_OPERAND (exp, 2)) - return NULL_TREE; - if (!TREE_CONSTANT (DECL_FIELD_OFFSET (TREE_OPERAND (exp, 1)))) return NULL_TREE; break; @@ -2806,7 +2803,7 @@ get_inner_constant_reference (tree exp) case ARRAY_REF: case ARRAY_RANGE_REF: { - if (TREE_OPERAND (exp, 2) || TREE_OPERAND (exp, 3)) + if (TREE_OPERAND (exp, 2)) return NULL_TREE; tree array_type = TREE_TYPE (TREE_OPERAND (exp, 0)); @@ -2934,16 +2931,12 @@ gnat_invariant_expr (tree expr) switch (TREE_CODE (t)) { case COMPONENT_REF: - if (TREE_OPERAND (t, 2)) - return NULL_TREE; invariant_p |= DECL_INVARIANT_P (TREE_OPERAND (t, 1)); break; case ARRAY_REF: case ARRAY_RANGE_REF: - if (!TREE_CONSTANT (TREE_OPERAND (t, 1)) - || TREE_OPERAND (t, 2) - || TREE_OPERAND (t, 3)) + if (!TREE_CONSTANT (TREE_OPERAND (t, 1)) || TREE_OPERAND (t, 2)) return NULL_TREE; break; |