Keil Logo

SAVESYS Compiler Directive

Abbreviation

None.

Arguments

None.

Default

SAVESYS

µVision

Options — C166 — Save Temporary Variables on User Stack.

Description

The SAVESYS directive instructs the C166 Compiler to save temporary results on the system stack. This is the default operation of the C166 Compiler.

See Also

SAVEUSR

Example
  1    extern void func (void);
  2
  3    #pragma SAVESYS // Save to SYS STACK (default)
  4    int func1 (int i1, int i2)  {
  5 1    func ();
  6 1    return (i1 + i2);
  7 1  }
  8
  9
 10    #pragma SAVEUSR // Save to USER STACK
 11    int func2 (int i1, int i2)  {
 12 1    func ();
 13 1    return (i1 + i2);
 14 1  }

ASSEMBLY LISTING OF GENERATED OBJECT CODE
        ; FUNCTION func1 (BEGIN  RMASK = @0x7FFF)
                        ; SOURCE LINE # 4
0000 ECFD          PUSH    R13
0002 ECFE          PUSH    R14
0004 F0D9          MOV     R13,R9
;---- Variable 'i2' assigned to Register 'R13' ----
0006 F0E8          MOV     R14,R8
;---- Variable 'i1' assigned to Register 'R14' ----
                ; SOURCE LINE # 5
0008 CA000000 E    CALLA   cc_UC,func
                ; SOURCE LINE # 6
000C F04E          MOV     R4,R14
000E 004D          ADD     R4,R13
                ; SOURCE LINE # 7
0010 FCFE          POP     R14
0012 FCFD          POP     R13
0014 CB00          RET
        ; FUNCTION func1 (END    RMASK = @0x7FFF)

        ; FUNCTION func2 (BEGIN  RMASK = @0x7FFF)
                ; SOURCE LINE # 11
0016 88D0          MOV     [-R0],R13
0018 88E0          MOV     [-R0],R14
001A F0D9          MOV     R13,R9
;---- Variable 'i2' assigned to Register 'R13' ----
001C F0E8          MOV     R14,R8
;---- Variable 'i1' assigned to Register 'R14' ----
                ; SOURCE LINE # 12
001E CA000000 E    CALLA   cc_UC,func
                ; SOURCE LINE # 13
0022 F04E          MOV     R4,R14
0024 004D          ADD     R4,R13
                ; SOURCE LINE # 14
0026 98E0          MOV     R14,[R0+]
0028 98D0          MOV     R13,[R0+]
002A CB00          RET
        ; FUNCTION func2 (END    RMASK = @0x7FFF)
  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

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.