1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- Expand routines for chapter 6 constructs
29 with Types
; use Types
;
33 procedure Expand_N_Function_Call
(N
: Node_Id
);
34 procedure Expand_N_Subprogram_Body
(N
: Node_Id
);
35 procedure Expand_N_Subprogram_Body_Stub
(N
: Node_Id
);
36 procedure Expand_N_Subprogram_Declaration
(N
: Node_Id
);
37 procedure Expand_N_Procedure_Call_Statement
(N
: Node_Id
);
39 procedure Expand_Call
(N
: Node_Id
);
40 -- This procedure contains common processing for Expand_N_Function_Call,
41 -- Expand_N_Procedure_Statement, and Expand_N_Entry_Call.
43 function Is_Build_In_Place_Function
(E
: Entity_Id
) return Boolean;
44 -- Ada 2005 (AI-318-02): Returns True if E denotes a function or an
45 -- access-to-function type whose result must be built in place; otherwise
46 -- returns False. Currently this is restricted to the subset of functions
47 -- whose result subtype is a constrained inherently limited type.
49 function Is_Build_In_Place_Function_Call
(N
: Node_Id
) return Boolean;
50 -- Ada 2005 (AI-318-02): Returns True if N denotes a call to a function
51 -- that requires handling as a build-in-place call or is a qualified
52 -- expression applied to such a call; otherwise returns False.
54 procedure Freeze_Subprogram
(N
: Node_Id
);
55 -- generate the appropriate expansions related to Subprogram freeze
56 -- nodes (e. g. the filling of the corresponding Dispatch Table for
57 -- Primitive Operations)
59 procedure Make_Build_In_Place_Call_In_Allocator
61 Function_Call
: Node_Id
);
62 -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
63 -- occurs as the expression initializing an allocator, by passing access
64 -- to the allocated object as an additional parameter of the function call.
65 -- A new access object is declared that is initialized to the result of the
66 -- allocator, passed to the function, and the allocator is rewritten to
67 -- refer to that access object. Function_Call must denote either an
68 -- N_Function_Call node for which Is_Build_In_Place_Call is True, or else
69 -- an N_Qualified_Expression node applied to such a function call.
71 procedure Make_Build_In_Place_Call_In_Anonymous_Context
72 (Function_Call
: Node_Id
);
73 -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
74 -- occurs in a context that does not provide a separate object. A temporary
75 -- object is created to act as the return object and an access to the
76 -- temporary is passed as an additional parameter of the call. This occurs
77 -- in contexts such as subprogram call actuals and object renamings.
78 -- Function_Call must denote either an N_Function_Call node for which
79 -- Is_Build_In_Place_Call is True, or else an N_Qualified_Expression node
80 -- applied to such a function call.
82 procedure Make_Build_In_Place_Call_In_Assignment
84 Function_Call
: Node_Id
);
85 -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
86 -- occurs as the right-hand side of an assignment statement by passing
87 -- access to the left-hand sid as an additional parameter of the function
88 -- call. Assign must denote a N_Assignment_Statement. Function_Call must
89 -- denote either an N_Function_Call node for which Is_Build_In_Place_Call
90 -- is True, or an N_Qualified_Expression node applied to such a function
93 procedure Make_Build_In_Place_Call_In_Object_Declaration
94 (Object_Decl
: Node_Id
;
95 Function_Call
: Node_Id
);
96 -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
97 -- occurs as the expression initializing an object declaration by
98 -- passing access to the declared object as an additional parameter of the
99 -- function call. Function_Call must denote either an N_Function_Call node
100 -- for which Is_Build_In_Place_Call is True, or an N_Qualified_Expression
101 -- node applied to such a function call.
103 procedure Register_Interface_DT_Entry
104 (Related_Nod
: Node_Id
;
106 -- Ada 2005 (AI-251): Register a primitive in a secondary dispatch table.
107 -- Related_Nod is the node after which the expanded code will be inserted.