Renesas Technology, Tools FAQs
Last Updated: March 21, 2000
Document Number: 01051259_e
Q.
In the program example, variable b is over written at the line stated by [l=ReceiveByte(4);] in the compiled assembly code. Why
does this happen?
Example program Assembly code
void IntS4R(void)
{
long l;
char c,b;
b=ReceiveByte(4);
l=ReceiveByte(4);
}
void IntS4R(void)
{
long l;
char c,b;
b=ReceiveByte(4);
MOV.B #4,R1L
JSR.A $Receive
MOV.B R0L,-4H[FB]
l=ReceiveByte(4);
MOV.B #4,R1L
JSR.A $Receive
MOV.W R0,-4H[FB]
MOV.W R2,-2H[FB]
EXITD
}
A.
This code is a result of the NC30WA optimization.
In the example program, auto variables b and l exist in different blocks (blocks in which the variable is valid). Variable b is used for
storing a return value of the function ReceiveByte. After that, b is never used. Therefore, variable b can share the same auto area
with variable l.
For this reason, if the variable active blocks do not overlap, NC30WA optimizes the stack area for more efficient processing.
When a write-access to a variable occurs, it appears that the same access happened to variable b. If variable be is in use at the same
time l is in use, the above auto-area overlay will not happen.
Top of Page | Back to Previous Page
Terms of Use Privacy Policy
(C)2004 Renesas Technology Corp., All Rights Reserved.
Comentarios a estos manuales