diff options
author | Arnaud Charlet <charlet@adacore.com> | 2018-06-11 09:18:39 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-06-11 09:18:39 +0000 |
commit | 63254915a9dc280e52f033da0fe40441727758c0 (patch) | |
tree | ab1f252e97183e5c33b72a0c66b60f792122f48c | |
parent | 09adaa8d122955d9661b01d2fe005975e1331f46 (diff) | |
download | gcc-63254915a9dc280e52f033da0fe40441727758c0.zip gcc-63254915a9dc280e52f033da0fe40441727758c0.tar.gz gcc-63254915a9dc280e52f033da0fe40441727758c0.tar.bz2 |
[Ada] Simplify expansion of "and then" in CodePeer mode
2018-06-11 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* exp_ch4.adb (Expand_Record_Equality): Remove extraneous "True and
then" and general logical "ada" in codepeer mode.
From-SVN: r261418
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/exp_ch4.adb | 35 |
2 files changed, 29 insertions, 11 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cafac4f..97dbbf3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-06-11 Arnaud Charlet <charlet@adacore.com> + + * exp_ch4.adb (Expand_Record_Equality): Remove extraneous "True and + then" and general logical "ada" in codepeer mode. + 2018-06-11 Javier Miranda <miranda@adacore.com> * exp_ch9.adb (Expand_N_Protected_Body): Add missing handling of diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 0d836f8..c29ba76 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -12154,12 +12154,11 @@ package body Exp_Ch4 is -- Generates the following code: (assuming that Typ has one Discr and -- component C2 is also a record) - -- True - -- and then Lhs.Discr1 = Rhs.Discr1 - -- and then Lhs.C1 = Rhs.C1 - -- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn - -- and then ... - -- and then Lhs.Cmpn = Rhs.Cmpn + -- Lhs.Discr1 = Rhs.Discr1 + -- and then Lhs.C1 = Rhs.C1 + -- and then Lhs.C2.C1=Rhs.C2.C1 and then ... Lhs.C2.Cn=Rhs.C2.Cn + -- and then ... + -- and then Lhs.Cmpn = Rhs.Cmpn Result := New_Occurrence_Of (Standard_True, Loc); C := Element_To_Compare (First_Entity (Typ)); @@ -12171,7 +12170,6 @@ package body Exp_Ch4 is begin if First_Time then - First_Time := False; New_Lhs := Lhs; New_Rhs := Rhs; else @@ -12199,13 +12197,28 @@ package body Exp_Ch4 is Set_Etype (Result, Standard_Boolean); exit; else - Result := - Make_And_Then (Loc, - Left_Opnd => Result, - Right_Opnd => Check); + if First_Time then + Result := Check; + + -- Generate logical "and" for CodePeer to simplify the + -- generated code and analysis. + + elsif CodePeer_Mode then + Result := + Make_Op_And (Loc, + Left_Opnd => Result, + Right_Opnd => Check); + + else + Result := + Make_And_Then (Loc, + Left_Opnd => Result, + Right_Opnd => Check); + end if; end if; end; + First_Time := False; C := Element_To_Compare (Next_Entity (C)); end loop; |