OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [ada/] [inline.ads] - Blame information for rev 843

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                               I N L I N E                                --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
10
--                                                                          --
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.          --
20
--                                                                          --
21
-- GNAT was originally developed  by the GNAT team at  New York University. --
22
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23
--                                                                          --
24
------------------------------------------------------------------------------
25
 
26
--  This module handles two kinds of inlining activity:
27
 
28
--  a) Instantiation of generic bodies. This is done unconditionally, after
29
--  analysis and expansion of the main unit.
30
 
31
--  b) Compilation of unit bodies that contain the bodies of inlined sub-
32
--  programs. This is done only if inlining is enabled (-gnatn). Full inlining
33
--  requires that a) an b) be mutually recursive, because each step may
34
--  generate another generic expansion and further inlined calls. For now each
35
--  of them uses a workpile algorithm, but they are called independently from
36
--  Frontend, and thus are not mutually recursive.
37
 
38
with Alloc;
39
with Sem;   use Sem;
40
with Table;
41
with Types; use Types;
42
 
43
package Inline is
44
 
45
   --------------------------------
46
   -- Generic Body Instantiation --
47
   --------------------------------
48
 
49
   --  The bodies of generic instantiations are built after semantic analysis
50
   --  of the main unit is complete. Generic instantiations are saved in a
51
   --  global data structure, and the bodies constructed by means of a separate
52
   --  analysis and expansion step.
53
 
54
   --  See full description in body of Sem_Ch12 for more details
55
 
56
   type Pending_Body_Info is record
57
      Inst_Node : Node_Id;
58
      --  Node for instantiation that requires the body
59
 
60
      Act_Decl : Node_Id;
61
      --  Declaration for package or subprogram spec for instantiation
62
 
63
      Expander_Status : Boolean;
64
      --  If the body is instantiated only for semantic checking, expansion
65
      --  must be inhibited.
66
 
67
      Current_Sem_Unit : Unit_Number_Type;
68
      --  The semantic unit within which the instantiation is found. Must
69
      --  be restored when compiling the body, to insure that internal enti-
70
      --  ties use the same counter and are unique over spec and body.
71
 
72
      Scope_Suppress           : Suppress_Array;
73
      Local_Suppress_Stack_Top : Suppress_Stack_Entry_Ptr;
74
      --  Save suppress information at the point of instantiation. Used to
75
      --  properly inherit check status active at this point (see RM 11.5
76
      --  (7.2/2), AI95-00224-01):
77
      --
78
      --    "If a checking pragma applies to a generic instantiation, then the
79
      --    checking pragma also applies to the instance. If a checking pragma
80
      --    applies to a call to a subprogram that has a pragma Inline applied
81
      --    to it, then the checking pragma also applies to the inlined
82
      --    subprogram body".
83
      --
84
      --  This means we have to capture this information from the current scope
85
      --  at the point of instantiation.
86
 
87
   end record;
88
 
89
   package Pending_Instantiations is new Table.Table (
90
     Table_Component_Type => Pending_Body_Info,
91
     Table_Index_Type     => Int,
92
     Table_Low_Bound      => 0,
93
     Table_Initial        => Alloc.Pending_Instantiations_Initial,
94
     Table_Increment      => Alloc.Pending_Instantiations_Increment,
95
     Table_Name           => "Pending_Instantiations");
96
 
97
   --  The following table records subprograms and packages for which
98
   --  generation of subprogram descriptors must be delayed.
99
 
100
   package Pending_Descriptor is new Table.Table (
101
     Table_Component_Type => Entity_Id,
102
     Table_Index_Type     => Int,
103
     Table_Low_Bound      => 0,
104
     Table_Initial        => Alloc.Pending_Instantiations_Initial,
105
     Table_Increment      => Alloc.Pending_Instantiations_Increment,
106
     Table_Name           => "Pending_Descriptor");
107
 
108
   Analyzing_Inlined_Bodies : Boolean;
109
   --  This flag is set False by the call to Initialize, and then is set
110
   --  True by the call to Analyze_Inlined_Bodies. It is used to suppress
111
   --  generation of subprogram descriptors for inlined bodies.
112
 
113
   -----------------
114
   -- Subprograms --
115
   -----------------
116
 
117
   procedure Initialize;
118
   --  Initialize internal tables
119
 
120
   procedure Lock;
121
   --  Lock internal tables before calling backend
122
 
123
   procedure Instantiate_Bodies;
124
   --  This procedure is called after semantic analysis is complete, to
125
   --  instantiate the bodies of generic instantiations that appear in the
126
   --  compilation unit.
127
 
128
   procedure Add_Inlined_Body (E : Entity_Id);
129
   --  E is an inlined subprogram appearing in a call, either explicitly, or
130
   --  a discriminant check for which gigi builds a call.  Add E's enclosing
131
   --  unit to Inlined_Bodies so that body of E can be subsequently retrieved
132
   --  and analyzed.
133
 
134
   procedure Analyze_Inlined_Bodies;
135
   --  At end of compilation, analyze the bodies of all units that contain
136
   --  inlined subprograms that are actually called.
137
 
138
   procedure Check_Body_For_Inlining (N : Node_Id; P : Entity_Id);
139
   --  If front-end inlining is enabled and a package declaration contains
140
   --  inlined subprograms, load and compile the package body to collect the
141
   --  bodies of these subprograms, so they are available to inline calls.
142
   --  N is the compilation unit for the package.
143
 
144
   procedure Remove_Dead_Instance (N : Node_Id);
145
   --  If an instantiation appears in unreachable code, delete the pending
146
   --  body instance.
147
 
148
end Inline;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.