[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc grammar problems

From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] tcc grammar problems
Date: Wed, 13 Aug 2014 21:43:05 +0800
User-agent: KMail/4.12.4 (Linux/3.14-2-amd64; KDE/4.13.3; x86_64; ; )

Le lundi 11 août 2014, 00:39:17 jiang a écrit :
> +/* gen_ctrl */
> +enum {
> +    CTRL_NONE,
> +    CTRL_CALL,
> +    CTRL_FOCE,
> +    CTRL_ARGS,
> +    CTRL_RETS,
> +    CTRL_INIT,
> +    CTRL_USED,
> +};
> +ST_DATA int gen_ctrl;
> This is  one of my  local branch  code,  want to join the  mob  after

Alright, I don't really want to see your local branch as long as it's not 
ready. Just remove the unused enum for now and add them later in the patches 
that add the pieces you are still working on.

> > 
> > Why this vtop > (vstack + 1)? What's so special about a stack with 3
> > entries or more? It looks fishy.
> For example  the following expression:
> a = b = c; -> (a = (b = c));
> Requires  three  SValue,  will  be greater than  vstack + 1, ret  equal to
> 1. Return  right  value
> a = b
> Less than or equal  vstack + 1, ret  equal to  0.
> Does not return  the right  value
> Generate  less  machine code

Maybe but that seems wrong. Why not have some code for when you have 3 
assignments? It's inelegant as it is now.

You should only deal with one assignment at a time so 2 Svalue. In the first 
example you give, it means dealing with b = c, then return the Svalue that 
correspond to it and then process the a = result assignment that has only 2 
Svalue. Improving the right way would mean not generating the code right away 
and doing a pass after that.

The final result of your patch should be quite small. If not, either I 
underestimate the difficulty of this bug fix (it's quite possible) or you 
overcomplicated things.



Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]