summaryrefslogtreecommitdiff
path: root/src/ortho/mcode/ortho_mcode.private.ads
blob: 1b414773f0838d2a6ccad39b24111914b1aa01af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
--  Mcode back-end for ortho.
--  Copyright (C) 2006 Tristan Gingold
--
--  GHDL is free software; you can redistribute it and/or modify it under
--  the terms of the GNU General Public License as published by the Free
--  Software Foundation; either version 2, or (at your option) any later
--  version.
--
--  GHDL is distributed in the hope that it will be useful, but WITHOUT 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
--  along with GCC; see the file COPYING.  If not, write to the Free
--  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
--  02111-1307, USA.
with Interfaces; use Interfaces;
with Ortho_Code; use Ortho_Code;
with Ortho_Code.Types; use Ortho_Code.Types;
with Ortho_Code.Consts; use Ortho_Code.Consts;
with Ortho_Code.Decls; use Ortho_Code.Decls;
with Ortho_Code.Exprs; use Ortho_Code.Exprs;

--  Interface to create nodes.
package Ortho_Mcode is
   --  Initialize nodes.
   procedure Init;
   procedure Finish;

   procedure Free_All;

private
   --  MCode supports nested subprograms.
   Has_Nested_Subprograms : constant Boolean := True;

   type O_Tnode is new Ortho_Code.O_Tnode;
   type O_Cnode is new Ortho_Code.O_Cnode;
   type O_Dnode is new Ortho_Code.O_Dnode;
   type O_Enode is new Ortho_Code.O_Enode;
   type O_Fnode is new Ortho_Code.O_Fnode;
   type O_Lnode is new Ortho_Code.O_Lnode;
   type O_Snode is new Ortho_Code.Exprs.O_Snode;

   O_Lnode_Null : constant O_Lnode := O_Lnode (Ortho_Code.O_Lnode_Null);
   O_Cnode_Null : constant O_Cnode := O_Cnode (Ortho_Code.O_Cnode_Null);
   O_Dnode_Null : constant O_Dnode := O_Dnode (Ortho_Code.O_Dnode_Null);
   O_Enode_Null : constant O_Enode := O_Enode (Ortho_Code.O_Enode_Null);
   O_Fnode_Null : constant O_Fnode := O_Fnode (Ortho_Code.O_Fnode_Null);
   O_Snode_Null : constant O_Snode := O_Snode (Ortho_Code.Exprs.O_Snode_Null);
   O_Tnode_Null : constant O_Tnode := O_Tnode (Ortho_Code.O_Tnode_Null);

   type O_Element_List is new Ortho_Code.Types.O_Element_List;
   type O_Enum_List    is new Ortho_Code.Types.O_Enum_List;
   type O_Inter_List   is new Ortho_Code.Decls.O_Inter_List;
   type O_Record_Aggr_List is new Ortho_Code.Consts.O_Record_Aggr_List;
   type O_Array_Aggr_List is new Ortho_Code.Consts.O_Array_Aggr_List;
   type O_Assoc_List is new Ortho_Code.Exprs.O_Assoc_List;
   type O_If_Block   is new Ortho_Code.Exprs.O_If_Block;
   type O_Case_Block is new Ortho_Code.Exprs.O_Case_Block;

   pragma Inline (New_Lit);
   pragma Inline (New_Dyadic_Op);
   pragma Inline (New_Monadic_Op);
   pragma Inline (New_Compare_Op);
   pragma Inline (New_Signed_Literal);
   pragma Inline (New_Unsigned_Literal);
   pragma Inline (New_Float_Literal);
   pragma Inline (New_Null_Access);

   pragma Inline (Start_Record_Aggr);
   pragma Inline (New_Record_Aggr_El);
   pragma Inline (Finish_Record_Aggr);

   pragma Inline (Start_Array_Aggr);
   pragma Inline (New_Array_Aggr_El);
   pragma Inline (Finish_Array_Aggr);

   pragma Inline (New_Union_Aggr);
   pragma Inline (New_Sizeof);
   pragma Inline (New_Alignof);
   pragma Inline (New_Offsetof);

   pragma Inline (New_Indexed_Element);
   pragma Inline (New_Slice);
   pragma Inline (New_Selected_Element);
   pragma Inline (New_Access_Element);

   pragma Inline (New_Convert_Ov);

   pragma Inline (New_Address);
   pragma Inline (New_Global_Address);
   pragma Inline (New_Unchecked_Address);
   pragma Inline (New_Global_Unchecked_Address);
   pragma Inline (New_Subprogram_Address);

   pragma Inline (New_Value);
   pragma Inline (New_Obj_Value);

   pragma Inline (New_Alloca);

   pragma Inline (New_Debug_Filename_Decl);
   pragma Inline (New_Debug_Line_Decl);
   pragma Inline (New_Debug_Comment_Decl);

   pragma Inline (New_Type_Decl);
   pragma Inline (New_Const_Decl);

   pragma Inline (Start_Const_Value);
   pragma Inline (Finish_Const_Value);
   pragma Inline (New_Var_Decl);

   pragma Inline (New_Obj);
   pragma Inline (Start_Function_Decl);
   pragma Inline (Start_Procedure_Decl);
   pragma Inline (New_Interface_Decl);
   pragma Inline (Finish_Subprogram_Decl);
   pragma Inline (Start_Subprogram_Body);
   pragma Inline (Finish_Subprogram_Body);

   pragma Inline (New_Debug_Line_Stmt);
   pragma Inline (New_Debug_Comment_Stmt);

   pragma Inline (Start_Declare_Stmt);
   pragma Inline (Finish_Declare_Stmt);

   --  Create a function call or a procedure call.
   pragma Inline (Start_Association);
   pragma Inline (New_Association);
   pragma Inline (New_Function_Call);
   pragma Inline (New_Procedure_Call);

   pragma Inline (New_Assign_Stmt);
   pragma Inline (New_Return_Stmt);
   pragma Inline (Start_If_Stmt);
   pragma Inline (New_Else_Stmt);
   pragma Inline (Finish_If_Stmt);

   pragma Inline (Start_Loop_Stmt);
   pragma Inline (Finish_Loop_Stmt);
   pragma Inline (New_Exit_Stmt);
   pragma Inline (New_Next_Stmt);

   pragma Inline (Start_Case_Stmt);
   pragma Inline (Start_Choice);
   pragma Inline (New_Expr_Choice);
   pragma Inline (New_Range_Choice);
   pragma Inline (New_Default_Choice);
   pragma Inline (Finish_Choice);
   pragma Inline (Finish_Case_Stmt);
end Ortho_Mcode;