Author: chenr Date: 2010-11-01 03:37:56 -0400 (Mon, 01 Nov 2010) New Revision: 3383
Modified: trunk/osprey/be/opt/opt_etable.cxx trunk/osprey/be/opt/opt_htable_emit.cxx trunk/osprey/be/opt/opt_sym.cxx trunk/osprey/be/opt/opt_wn.cxx trunk/osprey/common/com/wn_core.h Log: Added a new "WN_change_operator" method. Modified all "WN_set_operator" invocations in wopt to "WN_change_operator". Approved by Sun Chan. Modified: trunk/osprey/be/opt/opt_etable.cxx =================================================================== --- trunk/osprey/be/opt/opt_etable.cxx 2010-10-28 20:59:08 UTC (rev 3382) +++ trunk/osprey/be/opt/opt_etable.cxx 2010-11-01 07:37:56 UTC (rev 3383) @@ -484,7 +484,7 @@ Field_id()); if (opt_stab->Bit_size (Aux_id()) > 0) { - WN_set_operator (home_wn, OPR_LDBITS); + WN_change_operator (home_wn, OPR_LDBITS); WN_set_bit_offset_size (home_wn, Bit_offset (), Bit_size ()); } } Modified: trunk/osprey/be/opt/opt_htable_emit.cxx =================================================================== --- trunk/osprey/be/opt/opt_htable_emit.cxx 2010-10-28 20:59:08 UTC (rev 3382) +++ trunk/osprey/be/opt/opt_htable_emit.cxx 2010-11-01 07:37:56 UTC (rev 3383) @@ -349,7 +349,7 @@ #ifdef TARG_LOONGSON // Need to change operator of induction to OPT_LDBITS when induction is BITs variable if (iv->Points_to(Opt_stab())->Bit_Size() != 0) - WN_set_operator(induction, OPR_LDBITS); + WN_change_operator(induction, OPR_LDBITS); #endif if (Do_rvi() && ST_class(WN_st(induction)) != CLASS_PREG) { Warn_todo("ML_WHIRL_EMITTER::Build_loop_info: do not adjust bitpos by 1" ); Modified: trunk/osprey/be/opt/opt_sym.cxx =================================================================== --- trunk/osprey/be/opt/opt_sym.cxx 2010-10-28 20:59:08 UTC (rev 3382) +++ trunk/osprey/be/opt/opt_sym.cxx 2010-11-01 07:37:56 UTC (rev 3383) @@ -1727,7 +1727,10 @@ OPERATOR_name(opr))); rtype = WN_rtype(twn); desc = WN_desc(twn); - WN_set_operator(wn, opr); + // reset map_id since OPR_INTCONST is in different mapcat group than OPR_LDID/OPR_LDBITS. + if (opr == OPR_INTCONST) + WN_set_map_id(wn, -1); + WN_change_operator(wn, opr); WN_set_rtype(wn, rtype); WN_set_desc(wn, desc); if (opr == OPR_INTCONST) @@ -1760,7 +1763,7 @@ opr = WN_operator(twn); rtype = WN_rtype(twn); desc = WN_desc(twn); - WN_set_operator(wn, opr); + WN_change_operator(wn, opr); WN_set_rtype(wn, rtype); WN_set_desc(wn, desc); WN_load_offset(wn) = WN_load_offset(twn); @@ -1791,7 +1794,7 @@ if (opr == OPR_TRUEBR && WN_const_val(test) != 0 || opr == OPR_FALSEBR && WN_const_val(test) == 0) { WN_Delete(test); - WN_set_operator(wn, OPR_GOTO); + WN_change_operator(wn, OPR_GOTO); WN_set_rtype(wn, MTYPE_V); WN_set_desc(wn, MTYPE_V); WN_set_kid_count(wn, 0); Modified: trunk/osprey/be/opt/opt_wn.cxx =================================================================== --- trunk/osprey/be/opt/opt_wn.cxx 2010-10-28 20:59:08 UTC (rev 3382) +++ trunk/osprey/be/opt/opt_wn.cxx 2010-11-01 07:37:56 UTC (rev 3383) @@ -1500,10 +1500,10 @@ if (sym->Bit_size () > 0) { if (sym->Field_id() == 0) { - WN_set_operator (rhs, OPR_LDBITS); + WN_change_operator (rhs, OPR_LDBITS); WN_set_bit_offset_size (rhs, sym->Bit_ofst (), sym->Bit_size ()); - WN_set_operator (copy, OPR_STBITS); + WN_change_operator (copy, OPR_STBITS); WN_set_bit_offset_size (copy, sym->Bit_ofst (), sym->Bit_size ()); } else { // if field id != 0, then it is MTYPE_BS, not LD_BITS Modified: trunk/osprey/common/com/wn_core.h =================================================================== --- trunk/osprey/common/com/wn_core.h 2010-10-28 20:59:08 UTC (rev 3382) +++ trunk/osprey/common/com/wn_core.h 2010-11-01 07:37:56 UTC (rev 3383) @@ -668,6 +668,7 @@ friend inline OPERATOR WN_operator (const WN *); friend inline void WN_set_operator (WN *, OPERATOR); + friend inline void WN_change_operator (WN *, OPERATOR); friend inline TYPE_ID WN_rtype (const WN *); friend inline void WN_set_rtype (WN *, TYPE_ID); friend inline INT WN_kid_count (const WN *); @@ -809,6 +810,12 @@ inline OPERATOR WN_operator (const WN* wn) { return wn->common.wn_operator; } inline void WN_set_operator (WN* wn, OPERATOR opr) { wn->common.wn_operator = opr; } +inline void WN_change_operator (WN* wn, OPERATOR opr) { + Is_True((WN_map_id(wn) == -1 || + OPERATOR_mapcat(WN_operator(wn)) == OPERATOR_mapcat(opr)), + ("WN's new operator belongs to a different mapcat in Create_identity_assignment")); + WN_set_operator(wn, opr); +} inline TYPE_ID WN_rtype (const WN* wn) { return wn->common.rtype; } inline void WN_set_rtype (WN* wn, TYPE_ID ty) { wn->common.rtype = ty; } inline INT WN_kid_count (const WN* wn) { return OPERATOR_nkids(WN_operator(wn)) == -1 ? wn->common.kid_count : OPERATOR_nkids(WN_operator(wn)); } ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel