Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ User's Guide - the following form of the auxiliary pragma can be used to describe the http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
The following form of the auxiliary pragma can be used to describe the
registers that a function will use without saving.

+--------------------------------------------------------------------------+
|      #pragma aux sym modify [exact] reg_set [;]                          |
|                                                                          |
+--------------------------------------------------------------------------+

where
    description

sym
    is a function name.

reg_set
    is a register set.

Specifying a register set informs Watcom C/C++ that the registers belonging
to the register set are modified by the function.  That is, the value in a
register before calling the function is different from its value after
execution of the function.

Registers that are used to pass arguments are assumed to be modified and
hence do not have to be saved and restored by the called function.  Also,
since the AX register is frequently used to return a value, it is always
assumed to be modified.  If necessary, the caller will contain code to save
and restore the contents of registers used to pass arguments.  Note that
saving and restoring the contents of these registers may not be necessary if
the called function does not modify them.  The following form of the
auxiliary pragma can be used to describe exactly those registers that will
be modified by the called function.

+--------------------------------------------------------------------------+
|      #pragma aux sym modify exact reg_set [;]                            |
|                                                                          |
+--------------------------------------------------------------------------+

where
    description

sym
    is a function name.

reg_set
    is a register set.

The above form of the auxiliary pragma tells Watcom C/C++ not to assume that
the registers used to pass arguments will be modified by the called
function.  Instead, only the registers specified in the register set will be
modified.  This will prevent generation of the code which unnecessarily
saves and restores the contents of the registers used to pass arguments.

Also, any registers that are specified in the value register set are assumed
to be unmodified unless explicitly listed in the exact register set.  In the
following example, the code generator will not generate code to save and
restore the value of the stack pointer register since we have told it that
"GetSP" does not modify any register whatsoever.

Example:

     unsigned GetSP(void);
     #if defined(__386__)
     #pragma aux GetSP = value [esp] modify exact [];
     #else
     #pragma aux GetSP = value [sp] modify exact [];
     #endif

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson