[llvm-commits] [llvm-gcc-4.2] r54204 - in /llvm-gcc-4.2/trunk/gcc: bb-reorder.c c-common.c c-format.c c-parser.c cp/call.c cp/decl2.c cp/except.c cp/lex.c cp/pt.c objc/objc-act.c tree-inline.c tree-optimize.c
Bill Wendling
isanbard at gmail.com
Wed Jul 30 00:11:17 PDT 2008
Author: void
Date: Wed Jul 30 02:11:17 2008
New Revision: 54204
URL: http://llvm.org/viewvc/llvm-project?rev=54204&view=rev
Log:
Merges from Apple's GCC 4.2 r148430
Modified:
llvm-gcc-4.2/trunk/gcc/bb-reorder.c
llvm-gcc-4.2/trunk/gcc/c-common.c
llvm-gcc-4.2/trunk/gcc/c-format.c
llvm-gcc-4.2/trunk/gcc/c-parser.c
llvm-gcc-4.2/trunk/gcc/cp/call.c
llvm-gcc-4.2/trunk/gcc/cp/decl2.c
llvm-gcc-4.2/trunk/gcc/cp/except.c
llvm-gcc-4.2/trunk/gcc/cp/lex.c
llvm-gcc-4.2/trunk/gcc/cp/pt.c
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
llvm-gcc-4.2/trunk/gcc/tree-inline.c
llvm-gcc-4.2/trunk/gcc/tree-optimize.c
Modified: llvm-gcc-4.2/trunk/gcc/bb-reorder.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/bb-reorder.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/bb-reorder.c (original)
+++ llvm-gcc-4.2/trunk/gcc/bb-reorder.c Wed Jul 30 02:11:17 2008
@@ -87,6 +87,7 @@
/* LLVM LOCAL begin comment out most of this file */
#ifndef ENABLE_LLVM
+
#ifndef HAVE_conditional_execution
#define HAVE_conditional_execution 0
#endif
@@ -1967,7 +1968,7 @@
}
}
}
-#endif
+#endif /* !ENABLE_LLVM */
/* LLVM LOCAL end */
/* Duplicate the blocks containing computed gotos. This basically unfactors
@@ -1982,6 +1983,7 @@
return (optimize > 0 && flag_expensive_optimizations && !optimize_size);
}
+
static unsigned int
duplicate_computed_gotos (void)
{
Modified: llvm-gcc-4.2/trunk/gcc/c-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.c Wed Jul 30 02:11:17 2008
@@ -5818,7 +5818,10 @@
return NULL_TREE;
}
- if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE)
+ /* APPLE LOCAL begin blocks 5925781 */
+ if (TREE_CODE (TREE_VALUE (argument)) != POINTER_TYPE &&
+ TREE_CODE (TREE_VALUE (argument)) != BLOCK_POINTER_TYPE)
+ /* APPLE LOCAL end blocks 5925781 */
{
error ("nonnull argument references non-pointer operand (argument %lu, operand %lu)",
(unsigned long) attr_arg_num, (unsigned long) arg_num);
@@ -5986,7 +5989,10 @@
happen if the "nonnull" attribute was given without an operand
list (which means to check every pointer argument). */
- if (TREE_CODE (TREE_TYPE (param)) != POINTER_TYPE)
+ /* APPLE LOCAL begin blocks 5925781 */
+ if (TREE_CODE (TREE_TYPE (param)) != POINTER_TYPE &&
+ TREE_CODE (TREE_TYPE (param)) != BLOCK_POINTER_TYPE)
+ /* APPLE LOCAL end blocks 5925781 */
return;
if (integer_zerop (param))
Modified: llvm-gcc-4.2/trunk/gcc/c-format.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-format.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-format.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-format.c Wed Jul 30 02:11:17 2008
@@ -713,6 +713,11 @@
/* GNU conversion specifiers. */
{ "kls", 0, STD_EXT, NOLENGTHS, "-_0Ow", "", NULL },
{ "P", 0, STD_EXT, NOLENGTHS, "", "", NULL },
+ /* APPLE LOCAL begin strftime 5838528 */
+#ifdef CONFIG_DARWIN_H
+ { "+", 0, STD_EXT, NOLENGTHS, "E", "", NULL },
+#endif
+ /* APPLE LOCAL end strftime 5838528 */
{ NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
};
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=54204&r1=54203&r2=54204&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:11:17 2008
@@ -1571,7 +1571,11 @@
/* Function definition (nested or otherwise). */
if (nested)
{
- if (pedantic)
+ /* APPLE LOCAL begin radar 5985368 */
+ if (declarator->declarator && declarator->declarator->kind == cdk_block_pointer)
+ error ("bad definition of a block");
+ else if (pedantic)
+ /* APPLE LOCAL end radar 5985368 */
pedwarn ("ISO C forbids nested functions");
/* APPLE LOCAL begin nested functions 4258406 4357979 (in 4.2 m) */
else if (flag_nested_functions == 0)
@@ -4387,7 +4391,8 @@
/* APPLE LOCAL begin radar 4708210 (for_objc_collection in 4.2) */
cond = NULL_TREE;
c_parser_declaration_or_fndef (parser, true, true, true, true, &cond);
- if (c_parser_next_token_is_keyword (parser, RID_IN))
+ /* APPLE LOCAL radar 5925639 */
+ if (c_parser_next_token_is_keyword (parser, RID_IN) && cond)
{
cond = finish_parse_foreach_header (parser, cond);
foreach_p = true;
@@ -4415,7 +4420,8 @@
cond = NULL_TREE;
c_parser_declaration_or_fndef (parser, true, true, true, true, &cond);
restore_extension_diagnostics (ext);
- if (c_parser_next_token_is_keyword (parser, RID_IN))
+ /* APPLE LOCAL radar 5925639 */
+ if (c_parser_next_token_is_keyword (parser, RID_IN) && cond)
{
cond = finish_parse_foreach_header (parser, cond);
foreach_p = true;
@@ -5471,6 +5477,8 @@
assignment-expression ,
assignment-expression )
__builtin_types_compatible_p ( type-name , type-name )
+ APPLE LOCAL blocks (C++ cf)
+ ^ block-literal-expr
offsetof-member-designator:
identifier
@@ -6001,29 +6009,6 @@
expr.original_code = ERROR_MARK;
break;
}
- /* (in 4.2 be) */
- if (c_parser_next_token_is (parser, CPP_ATSIGN))
- {
- tree id;
- location_t loc = c_parser_peek_token (parser)->location;
- c_parser_consume_token (parser);
- if (c_parser_peek_token (parser)->id_kind != C_ID_ID)
- {
- c_parser_error (parser, "expected identifier");
- expr.value = error_mark_node;
- expr.original_code = ERROR_MARK;
- break;
- }
-
- id = c_parser_peek_token (parser)->value;
- c_parser_consume_token (parser);
- id = prepend_char_identifier (id, '@');
- expr.value = build_external_ref (id,
- (c_parser_peek_token (parser)->type
- == CPP_OPEN_PAREN), loc);
- expr.original_code = ERROR_MARK;
- break;
- }
}
/* APPLE LOCAL end CW asm blocks */
c_parser_error (parser, "expected expression");
@@ -9224,17 +9209,6 @@
operand = iasm_build_register_offset (operand, op2.value);
}
- /* (in 4.2 bd) */
- while (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
- {
- struct c_expr op2;
- c_parser_consume_token (parser);
- op2 = c_parser_expr_no_commas (parser, NULL);
- c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
- "expected %<)%>");
- operand = iasm_build_register_offset (operand, op2.value);
- }
-
return operand;
}
Modified: llvm-gcc-4.2/trunk/gcc/cp/call.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/call.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/call.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/call.c Wed Jul 30 02:11:17 2008
@@ -907,6 +907,15 @@
&& DERIVED_FROM_P (t1, t2)));
}
+/* APPLE LOCAL begin radar 6029624 */
+/* Used in objective-c++, same as reference_related_p */
+bool
+objcp_reference_related_p (tree t1, tree t2)
+{
+ return reference_related_p (t1, t2);
+}
+/* APPLE LOCAL end radar 6029624 */
+
/* Returns nonzero if T1 is reference-compatible with T2. */
static bool
Modified: llvm-gcc-4.2/trunk/gcc/cp/decl2.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl2.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl2.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl2.c Wed Jul 30 02:11:17 2008
@@ -1604,6 +1604,17 @@
DECL_VISIBILITY (decl) = visibility;
return true;
}
+ /* APPLE LOCAL begin constrain visibility for templates 5813435 */
+ else if (visibility > DECL_VISIBILITY (decl)
+ && DECL_VISIBILITY_SPECIFIED (decl)
+ && !lookup_attribute ("visibility", DECL_ATTRIBUTES (decl))
+ && !lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
+ {
+ /* We also constrain implicit visibilities (for templates). */
+ DECL_VISIBILITY (decl) = visibility;
+ return true;
+ }
+ /* APPLE LOCAL end constrain visibility for templates 5813435 */
return false;
}
Modified: llvm-gcc-4.2/trunk/gcc/cp/except.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/except.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/except.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/except.c Wed Jul 30 02:11:17 2008
@@ -56,7 +56,8 @@
static int can_convert_eh (tree, tree);
static tree cp_protect_cleanup_actions (void);
-/* LLVM local begin */
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
/* Do nothing (return NULL_TREE). */
static tree return_null_tree (void);
@@ -65,7 +66,8 @@
{
return NULL_TREE;
}
-/* LLVM local end */
+#endif
+/* LLVM LOCAL end */
/* Sets up all the global eh stuff that needs to be initialized at the
start of compilation. */
@@ -89,22 +91,36 @@
call_unexpected_node
= push_throw_library_fn (get_identifier ("__cxa_call_unexpected"), tmp);
- /* LLVM local begin */
+ /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
llvm_eh_personality_libfunc
= llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS
? "__gxx_personality_sj0"
: "__gxx_personality_v0");
- /* LLVM local end */
+#else
+ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ ? "__gxx_personality_sj0"
+ : "__gxx_personality_v0");
+#endif
+ /* LLVM LOCAL end */
if (targetm.arm_eabi_unwinder)
- /* LLVM local */
+ /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
llvm_unwind_resume_libfunc = llvm_init_one_libfunc ("__cxa_end_cleanup");
+#else
+ unwind_resume_libfunc = init_one_libfunc ("__cxa_end_cleanup");
+#endif
+ /* LLVM LOCAL end */
else
default_init_unwind_resume_libfunc ();
lang_eh_runtime_type = build_eh_type_type;
lang_protect_cleanup_actions = &cp_protect_cleanup_actions;
- /* LLVM local */
+ /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
lang_eh_catch_all = return_null_tree;
+#endif
+ /* LLVM LOCAL end */
}
/* Returns an expression to be executed if an unhandled exception is
@@ -371,12 +387,18 @@
case lang_java:
state = chose_java;
- /* LLVM local begin */
+ /* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
llvm_eh_personality_libfunc
= llvm_init_one_libfunc (USING_SJLJ_EXCEPTIONS
? "__gcj_personality_sj0"
: "__gcj_personality_v0");
- /* LLVM local end */
+#else
+ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ ? "__gcj_personality_sj0"
+ : "__gcj_personality_v0");
+#endif
+ /* LLVM LOCAL end */
break;
default:
Modified: llvm-gcc-4.2/trunk/gcc/cp/lex.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/lex.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/lex.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/lex.c Wed Jul 30 02:11:17 2008
@@ -877,18 +877,3 @@
return t;
}
-
-/* Returns true if we are currently in the main source file, or in a
- template instantiation started from the main source file. */
-
-bool
-in_main_input_context (void)
-{
- tree tl = outermost_tinst_level();
-
- if (tl)
- return strcmp (main_input_filename,
- LOCATION_FILE (TINST_LOCATION (tl))) == 0;
- else
- return strcmp (main_input_filename, input_filename) == 0;
-}
Modified: llvm-gcc-4.2/trunk/gcc/cp/pt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/pt.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/pt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/pt.c Wed Jul 30 02:11:17 2008
@@ -5288,15 +5288,6 @@
pop_tinst_level ();
}
-/* Returns the TINST_LEVEL which gives the original instantiation
- context. */
-
-tree
-outermost_tinst_level (void)
-{
- return tree_last (current_tinst_level);
-}
-
/* DECL is a friend FUNCTION_DECL or TEMPLATE_DECL. ARGS is the
vector of template arguments, as for tsubst.
@@ -5778,7 +5769,15 @@
if (CLASSTYPE_VISIBILITY_SPECIFIED (pattern))
{
CLASSTYPE_VISIBILITY_SPECIFIED (type) = 1;
- CLASSTYPE_VISIBILITY (type) = CLASSTYPE_VISIBILITY (pattern);
+ /* APPLE LOCAL begin 5812195 */
+ /* CLASSTYPE_VISIBILITY (type) should already be set by the time
+ we get here, in particular, we should just constrain the
+ visibility, as we don't reconstrain on template arguments
+ post this whereas we've already done that by the time we get
+ here. */
+ if (CLASSTYPE_VISIBILITY (type) < CLASSTYPE_VISIBILITY (pattern))
+ CLASSTYPE_VISIBILITY (type) = CLASSTYPE_VISIBILITY (pattern);
+ /* APPLE LOCAL end 5812195 */
}
pbinfo = TYPE_BINFO (pattern);
@@ -7011,7 +7010,7 @@
cp_apply_type_quals_to_decl (cp_type_quals (type), r);
DECL_CONTEXT (r) = ctx;
/* Clear out the mangled name and RTL for the instantiation. */
- SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
+ SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL))
/* LLVM LOCAL begin */
#ifndef ENABLE_LLVM
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=54204&r1=54203&r2=54204&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:11:17 2008
@@ -16319,6 +16319,12 @@
tree record = CLASS_STATIC_TEMPLATE (class);
tree type = TREE_TYPE (property);
tree field_decl, field;
+ /* APPLE LOCAL begin radar 6029624 */
+#ifdef OBJCPLUS
+ if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TYPE_MAIN_VARIANT (TREE_TYPE (type));
+#endif
+ /* APPLE LOCAL end radar 6029624 */
field_decl = create_field_decl (type,
ivar_name ? ivar_name
: objc_build_property_ivar_name (property));
@@ -19587,8 +19593,22 @@
tree ivar_type = DECL_BIT_FIELD_TYPE (ivar_decl)
? DECL_BIT_FIELD_TYPE (ivar_decl)
: TREE_TYPE (ivar_decl);
- if (comptypes (ivar_type, TREE_TYPE (property_decl)) != 1
- && !objc_compare_types (TREE_TYPE (property_decl), ivar_type, -5, NULL_TREE))
+ /* APPLE LOCAL begin radar 6029624 */
+ tree property_type = TREE_TYPE (property_decl);
+ bool comparison_result;
+#ifdef OBJCPLUS
+ if (TREE_CODE (property_type) == REFERENCE_TYPE)
+ {
+ property_type = TREE_TYPE (property_type);
+ comparison_result =
+ !objcp_reference_related_p (property_type, ivar_type);
+ }
+ else
+#endif
+ comparison_result = comptypes (ivar_type, property_type) != 1;
+ if (comparison_result
+ && !objc_compare_types (property_type, ivar_type, -5, NULL_TREE))
+ /* APPLE LOCAL end radar 6029624 */
/* APPLE LOCAL end radar 5389292 */
{
error ("type of property %qs does not match type of ivar %qs",
Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-inline.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-inline.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-inline.c Wed Jul 30 02:11:17 2008
@@ -1022,11 +1022,14 @@
/* If the parameter is never assigned to, we may not need to
create a new variable here at all. Instead, we may be able
to just use the argument value. */
-/* LLVM LOCAL begin fix handling of parameters with variably modified types */
- /* We need the copy if it has a variably modified type. */
if (TREE_READONLY (p)
&& !TREE_ADDRESSABLE (p)
+/* LLVM LOCAL begin fix handling of parameters with variably modified types */
+#ifdef ENABLE_LLVM
+ /* We need the copy if it has a variably modified type. */
&& !variably_modified_type_p (TREE_TYPE (p), id->src_fn)
+#endif
+/* LLVM LOCAL end */
&& value && !TREE_SIDE_EFFECTS (value))
{
/* We may produce non-gimple trees by adding NOPs or introduce
@@ -1052,12 +1055,15 @@
function. */
var = copy_decl_to_var (p, id);
+/* LLVM LOCAL begin fix handling of parameters with variably modified types */
+#ifdef ENABLE_LLVM
/* But, we must remap variably modified types, which depend on local
variables in this function and are NOT visible to the calling
function. */
if (variably_modified_type_p (TREE_TYPE (p), id->src_fn))
TREE_TYPE (var) = remap_type(TREE_TYPE (p), id);
-/* LLVM LOCAL end fix handling of parameters with variably modified types */
+#endif
+/* LLVM LOCAL end */
/* See if the frontend wants to pass this by invisible reference. If
so, our new VAR_DECL will have REFERENCE_TYPE, and we need to
@@ -1274,9 +1280,8 @@
/* LLVM LOCAL begin */
#ifdef ENABLE_LLVM
- /* The return node may not dominate all of its uses. Because of
- * this, conservatively don't consider it for SSA form anymore.
- */
+ /* The return node may not dominate all of its uses. Because of this,
+ conservatively don't consider it for SSA form anymore. */
if (TREE_CODE (var) == VAR_DECL)
DECL_GIMPLE_FORMAL_TEMP_P (var) = 0;
#endif
@@ -1580,7 +1585,7 @@
/* Squirrel away the result so that we don't have to check again. */
DECL_UNINLINABLE (fn) = !inlinable;
-
+
return inlinable;
}
@@ -2840,7 +2845,7 @@
if (!update_clones)
DECL_NAME (new_decl) = create_tmp_var_name (NULL);
/* LLVM LOCAL begin */
- #ifndef ENABLE_LLVM
+#ifndef ENABLE_LLVM
/* Create a new SYMBOL_REF rtx for the new name. */
if (DECL_RTL (old_decl) != NULL)
{
@@ -2849,7 +2854,7 @@
gen_rtx_SYMBOL_REF (GET_MODE (XEXP (DECL_RTL (old_decl), 0)),
IDENTIFIER_POINTER (DECL_NAME (new_decl)));
}
- #endif
+#endif
/* LLVM LOCAL end */
/* Prepare the data structures for the tree copy. */
Modified: llvm-gcc-4.2/trunk/gcc/tree-optimize.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-optimize.c?rev=54204&r1=54203&r2=54204&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-optimize.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-optimize.c Wed Jul 30 02:11:17 2008
@@ -50,7 +50,9 @@
/* APPLE LOCAL optimization pragmas 3124235/3420242 */
#include "opts.h"
/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
#include "llvm.h"
+#endif
/* LLVM LOCAL end */
#include "cfgloop.h"
#include "except.h"
More information about the llvm-commits
mailing list