13.8 Machine Code Insertions
This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue
[ A machine code insertion can be achieved by a call to a subprogram whose sequence_of_statements
contains code_statement
s.]
Syntax
2code_statement
::=
qualified_expression
;
3A code_statement
is only allowed in the handled_sequence_of_statements
of a subprogram_body
. If a subprogram_body
contains any code_statement
s, then within this subprogram_body
the only allowed form of statement
is a code_statement
(labeled or not), the only allowed declarative_item
s are use_clause
s, and no exception_handler
is allowed (comment
s and pragma
s are allowed as usual).
Name Resolution Rules
4The qualified_expression
is expected to be of any type.
Legality Rules
5The qualified_expression
shall be of a type declared in package System.Machine_Code.
A code_statement
shall appear only within the scope of a with_clause
that mentions package System.Machine_Code.
Static Semantics
7The contents of the library package System.Machine_Code (if provided) are implementation defined. The meaning of code_statement
s is implementation defined. [Typically, each qualified_expression
represents a machine instruction or assembly directive.]
code_statement
s.Implementation Permissions
8An implementation may place restrictions on code_statement
s. An implementation is not required to provide package System.Machine_Code.
code_statement
s are allowed. Examples
12Example of a code statement:
M : Mask;
procedure Set_Mask
with Inline;
14procedure 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;
Extensions to Ada 83
Wording Changes from Ada 83
code_statement
is changed to say “qualified_expression
” instead of “subtype_mark
'record_aggregate
”. Requiring the type of each instruction to be a record type is overspecification.