AREGS

Abbreviation

None.

Arguments

None.

Default

AREGS

Description

The AREGS control causes the compiler to use absolute register addressing for registers R0 through R7. Absolute addressing improves the efficiency of the generated code. For example, PUSH and POP instructions function only with direct or absolute addresses. Using the AREGS directive, functions can directly push and pop registers.
You may use the REGISTERBANK directive to define which register bank to use.

NOTE
Though it may defined several times in a program, the AREGS option is valid only when defined outside of a function declaration.

See Also
NOAREGS
Example
The following is a source and code listing using both NOAREGS and AREGS.
.
.
.
stmt level source
1 extern char func ();
2 char k;
3
4 #pragma NOAREGS
5 noaregfunc () {
6 1 k = func () + func ();
7 1 }
8
9 #pragma AREGS
10 aregfunc () {
11 1 k = func () + func ();
12 1 }
.
.
.
; FUNCTION noaregfunc (BEGIN)
; SOURCE LINE # 6
0000 120000 E LCALL func
0003 EF MOV A,R7
0004 C0E0 PUSH ACC
0006 120000 E LCALL func
0009 D0E0 POP ACC
000B 2F ADD A,R7
000C F500 R MOV k,A
; SOURCE LINE # 7
000E 22 RET
; FUNCTION noaregfunc (END)

; FUNCTION aregfunc (BEGIN)
; SOURCE LINE # 11
0000 120000 E LCALL func
0003 C007 PUSH AR7
0005 120000 E LCALL func
0008 D0E0 POP ACC
000A 2F ADD A,R7
000B F500 R MOV k,A
; SOURCE LINE # 12
000D 22 RET
; FUNCTION aregfunc (END)
.
.
.
Note the different methods of saving R7 on the stack. The code generated for the function noaregfunc  is:
MOV  A,R7
PUSH ACC
while the code for the aregfunc  function is:
PUSH AR7