Fix comment about meet semilattice rules.
authorManuele Conti <conti.ma@alice.it>
Mon, 24 Dec 2012 16:56:08 +0100
changeset 776 96a1199d0739
parent 775 0422ee273152
child 777 e74a882c8d22
child 780 9fbdf8a7430e
Fix comment about meet semilattice rules.
stage3/constant_folding.cc
--- a/stage3/constant_folding.cc	Sat Dec 22 19:34:57 2012 +0100
+++ b/stage3/constant_folding.cc	Mon Dec 24 16:56:08 2012 +0100
@@ -206,14 +206,16 @@
 		{SET_NONCONST(dtype, symbol);}                                                                            \
 }
 
-/* Meet rules
- * - any * T = any
- * - any * B = B
- * - constant * constant = constant (if equal)
- * - constant * constant = B        (if not equal)
+/* Constant Propagation: Rules for Meet from "Cooper K., Torczon L. - Engineering a Compiler, Second Edition - 2011"
+ * at 9.3 Static Single-Assignment Form  page 517
+ * - any * undefined = any
+ * - any * non_const = non_const
+ * - constant * constant = constant  (if equal)
+ * - constant * constant = non_const (if not equal)
  */
 #define COMPUTE_MEET_SEMILATTICE(dtype, c1, c2, resValue) {\
-		if ((c1._##dtype.value != c2._##dtype.value && c2._##dtype.status == symbol_c::cs_const_value && c1._##dtype.status == symbol_c::cs_const_value) ||\
+		if (( c1._##dtype.value  != c2._##dtype.value && c2._##dtype.status == symbol_c::cs_const_value &&\
+              c1._##dtype.status == symbol_c::cs_const_value) ||\
 		    ( c1._##dtype.status == symbol_c::cs_non_const && c2._##dtype.status == symbol_c::cs_const_value ) ||\
 		    ( c2._##dtype.status == symbol_c::cs_non_const && c1._##dtype.status == symbol_c::cs_const_value  )) {\
 			resValue._##dtype.status = symbol_c::cs_non_const;\