SW006012 Microchip Technology, SW006012 Datasheet - Page 82

C COMPILER FOR DSPIC30F FAMILY

SW006012

Manufacturer Part Number
SW006012
Description
C COMPILER FOR DSPIC30F FAMILY
Manufacturer
Microchip Technology
Type
MPLAB® C30 Compilerr
Series
PIC24 & DsPICr
Datasheets

Specifications of SW006012

Supported Families
PIC24, DsPIC30F And DsPIC33F
Core Architecture
PIC, DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Tool Type
Compiler
Processor Series
PIC24, dsPIC
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
dsPIC30F
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
MPLAB
4.12
DS51284F-page 76
FUNCTION CALL CONVENTIONS
®
C30 User’s Guide
When calling a function:
• Registers W0-W7 are caller saved. The calling function must push these values
• Registers W8-W14 are callee saved. The function being called must save any of
• Registers W0-W4 are used for function return values.
TABLE 4-3:
Parameters are placed in the first aligned contiguous register(s) that are available. The
calling function must preserve the parameters, if required. Structures do not have any
alignment restrictions; a structure parameter will occupy registers if there are enough
registers to hold the entire structure. Function results are stored in consecutive
registers, beginning with W0.
4.12.1
The first eight working registers (W0-W7) are used for function parameters.Parameters
are allocated to registers in left-to-right order, and a parameter is assigned to the first
available register that is suitably aligned.
In the following example, all parameters are passed in registers, although not in the
order that they appear in the declaration. This format allows the MPLAB C30 compiler
to make the most efficient use of the available parameter registers.
EXAMPLE 4-1:
void
params0(short p0, long p1, int p2, char p3, float p4, void *p5)
{
}
The next example demonstrates how structures are passed to functions. If the
complete structure can fit in the available registers, then the structure is passed via
registers; otherwise the structure argument will be placed onto the stack.
char
int
short
pointer
long
float
double*
long double
structure
* double is equivalent to long double if -fno-short-double is used.
onto the stack for the register values to be preserved.
these registers it will modify.
Data Type
/*
** W0
** W1
** W3:W2
** W4
** W5
** W7:W6
*/
...
Function Parameters
REGISTERS REQUIRED
1
1
1
1
2 (contiguous – aligned to even numbered register)
2 (contiguous – aligned to even numbered register)
2 (contiguous – aligned to even numbered register)
4 (contiguous – aligned to quad numbered register)
1 register per 2 bytes in structure
FUNCTION CALL MODEL
p0
p2
p1
p3
p5
p4
Number of Registers Required
© 2007 Microchip Technology Inc.

Related parts for SW006012