13.8 Machine Code Insertions
Syntax
Name Resolution Rules
Legality Rules
Static Semantics
The contents
of the library package System.Machine_Code (if provided) are implementation
defined. The meaning of
code_statements
is implementation defined. Typically, each
qualified_expression
represents a machine instruction or assembly directive.
Implementation Permissions
An implementation may place restrictions on
code_statements.
An implementation is not required to provide package System.Machine_Code.
NOTE 1 An implementation can provide
implementation-defined pragmas specifying register conventions and calling
conventions.
NOTE 2 Machine code functions are
exempt from the rule that a return statement is required. In fact, return
statements are forbidden, since only
code_statements
are allowed.
Examples
Example of a code
statement:
M : Mask;
procedure Set_Mask
with Inline;
procedure Set_Mask is
use System.Machine_Code; -- assume “with System.Machine_Code;” appears somewhere above
begin
SI_Format'(Code => SSM, B => M'Base_Reg, D => M'Disp);
-- Base_Reg and Disp are implementation-defined attributes
end Set_Mask;
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe