3-6
C Cross Compiler
used to declare local variables; global accumulators are not supported.
From the compiler’s point of view,
accum_a
and
accum_b
are 32-bit
variables that must be stored in a specified register. On the ZSP400, the
accum_a
and
accum_b
data types are placed in r1r0 and r3r2,
respectively, to allow the use of accumulator-specific operations.
Although the compiler treats
accum_a
and
accum_b
as 32-bit variables,
the accumulator instructions (for example,
mac.a
,
mac2.a
,
macn.a
... )
operate on a 40-bit accumulator. The high-order 8 bits for each
accumulator are in the %guard register. If 40-bit accumulators are
needed, the high-order bits can be accessed through inline assembly
instructions that read or modify the %guard register. In ZSPG2, since
every GPR pair supports accumulator operations, other accumulators
can be used by declaring them with:
register long acc_c asm(“rX”);
In fact,
accum_a
and
accum_b
declarations are equivalent to:
register long x asm (“rX”);
where “X” is the appropriate register.
It should be remembered that only accumulators r12-r15 have their guard
bits preserved across calls.
3.2.2 Register Usage
3.2.2.1 SDCC/ZDXCC Register Usage
Register usage SDCC/ZDXCC is summarized below. Registers r0
through r15 are general-purpose registers, and registers beginning with
‘%’ are control registers.
Registers used by the compiler: r0–r15, %fmode, %smode, %amode,
%hwflag, %loop0, %loop1, %loop2, %loop3, %rpc, %pc, %cb0_beg,
%cb0_end, %cb1_beg, %cb1_end, %guard.
Stack pointer: r12
Parameter registers: r4-r6
Callee preserved registers: r0-r3, r7-r12, r14, r15, %guard
There are no caller saved registers.