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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [sem_disp.ads] - Blame information for rev 708

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

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                             S E M _ D I S P                              --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2010, 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 package contains routines involved in tagged types and dynamic
27
--  dispatching.
28
 
29
with Types; use Types;
30
package Sem_Disp is
31
 
32
   procedure Check_Controlling_Formals (Typ : Entity_Id; Subp : Entity_Id);
33
   --  Check that all controlling parameters of Subp are of type Typ,
34
   --  that defaults for controlling parameters are tag-indeterminate,
35
   --  and that the nominal subtype of the parameters and result
36
   --  statically match the first subtype of the controlling type.
37
 
38
   procedure Check_Dispatching_Call (N : Node_Id);
39
   --  Check if a call is a dispatching call. The subprogram is known to
40
   --  be a dispatching operation. The call is dispatching if all the
41
   --  controlling actuals are dynamically tagged. This procedure is called
42
   --  after overload resolution, so the call is known to be unambiguous.
43
 
44
   procedure Check_Dispatching_Operation (Subp, Old_Subp : Entity_Id);
45
   --  Add "Subp" to the list of primitive operations of the corresponding type
46
   --  if it has a parameter of this type and is defined at a proper place for
47
   --  primitive operations (new primitives are only defined in package spec,
48
   --  overridden operation can be defined in any scope). If Old_Subp is not
49
   --  Empty we are in the overriding case. If the tagged type associated with
50
   --  Subp is a concurrent type (case that occurs when the type is declared in
51
   --  a generic because the analysis of generics disables generation of the
52
   --  corresponding record) then this routine does does not add "Subp" to the
53
   --  list of primitive operations but leaves Subp decorated as dispatching
54
   --  operation to enable checks associated with the Object.Operation notation
55
 
56
   procedure Check_Operation_From_Incomplete_Type
57
     (Subp : Entity_Id;
58
      Typ  : Entity_Id);
59
   --  If a primitive operation was defined for the incomplete view of the
60
   --  type, and the full type declaration is a derived type definition,
61
   --  the operation may override an inherited one.
62
 
63
   procedure Check_Operation_From_Private_View (Subp, Old_Subp : Entity_Id);
64
   --  Add "Old_Subp" to the list of primitive operations of the corresponding
65
   --  tagged type if it is the full view of a private tagged type. The Alias
66
   --  of "OldSubp" is adjusted to point to the inherited procedure of the
67
   --  full view because it is always this one which has to be called.
68
 
69
   function Covers_Some_Interface (Prim : Entity_Id) return Boolean;
70
   --  Returns true if Prim covers some interface primitive of its associated
71
   --  tagged type. The tagged type of Prim must be frozen when this function
72
   --  is invoked.
73
 
74
   function Find_Controlling_Arg (N : Node_Id) return Node_Id;
75
   --  Returns the actual controlling argument if N is dynamically tagged,
76
   --  and Empty if it is not dynamically tagged.
77
 
78
   function Find_Dispatching_Type (Subp : Entity_Id) return Entity_Id;
79
   --  Check whether a subprogram is dispatching, and find the tagged type of
80
   --  the controlling argument or arguments. Returns Empty if Subp is not a
81
   --  dispatching operation.
82
 
83
   function Find_Primitive_Covering_Interface
84
     (Tagged_Type : Entity_Id;
85
      Iface_Prim  : Entity_Id) return Entity_Id;
86
   --  Search in the homonym chain for the primitive of Tagged_Type that covers
87
   --  Iface_Prim. The homonym chain traversal is required to catch primitives
88
   --  associated with the partial view of private types when processing the
89
   --  corresponding full view. If the entity is not found then search for it
90
   --  in the list of primitives of Tagged_Type. This latter search is needed
91
   --  when the interface primitive is covered by a private subprogram. If the
92
   --  primitive has not been covered yet then return the entity that will be
93
   --  overridden when the primitive is covered (that is, return the entity
94
   --  whose alias attribute references the interface primitive). If none of
95
   --  these entities is found then return Empty.
96
 
97
   type Subprogram_List is array (Nat range <>) of Entity_Id;
98
   --  Type returned by Inherited_Subprograms function
99
 
100
   function Inherited_Subprograms (S : Entity_Id) return Subprogram_List;
101
   --  Given the spec of a subprogram, this function gathers any inherited
102
   --  subprograms from direct inheritance or via interfaces. The list is
103
   --  a list of entity id's of the specs of inherited subprograms. Returns
104
   --  a null array if passed an Empty spec id. Note that the returned array
105
   --  only includes subprograms and generic subprograms (and excludes any
106
   --  other inherited entities, in particular enumeration literals).
107
 
108
   function Is_Dynamically_Tagged (N : Node_Id) return Boolean;
109
   --  Used to determine whether a call is dispatching, i.e. if is an
110
   --  an expression of a class_Wide type, or a call to a function with
111
   --  controlling result where at least one operand is dynamically tagged.
112
 
113
   function Is_Null_Interface_Primitive (E : Entity_Id) return Boolean;
114
   --  Returns True if E is a null procedure that is an interface primitive
115
 
116
   function Is_Tag_Indeterminate (N : Node_Id) return Boolean;
117
   --  An expression is tag-indeterminate if it is a call that dispatches
118
   --  on result, and all controlling operands are also indeterminate.
119
   --  Such a function call may inherit a tag from an enclosing call.
120
 
121
   procedure Override_Dispatching_Operation
122
     (Tagged_Type : Entity_Id;
123
      Prev_Op     : Entity_Id;
124
      New_Op      : Entity_Id);
125
   --  Replace an implicit dispatching operation with an explicit one.
126
   --  Prev_Op is an inherited primitive operation which is overridden
127
   --  by the explicit declaration of New_Op.
128
 
129
   procedure Propagate_Tag (Control : Node_Id; Actual : Node_Id);
130
   --  If a function call is tag-indeterminate,  its controlling argument is
131
   --  found in the context;  either an enclosing call, or the left-hand side
132
   --  of the enclosing assignment statement. The tag must be propagated
133
   --  recursively to the tag-indeterminate actuals of the call.
134
 
135
end Sem_Disp;

powered by: WebSVN 2.1.0

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