tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] /* suppress this mess */ expr_land_const


From: Fabrice Bellard
Subject: Re: [Tinycc-devel] /* suppress this mess */ expr_land_const
Date: Fri, 07 Mar 2003 00:29:00 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.1) Gecko/20020828


The problem is that constant evaluation for &&, || and ?: is handled in different functions than the nominal case. I find it less elegant and more error prone. Moreover, it does not allow some kind of jump optimizations in these constructs. I think that a generic dead code elimination system would solve this problem, but the challenge is to do it without complicating TCC too much :-)

Fabrice.

Peter "Firefly" Lund wrote:
What is wrong with these bits of tcc.c ?

/* XXX: suppress this mess */
static void expr_land_const(void)
{
    expr_or();
    while (tok == TOK_LAND) {
        next();
        expr_or();
        gen_op(TOK_LAND);
    }
}

/* XXX: suppress this mess */
static void expr_lor_const(void)
{
    expr_land_const();
    while (tok == TOK_LOR) {
        next();
        expr_land_const();
        gen_op(TOK_LOR);
    }
}

It looks like a rather standard recursive descent parser to me.

(ok, the names puzzle me -- why do they end in _const?)

-Peter


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/tinycc-devel




--
Fabrice.





reply via email to

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