[M3commit] CVS Update: cm3
Jay Krell
jkrell at elego.de
Wed Jan 9 07:14:57 CET 2013
CVSROOT: /usr/cvs
Changes by: jkrell at birch. 13/01/09 07:14:57
Modified files:
cm3/m3-sys/m3back/src/: M3C.m3
Log message:
use locals to capture the values for check_hi/lo/nil/range/index,
but not check_eq -- it doesn't need it, due to inconsistency in M3CG.
Note that this is nice and conservative and should save some
duplicate evaluation, but whatever cases I looked at, it is pretty bad.
Here are the ones I looked at:
Xor.mg in m3front:
PROCEDURE Compile (ce: CallExpr.T) =
BEGIN
Expr.Compile (ce.args[0]);
Expr.Compile (ce.args[1]);
CG.Xor (Word_types[rep].cg_type);
END Compile;
check_index is applied to "0" and "1".
Constants.
No point in the temporary.
It is easy to optimize away..but it is not easy to
not allocate the temporary. Temporaries are allocated
with way less information.
WordInsert:
(*(INT64*)(&L_277_L_278))=(INT64)( /* cast_removed2: INT64 */ i2_L_138);
//line 111 "../AMD64_DARWIN/WordInsert.m3 => ../src/builtinWord/Insert.mg"
/*check_lo*/if(L_277_L_278<M3_INT64(0))M_WordInsert_L_111_CRASH(3553);
A simple algorithm is that "variables" (not casted, not offset)
and constants, should not be stored in a temporary, but instead
used directly. Even offsets could be ok -- struct field references.
If we generated C++ instead of C, the solution would be easy.
Introduce temporaries as needed. W/o needing braces.
NOTE that the gcc backend doesn't introduce temporaries.
It seemingly evaluates stuff multiple times.
Solving this requires multiple passes, where the data
evolves more signficantly as passes run.
This utilitizes relatively new infrastructure.
All operations in the M3CG_MultiPass are now given an index.
Data can now be easily/directly maintained on the size, per operation.
This is similar to "extending" the representation, but doesn't require
modifying the one central representation.
More information about the M3commit
mailing list