Keil Logo Arm Logo

REGPARMS Compiler Directive

Abbreviation

None.

Arguments

None.

Default

REGPARMS

µVision

Options — C51 — Misc controls.

Description

The REGPARMS directive instructs the compiler to pass up to three function arguments in registers. Parameters that cannot be passed in registers are passed using fixed memory locations. This technique is used in assembly programs to improve speed and reduce memory utilization. It is significantly faster than storing function arguments in memory.

Note

  • You may specify both the REGPARMS and NOREGPARMS directive several times within a source file to compile some functions using register parameters and other functions using the old style of parameter passing. For example:
    #pragma NOREGPARMS      /* Parm passing-old style */
    extern int old_func (int, char);
    
    #pragma REGPARMS        /* Parm passing-in registers */
    extern int new_func (int, char);
    
    main  ()  {
            char a;
            int  x1, x2;
            x1 = old_func (x2, a);
            x1 = new_func (x2, a);
    }
    
  • You may use the NOREGPARMS directive when accessing assembly functions or libraries that were built with older tools.
See Also

NOREGPARMS

Example
C51 SAMPLE.C REGPARMS

Related Knowledgebase Articles

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings