SW500009 Microchip Technology, SW500009 Datasheet - Page 125

HI-TECH FOR DSPIC/PIC24

SW500009

Manufacturer Part Number
SW500009
Description
HI-TECH FOR DSPIC/PIC24
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC24 & DsPICr
Datasheet

Specifications of SW500009

Supported Families
PIC24
Core Architecture
PIC, DsPIC
Software Edition
Standard
Kit Contents
Software And Docs
Tool Type
Compiler
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
DSPIC3X/PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
025
778-1003
778-1003
Linker and Utilities
stack program, a function must be considered active as soon as its parameter area has been modified
in preparation for a call, even though code in that function is not yet being executed and a call to
that function has not been made. This is particularly import with functions that accept more than
one parameter as the ANSI standard does not dictate the order in which function parameters must be
evaluated.
The linker indicates in the call graph those functions that may have been called to determine param-
eter values to other functions. See Section
file.
Such a condition is best illustrated by an example, which is shown in the following tutorial.
T
P
For the highlighted statement, the compiler might evaluate and load the first parameter
to the function B, which is the literal, 5. To do this, the value of 5 is loaded to the loca-
tions ?_B and ?_B+1. Now to evaluate the second parameter value to the function B, the
compiler must first call the function A. So A’s parameters are loaded and the call to func-
tion A is made. Code inside the function A, calls the function B. This involves loading
the parameters to B: the contents of the variable b are loaded to ?_B+2 and ?_B+3, and
the value 9 is loaded to ?_B and ?_B+1, which corrupts the contents of these locations
which were loaded earlier for the still pending call to function B. Function A eventually
returns normally and the the return value is the loaded to the second parameter locations
for the still pending call to function B, back at the highlighted line of source. However,
the value of 5 previously loaded as the first parameter to B has been lost. When the call
to function B is now made, the parameters will not be correct.
Note that the function B is not actively executing code in more than one instance of the
function at the same time, however the code that loads the parameters to function B is.
UT RIAL
ARAMETERS IMPLEMENTED AS FUNCTION CALLS
int B(int x, int y) {
}
int A(int a, int b) {
}
void main(void) {
}
return x - y;
return a+B(9, b);
B(5, A(6, 7)); // consider this statement
5.11.1
for information on how this is displayed in the map
Consider the following code.
Compiled Stack Operation
111

Related parts for SW500009