Author: laijx
Date: 2010-08-24 22:12:27 -0400 (Tue, 24 Aug 2010)
New Revision: 3320

Modified:
   trunk/osprey/be/com/opt_alias_mgr.cxx
   trunk/osprey/be/com/opt_points_to.h
   trunk/osprey/be/opt/opt_alias_analysis.cxx
   trunk/osprey/be/opt/opt_emit_template.h
   trunk/osprey/be/opt/opt_sym.cxx
   trunk/osprey/be/opt/opt_wn.cxx
   trunk/osprey/common/com/wn_core.h
   trunk/osprey/wgen/wgen_expr.cxx
Log:
Enable PARM_DEREFERENCE on all platforms.
PARM_DEREFERENCE is introduced by SL to model the side-effect of the
intrinsic op:
(PARM_BY_VALUE | PARM_DEREFERENCE) means the parameter is a pointer passed
by value and it will be dereferenced in the callee.

Approved by Fred.


Modified: trunk/osprey/be/com/opt_alias_mgr.cxx
===================================================================
--- trunk/osprey/be/com/opt_alias_mgr.cxx       2010-08-25 01:42:50 UTC (rev 
3319)
+++ trunk/osprey/be/com/opt_alias_mgr.cxx       2010-08-25 02:12:27 UTC (rev 
3320)
@@ -1130,13 +1130,8 @@
     // Test aliasing with call-by-ref parameters
     for (INT32 i = 0; i < WN_kid_count(region_or_call); i++) {
       WN *wn = WN_kid(region_or_call,i);  
-#if defined(TARG_SL)
       if (WN_operator(wn) == OPR_PARM && 
          (WN_Parm_By_Reference(wn)||WN_Parm_Dereference(wn))) {
-#else
-      if (WN_operator(wn) == OPR_PARM && 
-         WN_Parm_By_Reference(wn)) {
-#endif
        // check aliasing
        IDTYPE id2 = am->Id(wn);
        if (id2 == 0) return POSSIBLY_ALIASED;  // assume aliased 
@@ -1193,11 +1188,7 @@
   // go through call-by-ref all parameters
   for (INT32 i = 0; i < WN_kid_count(intr_op); i++) {
     WN *wn = WN_kid(intr_op,i);  
-#if defined(TARG_SL)
     if (WN_Parm_By_Reference(wn) || WN_Parm_Dereference(wn)) {
-#else
-    if (WN_Parm_By_Reference(wn)) {
-#endif
       // check aliasing
       IDTYPE id2 = am->Id(wn);
       if (id2 == 0) return POSSIBLY_ALIASED;  // assume aliased 
@@ -1343,11 +1334,7 @@
        ST_sclass(WN_st(wn1)) == SCLASS_REG) {
       id = am->Preg_id();
       am->Set_id(wn1, id);
-#if defined(TARG_SL)
     } else if (opr == OPR_PARM && !WN_Parm_By_Reference(wn1) && 
!WN_Parm_Dereference(wn1)) {
-#else
-    } else if (opr == OPR_PARM && !WN_Parm_By_Reference(wn1)) {
-#endif
       // It has no alias info.
       am->Set_id(wn2, 0);    // cancel the original alias info in wn2
       return;
@@ -1394,11 +1381,7 @@
        ST_sclass(WN_st(wn1)) == SCLASS_REG) {
       id = am->Preg_id();
       am->Set_id(wn1, id);
-#if defined(TARG_SL)
     } else if (opr == OPR_PARM && !WN_Parm_By_Reference(wn1) && 
!WN_Parm_Dereference(wn1)) {
-#else
-    } else if (opr == OPR_PARM && !WN_Parm_By_Reference(wn1)) {
-#endif
       // It has no alias info.
       am->Set_id(wn2, 0);    // cancel the original alias info in wn2
       return;

Modified: trunk/osprey/be/com/opt_points_to.h
===================================================================
--- trunk/osprey/be/com/opt_points_to.h 2010-08-25 01:42:50 UTC (rev 3319)
+++ trunk/osprey/be/com/opt_points_to.h 2010-08-25 02:12:27 UTC (rev 3320)
@@ -917,6 +917,7 @@
     if(INTRN_copy_addr(WN_intrinsic(wn)))
       return Find_addr_recur(WN_kid0(WN_kid0(wn)),stab);
     return NULL;
+#endif
 
   case OPR_PARM:
     if ((WN_Parm_By_Reference(wn) || WN_Parm_Dereference(wn)) && 
WN_kid_count(wn))
@@ -924,14 +925,6 @@
     // otherwise, there is no address expression
     return NULL;
 
-#else
-  case OPR_PARM:
-    // if it is called by reference, LDID is a addr expr
-    if (WN_Parm_By_Reference(wn) && WN_kid_count(wn))
-      return Find_addr_recur(WN_kid0(wn), stab);
-    // otherwise, there is no address expression
-    return NULL;
-#endif
   case OPR_LDA:
     return wn;
   case OPR_LDID:

Modified: trunk/osprey/be/opt/opt_alias_analysis.cxx
===================================================================
--- trunk/osprey/be/opt/opt_alias_analysis.cxx  2010-08-25 01:42:50 UTC (rev 
3319)
+++ trunk/osprey/be/opt/opt_alias_analysis.cxx  2010-08-25 02:12:27 UTC (rev 
3320)
@@ -984,7 +984,7 @@
       }
     }
     break;
-#if defined(TARG_SL)
+
   case OPR_PARM:
     if( WN_Parm_Dereference(wn) ) {
       Simplify_Pointer( WN_kid0(wn), &ai );
@@ -1012,7 +1012,6 @@
       }
       break;
     }
-#endif
 
   case OPR_ISTORE:
   case OPR_ISTBITS:
@@ -2315,11 +2314,7 @@
     break;
 
   case OPR_PARM:
-#if defined(TARG_SL)
     if ( WN_Parm_By_Reference(wn) || WN_Parm_Dereference(wn) ) {
-#else
-    if ( WN_Parm_By_Reference(wn) ) {
-#endif
 #ifdef KEY
       if (WOPT_Enable_New_Vsym_Allocation) {
         POINTS_TO pt;
@@ -3215,11 +3210,7 @@
 
   case OPR_PARM:
     // generating the mu-list for parameters.
-    if ( WN_Parm_By_Reference(wn) 
-#if defined(TARG_SL)
-         || WN_Parm_Dereference(wn)
-#endif
-                   ) {
+    if ( WN_Parm_By_Reference(wn) || WN_Parm_Dereference(wn) ) {
       occ = Get_occ(wn);
       AUX_ID vp_idx = occ->Aux_id();
       // With virtual var, PARM only cares about its own vp.
@@ -3370,11 +3361,7 @@
     if (OPCODE_is_load(opc) ||
        OPCODE_is_store(opc) ||
        opr == OPR_LDA ||
-#if defined(TARG_SL)
        (opr == OPR_PARM && (WN_Parm_By_Reference(wn) || 
WN_Parm_Dereference(wn)))) {
-#else
-       (opr == OPR_PARM && WN_Parm_By_Reference(wn))) {
-#endif
       if (OPERATOR_is_scalar_load (opr) || OPERATOR_is_scalar_store (opr) ||
          opr == OPR_LDA) {
        POINTS_TO *sym_pt = Aux_stab_entry(WN_aux(wn))->Points_to();
@@ -4064,12 +4051,10 @@
           OPCODE_name(opc)));
   
   OCC_TAB_ENTRY *occ;
-#if defined(TARG_SL)
+
   if (OPERATOR_is_scalar_iload (opr) || opr == OPR_MLOAD ||
       (opr == OPR_PARM && WN_Parm_Dereference(wn))) {
-#else
-  if (OPERATOR_is_scalar_iload (opr) || opr == OPR_MLOAD) {
-#endif
+
     // to be consistent with OPR_ISTORE
     occ = Get_occ(wn);
 

Modified: trunk/osprey/be/opt/opt_emit_template.h
===================================================================
--- trunk/osprey/be/opt/opt_emit_template.h     2010-08-25 01:42:50 UTC (rev 
3319)
+++ trunk/osprey/be/opt/opt_emit_template.h     2010-08-25 02:12:27 UTC (rev 
3320)
@@ -578,12 +578,8 @@
       }
 #endif
       wn = WN_CreateParm(exp->Dtyp(), wn, exp->Ilod_ty(), exp->Offset());
-#if defined(TARG_SL)
-      // avoid cse of implicit aliases stuff, mostly in sl specific intrinsics
+      // avoid cse of implicit aliases stuff
       if (WN_Parm_By_Reference(wn) || WN_Parm_Dereference(wn)) {
-#else
-      if (WN_Parm_By_Reference(wn)) {
-#endif
        POINTS_TO *pt = exp->Points_to(emitter->Opt_stab());
        Is_True(pt != NULL, ("Reference parameter has NULL POINTS_TO."));
        emitter->Alias_Mgr()->Gen_alias_id(wn, pt);

Modified: trunk/osprey/be/opt/opt_sym.cxx
===================================================================
--- trunk/osprey/be/opt/opt_sym.cxx     2010-08-25 01:42:50 UTC (rev 3319)
+++ trunk/osprey/be/opt/opt_sym.cxx     2010-08-25 02:12:27 UTC (rev 3320)
@@ -369,9 +369,7 @@
   // Fix 625656:
   //  Catch the cases not covered by addr_saved in be/com/opt_addr_flags.cxx.
   if (WN_operator(wn) == OPR_PARM && (
-#if defined(TARG_SL)
       WN_Parm_Dereference(wn) ||
-#endif
       WN_Parm_By_Reference(wn) || WN_Parm_Passed_Not_Saved(wn))) 
     Collect_addr_passed(WN_kid0(wn));
   //

Modified: trunk/osprey/be/opt/opt_wn.cxx
===================================================================
--- trunk/osprey/be/opt/opt_wn.cxx      2010-08-25 01:42:50 UTC (rev 3319)
+++ trunk/osprey/be/opt/opt_wn.cxx      2010-08-25 02:12:27 UTC (rev 3320)
@@ -347,11 +347,7 @@
        return TRUE;
     }
     case OPR_PARM:
-#if defined(TARG_SL)
       return (WN_Parm_By_Reference(wn) || WN_Parm_Dereference(wn));
-#else
-      return (WN_Parm_By_Reference(wn));
-#endif
     default:
       return FALSE;
   }

Modified: trunk/osprey/common/com/wn_core.h
===================================================================
--- trunk/osprey/common/com/wn_core.h   2010-08-25 01:42:50 UTC (rev 3319)
+++ trunk/osprey/common/com/wn_core.h   2010-08-25 02:12:27 UTC (rev 3320)
@@ -1502,13 +1502,10 @@
 #define WN_PARM_NOT_EXPOSED_USE   0x40  /* there is no exposed use */
 #define WN_PARM_IS_KILLED   0x80        /* the parameter is killed, for
                                           pass by reference */
+#define WN_PARM_DEREFERENCE         0x100 /* parm is deferenced in callee */
+#define WN_Parm_Dereference(x)          (WN_parm_flag(x) & WN_PARM_DEREFERENCE)
+#define WN_Set_Parm_Dereference(x)      (WN_parm_flag(x) |= 
WN_PARM_DEREFERENCE)
 
-#if defined(TARG_SL)
-#define WN_PARM_DEREFERENCE  0x100
-#define WN_Parm_Dereference(x)         (WN_parm_flag(x) & WN_PARM_DEREFERENCE)
-#define WN_Set_Parm_Dereference(x)   (WN_parm_flag(x) |= WN_PARM_DEREFERENCE)
-#endif // TARG_SL
-
 #define WN_Parm_By_Reference(x)                (WN_parm_flag(x) & 
WN_PARM_BY_REFERENCE)
 #define WN_Set_Parm_By_Reference(x)    (WN_parm_flag(x) |= 
WN_PARM_BY_REFERENCE)
 #define WN_Parm_By_Value(x)            (WN_parm_flag(x) & WN_PARM_BY_VALUE)

Modified: trunk/osprey/wgen/wgen_expr.cxx
===================================================================
--- trunk/osprey/wgen/wgen_expr.cxx     2010-08-25 01:42:50 UTC (rev 3319)
+++ trunk/osprey/wgen/wgen_expr.cxx     2010-08-25 02:12:27 UTC (rev 3320)
@@ -449,37 +449,6 @@
   return NULL;
 }
 
-static void WN_Set_Deref_If_Needed(WN *wn) {
-  INTRINSIC intrn=WN_intrinsic(wn);
-  if (intrinsic_need_deref(intrn)) {
-    INTRN_ATTR_EXTEND *p=Get_intrinsic_op_Eattr(intrn);
-
-    switch (p->pos) {
-      case P0:
-        WN_Set_Parm_Dereference(WN_kid(wn,0));  break;
-      case P1:
-        WN_Set_Parm_Dereference(WN_kid(wn,1));  break;
-      case P2:
-        WN_Set_Parm_Dereference(WN_kid(wn,2));  break;
-      case P3:
-        WN_Set_Parm_Dereference(WN_kid(wn,3));  break;
-      case P4:
-        WN_Set_Parm_Dereference(WN_kid(wn,4));  break;
-      case P0_P2:
-        WN_Set_Parm_Dereference(WN_kid(wn,0)); 
WN_Set_Parm_Dereference(WN_kid(wn,2)); break;
-      case P1_P3:
-        WN_Set_Parm_Dereference(WN_kid(wn,1)); 
WN_Set_Parm_Dereference(WN_kid(wn,3)); break;
-      case P2_P4:
-        WN_Set_Parm_Dereference(WN_kid(wn,2)); 
WN_Set_Parm_Dereference(WN_kid(wn,4)); break;
-      case P3_P4:
-        WN_Set_Parm_Dereference(WN_kid(wn,3)); 
WN_Set_Parm_Dereference(WN_kid(wn,4)); break;
-      default:
-        Is_True(0, ("intrinsic has no extended attribution"));
-    }
-  }
-        return;
-}
-
 static int intrinsic_op_extend_kid (int index) {
    return intrn_eattr[index].extend_kid;
 }
@@ -604,6 +573,47 @@
 }
 #endif
 
+static void WN_Set_Deref_If_Needed(WN *wn) {
+  INTRINSIC intrn=WN_intrinsic(wn);
+
+#if defined(TARG_SL)
+  if (intrinsic_need_deref(intrn)) {
+    INTRN_ATTR_EXTEND *p=Get_intrinsic_op_Eattr(intrn);
+
+    switch (p->pos) {
+      case P0:
+        WN_Set_Parm_Dereference(WN_kid(wn,0));  break;
+      case P1:
+        WN_Set_Parm_Dereference(WN_kid(wn,1));  break;
+      case P2:
+        WN_Set_Parm_Dereference(WN_kid(wn,2));  break;
+      case P3:
+        WN_Set_Parm_Dereference(WN_kid(wn,3));  break;
+      case P4:
+        WN_Set_Parm_Dereference(WN_kid(wn,4));  break;
+      case P0_P2:
+        WN_Set_Parm_Dereference(WN_kid(wn,0)); 
WN_Set_Parm_Dereference(WN_kid(wn,2)); break;
+      case P1_P3:
+        WN_Set_Parm_Dereference(WN_kid(wn,1)); 
WN_Set_Parm_Dereference(WN_kid(wn,3)); break;
+      case P2_P4:
+        WN_Set_Parm_Dereference(WN_kid(wn,2)); 
WN_Set_Parm_Dereference(WN_kid(wn,4)); break;
+      case P3_P4:
+        WN_Set_Parm_Dereference(WN_kid(wn,3)); 
WN_Set_Parm_Dereference(WN_kid(wn,4)); break;
+      default:
+        Is_True(0, ("intrinsic has no extended attribution"));
+    }
+  }
+#elif defined(TARG_X8664)
+  if (intrn == INTRN_LOADLPD || intrn == INTRN_LOADHPD ||
+      intrn == INTRN_LOADLPS || intrn == INTRN_LOADHPS ||
+      intrn == INTRN_LOADUPS || intrn == INTRN_LOADUPS256 ||
+      intrn == INTRN_LOADUPD || intrn == INTRN_LOADUPD256 ||
+      intrn == INTRN_LOADDQU || intrn == INTRN_LOADDQU256) {
+    WN_Set_Parm_Dereference(WN_kid(wn,0));
+  }
+#endif
+}
+
 // KEY bug 11288: support for anonymous unions:
 // ---------------------------------------------
 // GNU3 based front-end:
@@ -9315,9 +9325,8 @@
 #endif
            wn = WN_Create_Intrinsic (OPR_INTRINSIC_OP, ret_mtype, MTYPE_V,
                                      iopc, num_args, ikids);
-#if defined(TARG_SL)
             WN_Set_Deref_If_Needed(wn);
-#endif
+
 #ifdef KEY
            if (cvt_to != MTYPE_UNKNOWN) // bug 8251
               wn = WN_Cvt (ret_mtype, cvt_to, wn);


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to