Author: minz Date: 2010-12-22 18:03:38 -0500 (Wed, 22 Dec 2010) New Revision: 3446
Modified: trunk/osprey/common/com/wn_simp_code.h Log: Fix a problem in simplifier. SIMP_Is_Constant is used to detect whether a simpnode is a constant or not. SIMP_Is_Constant will also return true for string constant. While in the simplifying functions (e.g., simp_bxor, simp_bior), only int constant is expected. The fix is to add a function, SIMP_Int_Str_ConstVal, to handle both int and string constant case. The uses of SIMP_Int_ConstVal inside simplifying functions are changed to SIMP_Int_Str_ConstVal. Code Review: Sun Chan Modified: trunk/osprey/common/com/wn_simp_code.h =================================================================== --- trunk/osprey/common/com/wn_simp_code.h 2010-12-21 20:49:40 UTC (rev 3445) +++ trunk/osprey/common/com/wn_simp_code.h 2010-12-22 23:03:38 UTC (rev 3446) @@ -530,6 +530,16 @@ } #endif // KEY +inline INT64 SIMP_Int_Str_ConstVal(simpnode x) +{ + if (SIMP_Is_Int_Constant (x)) + return SIMP_Int_ConstVal(x); + else if (SIMP_Is_Str_Constant (x)) + return Targ_To_Host(SIMP_Str_ConstVal(x)); + else + Fail_FmtAssertion("Not a int/str constant"); +} + #define IS_POWER_OF_2(x) (((x)!=0) && ((x) & ((x)-1))==0) /* Utility routine to create a 64 bit number with from 0 to 64 bits in it. @@ -3644,7 +3654,7 @@ ty = OPCODE_rtype(opc); if (k1const) { - c1 = SIMP_Int_ConstVal(k1); + c1 = SIMP_Int_Str_ConstVal(k1); if (c1 == 0) { SHOW_RULE("j&0"); r = SIMP_INTCONST(ty,0); @@ -3803,18 +3813,8 @@ ty = OPCODE_rtype(opc); if (k1const) { -#ifdef TARG_IA64 - if (SIMP_Is_Int_Constant (k1)) { - c1 = SIMP_Int_ConstVal(k1); - } else if (SIMP_Is_Str_Constant (k1)) { - c1 = Targ_To_Host (SIMP_Str_ConstVal (k1)); - } else { - Fail_FmtAssertion ("Not a int/str constant"); - } -#else - c1 = SIMP_Int_ConstVal(k1); -#endif - if (c1 == 0) { + c1 = SIMP_Int_Str_ConstVal(k1); + if (c1 == 0) { SHOW_RULE("j|0"); r = k0; SIMP_DELETE(k1); @@ -4038,7 +4038,7 @@ ty = OPCODE_rtype(opc); if (k1const) { - c1 = SIMP_Int_ConstVal(k1); + c1 = SIMP_Int_Str_ConstVal(k1); if (c1 == 0) { SHOW_RULE("j^0"); r = k0; @@ -4123,7 +4123,7 @@ ty = OPCODE_rtype(opc); if (k1const) { - c1 = SIMP_Int_ConstVal(k1); + c1 = SIMP_Int_Str_ConstVal(k1); if (c1 == 0) { SHOW_RULE(" j&&0"); r = SIMP_INTCONST(ty,0); @@ -4195,7 +4195,7 @@ ty = OPCODE_rtype(opc); if (k1const) { - c1 = SIMP_Int_ConstVal(k1); + c1 = SIMP_Int_Str_ConstVal(k1); if (c1 == 0) { SHOW_RULE("j||0"); r = k0; @@ -4253,7 +4253,7 @@ INT64 c1; if (k0const) { - c1 = SIMP_Int_ConstVal(k0); + c1 = SIMP_Int_Str_ConstVal(k0); if (c1 == 0) { SHOW_RULE(" 0 c&& j"); r = SIMP_INTCONST(OPCODE_rtype(opc),0); @@ -4265,7 +4265,7 @@ SIMP_DELETE(k0); } } else if (k1const) { - c1 = SIMP_Int_ConstVal(k1); + c1 = SIMP_Int_Str_ConstVal(k1); if (c1 != 0) { SHOW_RULE(" j c&& 1"); r = k0; @@ -4311,7 +4311,7 @@ #endif if (k0const) { - c1 = SIMP_Int_ConstVal(k0); + c1 = SIMP_Int_Str_ConstVal(k0); if (c1 == 0) { SHOW_RULE("0 c|| j"); r = k1; @@ -4323,7 +4323,7 @@ SIMP_DELETE_TREE(k1); } } else if (k1const) { - c1 = SIMP_Int_ConstVal(k1); + c1 = SIMP_Int_Str_ConstVal(k1); if (c1 == 0) { SHOW_RULE("j c|| 0"); r = k0; ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel