| 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-2025, 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. It implements the |
| 34 |
-- *System.Machine_code* package defined in ARM 13.8 and GNAT Reference Manual |
| 35 |
-- (chapter 'Implementation of Specific Ada Features', 'Machine Code |
| 36 |
-- Insertions'). |
| 37 |
|
| 38 |
package System.Machine_Code |
| 39 |
with SPARK_Mode => Off |
| 40 |
is |
| 41 |
pragma No_Elaboration_Code_All; |
| 42 |
pragma Pure; |
| 43 |
|
| 44 |
pragma Implementation_Defined; |
| 45 |
-- All identifiers in this unit are implementation defined |
| 46 |
|
| 47 |
type Asm_Input_Operand is private; |
| 48 |
type Asm_Output_Operand is private; |
| 49 |
-- These types are never used directly, they are declared only so that |
| 50 |
-- the calls to Asm are type correct according to Ada semantic rules. |
| 51 |
|
| 52 |
No_Input_Operands : constant Asm_Input_Operand; |
| 53 |
No_Output_Operands : constant Asm_Output_Operand; |
| 54 |
-- These constants are used as default value to denote respectively no |
| 55 |
-- input operands and no output operands. |
| 56 |
|
| 57 |
type Asm_Input_Operand_List is |
| 58 |
array (Integer range <>) of Asm_Input_Operand; |
| 59 |
|
| 60 |
type Asm_Output_Operand_List is |
| 61 |
array (Integer range <>) of Asm_Output_Operand; |
| 62 |
-- The types *Asm_Input_Operand_List* and *Asm_Output_Operand_List* are |
| 63 |
-- arrays of respectively *Asm_Input_Operand* and *Asm_Output_Operand*. |
| 64 |
-- They are used to describe lists of operands for the Asm subprograms. |
| 65 |
|
| 66 |
type Asm_Insn is private; |
| 67 |
-- This type is not used directly. It is declared only so that the |
| 68 |
-- aggregates used in code statements are type correct by Ada rules. |
| 69 |
|
| 70 |
procedure Asm ( |
| 71 |
Template : String; |
| 72 |
Outputs : Asm_Output_Operand_List; |
| 73 |
Inputs : Asm_Input_Operand_List; |
| 74 |
Clobber : String := ""; |
| 75 |
Volatile : Boolean := False); |
| 76 |
|
| 77 |
procedure Asm ( |
| 78 |
Template : String; |
| 79 |
Outputs : Asm_Output_Operand := No_Output_Operands; |
| 80 |
Inputs : Asm_Input_Operand_List; |
| 81 |
Clobber : String := ""; |
| 82 |
Volatile : Boolean := False); |
| 83 |
|
| 84 |
procedure Asm ( |
| 85 |
Template : String; |
| 86 |
Outputs : Asm_Output_Operand_List; |
| 87 |
Inputs : Asm_Input_Operand := No_Input_Operands; |
| 88 |
Clobber : String := ""; |
| 89 |
Volatile : Boolean := False); |
| 90 |
|
| 91 |
procedure Asm ( |
| 92 |
Template : String; |
| 93 |
Outputs : Asm_Output_Operand := No_Output_Operands; |
| 94 |
Inputs : Asm_Input_Operand := No_Input_Operands; |
| 95 |
Clobber : String := ""; |
| 96 |
Volatile : Boolean := False); |
| 97 |
|
| 98 |
function Asm ( |
| 99 |
Template : String; |
| 100 |
Outputs : Asm_Output_Operand_List; |
| 101 |
Inputs : Asm_Input_Operand_List; |
| 102 |
Clobber : String := ""; |
| 103 |
Volatile : Boolean := False) return Asm_Insn; |
| 104 |
|
| 105 |
function Asm ( |
| 106 |
Template : String; |
| 107 |
Outputs : Asm_Output_Operand := No_Output_Operands; |
| 108 |
Inputs : Asm_Input_Operand_List; |
| 109 |
Clobber : String := ""; |
| 110 |
Volatile : Boolean := False) return Asm_Insn; |
| 111 |
|
| 112 |
function Asm ( |
| 113 |
Template : String; |
| 114 |
Outputs : Asm_Output_Operand_List; |
| 115 |
Inputs : Asm_Input_Operand := No_Input_Operands; |
| 116 |
Clobber : String := ""; |
| 117 |
Volatile : Boolean := False) return Asm_Insn; |
| 118 |
|
| 119 |
function Asm ( |
| 120 |
Template : String; |
| 121 |
Outputs : Asm_Output_Operand := No_Output_Operands; |
| 122 |
Inputs : Asm_Input_Operand := No_Input_Operands; |
| 123 |
Clobber : String := ""; |
| 124 |
Volatile : Boolean := False) return Asm_Insn; |
| 125 |
-- The parameters are described in the GNAT Reference Manual [GRM]. |
| 126 |
-- |
| 127 |
-- These are intrinsic subprograms, fully implemented by the compiler. |
| 128 |
|
| 129 |
pragma Import (Intrinsic, Asm); |
| 130 |
|
| 131 |
private |
| 132 |
|
| 133 |
type Asm_Input_Operand is new Integer; |
| 134 |
type Asm_Output_Operand is new Integer; |
| 135 |
type Asm_Insn is new Integer; |
| 136 |
-- All three of these types are dummy types, to meet the requirements of |
| 137 |
-- type consistency. No values of these types are ever referenced. |
| 138 |
|
| 139 |
No_Input_Operands : constant Asm_Input_Operand := 0; |
| 140 |
No_Output_Operands : constant Asm_Output_Operand := 0; |
| 141 |
|
| 142 |
end System.Machine_Code; |