[llvm-commits] [llvm-gcc-4.2] r65913 - in /llvm-gcc-4.2/branches/Apple/Dib: ./ gcc/ gcc/config/ gcc/config/arm/ gcc/config/i386/ gcc/cp/ gcc/testsuite/g++.apple/ gcc/testsuite/gcc.apple/

Bill Wendling isanbard at gmail.com
Mon Mar 2 17:22:11 PST 2009


Author: void
Date: Mon Mar  2 19:22:11 2009
New Revision: 65913

URL: http://llvm.org/viewvc/llvm-project?rev=65913&view=rev
Log:
Update Dib to TOT with Apple GCC 5641.

Added:
    llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/block-no-trampoline-1.C
    llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/weak-2.C
    llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/gcc.apple/6515001.c
Modified:
    llvm-gcc-4.2/branches/Apple/Dib/configure.in
    llvm-gcc-4.2/branches/Apple/Dib/driverdriver.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/ChangeLog.apple
    llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.h
    llvm-gcc-4.2/branches/Apple/Dib/gcc/c-decl.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/c-typeck.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/config/arm/arm.h
    llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h
    llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/darwin.h
    llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/predicates.md
    llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/ChangeLog.apple
    llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/decl.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/semantics.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/dwarf2out.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/gimplify.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/ifcvt.c
    llvm-gcc-4.2/branches/Apple/Dib/gcc/tree.h
    llvm-gcc-4.2/branches/Apple/Dib/gcc/version.c

Modified: llvm-gcc-4.2/branches/Apple/Dib/configure.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/configure.in?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/configure.in (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/configure.in Mon Mar  2 19:22:11 2009
@@ -989,8 +989,10 @@
   i[[3456789]]86-*-darwin*)
     host_makefile_frag="config/mh-x86-darwin"
     # gcc can default to x86_64 code generation, avoid that
-    CC="${CC-gcc} -m32"
-    CXX="${CXX-g++} -m32"
+    if test "${build}" = "${host}"; then
+      CC="${CC-gcc} -m32"
+      CXX="${CXX-g++} -m32"
+    fi
     ;;
   # APPLE LOCAL end dynamic-no-pic
   powerpc-*-aix*)

Modified: llvm-gcc-4.2/branches/Apple/Dib/driverdriver.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/driverdriver.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/driverdriver.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/driverdriver.c Mon Mar  2 19:22:11 2009
@@ -1,4 +1,5 @@
 /* APPLE LOCAL file driver driver */
+
 /* Darwin driver program that handles -arch commands and invokes
    appropriate compiler driver.
    Copyright (C) 2004, 2005 Free Software Foundation, Inc.
@@ -76,6 +77,8 @@
 int dash_dynamiclib_seen = 0;
 int verbose_flag = 0;
 int save_temps_seen = 0;
+int dash_m32_seen = 0;
+int dash_m64_seen = 0;
 
 /* Support at the max 10 arch. at a time. This is historical limit.  */
 #define MAX_ARCHES 10
@@ -190,27 +193,35 @@
 static const char *
 get_arch_name (const char *name)
 {
-  const NXArchInfo * a_info;
+  NXArchInfo * a_info;
   const NXArchInfo * all_info;
   cpu_type_t cputype;
   struct arch_config_guess_map *map;
   const char *aname;
 
-  if (name)
-    {
-      /* Find config name based on arch name.  */
-      aname = NULL;
-      map = arch_config_map;
-      while (map->arch_name)
-	{
-	  if (!strcmp (map->arch_name, name))
-	    return name;
-	  else map++;
-	}
-      a_info = NXGetArchInfoFromName (name);
+  if (name) {
+    /* Find config name based on arch name.  */
+    aname = NULL;
+    map = arch_config_map;
+    while (map->arch_name) {
+      if (!strcmp (map->arch_name, name))
+	return name;
+      else map++;
     }
-  else
-    a_info = NXGetLocalArchInfo ();
+    a_info = (NXArchInfo *) NXGetArchInfoFromName (name);
+  } else {
+    a_info = (NXArchInfo *) NXGetLocalArchInfo();
+    if (a_info) {
+      if (dash_m32_seen) {
+        /* If -m32 is seen then do not change cpu type.  */
+      } else if (dash_m64_seen) {
+        /* If -m64 is seen then enable CPU_ARCH_ABI64.  */
+	a_info->cputype |= CPU_ARCH_ABI64;
+      } else if (sizeof (long) == 8)
+	/* On x86, by default (name is NULL here) enable 64 bit code.  */
+	a_info->cputype |= CPU_ARCH_ABI64;
+    }
+  }
 
   if (!a_info)
     fatal ("Invalid arch name : %s", name);
@@ -639,7 +650,6 @@
 
       for (i = 1; i < new_argc; i++)
 	{
-
 	  if (ifn && ifn->name && !strcmp (new_argv[i], ifn->name))
 	    {
 	      /* This argument is one of the input file.  */
@@ -1371,6 +1381,16 @@
 	  new_argv[new_argc++] = argv[i];
 	  dash_capital_m_seen = 1;
 	}
+      else if (!strcmp (argv[i], "-m32"))
+	{
+	  new_argv[new_argc++] = argv[i];
+	  dash_m32_seen = 1;
+	}
+      else if (!strcmp (argv[i], "-m64"))
+	{
+	  new_argv[new_argc++] = argv[i];
+	  dash_m64_seen = 1;
+	}
       else if (!strcmp (argv[i], "-dynamiclib"))
 	{
 	  new_argv[new_argc++] = argv[i];
@@ -1505,6 +1525,9 @@
     fatal ("no input files");
 #endif
 
+  if (num_arches == 0)
+    add_arch(get_arch_name(NULL));
+
   if (num_arches > 1)
     {
       if (preprocessed_output_request
@@ -1517,22 +1540,15 @@
      Invoke appropriate compiler driver.  FAT build is not required in this
      case.  */
 
-  if (num_arches == 0 || num_arches == 1)
+  if (num_arches == 1)
     {
       int arch_specific_argc;
       const char **arch_specific_argv;
 
-      /* If no -arch is specified than use host compiler driver.  */
-      if (num_arches == 0)
-	new_argv[0] = get_driver_name (get_arch_name (NULL));
-      else if (num_arches == 1)
-	{
-	  /* Find compiler driver based on -arch <foo> and add approriate
-	     -m* argument.  */
-	  new_argv[0] = get_driver_name (get_arch_name (arches[0]));
-	  new_argc = new_argc + add_arch_options (0, new_argv, new_argc);
-	}
-
+      /* Find compiler driver based on -arch <foo> and add approriate
+	 -m* argument.  */
+      new_argv[0] = get_driver_name (get_arch_name (arches[0]));
+      new_argc = new_argc + add_arch_options (0, new_argv, new_argc);
 
 #ifdef DEBUG
       printf ("%s: invoking single driver name = %s\n", progname, new_argv[0]);

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/ChangeLog.apple?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/ChangeLog.apple Mon Mar  2 19:22:11 2009
@@ -1,3 +1,25 @@
+2009-02-11  Fariborz Jahanian <fjahanian at apple.com>
+
+	Radar 6573923
+	* c-decl.c (synth_block_byref_id_object_copy_func,
+	synth_block_byref_id_object_dispose_func): Set BLOCK_BYREF_CALLER
+	flag in call to copy/dispose helper functions.
+	* c-common.h (BLOCK_BYREF_CALLER): New flag.
+
+2009-01-29  Josh Conner  <jconner at apple.com>
+
+	Radar 6186914, 6541440
+	* dwarf2out.c (dwarf_stack_op_name): Handle DW_OP_bit_piece.
+	(size_of_loc_descr, output_loc_operands): Likewise.
+	(reg_loc_descriptor): Call TARGET_DWARF2_REG_HANDLER if it is defined.
+	* config/arm/arm.h (TARGET_DWARF2_REG_HANDLER): Define.
+
+2009-01-22  Stuart Hastings  <stuart at apple.com>
+
+	Radar 6515001
+	* ifcvt.c(noce_try_cmove_arith): Use a more conservative trap
+          check.
+
 2009-01-12  Caroline Tice  <ctice at apple.com>
 
         Radar 6476836

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c Mon Mar  2 19:22:11 2009
@@ -5169,6 +5169,16 @@
       || TREE_CODE (*node) == VAR_DECL)
     declare_weak (*node);
   /* APPLE LOCAL begin weak types 5954418 */
+  else if (!DECL_P (*node)
+	   /* If the weak flag can be associated with something else,
+	      prefer that. */
+	   && (flags & (ATTR_FLAG_FUNCTION_NEXT
+			|ATTR_FLAG_DECL_NEXT
+			|ATTR_FLAG_ARRAY_NEXT)))
+    {
+      *no_add_attrs = true;
+      return tree_cons (name, args, NULL_TREE);
+    }
   else if (! targetm.cxx.class_data_always_comdat ()
 	   && TREE_CODE (*node) == RECORD_TYPE)
     {

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.h?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.h (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.h Mon Mar  2 19:22:11 2009
@@ -1139,7 +1139,8 @@
     BLOCK_FIELD_IS_OBJECT   =  3,  /* id, NSObject, __attribute__((NSObject)), block, ... */
     BLOCK_FIELD_IS_BLOCK    =  7,  /* a block variable */
     BLOCK_FIELD_IS_BYREF    =  8,  /* the on stack structure holding the __block variable */
-    BLOCK_FIELD_IS_WEAK     = 16   /* declared __weak, only used in byref copy helpers */
+    BLOCK_FIELD_IS_WEAK     = 16,  /* declared __weak, only used in byref copy helpers */
+    BLOCK_BYREF_CALLER      = 128  /* called from __block (byref) copy/dispose support routines */
 };
 /* APPLE LOCAL end radar 5847976 */
 /* APPLE LOCAL begin radar 5732232 - blocks */

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/c-decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/c-decl.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/c-decl.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/c-decl.c Mon Mar  2 19:22:11 2009
@@ -3650,6 +3650,11 @@
   /* APPLE LOCAL begin radar 6180456 */
   /* _Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_OBJECT) or :
      _Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_BLOCK) */
+  /* APPLE LOCAL begin radar 6573923 */
+  /* Also add the new flag when calling _Block_object_dispose
+     from byref dispose helper. */
+  flag |= BLOCK_BYREF_CALLER;
+ /* APPLE LOCAL end radar 6573923 */
   call_exp = build_block_object_assign_call_exp (build_fold_addr_expr (dst_obj), src_obj, flag);
   add_stmt (call_exp);
   /* APPLE LOCAL end radar 6180456 */
@@ -3696,6 +3701,11 @@
   /* APPLE LOCAL begin radar 6180456 */
   /* _Block_object_dispose(_src->object, BLOCK_FIELD_IS_OBJECT) : or
      _Block_object_dispose(_src->object, BLOCK_FIELD_IS_BLOCK) */
+  /* APPLE LOCAL begin radar 6573923 */
+  /* Also add the new flag when calling _Block_object_dispose
+     from byref dispose helper. */
+  flag |= BLOCK_BYREF_CALLER;
+  /* APPLE LOCAL end radar 6573923 */
   rel_exp = build_block_object_dispose_call_exp (src_obj, flag);
   /* APPLE LOCAL end radar 6180456 */
   add_stmt (rel_exp);

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/c-typeck.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/c-typeck.c Mon Mar  2 19:22:11 2009
@@ -2104,7 +2104,6 @@
 	       in an inline function.
 	       Hope it doesn't break something else.  */
 	    | TREE_THIS_VOLATILE (array));
-
       return require_complete_type (fold (rval));
     }
   else

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/arm/arm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/arm/arm.h?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/arm/arm.h Mon Mar  2 19:22:11 2009
@@ -2700,6 +2700,36 @@
 		((FIRST_PARM_OFFSET (FNDECL)) 			\
 		 + (DECL_STRUCT_FUNCTION (FNDECL))->pretend_args_size)
 /* APPLE LOCAL end ARM 6148015 */
+
+/* APPLE LOCAL begin 6186914 */
+/* As per the ARM ABI, for double-width VFP regs:
+     Dx = DW_OP_regx(256+x)
+   For single-width VFP regs:
+     S[2x] = DW_OP_regx(256 + (x >> 1)) DW_OP_bit piece(32, 0)
+     S[2x+1] = DW_OP_regx(256 + (x >> 1)) DW_OP_bit_piece (32, 32)
+   It's unfortunate that we have to put this into inline code, but the
+   interfaces we need from dwarf2out.c aren't exposed.  */
+#define TARGET_DWARF2_REG_HANDLER(reg)					\
+  do {									\
+    if (IS_VFP_REGNUM (REGNO (reg))					\
+	&& (GET_MODE (reg) == SFmode || GET_MODE (reg) == DFmode))	\
+      {									\
+	dw_loc_descr_ref loc_result = NULL;				\
+	dw_loc_descr_ref temp;						\
+	unsigned int relative_regno = REGNO (reg) - FIRST_VFP_REGNUM;	\
+	unsigned int base_reg = 256 + (relative_regno >> 1);		\
+	temp = one_reg_loc_descriptor (base_reg, initialized);		\
+	add_loc_descr (&loc_result, temp);				\
+	if (GET_MODE (reg) == SFmode)					\
+	  {								\
+	    int offset = relative_regno & 0x1 ? 32 : 0;			\
+	    temp = new_loc_descr (DW_OP_bit_piece, 32, offset);		\
+	    add_loc_descr (&loc_result, temp);				\
+	  }								\
+	return loc_result;						\
+      }									\
+  } while (0)
+/* APPLE LOCAL end 6186914 */
 
 enum arm_builtins
 {

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c Mon Mar  2 19:22:11 2009
@@ -299,12 +299,14 @@
   name = XSTR (sym_ref, 0);
 
   lprefix = (((name[0] == '*' || name[0] == '&')
+	      /* APPLE LOCAL begin fix-and-continue 6227434 */
               && (name[1] == 'L'
 		  || (name[1] == '"' && name[2] == 'L')
 		  /* Don't indirect writable strings.  */
 		  || (name[1] == 'l' && name[2] == 'C')))
              || (strncmp (name, "_OBJC_", 6) == 0)
 	     || objc_anonymous_local_objc_name (name));
+	      /* APPLE LOCAL end fix-and-continue 6227434 */
 
   return ! lprefix;
 }

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.h Mon Mar  2 19:22:11 2009
@@ -493,10 +493,12 @@
       miphoneos-version-min=*: %(darwin_iphoneos_libgcc);		   \
       shared-libgcc|fexceptions|fgnu-runtime:				   \
        %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)	   \
-       %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)	   \
+       "/* APPLE LOCAL link optimizations 6499452 */"			   \
+       %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
        -lgcc;								   \
       :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
-       %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)	   \
+       "/* APPLE LOCAL link optimizations 6499452 */"			   \
+       %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)   \
        -lgcc}"
 
 /* We specify crt0.o as -lcrt0.o so that ld will search the library path.
@@ -510,7 +512,8 @@
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC							    \
   "%{Zdynamiclib: %(darwin_dylib1) }					    \
-   %{!Zdynamiclib:%{Zbundle:%{!static:-lbundle1.o}}			    \
+   "/* APPLE LOCAL link optimizations 6499452 */"			    \
+   %{!Zdynamiclib:%{Zbundle:%{!static: %(darwin_bundle1)}}		    \
      %{!Zbundle:%{pg:%{static:-lgcrt0.o}				    \
                      %{!static:%{object:-lgcrt0.o}			    \
                                %{!object:%{preload:-lgcrt0.o}		    \
@@ -534,6 +537,8 @@
 #define DARWIN_EXTRA_SPECS						\
   { "darwin_crt1", DARWIN_CRT1_SPEC },					\
   { "darwin_dylib1", DARWIN_DYLIB1_SPEC },				\
+  /* APPLE LOCAL link optimizations 6499452 */				\
+  { "darwin_bundle1", DARWIN_BUNDLE1_SPEC },				\
   { "darwin_minversion", DARWIN_MINVERSION_SPEC },			\
 /* APPLE LOCAL end mainline */						\
 /* APPLE LOCAL begin ARM 5683689 */					\
@@ -550,6 +555,11 @@
      %:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o)		\
      %:version-compare(>= 10.5 mmacosx-version-min= -ldylib1.10.5.o)}"
 
+/* APPLE LOCAL begin link optimizations 6499452 */
+#define DARWIN_BUNDLE1_SPEC						\
+  "-lbundle1.o"
+/* APPLE LOCAL end link optimizations 6499452 */
+
 #define DARWIN_CRT1_SPEC						\
 /* APPLE LOCAL ARM 5823776 iphoneos should use crt1.o */		\
   "%{miphoneos-version-min=*: -lcrt1.o}					\

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/darwin.h?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/darwin.h (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/darwin.h Mon Mar  2 19:22:11 2009
@@ -141,6 +141,23 @@
 /* APPLE LOCAL ARM 5681645 */
 #define DARWIN_IPHONEOS_LIBGCC_SPEC "-lgcc_s.10.5 -lgcc"
 
+/* APPLE LOCAL begin link optimizations 6499452 */
+#undef DARWIN_CRT1_SPEC
+#define DARWIN_CRT1_SPEC						\
+  "%:version-compare(!> 10.5 mmacosx-version-min= -lcrt1.o)		\
+   %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lcrt1.10.5.o)	\
+   %:version-compare(>= 10.6 mmacosx-version-min= -lcrt1.10.6.o)"
+
+#undef DARWIN_DYLIB1_SPEC
+#define DARWIN_DYLIB1_SPEC						\
+  "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o)		\
+   %:version-compare(>< 10.5 10.6 mmacosx-version-min= -ldylib1.10.5.o)"
+
+#undef DARWIN_BUNDLE1_SPEC
+#define DARWIN_BUNDLE1_SPEC						\
+  "%:version-compare(!> 10.6 mmacosx-version-min= -lbundle1.o)"
+/* APPLE LOCAL end link optimizations 6499452 */
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                                   \
   DARWIN_EXTRA_SPECS                                            \

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/predicates.md
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/predicates.md?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/predicates.md (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/i386/predicates.md Mon Mar  2 19:22:11 2009
@@ -470,7 +470,7 @@
 /* LLVM LOCAL begin non-Darwin hack. */
 #ifdef TARGET_FIX_AND_CONTINUE
       if (!indirect_data (op)
-          || machopic_data_defined_p (op))
+	  || machopic_data_defined_p (op))  
 #endif
 /* LLVM LOCAL end non-Darwin hack */
       return 1;

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/ChangeLog.apple?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/ChangeLog.apple (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/ChangeLog.apple Mon Mar  2 19:22:11 2009
@@ -1,3 +1,16 @@
+2009-02-11  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 6573923
+        * decl.c (synth_block_byref_id_object_copy_func,
+        synth_block_byref_id_object_dispose_func): Set BLOCK_BYREF_CALLER
+        flag in call to copy/dispose helper functions.
+
+2009-02-11  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 6545782
+	* semantics.c (get_final_block_variable): New
+	(finish_id_expression): Call get_final_block_variable.
+
 2008-12-05  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 6413140

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/decl.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/decl.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/decl.c Mon Mar  2 19:22:11 2009
@@ -5365,6 +5365,11 @@
   /* APPLE LOCAL begin radar 6180456 */
   /* _Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_OBJECT) or:
      _Block_object_assign (&_dest->object, _src->object, BLOCK_FIELD_IS_BLOCK) */
+  /* APPLE LOCAL begin radar 6573923 */
+  /* Also add the new flag when calling _Block_object_dispose
+     from byref dispose helper. */
+  flag |= BLOCK_BYREF_CALLER;
+ /* APPLE LOCAL end radar 6573923 */
   call_exp = build_block_object_assign_call_exp (build_fold_addr_expr (dst_obj), src_obj, flag);
   add_stmt (call_exp);
   /* APPLE LOCAL end radar 6180456 */
@@ -5413,6 +5418,11 @@
   /* APPLE LOCAL begin radar 6180456 */
   /* _Block_object_dispose(_src->object, BLOCK_FIELD_IS_OBJECT) or:
      _Block_object_dispose(_src->object, BLOCK_FIELD_IS_BLOCK) */
+  /* APPLE LOCAL begin radar 6573923 */
+  /* Also add the new flag when calling _Block_object_dispose
+     from byref dispose helper. */
+  flag |= BLOCK_BYREF_CALLER;
+ /* APPLE LOCAL end radar 6573923 */
   rel_exp = build_block_object_dispose_call_exp (src_obj, flag);
   /* APPLE LOCAL end radar 6180456 */
   add_stmt (rel_exp);

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/semantics.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/semantics.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/semantics.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/cp/semantics.c Mon Mar  2 19:22:11 2009
@@ -2487,6 +2487,50 @@
 
   return false;
 }
+
+/* APPLE LOCAL begin radar 6545782 */
+/** This routine does all the work on use of variables in a block. */
+static tree get_final_block_variable (tree name, tree var) {
+  tree decl = var;
+  
+  if (cur_block
+      && (TREE_CODE (decl) == VAR_DECL
+          || TREE_CODE (decl) == PARM_DECL)
+      && !lookup_name_in_block (name, &decl))
+  { 
+    bool gdecl;
+    /* We are referencing a variable inside a block whose
+     declaration is outside.  */
+    gcc_assert (decl && 
+                (TREE_CODE (decl) == VAR_DECL
+                 || TREE_CODE (decl) == PARM_DECL));
+    gdecl = (TREE_CODE (decl) == VAR_DECL && 
+             (DECL_EXTERNAL (decl) || TREE_STATIC (decl)));
+    /* Treat all 'global' variables as 'byref' by default. */
+    if (gdecl
+        || (TREE_CODE (decl) == VAR_DECL && COPYABLE_BYREF_LOCAL_VAR (decl)))
+    {
+      /* byref globals are directly accessed. */
+      if (!gdecl)
+      /* build a decl for the byref variable. */
+        decl = build_block_byref_decl (name, decl, decl);
+      else
+        add_block_global_byref_list (decl);
+    }
+    else
+    {
+      /* 'byref' globals are never copied-in. So, do not add
+       them to the copied-in list. */
+      if (!in_block_global_byref_list (decl))
+      /* build a new decl node. set its type to 'const' type
+        of the old decl. */
+        decl = build_block_ref_decl (name, decl);
+    }
+  }
+  return decl;
+}
+/* APPLE LOCAL end radar 6545782 */
+
 /* APPLE LOCAL end blocks 6040305 */
 
 /* ID_EXPRESSION is a representation of parsed, but unprocessed,
@@ -2943,48 +2987,12 @@
 	      path = currently_open_derived_class (DECL_CONTEXT (decl));
 	      perform_or_defer_access_check (TYPE_BINFO (path), decl, decl);
 	    }
-
+          /* APPLE LOCAL radar 6545782 */
+          decl = get_final_block_variable (id_expression, decl);
 	  decl = convert_from_reference (decl);
 	}
     }
 
-  /* APPLE LOCAL begin blocks 6040305 (ci) */
-  if (cur_block
-      && (TREE_CODE (decl) == VAR_DECL
-	  || TREE_CODE (decl) == PARM_DECL)
-      && !lookup_name_in_block (id_expression, &decl))
-    {
-      bool gdecl;
-      /* We are referencing a variable inside a block whose
-	 declaration is outside.  */
-      gcc_assert (decl && 
-		  (TREE_CODE (decl) == VAR_DECL
-		   || TREE_CODE (decl) == PARM_DECL));
-      gdecl = (TREE_CODE (decl) == VAR_DECL && 
-	       (DECL_EXTERNAL (decl) || TREE_STATIC (decl)));
-      /* Treat all 'global' variables as 'byref' by default. */
-      if (gdecl
-	  || (TREE_CODE (decl) == VAR_DECL && COPYABLE_BYREF_LOCAL_VAR (decl)))
-	{
-	  /* byref globals are directly accessed. */
-	  if (!gdecl)
-	    /* build a decl for the byref variable. */
-	    decl = build_block_byref_decl (id_expression, decl, decl);
-	  else
-	    add_block_global_byref_list (decl);
-	}
-      else
-	{
-	  /* 'byref' globals are never copied-in. So, do not add
-	     them to the copied-in list. */
-	  if (!in_block_global_byref_list (decl))
-	    /* build a new decl node. set its type to 'const' type
-	       of the old decl. */
-	    decl = build_block_ref_decl (id_expression, decl);
-	}
-    }
-  /* APPLE LOCAL end blocks 6040305 (ci) */
-
   if (TREE_DEPRECATED (decl))
     warn_deprecated_use (decl);
 

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/dwarf2out.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/dwarf2out.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/dwarf2out.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/dwarf2out.c Mon Mar  2 19:22:11 2009
@@ -3096,6 +3096,10 @@
       return "DW_OP_bregx";
     case DW_OP_piece:
       return "DW_OP_piece";
+    /* APPLE LOCAL begin 6186914 */
+    case DW_OP_bit_piece:
+      return "DW_OP_bit_piece";
+    /* APPLE LOCAL end 6186914 */
     case DW_OP_deref_size:
       return "DW_OP_deref_size";
     case DW_OP_xderef_size:
@@ -3246,6 +3250,12 @@
     case DW_OP_piece:
       size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
       break;
+    /* APPLE LOCAL begin 6186914 */
+    case DW_OP_bit_piece:
+      size += size_of_uleb128 (loc->dw_loc_oprnd1.v.val_unsigned);
+      size += size_of_uleb128 (loc->dw_loc_oprnd2.v.val_unsigned);
+      break;
+    /* APPLE LOCAL end 6186914 */
     case DW_OP_deref_size:
     case DW_OP_xderef_size:
       size += 1;
@@ -3411,6 +3421,12 @@
     case DW_OP_piece:
       dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
       break;
+    /* APPLE LOCAL begin 6186914 */
+    case DW_OP_bit_piece:
+      dw2_asm_output_data_uleb128 (val1->v.val_unsigned, NULL);
+      dw2_asm_output_data_uleb128 (val2->v.val_unsigned, NULL);
+      break;
+    /* APPLE LOCAL end 6186914 */
     case DW_OP_deref_size:
     case DW_OP_xderef_size:
       dw2_asm_output_data (1, val1->v.val_int, NULL);
@@ -9093,6 +9109,16 @@
 
   regs = targetm.dwarf_register_span (rtl);
 
+/* APPLE LOCAL begin 6186914 */
+#ifdef TARGET_DWARF2_REG_HANDLER
+  /* If this macro is defined, it should provide any target-specific
+     register debug info handling.  The macro should return the
+     dw_loc_descr_ref if it performs any alternative handling, and
+     fall through otherwise.  */
+  TARGET_DWARF2_REG_HANDLER (rtl);
+#endif
+/* APPLE LOCAL end 6186914 */
+
   /* APPLE LOCAL begin track initialization status 4964532  */
   if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
     return multiple_reg_loc_descriptor (rtl, regs, initialized);

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/gimplify.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/gimplify.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/gimplify.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/gimplify.c Mon Mar  2 19:22:11 2009
@@ -3096,6 +3096,7 @@
 		gimple_add_tmp_var (new);
 		TREE_STATIC (new) = 1;
 		TREE_READONLY (new) = 1;
+                /* LLVM LOCAL */
 		DECL_LLVM_PRIVATE (new) = 1;
 		DECL_INITIAL (new) = ctor;
 		if (align > DECL_ALIGN (new))

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/ifcvt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/ifcvt.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/ifcvt.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/ifcvt.c Mon Mar  2 19:22:11 2009
@@ -1409,7 +1409,8 @@
   /* ??? We could handle this if we knew that a load from A or B could
      not fault.  This is also true if we've already loaded
      from the address along the path from ENTRY.  */
-  else if (may_trap_p (a) || may_trap_p (b))
+  /* APPLE LOCAL 6515001 */
+  else if (may_trap_after_code_motion_p (a) || may_trap_after_code_motion_p (b))
     return FALSE;
 
   /* if (test) x = a + b; else x = c - d;

Added: llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/block-no-trampoline-1.C
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g%2B%2B.apple/block-no-trampoline-1.C?rev=65913&view=auto

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/block-no-trampoline-1.C (added)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/block-no-trampoline-1.C Mon Mar  2 19:22:11 2009
@@ -0,0 +1,61 @@
+/* APPLE LOCAL file radar 6545782 */
+/* Test that no trampoline is generated for this test case. */
+/* { dg-do run { target *-*-darwin[1-2][0-9]* } } */
+/* { dg-options "-mmacosx-version-min=10.6" { target *-*-darwin* } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "-m64" } { "" } } */
+
+#include <dispatch/dispatch.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <Block.h>
+
+extern "C" void __enable_execute_stack ()
+{
+        abort();
+}
+
+class A {
+public:
+    void foo();
+};
+
+void A::foo() {}
+
+class B {
+public:
+    void createBlockInMethod(A &a);
+    void callBlockPassedIn(A &a, void(^aBlock)());
+};
+
+void B::createBlockInMethod(A &a) {
+    void (^block) () = ^{ a.foo(); };
+    block();
+}
+
+void B::callBlockPassedIn(A &a, void(^aBlock)()) {
+    aBlock();
+}
+
+
+int main(int argc __attribute__((unused)), char **argv) {
+    __block B b;
+    __block A a;
+    
+    __block int x = 0;
+    
+    uint64_t cyclesPerBlock1 = dispatch_benchmark(1000000, ^{
+        b.createBlockInMethod(a);
+    });
+        
+    uint64_t cyclesPerBlock2 = dispatch_benchmark(1000000, ^{
+        b.callBlockPassedIn(a, ^{ a.foo(); });
+    });
+    
+    fprintf(stdout, "%s: %llu cycles/iter vs. %llu cycles/iter: %5.5f slower\n", argv[0],
+            cyclesPerBlock1, cyclesPerBlock2,
+            ((double)cyclesPerBlock1) / ((double)cyclesPerBlock2));
+    
+    return 0;
+}
+
+

Added: llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/weak-2.C
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g%2B%2B.apple/weak-2.C?rev=65913&view=auto

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/weak-2.C (added)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/g++.apple/weak-2.C Mon Mar  2 19:22:11 2009
@@ -0,0 +1,7 @@
+/* APPLE LOCAL file weak types 6524730 */
+/* { dg-do compile } */
+/* Radar 6524730 */
+
+int * __attribute__((weak)) foo(int * x) {
+  return x;
+}

Added: llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/gcc.apple/6515001.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/gcc.apple/6515001.c?rev=65913&view=auto

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/gcc.apple/6515001.c (added)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/testsuite/gcc.apple/6515001.c Mon Mar  2 19:22:11 2009
@@ -0,0 +1,20 @@
+/* APPLE LOCAL file 6515001 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { scan-assembler-not "cmove" } */
+typedef struct __NSSymbol* NSSymbol;
+
+static struct {
+  unsigned pad[2];
+  unsigned n_value;
+  NSSymbol realSymbol;
+} sLastLookup;
+
+void foo(void *);
+void* NSAddressOfSymbol(NSSymbol symbol)
+{
+  if ( (void*)symbol == (void*)(&sLastLookup) )
+    symbol = sLastLookup.realSymbol;
+
+  foo(symbol);
+  return symbol;
+}

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/tree.h?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/tree.h (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/tree.h Mon Mar  2 19:22:11 2009
@@ -2916,8 +2916,10 @@
   /* Used to indicate that this DECL has weak linkage.  */
 #define DECL_WEAK(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.weak_flag)
 
+/* LLVM LOCAL begin */
 #define DECL_LLVM_PRIVATE(NODE) \
   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.llvm_private_flag)
+/* LLVM LOCAL end */
 
 /* Internal to the gimplifier.  Indicates that the value is a formal
    temporary controlled by the gimplifier.  */

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/version.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/version.c?rev=65913&r1=65912&r2=65913&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/version.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/version.c Mon Mar  2 19:22:11 2009
@@ -11,12 +11,12 @@
 /* APPLE LOCAL begin Apple version */
 #ifdef ENABLE_LLVM
 #ifdef LLVM_VERSION_INFO
-#define VERSUFFIX " (Based on Apple Inc. build 5636) (LLVM build " LLVM_VERSION_INFO ")"
+#define VERSUFFIX " (Based on Apple Inc. build 5641) (LLVM build " LLVM_VERSION_INFO ")"
 #else
-#define VERSUFFIX " (Based on Apple Inc. build 5636) (LLVM build)"
+#define VERSUFFIX " (Based on Apple Inc. build 5641) (LLVM build)"
 #endif
 #else
-#define VERSUFFIX " (Based on Apple Inc. build 5636)"
+#define VERSUFFIX " (Based on Apple Inc. build 5641)"
 #endif
 /* APPLE LOCAL end Apple version */
 





More information about the llvm-commits mailing list