Inline Assembly Language - Intel i960 User Manual

Processor compiler
Hide thumbs Also See for i960:
Table of Contents

Advertisement

7

Inline Assembly Language

7-52
i960 Processor Compiler User's Guide
Introduction
Two distinct styles of inline assembly language are supported by the
compilation system: asm statements and asm functions. The
recommended way to use inline assembly language is asm statements; asm
functions are supported for compatibility with previous CTOOLS960
releases.
Resource Usage
The compiler makes assumptions about the machine resources: registers
and memory. It manages access to these resources based on the C
program, and its knowledge of the code it is generating, and inline
assembly language can violate these assumptions.
Both styles of inline assembly language provide the programmer with
ways to communicate the usage/modification of machine resources. Inline
assembly code that uses/modifies such machine resources without
informing the compiler may cause incorrect code to be generated by the
compiler.
Before and after each call to a C function, the compiler generates
instructions to preserve resources for the calling function while the called
function executes. For example, any general purpose registers that might
be updated by the called function must be saved on the stack before and
after each function call. The term for this resource management is "the
calling convention."
The calling convention for a call to an
call to a C function. In particular, the compiler assumes by default that the
only resources used by an
temporaries, and the return value. The compiler must be explicitly
informed about other resources that can be used by the
compiler does not manipulate assembly language within
relies on the assembler to check the assembly language. The result is that
function differs from that of a
asm
function are its parameters, local
asm
function. The
asm
functions. It
asm

Advertisement

Table of Contents
loading

Table of Contents