[M3commit] CVS Update: cm3

Jay K jay.krell at cornell.edu
Tue Jul 6 21:39:20 CEST 2010


attachments don't seem to be working, we'll see if this is readable..


Index: m3cc/gcc/gcc/m3cg/parse.c
===================================================================
RCS file: /usr/cvs/cm3/m3-sys/m3cc/gcc/gcc/m3cg/parse.c,v
retrieving revision 1.218
diff -u -r1.218 parse.c
--- m3cc/gcc/gcc/m3cg/parse.c    5 Jul 2010 22:16:43 -0000    1.218
+++ m3cc/gcc/gcc/m3cg/parse.c    6 Jul 2010 19:32:16 -0000
@@ -5715,7 +5715,7 @@
 #endif
     /*flag_strict_aliasing = 0;*/ /* consider? */
     /*flag_strict_overflow = 0;*/ /* consider? */
-    flag_tree_ter = 0; /* fails to compile m3core CopySign */
+    /*flag_tree_ter = 0;*/ /* used to break m3core CopySign, see m3front/CastExpr */
     /*flag_delete_null_pointer_checks = 0;*/ /* consider? */
     /*flag_reorder_functions = 0;*/ /* consider? */
   }
Index: m3front/src/exprs/CastExpr.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-sys/m3front/src/exprs/CastExpr.m3,v
retrieving revision 1.9
diff -u -r1.9 CastExpr.m3
--- m3front/src/exprs/CastExpr.m3    5 Jul 2010 11:28:32 -0000    1.9
+++ m3front/src/exprs/CastExpr.m3    6 Jul 2010 19:32:16 -0000
@@ -10,6 +10,7 @@
 
 IMPORT M3Buf, CG, Expr, ExprRep, Type, Error, OpenArrayType;
 IMPORT M3, M3ID, M3RT, Target, TInt;
+FROM Target IMPORT FloatType;
 
 TYPE
   Kind = {
@@ -394,7 +395,7 @@
     u  := Expr.TypeOf (e);
     t  := p.tipe;
     sz, t_align, u_align, z_align: INTEGER;
-    u_cg: CG.Type;
+    t_cg, u_cg: CG.Type;
     u_info, t_info: Type.Info;
   BEGIN
     u := Type.CheckInfo (u, u_info);
@@ -402,6 +403,7 @@
     t_align := t_info.alignment;
     u_align := u_info.alignment;
     z_align := MAX (t_align, u_align);
+    t_cg := t_info.stk_type;
     u_cg := u_info.stk_type;
     sz := u_info.size;
     Type.Compile (t);
@@ -417,6 +419,21 @@
         Expr.CompileLValue (p.expr, traced);
         CG.Boost_alignment (t_align);
 
+        (* Inhibit some optimization that causes compilation to fail. e.g.:
+         * m3core/src/float/IEEE/RealFloat.m3:
+         * In function 'RealFloat__CopySign':
+         * internal compiler error: in convert_move, at expr.c:371
+         *
+         * ?Force() inhibits optimizations done by m3front/src/misc/CG.m3?
+         * ?The particular optimizations are removal of address taken and
+         * pointer indirections? ?Leaving the address taken inhibits
+         * gcc optimization? ?Given that this is LOOPHOLE and floating point,
+         * inhibiting optimization is very ok?
+         *)
+        IF p.kind = Kind.D_to_S AND (FloatType[t_cg] # FloatType[u_cg]) THEN
+          CG.Force ();
+        END;
+
     | Kind.D_to_A,
       Kind.S_to_A,
       Kind.V_to_A =>






----------------------------------------
> Date: Tue, 6 Jul 2010 21:36:58 +0000
> To: m3commit at elegosoft.com
> From: jkrell at elego.de
> Subject: [M3commit] CVS Update: cm3
>
> CVSROOT: /usr/cvs
> Changes by: jkrell at birch. 10/07/06 21:36:58
>
> Modified files:
> cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c
> cm3/m3-sys/m3front/src/exprs/: CastExpr.m3
>
> Log message:
> allow "ter"/-O3, but without causing compiling CopySign in
> m3core/src/float/IEEE/RealFloat.m3 to fail to compile:
> internal compiler error: in convert_move, at expr.c
>
> This change might not go far enough though.
> We might want to call Force() more often.
>
> The theory here is, I don't completely know, but that Force()
> inhibits optimizations done by m3front/src/misc/CG.m3, such
> as that might remove "taking the address of", which would
> then inhibit optimizations by the backend.
>
> Optimizations are being inhibited here specifically for
> unsafe code that is casting floats to structures, surely
> an acceptable small amount of code. In fact, again, consider
> doing this more.
>
 		 	   		  


More information about the M3commit mailing list