[llvm-commits] [llvm-gcc-4.2] r64577 - in /llvm-gcc-4.2/trunk/gcc: ChangeLog.apple c-common.h c-decl.c config/arm/arm.h cp/ChangeLog.apple cp/decl.c cp/semantics.c dwarf2out.c testsuite/g++.apple/block-no-trampoline-1.C version.c
Bill Wendling
isanbard at gmail.com
Sat Feb 14 20:21:19 PST 2009
Author: void
Date: Sat Feb 14 22:21:19 2009
New Revision: 64577
URL: http://llvm.org/viewvc/llvm-project?rev=64577&view=rev
Log:
Update to Apple GCC's 5641. This includes some important blocks fixes.
Added:
llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C
Modified:
llvm-gcc-4.2/trunk/gcc/ChangeLog.apple
llvm-gcc-4.2/trunk/gcc/c-common.h
llvm-gcc-4.2/trunk/gcc/c-decl.c
llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple
llvm-gcc-4.2/trunk/gcc/cp/decl.c
llvm-gcc-4.2/trunk/gcc/cp/semantics.c
llvm-gcc-4.2/trunk/gcc/dwarf2out.c
llvm-gcc-4.2/trunk/gcc/version.c
Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ChangeLog.apple?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/ChangeLog.apple Sat Feb 14 22:21:19 2009
@@ -1,3 +1,19 @@
+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
Modified: llvm-gcc-4.2/trunk/gcc/c-common.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.h?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.h Sat Feb 14 22:21:19 2009
@@ -467,9 +467,11 @@
extern int warn_format;
/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
/* Warn about possible security problems with format functions */
extern int warn_format_security;
+#endif
/* LLVM LOCAL end */
/* APPLE LOCAL begin disable_typechecking_for_spec_flag */
@@ -993,8 +995,11 @@
/* APPLE LOCAL radar 4507230 */
bool objc_type_valid_for_messaging (tree);
extern void objc_volatilize_decl (tree);
-/* LLVM LOCAL rdar 6551276 */
+/* LLVM LOCAL begin - rdar 6551276 */
+#ifdef ENABLE_LLVM
extern tree objc_build_volatilized_type (tree);
+#endif
+/* LLVM LOCAL end - rdar 6551276 */
extern bool objc_type_quals_match (tree, tree);
extern tree objc_rewrite_function_call (tree, tree);
extern tree objc_message_selector (void);
@@ -1139,7 +1144,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/trunk/gcc/c-decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-decl.c Sat Feb 14 22:21:19 2009
@@ -2020,6 +2020,7 @@
&& TREE_STATIC (olddecl))))
make_decl_llvm (olddecl);
#endif
+ /* LLVM LOCAL end */
/* APPLE LOCAL begin mainline 4.3 2006-10-31 4134307 */
/* If we changed a function from DECL_EXTERNAL to !DECL_EXTERNAL,
@@ -3650,6 +3651,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 +3702,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/trunk/gcc/config/arm/arm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Sat Feb 14 22:21:19 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/trunk/gcc/cp/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple Sat Feb 14 22:21:19 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/trunk/gcc/cp/decl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.c?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Sat Feb 14 22:21:19 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/trunk/gcc/cp/semantics.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/semantics.c?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/semantics.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/semantics.c Sat Feb 14 22:21:19 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/trunk/gcc/dwarf2out.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/dwarf2out.c?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/dwarf2out.c (original)
+++ llvm-gcc-4.2/trunk/gcc/dwarf2out.c Sat Feb 14 22:21:19 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);
Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-no-trampoline-1.C?rev=64577&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C (added)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-no-trampoline-1.C Sat Feb 14 22:21:19 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;
+}
+
+
Modified: llvm-gcc-4.2/trunk/gcc/version.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/version.c?rev=64577&r1=64576&r2=64577&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/version.c (original)
+++ llvm-gcc-4.2/trunk/gcc/version.c Sat Feb 14 22:21:19 2009
@@ -11,12 +11,12 @@
/* APPLE LOCAL begin Apple version */
#ifdef ENABLE_LLVM
#ifdef LLVM_VERSION_INFO
-#define VERSUFFIX " (Based on Apple Inc. build 5639) (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 5639) (LLVM build)"
+#define VERSUFFIX " (Based on Apple Inc. build 5641) (LLVM build)"
#endif
#else
-#define VERSUFFIX " (Based on Apple Inc. build 5639)"
+#define VERSUFFIX " (Based on Apple Inc. build 5641)"
#endif
/* APPLE LOCAL end Apple version */
More information about the llvm-commits
mailing list