dotgnu-general
[Top][All Lists]
Advanced

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

Re: Optimizations (was Re: [DotGNU]All my tests work)


From: Gopal V
Subject: Re: Optimizations (was Re: [DotGNU]All my tests work)
Date: Wed, 20 Nov 2002 14:06:11 +0530
User-agent: Mutt/1.2.5i

If memory serves me right, Rhys Weatherley wrote:
> (the compiler cannot handle it easily).  Look at "FinishLabels"
> in "ilasm_output.c".  But most of the simple cases of instruction
> replacement (e.g. "ldloc 3" => "ldloc.3") are already handled by
> the compiler or the assembler.

Hehe ... as usual , all the simple cases are done :-)

> There are some possibilities for "reduction in strength" and
> "arithmetic equivalence" optimizations.  e.g. converting "x * 2"
> into "x << 1" if "x" is an integer type.  This would probably need
> to be handled in "cg_arith.tc", 

Hmm... I would rather do it in cs_oper.tc ? ... Calling EvalConst on the
codegen seems ugly to me .... Considering the fact that we already do a
constant folding (ILEvalOperator) step in the SemAnalysis ?.. 

> until we have better dynamic flow analysis in the compiler (right
> now we have none).

/me dreams on about doing a CSOptmizerIsInVariant(info, node->body, var) ;
and CSOptmizerIsUnused(info, node->body, var); .... which in my very humble
opinion are very similar to ILNodeEndsInFlowChange.. (assign expressions 
with var in lvalue and out or ref parameters seem the only variant cases ,
and the second could use ILNode_Identifier's semanalysis ?).

Also we might even use a bitset for vars in each ScopeChange, inherit it from
the parents' ... This will allow us to check for "'x' may be used before 
initialization" cases.....

But well ... I'll leave cscc clean of such hacks until 0.4.8 .. (when is
the big release Rhys ? ....)

> If someone wants to look into optimizations, I suggest adding an
> "optimize_flag" to "ILGenInfo" (cg_gen.h), and then start looking
> into simple arithmetic reduction in strength optimizations.  That
> will be a good starting point to get experience before thinking
> about the more complex cases.

Ok ... I'm on the Multiply and Divide operations conversion to shifts..

Hmm... also need to make sure we don't mess up actual compilation here,
because cscctest won't do much good for this ....

Gopal
-- 
The difference between insanity and genius is measured by success


reply via email to

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