|
From: Philipp K. K. <pk...@sp...> - 2017-11-02 13:08:14
|
Am 02.11.2017 um 14:04 schrieb Philipp Klaus Krause:
> Am 26.10.2017 um 23:52 schrieb Åke Rehnman:
>> Hello All!
>>
>> If some kind soul could donate some time to explain. Looking at
>> generated AST i wonder what levels and blocks are. Specifically why "ni"
>> symbol has L2 B3 in (block???) L2 B4 ?
>>
>> /Ake
>
> Looking at function_declarator2 in src/SDCC.y it seems, function
> parameters go into an extra block? However, I do not know why for your
> int dummy(int x)
> {
> int n = 0;
> {
> int ni = 10;
> for (;x>=0;x--)
> ni = ni - 2;
> }
> return n;
> }
>
> x is in some "hidden" block B3 (by number "in between" the two blocks
> B2, B4 for the function body), while for
>
> int dummy2(int j)
> {
> for(int i = 0; i < 3; i++)
> {
> j--;
> }
> return(j);
> }
>
> j is in some "hidden" block B1 (by number "above" the two blocks B2, B3
> for the function body);
>
> Philipp
Did you encounter a case where such block weirdness happens for
variables that are not parameters? Otherwise, we might be able to use a
parameter-specific workaround to get debug info working for now?
Also remember that the blocks do not provide exact live-range
information; SDCC will not keep variables in registers after their last
user, not even throughout the block.
Philipp
|