From bba760a5730a052ac5ab7eac0c92205731c392aa Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 2 Aug 2011 10:07:34 +0000 Subject: [PATCH] 2011-08-02 Eric Botcazou * einfo.adb (Base_Type): Tune implementation for speed. 2011-08-02 Robert Dewar * freeze.adb: Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177122 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/einfo.adb | 16 ++++++++++++++-- gcc/ada/freeze.adb | 3 +-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1bba5f3..a78d1b9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2011-08-02 Eric Botcazou + + * einfo.adb (Base_Type): Tune implementation for speed. + +2011-08-02 Robert Dewar + + * freeze.adb: Minor reformatting. + 2011-08-02 Thomas Quinot * scos.ads: Update comments. diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index 408f3c5..662af67 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -5608,7 +5608,13 @@ package body Einfo is --------------- function Base_Type (Id : E) return E is + Is_Base_Type : Boolean; begin + -- Implementation note: this function shows up high in the profile. + -- We use a fully static case construct so as to make it easier for + -- the compiler to build a static table out of it, instead of using + -- a less efficient jump table. + case Ekind (Id) is when E_Enumeration_Subtype | E_Incomplete_Type | @@ -5628,11 +5634,17 @@ package body Einfo is E_Task_Subtype | E_String_Literal_Subtype | E_Class_Wide_Subtype => - return Etype (Id); + Is_Base_Type := False; when others => - return Id; + Is_Base_Type := True; end case; + + if Is_Base_Type then + return Id; + end if; + + return Etype (Id); end Base_Type; ------------------------- diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 08aed55..0db5459 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -2455,8 +2455,7 @@ package body Freeze is and then Nkind (Parent (E)) = N_Object_Declaration and then Present (Expression (Parent (E))) and then Nkind (Expression (Parent (E))) = N_Aggregate - and then - Is_Atomic_Aggregate (Expression (Parent (E)), Etype (E)) + and then Is_Atomic_Aggregate (Expression (Parent (E)), Etype (E)) then null; end if; -- 2.7.4