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-2011, 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 Pure;
38
39   --  All identifiers in this unit are implementation defined
40
41   pragma Implementation_Defined;
42
43   type Asm_Input_Operand  is private;
44   type Asm_Output_Operand is private;
45   --  These types are never used directly, they are declared only so that
46   --  the calls to Asm are type correct according to Ada semantic rules.
47
48   No_Input_Operands  : constant Asm_Input_Operand;
49   No_Output_Operands : constant Asm_Output_Operand;
50
51   type Asm_Input_Operand_List  is
52     array (Integer range <>) of Asm_Input_Operand;
53
54   type Asm_Output_Operand_List is
55     array (Integer range <>) of Asm_Output_Operand;
56
57   type Asm_Insn is private;
58   --  This type is not used directly. It is declared only so that the
59   --  aggregates used in code statements are type correct by Ada rules.
60
61   procedure Asm (
62     Template : String;
63     Outputs  : Asm_Output_Operand_List;
64     Inputs   : Asm_Input_Operand_List;
65     Clobber  : String  := "";
66     Volatile : Boolean := False);
67
68   procedure Asm (
69     Template : String;
70     Outputs  : Asm_Output_Operand := No_Output_Operands;
71     Inputs   : Asm_Input_Operand_List;
72     Clobber  : String  := "";
73     Volatile : Boolean := False);
74
75   procedure Asm (
76     Template : String;
77     Outputs  : Asm_Output_Operand_List;
78     Inputs   : Asm_Input_Operand := No_Input_Operands;
79     Clobber  : String  := "";
80     Volatile : Boolean := False);
81
82   procedure Asm (
83     Template : String;
84     Outputs  : Asm_Output_Operand := No_Output_Operands;
85     Inputs   : Asm_Input_Operand  := No_Input_Operands;
86     Clobber  : String  := "";
87     Volatile : Boolean := False);
88
89   function Asm (
90     Template : String;
91     Outputs  : Asm_Output_Operand_List;
92     Inputs   : Asm_Input_Operand_List;
93     Clobber  : String  := "";
94     Volatile : Boolean := False) return Asm_Insn;
95
96   function Asm (
97     Template : String;
98     Outputs  : Asm_Output_Operand := No_Output_Operands;
99     Inputs   : Asm_Input_Operand_List;
100     Clobber  : String  := "";
101     Volatile : Boolean := False) return Asm_Insn;
102
103   function Asm (
104     Template : String;
105     Outputs  : Asm_Output_Operand_List;
106     Inputs   : Asm_Input_Operand := No_Input_Operands;
107     Clobber  : String  := "";
108     Volatile : Boolean := False) return Asm_Insn;
109
110   function Asm (
111     Template : String;
112     Outputs  : Asm_Output_Operand := No_Output_Operands;
113     Inputs   : Asm_Input_Operand  := No_Input_Operands;
114     Clobber  : String  := "";
115     Volatile : Boolean := False) return Asm_Insn;
116
117   pragma Import (Intrinsic, Asm);
118
119private
120
121   type Asm_Input_Operand  is new Integer;
122   type Asm_Output_Operand is new Integer;
123   type Asm_Insn           is new Integer;
124   --  All three of these types are dummy types, to meet the requirements of
125   --  type consistency. No values of these types are ever referenced.
126
127   No_Input_Operands  : constant Asm_Input_Operand  := 0;
128   No_Output_Operands : constant Asm_Output_Operand := 0;
129
130end System.Machine_Code;
131