[llvm-commits] [llvm-gcc-4.2] r54205 - in /llvm-gcc-4.2/trunk/gcc: c-parser.c c-ppoutput.c combine.c cp/typeck.c objc/objc-act.c regclass.c tree-ssa.c

Bill Wendling isanbard at gmail.com
Wed Jul 30 00:24:07 PDT 2008


Author: void
Date: Wed Jul 30 02:24:06 2008
New Revision: 54205

URL: http://llvm.org/viewvc/llvm-project?rev=54205&view=rev
Log:
Merges from Apple's GCC 4.2 r148430

Modified:
    llvm-gcc-4.2/trunk/gcc/c-parser.c
    llvm-gcc-4.2/trunk/gcc/c-ppoutput.c
    llvm-gcc-4.2/trunk/gcc/combine.c
    llvm-gcc-4.2/trunk/gcc/cp/typeck.c
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
    llvm-gcc-4.2/trunk/gcc/regclass.c
    llvm-gcc-4.2/trunk/gcc/tree-ssa.c

Modified: llvm-gcc-4.2/trunk/gcc/c-parser.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-parser.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-parser.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-parser.c Wed Jul 30 02:24:06 2008
@@ -4236,6 +4236,8 @@
   tree block, expr, body, save_break;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_SWITCH));
   c_parser_consume_token (parser);
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  in_bc_stmt_block ();
   block = c_begin_compound_stmt (flag_isoc99);
   if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
     {
@@ -4253,6 +4255,8 @@
     add_stmt (build1 (LABEL_EXPR, void_type_node, c_break_label));
   c_break_label = save_break;
   add_stmt (c_end_compound_stmt (block, flag_isoc99));
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  outof_bc_stmt_block ();
 }
 
 /* Parse a while statement (C90 6.6.5, C99 6.8.5).
@@ -4277,6 +4281,8 @@
 /* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
   attrs = c_parser_attributes (parser);
 /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  in_bc_stmt_block ();
   block = c_begin_compound_stmt (flag_isoc99);
   loc = c_parser_peek_token (parser)->location;
   cond = c_parser_paren_condition (parser);
@@ -4290,6 +4296,8 @@
 		 true);
 /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   add_stmt (c_end_compound_stmt (block, flag_isoc99));
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  outof_bc_stmt_block ();
   c_break_label = save_break;
   c_cont_label = save_cont;
 }
@@ -4316,6 +4324,8 @@
 /* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
   attrs = c_parser_attributes (parser);
 /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  in_bc_stmt_block ();
   block = c_begin_compound_stmt (flag_isoc99);
   loc = c_parser_peek_token (parser)->location;
   save_break = c_break_label;
@@ -4335,6 +4345,8 @@
   c_finish_loop (loc, cond, NULL, body, new_break, new_cont, attrs, false);
 /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   add_stmt (c_end_compound_stmt (block, flag_isoc99));
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  outof_bc_stmt_block ();
 }
 
 /* Parse a for statement (C90 6.6.5, C99 6.8.5).
@@ -4374,6 +4386,8 @@
 /* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
   attrs = c_parser_attributes (parser);
 /* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  in_bc_stmt_block ();
   /* APPLE LOCAL radar 4472881 (in 4.2 ah) */
   block = c_begin_compound_stmt (flag_isoc99 || c_dialect_objc ());
   if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
@@ -4499,6 +4513,8 @@
   /* APPLE LOCAL end radar 4708210 (for_objc_collection in 4.2) */
   /* APPLE LOCAL radar 4472881 (in 4.2 ai) */
   add_stmt (c_end_compound_stmt (block, flag_isoc99 || c_dialect_objc ()));
+  /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
+  outof_bc_stmt_block ();
   c_break_label = save_break;
   c_cont_label = save_cont;
 }
@@ -7258,6 +7274,26 @@
   objc_finish_try_stmt ();
 }
 
+/* APPLE LOCAL begin radar 5982990 */
+/* This routine is called from c_parser_objc_synchronized_statement
+   and is identical to c_parser_compound_statement with
+   the addition of volatizing local variables seen in the scope
+   of @synchroniz block.
+*/
+static tree
+c_parser_objc_synch_compound_statement (c_parser *parser)
+{
+  tree stmt;
+  if (!c_parser_require (parser, CPP_OPEN_BRACE, "expected %<{%>"))
+    return error_mark_node;
+  stmt = c_begin_compound_stmt (true);
+  c_parser_compound_statement_nostart (parser);
+  if (flag_objc_sjlj_exceptions)
+    objc_mark_locals_volatile (NULL);
+  return c_end_compound_stmt (stmt, true);
+}
+/* APPLE LOCAL end radar 5982990 */
+
 /* Parse an objc-synchronized-statement.
 
    objc-synchronized-statement:
@@ -7279,7 +7315,8 @@
     }
   else
     expr = error_mark_node;
-  stmt = c_parser_compound_statement (parser);
+  /* APPLE LOCAL radar 5982990 */
+  stmt = c_parser_objc_synch_compound_statement (parser);
   objc_build_synchronized (loc, expr, stmt);
 }
 

Modified: llvm-gcc-4.2/trunk/gcc/c-ppoutput.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-ppoutput.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-ppoutput.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-ppoutput.c Wed Jul 30 02:24:06 2008
@@ -21,8 +21,11 @@
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-/* LLVM LOCAL */
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
 #include "toplev.h"
+#endif
+/* LLVM LOCAL end */
 #include "cpplib.h"
 #include "../libcpp/internal.h"
 #include "tree.h"
@@ -456,9 +459,13 @@
   c_common_read_pch (pfile, name, fd, orig_name);
 
   /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
   fprintf (print.outf, "#pragma GCC pch_preprocess ");
   output_quoted_string (print.outf, name);
   fprintf (print.outf, "\n");
+#else
+  fprintf (print.outf, "#pragma GCC pch_preprocess \"%s\"\n", name);
+#endif
   /* LLVM LOCAL end */
   print.src_line++;
 }

Modified: llvm-gcc-4.2/trunk/gcc/combine.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/combine.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/combine.c (original)
+++ llvm-gcc-4.2/trunk/gcc/combine.c Wed Jul 30 02:24:06 2008
@@ -106,6 +106,28 @@
 /* LLVM LOCAL begin comment out most of this file */
 #ifndef ENABLE_LLVM
 /* LLVM LOCAL end */
+
+/* APPLE LOCAL begin ARM DImode multiply enhancement */
+/* If this is set, try substituting instructions forward even if we cannot
+   immediately delete the earlier instructions because their values are
+   reused later.  This is beneficial in a few cases where it's cheaper to
+   redo an earlier operation as part of the later instruction than it is
+   to use the register result of computing it. E.g. (i64)i32 * (i64)i32
+   on ARM is a single insn, but i64*i64 is several, so if we have
+   something like
+      t1 = (i64)i32
+      t2 = (i64)i32
+      t3 = (i64)i32
+      = t1*t2 + t2*t3 + t1*t3
+  we want to move the casts forward into the multiplies.  For the last
+  multiply the original casts will be deleted, but copying them forward
+  would gain even if this did not happen. */
+
+#ifndef COMBINE_TRY_RETAIN
+#define COMBINE_TRY_RETAIN 0
+#endif
+/* APPLE LOCAL end ARM DImode multiply enhancement */
+
 /* Number of attempts to combine instructions in this function.  */
 
 static int combine_attempts;
@@ -393,7 +415,8 @@
 static int can_combine_p (rtx, rtx, rtx, rtx, rtx *, rtx *);
 static int combinable_i3pat (rtx, rtx *, rtx, rtx, int, rtx *);
 static int contains_muldiv (rtx);
-static rtx try_combine (rtx, rtx, rtx, int *);
+/* APPLE LOCAL expand retain_inputs */
+static rtx try_combine (rtx, rtx, rtx, int *, bool);
 static void undo_all (void);
 static void undo_commit (void);
 static rtx *find_split_point (rtx *, rtx);
@@ -588,12 +611,16 @@
 
 #define SUBST_MODE(INTO, NEWVAL)  do_SUBST_MODE(&(INTO), (NEWVAL))
 
+/* APPLE LOCAL begin ARM DImode multiply enhancement */
 /* Subroutine of try_combine.  Determine whether the combine replacement
    patterns NEWPAT and NEWI2PAT are cheaper according to insn_rtx_cost
    that the original instruction sequence I1, I2 and I3.  Note that I1
    and/or NEWI2PAT may be NULL_RTX.  This function returns false, if the
    costs of all instructions can be estimated, and the replacements are
-   more expensive than the original sequence.  */
+   more expensive than the original sequence.
+   We also permit I2 to be null; this means NEWPAT is a replacement for
+   I3, but the original instructions feeding into it will remain.  In
+   this case I1 and NEWI2PAT are expected to be null. */
 
 static bool
 combine_validate_cost (rtx i1, rtx i2, rtx i3, rtx newpat, rtx newi2pat)
@@ -603,22 +630,31 @@
   int old_cost, new_cost;
 
   /* Lookup the original insn_rtx_costs.  */
-  i2_cost = INSN_UID (i2) <= last_insn_cost
-	    ? uid_insn_cost[INSN_UID (i2)] : 0;
   i3_cost = INSN_UID (i3) <= last_insn_cost
 	    ? uid_insn_cost[INSN_UID (i3)] : 0;
-
-  if (i1)
+  if (i2)
     {
-      i1_cost = INSN_UID (i1) <= last_insn_cost
-		? uid_insn_cost[INSN_UID (i1)] : 0;
-      old_cost = (i1_cost > 0 && i2_cost > 0 && i3_cost > 0)
-		 ? i1_cost + i2_cost + i3_cost : 0;
+      i2_cost = INSN_UID (i2) <= last_insn_cost
+	    ? uid_insn_cost[INSN_UID (i2)] : 0;
+      if (i1)
+	{
+	  i1_cost = INSN_UID (i1) <= last_insn_cost
+		    ? uid_insn_cost[INSN_UID (i1)] : 0;
+	  old_cost = (i1_cost > 0 && i2_cost > 0 && i3_cost > 0)
+		     ? i1_cost + i2_cost + i3_cost : 0;
+	}
+      else
+	{
+	  i1_cost = 0;
+	  old_cost = (i2_cost > 0 && i3_cost > 0) ? i2_cost + i3_cost : 0;
+	}
     }
   else
     {
-      old_cost = (i2_cost > 0 && i3_cost > 0) ? i2_cost + i3_cost : 0;
-      i1_cost = 0;
+      gcc_assert (!i1);
+      gcc_assert (!newi2pat);
+      i1_cost = i2_cost = 0;
+      old_cost = (i3_cost > 0) ? i3_cost : 0;
     }
 
   /* Calculate the replacement insn_rtx_costs.  */
@@ -651,10 +687,25 @@
 	old_cost = 0;
     }
 
+  if (i2 == 0 
+      && (old_cost == 0 
+	  || new_cost == 0 
+	  || new_cost > old_cost))
+    {
+      if (dump_file)
+	{
+	  fprintf (dump_file,
+		   "rejecting forward combination into insn %d\n",
+		   INSN_UID (i3));
+	  fprintf (dump_file, "original cost %d\n", old_cost);
+	  fprintf (dump_file, "replacement cost %d\n", new_cost);
+	}
+      return false;
+   }
   /* Disallow this recombination if both new_cost and old_cost are
      greater than zero, and new_cost is greater than old cost.  */
-  if (old_cost > 0
-      && new_cost > old_cost)
+  else if (old_cost > 0 
+           && new_cost > old_cost)
     {
       if (dump_file)
 	{
@@ -688,13 +739,15 @@
     }
 
   /* Update the uid_insn_cost array with the replacement costs.  */
-  uid_insn_cost[INSN_UID (i2)] = new_i2_cost;
+  if (i2)
+    uid_insn_cost[INSN_UID (i2)] = new_i2_cost;
   uid_insn_cost[INSN_UID (i3)] = new_i3_cost;
   if (i1)
     uid_insn_cost[INSN_UID (i1)] = 0;
 
   return true;
 }
+/* APPLE LOCAL end ARM DImode multiply enhancement */
 
 /* Main entry point for combiner.  F is the first insn of the function.
    NREGS is the first unused pseudo-reg number.
@@ -828,7 +881,8 @@
 
 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
 		if ((next = try_combine (insn, XEXP (links, 0),
-					 NULL_RTX, &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					 NULL_RTX, &new_direct_jump_p, true)) != 0)
 		  goto retry;
 
 	      /* Try each sequence of three linked insns ending with this one.  */
@@ -847,7 +901,8 @@
 		       nextlinks = XEXP (nextlinks, 1))
 		    if ((next = try_combine (insn, link,
 					     XEXP (nextlinks, 0),
-					     &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					     &new_direct_jump_p, true)) != 0)
 		      goto retry;
 		}
 
@@ -865,14 +920,16 @@
 		  && sets_cc0_p (PATTERN (prev)))
 		{
 		  if ((next = try_combine (insn, prev,
-					   NULL_RTX, &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					   NULL_RTX, &new_direct_jump_p, true)) != 0)
 		    goto retry;
 
 		  for (nextlinks = LOG_LINKS (prev); nextlinks;
 		       nextlinks = XEXP (nextlinks, 1))
 		    if ((next = try_combine (insn, prev,
 					     XEXP (nextlinks, 0),
-					     &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					     &new_direct_jump_p, true)) != 0)
 		      goto retry;
 		}
 
@@ -885,14 +942,16 @@
 		  && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
 		{
 		  if ((next = try_combine (insn, prev,
-					   NULL_RTX, &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					   NULL_RTX, &new_direct_jump_p, true)) != 0)
 		    goto retry;
 
 		  for (nextlinks = LOG_LINKS (prev); nextlinks;
 		       nextlinks = XEXP (nextlinks, 1))
 		    if ((next = try_combine (insn, prev,
 					     XEXP (nextlinks, 0),
-					     &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					     &new_direct_jump_p, true)) != 0)
 		      goto retry;
 		}
 
@@ -907,7 +966,8 @@
 		    && NONJUMP_INSN_P (prev)
 		    && sets_cc0_p (PATTERN (prev))
 		    && (next = try_combine (insn, XEXP (links, 0),
-					    prev, &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					    prev, &new_direct_jump_p, true)) != 0)
 		  goto retry;
 #endif
 
@@ -918,7 +978,8 @@
 		     nextlinks = XEXP (nextlinks, 1))
 		  if ((next = try_combine (insn, XEXP (links, 0),
 					   XEXP (nextlinks, 0),
-					   &new_direct_jump_p)) != 0)
+				    /* APPLE LOCAL expand retain_inputs */
+					   &new_direct_jump_p, true)) != 0)
 		    goto retry;
 
 	      /* Try this insn with each REG_EQUAL note it links back to.  */
@@ -944,8 +1005,20 @@
 		      i2mod = temp;
 		      i2mod_old_rhs = copy_rtx (orig);
 		      i2mod_new_rhs = copy_rtx (note);
+		      /* APPLE LOCAL begin ARM expand retain_inputs */
+		      /* If we were to allow the retain_inputs optimization here,
+			 we would need to restore SET_SRC below when the
+			 retain_inputs case was hit.  That is possible, but
+			 leads to the following harder problem: when we have
+			 a REG_DEAD note on i3 and that register no longer appears
+			 due to optimization of i3 after replacements, we don't
+			 know whether to remove the instruction that set that
+			 reg (which is what it does) or leave it alone because
+			 it will be used again once we restore SET_SRC below.
+			 See REG_DEAD case in distribute_notes.  */
 		      next = try_combine (insn, i2mod, NULL_RTX,
-					  &new_direct_jump_p);
+					  &new_direct_jump_p, false);
+		      /* APPLE LOCAL end ARM expand retain_inputs */
 		      i2mod = NULL_RTX;
 		      if (next)
 			goto retry;
@@ -1804,14 +1877,21 @@
    If we did the combination, return the insn at which combine should
    resume scanning.
 
+   APPLE LOCAL begin ARM expand retain_inputs
    Set NEW_DIRECT_JUMP_P to a nonzero value if try_combine creates a
-   new direct jump instruction.  */
+   new direct jump instruction.
+
+   If RETAIN_INPUTS_OK, and the replacement doesn't match because one of the
+   inputs is reused later, try accepting the replacement anyway and leaving
+   the original insns there.  */
 
 static rtx
-try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
+try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p, bool retain_inputs_ok)
+/* APPLE LOCAL end ARM expand retain_inputs */
 {
   /* New patterns for I3 and I2, respectively.  */
-  rtx newpat, newi2pat = 0;
+  /* APPLE LOCAL ARM DImode multiply enhancement */
+  rtx newpat, newi2pat = 0, newpat_before_added_sets = 0;
   rtvec newpat_vec_with_clobbers = 0;
   int substed_i2 = 0, substed_i1 = 0;
   /* Indicates need to preserve SET in I1 or I2 in I3 if it is not dead.  */
@@ -1841,6 +1921,11 @@
   /* Notes that I1, I2 or I3 is a MULT operation.  */
   int have_mult = 0;
   int swap_i2i3 = 0;
+/* APPLE LOCAL begin ARM DImode multiply enhancement */
+  /* Marks the case where it's cheaper to duplicate an operation in i3 
+     even though we can't delete i2 and i1 because of later uses. */
+  bool retain_inputs = 0;
+/* APPLE LOCAL end ARM DImode multiply enhancement */
 
   int maxreg;
   rtx temp;
@@ -2419,6 +2504,8 @@
     {
       combine_extras++;
 
+      /* APPLE LOCAL ARM DImode multiply enhancement */
+      newpat_before_added_sets = copy_rtx (newpat);
       if (GET_CODE (newpat) == PARALLEL)
 	{
 	  rtvec old = XVEC (newpat, 0);
@@ -2964,7 +3051,81 @@
        && (! check_asm_operands (newpat) || added_sets_1 || added_sets_2)))
     {
       undo_all ();
-      return 0;
+      /* APPLE LOCAL begin ARM DImode multiply enhancement */
+      /* If we had to add copies of the original inputs because their values
+	 are used later, try matching the replacement without those copies
+	 and leaving the originals alone. 
+	 Do not copy a load, even if the costs appear to be equal (which
+	 can certainly happen with -Os).  We check for volatile explicitly
+	 so this should not be a correctness problem, but it just can't be
+	 an improvement whatever the costs say.  (e.g., the interference with
+	 scheduling is not modeled in this pass.)  */
+      /* Currently, we accept cases where i1!=0 and i1 feeds i3, and where
+	 i1==0.  Can certainly be expanded to handle cases where !i1_feeds_i3, 
+	 i3 is a CALL or JUMP, or only one of added_sets_1 and added_sets_2 is true.
+
+      	 At the moment, code below that fixes up notes assumes the conditions here
+	 are true.  */
+      if (COMBINE_TRY_RETAIN
+	  && retain_inputs_ok
+	  && i2
+	  && !CALL_P (i2) && !JUMP_P (i2) 
+	  && !volatile_refs_p (PATTERN (i2))
+	  && added_sets_2
+	  && !MEM_P (i2src)
+	  && !((GET_CODE (i2src) == SIGN_EXTEND
+	        || GET_CODE (i2src) == ZERO_EXTEND
+		|| GET_CODE (i2src) == SUBREG)
+	       && MEM_P (XEXP (i2src, 0)))
+          && (!targetm.cannot_copy_insn_p || !targetm.cannot_copy_insn_p (i2))
+	  && !i2dest_in_i2src
+    	  && (!i1 
+	       || (!CALL_P (i1) && !JUMP_P (i1) 
+		   && !volatile_refs_p (PATTERN (i1))
+		   && added_sets_1
+		   && !MEM_P (i1src)
+		   && !((GET_CODE (i1src) == SIGN_EXTEND
+			 || GET_CODE (i1src) == ZERO_EXTEND
+			 || GET_CODE (i1src) == SUBREG)
+			&& MEM_P (XEXP (i1src, 0)))
+		   && !i1dest_in_i1src
+		   && i1_feeds_i3))
+	  && !CALL_P (i3) && !JUMP_P (i3)
+	  && !swap_i2i3
+	  && !i3_subst_into_i2)
+	{
+	  SUBST (PATTERN (i3), newpat_before_added_sets);
+	  insn_code_number = recog_for_combine (&newpat_before_added_sets, i3, &new_i3_notes);
+	  if (insn_code_number < 0 
+	      || undobuf.other_insn
+	      || !combine_validate_cost (0, 0, i3, newpat_before_added_sets, 0))
+	    {
+	      undo_all ();
+	      return 0;
+	    }
+	  added_sets_1 = added_sets_2 = 0;
+	  newi2pat = NULL_RTX;
+	  newpat = newpat_before_added_sets;
+	  retain_inputs = 1;
+	  if (dump_file)
+	    {
+	      if (i1) 
+		{
+		  fprintf (dump_file,
+			   "Forward combination of %d and %d into insn %d\n",
+			   INSN_UID (i1), INSN_UID (i2), INSN_UID (i3));
+	        } 
+	      else 
+		{
+		  fprintf (dump_file,
+			   "Forward combination of %d into insn %d\n",
+			   INSN_UID (i2), INSN_UID (i3));
+		}
+	    }
+	}
+      else
+	return 0;
+      /* APPLE LOCAL end ARM DImode multiply enhancement */
     }
 
   /* If we had to change another insn, make sure it is valid also.  */
@@ -3025,9 +3186,11 @@
   }
 #endif
 
+  /* APPLE LOCAL begin ARM DImode multiply enhancement */
   /* Only allow this combination if insn_rtx_costs reports that the
      replacement instructions are cheaper than the originals.  */
-  if (!combine_validate_cost (i1, i2, i3, newpat, newi2pat))
+  if (!retain_inputs
+      && !combine_validate_cost (i1, i2, i3, newpat, newi2pat))
     {
       undo_all ();
       return 0;
@@ -3186,7 +3349,8 @@
 
     LOG_LINKS (i3) = 0;
     REG_NOTES (i3) = 0;
-    LOG_LINKS (i2) = 0;
+    if (!retain_inputs)
+      LOG_LINKS (i2) = 0;
     REG_NOTES (i2) = 0;
 
     if (newi2pat)
@@ -3194,14 +3358,16 @@
 	INSN_CODE (i2) = i2_code_number;
 	PATTERN (i2) = newi2pat;
       }
-    else
+    else if (!retain_inputs)
       SET_INSN_DELETED (i2);
 
     if (i1)
       {
-	LOG_LINKS (i1) = 0;
+        if (!retain_inputs)
+	  LOG_LINKS (i1) = 0;
 	REG_NOTES (i1) = 0;
-	SET_INSN_DELETED (i1);
+	if (!retain_inputs)
+	  SET_INSN_DELETED (i1);
       }
 
     /* Get death notes for everything that is now used in either I3 or
@@ -3307,10 +3473,13 @@
       }
 
     distribute_links (i3links);
-    distribute_links (i2links);
-    distribute_links (i1links);
+    if (!retain_inputs)
+      {
+	distribute_links (i2links);
+	distribute_links (i1links);
+      }
 
-    if (REG_P (i2dest))
+    if (!retain_inputs && REG_P (i2dest))
       {
 	rtx link;
 	rtx i2_insn = 0, i2_val = 0, set;
@@ -3341,7 +3510,8 @@
 	  }
       }
 
-    if (i1 && REG_P (i1dest))
+    if (!retain_inputs && i1 && REG_P (i1dest))
+    /* APPLE LOCAL end ARM DImode multiply enhancement */
       {
 	rtx link;
 	rtx i1_insn = 0, i1_val = 0, set;

Modified: llvm-gcc-4.2/trunk/gcc/cp/typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/typeck.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/typeck.c Wed Jul 30 02:24:06 2008
@@ -2129,6 +2129,10 @@
 	  /* APPLE LOCAL radar 5285911 */
           && (expr = objc_build_property_reference_expr (object, name)))
         return expr;
+      /* APPLE LOCAL begin radar 5802025 */
+      else if (objc_property_reference_expr (object))
+        object = objc_build_property_getter_func_call (object);
+      /* APPLE LOCAL end radar 5802025 */
     }
   /* APPLE LOCAL end C* property (Radar 4436866) */
 
@@ -3510,7 +3514,8 @@
       if (TREE_CODE (orig_op0) == STRING_CST
 	  || TREE_CODE (orig_op1) == STRING_CST)
 	warning (OPT_Waddress, 
-                 "comparison with string literal results in unspecified behaviour");
+		 /* APPLE LOCAL spelling 5808469 */
+                 "comparison with string literal results in unspecified behavior");
 
       build_type = boolean_type_node;
       if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Wed Jul 30 02:24:06 2008
@@ -18934,6 +18934,19 @@
   return function;
 }
 
+/* APPLE LOCAL begin radar 5802025 */
+tree objc_build_property_getter_func_call (tree pref_expr)
+{
+  tree getter_call;
+  tree save_UOBJC_SUPER_decl = UOBJC_SUPER_decl;
+  UOBJC_SUPER_decl = TREE_OPERAND (pref_expr, 2);
+  getter_call = objc_build_getter_call (TREE_OPERAND (pref_expr, 0),
+                                    TREE_OPERAND (pref_expr, 1));
+  UOBJC_SUPER_decl = save_UOBJC_SUPER_decl;
+  return getter_call;
+}
+/* APPLE LOCAL end radar 5802025 */
+  
 /* Look for the special case of OBJC_TYPE_REF with the address of
    a function in OBJ_TYPE_REF_EXPR (presumably objc_msgSend or one
    of its cousins).  */
@@ -18972,13 +18985,8 @@
   /* APPLE LOCAL end radar 5276085 */
   /* APPLE LOCAL begin radar 5285911 5494488 */
   else if (objc_property_reference_expr (*expr_p))
-    {
-      tree save_UOBJC_SUPER_decl = UOBJC_SUPER_decl;
-      UOBJC_SUPER_decl = TREE_OPERAND (*expr_p, 2);
-      *expr_p = objc_build_getter_call (TREE_OPERAND (*expr_p, 0), 
-					TREE_OPERAND (*expr_p, 1));
-      UOBJC_SUPER_decl = save_UOBJC_SUPER_decl;
-    }
+    /* APPLE LOCAL radar 5802025 */
+    *expr_p = objc_build_property_getter_func_call (*expr_p);
   /* APPLE LOCAL end radar 5285911 5494488 */
 
 #ifdef OBJCPLUS

Modified: llvm-gcc-4.2/trunk/gcc/regclass.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/regclass.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/regclass.c (original)
+++ llvm-gcc-4.2/trunk/gcc/regclass.c Wed Jul 30 02:24:06 2008
@@ -148,6 +148,15 @@
 int inv_reg_alloc_order[FIRST_PSEUDO_REGISTER];
 #endif
 
+/* APPLE LOCAL begin 5831562 add DIMODE_REG_ALLOC_ORDER */
+#ifdef DIMODE_REG_ALLOC_ORDER
+int dimode_reg_alloc_order[FIRST_PSEUDO_REGISTER] = DIMODE_REG_ALLOC_ORDER;
+
+/* The inverse of reg_alloc_order.  */
+int dimode_inv_reg_alloc_order[FIRST_PSEUDO_REGISTER];
+#endif
+/* APPLE LOCAL end 5831562 add DIMODE_REG_ALLOC_ORDER */
+
 /* For each reg class, a HARD_REG_SET saying which registers are in it.  */
 
 HARD_REG_SET reg_class_contents[N_REG_CLASSES];
@@ -302,6 +311,13 @@
   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
     inv_reg_alloc_order[reg_alloc_order[i]] = i;
 #endif
+
+/* APPLE LOCAL begin 5831562 add DIMODE_REG_ALLOC_ORDER */
+#ifdef DIMODE_REG_ALLOC_ORDER
+  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+    dimode_inv_reg_alloc_order[dimode_reg_alloc_order[i]] = i;
+#endif
+/* APPLE LOCAL end 5831562 add DIMODE_REG_ALLOC_ORDER */
 }
 
 /* After switches have been processed, which perhaps alter

Modified: llvm-gcc-4.2/trunk/gcc/tree-ssa.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-ssa.c?rev=54205&r1=54204&r2=54205&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-ssa.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-ssa.c Wed Jul 30 02:24:06 2008
@@ -926,19 +926,7 @@
   if (lang_hooks.types_compatible_p (inner_type, outer_type))
     return true;
 
-  /* If both types are pointers and the outer type is a (void *), then
-     the conversion is not necessary.  The opposite is not true since
-     that conversion would result in a loss of information if the
-     equivalence was used.  Consider an indirect function call where
-     we need to know the exact type of the function to correctly
-     implement the ABI.  */
-  else if (POINTER_TYPE_P (inner_type)
-           && POINTER_TYPE_P (outer_type)
-	   && TYPE_REF_CAN_ALIAS_ALL (inner_type)
-	      == TYPE_REF_CAN_ALIAS_ALL (outer_type)
-	   && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
-    return true;
-
+  /* APPLE LOCAL begin 5799099 */
   /* Don't lose casts between pointers to volatile and non-volatile
      qualified types.  Doing so would result in changing the semantics
      of later accesses.  */
@@ -947,6 +935,7 @@
 	   && TYPE_VOLATILE (TREE_TYPE (outer_type))
 	      != TYPE_VOLATILE (TREE_TYPE (inner_type)))
     return false;
+  /* APPLE LOCAL end 5799099 */
 
   /* APPLE LOCAL begin mainline */
   /* Do not lose casts from const qualified to non-const                                 
@@ -959,6 +948,21 @@
     return false;
   /* APPLE LOCAL end mainline */
 
+  /* APPLE LOCAL begin 5799099 moved down */
+  /* If both types are pointers and the outer type is a (void *), then
+     the conversion is not necessary.  The opposite is not true since
+     that conversion would result in a loss of information if the
+     equivalence was used.  Consider an indirect function call where
+     we need to know the exact type of the function to correctly
+     implement the ABI.  */
+  else if (POINTER_TYPE_P (inner_type)
+           && POINTER_TYPE_P (outer_type)
+	   && TYPE_REF_CAN_ALIAS_ALL (inner_type)
+	      == TYPE_REF_CAN_ALIAS_ALL (outer_type)
+	   && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
+    return true;
+  /* APPLE LOCAL end 5799099 moved down */
+
   /* Pointers/references are equivalent if their pointed to types
      are effectively the same.  This allows to strip conversions between
      pointer types with different type qualifiers.  */





More information about the llvm-commits mailing list