2011-08-02 Eric Botcazou <ebotcazou@adacore.com>
* einfo.adb (Base_Type): Tune implementation for speed.
2011-08-02 Robert Dewar <dewar@adacore.com>
* freeze.adb: Minor reformatting.
From-SVN: r177122
+2011-08-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * einfo.adb (Base_Type): Tune implementation for speed.
+
+2011-08-02 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb: Minor reformatting.
+
2011-08-02 Thomas Quinot <quinot@adacore.com>
* scos.ads: Update comments.
---------------
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 |
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;
-------------------------
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;