13.8 Machine Code Insertions
Name Resolution Rules
Ramification: This includes types declared
in children of System.Machine_Code.
Ramification: Note that this is not a
note; without this rule, it would be possible to write machine code in
compilation units which depend on System.Machine_Code only indirectly.
of the library package System.Machine_Code (if provided) are implementation
defined. The meaning of code_statement
is implementation defined. [Typically, each qualified_expression
represents a machine instruction or assembly directive.]
Discussion: For example, an instruction
might be a record with an Op_Code component and other components for
of the visible part of package System.Machine_Code, and the meaning of
An implementation may place restrictions on code_statement
An implementation is not required to provide package System.Machine_Code.
19 An implementation may provide implementation-defined
pragmas specifying register conventions and calling conventions.
Discussion: The idea is that the author
of a machine code subprogram knows the calling conventions, and refers
to parameters and results accordingly. The implementation should document
where to put the result of a machine code function, for example, “Scalar
results are returned in register 0.”
Example of a code
M : Mask;
; pragma Inline(Set_Mask);
procedure Set_Mask is
use System.Machine_Code; -- assume “with System.Machine_Code;” appears somewhere above
SI_Format'(Code => SSM, B => M'Base_Reg, D => M'Disp);
-- Base_Reg and Disp are implementation-defined attributes
Extensions to Ada 83
Machine code functions are
allowed in Ada 95; in Ada 83, only procedures were allowed.
Wording Changes from Ada 83
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe