Commit f8726f2b by Arnaud Charlet

[multiple changes]

2011-08-02  Eric Botcazou  <ebotcazou@adacore.com>

	* inline.adb (Add_Inlined_Body): Adjust check for library-level inlined
	functions to previous change.  Reorganize code slightly.

2011-08-02  Geert Bosch  <bosch@adacore.com>

	* back_end.ads (Register_Type_Proc): New call back procedure type for
	allowing the back end to provide information about available types.
	(Register_Back_End_Types): New procedure to register back end types.
	* back_end.adb (Register_Back_End_Types): Call the back end to enumerate
	available types.
	* cstand.adb (Back_End_Float_Types): New list for floating point types
	supported by the back end.
	(Build_Float_Type): Add extra parameter for Float_Rep_Kind.
	(Copy_Float_Type): New procedure to make new copies of predefined types.
	(Register_Float_Type): New call back procedure to populate the BEFT list
	(Find_Back_End_Float_Type): New procedure to find a BEFT by name
	(Create_Back_End_Float_Types): New procedure to populate the BEFT list.
	(Create_Float_Types): New procedure to create entities for floating
	point types predefined in Standard, and put these and any remaining
	BEFTs on the Predefined_Float_Types list.
	* stand.ads (Predefined_Float_Types): New list for predefined floating
	point types that do not have declarations in package Standard.

From-SVN: r177137
parent feecad68
2011-08-02 Eric Botcazou <ebotcazou@adacore.com> 2011-08-02 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Add_Inlined_Body): Adjust check for library-level inlined
functions to previous change. Reorganize code slightly.
2011-08-02 Geert Bosch <bosch@adacore.com>
* back_end.ads (Register_Type_Proc): New call back procedure type for
allowing the back end to provide information about available types.
(Register_Back_End_Types): New procedure to register back end types.
* back_end.adb (Register_Back_End_Types): Call the back end to enumerate
available types.
* cstand.adb (Back_End_Float_Types): New list for floating point types
supported by the back end.
(Build_Float_Type): Add extra parameter for Float_Rep_Kind.
(Copy_Float_Type): New procedure to make new copies of predefined types.
(Register_Float_Type): New call back procedure to populate the BEFT list
(Find_Back_End_Float_Type): New procedure to find a BEFT by name
(Create_Back_End_Float_Types): New procedure to populate the BEFT list.
(Create_Float_Types): New procedure to create entities for floating
point types predefined in Standard, and put these and any remaining
BEFTs on the Predefined_Float_Types list.
* stand.ads (Predefined_Float_Types): New list for predefined floating
point types that do not have declarations in package Standard.
2011-08-02 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Get_Code_Unit_Entity): New local function. Returns the * inline.adb (Get_Code_Unit_Entity): New local function. Returns the
entity node for the unit containing the parameter. entity node for the unit containing the parameter.
(Add_Inlined_Body): Use it to find the unit containing the subprogram. (Add_Inlined_Body): Use it to find the unit containing the subprogram.
......
...@@ -325,4 +325,16 @@ package body Back_End is ...@@ -325,4 +325,16 @@ package body Back_End is
Next_Arg := Next_Arg + 1; Next_Arg := Next_Arg + 1;
end loop; end loop;
end Scan_Compiler_Arguments; end Scan_Compiler_Arguments;
-----------------------------
-- Register_Back_End_Types --
-----------------------------
procedure Register_Back_End_Types (Call_Back : Register_Type_Proc) is
procedure Enumerate_Modes (Call_Back : Register_Type_Proc);
pragma Import (C, Enumerate_Modes, "enumerate_modes");
begin
Enumerate_Modes (Call_Back);
end Register_Back_End_Types;
end Back_End; end Back_End;
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
-- Call the back end with all the information needed. Also contains other -- Call the back end with all the information needed. Also contains other
-- back-end specific interfaces required by the front end. -- back-end specific interfaces required by the front end.
with Einfo; use Einfo;
package Back_End is package Back_End is
type Back_End_Mode_Type is ( type Back_End_Mode_Type is (
...@@ -44,6 +46,25 @@ package Back_End is ...@@ -44,6 +46,25 @@ package Back_End is
pragma Convention (C, Back_End_Mode_Type); pragma Convention (C, Back_End_Mode_Type);
for Back_End_Mode_Type use (0, 1, 2); for Back_End_Mode_Type use (0, 1, 2);
type C_String is array (0 .. 255) of aliased Character;
pragma Convention (C, C_String);
type Register_Type_Proc is access procedure
(C_Name : C_String; -- Nul-terminated string with name of type
Digs : Natural; -- Nr or digits for floating point, 0 otherwise
Complex : Boolean; -- True iff type has real and imaginary parts
Count : Natural; -- Number of elements in vector, 0 otherwise
Float_Rep : Float_Rep_Kind; -- Representation used for fpt type
Size : Positive; -- Size of representation in bits
Alignment : Natural); -- Required alignment in bits
pragma Convention (C, Register_Type_Proc);
-- Call back procedure for Register_Back_End_Types. This is to be used by
-- Create_Standard to create predefined types for all types supported by
-- the back end.
procedure Register_Back_End_Types (Call_Back : Register_Type_Proc);
-- Calls the Call_Back function with information for each supported type.
procedure Call_Back_End (Mode : Back_End_Mode_Type); procedure Call_Back_End (Mode : Back_End_Mode_Type);
-- Call back end, i.e. make call to driver traversing the tree and -- Call back end, i.e. make call to driver traversing the tree and
-- outputting code. This call is made with all tables locked. -- outputting code. This call is made with all tables locked.
......
...@@ -236,7 +236,6 @@ package body Inline is ...@@ -236,7 +236,6 @@ package body Inline is
---------------------- ----------------------
procedure Add_Inlined_Body (E : Entity_Id) is procedure Add_Inlined_Body (E : Entity_Id) is
Pack : Entity_Id;
function Must_Inline return Boolean; function Must_Inline return Boolean;
-- Inlining is only done if the call statement N is in the main unit, -- Inlining is only done if the call statement N is in the main unit,
...@@ -318,35 +317,39 @@ package body Inline is ...@@ -318,35 +317,39 @@ package body Inline is
-- no enclosing package to retrieve. In this case, it is the body of -- no enclosing package to retrieve. In this case, it is the body of
-- the function that will have to be loaded. -- the function that will have to be loaded.
if not Is_Abstract_Subprogram (E) and then not Is_Nested (E) if not Is_Abstract_Subprogram (E)
and then not Is_Nested (E)
and then Convention (E) /= Convention_Protected and then Convention (E) /= Convention_Protected
and then Must_Inline
then then
Pack := Get_Code_Unit_Entity (E); declare
Pack : constant Entity_Id := Get_Code_Unit_Entity (E);
if Must_Inline
and then Ekind (Pack) = E_Package
then
Set_Is_Called (E);
if Pack = Standard_Standard then begin
if Pack = E then
-- Library-level inlined function. Add function itself to -- Library-level inlined function. Add function itself to
-- list of needed units. -- list of needed units.
Set_Is_Called (E);
Inlined_Bodies.Increment_Last; Inlined_Bodies.Increment_Last;
Inlined_Bodies.Table (Inlined_Bodies.Last) := E; Inlined_Bodies.Table (Inlined_Bodies.Last) := E;
elsif Is_Generic_Instance (Pack) then elsif Ekind (Pack) = E_Package then
null; Set_Is_Called (E);
elsif not Is_Inlined (Pack) if Is_Generic_Instance (Pack) then
and then not Has_Completion (E) null;
then
Set_Is_Inlined (Pack); elsif not Is_Inlined (Pack)
Inlined_Bodies.Increment_Last; and then not Has_Completion (E)
Inlined_Bodies.Table (Inlined_Bodies.Last) := Pack; then
Set_Is_Inlined (Pack);
Inlined_Bodies.Increment_Last;
Inlined_Bodies.Table (Inlined_Bodies.Last) := Pack;
end if;
end if; end if;
end if; end;
end if; end if;
end Add_Inlined_Body; end Add_Inlined_Body;
......
...@@ -229,9 +229,9 @@ package Stand is ...@@ -229,9 +229,9 @@ package Stand is
type Standard_Entity_Array_Type is array (Standard_Entity_Type) of Node_Id; type Standard_Entity_Array_Type is array (Standard_Entity_Type) of Node_Id;
Standard_Entity : Standard_Entity_Array_Type; Standard_Entity : Standard_Entity_Array_Type;
-- This array contains pointers to the Defining Identifier nodes -- This array contains pointers to the Defining Identifier nodes for
-- for each of the entities defined in Standard_Entities_Type. It -- each of the visible entities defined in Standard_Entities_Type. It is
-- is initialized by the Create_Standard procedure. -- initialized by the Create_Standard procedure.
Standard_Package_Node : Node_Id; Standard_Package_Node : Node_Id;
-- Points to the N_Package_Declaration node for standard. Also -- Points to the N_Package_Declaration node for standard. Also
...@@ -343,6 +343,14 @@ package Stand is ...@@ -343,6 +343,14 @@ package Stand is
-- A zero-size subtype of Integer, used as the type of variables used -- A zero-size subtype of Integer, used as the type of variables used
-- to provide the debugger with name encodings for renaming declarations. -- to provide the debugger with name encodings for renaming declarations.
Predefined_Float_Types : List_Id;
-- Entities for predefined floating point types. These are used by
-- the semantic phase to select appropriate types for floating point
-- declarations. This list is ordered by preference. All types up to
-- Long_Long_Float_Type are considered for plain "digits N" declarations,
-- while selection of later types requires a range specification and
-- possibly other attributes or pragmas.
-- The entities labeled Any_xxx are used in situations where the full -- The entities labeled Any_xxx are used in situations where the full
-- characteristics of an entity are not yet known, e.g. Any_Character -- characteristics of an entity are not yet known, e.g. Any_Character
-- is used to label a character literal before resolution is complete. -- is used to label a character literal before resolution is complete.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment