[Home] [Prev] [Next] [Index]

13.8 Machine Code Insertions

13.8 Machine Code Insertions

1
A machine code insertion can be achieved by a call to a procedure whose sequence of statements contains code statements.

2
code_statement ::= type_mark'record_aggregate;

3
A code statement is only allowed in the sequence of statements of a procedure body. If a procedure body contains code statements, then within this procedure body the only allowed form of statement is a code statement (labeled or not), the only allowed declarative items are use clauses, and no exception handler is allowed (comments and pragmas are allowed as usual).

4
Each machine instruction appears as a record aggregate of a record type that defines the corresponding instruction. The base type of the type mark of a code statement must be declared within the predefined library package called MACHINE_CODE; this package must be named by a with clause that applies to the compilation unit in which the code statement occurs. An implementation is not required to provide such a package.

5
An implementation is allowed to impose further restrictions on the record aggregates allowed in code statements. For example, it may require that expressions contained in such aggregates be static expressions.

6
An implementation may provide machine-dependent pragmas specifying register conventions and calling conventions. Such pragmas must be documented in Appendix F.

7
Example:

M : MASK
procedure SET_MASK; pragma INLINE(SET_MASK);

procedure SET_MASK is
     use MACHINE_CODE;
begin
     SI_FORMAT'(CODE => SSM, B => M'BASE_REG, D => M'DISP);
     -- M'BASE_REG and M'DISP are implementation-specific
     -- predefined attributes
end;

8
References:

*
allow 1.6

*
apply 10.1.1

*
comment 2.7

*
compilation unit 10.1

*
declarative item 3.9

*
exception handler 11.2

*
inline pragma 6.3.2

*
labeled statement 5.1

*
library unit 10.1

*
package 7

*
pragma 2.8

*
procedure 6.1

*
procedure body 6.3

*
record aggregate 4.3.1

*
record type 3.7

*
sequence of statements 5.1

*
statement 5

*
static expression 4.9

*
use clause 5.4

*
with clause 10.1.1



[Home] [Prev] [Next] [Index]

documentation@rational.com
Copyright © 1993-2000, Rational Software Corporation. All rights reserved.