1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                   S Y S T E M . M A C H I N E _ C O D E                  --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 1992-2018, 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.                                     --
17--                                                                          --
18-- As a special exception under Section 7 of GPL version 3, you are granted --
19-- additional permissions described in the GCC Runtime Library Exception,   --
20-- version 3.1, as published by the Free Software Foundation.               --
21--                                                                          --
22-- You should have received a copy of the GNU General Public License and    --
23-- a copy of the GCC Runtime Library Exception along with this program;     --
24-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25-- <http://www.gnu.org/licenses/>.                                          --
26--                                                                          --
27-- GNAT was originally developed  by the GNAT team at  New York University. --
28-- Extensive contributions were provided by Ada Core Technologies Inc.      --
29--                                                                          --
30------------------------------------------------------------------------------
31
32--  This package provides machine code support, both for intrinsic machine
33--  operations, and also for machine code statements. See GNAT documentation
34--  for full details.
35
36package System.Machine_Code is
37   pragma No_Elaboration_Code_All;
38   pragma Pure;
39
40   --  All identifiers in this unit are implementation defined
41
42   pragma Implementation_Defined;
43
44   type Asm_Input_Operand  is private;
45   type Asm_Output_Operand is private;
46   --  These types are never used directly, they are declared only so that
47   --  the calls to Asm are type correct according to Ada semantic rules.
48
49   No_Input_Operands  : constant Asm_Input_Operand;
50   No_Output_Operands : constant Asm_Output_Operand;
51
52   type Asm_Input_Operand_List  is
53     array (Integer range <>) of Asm_Input_Operand;
54
55   type Asm_Output_Operand_List is
56     array (Integer range <>) of Asm_Output_Operand;
57
58   type Asm_Insn is private;
59   --  This type is not used directly. It is declared only so that the
60   --  aggregates used in code statements are type correct by Ada rules.
61
62   procedure Asm (
63     Template : String;
64     Outputs  : Asm_Output_Operand_List;
65     Inputs   : Asm_Input_Operand_List;
66     Clobber  : String  := "";
67     Volatile : Boolean := False);
68
69   procedure Asm (
70     Template : String;
71     Outputs  : Asm_Output_Operand := No_Output_Operands;
72     Inputs   : Asm_Input_Operand_List;
73     Clobber  : String  := "";
74     Volatile : Boolean := False);
75
76   procedure Asm (
77     Template : String;
78     Outputs  : Asm_Output_Operand_List;
79     Inputs   : Asm_Input_Operand := No_Input_Operands;
80     Clobber  : String  := "";
81     Volatile : Boolean := False);
82
83   procedure Asm (
84     Template : String;
85     Outputs  : Asm_Output_Operand := No_Output_Operands;
86     Inputs   : Asm_Input_Operand  := No_Input_Operands;
87     Clobber  : String  := "";
88     Volatile : Boolean := False);
89
90   function Asm (
91     Template : String;
92     Outputs  : Asm_Output_Operand_List;
93     Inputs   : Asm_Input_Operand_List;
94     Clobber  : String  := "";
95     Volatile : Boolean := False) return Asm_Insn;
96
97   function Asm (
98     Template : String;
99     Outputs  : Asm_Output_Operand := No_Output_Operands;
100     Inputs   : Asm_Input_Operand_List;
101     Clobber  : String  := "";
102     Volatile : Boolean := False) return Asm_Insn;
103
104   function Asm (
105     Template : String;
106     Outputs  : Asm_Output_Operand_List;
107     Inputs   : Asm_Input_Operand := No_Input_Operands;
108     Clobber  : String  := "";
109     Volatile : Boolean := False) return Asm_Insn;
110
111   function Asm (
112     Template : String;
113     Outputs  : Asm_Output_Operand := No_Output_Operands;
114     Inputs   : Asm_Input_Operand  := No_Input_Operands;
115     Clobber  : String  := "";
116     Volatile : Boolean := False) return Asm_Insn;
117
118   pragma Import (Intrinsic, Asm);
119
120private
121
122   type Asm_Input_Operand  is new Integer;
123   type Asm_Output_Operand is new Integer;
124   type Asm_Insn           is new Integer;
125   --  All three of these types are dummy types, to meet the requirements of
126   --  type consistency. No values of these types are ever referenced.
127
128   No_Input_Operands  : constant Asm_Input_Operand  := 0;
129   No_Output_Operands : constant Asm_Output_Operand := 0;
130
131end System.Machine_Code;
132