Developer's Topics
Chapter 9, Enhanced asm facility

Definition

Definition

The syntactic descriptions that follow are presented in the style used in Chapter 3, ``C language compiler'' in the Programming Tools Guide. The syntactic classes type-specifier, identifier, and parameter-list have the same form as in that chapter. A syntactic description enclosed in square brackets (``[]'') is optional, unless the right bracket is followed by a ``+''. A ``+'' means ``one or more repetitions'' of a description. Similarly, ``*'' means ``zero or more repetitions''.

   asm macro:
   	asm [ type-specifier ] identifier ( [ parameter-list ] )
   	{
   	[ storage-mode-specification-line
   		asm-body ] *
   	}
An asm macro consists of the keyword asm, followed by what looks like a C function declaration. Inside the macro body there are one or more pairs of storage-mode-specification-line(s) (patterns) and corresponding asm-body(ies). If the type-specifier is other than void, the asm macro should return a value of the declared type.
   storage-mode-specification-line:
   	% [ storage-mode [ identifier [ , identifier ]* ] ; ]+

A storage-mode-specification-line consists of a single line (no continuation with \ is permitted) that begins with % and contains the names, (identifier)(s) and storage mode(s) of the formal parameters. Modes for all formal parameters must be given in each storage-mode-specification-line (except for error). The % must be the first character on a line. If an asm macro has no parameter-list, the storage-mode-specification-line may be omitted.