aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2011-11-04 13:57:31 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2011-11-04 14:57:31 +0100
commit6ec084f3873a3216c212713722d75084ca146eff (patch)
treed78cb5ec9db0f084421ecef02223389ae376f264 /gcc
parent73fe16797b7cc9e9a41794780d7e448b1d4b2b1e (diff)
downloadgcc-6ec084f3873a3216c212713722d75084ca146eff.zip
gcc-6ec084f3873a3216c212713722d75084ca146eff.tar.gz
gcc-6ec084f3873a3216c212713722d75084ca146eff.tar.bz2
exp_alfa.adb: Add local constant Disable_Processing_Of_Renamings;
2011-11-04 Hristian Kirtchev <kirtchev@adacore.com> * exp_alfa.adb: Add local constant Disable_Processing_Of_Renamings; (Expand_Alfa_N_Object_Renaming_Declaration): Disable the name evaluation of object renamings for now. (Expand_Potential_Renaming): Do not perform the substitution for now. * exp_util.adb (Remove_Side_Effects): Remove processing for functions with side effects in Alfa mode. From-SVN: r180953
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/exp_alfa.adb10
-rw-r--r--gcc/ada/exp_util.adb80
3 files changed, 52 insertions, 49 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 41bd2b6..be2dcea 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2011-11-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_alfa.adb: Add local constant
+ Disable_Processing_Of_Renamings;
+ (Expand_Alfa_N_Object_Renaming_Declaration): Disable
+ the name evaluation of object renamings for now.
+ (Expand_Potential_Renaming): Do not perform the substitution
+ for now.
+ * exp_util.adb (Remove_Side_Effects): Remove processing for
+ functions with side effects in Alfa mode.
+
2011-11-04 Gary Dismukes <dismukes@adacore.com>
* bindgen.adb (Gen_Elab_Calls): In the case
diff --git a/gcc/ada/exp_alfa.adb b/gcc/ada/exp_alfa.adb
index 7dcecfd..844fe89 100644
--- a/gcc/ada/exp_alfa.adb
+++ b/gcc/ada/exp_alfa.adb
@@ -42,6 +42,8 @@ with Tbuild; use Tbuild;
package body Exp_Alfa is
+ Disable_Processing_Of_Renamings : constant Boolean := True;
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -209,6 +211,10 @@ package body Exp_Alfa is
procedure Expand_Alfa_N_Object_Renaming_Declaration (N : Node_Id) is
begin
+ if Disable_Processing_Of_Renamings then
+ return;
+ end if;
+
-- Unconditionally remove all side effects from the name
Evaluate_Name (Name (N));
@@ -297,6 +303,10 @@ package body Exp_Alfa is
T : constant Entity_Id := Etype (N);
begin
+ if Disable_Processing_Of_Renamings then
+ return;
+ end if;
+
-- Substitute a reference to a renaming with the actual renamed object
if Present (Renamed_Object (E)) then
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index aa33066..bbad712 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -168,23 +168,30 @@ package body Exp_Util is
Msg_Node : Node_Id;
begin
-
case Nkind (Parent (N)) is
- when N_Attribute_Reference |
- -- Nothing to do if we are the prefix of an attribute, since we
- -- do not want an atomic sync operation for things like 'Size.
+ -- Check for cases of appearing in the prefix of a construct where
+ -- we don't need atomic synchronization for this kind of usage.
+
+ when
+ -- Nothing to do if we are the prefix of an attribute, since we
+ -- do not want an atomic sync operation for things like 'Size.
+
+ N_Attribute_Reference |
+
+ -- The N_Reference node is like an attribute
N_Reference |
- -- Likewise for a mere reference
+ -- Nothing to do for a reference to a component (or components)
+ -- of a composite object. Only reads and updates of the object
+ -- as a whole require atomic synchronization (RM C.6 (15)).
N_Indexed_Component |
N_Selected_Component |
N_Slice =>
- -- The C.6(15) clause says that only reads and updates of the
- -- object as a whole require atomic synchronization.
+ -- For all the above cases, nothing to do if we are the prefix
if Prefix (Parent (N)) = N then
return;
@@ -6547,57 +6554,32 @@ package body Exp_Util is
end;
end if;
- Def_Id := Make_Temporary (Loc, 'R', Exp);
- Set_Etype (Def_Id, Exp_Type);
-
- -- The regular expansion of functions with side effects involves the
- -- generation of an access type to capture the return value found on
- -- the secondary stack. Since Alfa (and why) cannot process access
- -- types, use a different approach which ignores the secondary stack
- -- and "copies" the returned object.
-
- if Alfa_Mode then
- Res := New_Reference_To (Def_Id, Loc);
- Ref_Type := Exp_Type;
-
- -- Regular expansion utilizing an access type and 'reference
+ Ref_Type := Make_Temporary (Loc, 'A');
- else
- Res :=
- Make_Explicit_Dereference (Loc,
- Prefix => New_Reference_To (Def_Id, Loc));
+ Ptr_Typ_Decl :=
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Ref_Type,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present => True,
+ Subtype_Indication =>
+ New_Reference_To (Exp_Type, Loc)));
- -- Generate:
- -- type Ann is access all <Exp_Type>;
-
- Ref_Type := Make_Temporary (Loc, 'A');
+ E := Exp;
+ Insert_Action (Exp, Ptr_Typ_Decl);
- Ptr_Typ_Decl :=
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Ref_Type,
- Type_Definition =>
- Make_Access_To_Object_Definition (Loc,
- All_Present => True,
- Subtype_Indication =>
- New_Reference_To (Exp_Type, Loc)));
+ Def_Id := Make_Temporary (Loc, 'R', Exp);
+ Set_Etype (Def_Id, Exp_Type);
- Insert_Action (Exp, Ptr_Typ_Decl);
- end if;
+ Res :=
+ Make_Explicit_Dereference (Loc,
+ Prefix => New_Reference_To (Def_Id, Loc));
- E := Exp;
if Nkind (E) = N_Explicit_Dereference then
New_Exp := Relocate_Node (Prefix (E));
else
E := Relocate_Node (E);
-
- -- Do not generate a 'reference in Alfa since the access type is
- -- not generated.
-
- if Alfa_Mode then
- New_Exp := E;
- else
- New_Exp := Make_Reference (Loc, E);
- end if;
+ New_Exp := Make_Reference (Loc, E);
end if;
if Is_Delayed_Aggregate (E) then