DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Enhanced asm facility

asm body

The asm body represents (presumed) assembly code that the compiler will generate when the modes for all of the formal parameters match the associated pattern. Syntactically, the asm body consists of the text between two pattern lines (that begin with %) or between the last pattern line and the } that ends the asm macro. C language comment lines are not recognized as such in the asm body. Instead they are simply considered part of the text to be expanded.

Formal parameter names may appear in any context in the asm body, delimited by non-alphanumeric characters. For each instance of a formal parameter in the asm body the compiler substitutes the appropriate assembly language operand syntax that will access the actual argument at run time. As an example, if one of the actual arguments to an asm macro is x, an automatic variable, a string like 4(%fp) would be substituted for occurrences of the corresponding formal parameter. An important consequence of this macro substitution behavior is that asm macros can change the value of their arguments. Note that this is different from standard C semantics.

For lab parameters a unique label is chosen for each new expansion.

If an asm macro is declared to return a value, it must be coded to return a value of the proper type in the machine register that is appropriate for the implementation.

An implementation restriction requires that no line in the asm body may start with %.


Next topic: Writing asm macros
Previous topic: Storage modes

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003