1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2010, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Einfo
; use Einfo
;
27 with Nlists
; use Nlists
;
28 with Nmake
; use Nmake
;
29 with Rtsfind
; use Rtsfind
;
30 with Stand
; use Stand
;
31 with Tbuild
; use Tbuild
;
33 package body Exp_Sel
is
35 -----------------------
36 -- Build_Abort_Block --
37 -----------------------
39 function Build_Abort_Block
41 Abr_Blk_Ent
: Entity_Id
;
42 Cln_Blk_Ent
: Entity_Id
;
43 Blk
: Node_Id
) return Node_Id
47 Make_Block_Statement
(Loc
,
48 Identifier
=> New_Reference_To
(Abr_Blk_Ent
, Loc
),
50 Declarations
=> No_List
,
52 Handled_Statement_Sequence
=>
53 Make_Handled_Sequence_Of_Statements
(Loc
,
56 Make_Implicit_Label_Declaration
(Loc
,
57 Defining_Identifier
=>
65 Make_Implicit_Exception_Handler
(Loc
,
68 New_Reference_To
(Stand
.Abort_Signal
, Loc
)),
71 Make_Procedure_Call_Statement
(Loc
,
73 New_Reference_To
(RTE
(
74 RE_Abort_Undefer
), Loc
),
75 Parameter_Associations
=> No_List
))))));
76 end Build_Abort_Block
;
84 Decls
: List_Id
) return Entity_Id
86 B
: constant Entity_Id
:= Make_Temporary
(Loc
, 'B');
89 Make_Object_Declaration
(Loc
,
90 Defining_Identifier
=> B
,
91 Object_Definition
=> New_Reference_To
(Standard_Boolean
, Loc
),
92 Expression
=> New_Reference_To
(Standard_False
, Loc
)));
102 Decls
: List_Id
) return Entity_Id
104 C
: constant Entity_Id
:= Make_Temporary
(Loc
, 'C');
107 Make_Object_Declaration
(Loc
,
108 Defining_Identifier
=> C
,
109 Object_Definition
=> New_Reference_To
(RTE
(RE_Prim_Op_Kind
), Loc
)));
113 -------------------------
114 -- Build_Cleanup_Block --
115 -------------------------
117 function Build_Cleanup_Block
121 Clean_Ent
: Entity_Id
) return Node_Id
123 Cleanup_Block
: constant Node_Id
:=
124 Make_Block_Statement
(Loc
,
125 Identifier
=> New_Reference_To
(Blk_Ent
, Loc
),
126 Declarations
=> No_List
,
127 Handled_Statement_Sequence
=>
128 Make_Handled_Sequence_Of_Statements
(Loc
,
129 Statements
=> Stmts
),
130 Is_Asynchronous_Call_Block
=> True);
133 Set_Entry_Cancel_Parameter
(Blk_Ent
, Clean_Ent
);
135 return Cleanup_Block
;
136 end Build_Cleanup_Block
;
145 Obj
: Entity_Id
) return Entity_Id
147 K
: constant Entity_Id
:= Make_Temporary
(Loc
, 'K');
150 Make_Object_Declaration
(Loc
,
151 Defining_Identifier
=> K
,
153 New_Reference_To
(RTE
(RE_Tagged_Kind
), Loc
),
155 Make_Function_Call
(Loc
,
156 Name
=> New_Reference_To
(RTE
(RE_Get_Tagged_Kind
), Loc
),
157 Parameter_Associations
=> New_List
(
158 Unchecked_Convert_To
(RTE
(RE_Tag
), Obj
)))));
168 Decls
: List_Id
) return Entity_Id
170 S
: constant Entity_Id
:= Make_Temporary
(Loc
, 'S');
173 Make_Object_Declaration
(Loc
,
174 Defining_Identifier
=> S
,
175 Object_Definition
=> New_Reference_To
(Standard_Integer
, Loc
)));
179 ------------------------
180 -- Build_S_Assignment --
181 ------------------------
183 function Build_S_Assignment
187 Call_Ent
: Entity_Id
) return Node_Id
191 Make_Assignment_Statement
(Loc
,
192 Name
=> New_Reference_To
(S
, Loc
),
194 Make_Function_Call
(Loc
,
195 Name
=> New_Reference_To
(RTE
(RE_Get_Offset_Index
), Loc
),
196 Parameter_Associations
=> New_List
(
197 Unchecked_Convert_To
(RTE
(RE_Tag
), Obj
),
198 Make_Integer_Literal
(Loc
, DT_Position
(Call_Ent
)))));
199 end Build_S_Assignment
;