OSDN Git Service

PR middle-end/42068
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_ch6.ads
index 219ce70..242995f 100644 (file)
@@ -6,18 +6,17 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license.          --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
@@ -40,22 +39,79 @@ package Exp_Ch6 is
    --  This procedure contains common processing for Expand_N_Function_Call,
    --  Expand_N_Procedure_Statement, and Expand_N_Entry_Call.
 
+   procedure Freeze_Subprogram (N : Node_Id);
+   --  generate the appropriate expansions related to Subprogram freeze
+   --  nodes (e.g. the filling of the corresponding Dispatch Table for
+   --  Primitive Operations)
+
+   --  The following type defines the various forms of allocation used for the
+   --  results of build-in-place function calls.
+
+   type BIP_Allocation_Form is
+     (Unspecified,
+      Caller_Allocation,
+      Secondary_Stack,
+      Global_Heap,
+      User_Storage_Pool);
+
+   type BIP_Formal_Kind is
+   --  Ada 2005 (AI-318-02): This type defines the kinds of implicit extra
+   --  formals created for build-in-place functions. The order of the above
+   --  enumeration literals matches the order in which the formals are
+   --  declared. See Sem_Ch6.Create_Extra_Formals.
+     (BIP_Alloc_Form,
+      --  Present if result subtype is unconstrained, or if the result type
+      --  is tagged. Indicates whether the return object is allocated by the
+      --  caller or callee, and if the callee, whether to use the secondary
+      --  stack or the heap. See Create_Extra_Formals.
+      BIP_Final_List,
+      --  Present if result type needs finalization. Pointer to caller's
+      --  finalization list.
+      BIP_Master,
+      --  Present if result type contains tasks. Master associated with
+      --  calling context.
+      BIP_Activation_Chain,
+      --  Present if result type contains tasks. Caller's activation chain
+      BIP_Object_Access);
+      --  Present for all build-in-place functions. Address at which to place
+      --  the return object, or null if BIP_Alloc_Form indicates
+      --  allocated by callee.
+      --  ??? We also need to be able to pass in some way to access a
+      --  user-defined storage pool at some point. And perhaps a constrained
+      --  flag.
+
+   function BIP_Formal_Suffix (Kind : BIP_Formal_Kind) return String;
+   --  Ada 2005 (AI-318-02): Returns a string to be used as the suffix of names
+   --  for build-in-place formal parameters of the given kind.
+
+   function Build_In_Place_Formal
+     (Func : Entity_Id;
+      Kind : BIP_Formal_Kind) return Entity_Id;
+   --  Ada 2005 (AI-318-02): Locates and returns the entity for the implicit
+   --  build-in-place formal parameter of the given kind associated with the
+   --  function Func, and returns its Entity_Id. It is a bug if not found; the
+   --  caller should ensure this is called only when the extra formal exists.
+
    function Is_Build_In_Place_Function (E : Entity_Id) return Boolean;
-   --  Ada 2005 (AI-318-02): Returns True if E denotes a function or an
-   --  access-to-function type whose result must be built in place; otherwise
-   --  returns False. Currently this is restricted to the subset of functions
-   --  whose result subtype is a constrained inherently limited type.
+   --  Ada 2005 (AI-318-02): Returns True if E denotes a function, generic
+   --  function, or access-to-function type whose result must be built in
+   --  place; otherwise returns False. For Ada 2005, this is currently
+   --  restricted to the set of functions whose result subtype is an inherently
+   --  limited type. In Ada 95, this must be False for inherently limited
+   --  result types (but currently returns False for all Ada 95 functions).
+   --  Eventually we plan to support build-in-place for nonlimited types.
+   --  Build-in-place is usually more efficient for large things, and less
+   --  efficient for small things. However, we never use build-in-place if the
+   --  convention is other than Ada, because that would disturb mixed-language
+   --  programs. Note that for the non-inherently-limited cases, we must make
+   --  the same decision for Ada 95 and 2005, so that mixed-dialect programs
+   --  will work.
 
    function Is_Build_In_Place_Function_Call (N : Node_Id) return Boolean;
    --  Ada 2005 (AI-318-02): Returns True if N denotes a call to a function
    --  that requires handling as a build-in-place call or is a qualified
    --  expression applied to such a call; otherwise returns False.
 
-   procedure Freeze_Subprogram (N : Node_Id);
-   --  generate the appropriate expansions related to Subprogram freeze
-   --  nodes (e. g. the filling of the corresponding Dispatch Table for
-   --  Primitive Operations)
-
    procedure Make_Build_In_Place_Call_In_Allocator
      (Allocator     : Node_Id;
       Function_Call : Node_Id);
@@ -84,7 +140,7 @@ package Exp_Ch6 is
       Function_Call : Node_Id);
    --  Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
    --  occurs as the right-hand side of an assignment statement by passing
-   --  access to the left-hand sid as an additional parameter of the function
+   --  access to the left-hand side as an additional parameter of the function
    --  call. Assign must denote a N_Assignment_Statement. Function_Call must
    --  denote either an N_Function_Call node for which Is_Build_In_Place_Call
    --  is True, or an N_Qualified_Expression node applied to such a function
@@ -100,10 +156,9 @@ package Exp_Ch6 is
    --  for which Is_Build_In_Place_Call is True, or an N_Qualified_Expression
    --  node applied to such a function call.
 
-   procedure Register_Interface_DT_Entry
-     (Related_Nod : Node_Id;
-      Prim        : Entity_Id);
-   --  Ada 2005 (AI-251): Register a primitive in a secondary dispatch table.
-   --  Related_Nod is the node after which the expanded code will be inserted.
+   function Needs_BIP_Final_List (E : Entity_Id) return Boolean;
+   --  ???pragma Precondition (Is_Build_In_Place_Function (E));
+   --  Ada 2005 (AI-318-02): Returns True if the function needs the
+   --  BIP_Final_List implicit parameter.
 
 end Exp_Ch6;