|
From: Maarten B. <sou...@ds...> - 2017-10-29 08:23:21
|
Hello,
>From the top of my head the idea was that the level is the nesting level
of the blocks and the block is the sequential count of the block. But for
the intricacies you'd better look in the sources of SDCC.
Maarten
> 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
>
> Example:
>
> FUNCTION (_dummy=0x6000f39b0) type (int fixed) args (int auto)
> tree (0x6000f3910) not decorated
> (null):0:{ L1 B2
> (null):0:Â DECLARE SYMBOL (L1 B2 n=0x6000eda30) type (int auto)
> (null):0:Â { L2 B4
> (null):0:Â Â Â DECLARE SYMBOL (L2 B3 ni=0x6000ee1e0) type (int auto)
> (null):0:Â Â Â LABEL (0x6000f2f80)
> test6.c:0:Â Â Â Â Â SYMBOL (L3 B4 _forcond_0=0x6000f2ee0 @ 0x6000ef250)
> test6.c:0:Â Â Â IF (0x6000f2920)
> test6.c:6:Â Â Â Â Â LT(<) (0x6000efa20) type (_Bool fixed)
> test6.c:6:Â Â Â Â Â Â Â SYMBOL (L1 B1 x=0x6000ed8e0 @ 0x6000ed0d0) type
> (int auto)
> test6.c:6:Â Â Â Â Â Â Â CONSTANT (0x6000ef980) value = 0, 0x0, 0.000000
> type
> (const-unsigned-char literal)
> test6.c:0:Â Â Â Â Â NE(!=) 0 goto _forbreak_0
> test6.c:0:Â Â Â Â Â EQ(==) 0 goto _forbody_0
> (null):0:Â Â Â LABEL (0x6000f2c50)
> test6.c:0:Â Â Â Â Â SYMBOL (L3 B4 _forbody_0=0x6000f2bb0 @ 0x6000ef000)
> test6.c:7:Â Â Â ASSIGN(=) (0x6000f0a00) type (int auto)
> test6.c:7:Â Â Â Â Â SYMBOL (L2 B3 ni=0x6000f02a0 @ 0x6000ee1e0) type (int
> auto)
> test6.c:7:Â Â Â Â Â SUB (0x6000f0960) type (int register)
> test6.c:7:Â Â Â Â Â Â Â SYMBOL (L2 B3 ni=0x6000f0690 @ 0x6000ee1e0) type
> (int
> auto)
> test6.c:7:Â Â Â Â Â Â Â CONSTANT (0x6000f1cb0) value = 2, 0x2, 2.000000
> type
> (int literal)
> (null):0:Â Â Â LABEL (0x6000f3590)
> test6.c:0:Â Â Â Â Â SYMBOL (L3 B4 _forcontinue_0=0x6000f34f0 @
> 0x6000eeb60)
> test6.c:6:Â Â Â post-DEC_OP (0x6000efeb0) type (int auto)
> test6.c:6:Â Â Â Â Â SYMBOL (L1 B1 x=0x6000efe10 @ 0x6000ed0d0) type (int
> auto)
> test6.c:0:Â Â Â GOTO (0x6000f31c0)
> test6.c:0:Â Â Â Â Â SYMBOL (L3 B4 _forcond_0=0x6000f3120 @ 0x6000ef250)
> (null):0:Â Â Â LABEL (0x6000f0dd0)
> test6.c:0:Â Â Â Â Â SYMBOL (L3 B4 _forbreak_0=0x6000f0d30 @ 0x6000eedb0)
> (null):0:Â }
> test6.c:9:Â RETURN (0x6000f13a0) type (int auto)
> test6.c:9:Â Â Â SYMBOL (L1 B2 n=0x6000f1300 @ 0x6000eda30) type (int
> auto)
> (null):0:}
>
> int dummy(int x)
> {
> Â Â int n = 0;
> Â Â {
> Â Â int ni = 10;
> Â Â for (;x>=0;x--)
> Â Â Â Â ni = ni - 2;
> Â Â }
> Â Â return n;
> }
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org!
> http://sdm.link/slashdot_______________________________________________
> sdcc-devel mailing list
> sdc...@li...
> https://lists.sourceforge.net/lists/listinfo/sdcc-devel
>
|