diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2007-09-08 10:30:06 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2007-09-08 10:30:06 +0000 |
commit | 79646678b52a9c63f19ce74a2471291aae1d59a4 (patch) | |
tree | e298e197d6ac93776440288b70e8a3888ecd21df /gcc/ada | |
parent | 3b9f15d25672cf8dcaf66cee2eb80108aa07ba57 (diff) | |
download | gcc-79646678b52a9c63f19ce74a2471291aae1d59a4.zip gcc-79646678b52a9c63f19ce74a2471291aae1d59a4.tar.gz gcc-79646678b52a9c63f19ce74a2471291aae1d59a4.tar.bz2 |
decl.c (gnat_to_gnu_entity): Simplify the condition under which a constant renaming is treated as a normal...
* decl.c (gnat_to_gnu_entity) <Object>: Simplify the condition under
which a constant renaming is treated as a normal object declaration.
* trans.c (lvalue_required_p) <N_Slice>: New case, extracted from
the N_Indexed_Component case.
<N_Indexed_Component>: Fall through to above case.
<N_Object_Renaming_Declaration>: Return true for all composite types.
From-SVN: r128268
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/decl.c | 5 | ||||
-rw-r--r-- | gcc/ada/trans.c | 20 |
3 files changed, 24 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e23d6b8..3c5969d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,14 @@ 2007-09-08 Eric Botcazou <ebotcazou@adacore.com> + * decl.c (gnat_to_gnu_entity) <Object>: Simplify the condition under + which a constant renaming is treated as a normal object declaration. + * trans.c (lvalue_required_p) <N_Slice>: New case, extracted from + the N_Indexed_Component case. + <N_Indexed_Component>: Fall through to above case. + <N_Object_Renaming_Declaration>: Return true for all composite types. + +2007-09-08 Eric Botcazou <ebotcazou@adacore.com> + * decl.c (make_packable_type): If the new type has been given BLKmode, try again to get an integral mode for it. diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 7a01327..202cca8 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -815,10 +815,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* Case 3: If this is a constant renaming and creating a new object is allowed and cheap, treat it as a normal object whose initial value is what is being renamed. */ - if (const_flag - && Ekind (Etype (gnat_entity)) != E_Class_Wide_Type - && TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE - && TYPE_MODE (gnu_type) != BLKmode) + if (const_flag && Is_Elementary_Type (Etype (gnat_entity))) ; /* Case 4: Make this into a constant pointer to the object we diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 2479775..1a4067c 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -384,20 +384,28 @@ lvalue_required_p (Node_Id gnat_node, tree operand_type, int aliased) gnat_temp = Next (gnat_temp)) if (Nkind (gnat_temp) != N_Integer_Literal) return 1; - aliased |= Has_Aliased_Components (Etype (Prefix (gnat_node))); - return lvalue_required_p (Parent (gnat_node), operand_type, aliased); } + /* ... fall through ... */ + + case N_Slice: + aliased |= Has_Aliased_Components (Etype (Prefix (gnat_node))); + return lvalue_required_p (Parent (gnat_node), operand_type, aliased); + case N_Selected_Component: aliased |= Is_Aliased (Entity (Selector_Name (gnat_node))); return lvalue_required_p (Parent (gnat_node), operand_type, aliased); case N_Object_Renaming_Declaration: /* We need to make a real renaming only if the constant object is - aliased; otherwise we can optimize and return the rvalue. We - make an exception if the object is an identifier since in this - case the rvalue can be propagated attached to the CONST_DECL. */ - return aliased || Nkind (Name (gnat_node)) == N_Identifier; + aliased or if we may use a renaming pointer; otherwise we can + optimize and return the rvalue. We make an exception if the object + is an identifier since in this case the rvalue can be propagated + attached to the CONST_DECL. */ + return (aliased != 0 + /* This should match the constant case of the renaming code. */ + || Is_Composite_Type (Etype (Name (gnat_node))) + || Nkind (Name (gnat_node)) == N_Identifier); default: return 0; |