[llvm-commits] [llvm-gcc-4.2] r43927 - in /llvm-gcc-4.2/trunk: ./ gcc/ gcc/config/ gcc/config/arm/ gcc/config/i386/ gcc/config/rs6000/ gcc/cp/ gcc/doc/ gcc/ginclude/ gcc/objc/

Bill Wendling isanbard at gmail.com
Thu Nov 8 18:30:17 PST 2007


Author: void
Date: Thu Nov  8 20:30:15 2007
New Revision: 43927

URL: http://llvm.org/viewvc/llvm-project?rev=43927&view=rev
Log:
Final commit to bring LLVM-GCC 4.2 up to Apple GCC r139307

Modified:
    llvm-gcc-4.2/trunk/build_gcc
    llvm-gcc-4.2/trunk/gcc/ChangeLog
    llvm-gcc-4.2/trunk/gcc/ChangeLog.apple
    llvm-gcc-4.2/trunk/gcc/ChangeLog.lno
    llvm-gcc-4.2/trunk/gcc/Makefile.in
    llvm-gcc-4.2/trunk/gcc/bitmap.h
    llvm-gcc-4.2/trunk/gcc/builtins.c
    llvm-gcc-4.2/trunk/gcc/builtins.def
    llvm-gcc-4.2/trunk/gcc/c-common.c
    llvm-gcc-4.2/trunk/gcc/c-common.h
    llvm-gcc-4.2/trunk/gcc/c-decl.c
    llvm-gcc-4.2/trunk/gcc/c-lex.c
    llvm-gcc-4.2/trunk/gcc/c-opts.c
    llvm-gcc-4.2/trunk/gcc/c-parser.c
    llvm-gcc-4.2/trunk/gcc/c-tree.h
    llvm-gcc-4.2/trunk/gcc/c-typeck.c
    llvm-gcc-4.2/trunk/gcc/c.opt
    llvm-gcc-4.2/trunk/gcc/calls.c
    llvm-gcc-4.2/trunk/gcc/cfghooks.c
    llvm-gcc-4.2/trunk/gcc/common.opt
    llvm-gcc-4.2/trunk/gcc/config.gcc
    llvm-gcc-4.2/trunk/gcc/config/arm/arm-protos.h
    llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
    llvm-gcc-4.2/trunk/gcc/config/arm/arm.h
    llvm-gcc-4.2/trunk/gcc/config/arm/arm.md
    llvm-gcc-4.2/trunk/gcc/config/arm/arm.opt
    llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-df.S
    llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-sf.S
    llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm
    llvm-gcc-4.2/trunk/gcc/config/arm/predicates.md
    llvm-gcc-4.2/trunk/gcc/config/asm.h
    llvm-gcc-4.2/trunk/gcc/config/darwin-c.c
    llvm-gcc-4.2/trunk/gcc/config/darwin-protos.h
    llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def
    llvm-gcc-4.2/trunk/gcc/config/darwin.c
    llvm-gcc-4.2/trunk/gcc/config/darwin.h
    llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h
    llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h
    llvm-gcc-4.2/trunk/gcc/config/i386/i386-protos.h
    llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
    llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
    llvm-gcc-4.2/trunk/gcc/config/i386/i386.md
    llvm-gcc-4.2/trunk/gcc/config/i386/linux.h
    llvm-gcc-4.2/trunk/gcc/config/i386/t-mingw32
    llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h
    llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000-protos.h
    llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c
    llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
    llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.md
    llvm-gcc-4.2/trunk/gcc/cp/ChangeLog
    llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple
    llvm-gcc-4.2/trunk/gcc/cp/call.c
    llvm-gcc-4.2/trunk/gcc/cp/class.c
    llvm-gcc-4.2/trunk/gcc/cp/cp-gimplify.c
    llvm-gcc-4.2/trunk/gcc/cp/cp-tree.def
    llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
    llvm-gcc-4.2/trunk/gcc/cp/cvt.c
    llvm-gcc-4.2/trunk/gcc/cp/decl.c
    llvm-gcc-4.2/trunk/gcc/cp/dump.c
    llvm-gcc-4.2/trunk/gcc/cp/init.c
    llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c
    llvm-gcc-4.2/trunk/gcc/cp/parser.c
    llvm-gcc-4.2/trunk/gcc/cp/pt.c
    llvm-gcc-4.2/trunk/gcc/cp/semantics.c
    llvm-gcc-4.2/trunk/gcc/cp/typeck.c
    llvm-gcc-4.2/trunk/gcc/cp/typeck2.c
    llvm-gcc-4.2/trunk/gcc/cse.c
    llvm-gcc-4.2/trunk/gcc/dbxout.c
    llvm-gcc-4.2/trunk/gcc/defaults.h
    llvm-gcc-4.2/trunk/gcc/doc/extend.texi
    llvm-gcc-4.2/trunk/gcc/doc/invoke.texi
    llvm-gcc-4.2/trunk/gcc/dwarf2out.c
    llvm-gcc-4.2/trunk/gcc/emit-rtl.c
    llvm-gcc-4.2/trunk/gcc/except.c
    llvm-gcc-4.2/trunk/gcc/explow.c
    llvm-gcc-4.2/trunk/gcc/expr.c
    llvm-gcc-4.2/trunk/gcc/final.c
    llvm-gcc-4.2/trunk/gcc/function.h
    llvm-gcc-4.2/trunk/gcc/gcc.c
    llvm-gcc-4.2/trunk/gcc/gcse.c
    llvm-gcc-4.2/trunk/gcc/gimplify.c
    llvm-gcc-4.2/trunk/gcc/ginclude/float.h
    llvm-gcc-4.2/trunk/gcc/global.c
    llvm-gcc-4.2/trunk/gcc/insn-notes.def
    llvm-gcc-4.2/trunk/gcc/jump.c
    llvm-gcc-4.2/trunk/gcc/libgcc2.c
    llvm-gcc-4.2/trunk/gcc/libgcc2.h
    llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.h
    llvm-gcc-4.2/trunk/gcc/objc/objc-tree.def
    llvm-gcc-4.2/trunk/gcc/opts.c
    llvm-gcc-4.2/trunk/gcc/passes.c
    llvm-gcc-4.2/trunk/gcc/print-rtl.c
    llvm-gcc-4.2/trunk/gcc/recog.c
    llvm-gcc-4.2/trunk/gcc/regclass.c
    llvm-gcc-4.2/trunk/gcc/reload.c
    llvm-gcc-4.2/trunk/gcc/reload1.c
    llvm-gcc-4.2/trunk/gcc/rtl.def
    llvm-gcc-4.2/trunk/gcc/rtl.h
    llvm-gcc-4.2/trunk/gcc/stmt.c
    llvm-gcc-4.2/trunk/gcc/stor-layout.c
    llvm-gcc-4.2/trunk/gcc/stub-objc.c
    llvm-gcc-4.2/trunk/gcc/target-def.h
    llvm-gcc-4.2/trunk/gcc/target.h
    llvm-gcc-4.2/trunk/gcc/toplev.c
    llvm-gcc-4.2/trunk/gcc/toplev.h
    llvm-gcc-4.2/trunk/gcc/tree-cfg.c
    llvm-gcc-4.2/trunk/gcc/tree-flow.h
    llvm-gcc-4.2/trunk/gcc/tree-pass.h
    llvm-gcc-4.2/trunk/gcc/tree-sra.c
    llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-memset.c
    llvm-gcc-4.2/trunk/gcc/tree-ssa-loop.c
    llvm-gcc-4.2/trunk/gcc/tree-vect-analyze.c
    llvm-gcc-4.2/trunk/gcc/tree-vectorizer.h
    llvm-gcc-4.2/trunk/gcc/tree.c
    llvm-gcc-4.2/trunk/gcc/tree.h
    llvm-gcc-4.2/trunk/gcc/varasm.c
    llvm-gcc-4.2/trunk/gcc/version.c

Modified: llvm-gcc-4.2/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Thu Nov  8 20:30:15 2007
@@ -123,6 +123,7 @@
 rm -f /usr/lib/gcc/*/4.0.0/specs
 
 # These are the configure and build flags that are used.
+# LLVM LOCAL begin - FIXME: Disable multilibs
 CONFIGFLAGS="--disable-checking -enable-werror \
   --disable-multilib \
   --prefix=$DEST_ROOT \
@@ -132,6 +133,7 @@
   --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \
   --with-slibdir=/usr/lib \
   --build=$BUILD-apple-darwin$DARWIN_VERS"
+# LLVM LOCAL end - FIXME: Disable multilibs
 
 # LLVM LOCAL begin
 if [ "$ENABLE_LLVM" == true ]; then

Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ChangeLog?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ChangeLog (original)
+++ llvm-gcc-4.2/trunk/gcc/ChangeLog Thu Nov  8 20:30:15 2007
@@ -1,3 +1,74 @@
+2007-10-07  Geoffrey Keating  <geoffk at apple.com>
+
+	* config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS): Register
+	'#pragma mark' to be executed at preprocessing time.
+
+2007-09-14  Geoffrey Keating  <geoffk at apple.com>
+
+	Radar 5480287
+	* dwarf2out.c (output_call_frame_info): FDEs are always emitted
+	if flag_exceptions is not set.
+	* config/darwin.c (darwin_emit_unwind_label): Rewrite to use
+	assemble_name rather than incorrectly emulating it.
+
+	Radar 5482863
+	* doc/extend.texi (Deprecated Features): Mention that <? and >? and
+	friends are removed from G++.
+
+2007-08-02  Geoffrey Keating  <geoffk at apple.com>
+
+	Radar 3274130, 5295549
+	* c-parser.c (c_parser_while_statement): Handle attributes.
+	(c_parser_do_statement): Handle attributes.
+	(c_parser_for_statement): Handle attributes.
+	* c-common.c (handle_unused_attribute): Warn if a statement
+	is marked as unused.
+	* c-tree.h (c_finish_loop): Add extra parameter.
+	* c-typeck.c (c_finish_loop): Handle attributes.
+	* doc/extend.texi (Attribute Syntax): Document statement attributes.
+	(Label Attributes): Explain how they apply to statements.
+	* tree-cfg.c (cleanup_dead_labels): Preserve labels with
+	user-specified alignment or attributes.
+	* stmt.c (expand_label): Update and correct documentation.
+
+	* c-common.c (handle_aligned_attribute): Handle LABEL_DECL.
+	* rtl.def (CODE_LABEL): Add 8th operand.
+	* rtl.h (LABEL_ALIGN_LOG): New.
+	(LABEL_MAX_SKIP): New.
+	(SET_LABEL_ALIGN): New.
+	* emit-rtl.c (gen_label_rtx): Adjust.
+	* print-rtl.c (print_rtx): Print LABEL_ALIGN_LOG.
+	* stmt.c (label_rtx): Set CODE_LABEL's alignment from DECL_ALIGN.
+	(expand_label): Update documentation.
+	* final.c (struct label_alignment): Delete.
+	(label_align): Delete.
+	(min_labelno): Delete.
+	(max_labelno): Delete.
+	(LABEL_TO_ALIGNMENT): Delete.
+	(LABEL_TO_MAX_SKIP): Delete.
+	(label_to_alignment): Adjust for LABEL_ALIGN_LOG.
+	(align_fuzz): Likewise.
+	(compute_alignments): Likewise.
+	(shorten_branches): Remove code to set up label_align.
+	Adjust for LABEL_ALIGN_LOG.
+	(final_scan_insn): Adjust for LABEL_ALIGN_LOG.
+	* doc/extend.texi (C Extensions): Add 'Label Attributes' to menu.
+	(Attribute Syntax): Move label content to Label Attributes.
+	(Function Attributes): Mention label attributes.
+	(Variable Attributes): Mention label attributes.
+	(Type Attributes): Mention label attributes.
+	(Label Attributes): New.
+
+	* builtins.c (get_pointer_alignment): Honor DECL_ALIGN on a
+	FUNCTION_DECL.
+	* tree.c (build_decl_stat): Move code from here...
+	(make_node_stat): ... to here.  Don't uselessly clear DECL_USER_ALIGN.
+	(expr_align): Honor DECL_ALIGN on a FUNCTION_DECL.  Add comment
+	about using DECL_ALIGN of LABEL_DECL and CONST_DECL.
+	* tree.h (DECL_USER_ALIGN): Fix misplaced comment.
+	* varasm.c (assemble_start_function): Use DECL_ALIGN instead of
+	FUNCTION_BOUNDARY.
+
 2007-06-21  H.J. Lu  <hongjiu.lu at intel.com>
 
 	Radar 5289915

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/ChangeLog.apple Thu Nov  8 20:30:15 2007
@@ -1,3 +1,532 @@
+2007-11-07  Josh Conner  <jconner at apple.com>
+
+	Radar 5581683
+	* function.h (struct function): Add calls_builtin_ret_addr
+	and calls_builtin_frame_addr.
+	(current_function_calls_builtin_ret_addr): New definition.
+	(current_function_calls_builtin_frame_addr): New definition.
+	* builtins.c (expand_builtin_return_addr): Set
+	current_function_calls_builtin_frame_addr and
+	current_function_calls_builtin_ret_addr.
+	(expand_builtin_setjmp_receiver): Check
+	builtin_setjmp_frame_value.
+	* dbxout.c (dbxout_parms): Adjust debug info offset by
+	DEBUGGER_ARG_OFFSET.
+	* global.c (global_alloc): Add ALLOW_ELIMINATION_TO_SP
+	logic.
+	* reload1.c (update_eliminables): Likewise.
+	(init_elim_table): Likewise.
+	* config/arm/arm.c (arm_builtin_setjmp_frame_value): New
+	function.
+	(TARGET_BUILTIN_SETJMP_FRAME_VALUE): Define.
+	(inclusive_bitmask): New function.
+	(use_return_insn): Support darwin alternate frame layout.
+	(arm_compute_save_reg0_reg12_mask): Likewise.
+	(arm_compute_save_reg_mask): Likewise.
+	(thumb_compuate_save_reg_mask): Mandate use of FP.  Also,
+	support darwin alternate frame layout.
+	(arm_output_epilogue): Support darwin alternate frame layout.
+	(arm_get_frame_offsets): Likewise.
+	(arm_compute_initial_elimination_offset): Likewise.
+	(arm_expand_prologue): Likewise.
+	(arm_return_addr): Likewise.
+	(thumb_compute_initial_elimination_offset): Likewise.
+	(thumb_expand_prologue): Likewise.
+	(arm_set_return_addr): Likewise.
+	(thumb_set_return_addr): Likewise.
+	(arm_debugger_arg_offset): Adjust for SP-relative addressing.
+	(thumb_output_function_prologue): Mandate use of FP.
+	(arm_builtin_setjmp_frame_value): New function.
+	(arm_local_debug_offset): New function.
+	* config/arm/arm.h (ARM_HARD_FRAME_POINTER_REGNUM): Define as
+	r7.
+	(FRAME_POINTER_REQUIRED): Redefine to match darwin alternate
+	frame layout.
+	(ELIMINABLE_REGS): Don't eliminate from AP into FP.
+	Merge ARM and Thumb hard frame pointers.
+	(CAN_ELIMINATE): Allow elimination to SP if SP doesn't change
+	during a function's lifetime.
+	(DEBUGGER_ARG_OFFSET): Always call arm_debugger_arg_offset.
+	(DEBUGGER_AUTO_OFFSET): Define.
+	(ALLOW_ELIMINATION_TO_SP): Define.
+	* config/arm/arm-protos.h (arm_local_debug_offset): New proto.
+	* config/arm/darwin-libgcc.10.4.ver (addsf3, floatdisf,
+	floatsisf, subsf3): Remove.
+
+2007-11-07  Josh Conner  <jconner at apple.com>
+
+	Radar 5585396
+	* config/arm/arm.md (trap): New define_insn.
+
+2007-11-06  Eric Christopher  <echristo at apple.com>
+
+	Radar 5583537
+	* config.gcc: Remove duplicate apple local code.
+
+2007-11-05  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4709514
+	* tree-pass.h (pass_memset) : Removed.
+	* bitmap.h (bitmap_empty_p) : Removed.
+	* tree-ssa-loop.c: (tree_ssa_loop_memset, gate_tree_ssa_loop_memset,
+	pass_memset) : Removed.
+	* tree-ssa-loop-memset.c : Removed.
+	* tree-vectorizer.h: (vect_analyze_pointer_ref_access) : Removed.
+	* tree-vect-analyze.c (tree vect_get_loop_niters): Declared it as
+	a static instead of an extern function.
+	* tree-flow.h (tree_ssa_memset): Removed.
+	* passes.c (pass_memset): Removed.
+	* Makefile.in (tree-ssa-loop-memset.o) : Removed.
+
+2007-11-05  Josh Conner  <jconner at apple.com>
+
+	Radar 5569420
+	* doc/invoke.texi: Reinstate ARM options.
+	* builtins.c (expand_builtin_alloca): Emit NOTE_INSN_ALLOCA.
+	* final.c (final_scan_insn): Handle NOTE_INSN_ALLOCA.
+	* insn-notes.def (ALLOCA): New INSN_NOTE.
+	* cse.c (fold_rtx): Verify REGNO_QTY_VALID_P (folded_arg1)
+	before using it.
+	* stor-layout.c (start_record_layout): Add PEG_ALIGN_FOR_MAC68K
+	handling.
+	* calls.c (store_one_arg): Handle arguments which are partially
+	on the stack when detecting argument overlap.
+	* except.c (sjlj_emit_function_enter): Split this into
+	(sjlj_generate_setjmp_sequence): ...this new function...
+	(sjlj_emit_function_setjmps): ...and this new function.
+	(sjlj_emit_dispatch_table): Call sjlj_emit_function_setjmps
+	instead of sjlj_emit_function_enter.
+	* config/i386/darwin.h (CC1_SPEC): Ignore -mthumb and
+	-mno-thumb.
+	* config/rs6000/darwin.h (CC1_SPEC): Likewise.
+	* config/arm/arm.c (all_architectures): Change default
+	processors for TARGET_MACHO.
+	(arm_override_options): Don't warn if interworking selected
+	on a processor that doesn't support thumb.  Enable
+	interworking by default on v5 and later architectures.
+	(arm_compute_func_type): Consider TARGET_INTERWORK only on
+	pre-v5 architectures.
+	(use_return_insn): Likewise.
+	(thumb_pushpop): Likewise.
+	(thumb_exit): Likewise.
+	(arm_function_ok_for_sibcall): Likewise.  Also, don't allow
+	sibcalls of external functions on TARGET_MACHO.  Also,
+	don't allow sibcalls of weak functions.
+	(arm_legitimate_index_p): Limit indexed addressing on
+	TARGET_VFP.  Also, consider TARGET_INTERWORK only on pre-v5
+	architectures.
+	(arm_output_mi_thunk): Use a stub for dynamic references.
+	Also, use a -8 offset when calculating the address of a
+	PIC reference to a non-local function.
+	(optimization_options): New function.
+	* config/arm/arm.h (TARGET_INTERWORK): Define.
+	(OPTIMIZATION_OPTIONS): Define.
+	* config/arm/arm-protos.h (optimization_options): New
+	prototype.
+	* config/arm/arm.opt (mthumb-interwork): Set interwork_option
+	instead of a target mask.
+	* config/arm/arm.md (UNSPEC_JMP_XCHG): New UNSPEC.
+	(thumb_extendqisi2_v6): Check for which_alternative == 1.
+	(builtin_setjmp_receiver): Remove.
+	(builtin_setjmp_setup): New define_expand.
+	(builtin_longjmp): New define_expand.
+	(indirect_jump_exchange): New define_expand.
+	(arm_indirect_jump_exchange): New define_insn.
+	(thumb_indirect_jump_exchange): New define_insn.
+
+2007-11-04  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 5543378
+	* config/i386/i386.c (ix86_expand_builtin): Improved the previous
+	patch.
+
+2007-10-30  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 5543378
+	* config/i386/i386.c (ix86_expand_builtin): Allow non-immediate
+	shift count, load a memory operand to a register and convert to
+	TI mode if necessary.
+
+2007-10-26  Josh Conner  <jconner at apple.com>
+
+	Radar 5562046
+	* defaults.h (LEGITIMATE_INDIRECT_OPERAND_P): Define...
+	* reload.c (find_reloads): ...use.
+	* reload1.c (reload): Likewise.
+	* recog.c (general_operand): Likewise.
+	(immediate_operand): Likewise.
+	(nonmemory_operand): Likewise.
+	(asm_operand_ok): Likewise.
+	* regclass.c (record_reg_classes): Likewise.
+	* gcc.c (main): Add sysroot prefix to startfile_prefixes.
+	* jump.c (rtx_renumbered_equal_p): Don't allow LABEL_REFs to
+	undefined labels to match.
+	* c-common.c (iasm_process_arg): Define default constraints for
+	ARM.
+	(cw_cpsr, cw_cpsr_c): New variables.
+	(iasm_lookup_label): Recognize cpsr and cpsr_c as operands.
+	* config.gcc: Add arm*-*-darwin* target.
+	* config/i386/darwin.h (DARWIN_DSYMUTIL_SPEC): New definition.
+	* config/rs6000/darwin.h (DARWIN_DSYMUTIL_SPEC): New definition.
+	* config/darwin-protos.h (machopic_lookup_stub_or_non_lazy_ptr):
+	New function.
+	(machopic_data_defined_p): Make extern.
+	* config/darwin.c (machopic_data_defined_p): Make extern.
+	(struct machopic_indirection): Add 'emitted' field.
+	(indirection_uses_changed): New variable.
+	(machopic_indirection_name): Set 'emitted' field.
+	(machopic_lookup_stub_or_non_lazy_ptr): New function.
+	(machopic_validate_stub_or_non_lazy_ptr): Set
+	indirection_uses_changed.  Use 'emitted' field.
+	(machopic_output_indirection): Set 'emitted' field.
+	(machopic_finish): Use 'indirection_uses_changed' to determine
+	whether to invoke htabl_traverse_noresize again.
+	(machopic_select_section): Fix a signedness mismatch.
+	* config/darwin-sections.def (machopic_symbol_stub4_section):
+	New section defintion.
+	(machopic_picsymbol_stub4_section): New section definition.
+	* config/darwin.h (LINK_COMMAND_SPEC): Use DARWIN_DSYMUTIL_SEPC.
+	(DARWIN_EXTRA_SPECS): Add darwin_dsymutil.
+	(SUBTARGET_ASM_DECLARE_FUNCTION_NAME): New definition...
+	(ASM_DECLARE_FUNCTION_NAME): ...use it.
+	* config/arm/t-darwin: New file.
+	* config/arm/ieee754-df.S (*): Convert macro definitions to
+	gcc preprocessor and cctools assembler style macros.  Don't
+	use local labels > 9.
+	* config/arm/ieee754-sf.S (*): Likewise.
+	* config/arm/lib1funcs.asm (*): Likewise.
+	* config/arm/arm.c: Add libcpp/internal.h include.
+	(arm_darwin_file_start): New function.
+	(arm_darwin_file_end): New function.
+	(symbol_mentioned_with_filter): New function.
+	(arm_cannot_force_const_mem): New function.
+	(arm_binds_local_p): New function.
+	(TARGET_ASM_FILE_START): New definition.
+	(TARGET_ASM_FILE_END): New definition.
+	(TARGET_ASM_ALIGNED_SI_OP): New definition.
+	(TARGET_CANNOT_FORCE_CONST_MEM): Redefine.
+	(TARGET_BINDS_LOCAL_P): New definition.
+	(arm_override_options): Don't warn for conflicting -mcpu and
+	-march switch on darwin.  Don't set arm_pic_register on darwin.
+	Invoke SUBTARGET_OVERRIDE_OPTIONS and
+	SUBSUBTARGET_OVERRIDE_OPTIONS.
+	(arm_attribute_table): Include SUBTARGET_ATTRIBUTE_TABLE.
+	(arm_encode_call_attribute): Add MACHO handling.
+	(current_file_function_operand): Use SYMBOL_SHORT_CALL_ATTR_P on
+	darwin.
+	(arm_is_longcall_p): Use SYMBOL_LONG_CALL_ATTR_P on darwin.
+	(legitimize_pic_address): Add TARGET_MACHO support.
+	(arm_load_pic_register): Disable for darwin.  Pass label rtx
+	when calling gen_pic_load_addr_arm, gen_pic_add_dot_plus_eight,
+	gen_pic_load_addr_thumb, and gen_pic_add_dot_plus_four.
+	(arm_cannot_force_const_mem): New function.
+	(symbol_mentioned_p): Call symbol_mentioned_with_filter.
+	(symbol_mentioned_with_filter): New function.
+	(arm_cannot_copy_insn_p): Match MACHO UNSPEC_PIC_BASE.
+	(arm_output_function_epilogue): For darwin, insert a nop after
+	a trailing label.
+	(arm_print_operand): Use a LOCAL_LABEL_PREFIX, if one is
+	defined.
+	(arm_assemble_integer): Assume aligned_p on darwin.  Use
+	DOT_WORD instead of ".word".
+	(arm_elf_asm_constructor): Only define if OBJECT_FORMAT_ELF.
+	(arm_init_builtins): Include SUBTARGET_INIT_BUILTINS.
+	(arm_darwin_file_start): New function.
+	(arm_darwin_file_end): New function.
+	(arm_encode_section_info): For TARGET_MACHO, call
+	darwin_encode_section_info, and use SYMBOL_LONG_CALL and
+	SYMBOL_SHORT_CALL.
+	(arm_cxx_class_data_always_comdat): Return false for darwin.
+	(arm_binds_local_p): New function.
+	(reset_optimization_options): New function.
+	(machopic_output_stub): New function.
+	(iasm_memory_clobber): New function.
+	* config/arm/arm.h (TARGET_MACHO, DOT_WORD, SYMBOL_SHORT_CALL,
+	SYMBOL_LONG_CALL, SYMBOL_SHORT_CALL_ATTR_P,
+	SYMBOL_LONG_CALL_ATTR_P, LEGITIMATE_DYNAMIC_NO_PIC_OPERAND_P,
+	LEGITIMATE_INDIRECT_OPERAND_P): Define.
+	(ENCODED_SHORT_CALL_ATTR_P, ENCODED_LONG_CALL_ATTR_P): Remove.
+	(THUMB_TRAMPOLINE_TEMPLATE): Use DOT_WORD instead of ".word".
+	(ARM_NAME_ENCODING_LENGTHS): Remove handling of
+	SHORT_CALL_FLAG_CHAR and LONG_CALL_FLAG_CHAR.
+	(ARM_DECLARE_FUNCTION_SIZE): Use SYMBOL_SHORT_CALL instead of
+	SHORT_CALL_FLAG_CHAR.
+	(ARM_DECLARE_FUNCTION_NAME): Add symbol name to .thumb_func.
+	(PRINT_OPERAND_PUNCT_VALID_P): Allow '.'.
+	* config/arm/darwin.opt: New file.
+	* config/arm/arm-protos.h (non_local_symbol_mentioned_p): New
+	prototype.
+	* config/arm/darwin.h: New file.
+	* config/arm/arm.opt (mlong-branch): New option, alias for
+	-mlong-calls).
+	* config/arm/predicates.md (arm_branch_target): New predicate.
+	* config/arm/arm.md (movsi): Use LEGITIMATE_INDIRECT_OPERAND_P.
+	(pic_load_addr_arm): Include label reference as param.  Allow
+	to match for dynamic-no-pic on darwin.
+	(pic_load_addr_thumb): Likewise.
+	(pic_add_dot_plus_four): Likewise.
+	(pic_add_dot_plus_eight): Likewise.
+	(cbranchsi4_insn, cbranchsi4_scratch, movsi_cbranchsi4,
+	negated_cbranchsi4, tbit_cbranch, tlobits_cbranch,
+	tstsi3_cbranch, andsi3_cbranch, orrsi3_cbranch_scratch,
+	orrsi3_cbranch, xorsi3_cbranch_scratch, xorsi3_cbranch,
+	bicsi3_cbranch_scratch, bicsi3_cbranch, cbranchne_decr1,
+	addsi3_cbranch, addsi3_cbranch_scratch, subsi3_cbranch,
+	subsi3_cbranch_scratch): Don't use relative local labels.
+	(call): Calculate stub name on darwin, if building dynamic.
+	(call_value): Likewise.
+	(sibcall): Likewise.
+	(sibcall_value): Likewise.
+	(call_symbol): Require an arm_branch_target destination.
+	(call_value_symbol): Likewise.
+	(call_insn): Likewise.  On darwin, use stub if one was
+	generated.
+	(call_value_insn): Likewise.
+	* config/arm/darwin-libgcc.10.4.ver: New file.
+	* config/arm/darwin-libgcc.10.5.ver: New file.
+
+2007-10-26  Josh Conner  <jconner at apple.com>
+
+	Radar 3399553
+	* config/i386/i386.c (ix86_expand_flt_rounds): Fix comment.
+
+2007-10-25  Josh Conner  <jconner at apple.com>
+
+	Radar 3399553
+	* ginclude/float.h (FLT_ROUNDS): Define to __builtin_flt_rounds.
+	* builtins.c (expand_builtin_flt_rounds): New function...
+	(expand_builtin): ...call it.
+	* builtins.def (BUILT_IN_FLT_ROUNDS): Define.
+	* config/i386/i386.md (UNSPEC_FLT_ROUNDS): New UNSPEC.
+	(flt_rounds): New define_expand.
+	* config/i386/i386-protos.h (ix86_expand_flt_rounds): New proto.
+	* config/i386/i386.c (ix86_expand_flt_rounds): New function.
+	* config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTER): Bump to 115.
+	(LAST_PHYSICAL_REGISTER): New definition...
+	(DWARF_FRAME_REGISTERS): ...use it here...
+	(DWARF_REG_TO_UNWIND_COLUMN): ...and here.
+	(FIXED_REGISTERS): Add value for FPSCR_REGNO.
+	(CALL_USED_REGISTERS): Likewise.
+	(CALL_REALLY_USED_REGISTERS): Likewise.
+	(FPSCR_REGNO): Define.
+	(REG_ALLOC_ORDER): Add FPSCR_REGNO.
+	(enum reg_class): Add FPSCR_REGNO to ALL_REGS class.
+	(REGISTER_NAME): Add FPSCR name.
+	* config/rs6000/rs6000.md (UNSPEC_MFFS) New UNSPEC.
+	(UNSPEC_FLT_ROUNDS): Likewise.
+	(mffs): New define_insn.
+	(flt_rounds): New define_expand.
+	* config/rs6000/rs6000-protos.h (rs6000_expand_flt_rounds): New
+	proto.
+	* config/rs6000/darwin.h (REGISTER_NAMES): Add fpscr.
+	* config/rs6000/rs6000.c (rs6000_reg_names): Add fpscr.
+	(alt_reg_names): Likewise.
+	(rs6000_expand_flt_rounds): New function.
+
+2007-10-23  Eric Christopher  <echristo at apple.com>
+
+	Radar 5547244
+	* config/i386/i386.c (override_options): For darwin 64-bit kernel
+	compilations turn off the red zone.
+
+2007-10-23  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 3996036
+	* config/darwin.c (darwin_init_cfstring_builtins) : Do not emit
+	a warning message for __builtin_CFString when -Wpadded is specified.
+
+2007-10-15  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 5416357
+	* tree-sra.c (decide_block_copy) : Removed MERGE FIXME.
+
+2007-10-15  Caroline Tice   <ctice at apple.com>
+
+       Radar 5359827
+       * dwarf2out.c (modified_type_die):  If the die is a pointer type, and
+       it has a name, add it to the list of potential types for the pubtypes
+       table.
+
+2007-10-08  Eric Christopher  <echristo at apple.com>
+
+	Radar 5516808
+	* config/rs6000/rs6000.c (altivec_pim_info): Fix comment.
+	(altivec_ovl_resolve): Split out conditionals.
+	(altivec_convert_args): Check for too many arguments to builtin.
+	(rs6000_fold_builtin): Update comment, remove merge fixme.
+	Fix type for fcode. Make sure that our second argument has
+	a proper type as well.
+
+2007-10-05  Eric Christopher  <echristo at apple.com>
+
+	Radar 5518348
+	* common.opt: Remove -fpascal-strings option.
+
+2007-10-01  Jon Ziegler <jonz at apple.com>
+
+	Radar 5490688
+	* doc/invoke.texi: remove reference to gcc_select
+
+2007-09-28  Eric Christopher  <echristo at apple.com>
+
+	Radar 5490617
+	* varasm.c (assemble_variable): Use the classified section, not
+	DECL_COMMON for zerofill.
+
+2007-09-24  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 5447227
+	* config/rs6000/rs6000.c (altivec_expand_predicate_builtin) :
+	Fixed APPLE LOCAL marker.
+
+2007-09-22  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 5447227
+	* config/rs6000/rs6000.c (altivec_expand_abs_builtin,
+	altivec_expand_predicate_builtin, altivec_expand_lv_builtin,
+	altivec_expand_stv_builtin) : Fixed compile time warnings.
+
+2007-09-21  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 5447227
+	* config/rs6000/rs6000.c (altivec_expand_abs_builtin,
+	altivec_expand_predicate_builtin, altivec_expand_lv_builtin,
+	altivec_expand_stv_builtin, altivec_expand_ld_builtin,
+	altivec_expand_st_builtin, altivec_expand_dst_builtin)
+	: Issue error messages for functions with too few arguments.
+
+2007-09-21  Hui-May Chang <hm.chang at apple.com>
+
+	Radar 4994150
+	* rs6000.c (rs6000_legitimate_offset_address_p): Return
+	false for AltiVec vector modes.
+
+2007-09-13  Stuart Hastings  <stuart at apple.com>
+
+	Radar 5437393
+	* gcse.c (gcse_main, cprop_insn): Remove APPLE LOCAL.
+
+2007-09-04  Hui-May Chang  <hm.chang at apple.com>
+	Radar 5155743
+	* target.h (have_dynamic_stack_space): New.
+        * target-def.h (TARGET_HAVE_DYNAMIC_STACK_SPACE) : New.
+        * explow.c (allocate_dynamic_stack_space) : Reserve space
+          for outgoing args and registers saved area if
+          DYNAMIC_STACK_OFFSET is defined.
+        * rs6000.c (TARGET_HAVE_DYNAMIC_STACK_SPACE): New.
+
+2007-08-23  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4869885
+	Backport from mainline:
+	2006-10-31  Geoffrey Keating  <geoffk at apple.com>
+	PR 23067
+	* c-decl.c (start_struct): Don't create self-containing
+	structures.
+	* config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
+	New.
+	* config/rs6000/rs6000-protos.h
+	(darwin_rs6000_special_round_type_align): New.
+	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Rewrite.
+	(ROUND_TYPE_ALIGN): Use darwin_rs6000_special_round_type_align.
+
+	* stor-layout.c (ADJUST_FIELD_ALIGN): Only passed two arguments.
+
+2007-08-22  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 4947311
+	* c-common.h (objc_declare_protocols, objc_start_protocol): Decl changed.
+	* stub-objc.c (objc_declare_protocols, objc_start_protocol): Changed.
+	* c-parser.c (c_parser_external_declaration): Call to
+	c_parser_objc_protocol_definition takes additional argument.
+	(c_parser_declaration_or_fndef): Protocols with attributes are processed
+	here by passing it to c_parser_objc_protocol_definition.
+	(c_parser_objc_protocol_definition): Takes additional argument and passes
+	it to objc_declare_protocols or objc_start_protocol.
+
+2007-08-21  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4874197
+	* gcc/config/i386/i386.c (legitimate_constant_p): Accepted a sse
+	constant vector as a legitimate constant.
+
+2007-08-20  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4870336, 4874471, 4874208
+	* tree.c (build_vector) : Moved the declaration of max_index
+	inside the block it is used.
+
+2007-08-20  Hui-May Chang  <hm.chang at apple.com>
+
+        Radar 4708086
+        * passes.c (rest_of_compilation): Removed after confirming the
+	patch to radar 4548482 is no longer needed in gcc 4.2.
+
+2007-08-20  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5422751
+	* c-common.h (objc_protocol_implementation): decl removed.
+	* stub-objc.c (objc_protocol_implementation): stub removed.
+	* c-parser.c (c_parser_objc_class_definition): Misplaced syntax
+	recognition removed.
+
+2007-08-17  Hui-May Chang  <hm.chang at apple.com>
+
+        Radar 5134231
+        * gcc/config/rs6000/rs6000.c (rs6000_handle_option): Set
+        rs6000_alignment_flags to OPTION_MASK_ALIGN_MAC68K instead of
+        OPTION_ALIGN_MAC68K for -malign-mac68k option.
+
+2007-08-17  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4876451
+	Backport from mainline:
+	2007-04-24  Richard Henderson  <rth at redhat.com>
+	* libgcc2.h (AVOID_FP_TYPE_CONVERSION): Rename from
+	IS_IBM_EXTENDED.  Also define in terms of WIDEST_HARDWARE_FP_SIZE.
+	* libgcc2.c (__floatdisf): Avoid double-word arithmetic when
+	looking for non-zero bits shifted out.  Avoid a recursive call
+	when constructing the scalar.
+	(__floatundisf): Likewise.
+
+2007-08-14  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4870336, 4874471, 4874208
+	* tree.c (build_vector) : Assign zeroes to uninitialized
+	vector elements only for -mpim-alitivec option on ppc.
+
+2007-08-10  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5376125
+        * doc/invoke.texi (-Wdirect-ivar-access): New option
+        * c.opt (-Wdirect-ivar-access): New warning
+
+2007-08-10  Stuart Hastings  <stuart at apple.com>
+
+	Radar 5379188
+	* config/i386/i386.md (*darwin_cmpstrnqi_nz_1,
+          *darwin_cmpstrqi_1): Mark destination with earlyclobber.
+
+2007-08-10  Stuart Hastings  <stuart at apple.com>
+
+	Radar 4448096, 5238795
+	* gcc/doc/invoke.texi: Remove erroneous comment.
+
+2007-08-09  Hui-May Chang  <hm.chang at apple.com>
+
+	Radar 4875125
+	Undo the mainline patch who broke ABI compatibility.
+	2005-06-10  Uros Bizjak  <uros at kss-loka.si>
+	PR target/21981
+	* config/i386/i386.c (ix86_return_in_memory): Return 1 for MMX/3dNow
+	vectors.
+
+2007-08-08  Geoffrey Keating  <geoffk at apple.com>
+
+	Radar 5395148
+	* toplev.c (general_init): Don't install SIGHUP handler.
+	(interrupt_signal): Remove.
+
 2007-07-24  Stuart Hastings  <stuart at apple.com>
 
 	Radar 5346453
@@ -22,7 +551,7 @@
 
 	Radar 5285911
 	* tree.h (CALL_EXPR_OBJC_PROPERTY_GETTER): Macro removed.
-	* c-typeck.c (build_component_ref): Call 
+	* c-typeck.c (build_component_ref): Call
 	objc_build_property_reference_expr instead of objc_build_getter_call.
 	(build_modify_expr): Call objc_property_reference_expr instead of
 	objc_property_call.
@@ -30,7 +559,7 @@
 	(objc_build_property_reference_expr, objc_property_reference_expr): Decl.
 	added.
 	* stub-objc.c (objc_build_getter_call, objc_property_call): Stub removed.
-	(objc_build_property_reference_expr, objc_property_reference_expr): 
+	(objc_build_property_reference_expr, objc_property_reference_expr):
 	Stub added.
 
 2007-06-29  Stuart Hastings  <stuart at apple.com>
@@ -80,9 +609,9 @@
 2007-06-29  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 5276085
-        * c-parser.c (c_parser_binary_expression) : objc_generate_weak_read 
+        * c-parser.c (c_parser_binary_expression) : objc_generate_weak_read
 	replaced with call to objc_build_weak_reference_tree
-        * c-typeck.c (build_modify_expr, c_objc_common_truthvalue_conversion): 
+        * c-typeck.c (build_modify_expr, c_objc_common_truthvalue_conversion):
 	objc_remove_weak_read replaced with call to objc_weak_reference_expr.
         * c-common.h (objc_weak_reference_expr,
         objc_build_weak_reference_tree) : New decl.
@@ -230,7 +759,7 @@
 
 	Radar 5109764
 	* reload1.c (emit_output_reload_insns): Undo radar 5002270.
-	* config/i386/sse.md (sse2_stored) : Undo radar 4412214, 4172200. 
+	* config/i386/sse.md (sse2_stored) : Undo radar 4412214, 4172200.
 	Backport from mainline:
 	2007-04-23  H.J. Lu  <hongjiu.lu at intel.com>
 	* config/i386/sse.md (sse2_stored): Don't split to inter-unit
@@ -239,7 +768,7 @@
 	move if inter-unit move isn't allowed.
 	2007-02-09  Richard Henderson  <rth at redhat.com>
 	* config/i386/sse.md (sse2_stored): Split rm alternative, use Yi.
-	
+
 2007-06-06  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 5250860 (Remove old property)
@@ -278,21 +807,21 @@
 
 	Radar 5164498
 	Backport from mainline:
-	* config/i386/i386.c (ix86_function_regparm): Added checking of 
+	* config/i386/i386.c (ix86_function_regparm): Added checking of
 	ix86_force_align_arg_pointer to determine the number of
 	register parameters.
 
 2007-05-23 Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 5195402
-	* c-format.c (handle_format_arg_attribute): Check for NSString * 
+	* c-format.c (handle_format_arg_attribute): Check for NSString *
 	and CFStringRef as valid formatting types.
 	(check_format_string): Ditto.
 	* c-common.h (objc_check_format_nsstring,
 	objc_check_cfstringref_type): New decls.
 	* stub-objc.c (objc_check_nsstring_pointer_type): New stub.
 	* config/darwin-c.c (objc_check_cfstringref_type): New
-	(objc_check_format_cfstring): Call objc_check_cfstringref_type 
+	(objc_check_format_cfstring): Call objc_check_cfstringref_type
 	for valid CFStringRef argument type.
 	* config/darwin-protos.h (objc_check_cfstringref_type): New decl.
 	* config/darwin.h (CFSTRING_TYPE_CHECK): New macro.
@@ -316,7 +845,7 @@
 	* c-common.h (objc_anonymous_local_objc_name): New decl.
 	* config/darwin-protos.h (objc_anonymous_local_objc_name): Decl.
 	* stub-objc.c (objc_anonymous_local_objc_name): New stub.
-	* config/darwin.h (ASM_OUTPUT_LABELREF) Call 
+	* config/darwin.h (ASM_OUTPUT_LABELREF) Call
 	objc_anonymous_local_objc_name.
 
 2007-05-17  Fariborz Jahanian <fjahanian at apple.com>
@@ -333,10 +862,10 @@
 2007-05-09  Caroline Tice  <ctice at apple.com>
 
 	Radar 4964532
-	* defaults.h (TARGET_DWARF_UNINIT_VARS): New macro, to control 
+	* defaults.h (TARGET_DWARF_UNINIT_VARS): New macro, to control
 	tracking uninitialized variables.
-	* rtl.def (VAR_LOCATION): Add a new integer subfield to VAR_LOCATION 
-	note definitions, to allow recording of initialization status in the 
+	* rtl.def (VAR_LOCATION): Add a new integer subfield to VAR_LOCATION
+	note definitions, to allow recording of initialization status in the
 	notes.
 	* dwarf2out.c (dwarf_stack_op_name): Add case for DW_OP_APPLE_uninit.
 	(add_var_loc_to_decl): Add comparison of NOTE_VAR_LOCATION_STATUS to
@@ -345,8 +874,8 @@
 	are the same.
 	(reg_loc_descriptor): Add parameter for initialization status; pass it
 	to other loc descriptor functions.
-	(one_reg_loc_descriptor): Add parameter for initialization status; 
-	check its value and add DW_OP_APPLE_uninit to returned loc descr if 
+	(one_reg_loc_descriptor): Add parameter for initialization status;
+	check its value and add DW_OP_APPLE_uninit to returned loc descr if
 	appropriate.
 	(multiple_reg_loc_descriptor): Add parameter for initialization status;
 	pass its value to other loc descriptor functions; check its value and
@@ -354,28 +883,28 @@
  	(based_loc_descr): Likewise.
 	(mem_loc_descriptor): Likewise.
 	(concat_loc_descriptor): Likewise.
-	(loc_descriptor): Add parameter for initialization status; add 
-	appropriate initialization status to other loc descriptor function 
+	(loc_descriptor): Add parameter for initialization status; add
+	appropriate initialization status to other loc descriptor function
 	calls.
 	(loc_descriptor_from_tree_1): Add appropriate initialization status
 	to loc descriptor function calls.
-	(add_location_or_const_value_attribute): Get initialization status 
+	(add_location_or_const_value_attribute): Get initialization status
 	from note; add initialization status to loc descriptor function calls.
 	* dwarf2.h (enum dwarf_location_atom): New op, DW_OP_APPLE_uninit.
 	* print-rtl.c (print_rtx): When printing a VAR_LOCATION note, if status
 	is uninitialized, add "[uninint]" to output.
 	* rtl.h (NOTE_VAR_LOCATION_STATUS): New macro for accessing new field.
 	(enum var_init_status): New type, for var initialization status field.
-	* var-tracking.c (struct location_chain_def): Two new fields, init, 
+	* var-tracking.c (struct location_chain_def): Two new fields, init,
 	for initialization status, and set_src for the assignment value expr.
 	(unshare_variable): New parameter for initialization status; initialize
 	new init and set_src fields.
-	(var_reg_set): New parameters for initialization status and value; 
+	(var_reg_set): New parameters for initialization status and value;
 	pass them to set_variable_part.
 	(var_mem_set): Likewise.
 	(get_init_value): New function.
 	(var_reg_delete_and_set): New initialization status & value parameters;
-	add call to get_init_value if status is unknown; pass new parameters 
+	add call to get_init_value if status is unknown; pass new parameters
 	to clobber_variable_part and var_reg_set.
 	(var_mem_delete_and_set): Likewise.
 	(variable_union): Pass status to unshare_variable; initialize new init
@@ -384,13 +913,13 @@
 	used later to get the set_src value.
 	(find_src_status): New function.
 	(find_src_set_src): New function.
-	(compute_bb_dataflow): Pass status to calls to var_reg_set, 
+	(compute_bb_dataflow): Pass status to calls to var_reg_set,
 	var_mem_set, var_reg_delete_and_set and var_mem_delete_and_set; for
-	MO_SET, get set_src value and pass it to 
+	MO_SET, get set_src value and pass it to
 	var_reg_delete_and_set and var_mem_delete_and_set.
 	(dump_variable):  Print out "[uninit]" if appropriate.
-	(set_variable_part): Add new initialization and set_src parameters; 
-	pass status to unshare_variable; set node->init and node->set_src 
+	(set_variable_part): Add new initialization and set_src parameters;
+	pass status to unshare_variable; set node->init and node->set_src
 	fields and modify slot in hash table appropriately; save the init and
 	set_src values if appropriate and assign to the new node.
 	(clobber_variable_part): New set_src parameter; if two nodes have
@@ -406,16 +935,16 @@
 	var_mem_delete_and_set; call emit_notes_for_changes on NEXT_INSN(insn)
 	rather than on insn, to make up for change in add_stores.
 	(vt_add_function_parameters): Add status to calls to set_variable_part.
-	* config/i386/darwin.h (TARGET_DWARF_UNINIT_VARS): New macro 
+	* config/i386/darwin.h (TARGET_DWARF_UNINIT_VARS): New macro
 	definition to control tracking uninitialized variables.
-	* config/rs6000/darwin.h (TARGET_DWARF_UNINIT_VARS): New macro 
+	* config/rs6000/darwin.h (TARGET_DWARF_UNINIT_VARS): New macro
 	definition to control tracking uninitialized variables.
 
 2007-05-07  Fariborz Jahanian <fjahanian at apple.com>
 
 	Radar 3506309
 	* doc/invoke.texi: Document -Wnonportable-cfstrings
-	
+
 2007-05-07  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 4157812
@@ -6623,7 +7152,6 @@
 	* fold-const.c (fold_widened_comparison) Replace it with the
 	one from FSF mainline.
 	(fold_sign_changed_comparison): Ditto.
-	(fold): Remove APPLE LOCAL lno marker.
 
 2005-01-10  Ziemowit Laski  <zlaski at apple.com>
 

Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog.lno
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ChangeLog.lno?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ChangeLog.lno (original)
+++ llvm-gcc-4.2/trunk/gcc/ChangeLog.lno Thu Nov  8 20:30:15 2007
@@ -1,3390 +0,0 @@
-APPLE LOCAL file lno
-2004-07-18  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	Merge from mainline (lno-merge-20040718).
-
-2004-07-17  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (tree-cfg.o): Add CFGLAYOUT_H dependency.
-	* loop-init.c (loop_optimizer_init, loop_optimizer_finalize): Do not
-	free the dominators.
-	* passes.c (rest_of_handle_loop2): Free the dominators.
-	* sched-rgn.c (compute_trg_info): Initialize fields of variable el.
-	* tree-cfg.c: Include cfglayout.h.
-	(tree_duplicate_bb): Copy also phi nodes.
-	(struct ssa_name_map_entry): New type.
-	(collect_defs, add_phi_args_after_copy, ssa_name_map_entry_hash,
-	ssa_name_map_entry_eq, allocate_ssa_names,
-	rewrite_to_new_ssa_names_def, rewrite_to_new_ssa_names_use,
-	rewrite_to_new_ssa_names, tree_duplicate_sese_region): New functions.
-	* tree-flow.h (tree_duplicate_sese_region): Declare.
-	* tree-ssa-loop-ch.c (mark_defs_for_rewrite, duplicate_blocks): Removed.
-	(copy_loop_headers): Use tree_duplicate_sese_region.
-	* tree-ssa-loop-manip.c (copy_phi_nodes): Only copy the phi node
-	arguments.
-	* tree-ssa-pre.c (gate_pre): Disable the optimization.
-
-2004-07-14  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c (vect_is_simple_use): Additional argument.
-        (vect_is_supportable_op): Call vect_is_simple_use with extra argument.
-        (vect_is_supportbale_store): Likewise.
-        (vect_is_supportbale_assignment): Likewise.
-        (vect_mark_stmts_to_be_vectorized): Cleanup - use vect_is_simple_use.
-        (vect_get_vec_def_for_operand): Cleanup.
-
-        (vect_analyze_data_refs): Support certain forms of COMPONENT_REF as
-        array_base. Use force_gimple in handling of data-refs.
-        (vect_force_dr_alignment_p): Support certain forms of COMPONENT_REF.
-        (vect_align_data_ref): Likewise.
-        (vect_analyze_data_ref_dependence): Likewise.
-
-        (vect_analyze_operations): Remove duplicate calls to vect_debug_details.
-        (vect_analyze_scalar_cycles): Likewise.
-        (vect_analyze_data_ref_dependence): Likewise.
-        (vect_analyze_data_refs_alignment): Likewise.
-        (vect_analyze_pointer_ref_access): Likewise.
-        (vect_analyze_pointer_ref_access): Likewise.
-        (vect_analyze_data_refs): Likewise.
-        (vect_analyze_loop_form): Likewise.
-
-2004-07-13  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-data-ref.c: Fix some comments for inclusion in mainline.
-	(tree_fold_gcd): Moved...
-	* tree.c (tree_fold_gcd): ...here.
-	* tree.h (tree_fold_gcd): Declared here.
-
-2004-07-13  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-niter.c (mark_maybe_infinite_loops): Handle abnormal
-	edges.
-
-2004-07-13  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (tree-ssa-loop.o, tree-ssa-dce.o): Add function.h
-	dependency.
-	* builtins.c (expand_builtin): Handle BUILT_IN_MAYBE_INFINITE_LOOP.
-	* builtins.def (BUILT_IN_MAYBE_INFINITE_LOOP): New builtin.
-	* function.h (struct function): Add marked_maybe_inf_loops field.
-	* timevar.def (TV_MARK_MILOOPS): New timevar.
-	* tree-flow.h (mark_maybe_infinite_loops): Declare.
-	* tree-optimize.c (init_tree_optimization_passes): Add
-	pass_mark_maybe_inf_loops.
-	* tree-pass.h (pass_mark_maybe_inf_loops): Declare.
-	* tree-ssa-dce.c: Include function.h.
-	(find_obviously_necessary_stmts): Mark back edges only if they were
-	not marked already.
-	(perform_tree_ssa_dce): Do not call mark_dfs_back_edges here.
-	* tree-ssa-loop-niter.c (unmark_surely_finite_loop,
-	mark_maybe_infinite_loops): New functions.
-	* tree-ssa-loop.c: Include function.h.
-	(tree_mark_maybe_inf_loops, gate_tree_mark_maybe_inf_loops,
-	pass_mark_maybe_inf_loops): New pass.
-	* tree-ssa-operands.c (function_ignores_memory_p): Add
-	BUILT_IN_MAYBE_INFINITE_LOOP.
-
-2004-07-12  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* Makefile.in (tree-scalar-evolution.o): Remove dependences on 
-	tree-vectorizer.h and tree-data-ref.h. 
-	(tree-data-ref.o): Add dependence on lambda.h.
-	* lambda-trans.c, lambda.h: Add missing copyright notice.
-	* tree-scalar-evolution.c: Don't include tree-data-ref.h and 
-	tree-vectorizer.h.  Fix some comments.
-	* tree-scalar-evolution.h (simple_iv): Modified to match the
-	declaration that is in mainline.
-
-2004-07-11  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c: Update documentation. Use '#ifdef
-        ENABLE_CHECKING' to guard checks that are expected to have been
-        verified during analysis. Use vect_debug_details/vect_debug_stats
-        for dumping information.
-
-        * tree-vectorizer.h (struct _stmt_vec_info): New field "memtag".
-        (STMT_VINFO_MEMTAG): Access macro for new field "memtag".
-        * tree-vectorizer.c (vect_create_data_ref): Get tag from new field.
-        (vect_analyze_data_refs): Record the tag in the new memtag field.
-
-        (vect_align_data_ref): Remove unused argument.
-        (vect_analyze_data_refs): Call vect_align_data_ref with one argument.
-        (vect_get_array_first_index): Additional argument to return the
-        index rather than as the return value of the function.
-        (create_index_for_array_ref): Call vect_get_array_first_index with
-        an extra argument.
-        (vect_create_data_ref): Remove unused argument.
-        (vect_debug_stats, vect_debug_details): Argument "string" removed.
-
-        (vect_analyze_pointer_ref_access): New function.
-        (vect_analyze_data_refs): Call vect_analyze_pointer_ref_access.
-
-        (vect_finish_stmt_generation): New function.
-        (vect_transform_assignment, vect_transform_op, vect_transform_store):
-        (vect_transform_load): Call vect_finish_stmt_generation.
-
-        (get_vectype_for_scalar_type): No need to iterate through the
-        different modes - build_vector_type already does that.
-
-        (vect_transform_loop_bound): Check which edge is actually the 'then'.
-
-        (vect_analyze_operations): Temporarily disable vectorization of loops
-        with unknown loop bound.
- 
-2004-07-10  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (determine_biv_step): Use simple_iv.
-
-2004-07-09  Devang Patel  <dpatel at apple.com>
-
-	* Makefile.in (tree-ssa-loop-manip.o): Add tree-scalar-evolution.h
-	dependency.
-	* tree-scalar-evolution.c (scev_rest): Check scalar_evolution_info
-	and current_loops.
-	* tree-ssa-loop-manip.c (tree-scalar-evolution.h): Include.
-	(tree_duplicate_loop_to_header_edge): scev_reset () in the end.
-
-2004-07-09  Steven Bosscher  <stevenb at suse.de>,
-	    Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-pre.c: Merge changes from mainline.
-
-2004-07-09  Steven Bosscher  <stevenb at suse.de>
-
-	* varray.h (varray_data_enum): Remove VARRAY_DATA_DG.
-
-2004-07-08  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* varray.c (element): Don't include dependence_node_def.
-
-2004-07-08  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* Makefile.in (OBJS-common): Remove tree-dg.o.
-	(tree-dg.o): Removed.
-	(GTFILES): Remove tree-dg.h.
-	* gengtype.c (open_base_files): Remove tree-dg.h.
-	* tree-data-ref.c (subscript_dependence_tester): Don't define.
-	(dump_data_dependence_relation): Print data references only
-	when they are not NULL.
-	(analyze_array_top): Removed.
-	(initialize_data_dependence_relation): Is extern now.
-	When the data references are NULL the relation is not known.
-	(compute_affine_dependence): Is extern now.
-	(find_data_references_in_loop): Returns chrec_dont_know when
-	failing to analyze a difficult case.  
-	(compute_data_dependences_for_loop): Terminate earlier when 
-	find_data_references_in_loop fails.
-	* tree-data-ref.h (data_dependence_relation): Update comments.
-	(initialize_data_dependence_relation, compute_affine_dependence): 
-	Declared extern.
-	* tree-dg.c, tree-dg.h: Removed.
-	* tree-flow-inline.h (dg_node_for_stmt): Removed.
-	* tree-flow.h: Don't include tree-dg.h.
-	(stmt_ann_d): Remove dependence_node field.
-	* tree-ssa-loop.c: Include tree-data-ref.h.
-	(tree_vectorize, tree_linear_transform): Don't construct the dg_graph.
-	* tree-vectorizer.c: Remove some declarations of static functions.
-	(vect_analyze_data_ref_dependence): Extra parameter for the vectorized 
-	loop.  Don't rely on the information provided by the data
-	reference structure.  Compute directly the relation between
-	the data references instead of querying this information in
-	the dg_graph.
-	(vect_analyze_data_ref_dependences): Pass to
-	vect_analyze_data_ref_dependence the information about the
-	vectorized loop.
-	* varray.h (varray_data_tag): Remove dependence_node_def.
-
-2004-07-07  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (cand_value_at): Handle types correctly.
-	(may_eliminate_iv): Verify there is no overflow.
-
-2004-07-07  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (find_bivs, find_givs_in_stmt_scev):
-	Ensure that step of the iv satisfies cst_and_fits_in_hwi.
-	(determine_use_iv_cost_outer): Preserve the fact that the cost
-	is infinity.
-	* tree-ssa-loop-prefetch.c (WRITE_CAN_USE_READ_PREFETCH,
-	READ_CAN_USE_WRITE_PREFETCH, HAVE_FORWARD_PREFETCH,
-	HAVE_BACKWARD_PREFETCH, ACCEPTABLE_MISS_RATE): New macros.
-	(struct mem_ref_group): Type of step changed to HOST_WIDE_INT.
-	(struct mem_ref): Type of delta changed to HOST_WIDE_INT.
-	(dump_mem_ref, find_or_create_group, record_ref,
-	struct ar_data, idx_analyze_ref, analyze_ref,
-	gather_memory_references_ref, issue_prefetch_ref): Updated to reflect
-	this.
-	(ddown): New function.
-	(prune_ref_by_self_reuse, prune_ref_by_group_reuse):
-	Implement.
-	(prune_ref_by_reuse): Use WRITE_CAN_USE_READ_PREFETCH and
-	READ_CAN_USE_WRITE_PREFETCH.
-	(prune_group_by_reuse): Add dumps.
-	(issue_prefetch_ref): Assert that PREFETCH_BLOCK is a power of 2.
-	* tree.c (cst_and_fits_in_hwi): Update comment and fix semantics.
-	(int_cst_value, build_int_cst): Check that we use them only for
-	types representable in HOST_WIDE_INT.
-
-2004-07-07  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
-	Remove bogus check for chrec_contains_undetermined.
-
-2004-07-06  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* basic-block.h (edge_source, edge_destination): Removed.
-	* cfgloop.c (superloop_at_depth): Fix comment.
-	* cfgloop.h (loop_from_num, outer_loop, inner_loop, next_loop, 
-	loop_num, loop_depth, loop_header, loop_nb_iterations, 
-	loop_num_exits, loop_exit_edges, loop_exit_edge): Removed.
-	* lambda-code.c, tree-cfg.c, tree-data-ref.c, tree-dg.c, 
-	tree-elim-check.c, tree-scalar-evolution.c, tree-ssa-dom.c, 
-	tree-ssa-loop-ivcanon.c, tree-vectorizer.c: Inline removed functions.
-	* tree-data-ref.c: Rewrite some comments.
-	* tree-flow-inline.h (loop_of_stmt): Renamed loop_containing_stmt.
-
-2004-07-04  Dorit Naishlos <dorit at il.ibm.com>
-
-	* tree-vectorizer.c (vect_create_data_ref, vect_init_vector): 
-	Use insert_on_edge to add code in loop preheader.
-	(vect_transform_loop): Make sure there's a preheader BB.
-
-2004-06-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-prefetch.c: New file.
-	* Makefile.in (tree-ssa-loop-prefetch.o): Add.
-	* timevar.def (TV_TREE_PREFETCH): New.
-	* tree-flow.h (tree_ssa_prefetch_arrays,
-	standard_iv_increment_position): Declare.
-	* tree-optimize.c (init_tree_optimization_passes): Add
-	pass_loop_prefetch.
-	* tree-pass.h (pass_loop_prefetch): Declare.
-	* tree-ssa-loop-ivcanon.c (estimate_loop_size): Force the size to be
-	nonzero.
-	* tree-ssa-loop-ivopts.c (cst_and_fits_in_hwi): Moved to tree.c.
-	(standard_iv_increment_position): New function.
-	(zero_p): Export.
-	* tree-ssa-loop-niter.c (zero_p): Remove duplicate function.
-	* tree-ssa-loop.c (tree_ssa_loop_prefetch,
-	gate_tree_ssa_loop_prefetch): New functions.
-	(pass_loop_prefetch): New pass structure.
-	* tree-ssa-operands.c (function_ignores_memory_p): New function.
-	(get_expr_operands): Use it.
-	* tree.c (cst_and_fits_in_hwi): Moved from tree-ssa-loop-ivopts.c.
-	* tree.h (zero_p, cst_and_fits_in_hwi): Declare.
-
-2004-06-28  Daniel Berlin  <dberlin at dberlin.org>
-
-	* lambda-code.c (print_linear_expression): Rename a few variables,
-	simplify some code.
-	(print_lambda_loop): Ditto.
-	(lambda_compute_auxillary_space): Update a comment.
-	(gcc_loop_to_lambda_loop): Update code for chrec_dont_know change.
-	(struct dir_dist_pair): New.
-	(reverse_dep): Ditto.
-	(lambda_dep_mult_constant): New function.	
-	(lambda_dep_add): Ditto.
-	(lambda_vec_distdirvec_mult): Ditto.
-	(lambda_vec_distdirmat_mult): Ditto.
-	(lambda_deps_positive): Ditto.
-	(lambda_transform_legal_p): Ditto.
-	* lambda-mat.c (lambda_matrix_mult): Cleanup
-	(lambda_matrix_delete_rows): Ditto.
-	(lambda_matrix_row_add): Ditto.
-	(lambda_matrix_col_exchange): Ditto.
-	(lambda_trans_matrix_is_nonsingular): Rename to standard gcc predicate
-	naming.
-	(lambda_trans_matrix_is_fullrank): Ditto.
-	(lambda_trans_matrix_base): Rename to reflect actual computation.
-	* lambda.h (lambda_transform_legal_p): Add prototype.
-	* tree-loop-linear.c (linear_transform_loops): Rewrite a bit, use legality
-	tester to test transforms.
-
-2004-06-28  Daniel Berlin  <dberlin at dberlin.org>
-
-	* tree-data-ref.c (build_classic_dist_vector): Add argument, stop 
-	making out-of-bounds array accesses when analyzing less than
-	all the loops.  Add checks to verify.
-	(build_classic_dir_vector): Ditto.
-	(compute_data_dependences_for_loop): Pass in starting loop number
-	to build_classic_*.
-
-2004-06-27  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree.def (INTERVAL_CHREC): Removed.
-	(SCEV_KNOWN, SCEV_NOT_KNOWN): New nodes.
-	* tree-pretty-print.c (dump_generic_node): Handle SCEV_KNOWN and 
-	SCEV_NOT_KNOWN nodes.
-	* tree-chrec.h (build_polynomial_chrec): When one of the
-	operands is chrec_dont_know, return directly chrec_dont_know.
-	* tree-scalar-evolution.c (instantiate_parameters_1): Same.
-	(initialize_scalar_evolutions_analyzer): Build chrec_dont_know using a  
-	SCEV_NOT_KNOWN node, and chrec_known with a SCEV_KNOWN node.
-	
-2004-06-24  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-chrec.c (chrec_fold_automatically_generated_operands, 
-	chrec_merge): 
-	Use chrec_dont_know instead of a call to chrec_contains_undetermined.
-	(tree_fold_factorial, tree_fold_binomial, chrec_evaluate): Resurrect.
-	(chrec_apply): Reinsert the cases that were removed.
-	(chrec_convert): Remove the check for NULL_TREE inserted two days ago.
-	* tree-scalar-evolution.c (follow_ssa_edge_in_rhs): As a sequel of 
-	removing the tree_fold_* functions, the analyzed trees can contain 
-	NON_LVALUE_EXPR nodes.  Use STRIP_TYPE_NOPS for avoiding these nodes.
-	(number_of_iterations_in_loop): Add the missing open parenthesis in 
-	the debugging dumps.
-	(initialize_scalar_evolutions_analyzer): Use an INTERVAL_CHREC for 
-	constructing the chrec_dont_know node.  This fixes some strange 
-	problems that arise when chrec_dont_know is an INTEGER_CST. 
-	* tree.def (INTERVAL_CHREC): Resurrect.
-
-2004-06-23  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-chrec.c (chrec_merge): Handle case when one of the arguments
-	was not analyzed yet correctly.
-
-2004-06-23  Sebastian Pop  <pop at cri.ensmp.fr>
-	
-	* tree-chrec.c (chrec_fold_automatically_generated_operands): Now
-	static.  Clean comments.
-	(hide_evolution_in_loop, chrec_merge_types): Removed.  
-	* tree-chrec.h (hide_evolution_in_loop,
-	chrec_fold_automatically_generated_operands): Remove declarations.
-	* tree-scalar-evolution.c: Remove an old part of the comment at the 
-	beginning of the file.
-	(compute_overall_effect_of_inner_loop, 
-	compute_overall_effect_of_inner_loop, add_to_evolution_1,
-	analyze_scalar_evolution_1, analyze_scalar_evolution): Test for 
-	chrec_dont_know instead of calling chrec_contains_undetermined.
-	
-2004-06-22  Dorit Naishlos <dorit at il.ibm.com>
-
-	* tree-vectorizer.c (vect_create_data_ref): Fix setting of mem_tag.
-	(vect_analyze_data_refs): Make sure we have a mem_tag.
-
-2004-06-22  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-fold-const.c, tree-fold-const.h: Removed.
-	* Makefile.in (SCEV_H, tree-chrec.o): Remove tree-fold-const.h.
-	(OBJS-common): Remove tree-fold-const.o.
-	(tree-fold-const.o): Removed.
-	* gengtype.c (open_base_files): Remove tree-fold-const.h.
-	* lambda-code.c, tree-chrec.c, tree-data-ref.c, tree-dg.c, 
-	tree-elim-check.c, tree-loop-linear.c, tree-pretty-print.c, 
-	tree-scalar-evolution.c, tree-ssa-loop-ivcanon.c, 
-	tree-ssa-loop-ivopts.c, tree-ssa-loop-niter.c, tree-vectorizer.c: 
-	Don't include tree-fold-const.h.
-	* tree-chrec.c, tree-data-ref.c: Replace uses of tree_fold_* with 
-	fold (build (*, ...))
-	* tree-data-ref.c (tree_fold_gcd, tree_fold_divides_p,
-	tree_fold_bezout): Saved from deletion here.
-	
-2004-06-22  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-chrec.c, tree-chrec.h, tree-data-ref.c, tree-dg.c, 
-	tree-elim-check.c, tree-scalar-evolution.c, tree-ssa-loop-niter.c, 
-	tree-vectorizer.c: Replace chrec_top with chrec_dont_know, 
-	and chrec_bot with chrec_known.  Replace the checks of chrec_top 
-	with calls to chrec_contains_undetermined.
-	* tree.def (INTERVAL_CHREC): Removed.  
-	* cfgloop.h (loop): Update comments around nb_iterations field.  
-	* lambda-code.c (gcc_loop_to_lambda_loop): Always check for 
-	undetermined chrec after calling number_of_iterations_in_loop.
-	* tree-chrec.c (chrec_fold_multiply_ival_cst, 
-	chrec_fold_multiply_ival_ival, 
-	chrec_merge_types, chrec_contains_intervals, chrec_evaluate, 
-	chrec_merge_intervals): Removed.
-	(chrec_fold_plus_1, chrec_fold_plus, chrec_fold_minus, 
-	chrec_fold_multiply, chrec_merge, 
-	evolution_function_is_affine_multivariat, chrec_convert): 
-	Remove uses of INTERVAL_CHREC nodes.
-	(chrec_apply): Classify as unknown all the non-affine cases.
-	* tree-fold-const.h (tree_fold_binomial): Removed.
-	* tree-chrec.h (CHREC_LOW, CHREC_UP, 
-	chrec_contains_intervals, build_interval_chrec, 
-	build_chrec_top_type, evolution_function_is_multivariate, 
-	chrec_should_remain_symbolic): Removed.
-	(tree_is_chrec, chrec_zerop, evolution_function_is_affine_p): 
-	Remove uses of INTERVAL_CHREC nodes.
-	* tree-data-ref.c (analyze_ziv_subscript, 
-	analyze_overlapping_iterations): Same.
-	* tree-pretty-print.c (dump_generic_node): Same.
-	* tree-scalar-evolution.c (chrec_is_positive, 
-	instantiate_parameters_1, gather_chrec_stats, 
-	initialize_scalar_evolutions_analyzer): Same.
-	(analyze_scalar_evolution_in_loop): Make it static.
-	(resolve_mixers): Fix comments.
-	(chrec_stats, reset_chrecs_counters, dump_chrecs_stats):
-	Remove nb_interval_chrec counter.
-	(chrec_is_positive, simple_iv): Always check for undetermined after 
-	a call to number_of_iterations_in_loop or analyze_scalar_evolution.
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables, 
-	canonicalize_loop_induction_variables): Same.
-	* tree-ssa-loop-ivopts.c (determine_biv_step): Same.
-	* tree-ssa-loop-niter.c (find_loop_niter_by_eval): Same.
-	(estimate_numbers_of_iterations_loop): Remove redundant call to 
-	number_of_iterations_in_loop.
-	* tree-scalar-evolution.h (analyze_scalar_evolution_in_loop): 
-	Remove declaration, the function is now static.
-	* tree-vectorizer.c (vect_analyze_loop_with_symbolic_num_of_iters):
-	Don't test for INTERVAL_CHREC nodes.
-
-2004-06-22  Devang Patel  <dpatel at apple.com>
-		
-        PR 16105	
-        * tree-vectorizer.c (vect_analyze_operations): Type of MODIFY_EXPR is
-        not reliable. Use LHS's type.
-
-2004-06-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	PR rtl-optimization/16001
-	* loop-iv.c (iv_number_of_iterations): Prevent copy propagation in
-	niter_expr.
-
-2004-06-21  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree.def (PEELED_CHREC): Removed.
-	* tree-chrec.c (is_not_constant_evolution, chrec_fold_plus_1, 
-	chrec_fold_multiply, chrec_replace_initial_condition, chrec_convert):
-	Don't handle PEELED_CHREC nodes.
-	(chrec_fold_plus_peel_cst, chrec_fold_plus_poly_peel, 
-	chrec_fold_plus_peel_poly, chrec_fold_plus_peel_peel, 
-	chrec_fold_multiply_peel_cst, chrec_fold_multiply_poly_peel, 
-	chrec_fold_multiply_peel_peel, simplify_peeled_chrec): Removed.
-	* tree-chrec.h (tree_is_chrec): Don't handle PEELED_CHREC nodes.
-	(build_peeled_chrec, evolution_function_is_peeled_affine_p): Removed.
-	* tree-pretty-print.c (dump_generic_node): Don't handle
-	PEELED_CHREC nodes.
-	* tree-scalar-evolution.c (analyze_evolution_in_loop,
-	instantiate_parameters_1): Same.
-	(chrec_stats, reset_chrecs_counters, dump_chrecs_stats, 
-	gather_chrec_stats): Don't count the number of PEELED_CHREC nodes.
-
-2004-06-18  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* Makefile.in (OBJS-common): Remove tree-elim-check.o.
-	* tree-scalar-evolution.c (first_iteration_non_satisfying_noev_noev, 
-	first_iteration_non_satisfying_noev_ev, 
-	first_iteration_non_satisfying_ev_noev, 
-	first_iteration_non_satisfying_ev_ev, 
-	first_iteration_non_satisfying_1, 
-	first_iteration_non_satisfying): Removed.
-	(number_of_iterations_in_loop): Clean up.
-	* tree-scalar-evolution.h (first_iteration_non_satisfying): Removed.
-	* tree-ssa-loop-ivopts.c (zero_p): Compare tree pointer
-	against NULL_TREE.
-	* tree-ssa-loop.c (tree_ssa_loop_test): Return when loops
-	structure is not available.
-	(tree_elim_checks): Disabled for the moment.  Don't call
-	eliminate_redundant_checks.
-
-2004-06-17  Andrew MacLeod  <amacleod at redhat.com>
-
-	* tree-cfg.c (tree_make_forwarder_block):  Use SET_PHI_RESULT.
-	* tree-flow-inline.h (get_use_op_ptr):  Return a use_operand_p.
-	(get_use_from_ptr, get_def_from_ptr):  New.  Return operand pointers.
-	(get_def_op_ptr):  Return a def_operand_p instead of a 'tree *'.
-	(get_v_may_def_result_ptr):  Return a def_operand_p.
-	(get_v_may_def_op_ptr, get_vuse_op_ptr):   Return a use_operand_p.
-	(get_v_must_def_op_ptr):  Return a def_operand_p.
-	(get_phi_result_ptr):  New.  Return a pointer to the result of a PHI.
-	(get_phi_arg_def_ptr):  New.  Return a pointer to an argument of a PHI.
-	(phi_element_for_edge):  Remove.
-	* tree-flow.h (propagate_value, replace_exp):  Change prototype.
-	(propagate_tree_value):  Add new prototype.
-	(phi_element_for_edge):  Remove prototype.
-	* tree-into-ssa.c (mark_def_sites):  Use new operand types.
-	(prepare_operand_for_rename):  Split into two functions.
-	(prepare_use_operand_for_rename):  Prepare use operands.
-	(prepare_def_operand_for_rename):  Prepare def operands.
-	(rewrite_stmt):  Use new operand types.
-	(rewrite_operand):  Use new operand types, change parameter type.
-	* tree-outof-ssa.c (replace_variable):  Split into two functions.
-	(replace_use_variable):  Rewrite uses.
-	(replace_def_variable):  Rewrite defs.
-	(rewrite_trees, rewrite_vars_out_of_ssa):  Use new operand types.
-	* tree-phinodes.c (make_phi_node, resize_phi_node):  Use new types.
-	(add_phi_arg, remove_phi_arg_num):  Use new operand types.
-	* tree-ssa-ccp.c (substitute_and_fold):  Use new operand types.
-	(ccp_fold, replace_uses_in):  Use new operand types.
-	* tree-ssa-copy.c (replace_ssa_names):  Rename to replace_ssa_names_ann
-	and no longer set the value, change parameter type.
-	(replace_exp_1):  Use new operand types.
-	(propagate_value):  Change parameter type, use new operand types.
-	(propagate_tree_value):  Propagate_value without SSA operands.
-	(replace_exp, cprop_operand, cprop_into_stmt):  Use new operand types.
-	(cprop_into_successor_phis):  Use new operand types.
-	* tree-ssa-dom.c (thread_across_edge):  Use new operand types.
-	(eliminate_redundant_computations):  Use new operand types.
-	* tree-ssa-dse.c (fix_phi_uses):  Use new operand_types.
-	(fix_stmt_v_may_defs):  Use new operand_types.
-	* tree-ssa-live.c (create_ssa_var_map):  Use new operand_types.
-	(build_tree_conflict_graph):  Use new operand_types.
-	* tree-ssa-loop.c (duplicate_blocks):  Use PHI_ARG_DEF_FROM_EDGE.
-	* tree-ssa-operands.c (struct freelist_d):  Remove.
-	(check_optype_freelist, add_optype_freelist):  Remove.
-	(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
-	allocate_vuse_optype, allocate_v_must_def_optype):  Call ggc_alloc.
-	(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
-	Call ggc_free instead of add_optype_freelist.
-	(init_ssa_operands, fini_ssa_operands):  Remove free list code.
-	(finalize_ssa_defs, finalize_ssa_uses):  Set new use/def operands.
-	* tree-ssa-operands.h (struct def_optype_d):  Change underlying type.
-	(struct use_optype_d):  Change underlying type.
-	(def_operand_p, use_operand_p):  New types for pointers to operands.
-	(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP, 
-	V_MUST_DEF_OP):  Use new pointer type instead of dereferencing directly.
-	(USE_FROM_PTR, DEF_FROM_PTR):  New macros to "dereference" operand 
-	pointer types.
-	(SET_USE, SET_DEF):  New macros to set operands from their pointer.
-	(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
-	SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
-	(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT):  Macros to manage the
-	PHI result as an operand.
-	(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
-	PHI_ARG_DEF_PTR_FROM_EDGE):  Macros to manage the PHI arguments.
-	* tree-ssa-pre.c (eliminate):  Call propagate_tree_value.
-	* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis):  Use
-	PHI_ARG_DEF_FROM_EDGE.
-	* tree.h (PHI_RESULT):  Renamed to PHI_RESULT_TREE.
-	(PHI_ARG_DEF):  Renamed to PHI_ARG_DEF_TREE.
-
-	* tree-ssa-loop-ivopts.c (find_bivs, mark_bivs,
-	find_interesting_uses_outer_or_nonlin, find_interesting_uses_stmt,
-	find_interesting_uses_outside, add_old_iv_candidates,
-	remove_statement, rewrite_use_nonlinear_expr, split_loop_exit_edge,
-	protect_loop_closed_ssa_form_use, compute_phi_arg_on_exit,
-	rewrite_use_outer): Use new operand types.
-
-2004-06-16  Dale Johannesen  <dalej at apple.com>
-
-	* Makefile.in (GTFILES): Add tree-chrec.h.
-	* tree-chrec.h (chrec_top, chrec_bot): Add GTY.
-	* tree-scalar-evolution.c (initialize_scalar_evolutions_analyzer):
-	Set chrec_top, chrec_bot once per compilation.
-	* gengtype.c (ifiles):  Add tree-fold-const.h, tree-chrec.h.
-
-2004-06-16  Dale Johannesen  <dalej at apple.com>
-	* tree-flow.h (tree_ann_common-d.aux): Document required behavior.
-	* tree-ssa-loop-manip.c (allocate_new_names): Don't propagate
-	new_names into copies.
-
-2004-06-16  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	PR tree-optimization/15993
-	* tree-ssa-dom.c (thread_across_edge): Do not thread edge if its
-	destination is unchanged.
-
-2004-06-14  Dorit Naishlos <dorit at il.ibm.com>
-
-	* tree-vectorizer.c (vect_analyze_data_refs): Minor fix.
-
-2004-06-14  Andrew Pinski  <apinski at apple.com>
-
-	* tree-ssa-return.c: Remove.
-	* Makefile.in (OBJS-common): Remove tree-ssa-return.o
-	(tree-ssa-return.o): Remove.
-	* timevar.def (TV_TREE_RETURN): Remove.
-	* tree-optimize.c (init_tree_optimization_passes):
-	Do not run pass_return.
-	* tree-pass.h (pass_return): Remove declaration.
-
-2004-06-14  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-data-ref.c (init_data_ref): New function.
-        * tree-data-ref.h (init_data_ref): New function.
-        * tree-vectorizer.c (vect_get_array_first_index): Return index instead
-        of success status, and support pointers.
-        (vect_create_index_for_array_ref): Remove ARRAY_REF restriction, and
-        change call to vect_get_array_first_index.
-        (vect_create_data_ref): Handle INDIRECT_REFs.
-        (vect_is_supportable_store): Handle INDIRECT_REFs.
-        (vect_is_supportable_load): Handle INDIRECT_REFs.
-        (vect_analyze_data_ref_dependence): Handle INDIRECT_REFs.
-        (vect_analyze_data_ref_dependences): Remove usage of variable 'ok'.
-        (get_array_base): Removed (not used anymore).
-        (vect_force_dr_alignment_p): Use DR_BASE_NAME instead of
-        get_array_base.
-        (vect_align_data_ref): Likewise.
-        (vect_transform_store): Remove ARRAY_REF restriction.
-        (vect_transform_load): Remove ARRAY_REF restriction.
-        (vect_compute_data_ref_alignment): Support pointers.
-        (vect_analyze_data_refs): Support pointers.
-
-        (vect_debug_stats): New Function.
-        (vect_debug_details): New Function.
-        (vect_transform_loop): Use vect_debug_stats and vec_debug_details.
-        (vect_analyze_loop): Use vect_debug_details.
-        (vect_analyze_scalar_cycles): Use vect_debug_stats.
-        (vect_analyze_data_ref_dependence): Likewse.
-        (vect_analyze_data_refs_alignment): Likewise.
-        (vect_analyze_data_ref_accesses): Likewise.
-        (vect_analyze_data_refs): Likewise.
-        (vect_analyze_loop_form): Likewise.
-
-        (vect_gen_if_guard): Formatting fixes (avoid 80 column overflow).
-        (vect_update_initial_conditions_of_duplicatd_loop): Likewise.
-        (vect_transform_loop): Likewise.
-        (vect_analyze_loop_form): Likewise.
-
-2004-06-13  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	Merge from mainline (lno-merge-20040612).
-
-2004-06-13  Dorit Naishlos <dorit at il.ibm.com>
-
-	* tree-chrec.c (evolution_function_is_affine_multivariat): Add check
-	for POLYNOMIAL_CHREC.
-	* tree-dg.c (ddg_direction_between_stmts): Add check for chrec_top.
-
-	* tree-pass.h (TODO_write_loop_closed): New to-do flag.
-	* tree-optimize.c (execute_todo): Handle new to-do flag 
-	TODO_write_loop_closed.
-	* tree-ssa-loop.c (struct tree_opt_pass pass_vectorize): Set
-	TODO_write_loop_closed.
-
-	* tree-vectorizer.c (vect_transform_loop): Add calls to 
-	add_bb_to_loop.
-	(vect_analyze_data_ref_dependence): Fix last argument in call to 
-	ddg_direction_between_stmts.
-
-2004-06-11  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	PR target/15944
-	* loop-invariant.c (may_assign_reg_p): Use can_copy_p.
-
-2004-06-11  Olga Golovanevsky  <olga at il.ibm.com>
-            Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c (vect_generate_tmps_on_preheader):
-        (vect_gen_if_guard): New functions.
-        (vect_update_initial_conditions_of_duplicated_loop):
-        Update also phis of bb at the exit of epilog loop.
-        (vect_transform_loop): Remove code that now belongs to
-        vect_generate_tmps_on_preheader () function. Use
-        vect_gen_if_guard function twice.
-
-2004-06-10  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ch.c: New file.
-	* Makefile.in (tree-ssa-loop-ch.o): Add.
-	(tree-ssa-loop.o): Add SCEV_H and tree-vectorizer.h dependency.
-	* cfgloop.h (current_loops): Declare.
-	* common.opt (fivcanon, fivopts, floop-test, ftree-lim): Add.
-	(ftree-loop-optimize, fscalar-evolutions, fall-data-deps,
-	ftree-ddg): Remove.
-	* flags.h (flag_scalar_evolutions, flag_all_data_deps,
-	flag_tree_loop, flag_ddg): Removed.
-	(flag_tree_lim, flag_ivcanon, flag_ivopts,
-	flag_tree_ssa_loop_test): New.
-	(f_options): Remove scalar-evolutions, all-data-deps,
-	tree-ddg, tree-loop-optimize.
-	* toplev.c (flag_scalar_evolutions, flag_all_data_deps,
-	flag_tree_loop, flag_ddg): Removed.
-	(flag_tree_lim, flag_ivcanon, flag_ivopts,
-	flag_tree_ssa_loop_test): New.
-	* opts.c (decode_options, common_handle_option): Initialize new
-	options.
-	* timevar.def (TV_SCALAR_EVOLUTIONS, TV_ALL_DATA_DEPS): Removed.
-	(TV_TREE_ELIM_CHECKS, TV_DEP_GRAPH, TV_LIM, TV_COMPLETE_UNROLL,
-	TV_UNSWITCH): Added.
-	* tree-flow.h (test_unrolling_and_peeling, test_loop_versioning):
-	Removed.
-	(tree_unroll_loops_completely): Declare.
-	* tree-optimize.c (init_tree_optimization_passes): Reorganize loop
-	optimizer passes.
-	* tree-pass.h (pass_scev, pass_scev_init, pass_scev_anal,
-	pass_scev_depend, pass_scev_linear_transform, pass_scev_iv_canon,
-	pass_scev_elim_checks, pass_scev_vectorize, pass_scev_done, pass_ddg,
-	pass_delete_ddg): Removed.
-	(pass_loop_init, pass_loop_test, pass_lim, pass_unswitch,
-	pass_iv_canon, pass_record_bounds, pass_elim_checks, pass_vectorize,
-	pass_complete_unroll, pass_linear_transform, pass_iv_optimize,
-	pass_loop_done): Declare.
-	* tree-scalar-evolution.c (current_loops): Moved to tree-ssa-loop.c.
-	(dd_info_available): Removed.
-	(scev_init, scev_depend, scev_elim_checks, scev_vectorize, scev_done,
-	gate_scev, gate_scev_analysis, gate_scev_depend, gate_scev_elim_checks,
-	gate_scev_vectorize): Removed.
-	(pass_scev, pass_scev_init, pass_scev_anal, pass_scev_depend,
-	pass_scev_vectorize, pass_scev_linear_transform,
-	pass_scev_iv_canon, pass_scev_elim_checks, pass_scev_done,
-	pass_ddg, pass_delete_ddg): Removed.
-	* tree-scalar-evolution.h (scev_analysis): Declare.
-	(scev_analysis): Export.
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
-	Add parameter to control whether find_loop_niter_by_eval is run.
-	(canonicalize_induction_variables): Do not unroll loops.
-	(tree_unroll_loops_completely): Split from
-	canonicalize_induction_variables.
-	* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init,
-	tree_ssa_iv_optimize_finalize, tree_ssa_iv_optimize,
-	tree_ssa_iv_optimize): Global initialization/finalization removed.
-	* tree-ssa-loop-manip.c (test_unrolling_and_peeling,
-	test_loop_versioning): Removed.
-	* tree-ssa-loop.c: Include tree-scalar-evolution.h and
-	tree-vectorizer.h.
-	(current_loops): Moved from tree-scalar-evolution.c.
-	(tree_ssa_loop_opt): Removed.
-	(gate_loop): Removed.
-	(pass_loop): Modified.
-	(should_duplicate_loop_header_p, mark_defs_for_rewrite,
-	duplicate_blocks, do_while_loop_p, copy_loop_headers,
-	gate_ch, pass_ch): Moved to tree-ssa-loop-ch.c.
-	(tree_ssa_loop_init, pass_loop_init, tree_ssa_loop_im,
-	gate_tree_ssa_loop_im, pass_lim, tree_ssa_loop_unswitch,
-	gate_tree_ssa_loop_unswitch, pass_unswitch, tree_ssa_loop_ivcanon,
-	gate_tree_ssa_loop_ivcanon, pass_iv_canon, tree_ssa_loop_bounds,
-	pass_record_bounds, tree_ssa_loop_test, pass_loop_test,
-	tree_elim_checks, gate_tree_elim_checks, pass_elim_checks,
-	tree_vectorize, gate_tree_vectorize, pass_vectorize,
-	tree_complete_unroll, gate_tree_complete_unroll, pass_complete_unroll,
-	tree_linear_transform, gate_tree_linear_transform,
-	pass_linear_transform, tree_ssa_loop_ivopts, gate_tree_ssa_loop_ivopts,
-	pass_iv_optimize, tree_ssa_loop_done, pass_loop_done): New.
-	* testsuite/gcc.dg/tree-ssa-chrec/*: Updated.
-
-2004-06-10  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree.def: Remove EXPONENTIAL_CHREC node.
-	* tree-chrec.c (is_not_constant_evolution, chrec_fold_plus_1,
-	chrec_fold_multiply, chrec_evaluate, chrec_apply,
-	chrec_replace_initial_condition, initial_condition,
-	hide_evolution_in_loop, hide_evolution_in_other_loops_than_loop,
-	evolution_part_in_loop_num, reset_evolution_in_loop,
-	reset_evolution_in_loop, chrec_merge, is_multivariate_chrec_rec,
-	is_multivariate_chrec, evolution_function_is_affine_multivariate_p,
-	evolution_function_is_univariate_p, chrec_convert): Don't
-	handle EXPONENTIAL_CHREC nodes.
-	(chrec_fold_plus_expo_cst, chrec_fold_plus_cst_expo,
-	chrec_fold_plus_poly_expo, chrec_fold_plus_expo_poly,
-	chrec_fold_plus_expo_expo, chrec_fold_multiply_poly_expo,
-	chrec_fold_multiply_expo_expo, is_pure_sum_chrec): Removed.
-	* tree-chrec.h (tree_is_chrec, evolution_function_is_affine_p):
-	Don't handle EXPONENTIAL_CHREC nodes.
-	(build_exponential_chrec): Removed.
-	(no_evolution_in_loop_p): Use a call to tree_is_chrec for
-	determining when a node represents a scalar evolution.
-	* tree-data-ref.c (siv_subscript_p): Don't handle
-	EXPONENTIAL_CHREC nodes.
-	* tree-pretty-print.c (dump_generic_node): Same.
-	* tree-scalar-evolution.c: Remove FIXME comments about
-	EXPONENTIAL_CHREC nodes.  Add a pointer to the slides
-	presented at the GCC Summit 2004 about the scalar evolutions.
-	(compute_overall_effect_of_inner_loop): Clarify the leading comment.
-	(chrec_is_positive, add_to_evolution_1, add_to_evolution,
-	instantiate_parameters_1): Don't handle EXPONENTIAL_CHREC nodes.
-	(multiply_evolution_1, multiply_evolution): Removed.
-	(first_iteration_non_satisfying_ev_ev): Handle only affine
-	functions.
-	(follow_ssa_edge_in_rhs): Cases that were detected as
-	EXPONENTIAL_CHREC nodes are now mapped to the unknown element
-	(be it top or bottom) called chrec_top.
-	(chrec_stats, reset_chrecs_counters, dump_chrecs_stats,
-	gather_chrec_stats): Don't count the EXPONENTIAL_CHREC nodes.
-	* tree-vectorizer.c (vect_is_simple_iv_evolution,
-	vect_analyze_loop_with_symbolic_num_of_iters): Use
-	tree_is_chrec for determining whether the given node has an
-	evolution.
-
-2004-06-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	PR middle-end/15876
-	* tree-ssa-loop-ivopts.c (force_var_cost): Initialize DECL_RTL
-	correctly.
-
-2004-06-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* passes.c (rest_of_handle_loop2): Run loop optimizations always.
-
-2004-06-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* ra-build.c (livethrough_conflicts_bb): Check also contains_call.
-
-2004-06-09  Olga Golovanevsky  <olga at il.ibm.com>
-            Dorit Naishlos <dorit at il.ibm.com>
-
-	* tree-vctorizer.c
-	(vect_update_initial_conditions_of_duplicated_loop):
-	Handle general form of "init" and "step" of access function.
-	* tree-ssa-loop-manip.c (tree_duplicate_loop_to_exit_cfg):
-	The exit from loop is taken from bb previous to latch instead
-	of latch itself.
-
-2004-06-08  Andrew Pinski  <pinskia at physics.uc.edu>
-
-	PR tree-opt/15881
-	* tree-scalar-evolution.c (count_ev_in_wider_type): Use
-	fold_convert instead of convert.
-	(compute_overall_effect_of_inner_loop): Likewise.
-	(chrec_is_positive): Likewise.
-	(add_to_evolution_1): Likewise.
-	(add_to_evolution): Likewise.
-	(first_iteration_non_satisfying_1): Likewise.
-	(follow_ssa_edge_in_rhs): Likewise.
-	(interpret_rhs_modify_expr): Likewise.
-	(number_of_iterations_in_loop): Likewise.
-
-2004-06-08  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	PR tree-optimization/15779
-	* tree-scalar-evolution.c (scev_initialize): Clean the nb_iterations
-	field.
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): Do
-	not clean nb_iterations field.
-
-2004-06-07  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* version.c (version_string): Update "merged" stamp.
-
-2004-05-30  Daniel Berlin  <dberlin at dberlin.org>
-
-	* tree-loop-linear.c (linear_transform_loops): We don't handle sibling
-	loops, or loops with multiple exits, yet.
-	* lambda-code.c (invariant_in_loop): Check outer loops too for
-	right now.
-	(lle_to_gcc_expression): Special case the coefficient == 1 cases.
-	(lambda_loopnest_to_gcc_loopnest): Use correct test.
-
-2004-05-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-	    Jeff Law  <law at redhat.com>
-
-	* tree-into-ssa.c (prepare_operand_for_rename): New argument is_use.
-	If the operand is for a use, then strip away the SSA_NAME, do not
-	strip away the SSA_NAME for a set.  Never call release_ssa_name.
-	(mark_def_sites): Appropriately pass additional argument to
-	prepare_operand_for_rename.  If a VDEF_RESULT is not an SSA_NAME,
-	then set the VDEF_RESULT to the VDEF_OP.
-	(set_def_block): Strip away any SSA_NAME to get to the real
-	underlying variable.
-	(ssa_mark_def_sites): Prevent set_def_block from doing so.
-
-	* tree-ssa-loop.c (mark_defs_for_rewrite): Record defined ssa names.
-	(duplicate_blocks): Use rewrite_ssa_into_ssa.
-	(pass_ch): Remove TODO_rename_vars.
-
-2004-05-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* opts.c (decode_options): Enable flag_scalar_evolutions by default.
-
-2004-05-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* fold-const.c (fold_widened_comparison,
-	fold_sign_changed_comparison): New.
-	(fold): Use them.
-	* tree-flow.h (struct tree_niter_desc): New field additional_info.
-	* tree-ssa-loop-niter.c (simplify_using_outer_evolutions): Do not
-	rewrite expressions in-place.
-	(tree_simplify_using_condition, simplify_using_initial_conditions):
-	New functions.
-	(number_of_iterations_exit): Use simplify_using_initial_conditions.
-	(struct nb_iter_bound): New field additional.
-	(record_estimate, estimate_numbers_of_iterations_loop): Initialize
-	field additional.
-	(upper_bound_in_type, lower_bound_in_type): Export.  Handle
-	unsigned->signed conversion correctly.
-	(can_count_iv_in_wider_type): Pass the additional info to
-	can_count_iv_in_wider_type_bound.
-	(can_count_iv_in_wider_type_bound): Use the additional info.
-	* tree.h (lower_bound_in_type, upper_bound_in_type): Declare.
-	* config/i386/i386.c (legitimate_constant_p): Do not allow
-	integer - symbol.
-
-2004-05-29  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* lambda-code.c: Spell check.
-	* lambda-trans.c: Same.
-	* tree-chrec.c: Same.
-	* tree-dg.c: Same.
-	* tree-loop-linear.c: Same.
-	* tree-ssa-loop-im.c: Same.
-	* tree-ssa-loop-ivcanon.c: Same.
-	* tree-ssa-loop-ivopts.c: Same.
-	* tree-ssa-loop-manip.c: Same.
-	* tree-ssa-loop.c: Same.
-	* tree-vectorizer.c: Same.
-
-2004-05-28  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-niter.c (number_of_iterations_cond): Record correct
-	assumptions.
-
-2004-05-28  Dale Johannesen  <dalej at apple.com>
-
-	* loop-invariant.c (check_maybe_invariant):  Disallow hoisting CALLs.
-
-2004-05-27  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	Merge from mainline (lno-merge-20040526).
-	* tree-scalar-evolution.c (draw_tree_cfg): Removed.
-	* tree-into-ssa.c: Didn't merged
-	http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01231.html
-
-2004-05-25  Sebastian Pop  <pop at cri.ensmp.fr>
-            Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-scalar-evolution.c (first_iteration_non_satisfying_1):
-        Include the evolution of the non varying chrec in other_evs.
-        (number_of_iterations_in_loop): Don't instantiate the chrecs
-        before the computation of loop counts.
-
-2004-05-25  Olga Golovanevsky  <olga at il.ibm.com>
-            Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c (vect_transform_loop_bound): Advance IVs
-        by correct amount.
-        (vect_transform_loop, vect_build_symbl_bound): Use shifts
-        instead of division/multiplication to advance IVs.
-
-2004-05-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (number_of_iterations_in_loop):
-	Do not produce COND_EXPRs.
-
-2004-05-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (resolve_mixers): New function.
-	(already_instantiated): Type changed to bitmap.
-	(scev_initialize, scev_finalize): Reflect the change.
-	(analyze_scalar_evolution_in_loop): Use resolve_mixers.
-	(instantiate_parameters_1): Add possibility to just resolve mixers.
-	Fold the results.
-	(number_of_iterations_in_loop): Use number_of_iterations_exit.
-	* tree-ssa-loop-niter.c (simplify_using_outer_evolutions): New
-	function.
-	(number_of_iterations_exit): Use it.
-
-2004-05-24  Dale Johannesen  <dalej at apple.com>
-	* loop-invariant.c (find_defs):  Add DF_EQUIV_NOTES.
-
-2004-05-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (tree-ssa-loop-manip.o): Add cfglayout.h dependency.
-	* tree-flow.h (collect_defs, rename_variables_in_bb, rename_op,
-	allocate_new_names, free_new_names): Declaration removed.
-	(tree_duplicate_loop_to_exit): Declare.
-	* tree-ssa-loop-manip.c: Include cfglayout.h.
-	(collect_defs, rename_variables_in_bb, rename_op,
-	allocate_new_names, free_new_names): Made static.
-	(tdlte_rename_variables_in_loop, tdlte_copy_phi_nodes,
-	tree_duplicate_loop_to_exit_cfg, tree_duplicate_loop_to_exit):
-	Moved from tree-vectorizer.c.
-	* tree-vectorizer.c (vect_duplicate_loopm vect_copy_phi_nodes,
-	vect_rename_variables_in_loop, vect_tree_duplicate_loop): Moved
-	to tree-ssa-loop-manip.c and renamed.
-
-2004-05-20  Olga Golovanevsky  <olga at il.ibm.com>
-            Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c (vect_transform_loop): New parameter;
-        if bound is unknown, duplicates loop before vectorizing.
-        (vect_transfrom_loop_bound): New parameter; now deal with
-        symbolic loop bound.
-        (vect_analyze_loop_with_symbolic_num_of_iters)
-        (vect_duplicate_loop, vect_copy_phi_nodes)
-        (vect_rename_variables_in_loop, vect_tree_split_edge)
-        (vect_update_initial_conditions_of_duplicated_loop):
-        (vect_tree_duplicate_loop, vect_build_symbl_bound): New functions.
-        (new_loop_vec_info): Initialize the new field loop_vec_info:
-        symb_numb_of_iters.
-        * tree-vectorizer.h (loop_vec_info: symb_numb_of_iters): Added.
-        (LOOP_VINFO_SYMB_NUM_OF_ITERS): Added.
-        * cfgloopmanip.c (duplicate_loop): Made non-static.
-        * tree-ssa-loop-manip.c (collect_defs): Made non-static.
-        (allocate_new_names): Made non-static. Added option to allocate
-        for original loop or not.
-        (rename_op): Made non-static. Added input check.
-        (rename_variables_in_bb): Made mpm-static.
-        original loop were also renamed.
-        (free_new_names): release_ssa_name only if defs of original
-        loop were also renamed.
-        * cfgloop.h (duplicate_loop): Declare.
-        * tree-flow.h (collect_defs, allocate_new_names, rename_op)
-        (rename_variables_in_bb, free_new_names): Declare.
-
-2004-05-20  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (first_iteration_non_satisfying_noev_ev,
-	first_iteration_non_satisfying_ev_noev,
-	first_iteration_non_satisfying_ev_ev): Check the assumptions returned
-	by number_of_iterations_cond.
-
-2004-05-13  Devang Patel  <dpatel at apple.com>
-
-	* cfgloop.c (get_loop_body_in_bfs_order): New.
-	(flow_loop_exit_edges_find): Set EDGE_LOOP_EXIT.
-	* cfgloop.h (get_loop_body_in_bfs_order): New.
-
-2004-05-13  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* expr.c (expand_expr_real_1): Use REF_ORIGINAL information
-	from INDIRECT_REFS.
-	* tree-flow.h (force_gimple_operand, rewrite_address_base): Declare.
-	* tree-ssa-loop-ivopts.c (force_gimple_operand): Expand.
-	(add_address_candidates): Add candidates with constant offset
-	stripped.
-	(idx_remove_ssa_names, unshare_and_remove_ssa_names,
-	rewrite_address_base): New.
-	(rewrite_use_address): Use rewrite_address_base.
-	* tree-into-ssa.c (register_new_def): Remove unused code.
-	* tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
-	Handle invariants correctly.
-	* tree-cfg.c (tree_split_block): Do not modify the statements.
-	* tree.h (REF_ORIGINAL): New macro.
-
-2004-05-12  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-chrec.c (chrec_evaluate): Use the type of the chrec
-	instead of integer_type_node when folding operations.
-	(chrec_apply): Factor chrec_type calls.
-	(chrec_eval_next_init_cond): Removed.
-	(chrec_convert): Don't propagate overflows introduced by convert.
-	* tree-chrec.h (chrec_eval_next_init_cond): Removed.
-	* tree-scalar-evolution.c (first_iteration_non_satisfying_noev_ev,
-	first_iteration_non_satisfying_ev_noev,
-	first_iteration_non_satisfying_ev_ev): Use number_of_iterations_cond
-	instead of computing the loop counts.
-
-2004-05-10  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-invariant.c (find_invariant_insn): Handle trapping insns
-	correctly.
-
-2004-05-10  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-chrec.h (build_chrec_top_type): Disabled, return chrec_top.
-	* tree-scalar-evolution.c (first_iteration_non_satisfying_noev_ev,
-	first_iteration_non_satisfying_ev_noev): Use the type of the chrec
-	instead of integer_type_node when folding operations.
-	(number_of_iterations_to_overflow): New.
-	(first_iteration_non_satisfying_ev_ev): Implement some cases.
-	(set_nb_iterations_in_loop): Return chrec_top on overflow.
-	(follow_ssa_edge_in_rhs): Handle type conversions "a = (type) rhs".
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
-	Convert the result of find_loop_niter_by_eval to the same type as niter
-	before comparing.
-
-2004-05-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-iv.c (determine_max_iter, shorten_into_mode,
-	iv_number_of_iterations): Handle constants correctly.
-	* rtl.h (get_mode_bounds): Declaration changed.  Duplicate declaration
-	removed.
-	* stor-layout.c (get_mode_bounds): Return a constant suitable for
-	a target mode.
-
-2004-05-06  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-chrec.h (build_chrec_top_type): Check that the type has
-	min and max values before taking their values.
-
-2004-05-06  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* tree-chrec.h (build_chrec_top_type): New.
-	* tree-chrec.c (chrec_fold_multiply_ival_cst,
-	chrec_fold_multiply_ival_ival, chrec_fold_plus_1): Use
-	build_chrec_top_type instead of returning chrec_top.
-
-	* tree-data-ref.c (dump_data_dependence_relation): Don't dump
-	direction per subscript.
-	(analyze_array): Use an extra boolean parameter for the access
-	mode: read or write.
-	(analyze_array_top, finalize_ddr_dependent): New.
-	(compute_direction_vector, set_all_subscripts_to): Removed.
-	(initialize_data_dependence_relation): The dependence relation
-	is unknown when one of the references base name is NULL_TREE.
-	(subscript_dependence_tester, build_classic_dist_vector,
-	build_classic_dir_vector, compute_affine_dependence):
-	Use finalize_ddr_dependent.
-	(build_classic_dir_vector): When one of the directions is
-	dir_star, the subscript coupling cannot deduce independence.
-	(compute_all_dependences): Renamed compute_rw_wr_ww_dependences.
-	(compute_rw_wr_ww_dependences): Don't compute read-read
-	relations.  Don't compute the reversed dependence relation.
-	(find_data_references_in_loop): Use analyze_array_top when the
-	MODIFY_EXPR contains a VUSE/VDEF that is not an ARRAY_REF.
-	* tree-data-ref.h (data_reference): Add a field is_read.
-	(DR_IS_READ): New.
-	(DDR_SUBSCRIPTS_VECTOR_FINALIZE): Removed.
-	(analyze_array): Change declaration.
-	* tree-vectorizer.c (vect_analyze_data_refs): Adapt the use of
-	analyze_array to the new prototype.  Pass in the read or write
-	mode.
-
-2004-04-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-niter.c: New file.
-	* Makefile.in (tree-ssa-loop-niter.o): New.
-	* cfgloop.h (struct loop): Add bounds field.
-	* df.c (df_reg_clobber_gen): Removed.
-	(df_bb_rd_local_compute, df_insn_refs_record, df_rd_local_compute):
-	Make more effective for hard regs.
-	* loop-invariant.c (check_maybe_invariant, find_defs,
-	find_invariant_insn): Handle hard regs.
-	* tree-chrec.c (chrec_fold_plus_poly_poly, chrec_fold_multiply,
-	chrec_fold_multiply, chrec_merge): Handle types correctly.
-	(chrec_convert): Use count_ev_in_wider_type.
-	* tree-chrec.h (count_ev_in_wider_type): Declare.
-	* tree-flow.h (struct tree_niter_desc): Moved from
-	tree-ssa-loop-ivopts.c.
-	(number_of_iterations_cond, number_of_iterations_exit,
-	loop_niter_by_eval, find_loop_niter_by_eval,
-	estimate_numbers_of_iterations, can_count_iv_in_wider_type,
-	free_numbers_of_iterations_estimates): Declare.
-	* tree-scalar-evolution.c (count_ev_in_wider_type, scev_reset,
-	simple_iv): New.
-	(number_of_iterations_in_loop): Check that the exit condition
-	is tested in every iteration.
-	* tree-scalar-evolution.h (scev_reset, simple_iv): Declare.
-	* tree-ssa-loop-ivcanon.c (MAX_ITERATIONS_TO_TRACK,
-	chain_of_csts_start, get_base_for, get_val_for,
-	loop_niter_by_eval, find_loop_niter_by_eval): Moved to
-	tree-ssa-loop-niter.c.
-	* tree-ssa-loop-ivopts.c (struct tree_niter_desc): Moved to
-	tree-flow.h.
-	(force_gimple_operand): Accept a variable for the target of
-	the assignment.
-	(create_iv, rewrite_use_nonlinear_expr,
-	rewrite_use_address, rewrite_use_compare,
-	rewrite_use_outer): Changed due to this.
-	(tree_ssa_iv_optimize_init): Call estimate_numbers_of_iterations.
-	(get_var_def): Removed.
-	(find_givs_in_stmt_scev): Use simple_iv.
-	(inverse, number_of_iterations_cond): Moved to tree-ssa-loop-niter.c.
-	(determine_number_of_iterations): Use number_of_iterations_exit.
-	(idx_find_step, find_interesting_uses_address): Use
-	can_count_iv_in_wider_type.
-	(force_var_cost): Determine the costs more precisely.
-	(tree_ssa_iv_optimize_finalize): Call
-	free_numbers_of_iterations_estimates.
-	(tree_ssa_iv_optimize_loop): Call scev_reset.
-	* varasm.c (force_const_mem): Set MEM_NOTRAP_P flag.
-	* config/rs6000/rs6000.c (rs6000_emit_move): Set MEM_NOTRAP_P flag.
-
-2004-04-27  Sebastian Pop  <pop at cri.ensmp.fr>
-
-	* lambda-code.c (build_int_cst): Moved...
-	* tree-data-ref.c (int_cst_value): Moved...
-	* tree-ssa-loop-ivopts.c (int_cst_value, build_int_cst): Moved...
-	* tree.c (int_cst_value, build_int_cst): ...here.
-	* tree.h (int_cst_value, build_int_cst): Declare.
-
-	* tree-chrec.h (is_chrec, symbolic_parameter_expr_p): Removed.
-
-	* tree-chrec.c (evolution_function_is_affine_multivariat): Check that
-	the left part is a polynomial before taking its variable.
-
-	* tree-elim-check.c (prove_truth_value): Update the use of
-	tree_is_* functions.
-	* tree-fold-const.h (tree_is_ge, tree_is_gt, tree_is_le, tree_is_lt,
-	tree_is_eq, tree_is_ne): Return true when decidable, and use a
-	parameter for returning the result.
-
-	* tree-scalar-evolution.c (types_forbid_solutions_p): Removed.
-	(first_iteration_non_satisfying_noev_noev,
-	first_iteration_non_satisfying_noev_ev,
-	first_iteration_non_satisfying_ev_noev): Update the use of
-	tree_is_* functions.  Use no_evolution_in_loop_p instead of
-	evolution_function_is_constant_p.  Extends the analyzer to
-	symbolic loop counts.
-	(first_iteration_non_satisfying): Factorize code.
-
-2004-04-26  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* config/rs6000/altivec.md: Fix merge problem.
-
-2004-04-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	Merge from tree-ssa branch (lno-merge-20040425).
-
-2004-04-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (force_gimple_operand): Strip useless type
-	conversions.
-	(number_of_iterations_cond): Fix typo.
-	(rewrite_use_address): Fix.
-
-2004-04-23  Daniel Berlin  <dberlin at dberlin.org>
-
-	* tree-loop-linear.c (linear_transform_loops): Add invariants array.
-	* lambda-code.c (gcc_tree_to_linear_expression): Change arguments
-	to include invariants array, and an int, instead of a bool.
-	Handle invariants.
-	(invariant_in_loop): New function.
-	(gcc_loop_to_lambda_loop): Add support for invariants as bounds,
-	and NE_EXPR tests.
-	(gcc_loopnest_to_lambda_loopnest): Add invariants argument,
-	init the invariants array, and pass it along to gcc_loop_to_lambda_loop.
-	(lle_to_gcc_expression): Handle invariants and simple linear offsets.
-	(lambda_loopnest_to_gcc_loopnest): Ditto.
-	Also use the right test if the step is negative.
-
-2004-04-23  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (instantiate_parameters_1): Handle changed
-	semantics of analyze_scalar_evolution.  Split off from ...
-	(instantiate_parameters): ... here.
-
-2004-04-23  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (analyze_scalar_evolution_1): Keep
-	loop invariants in symbolic form.  Use
-	compute_scalar_evolution_in_loop for expressions defined in subloops.
-	(chrec_contains_symbols_defined_in_loop): Check for non-strict
-	nestedness.
-	(compute_scalar_evolution_after_loop): Renamed back to
-	compute_overall_effect_of_inner_loop.
-	(follow_ssa_edge_inner_loop_phi, interpret_loop_phi):
-	Changed due to the renaming.
-	(get_scalar_evolution): Return chrec_not_analyzed_yet for complicated
-	expressions.
-	(compute_scalar_evolution_in_loop): Compute the evolution of the
-	expression returned by compute_overall_effect_of_inner_loop.
-
-2004-04-22  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-elim-check.c (prove_truth_value_gt, prove_truth_value_lt,
-	prove_truth_value_le, prove_truth_value_ge, prove_truth_value_eq,
-	prove_truth_value_ne): Resurrect.
-	(prove_truth_value_symbolic): New.  Disabled for the moment.
-	(prove_truth_value): Use it when this function fails on unknown.
-	(try_eliminate_check): Factorize the code.
-	* tree-scalar-evolution.c (compute_scalar_evolution_after_loop):
-	Fix the description comment.
-
-2004-04-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-flow.h (linear_transform_loops): Prototype changed.
-	* tree-vectorizer.h (vectorize_loops): Ditto.
-	* tree-loop-linear.c (linear_transform_loops): Remove unused
-	argument.
-	* tree-vectorizer.c (vectorize_loops): Ditto.
-	* tree-scalar-evolution.c (scalar_evolution_info): Type changed
-	to hash table.
-	(new_scev_info_str): Use xmalloc instead of ggc_alloc.
-	(hash_scev_info, eq_scev_info, del_scev_info,
-	gather_stats_on_scev_database_1): New functions.
-	(find_var_scev_info, dump_chrecs_stats, gather_stats_on_scev_database,
-	scev_initialize, scev_finalize): Work with hash table instead of a
-	list.
-	(scev_elim_checks, scev_vectorize): Do not pass unused arguments to
-	functions.
-
-
-2004-04-21  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-chrec.c (chrec_apply): Fail on chrec_top when the chrec
-	contains symbols defined in the inner loop.  Otherwise perform
-	the computation with symbols.
-	(no_evolution_in_loop_p): Same.  Moved from here...
-	* tree-chrec.h (no_evolution_in_loop_p): ...there.  Define it inline.
-	(chrec_contains_symbols_defined_in_loop): Declare.
-	* tree-scalar-evolution.c (nb_set_scev, nb_get_scev): New counters.
-	(set_scalar_evolution, get_scalar_evolution): Count the number of calls.
-	(chrec_contains_symbols_defined_in_loop): Defined.
-	(compute_scalar_evolution_after_loop, first_iteration_non_satisfying_1,
-	analyze_scalar_evolution_in_loop): Initialize boolean values.
-	(dump_chrecs_stats): Dump the get/set counters.
-
-2004-04-21  Sebastian Pop  <sebastian.pop at ensmp.fr>
-            Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (compute_scalar_evolution_in_loop):
-	Use superloop_at_depth.
-	(analyze_scalar_evolution): Keep a symbolic form instead of
-	chrec_top.
-
-2004-04-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (instantiate_parameters): Handle casts
-	correctly.
-	* tree-ssa-loop-manip.c (add_exit_phis_edge): Do not add unnecessary
-	phi nodes.
-	* tree-ssa-loop.c (tree_ssa_loop_opt): Do not call create_preheaders.
-
-2004-04-20  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-scalar-evolution.c (scev_info_str, new_scev_info_str,
-	find_var_scev_info, set_scalar_evolution, get_scalar_evolution):
-	Store a single scalar evolution per definition.
-	(compute_overall_effect_of_inner_loop): Renamed
-	compute_scalar_evolution_after_loop.
-	(compute_scalar_evolution_in_loop): New.
-	(analyze_scalar_evolution): Use the helper function.
-	(analyze_scalar_evolution_1): Helper recursive function.
-	Avoid multiple set/get in the scev database when recursively called.
-
-2004-04-20  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c (vect_create_index_for_array_ref): Use create_iv
-        instead of creating iv's from scratch.
-        (vect_transform_loop_bound): Likewise.
-
-2004-04-20  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-chrec.c (chrec_fold_multiply_ival_cst,
-	chrec_fold_multiply_ival_ival, chrec_fold_plus_1): When the fold
-	resulted in an overflow, conservatively answer chrec_top.
-
-2004-04-20  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-chrec.c (chrec_fold_multiply_ival_cst): Compute the min
-	and max on the multiplication result.
-	(chrec_fold_negate): Removed.
-	* tree-chrec.h (chrec_fold_negate): Removed.
-	* tree-scalar-evolution.c (interpret_rhs_modify_expr):
-	Use chrec_fold_minus instead of chrec_fold_negate.
-
-2004-04-20  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-chrec.h (evolution_function_is_constant_p): Be careful.
-	* tree-data-ref.c (analyze_siv_subscript_affine_affine): Renamed
-	analyze_subscript_affine_affine.  Exchange the CHREC_VARIABLEs for
-	overlaps.
-	(analyze_miv_subscript): Use directly analyze_subscript_affine_affine,
-	and avoid the call to evolution_function_is_constant_p.
-
-2004-04-20  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-chrec.c (chrec_apply): Fail on chrec_top for symbolic chrecs.
-	(no_evolution_in_loop_p): Return false when non decidable, use
-	a parameter for returning the result.
-	* tree-chrec.h (no_evolution_in_loop_p): Modify its declaration.
-	* tree-scalar-evolution.c (add_to_evolution, multiply_evolution):
-	Avoid the use of no_evolution_in_loop_p.
-	(add_to_evolution_1, multiply_evolution_1): New.
-	(multiply_by_expr_the_loop_evolution, add_expr_to_loop_evolution,
-	build_exponential_evolution_in_loop,
-	build_polynomial_evolution_in_loop): Removed.
-	(first_iteration_non_satisfying_1, analyze_scalar_evolution_in_loop):
-	Modify the use of no_evolution_in_loop_p.
-	* tree-ssa-loop-ivopts.c (find_givs_in_stmt_scev,
-	find_givs_in_stmt_scev): Check that the result of scev analysis
-	does not contain symbols.
-
-2004-04-19  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (idx_contains_abnormal_ssa_name_p,
-	contains_abnormal_ssa_name_p): New functions.
-	(find_bivs, find_bivs, find_givs_in_stmt_scev):
-	Handle ssa names occuring in abnormal phis.
-	* tree-ssa-loop-im.c (movement_possibility): Ditto.
-
-2004-04-18  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c (create_index_for_array_ref): Remove code under
-        #ifdef POINTER_ARITHMETIC.
-        (vect_create_data_ref): Likewise. Support array addressing
-        instead of pointer arithmetic in vectorized code.
-
-2004-04-16  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	Merge from tree-ssa branch:
-
-	2004-03-25  Diego Novillo  <dnovillo at redhat.com>
-		* tree-ssa-alias.c (struct alias_info): Change type of field
-		'num_references' to varray_type.  Update all users.
-
-2004-04-15  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-into-ssa.c (struct mark_def_sites_global_data): Change type of
-	names_to_rename to sbitmap.
-	(insert_phi_nodes_for, insert_phi_nodes_1, insert_phi_nodes):
-	Allocate worklist globally.
-	(ssa_mark_def_sites_initialize_block, ssa_mark_phi_uses,
-	ssa_mark_def_sites, ssa_rewrite_initialize_block,
-	ssa_rewrite_phi_arguments, ssa_rewrite_stmt, rewrite_ssa_into_ssa):
-	Use sbitmaps instead of bitmaps.
-
-2004-04-15  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-scalar-evolution.c (instantiate_parameters): Don't keep
-	symbols after instantiation.  Fully instantiate parameters,
-	or fail on chrec_top.
-
-2004-04-15  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-fold-const.h (chrec_merge_types): Move it...
-	* tree-chrec.c (multiply_int, divide_int, add_int, substract_int,
-	integer_divides_p, lcm, gcd, update_initial_condition_to_origin,
-	remove_initial_condition, ): Removed.
-	(evolution_function_in_loop_num): Renamed into
-	hide_evolution_in_other_loops_than_loop.
-	(hide_evolution_in_loop, hide_evolution_in_other_loops_than_loop): New.
-	(chrec_merge_types): ... here.
-	(chrec_merge): Answer chrec_top on EXPONENTIAL_CHREC.
-	(ziv_subscript_p, siv_subscript_p, analyze_ziv_subscript,
-	analyze_siv_subscript, analyze_siv_subscript_cst_affine,
-	analyze_siv_subscript_affine_cst, analyze_siv_subscript_affine_affine,
-	chrec_steps_divide_constant_p, analyze_miv_subscript,
-	analyze_overlapping_iterations): Moved from here...
-	* tree-chrec.h (evolution_function_in_loop_num): Rename declaration.
-	(hide_evolution_in_other_loops_than_loop, hide_evolution_in_loop): New.
-	(analyze_overlapping_iterations): No longer extern.
-
-	* tree-data-ref.c (ziv_subscript_p, siv_subscript_p,
-	analyze_ziv_subscript,
-	analyze_siv_subscript, analyze_siv_subscript_cst_affine,
-	analyze_siv_subscript_affine_cst, analyze_siv_subscript_affine_affine,
-	chrec_steps_divide_constant_p, analyze_miv_subscript,
-	analyze_overlapping_iterations): ... there.
-	(initialize_data_dependence_relation,
-	access_functions_are_affine_or_constant_p): Moved down.
-	(compute_all_dependences): Moved down.  Now is static.
-	(build_classic_dir_vector): New.
-	(build_classic_dist_vector):
-	(find_data_references): Renamed find_data_references_in_loop.
-	Now is static.
-	(compute_data_dependences_for_loop): New.
-	(analyze_all_data_dependences): Use compute_data_dependences_for_loop.
-	* tree-data-ref.h (dd_info_available): Don't declare it extern.
-
-	* tree-scalar-evolution.c (dd_info_available): Declare static.
-	(select_outer_and_current_evolutions): Removed.
-	(stats_*): Move the static variables in the chrec_stats structure.
-	(chrec_stats): New structure.
-	(first_iteration_non_satisfying_1): In the multivariate case,
-	don't forget that the outer loops can change the number of iterations.
-	(cannot_analyze_loop_nb_iterations_yet): Removed.
-	(follow_ssa_edge_inner_loop_phi): Refine the case where the
-	evolution of the inner loop is symbolic.
-	(number_of_iterations_in_loop): Factor the end of the cases.
-
-	* tree-dg.c (classic_dist, classic_dir): Declared static.
-	(dg_delete_graph): Delete the classic_dist and classic_dir.
-	(dg_create_graph): Adapt to use compute_data_dependences_for_loop.
-	(gate_ddg, gate_delete_ddg, pass_ddg, pass_delete_ddg): Moved in
-	tree-scalar-evolution.c.
-	* tree-dg.h (dg_create_graph): Pass in struct loops.
-
-2004-04-15  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-data-ref.h (struct data_reference): New field "aux".
-        * tree-vectorizer.h (aligned_access_p, unknown_alignment_for_access_p):
-        New functions.
-        (DR_MISLAIGNMENT): New macro, for accessing the new 'aux' field in
-        data_reference.
-        * tree-vectorizer.c: (vect_analyze_data_refs_alignment): New function.
-        (vect_compute_data_refs_alignment): New function.
-        (vect_compute_data_ref_alignment): New function.
-        (vect_enhance_data_refs_alignment): New function.
-        (vect_force_dr_alignment_p): New function.
-        (vect_align_data_ref): Use new functions aligned_access_p and
-        vect_force_dr_alignment_p.
-        (vect_analyze_data_ref_access): Alignment related checks moved to new
-        functions that deal with alignment.
-        (vect_analyze_data_refs): Likewise.
-        (vect_analyze_loop): Call vect_analyze_data_refs_alignment.
-
-2004-04-15  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-invariant.c (may_assign_reg_p): Prevent unused parameter
-	warning.
-	* tree-ssa-loop-manip.c (find_use_block, find_use_blocks,
-	defined_inside_loop_p): Removed.
-	(add_exit_phis_var, add_exit_phis, rewrite_into_loop_closed_ssa):
-	Make more efficient.
-	(find_uses_to_rename_use, find_uses_to_rename_stmt,
-	find_uses_to_rename): New functions.
-
-2004-04-15  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-flow.h (compute_global_livein): Declare.
-	* tree-into-ssa.c (struct def_blocks_d): New field
-	phi_blocks.
-	(compute_global_livein): Export.
-	(set_def_block): Record phi_blocks.
-	(get_def_blocks_for): Allocate phi_blocks.
-	(mark_def_sites): Changed due to set_def_block change.
-	(ssa_mark_def_sites_initialize_block, ssa_mark_def_sites):
-	Make virtual defs be kills.
-	(insert_phi_nodes_for): Handle old phi nodes more efficiently.
-	(def_blocks_free): XFREE the bitmaps.
-	* tree-ssa-loop-manip.c (add_exit_phis_use, add_exit_phis_stmt):
-	Removed.
-	(get_loops_exits): Return bitmap.
-	(add_exit_phis_var, find_use_block, find_use_blocks,
-	defined_inside_loop_p): New functions.
-	(add_exit_phis): Use add_exit_phis_var.
-	(rewrite_into_loop_closed_ssa): Reorganize.
-	* tree-ssa-loop.c (pass_loop): Add garbage collection.
-
-2004-04-14  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-chrec.c (chrec_convert): Handle extending correctly.
-	* tree-scalar-evolution.c (set_scev_keep_symbolic): Removed.
-	(set_scalar_evolution): Do not use it.
-	(get_scalar_evolution): Only handle ssa names and constants.
-	(interpret_loop_phi): When interpreting subloop, compute the
-	evolution in outer loop afterwards.
-	(analyze_scalar_evolution_in_loop): New.
-	* tree-scalar-evolution.h (analyze_scalar_evolution_in_loop): Declare.
-	* tree-ssa-loop-ivopts.c: Include tree-fold-const.h, tree-chrec.h
-	and tree-scalar-evolution.h.
-	(tree_ssa_iv_optimize_init): Call scev_initialize.
-	(determine_biv_step, find_bivs, mark_bivs,
-	find_givs_in_stmt): Use scev analyzer.
-	(find_givs_in_stmt_scev): New function.
-	(find_induction_variables): Remove TODO comment.
-	(force_var_cost): Test for TREE_INVARIANT, not for
-	is_gimple_min_invariant.
-	(find_optimal_iv_set): Update comment.
-	(tree_ssa_iv_optimize_finalize): Call scev_finalize.
-
-2004-04-13  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa.c (raise_value): Removed.
-	(get_eq_name, check_phi_redundancy): New.
-	(kill_redundant_phi_nodes): Use standard algorithm.
-
-2004-04-12  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-manip.c (allocate_new_names): Use duplicate_ssa_name.
-	Preserve SSA_NAME_OCCURS_IN_ABNORMAL_PHI flag.
-
-2004-04-10  Daniel Berlin  <dberlin at dberlin.org>
-
-	* lambda-code.c (lambda_loopnest_transform): Add comments.
-
-2004-04-09  David Edelsohn  <edelsohn at gnu.org>
-
-	Backport from mainline:
-        * config/rs6000/t-linux64 (bispecs): Don't add -mlong-double-128 for
-        32-bit builds when defaulting to 32-bit.
-
-2004-04-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-iv.c (iv_number_of_iterations): Sign extend the constant value
-	appropriately for the target mode.
-	* tree-fold-const.c (tree_fold_gcd): Make more efficient.
-	* tree-ssa-loop-manip.c (add_exit_phis_use): Do not add unnecessary
-	phis.
-	(rewrite_into_loop_closed_ssa): Fix comment.
-
-2004-04-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfgrtl.c (purge_dead_edges): Clean the EDGE_ABNORMAL_CALL flags.
-	* loop-iv.c (iv_number_of_iterations): Handle the case when we prove
-	that the loop does not roll.
-	* opts.c (decode_options): Enable -floop-optimize2 and
-	-ftree-loop-optimize by default.
-	* tree-cfg.c (factored_computed_goto_label,
-	factored_computed_goto): Removed.
-	(factor_computed_gotos): Do not record them.
-	(disband_implicit_edges): Do not unfactor computed jumps.
-	* tree-ssa-loop-ivopts.c (force_gimple_operand): Give correct types
-	to temporary variables.
-	(idx_force_simple, create_iv, rewrite_use_nonlinear_expr,
-	rewrite_use_address, rewrite_use_compare, rewrite_use_outer):
-	Changed due to force_gimple_operand change.
-	(find_bivs): Handle ill-typed assignments correctly.
-
-2004-04-04  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* passes.c (rest_of_compilation): Enable rest_of_handle_loop2 by
-	flag_loop_optimize2.
-	* tree-scalar-evolution.c (scev_initialize): Find loop exits.
-
-2004-04-02  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (rewrite_use_outer): Do not remove ssa names
-	prematurely.
-
-2004-04-01 Mostafa Hagog  <mustafa at il.ibm.com>
-	   Dorit Naishlos <dorit at il.ibm.com>
-
-        * config/rs6000/rs6000.md ("*ctrsi_internal1", "*ctrsi_internal2",
-        "*ctrdi_internal1", "*ctrdi_internal2", "*ctrsi_internal3",
-        "*ctrsi_internal4", "*ctrdi_internal3", "*ctrdi_internal4",
-        "*ctrsi_internal5", "*ctrsi_internal6", "*ctrdi_internal5",
-        "*ctrdi_internal6"): Replace register_operand with nonimmediate_operand
-
-2004-03-31  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-into-ssa.c (ssa_rewrite_initialize_block): Update
-	SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
-	(ssa_rewrite_phi_arguments): Ditto.
-	* tree-ssa.c (kill_redundant_phi_nodes): Prevent replacing
-	ssa names that occur in abnormal phi nodes.
-	* tree-ssa-loop-ivopts.c (get_var_def): Handle non-invariant
-	non-ssa name operands.
-	* java/decl.c (java_init_decl_processing): Initialize
-	long_integer_type_node.
-
-2004-03-31  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (idx_find_step): Prevent misscompilation
-	in case the index overflows.
-
-2004-03-31  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>,
-	    Dorit Naishlos <DORIT at il.ibm.com>
-
-	* tree-scalar-evolution.c (dump_chrecs_stats): Prevent format warning.
-
-2004-03-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* lambda-code.c (gcc_loop_to_lambda_loop): Changed due to changes in
-	scev.
-	* tree-data-ref.c (analyze_array_indexes, analyze_array): Ditto.
-	* tree-elim-check.c (try_eliminate_check): Ditto.
-	* tree-vectorizer.c (vect_analyze_scalar_cycles): Ditto.
-	* tree-chrec.c (chrec_fold_plus_1): Handle exponential + peeled chrec
-	correctly.  Use correct types.
-	(chrec_fold_negate): New.
-	(chrec_merge):  Short-circuit the case when the merged values are
-	identical.
-	(no_evolution_in_loop_p): Handle chrec_top correctly.
-	(chrec_convert): Handle polynomial and exponential chrecs corectly.
-	(chrec_type): Use TREE_TYPE.
-	* tree-chrec.h (chrec_fold_negate): Declare.
-	* tree-phinodes.c (create_phi_node): Do not initialize PHI_MARKED.
-	* tree-scalar-evolution.c: Handle evolutions analysed from different
-	loops correctly.  Do not use PHI_MARKED.  Use correct types.
-	* tree-scalar-evolution.h (analyze_scalar_evolution,
-	instantiate_parameters): Declaration changed.
-	(struct scev_info_str): Moved to tree-scalar-evolution.c.
-	(MI_VAR, MI_INNER_LOOPS_CHREC, MI_OUTER_LOOPS_CHREC): Removed.
-	(new_scev_info_str): Moved to tree-scalar-evolution.c.
-	* tree-ssa-loop-manip.c (add_exit_phis_use): Just add exit phis for
-	superloops of the loop containing the definition.
-	* tree.h (PHI_MARKED): Removed.
-	(tree_phi_node): Field 'marked' removed.
-
-2004-03-30  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-chrec.c (chrec_contains_symbols): Factorize conditions,
-	chrec_not_analyzed_yet is a NULL_TREE.
-	* tree-chrec.h (prove_truth_value_{lt, le, ge, ne, gt, eq}.c):
-	Removed.
-	(evolution_function_is_multivariate,
-	evolution_function_is_peeled_affine_p): New.
-	* tree-data-ref.c (analyze_all_data_dependences): Dump some
-	statistics on the data dependences.
-	* tree-elim-check.c (not_code, prove_truth_value): New.
-	(try_eliminate_check): Use prove_truth_value.
-	* tree-fold-const.h (tree_is_ne): New.
-	* tree-scalar-evolution.c (types_forbid_solutions_p,
-	first_iteration_non_satisfying_noev_noev,
-	first_iteration_non_satisfying_noev_ev,
-	first_iteration_non_satisfying_ev_noev,
-	first_iteration_non_satisfying_ev_ev,
-	first_iteration_non_satisfying_1,
-	first_iteration_non_satisfying,
-	gather_stats_on_scev_database): New functions.
-	(nb_iterations_less, nb_iterations_eq, nb_iterations_ne): Removed.
-	(set_nb_iterations_in_loop): Be more careful on overflow.
-	(number_of_iterations_in_loop): Use first_iteration_non_satisfying.
-	* tree-scalar-evolution.h (first_iteration_non_satisfying,
-	gather_stats_on_scev_database): Declared.
-
-2004-03-30  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (iv_value): Use correct type.
-	(may_eliminate_iv): Add a fixme comment.
-
-2004-03-29  Devang Patel  <dpatel at apple.com>
-
-	* tree-flow.h (tree_ssa_loop_version): Add new parameter, basic_block *.
-	(update_lv_condition): New.
-	* tree-ssa-loop-manip.c (copy_phi_nodes): nreverse copied phi nodes list
-	to ensure that phi nodes remain in same order.
-	(lv_update_pending_stmts): Do not nreverse pending list.
-	(lv_adjust_loop_header_phi): Walk two phi nodes list in parallel.
-	(tree_ssa_loop_version): Now condition_bb is input parameter.
-	(update_lv_condition): New.
-	(test_loop_versioning): Use update_lv_condition.
-	* tree-ssa-loop-unswitch.c (tree_unswitch_loop): Update function
-	tree_ssa_loop_version () call by adding 4th parameter.
-
-2004-03-29  Richard Guenther <rguenth at tat.physik.uni-tuebingen.de>
-
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
-	Fix unused vars warning with -disable-checking.
-	* df.c (df_reg_def_chain_create, df_reg_use_chain_create): Ditto.
-
-2004-03-27  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfghooks.c (split_edge): Update IRREDUCIBLE_LOOP flags.
-	* tree-flow-inline.h (bsi_after_labels): New.
-	* tree-flow.h (struct ssa_name_ann_d): Add need_phi_state field.
-	(bsi_after_labels, rewrite_ssa_into_ssa, duplicate_ssa_name,
-	tree_ssa_dce_no_cfg_changes, rewrite_into_loop_closed_ssa,
-	verify_loop_closed_ssa, compute_phi_arg_on_exit): Declare.
-	(tree_loop_optimizer_init): Declaration changed.
-	* tree-into-ssa.c (struct mark_def_sites_global_data): Add
-	names_to_rename and ssa_names fields.
-	(insert_phi_nodes, get_value_for, set_value_for, set_def_block,
-	set_livein_block, insert_phi_nodes_1, insert_phi_nodes_for,
-	register_new_def, get_reaching_def, rewrite_into_ssa): Handle
-	rewriting of ssa names.
-	(get_phi_state, set_phi_state, ssa_mark_def_sites_initialize_block,
-	ssa_mark_phi_uses, ssa_mark_def_sites, duplicate_ssa_name,
-	ssa_rewrite_initialize_block, ssa_rewrite_phi_arguments,
-	ssa_rewrite_finalize_block, ssa_rewrite_stmt, rewrite_ssa_into_ssa):
-	New functions.
-	* tree-scalar-evolution.c (scev_initialize): Changed due to
-	tree_loop_optimizer_init change.
-	* tree-ssa-dce.c (perform_tree_ssa_dce, perform_tree_ssa_dce,
-	tree_ssa_cd_dce): Handle no cfg changes mode.
-	(tree_ssa_dce_no_cfg_changes): Resurrect.
-	* tree-ssa-loop-im.c (move_computations): Preserve loop closed ssa.
-	* tree-ssa-loop-ivopts.c (struct version_info): Field outermost_usage
-	removed.
-	(update_outermost_usage, find_outermost_usage): Removed.
-	(ip_normal_pos): Fix.
-	(tree_ssa_iv_optimize_init): Do not call find_outermost_usage.
-	(find_interesting_uses_stmt): Use loop closed ssa form.
-	(find_interesting_uses_outside): New.
-	(find_interesting_uses): Use it.
-	(determine_iv_cost): Prefer IP_NORMAL to IP_END.
-	(split_loop_exit_edge, protect_loop_closed_ssa_form_use,
-	protect_loop_closed_ssa_form, compute_phi_arg_on_exit): New functions.
-	(rewrite_use_outer): Preserve loop closed ssa form.
-	(tree_ssa_iv_optimize): Verify loop closed ssa form.
-	* tree-ssa-loop-manip.c (mfb_redirect_exit_edges): Removed.
-	(free_new_names): Free old ssa names.
-	(extend_exit_phi_nodes, add_exit_phis_edge,
-	add_exit_phis_use, add_exit_phis_stmt, add_exit_phis,
-	get_loops_exits, rewrite_into_loop_closed_ssa,
-	check_loop_closed_ssa_use, check_loop_closed_ssa_stmt,
-	verify_loop_closed_ssa): New functions.
-	(tree_duplicate_loop_to_header_edge): Use loop closed ssa form.
-	(tree_ssa_loop_version): Handle irreducible loops correctly.
-	* tree-ssa-loop.c (tree_loop_optimizer_init): Create loop closed ssa
-	form.
-	(tree_ssa_loop_opt, copy_loop_headers): Changed due to
-	tree_loop_optimizer_init change.
-
-2004-03-25  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-data-ref.c (subscript_dependence_tester): Removed.
-	(build_classic_dist_vector): Implement the subscript tester:
-	test for different distances carried by the same loop.
-
-2004-03-23  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-cfg.c (print_loop): Modify dump formatting.
-	(debug_loop_ir): Renamed tree_debug_loops.
-	(tree_debug_loop): New.
-	* tree-chrec.c: Restructure for handling more carefully types.
-	* tree-chre.h: Same.
-	* tree-fold-const.h: Same.
-	* tree-fold-const.c: Same.
-	* tree-scalar-evolution.c: Same.
-	* tree-scalar-evolution.h: Same.
-	* tree-data-ref.c (dump_data_dependence_relation): Remove the
-	dump of the base_name because it produces too many conflicts in
-	the diffs of the testsuite.
-	(compute_all_dependences): Use pointers to the dependence_relations varray.
-	(int_cst_value, build_classic_dist_vector): New.
-	(find_data_references): Use pointers to datarefs varray.
-	(analyze_all_data_dependences): Compute the classic distances.
-	* tree-data-ref.h: Declare functions.
-	* tree-dg.c (dg_create_graph): Update the uses of the data-ref functions.
-	* tree-flow.h (debug_loop_ir): Renamed to tree_debug_loops.
-	(tree_debug_loop): Declare.
-
-2004-03-23  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-flow.h (tree_ssa_dce_no_cfg_changes): Declaration removed.
-	* tree-ssa-dce.c (remove_dead_stmt): Invalidate dominators if we
-	thread the edge.
-	(tree_ssa_dce_no_cfg_changes): Removed.
-	(perform_tree_ssa_dce, tree_ssa_dce, perform_tree_ssa_dce): Remove
-	no cfg changes mode.
-	* tree-ssa-loop-ivopts.c (force_gimple_operand): Handle overflowed
-	constants.
-	(find_interesting_uses_outer_or_nonlin): New.
-	(find_interesting_uses_op, find_interesting_uses_outer): Use it.
-	(find_interesting_uses_cond, idx_record_use,
-	find_interesting_uses_stmt): Changed due to find_interesting_uses_op
-	change.
-	(create_new_iv, remove_statement, rewrite_use_nonlinear_expr,
-	rewrite_use_outer, tree_ssa_iv_optimize): Handle direct removal of
-	unused ivs.
-	(remove_unused_ivs): New.
-	(tree_ssa_iv_optimize_loop): Call it.
-
-2004-03-23  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (SCEV_H): New.
-	(tree-ssa-loop-ivcanon.o, tree-ssa-loop-ivopts.o,
-	tree-scalar-evolution.o, tree-data-ref.o, tree-dg.o,
-	tree-elim-check.o, tree-vectorizer.o, tree-loop-linear.o,
-	lambda-code.o): Use it.
-	* tree-chrec.h (build_interval_chrec, build_polynomial_chrec,
-	build_exponential_chrec, build_peeled_chrec): Give a type to the
-	chrec node.
-	* tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Preserve correct
-	type.
-	(analyze_evolution_in_loop): Fix test for edges from inside the loop.
-	(scev_initialize): New.
-	(scev_init): Use it.
-	(scev_finalize): New.
-	(scev_done): Use it.
-	* tree-flow-inline.h (loop_of_stmt): Handle initialization statements
-	without crash.
-	* tree-scalar-evolution.h (scev_initialize, scev_finalize): Declare.
-
-2004-03-23  Dorit Naishlos  <dorit at il.ibm.com>
-
-        * tree-vectorizer.c: (vect_align_data_ref): Check for DECL_ALIGN
-        instead of TYPE_ALIGN. Check for DECL_EXTERNAL.
-        (vect_analyze_data_refs): Check for DECL_EXTERNAL.
-
-        Add documentation for functions.
-
-2004-03-22  Dale Johannesen  <dalej at apple.com>
-
-	* Makefile.in (OBJS-common):  Remove duplicate loop-iv.o.
-
-2004-03-22  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c: Avoid usage of global variables.
-
-2004-03-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-unswitch.o: New file.
-	* Makefile.in (tree-ssa-loop-unswitch.o): Add.
-	(tree-ssa-loop-im.o): Add flags.h dependency.
-	* flags.h (flag_unswitch_loops): Declaration moved from ...
-	* toplev.h (flag_unswitch_loops): ... here.
-	* tree-flow.h (tree_ssa_loop_version): Declaration changed.
-	(tree_ssa_unswitch_loops, estimate_loop_size): Declare.
-	* tree-ssa-loop-im.c: Include flags.h.
-	(movement_possibility, stmt_cost, move_computations_stmt):
-	Handle unswitchable conditions.
-	* tree-ssa-loop-ivcanon.c (estimate_loop_size): Export.
-	* tree-ssa-loop-ivopts.c (find_interesting_uses_cond): Handle
-	if (0) and if (1).
-	* tree-ssa-loop-manip.c (tree_ssa_loop_version): Return the newly
-	created loop.
-	* tree-ssa-loop.c (tree_ssa_loop_opt): Call tree_ssa_unswitch_loops.
-
-2004-03-20  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	Merge from tree-ssa branch (lno-merge-20040321).
-
-2004-03-20  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c: (vect_init_vector): New function.
-        (vect_get_vec_def_for_operand): Support loop invariant uses.
-        (vect_is_simple_use): Likewise.
-        (vect_mark_stmts_to_be_vectorized): Likewise.
-        (vect_analyze_scalar_cycles): Redundant check removed.
-
-        (vect_analyze_operations): Don't fail for vdefs that have uses
-        outside the loop.
-
-        (vect_stmt_relevant_p): A call to get_stmt_operands removed (already
-        performed at new_loop_vec_info).
-        (vect_mark_stmts_to_be_vectorized): Likewise.
-
-        (need_imm_uses_for): New Function.
-        (vectorize_loops): Add call to compute_immediate_uses and free_df.
-
-2004-03-20  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-chrec.c (chrec_fold_multiply_ival_cst): Handle negative
-	constants correctly.
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
-	Enable use of scev.
-
-2004-03-20  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	PR optimization/14658
-	* loop-invariant.c (move_invariant_reg): Handle assignments
-	with nontrivial lhs correctly.
-
-2004-03-18  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* df.c (df_reg_def_chain_create, df_reg_use_chain_create): Do not clean
-	up the old information here.
-	(df_reg_def_chain_clean, df_reg_use_chain_clean): New.
-	(df_analyse_subcfg): Call them.
-
-2003-03-18  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-flow.h (loop_commit_inserts): Declare.
-	* tree-ssa-loop-im.c (commit_inserts): Rename to...
-	(loop_commit_inserts): ... this.
-	* move_computations (move_computations, determine_lsm): Use
-	loop_commit_inserts.
-	* tree-ssa-loop-ivopts.c (AVG_LOOP_NITER): New macro.
-	(struct iv): New field use_id.
-	(struct version_info): New field preserve_biv.
-	(alloc_iv, record_use, free_loop_data): Initialize new fields.
-	(enum use_type): Add USE_OUTER.
-	(dump_use, find_interesting_uses_op, add_derived_ivs_candidates,
-	determine_use_iv_cost, rewrite_use): Handle USE_OUTER.
-	(dump_cand, find_interesting_uses_stmt, add_candidate_1,
-	determine_use_iv_cost_condition, determine_iv_cost, set_cost,
-	create_new_iv, rewrite_use_nonlinear_expr): Handle final value
-	replacement.
-	(find_interesting_uses_outer, add_iv_outer_candidates,
-	may_replace_final_value, determine_use_iv_cost_outer,
-	remove_statement, rewrite_use_outer): New functions.
-	(var_at_use): Replaced by ...
-	(var_at_stmt): ... this.
-	(get_computation_at): Split from ...
-	(get_computation): ... here.
-	(get_computation_cost_at): Split from ...
-	(get_computation_cost): ... here.
-	(iv_value): Split from ...
-	(cand_value_at): ... here.
-	(may_eliminate_iv, rewrite_use_compare): Reflect these changes.
-	(tree_ssa_iv_optimize_loop): Call loop_commit_inserts.
-	* tree-ssanames.c (make_ssa_name): Handle NULL argument.
-
-2003-03-18  Devang Patel  <dpatel at apple.com>
-
-	* tree-ssa-live.c (new_tree_live_info): Set num_blocks to
-	last_basic_block instead of n_basic_blocks.
-	(calculate_live_on_entry): Use last_basic_block instead of
-	n_basic_blocks.
-	(calculate_live_on_exit): Same.
-
-2004-03-17  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-cfg.c (thread_jumps): Don't thread jumps over loop headers.
-	* tree-flow.h (rewrite_into_ssa): Declaration changed.
-	(kill_redundant_phi_nodes, tree_loop_optimizer_init): Declare.
-	* tree-optimize.c (execute_todo): Do not free vars_to_rename.
-	(execute_one_pass): Do not allocate vars_to_rename.
-	(tree_rest_of_compilation): Allocate vars_to_rename.
-	* tree-scalar-evolution.c (number_of_iterations_in_loop): Handle
-	loops exited when condition is true.
-	(initialize_scalar_evolutions_analyzer): Use tree_loop_optimizer_init.
-	* tree-ssa-chrec.c (how_far_to_positive): Handle chrec_top correctly.
-	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Changed due to
-	rewrite_into_ssa change.
-	* tree-ssa-loop-im.c (move_computations, determine_lsm): Ditto.
-	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
-	Use scev analyser.
-	* tree-ssa-loop-manip.c (allocate_new_names): Update name memory
-	tags.
-	* tree-ssa-loop.c (tree_loop_optimizer_init): New.
-	(tree_ssa_loop_opt, copy_loop_headers): Use it.
-	* tree-ssa.c (rewrite_into_ssa): Use argument to decide whether
-	to rename all variables.
-	(rewrite_all_into_ssa): New.
-	(pass_build_ssa): Use it.
-	(kill_redundant_phi_nodes): Export.
-
-2004-03-15  Andrew Pinski  <pinskia at physics.uc.edu>
-
-	* tree-ssa-return.c (tree_ssa_return):
-	Move check for NULL return value above check
-	for a modify expr.
-
-2004-03-13  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (gate_scev_iv_canon): Do not check rtl
-	level flags here.
-	* tree-ssa-loop-ivcanon.c (get_base_for): Verfify that the argument
-	of the phi node is a constant.
-	(loop_niter_by_eval, create_canonical_iv, try_unroll_loop_completely,
-	canonicalize_loop_induction_variables): Handle loops with more than
-	one exit.
-	(find_loop_niter_by_eval): New.
-	(canonicalize_induction_variables): Check rtl level flags here.
-
-2004-03-12  Andrew Pinski  <pinskia at physics.uc.edu>
-
-	* tree-ssa-return.c (tree_ssa_return):
-	Only do it when we have a modify expr.
-
-	* tree-ssa-return.c (tree_ssa_return):
-	Add new comments and fix some old ones.
-
-2004-03-12  Falk Hueffner  <falk at debian.org>
-
-	* tree-pass.h: Declare pass_return.
-
-2004-03-11  Andrew Pinski  <apinski at apple.com>
-
-	PR optimization/14135
-	* tree-ssa-return.c: New file.
-	* Makefile.in (tree-ssa-return.o): Add.
-	* tree-optimize.c (init_tree_optimization_passes): Add
-	pass_return.
-	* timevar.def (TV_TREE_RETURN): New.
-
-2004-03-12  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivcanon.o: New file.
-	* Makefile.in (tree-ssa-loop-ivcanon.o): Add.
-	* flags.h (flag_unroll_loops): Declare.
-	* loop-invariant.c (record_use): Fix.
-	* params.def (PARAM_MAX_COMPLETELY_PEELED_INSNS): Increment.
-	* timevar.def (TV_TREE_LOOP_IVCANON): New.
-	* toplev.h (flag_unroll_loops): Declaration moved to flags.h.
-	* tree-flow.h (enum tree_ann_type): Remove MISC_ANN.
-	(struct tree_ann_common_d): Add aux field.
-	(struct misc_ann_d): Removed.
-	(struct stmt_ann_d): Removed aux field.
-	(union tree_ann_d): Removed misc field.
-	(canonicalize_induction_variables): Declare.
-	* tree-optimize.c (init_tree_optimization_passes): Add
-	pass_scev_iv_canon.
-	* tree-pass.h (pass_scev_iv_canon): Declare.
-	* tree-scalar-evolution.c (scev_iv_canon, gate_scev_iv_canon,
-	pass_scev_iv_canon): New.
-	(scev_done): Run cfg cleanup.
-	* tree-ssa-loop-im.c (LIM_DATA, determine_invariantness_stmt,
-	move_computations_stmt, schedule_sm): Use aux field in common
-	part of annotations.
-	* tree-ssa-loop-manip.c (allocate_new_names, rename_op,
-	free_new_names): Use common aux field.
-	(tree_duplicate_loop_to_header_edge): Fix memory leak.
-	* tree-ssa.c (mark_def_sites): Fix.
-	* tree-vectorizer.h (set_stmt_info, vinfo_for_stmt): Use aux field in
-	common part of annotations.
-	* gcc.dg/tree-ssa/ivcanon-1.c: New test.
-
-2004-03-11  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (lambda-mat.o, lambda-trans.o, lambda-code.o): Add TM_H
-	dependency.
-
-2004-03-09  Olga Golovonevsky <olga at il.ibm.com>
-            Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c: (vect_transform_binop): Removed.
-        (vect_transform_op): New function instead of vect_transform_binop,
-        to support both unary and binary operations.
-        (vect_is_supportable_binop): Removed.
-        (vect_is_supportable_op): New function instead of
-        vect_is_supportable_binop to support additional codes.
-        * tree-vectorizer.h: (operation_type): New enum type declared.
-        * config/rs6000/altivec.md: (andvv16qi3, andv8hi3, one_cmplv16qi2,
-        one_cmplv8hi2, one_cmplv4si2, iorv16qi3, iorv8hi3,): New modelling.
-        (*movv4si_internal): Relax condition.
-        (*movv8hi_internal1): Likewise.
-        (*movv16qi_internal1): Likewise.
-        (*movv4sf_internal1): Likewise.
-
-2004-03-09  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (df.o): Remove FIBHEAP_H dependency.
-	(invariant.o): Add df.h dependency.
-	* df.c: Do not include fibheap.h.
-	(df_bb_table_realloc, df_analyse_subcfg, free_reg_ref_chain,
-	prune_to_subcfg, df_bb_modify, df_find_def, dataflow_set_a_op_b,
-	dataflow_set_copy): New functions.
-	(df_bitmaps_alloc, df_reg_def_chain_create, df_reg_use_chain_create,
-	df_refs_update, df_reg_table_realloc, df_ref_create,
-	df_bb_reg_def_chain_create, df_bb_reg_use_chain_create,
-	df_bb_rd_local_compute, df_bb_ru_local_compute, df_bb_lr_local_compute,
-	df_analyse_1, df_insn_modify): Support analysing only a part of the cfg.
-	(df_rd_transfer_function, df_ru_transfer_function,
-	df_lr_transfer_function): Type of bitmaps changed to void *.
-	(hybrid_search_bitmap, hybrid_search_sbitmap): Merge into ...
-	(hybrid_search): ... new function.
-	(iterative_dataflow_bitmap, iterative_dataflow_sbitmap): Merge into ...
-	(iterative_dataflow): ... new function. Avoid use of fibheaps for
-	a worklist.  Do not process basic blocks unnecessarily.
-	* df.h (struct ref): Add data field.
-	(DF_REF_DATA): New macro.
-	(df_analyse_subcfg, df_find_def): Declare.
-	(transfer_function_sbitmap, transfer_function_bitmap): Replaced by ...
-	(transfer_function): ... declare.
-	(iterative_dataflow_sbitmap, iterative_dataflow_bitmap): Replaced by ...
-	(iterative_dataflow): ... declare.
-	(enum set_representation, struct dataflow): New.
-	* loop-invariant.c: Include df.h.
-	(struct loop_data): Remove modified_regs field.
-	(struct def): Remove redundant fields.
-	(struct use): Add insn field.
-	(defs, adef, last_def, m_reg_info, reg_info): Removed.
-	(struct reg): Removed.
-	(record_def, note_insn_stores, find_defs_insn, find_defs_bb,
-	get_current_def, record_dependencies_fer, record_dependencies,
-	move_actual_defs): Removed.
-	(find_defs, find_invariants_insn, create_new_invariant,
-	find_invariants_bb, find_invariants_body, find_invariants,
-	find_invariants_to_move, move_invariant_reg,
-	move_invariants, move_single_loop_invariants,
-	move_loop_invariants): Use df.c.
-	(init_inv_motion_data): Do not initialize removed structures.
-	(free_inv_motion_data, free_loop_data): Do not cleanup removed
-	structures.
-	(check_dependencies, find_invariant_insn, record_uses): New.
-	(record_use): Record the insn.
-	(get_inv_cost): Update comments.
-
-2004-03-09  Andreas Jaeger  <aj at suse.de>
-
-	* common.opt: Put tree-loop-linear at right place.
-
-2004-03-09  Daniel Berlin  <dberlin at dberlin.org>
-
-	* Makefile.in: Add lambda-mat.o, lambda-code.o, and tree-loop-linear.o.
-	* common.opt: Add -ftree-loop-linear.
-	* flags.h: Add flag_tree_loop_linear.
-	* opts.c: Handle tree-loop-linear option.
-	* timevar.def (TV_TREE_LINEAR_TRANSFORM): New.
-	* tree-flow.h (linear_transform_loops): New prototype.
-	* tree-optimize.c (pass_scev_linear_transform): New.
-	* tree-pass.h (pass_scev_linear_transform): Ditto.
-	* tree-scalar-evolution.c (scev_linear_transform): Ditto.
-	(gate_scev): Add check for flag_tree_loop_linear.
-	(gate_scev_linear_transform): New.
-	* lambda-code.c: New file.
-	* lambda-mat.c: New file.
-	* lambda-trans.c: New file.
-	* lambda.h: New file.
-	* tree-loop-linear.c: New file.
-
-2004-03-09  Andrew Pinski  <pinskia at physics.uc.edu>
-
-	* tree-ssa-phiopt.c (conditional_replacement):
-	Initialize new_var to NULL to prevent the
-	uninitialized warning.
-
-	* tree-ssa-phiopt.c (conditional_replacement):
-	Disable the making a new variable for different
-	types.
-
-	* tree-ssa-phiopt.c (conditional_replacement):
-	Disable the use of non-gimple of invert_truthvalue.
-
-2004-03-08  Andrew Pinski  <apinski at apple.com>
-
-	* tree-ssa-phiopt.c (make_temp): New function.
-	(tree_ssa_phiopt): Use absolute_replacement
-	and value_replacement.
-	(conditional_replacement): Handle the case
-	the conditional is not a variable and
-	the types do not match.
-	Handle the case where invert_truthvalue
-	would create non-gimple.
-	(absolute_replacement): New function.
-	(value_replacement): New function.
-
-2004-03-08  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* tree-scalar-evolution.c (set_scalar_evolution,
-	set_scalar_evolution_outer_value): Compute the loop number
-	instead of passing it as a parameter.
-
-2004-03-04  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-live.c (coalesce_tpa_members): Update the root
-	variable of the partition.
-
-2004-03-03  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (enum iv_position): Add IP_ORIGINAL.
-	(struct iv_cand): Add incremented_at.
-	(dump_cand, add_candidate_1, add_candidate, add_old_iv_candidates,
-	var_at_use, get_computation, get_computation_cost,
-	cand_value_at, determine_iv_cost, find_best_candidate,
-	create_new_iv): Handle IP_ORIGINAL.
-	(stmt_after_ip_original_pos, stmt_after_increment): New functions.
-	(find_givs_in_stmt): Cast the values to the result type.
-	(record_invariant): Do not record virtual operands.
-
-2004-03-03  Daniel Berlin  <dberlin at dberlin.org>
-
-	* tree-scalar-evolution.c: Use pointers to varray instead of
-	varrays for functions that insert in the scev database.
-
-2004-03-03  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* Makefile.in (OBJS-common): Add tree-elim-check.o.
-	(tree-chrec.o): Add dependence on tree-pass.h.
-	(tree-elim-check.o): New rule.
-	* tree-elim-check.c: New file.
-	* basic-block.h (edge_source, edge_destination): New inlined
-	functions.
-	* cfgloop.h (loop_nb_iterations): Added a comment on the use
-	of this accessor.
-	* common.opt (ftree-elim-checks): New flag.
-	* flags.h (flag_tree_elim_checks): Declared here.
-	* opts.c (decode_options): Set flag_tree_elim_checks to zero.
-	(common_handle_option): Add case OPT_ftree_elim_checks.
-	* timevar.def (TV_TREE_ELIM_CHECKS): Defined.
-	* toplev.c (flag_tree_elim_checks): Defined.
-	* tree-cfg.c (print_pred_bbs, print_succ_bbs, print_loop):
-	Modify the dumping style.  Print nb_iterations.
-	* tree-chrec.c, tree-chrec.h, tree-scalar-evolution.c,
-	tree-scalar-evolution.h, tree-data-ref.c: New version of the
-	scalar evolution algorithm.  Don't use a schedule for
-	analyzing the scalar variables.
-	* tree-fold-const.c (tree_fold_bezout): Define.
-	* tree-fold-const.h (tree_fold_int_round_div,
-	tree_fold_int_trunc_mod, tree_fold_int_ceil_mod,
-	tree_fold_int_floor_mod, tree_fold_int_round_mod): Removed, because
-	not used for the moment.
-	(chrec_merge_types): New function.
-	* tree-optimize.c (pass_scev_elim_checks): Register the pass.
-	* tree-pass.h (pass_scev_elim_checks): Declare the pass.
-	* tree-pretty-print.c (dump_generic_node): Print
-	PEELED_CHREC.  Remove PERIODIC_CHREC.
-	* tree-vectorizer.c: Modify the use of
-	analyze_scalar_evolution.
-	* tree.def (POLYNOMIAL_CHREC, EXPONENTIAL_CHREC): Store the
-	evolution loop in a third leaf instead of in TREE_TYPE.
-	TREE_TYPE is then used in storing the type of the chrec.
-	(PERIODIC_CHREC): Removed since it is not used for the moment.
-	(PEELED_CHREC): New node.
-	* doc/invoke.texi (fdump-tree-scev, fdump-tree-ddall): Correct
-	the name of these flags.
-	(ftree-elim-checks, fdump-tree-elck): Document.
-
-2004-03-02  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (number_of_iterations_cond, cand_value_at):
-	Cast the constants.
-
-2004-03-01  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (tree-ssa-loop-ivopts.o): Add HASHTAB_H dependency.
-	* tree-ssa-loop-ivopts.c: Include hashtab.h.
-	(old_highest_ssa_version): Rename to version_info_size.
-	(struct tree_niter_desc): Split from ...
-	(struct loop_data): ... here.
-	(relevant): New variable.
-	(tree_ssa_iv_optimize_init, set_iv, find_induction_variables,
-	record_invariant, find_interesting_uses, add_old_ivs_candidates,
-	determine_set_costs, free_loop_data, tree_ssa_iv_optimize_finalize):
-	Use bitmap of relevant ssa names.
-	(var_at_use): New function.
-	(get_computation): Use it.
-	(multiply_by_cost): Cache all results.
-	(mbc_entry_hash, mbc_entry_eq): New functions.
-	(number_of_iterations_cond): Split from ...
-	(determine_number_of_iterations): ... here.
-	(cand_value_at, may_eliminate_iv): New functions.
-	(determine_use_iv_cost_condition, rewrite_use_compare): Implement iv
-	elimination.
-
-2004-03-01  Devang Patel  <dpatel at apple.com>
-
-	* tree-dg.c (dg_delete_graph): Reset varrays.
-	(gate_ddg) : Check current loops.
-
-2004-02-27  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-cfg.c (cleanup_control_expr_graph): Prevent probability from
-	overflowing.
-	* loop-invariant.c (get_current_def): Fix.
-	* tree-ssa-loop-im.c (move_computations): Only call rewrite_into_ssa
-	if vars_to_rename is nonempty.
-	* tree-ssa-loop-ivopts.c (outermost_usage, ivs): Removed.
-	(struct version_info): New.
-	(version_info, max_inv_id): New variables.
-	(struct cost_pair): Added depends_on field.
-	(struct iv_use): Removed fields choices, n_choices, min_cost and
-	min_cost_cand.
-	(enum iv_position, dump_cand, ip_end_pos, add_candidate_1,
-	determine_iv_cost, create_new_iv): IP_START position disabled.
-	(find_optimal_iv_set_1, min_remaining_cost, undo_changes,
-	execute_removal, add_forbidden_ivs, try_candidate): Removed.
-	(dump_use): Do not dump removed fields.
-	(ver_info, name_info, update_outermost_usage, record_invariant,
-	find_invariants_stmt, find_depends, try_improve_iv_set): New functions.
-	(find_outermost_usage): Handle uses in phis.
-	(divide): Update comment.
-	(tree_ssa_iv_optimize_init): Initialize version_info instead of ivs
-	and outermost_usage.
-	(set_iv, get_iv, find_induction_variables, add_old_ivs_candidates):
-	Use version_info instead of ivs.
-	(record_use): Do not initialize removed fields.
-	(find_interesting_uses_op): Call record_use.
-	(find_interesting_uses_stmt): Call find_invariants_stmt.
-	(find_interesting_uses): Scan just the current loop.
-	(set_use_iv_cost): Initialize depends_on field.
-	(get_use_iv_cost): Return depends_on field.
-	(get_computation): Handle special cases.
-	(force_var_cost, split_address_cost, ptr_difference_cost,
-	difference_cost, get_computation_cost, determine_use_iv_cost_generic,
-	determine_use_iv_cost_address, determine_use_iv_cost_condition):
-	Determine depends_on bitmap.
-	(determine_use_iv_costs): Dump depends_on bitmap.
-	(init_set_costs): Use information about invariants.
-	(find_best_candidate, set_cost, get_initial_solution,
-	find_optimal_iv_set): Take depends_on into account.
-	(rewrite_uses): Use use->selected to select candidate.
-	(free_loop_data, tree_ssa_iv_optimize_finalize): Cleanup version_info
-	instead of ivs.  Free depends_on bitmaps.
-	(tree_ssa_iv_optimize_loop): Do not pass iv_set to rewrite_uses.
-
-2004-02-27  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfgloopmanip.c (loopify): Fix comment.
-	* loop-iv.c (lowpart_byte, lowpart_subreg_p): Removed.
-	(lowpart_subreg, simple_reg_p, iv_get_reaching_def, get_biv_step_1,
-	iv_analyse_op, iv_analyse, get_iv_value): Use standard subreg
-	manipulation functions.
-	(simplify_using_assignment): Handle hardregs correctly.
-	(canon_condition): Use swap_commutative_operands_p.
-	(iv_number_of_iterations): Avoid overflow.
-	* loop-unroll.c (unroll_loop_runtime_iterations): Pass additional
-	argument to compare_and_jump_seq.
-	* loop-unswitch.c (unswitch_loop, may_unswitch_on,
-	unswitch_single_loop, compare_and_jump_seq): Handle comparisons of
-	ccmode registers.
-	* rtl.h (compare_and_jump_seq): Declaration changed.
-
-2004-02-25  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.h (assignment_vec_info_type): New enum value for
-        stmt_vec_info_type.
-        * tree-vectorizer.c (vect_transform_assignment): New function.
-        Support vectorization of assignment stmts.
-        (vect_transform_stmt): Call vect_transform_assignment.
-        (vect_is_supportable_assignment): New function.
-        (vect_analyze_operations): Call vect_is_supportable_assignment.
-
-        (vect_create_index_for_array_ref): Replace unsigned_intSI_type_node
-        with size_type_node.
-        (vect_transform_loop_bound): Likewise.
-
-        (get_vectype_for_scalar_type): Avoid division by 0.
-
-        (vect_analyze_operations): Apply check for no-out-of-loop-uses also
-        to stmts that are marked irrelevant.
-
-2004-02-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-flow.h (for_each_index): Declare.
-	* tree-ssa-loop-im.c (struct lim_aux_data): Add always_executed_in
-	and sm_done fields.
-	(struct use): New.
-	(max_uid): New static variable.
-	(outermost_invariant_loop, commit_inserts, may_move_till,
-	force_move_till, record_use, free_uses, single_reachable_address,
-	rewrite_uses, schedule_sm, determine_lsm_reg,
-	loop_suitable_for_sm, determine_lsm_loop, determine_lsm): New functions.
-	(add_dependency): Use outermost_invariant_loop.
-	(set_level): Add sanity checking.
-	(determine_invariantness_stmt): Set always_executed_in field.
-	(move_computations_stmt): Modified.
-	(move_computations): Use commit_inserts.
-	(fill_always_executed_in): Take possibility of an infinite loop into
-	account.
-	(tree_ssa_lim): Call determine_lsm.
-	* tree-ssa-loop-ivopts.c (for_each_index): Export.
-	(rewrite_use_address): Improve handling of memory tags.
-
-	* tree-ssa-loop.c (do_while_loop_p): Readd.
-	(copy_loop_headers): Readd check for do_while_loop_p.
-	* tree-ssa-operands.c (add_stmt_operand): Modified.
-
-2004-02-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	Merge from tree-ssa branch (lno-merge-20040221).
-
-2004-02-20  Devang Patel  <dpatel at apple.com>
-
-	* tree-vectorizer.c (vect_analyze_data_ref_dependence): Use
-        ddg_direction_between_stmts ().
-
-2004-02-20  Devang Patel  <dpatel at apple.com>
-
-	* tree-data-ref.h (data_dependence_direction): Add new member
-	dir_independent.
-        * tree-dg.h (tree-data-ref.h): Include.
-        (ddg_direction_between_stmts, ddg_distance_between_stmts): New decls.
-        * tree-dg.c (find_ddr_between_stmts, ddg_direction_between_stmts,
-        ddg_distance_between_stmts): New functions.
-
-2004-02-19  Devang Patel  <dpatel at apple.com>
-
-	* tree-dg.c (dg_delete_edges, dg_delete_node, dg_delete_graph,
-	dg_delete_edge, gate_delete_ddg): New functions.
-	(pass_delete_ddg): New.
-	* tree-dg.h (dg_delete_graph, dg_delete_edge): New extern decls.
-	* tree-optimize.c (init_tree_optimization_passes): Add new pass
-	pass_delete_ddg.
-	* tree-pass.h (pass_delete_ddg): New extern.
-
-2004-02-19  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-flow.h (create_iv): Declare.
-	* tree-ssa-loop-ivopts.c (create_iv): New function.
-	(create_new_iv): Use create_iv.
-
-2004-02-19  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop.c (do_while_loop_p): New function.
-	(copy_loop_headers): Do not peel do-while loops.
-
-2004-02-19  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-invariant.c: New file.
-	* Makefile.in (loop-invariant.o): New.
-	* cfgloop.h (init_set_costs, global_cost_for_size,
-	move_loop_invariants): Declare.
-	* toplev.c (rest_of_handle_loop2): Call move_loop_invariants.
-	(lang_dependent_init): Call init_set_costs.
-	* tree-ssa-loop-ivopts.c (avail_regs, res_regs, small_cost, pres_cost,
-	spill_cost): Made static.
-	(global_cost_for_size): Export.
-	(ivopts_global_cost_for_size, init_set_costs): New functions.
-	(determine_set_costs): Do not initialize set cost constants.
-	Use ivopts_global_cost_for_size.
-	(try_candidate, find_optimal_iv_set_1, set_cost): Use
-	ivopts_global_cost_for_size.
-
-	* cfgloop.c (fill_sons_in_loop): Fix typo in comment.
-
-2004-02-17  Devang Patel  <dpatel at apple.com>
-
-	* tree-vectorize.c (vect_create_data_ref): Set TREE_ADDRESSABLE bit.
-	(vectorize_loops): Reset loop->aux.
-
-2004-02-16  Devang Patel  <dpatel at apple.com>
-
-        * Makefile.in (TREE_FLOW_H): Add tree-dg.h
-        (OBJS-common): Add tree-dg.o
-        (gtype-desc.o): Depend on tree-dg.h
-        (tree-dg.o): New rule.
-        (GTFILES): Add tree-data-ref.h, tree-data-ref.h
-        * common.opt (ftree-ddg): Add new option.
-        * flags.h (flag_ddg): New extern.
-        * gengtype.c (open_base_files): Add tree-dg.h and tree-data-ref.h in
-        the list.
-        * opts.c (decode_option): Set flag_ddg to zero.
-        (common_handle_option): Handle OPT_ftree_ddg.
-        * timevar.def (TV_DEP_GRAPH): New.
-        * toplev.c (flag_ddg): New flag.
-        (lang_independent_options): Add entry for -ftree-ddg.
-        * tree-data-ref.c (compute_all_dependences): Make externally visible.
-        * tree-data-ref.h (data_reference, subscript, data_dependence_relation)
-        Add GTY markers.
-        (compute_all_dependences): Make externally visible.
-        * tree-dg.c: New file.
-        * tree-dg.h: New file.
-        * tree-flow-inline.h (dg_node_for_stmt): New function.
-        * tree-flow.h (tree-dg.h): Include.
-        (stmt_ann_d): New member, dg_node.
-        * tree-optimize.c (init_tree_optimization_passes): Add pass_ddg.
-        * tree-pass.h (PROP_scev): Define.
-        (tree_opt_pass pass_ddg): Extern decl.
-        * tree-scalar-evolution.c (pass_scev_anal): Provide PROP_scev property.
-        * varray.c (element[NUM_VARRAY_DATA]): Add new member for dependence
-        graph.
-        * varray.h (varray_data_enum): New member VARRAY_DATA_DG.
-        (varray_data_tag): New member dg.
-        (VARRAY_DG_INIT): New #define.
-        (VARRAY_DG): New #define.
-        (VARRAY_PUSH_DG): New #define.
-
-2004-02-12  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-optimize.c (init_tree_optimization_passes): Move ch after
-	the first dominator optimization pass.
-	* tree-ssa-loop.c (should_duplicate_loop_header_p,
-	copy_loop_headers): Work over ssa.
-	(pass_ch): Require and update ssa form.
-	(mark_defs_for_rewrite, duplicate_blocks): New.
-
-2004-02-10  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (for_each_index, prepare_decl_rtl,
-	peel_address): Handle RESULT_DECL.
-
-2004-02-10  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-doloop.c (doloop_optimize): Use get_simple_loop_desc.
-	* loop-init.c (loop_optimizer_finalize): Free the simple loop
-	descriptions.
-	* loop-unroll.c (unroll_and_peel_loops): Do not free the simple loop
-	descriptions.
-	(decide_peel_once_rolling, decide_peel_completely,
-	decide_unroll_stupid): Test assumptions.
-	decide_unroll_constant_iterations, decide_unroll_runtime_iterations,
-	decide_peel_simple, peel_loop_simple, unroll_loop_stupid): Update
-	number of iterations info.
-	(unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
-	(loop_exit_at_end_p): Use get_simple_loop_desc.
-
-2004-02-08  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfgloop.h (struct niter_desc): Add first_special, extend,
-	extend_mode, delta and mult fields.
-	(get_iv_value): Declare.
-	* expr.c (force_operand): Handle subregs of expressions.
-	* loop-doloop.c (doloop_valid_p): Test desc->infinite properly.
-	* loop-iv.c (dump_iv_info): Dump new fields.
-	(lowpart_byte, lowpart_subreg_p, lowpart_subreg,
-	iv_constant, iv_subreg, iv_extend, iv_neg, iv_add, iv_mult,
-	get_biv_step_1, get_biv_step, shorten_into_mode,
-	canonicalize_iv_subregs): New functions.
-	(simple_reg_p, simple_set_p, iv_get_reaching_def, iv_analyse_biv,
-	iv_analyse_op, iv_analyse, iv_number_of_iterations): Handle subregs.
-	* loop-unswitch.c (may_unswitch_on): Handle subregs.
-
-2004-02-04  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* Makefile.in (tree-ssa-loop-ivopts.o): Add RECOG_H and insn-config.h
-	dependency.
-	* loop-iv.c (iv_analysis_loop_init): Ensure we only care about
-	increments that are done just once each iteration.
-	* timevar.def (TV_TREE_LOOP_IVOPTS, TV_TREE_CH): New.
-	* tree-ssa-loop-ivopts.c: Include insn-config.h and recog.h.
-	(INFTY): Increase.
-	(struct iv_use): Add choices, n_choices, min_cost_cand and selected
-	fields.  Rename field best_cost to min_cost.
-	(CONSIDER_ALL_CANDIDATES_BOUND): Decrease.
-	(dump_use): Dump new fields.
-	(dump_uses, cst_and_fits_in_hwi, int_cst_value, build_int_cst,
-	divide, strip_offset, add_cost, multiply_by_cost, get_address_cost,
-	force_var_cost, peel_address, ptr_difference_const,
-	split_address_cost, ptr_difference_cost, difference_cost,
-	get_computation_cost): New functions.
-	(find_induction_variables): Formating changes.
-	(record_use): Initialize new fields.
-	(add_old_ivs_candidates): Do not add invariants.
-	(set_use_iv_cost): Set min_cost.
-	(get_use_iv_cost): Fix.
-	(get_computation): Use less memory.
-	(determine_use_iv_cost_generic, determine_use_iv_cost_address,
-	determine_use_iv_cost_condition, determine_iv_cost): Use
-	new cost estimation functions.
-	(compute_iv_set_cost): Removed.
-	(struct undo_record): New.
-	(use_with_min_choices, min_remaining_cost, undo_changes,
-	execute_removal, add_forbidden_ivs, try_candidate, set_cost,
-	get_initial_solution): New functions.
-	(find_optimal_iv_set_1, find_optimal_iv_set): Made more effective.
-	(create_new_ivs, rewrite_use_nonlinear_expr, rewrite_use_address):
-	Unshare created expressions.
-	(free_loop_data): Free new structures.
-	(tree_ssa_iv_optimize_loop): Remove garbage collection.
-	(tree_ssa_iv_optimize): Use TV_TREE_LOOP_IVOPTS timevar.
-	* tree-ssa-loop.c (pass_ch): Use TV_TREE_CH timevar.
-
-2004-02-02  Steven Bosscher  <stevenb at suse.de>
-
-	* common.opt: Re-order some options in ASCII collating order.
-
-2004-01-30  Devang Patel  <dpatel at apple.com>
-
-	* cfgloopmanip.c (loopify): Always redirect switch_bb's BRANCH_EDGE,
-	however redirect FALLTHRU_EDGE only if asked.
-	* tree-ssa-loop-manip.c (tree_ssa_loop_version): Update FALLTHRU_EDGE
-	pending stmts.
-
-2004-01-29  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (find_optimal_iv_set_1, compute_iv_set_cost):
-	Fix memory leak, speed up.
-	(tree_ssa_iv_optimize_finalize): Move reseting of DECL_RTL...
-	(free_loop_data): ... here.
-
-2004-01-29  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* basic-block.h (FOR_BB_INSNS, FOR_BB_INSNS_REVERSE): New macros.
-	* cfgloop.c (num_loop_branches): New function.
-	* cfgloop.h (struct loop_desc): Add field strange.
-	(struct loop): Remove fields simple, desc, has_desc.
-	(num_loop_branches, get_simple_loop_desc, free_simple_loop_desc):
-	Declare.
-	(simple_loop_desc): New inline function.
-	* cfgloopanal.c (count_loop_iterations): Set field strange.
-	(simple_loop_exit_p): Initialize postincr properly.
-	* loop-iv.c (assign_luids, mark_sets, simplify_using_initial_values):
-	Use FOR_BB_INSNS/FOR_BB_INSNS_REVERSE.
-	(iv_number_of_iterations): Restrict the number of iterations to the
-	actual mode.
-	(find_simple_exit): Check results with the old simple loop analyser.
-	(get_simple_loop_desc, free_simple_loop_desc): New functions.
-	* loop-unroll.c (loop_exit_at_end_p): New function.
-	(unroll_and_peel_loops, peel_loops_completely,
-	decide_unrolling_and_peeling, decide_peel_once_rolling,
-	decide_peel_completely, peel_loop_completely,
-	decide_unroll_constant_iterations, unroll_loop_constant_iterations,
-	decide_unroll_runtime_iterations, unroll_loop_runtime_iterations,
-	decide_peel_simple, decide_unroll_stupid): Use new iv analysis.
-	* predict.c (predict_loops): Use new iv analysis.
-
-	* tree-ssa-loop.c (copy_loop_headers): Predict entry edge from
-	copied loop header to be taken.
-
-	* tree-cfg.c (tree_find_edge_insert_loc,
-	bsi_insert_on_edge_immediate): Return the newly created block.
-	(bsi_commit_edge_inserts_1): Add parameter to
-	tree_find_edge_insert_loc call.
-	* tree-flow.h (bsi_insert_on_edge_immediate): Declaration changed.
-	* tree-ssa-loop-ivopts.c (create_new_iv): Update loop for newly
-	created block.
-
-	* cfg.c (unlink_block): Clean prev_bb and next_bb fields.
-
-2004-01-29  Devang Patel  <dpatel at apple.com>
-
-	* cfglayout.h (loopify): Add new bool parameter.
-	* cfgloopmanip.c (loopify): Support new bool argument.
-	* loop-unswitch.c (unswitch_loop): Supply additional argument 'true'
-	to loopify.
-	* tree-cfg.c (tree_block_label): Make externally visible.
-	* tree-flow.h (tree_block_label, test_loop_versioning, tree_ssa_loop_version): New
-	extern decls.
-	* tree-ssa-loop-manip.c (lv_adjust_loop_entry_edge, lv_udate_pending_stmts,
-	lv_adjust_loop_header_phi, tree_ssa_loop_version): New functions.
-	* tree-ssa-loop.c (tree_ssa_loop_opt): Test loop versioning.
-
-2004-01-29  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-scalar-evolution.c (scev_analyze_inner_loop_phi): Add ;.
-
-2004-01-29  Sebastian Pop  <sebastian.pop at ensmp.fr>
-
-	* Makefile.in (tree-ssa-dom.o): Depends on cfgloop.h.
-	* tree-flow-inline.h (loop_of_stmt): New function.
-	* tree-ssa-dom.c: Include cfgloop.h.
-	(tree_ssa_dominator_optimize): Detect and finalize the natural
-	loops structure.
-	(simplify_rhs_and_lookup_avail_expr): Verify that the folded
-	operations belong to the same loop.
-
-	* cfgloop.h (loop): Rewrite comments for the nb_iterations field.
-	* tree-data-ref.c (analyze_all_data_dependences): Increase the size
-	of the dependence graph when computing all the dependences.
-	* tree-optimize.c (init_tree_optimization_passes): Move the
-	pass_scev after the pass_pre.
-	* tree-scalar-evolution.h: Update comments.
-	* tree-scalar-evolution.c (symbolically_analyze,
-	scev_follow_ssa_edge_same_loop, scev_follow_ssa_edge_inner_loop,
-	loop_is_strictly_included_in, scev_analyze_inner_loop_phi,
-	draw_tree_cfg): New functions.
-	(compute_value_on_exit_of_loop): Removed.
-	(analyze_evolution): Mark phi nodes instead of looking into
-	the already_visited array.
-	(analyze_evolution_in_loop): Use scev_follow_ssa_edge_same_loop,
-	scev_follow_ssa_edge_inner_loop.
-	(scev_analyze_modify_expr): Refine the wrap-around case.
-	(scev_follow_ssa_edge): Handle edges to the current and inner loops
-	separately calling scev_follow_ssa_edge_same_loop or
-	scev_follow_ssa_edge_inner_loop.
-	(merge_branches_of_condition_phi_node): Restructure.
-	(set_nb_iterations_in_loop): Add one to the number of iterations.
-	When the loop copy headers is on, we always exit the loop after
-	having executed once its body.
-	(record_dependences_for_opnd): Do not record dependences on variables
-	that are not in the current loop.
-	(pass_scev_depend): Rename the pass from alldd to ddall.
-	* tree-ssa-loop.c (gate_ch): New function.
-	(pass_ch): Use gate_ch.
-	* doc/invoke.texi (-ftree-ch, -fdump-tree-ch): Document flags.
-	(fdump-tree-scev, fdump-tree-ddall): Update names, and comments.
-
-	* common.opt (ftree-ch): Document.
-	* flags.h (flag_tree_ch): Declare.
-	* opts.c (flag_tree_ch): Set it on by default.
-	(flag_scalar_evolutions, flag_all_data_deps): Turn off by default.
-	(OPT_ftree_ch): Handle this case.
-	* toplev.c (lang_independent_options): Register flag_tree_ch.
-
-2004-01-28  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfghooks.c (split_block): Update probabilities.
-
-	* cfgloopmanip.c (loopify): Always redirect branch edge to the new
-	loop.
-	* loop-iv.c (canon_condition, simplify_using_condition): Export.
-	(check_simple_exit): Do not allow cc mode registers.
-	* loop-unroll.c (unroll_loop_runtime_iterations): Use
-	compare_and_jump_seq.
-	* loop-unswitch.c (may_unswitch_on_p): Renamed to may_unswitch_on,
-	returns the condition, use iv_analyse.
-	(compare_and_jump_seq): New function.
-	(unswitch_loops): Call iv_analysis_done.
-	(unswitch_single_loop, unswitch_loop): Handle nontrivial invariants.
-	* rtl.h (compare_and_jump_seq, canon_condition,
-	simplify_using_condition): Declare.
-
-2004-01-28  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* loop-iv.c: New.
-	* loop-doloop.c: New.
-	* Makefile.in (loop-doloop.o, loop-iv.o): Add.
-	* alias.c (init_alias_analysis): Test flag_unroll_loops instead of
-	flag_old_unroll_loops.
-	* cfgloop.h (struct rtx_iv, struct niter_desc): New.
-	(get_loop_level, iv_analysis_loop_init, iv_get_reaching_def,
-	iv_analyse, find_simple_exit, iv_number_of_iterations,
-	iv_analysis_done, doloop_optimize_loops): Declare.
-	* cfgloopanal.c (get_loop_level): New.
-	* common.opt (floop-optimize2): New.
-	(fold-unroll-loops, fold-unroll-all-loops): Remove.
-	* doloop.c (doloop_condition_get): Export.
-	* flags.h (flag_old_unroll_loops, flag_old_unroll_all_loops):
-	Declaration removed.
-	* loop-unswitch.c (reversed_condition): Export.
-	* loop.c (loop_invariant_p): Use flag_unroll_loops instead
-	of flag_old_unroll_loops.
-	* opts.c (common_handle_option): Handle -floop-optimize2,
-	do not handle -fold-unroll-loops and -fold-unroll-all-loops.
-	* params.def (PARAM_MAX_DOLOOP_INSNS): New.
-	* rtl.h (get_mode_bounds, doloop_condition_get,
-	reversed_condition): Declare.
-	* stor-layout.c (get_mode_bounds): New function.
-	* toplev.c (flag_old_unroll_loops, flag_old_unroll_all_loops):
-	Remove.
-	(flag_loop_optimize2): New.
-	(rest_of_handle_loop_optimize): Use flag_unroll_loops instead
-	of flag_old_unroll_loops.
-	(rest_of_handle_loop2): Call doloop_optimize_loops.
-	(rest_of_compilation): Use flag_loop_optimize2.
-	(process_options): Remove flag_old_unroll_loops handling, add
-	flag_loop_optimize2 handling.
-	* toplev.h (flag_loop_optimize2): Declare.
-	* unroll.c (unroll_loop): Use flag_unroll_all_loops instead of
-	flag_old_unroll_all_loops.
-
-2004-01-26  Dorit Naishlos <dorit at il.ibm.com>
-
-	* Makefile.in: (tree-vectorizer.o): Remove dependency on real.h.
-	* tree-vectorizer.c: (real.h): Remove included file.
-        (vect_get_vec_def_for_operand): No need to explicitly use build_int_2
-        and build_real.
-
-        (vect_transform_loop_bound): Create loop IV update at loop exit
-        block, following changes in loop control.
-
-        (vectorize_loops): Remove debug printout.
-
-        * config/rs6000/altivec.md: (*movv4si_internal): More complex
-        condition.
-        (*movv8hi_internal1): Likewise.
-        (*movv16qi_internal1): Likewise.
-        (*movv4sf_internal1): Likewise.
-
-2004-01-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c (determine_set_costs): Do not use
-	GENERAL_REGNO_P.
-
-2004-01-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-ivopts.c: New file.
-	* Makefile.in (tree-ssa-loop-ivopts.o): Add.
-	* expr.c (expand_expr_1): Handle expand_expr_1.
-	* fold-const.c (invert_tree_comparison, invert_tree_comparison):
-	Export.
-	* tree-cfg.c (stmt_bsi): New function.
-	* tree-flow.h (stmt_bsi, tree_ssa_dce_no_cfg_changes,
-	tree_ssa_iv_optimize): Declare.
-	* tree-simple.c (get_base_symbol): Handle INDIRECT_REF.
-	* tree-ssa-dce.c (tree_ssa_dce_no_cfg_changes): Split from ...
-	(tree_ssa_dce): ... here.
-	* tree-ssa-loop.c (tree_ssa_loop_opt): Call tree_ssa_iv_optimize.
-	* tree-ssanames.c (make_ssa_name): Allow creating ssa name without
-	statement.
-	* tree.h (invert_tree_comparison, swap_tree_comparison): Declare.
-
-2004-01-25  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* doloop.c (doloop_optimize): Test for loop->top instead of
-	loop->scan_start.
-
-2004-01-22  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-alias-common.c (HAVE_BANSHEE): Do not define it.
-	(create_alias_vars): Do not test HAVE_BANSHEE value.
-
-2004-01-22  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-ssa-loop-manip.c: New file.
-	* Makefile.in (tree-ssa-loop-manip.o): Add.
-	* basic-block.h (struct reorder_block_def): New field copy_number.
-	* cfghooks.c (split_block, make_forwarder_block): Update irreducible
-	loop information.
-	* cfgloopmanip.c (duplicate_loop_to_header_edge): Set copy_number.
-	* tree-cfg.c (tree_duplicate_bb): Duplicate also virtual operands.
-	* tree-flow.h (enum tree_ann_type): Add MISC_ANN.
-	(struct misc_ann_d): New.
-	(union tree_ann_d): Add misc field.
-	(test_unrolling_and_peeling, tree_duplicate_loop_to_header_edge):
-	Declare.
-	* tree-ssa-loop.c (tree_ssa_loop_opt): Call
-	test_unrolling_and_peeling.
-	* tree-ssa-operands.c (copy_virtual_operands): New.
-	* tree-ssa-operands.h (copy_virtual_operands): Declare.
-
-	* dominance.c: Fix comment.
-
-	* cfgloopanal.c (mark_irreducible_loops): Rewriten.
-	(struct edge, struct vertex, struct graph): New.
-	(dump_graph, new_graph, add_edge, dfs, check_irred, for_each_edge,
-	free_graph): New functions.
-
-2004-01-21  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-scalar-evolution.c (pass_scev): Don't use a name.
-	(pass_scev_anal): Named this pass "scev".
-
-2004-01-21  Dorit Naishlos <dorit at il.ibm.com>
-
-	* Makefile.in: (tree-vectorizer.o): Add dependency on real.h.
-        * tree-vectorizer.c: (vect_is_simple_use): Allow constants.
-        (real.h): Included to support constants vectorization.
-        (vect_get_vec_def_for_operand): New function.
-        (vect_transform_binop): Use above new function.
-        (vect_transform_store): Likewise.
-        (vect_transform_load): Likewise.
-
-        (vect_get_new_vect_var): Allow more flexibility in naming scheme.
-        (vect_create_index_for_array_ref): Call vect_get_new_vect_var with a
-        name prefix instead of a variable.
-        (vect_create_data_ref): Likewise.
-        (vect_create_destination_var): Likewise.
-
-        (vect_analyze_data_refs): Temporarily restrict vectorizable data refs
-	to ARRYA_RES which base is a VAR_DECL.
-        (vect_create_data_ref): Support only VAR_DECL array base. Mark all
-        vops for renaming.
-
-        (vect_get_array_first_index): New function.
-        (vect_create_index_for_array_ref): Consider array_first_index.
-        (vect_analyze_data_ref_access): Likewise.
-
-        (vect_get_loop_niters): Use number_of_iterations_in_loop.
-        (vect_analyze_loop_form): Don't attempt to vectorize if
-        number_of_iterations == 0.
-
-        (vect_analyze_operations): Fix vectype analysis.
-
-        (vect_create_index_for_array_ref): Fix code insertion in loop prolog.
-        (vect_transform_loop_bound): Likewise.
-
-2004-01-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>,
-	    Devang Patel <dpatel at apple.com>
-
-	* basic-block.h (struct reorder_block_def): Moved from cfglayout.h.
-	(alloc_rbi_pool, initialize_bb_rbi, free_rbi_pool): Declare.
-	* bb-reorder.c (copy_bb, copy_bb_p): Use duplicate_block hooks.
-	* loop-unswitch.c (unswitch_loop): Ditto.
-	* tracer.c (tail_duplicate): Ditto.
-	* tree-ssa-loop.c (copy_loop_headers): Ditto.
-	* cfg.c (rbi_pool): New.
-	(alloc_rbi_pool, free_rbi_pool, initialize_bb_rbi): New functions.
-	* cfghooks.c (can_duplicate_block_p, duplicate_block): New functions.
-	* cfghooks.h (struct cfg_hooks): Add can_duplicate_block_p and
-	duplicate_block hooks.
-	(can_duplicate_block_p, duplicate_block): Declare.
-	* cfglayout.c (cfg_layout_pool): Removed.
-	(cfg_layout_initialize_rbi): Removed.
-	(fixup_reorder_chain): Use initialize_bb_rbi.
-	(cfg_layout_can_duplicate_bb_p, cfg_layout_duplicate_bb):
-	Ir-independent parts moved to cfghooks.c.
-	(cfg_layout_initialize): Use alloc_rbi_pool and initialize_bb_rbi.
-	(cfg_layout_finalize): Use free_rbi_pool.
-	(can_copy_bbs_p): Use can_duplicate_block_p.
-	(copy_bbs): Use duplicate_block.
-	* cfglayout.h (struct reorder_block_def): Moved to basic-block.h
-	(cfg_layout_can_duplicate_bb_p, cfg_layout_duplicate_bb,
-	cfg_layout_initialize_rbi): Declaration removed.
-	* cfgrtl.c (cfg_layout_create_basic_block): Use initialize_bb_rbi.
-	(cfg_layout_rtl_cfg_hooks): Add cfg_layout_can_duplicate_bb_p and
-	cfg_layout_duplicate_bb.
-	* tree-cfg.c (build_tree_cfg): Call alloc_rbi_pool.
-	(create_bb): Call initialize_bb_rbi.
-	(delete_tree_cfg): Call free_rbi_pool.
-	(tree_duplicate_bb): Ir independent parts moved to cfghooks.c.
-	(tree_cfg_hooks): Add tree_can_duplicate_bb_p and tree_duplicate_bb.
-	* tree-flow.h (tree_duplicate_bb): Declaration removed.
-
-2004-01-21  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* tree-alias-common.c (create_alias_vars): Don't use
-	andersen_alias_ops when we don't HAVE_BANSHEE.
-
-	* tree-ssa-loop.c (pass_ch): Remove TODO_verify_ssa.
-
-2004-01-20  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	Merge from tree-ssa branch (lno-merge-20040120).
-
-2004-01-18  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-scalar-evolution.c: (get_loop_exit_condition): Exposed to
-        external usage.
-        * tree-scalar-evolution.h: (get_loop_exit_condition): Exposed to
-        external usage.
-        * tree-vectorizer.c: (vect_is_simple_iv_evolution): Additional argument
-        to control how strict this function would be.
-        (vect_create_index_for_array_ref): Invoke vect_is_simple_iv_evolution
-        with "strict" set to true.
-        (vect_transform_loop_bound): More general loop bound transformation
-        scheme, independent of the loop exit condition form.
-        (vect_analyze_scalar_cycles): Invoke vect_is_simple_iv_evolution with
-        "strict" set to false.
-        (vect_get_loop_niters): Use monev utilities/precomputed info -
-        loop->nb_iterations and get_loop_exit_condition.
-
-2004-01-17  Dorit Naishlos  <dorit at il.ibm.com>
-
-	* tree-vectorizer.c: (vect_get_name_for_new_var): Removed.
-        (vect_get_new_vect_var): New function.  Replaces above function.
-        (vect_create_index_for_array_ref): Call vect_get_new_vect_var
-        instead of vect_get_name_for_new_var.
-        (vect_create_data_ref): Likewise.
-        (vect_create_destination_var): Likewise.
-        * tree-vectorizer.h: (vect_var_kind): New enum type.
-
-2004-01-15  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-chrec.c (remove_initial_condition,
-	add_expr_to_loop_evolution_1, add_expr_to_loop_evolution_2): New functions.
-	(add_expr_to_loop_evolution): Use these functions.
-	(build_polynomial_evolution_in_loop,
-	build_exponential_evolution_in_loop): Move from here...
-	* tree-chrec.h (build_polynomial_evolution_in_loop,
-	build_exponential_evolution_in_loop): Remove declarations.
-	* tree-scalar-evolution.c (build_polynomial_evolution_in_loop,
-	build_exponential_evolution_in_loop): ... to here.  Declare
-	these functions static.
-	(select_outer_and_current_evolutions): New function.
-	(matched_an_increment, scev_analyze_modify_expr,
-	compute_overall_effect_of_inner_loop,
-	analyze_scalar_evolution): Use this function.
-	(add_to_evolution, multiply_evolution): Construct canonical
-	chains of recurrences.
-
-2004-01-14  Dorit Naishlos <dorit at il.ibm.com>
-            Sebastian Pop  <s.pop at laposte.net>
-
-        * tree-vectorizer.c: (vect_is_simple_iv_evolution): Correctly use
-        APIs of the new monev analyzer. Additional argument (loop_num).
-        (vect_transform_loop_bound): Additional argument to
-        vect_is_simple_iv_evolution.
-        (vect_analyze_scalar_cycles): Likewise.
-        (vect_analyze_data_ref_access): Likewise.
-        (vect_get_loop_niters): Likewise.
-
-2004-01-14  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-optimize.c: (optimize_function_tree): Cleanup.
-
-        * tree-vectorizer.h: (DBG_VECT, DBG_VECT2): Removed.
-        (vec_array_base_name_differ_p): Removed.
-        (vec_analyze_array): Removed.
-        (struct _stmt_vec_info): New field: loop.
-        (STMT_VINFO_LOOP): New access function to above new field.
-        (new_stmt_vec_info): Additional argument.
-
-        * tree-vectorizer.c: (vect_is_simple_use): New function.
-        (vect_is_supportable_binop): Added call to vect_is_simple_use().
-        (vect_is_supportable_store): Added call to vect_is_simple_use().
-        (vect_is_supportable_load): Added call to vect_is_simple_use().
-
-        (vect_create_index_for_array_ref): Correct handling of accesses with
-        an offset (e.g, a[i+OFF]).
-        (vect_create_data_ref): Pass STMT as an argument to
-        vect_create_index_for_array_ref, instead of an operand.
-        (vect_transform_store): Handle accesses with an offset.
-        (vect_transform_load): Handle accesses with an offset.
-
-        (vect_create_data_ref): Set the mem_tag of the pointer used for the
-        vector data-access to reflect correct may-alias info.
-
-        (get_address_calculation_operands): Removed.
-        (exist_non_indexing_operands_for_use_p): New function, in place of
-        get_address_calculation_operands() to correctly handle induction (for
-        now this means to detect and not attempt to vectorize computations
-        like a[i]=i).
-        (vect_analyze_scalar_cycles): call above new function instead of
-        get_address_calculation_operands().
-        (vect_mark_stmts_to_be_vectorized): Likewise.
-
-        (get_vectype_for_scalar_type): Added test of VECTOR_MODE_SUPPORTED_P.
-
-        (new_stmt_vec_info): Takes also LOOP as an argument and initializes
-        new field STMT_VINFO_LOOP.
-        (new_loop_vec_info): Pass additional argument to new_stmt_vec_info.
-
-        (vect_stmt_relevant_p): Use flow_bb_inside_loop_p instead of comparing
-        loop->depth's.
-        (vect_analyze_operations): Likewise.
-
-        (vect_align_data_ref): Removed stderr debug printouts, some of which
-        replaced with code dumping dependending on TDF_DETAILS to dump_file.
-        (vect_create_index_for_array_ref): Likewise.
-        (vect_create_destination_var): Likewise.
-        (vect_create_data_ref): Likewise.
-        (vect_transform_binop): Likewise.
-        (vect_transform_store): Likewise.
-        (vect_transform_load): Likewise.
-        (vect_transform_stmt): Likewise.
-        (vect_transform_loop_bound): Likewise.
-        (vect_transform_loop): Likewise.
-        (vect_analyze_operations): Likewise.
-        (vect_is_simple_iv_evolution): Likewise.
-        (vect_analyze_scalar_cycles): Likewise.
-        (vect_analyze_data_ref_dependences): Likewise.
-        (vect_analyze_data_refs): Likewise.
-        (vect_mark_relevant): Likewise.
-        (vect_stmt_relevant_p): Likewise.
-        (vect_mark_stmts_to_be_vectorized): Likewise.
-        (vect_get_loop_niters): Likewise.
-        (vectorize_loops): Likewise.
-
-2004-01-13  Sebastian Pop  <s.pop at laposte.net>
-            Daniel Berlin  <dberlin at dberlin.org>
-
-	* tree-fold-const.h (tree_fold_int_plus, tree_fold_int_minus,
-	tree_fold_int_multiply): Remove NON_LVALUE_EXPR from the
-	answers of the folder.  Fixes bootstraps for powerpc.
-
-2004-01-12  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-chrec.c (chrec_fold_plus, chrec_fold_multiply): Verify
-	that there is no chrecs nested in the operands before calling
-	the folder.
-	(evolution_function_in_loop_num): When there is no evolution
-	in the loop, return the initial condition.
-	(evolution_part_in_loop_num): When there is no evolution
-	in the loop, return NULL_TREE.
-	(chrec_eval_next_init_cond): Adapt the function for the
-	multivariate case.
-	(tree_contains_chrecs): Avoid the use of double negation.
-	* tree-chrec.h (chrec_eval_next_init_cond): Add a parameter
-	for the dimension in which to evaluate the variation.
-	* tree-scalar-evolution.c (is_ssa_name_a_version_of_variable,
-	expression_contains_variable_p, remove_variable_from_expression,
-	analyze_non_gimple_initial_condition, matched_an_increment,
-	matched_an_exponentiation, matched_a_wrap_around,
-	matched_an_arithmetic_wrap_around,
-	evolution_of_phi_already_analyzed_p): New static functions.
-	(scev_analyze_modify_expr): Use these functions.  Refine the
-	cases detected as wrap-around variables.
-	(analyze_initial_condition): Don't erase the evolution in the
-	previous dimensions when computing the initial condition for a
-	new loop.
-	(analyze_evolution_in_loop): Call the scev_analyze_modify_expr
-	on the tree node, not on its evolution.
-	(scev_follow_ssa_edge): In the case of an inner loop-phi-node,
-	when the outer edge is a phi-node follow up the edge.
-	(scev_follow_ssa_edge): Avoid the analysis of the inner loop
-	when it has already been analyzed.
-	(merge_evolutions): Refine the operation for zero, one, and
-	more branches of evolutions.
-
-2004-01-09  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-scalar-evolution.c: New version of the analyzer.
-	* tree-scalar-evolution.h: Same.
-	* tree-chrec.c: Same.
-	* tree-data-ref.c: Same.
-	* tree-chrec.h: Same.
-	* tree-data-ref.h: Same.
-	* tree-fold-const.h: Same.
-
-	* tree-vectorizer.c (vect_transform_loop_bound,
-	vect_analyze_scalar_cycles, vect_analyze_data_ref_access,
-	vect_analyze_data_refs, vect_get_loop_niters): Use the new
-	interface of the analyzer.
-	* tree-optimize.c (optimize_function_tree): Same.
-
-2004-01-08  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfgloop.h (loop_is_included_in): Declaration removed.
-	* tree-scalar-evolution.c (stmt_is_in_loop, stmt_is_not_in_loop,
-	loop_is_included_in): Use existing functions to implement
-	them.
-
-2004-01-06  Sebastian Pop  <s.pop at laposte.net>
-
-	* cfgloop.h (loop_is_included_in, outer_loop, inner_loop,
-	next_loop, loop_num, loop_depth, loop_header,
-	loop_nb_iterations, loop_num_exits, loop_exit_edges,
-	loop_exit_edge): New inline functions.
-	(loop_is_included_in): Declare here.
-	* tree-flow-inline.h (loop_of_stmt): New inline function.
-	* tree-scalar-evolution.c (loop_is_included_in): Remove declaration.
-	(stmt_is_in_loop, stmt_is_not_in_loop): New functions.
-	(loop_is_included_in, loop_is_included_in_rec): Moved up in the same file.
-
-2004-01-06  Dorit Naishlos  <dorit at il.ibm.com>
-
-	* tree-vectorizer.c: Fix typos.
-
-2004-01-05  Andreas Jaeger  <aj at suse.de>
-
-	* tree-vectorizer.h: Follow coding standards, remove extra
-	whitespace.
-	* tree-vectorizer.c: Likewise.
-
-	* tree-vectorizer.c (vectorize_loops): Output statistics to
-	dump_file, fix printf string.
-	(vect_transform_loop): Replace DBG_VECT code with code dumping
-	dependend on TDF_DETAILS to dump_file.
-	(vect_is_supportable_binop): Likewise.
-	(vect_analyze_operations): Likewise.
-	(get_address_calculation_operands): Likewise.
-	(vect_analyze_scalar_cycles): Likewise.
-	(vect_analyze_data_ref_dependence): Likewise.
-	(vect_analyze_data_ref_access): Likewise.
-	(vect_analyze_data_ref_accesses): Likewise.
-	(vect_analyze_data_refs): Likewise.
-	(vect_mark_relevant): Likewise.
-	(vect_get_loop_niters): Likewise.
-	(vect_mark_stmts_to_be_vectorized): Likewise.
-	(vect_analyze_loop_form): Likewise.
-	(vectorize_loops): Likewise.
-
-	* tree-vectorizer.h (DBG_VEC): Remove.
-
-2004-01-04  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* doloop.c (doloop_optimize): Update number of iterations for the
-	loops entered at bottom.
-
-2004-01-04  Andreas Jaeger  <aj at suse.de>
-
-	* common.opt: Re-order some options in ASCII collating orders.
-
-2004-01-03  Zdenek Dvorak  <rakdver at atrey.karlin.mff.cuni.cz>
-
-	* cfghooks.h (struct cfg_hooks): New fields split_block_after_labels
-	and move_block_after, type of cfgh_make_forwarder_block field changed.
-	(HEADER_BLOCK, LATCH_EDGE): Moved to cfgloop.c.
-	(split_block_after_labels, move_block_after): New macros.
-	(make_forwarder_block): Changed.
-	* cfgloop.c (HEADER_BLOCK, LATCH_EDGE): Moved from cfghooks.h.
-	(update_latch_info, mfb_keep_just, mfb_keep_nonlatch,
-	fill_sons_in_loop): New functions.
-	(canonicalize_loop_headers): Changed due to changes in
-	make_forwarder_block.
-	* cfgloopmanip.c (split_loop_bb): Don't update dominators.
-	(create_preheader): Use make_forwarder_block.
-	(mfb_keep_just, mfb_update_loops): New.
-	* cfgrtl.c (rtl_split_block_after_labels): New.
-	(redirect_edge_with_latch_update): Removed.
-	(rtl_make_forwarder_block): New sematics.
-	(rtl_split_block): Update dominators.
-	(rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks):
-	Add rtl_split_block_after_labels.
-	* tree-cfg.c (tree_make_forwarder_block): Changed semantics.
-	(create_blocks_annotations): Removed.
-	(build_tree_cfg): Don't call create_blocks_annotations.
-	(create_bb): Create annotations for a new block.
-	(tree_split_edge): Don't call create_block_annotation.
-	Update irreducible loop information.
-	(tree_loop_optimizer_finalize): Add loop structure check.
-	(tree_redirect_edge_and_branch_1): Return the original edge if
-	no redirecting is neccessary.
-	(tree_split_block): Make the semantics same as for rtl_split_block.
-	(tree_split_block_after_labels, tree_move_block_after): New.
-	(tree_cfg_hooks): Add tree_split_block_after_labels and
-	tree_move_block_after.
-
-	* cfgloopanal.c (mark_irreducible_loops): Fix.
-	* loop-unswitch.c (unswitch_loop): Fix.
-
-	* Makefile.in (tree-ssa-loop.o): Add cfgloop.h and tree-inline.h
-	dependency.
-	* jump.c (next_nonnote_insn_in_loop, duplicate_loop_exit_test,
-	copy_loop_headers): Removed.
-	* rtl.h (copy_loop_headers): Declaration removed.
-	* toplev.c (rest_of_compilation): Do not call loop header copying.
-	* tree-dump.c (dump_files): Add .ch dump.
-	* tree-flow.h (tree_duplicate_bb, copy_loop_headers): Declare.
-	* tree-optimize.c (optimize_function_tree): Add loop header copying
-	pass.
-	* tree-ssa-loop.c: Include cfgloop.h and tree-inline.h.
-	(dump_file, dump_flags): Renamed to loop_dump_file and
-	loop_dump_flags.
-	(call_expr_p, should_duplicate_loop_header_p, copy_loop_headers):
-	New.
-	* tree.h (enum tree_dump_index): Add ch dump.
-	* doc/invoke.texi (-fdump-tree-copy-headers): Document.
-	* testsuite/gcc.dg/tree-ssa/20030711-1.c: Update test outcome.
-	* testsuite/gcc.dg/tree-ssa/20030714-2.c: Ditto.
-	* testsuite/gcc.dg/tree-ssa/copy-headers.c: New test.
-	* tree-cfg.c (tree_duplicate_bb): New function.
-
-	* tree-ssa-loop-im.c: New file.
-	* Makefile.in (tree-ssa-loop-im.o): Add.
-	* params.def (PARAM_LIM_EXPENSIVE): New parameter.
-	* tree-dump.c (dump_files): Move .loop dump.
-	* cfgloop.h (superloop_at_depth, get_loop_body_in_dom_order): Declare.
-	(loop_dump_file, loop_dump_flags): Declare variables.
-	* cfgloop.c (superloop_at_depth, get_loop_body_in_dom_order): New
-	functions.
-	* tree-flow.h (struct stmt_ann_d): Add aux field.
-	(bsi_commit_edge_inserts): Declaration changed.
-	(tree_ssa_lim): Declare.
-	* tree-mudflap.c (mf_xform_derefs_1): Use in_array_bounds_p.
-	* tree-optimize.c (optimize_function_tree): Move loop optimization
-	pass.
-	* tree-sra.c (scalarize_structures): Modified due to
-	bsi_commit_edge_inserts change.
-	* tree-ssa-loop.c (tree_ssa_loop_opt): Call tree_ssa_lim.
-	* tree-ssa.c (rewrite_trees, rewrite_vars_out_of_ssa): Modified due to
-	bsi_commit_edge_inserts change.
-	* tree.c (in_array_bounds_p): New function.
-	* tree.h (in_array_bounds_p): Declare.
-	(enum tree_dump_index): Move loop dump.
-	* tree-cfg.c (bsi_commit_edge_inserts): Don't take update_annotations
-	argument.
-
-	* tree-ssa.c (rewrite_into_ssa, rewrite_out_of_ssa): Ensure that the
-	closed files are not used.
-
-	* tree-tailcall.c (find_tail_calls, eliminate_tail_call): Update
-	phi nodes for vdefs of the eliminated call.
-
-2004-01-03  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-optimize.c (optimize_function_tree): Move the closing brace of
-	DCE2 to the right place.
-
-2004-01-03  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-vectorizer.c (vect_analyze_operations): Test vectorization_factor
-	before computing modulo.
-
-2004-01-02  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-vectorizer.c (vect_is_supportable_binop): Returns false instead
-	of NULL.
-
-2004-01-02  Richard Henderson  <rth at redhat.com>
-
-	* config/i386/i386.h (UNITS_PER_SIMD_WORD): New.
-
-2004-01-02  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-data-ref.c (vec_analyze_array, vec_array_base_name_differ_p,
-	array_base_name_differ_p): Removed for fixing the previous patch.
-
-2004-01-02  Richard Henderson  <rth at redhat.com>
-
-	* target.h (struct gcc_target): Remove vectype_for_scalar_type.
-	* target-def.h (TARGET_VECTYPE_FOR_SCALAR_TYPE): Remove.
-	* config/rs6000/rs6000.c (rs6000_vectype_for_scalar_type): Remove.
-	(TARGET_VECTYPE_FOR_SCALAR_TYPE): Remove.
-
-	* tree.c (build_vector_type_with_mode): Rename from make_vector,
-	remove unsignedp argument, update callers.
-	(build_vector_type): New.
-	* tree.h (build_vector_type): Declare it.
-	* tree-vectorizer.c (get_vectype_for_scalar_type): Use it.
-
-2004-01-02  Richard Henderson  <rth at redhat.com>
-
-	* tree-scalar-evolution.c (finalize_scalar_evolutions_analyzer):
-	Clear dump_file.
-
-2004-01-02  Sebastian Pop  <s.pop at laposte.net>
-
-	* tree-data-ref.c (vec_analyze_array): Renamed to analyze_array.
-	(analyze_array): Removed.
-	(find_data_references): Adapted to use the new analyze_array
-	function.
-	(array_base_name_differ_p): Moved to tree-data-ref.h.
-	(vec_array_base_name_differ_p): Removed.
-	* tree-data-ref.h (array_base_name_differ_p): Moved here.
-	* tree-vectorizer.c (vect_analyze_data_ref_dependence): Use
-	array_base_name_differ_p instead of vec_array_base_name_differ_p.
-	(vect_analyze_data_refs): Use analyze_array instead of
-	vec_analyze_array.
-	(vectorize_loops): Remove the initializers and finalizers of the
-	scalar evolution analyzer.
-
-2004-01-01  Dorit Naishlos <dorit at il.ibm.com>
-
-        * tree-vectorizer.c: New file. Implements loop vectorization
-        pass.
-        * tree-vectorizer.h: New file.
-        * Makefile.in: (tree-vectorizer.c,tree-vectorizer.h): New files.
-        * tree-dump.c: (dump_files): New dump file for the new
-        vectorization pass.
-        * tree.h: (TDI_vect): New dump index for the new vectorization
-        pass.
-        * timevar.def (TV_TREE_VECTORIZATION): Support new
-        vectorization pass.
-        * opts.c: (flag_tree_vetorize): New flag to enable/disable the
-        new vectorization pass.
-        * flags.h: Same.
-        * toplev.c: Same.
-        * common.opt: (ftree-vectorize): Same.
-        * doc/invoke.texi: Document above new options.
-        * tree-optimize.c: (optimize_function_tree): Invoke the new
-        vetorization pass.
-        * tree-flow.h: (struct stmt_ann_d): New field (aux) to allow
-        recording information per stmt.
-        * tree-data-ref.c (vec_analyze_array): New function, exposing
-        API to the vectorizer.
-        (vec_array_base_name_differ_p): New function, exposing API to
-        the vectorizer.
-        * tree-data-ref.h: Same.
-        * defaults.h: (UNITS_PER_SIMD_WORD): Define.
-        * config/rs6000/rs6000.h: (UNITS_PER_SIMD_WORD): Same.
-        * target-def.h (TARGET_VECTYPE_FOR_SCALAR_TYPE): Declare a new
-        target hook for vectorization.
-        * target.h (vectype_for_scalar_type): Same.
-        * config/rs6000/rs6000.c: (rs6000_vectype_for_scalar_type):
-        Implement the above new target hook.
-
-2003-12-31  Sebastian Pop  <s.pop at laposte.net>
-
-	* version.c (version_string): Change the identifier for the
-	sub-branch.
-
-2003-12-31  Sebastian Pop  <s.pop at laposte.net>
-            Daniel Berlin  <dberlin at dberlin.org>
-
-	* tree-phinodes.c (create_phi_node): Initialise PHI_MARKED to 0.
-	* tree-scalar-evolution.c (already_visited,
-	node_already_visited_by_ssa_path): Removed.
-	(analyze_evolution): Remove initialisation of already_visited.
-	(construct_schedule): idem.
-	(monev_follow_ssa_edge): use PHI_MARKED for deciding whether
-	to analyze the phi-node.
-	(follow_ssa_edge_and_record_dependences_rec): idem.
-	* tree.h (PHI_MARKED): New macro.
-	(tree_phi_node): Add a field marked.
-
-2003-12-27  Sebastian Pop  <s.pop at laposte.net>
-
-	* Makefile.in (OBJS-common): Added tree-chrec.o
-	tree-scalar-evolution.o, tree-data-ref.o, tree-fold-const.o.
-	(tree-optimize.o): Add dependencies on tree-fold-const.h
-	tree-chrec.h tree-scalar-evolution.h tree-data-ref.h
-	(tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o,
-	tree-fold-const.o): New rules.
-	* cfgloop.h (loop): New field nb_iterations.
-	(loop_from_num): New function.
-	* common.opt (fscalar-evolutions, fall-data-deps): Added.
-	* flags.h (flag_scalar_evolutions, flag_all_data_deps): Declared.
-	* opts.c (decode_options, common_handle_option): Initialize
-        flag_scalar_evolutions and flag_all_data_deps.
-	* timevar.def (TV_SCALAR_EVOLUTIONS, TV_ALL_DATA_DEPS): New.
-	* toplev.c (flag_scalar_evolutions, flag_all_data_deps): Defined.
-	(lang_independent_options): Add flag_scalar_evolutions and
-	flag_all_data_deps.
-	* tree-dump.c (scev, alldd): New extensions.
-	* tree.h (tree_dump_index): Added TDI_scev and TDI_alldd.
-	* tree-optimize.c (tree-fold-const.h, tree-chrec.h,
-	tree-scalar-evolution.h, tree-data-ref.h): Included.
-	(optimize_function_tree): Added the entry point for the analysis of
-	scalar evolutions and data dependences.
-	* tree-pretty-print.c (tree-fold-const.h, tree-chrec.h): Included.
-	(dump_generic_node): Added code for dumping POLYNOMIAL_CHREC,
-	EXPONENTIAL_CHREC, PERIODIC_CHREC, and INTERVAL_CHREC.
-	* tree.def (INTERVAL_CHREC, POLYNOMIAL_CHREC, EXPONENTIAL_CHREC,
-	PERIODIC_CHREC): New tree nodes.
-	* varray.h (index_in_varray_tree, tree_is_in_varray_tree_p,
-	index_in_varray_int, int_is_in_varray_int_p): New inlined functions.
-	* tree-chrec.c, tree-chrec.h, tree-data-ref.c, tree-data-ref.h,
-	tree-fold-const.c, tree-fold-const.h, tree-scalar-evolution.c,
-	tree-scalar-evolution.h: New files.
-	* doc/invoke.texi (-fdump-scalar-evolutions, -fdump-all-data-deps):
-	Documented.
-	* testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c : New testcases.
-	* testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-[01..50].c.scev: Expected
-	outputs for the scalar evolution analyzer.
-	* testsuite/gcc.dg/tree-ssa-chrec/ssa-chrec-{10, 30, 31, 32, 33, 34,
-	35, 36}.c.alldd: Expected outputs for the data dependence analyzer.
-	* testsuite/gcc.dg/tree-ssa-chrec/tree-ssa-scev.exp: New file.
-	* testsuite/lib/scantree.exp (diff-tree-dumps): New procedure.
-	* ChangeLog.lno: New file.

Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/Makefile.in (original)
+++ llvm-gcc-4.2/trunk/gcc/Makefile.in Thu Nov  8 20:30:15 2007
@@ -1044,7 +1044,7 @@
 C_OBJS = c-lang.o stub-objc.o $(C_AND_OBJC_OBJS)
 
 # Language-independent object files.
-# APPLE LOCAL begin lno, loops-to-memset
+# APPLE LOCAL begin loops-to-memset
 OBJS-common = \
  double-int.o tree-chrec.o tree-scalar-evolution.o tree-data-ref.o	   \
  tree-cfg.o tree-dfa.o tree-eh.o tree-ssa.o tree-optimize.o tree-gimple.o  \
@@ -1066,7 +1066,7 @@
  cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfglayout.o cfgloop.o		   \
  cfgloopanal.o cfgloopmanip.o loop-init.o loop-unswitch.o loop-unroll.o	   \
  cfgrtl.o combine.o conflict.o convert.o coverage.o cse.o cselib.o 	   \
- tree-ssa-loop-prefetch.o  tree-ssa-loop-memset.o \
+ tree-ssa-loop-prefetch.o  \
  dbxout.o ddg.o tree-ssa-loop-ch.o loop-invariant.o tree-ssa-loop-im.o	   \
  debug.o df-core.o df-problems.o df-scan.o dfp.o diagnostic.o dojump.o     \
  dominance.o loop-doloop.o	   					   \
@@ -1092,7 +1092,7 @@
  tree-vrp.o tree-stdarg.o tree-cfgcleanup.o tree-ssa-reassoc.o		   \
  tree-ssa-structalias.o tree-object-size.o 				   \
  rtl-factoring.o
-# APPLE LOCAL end lno, loops-to-memset
+# APPLE LOCAL end loops-to-memset
 
 
 OBJS-md = $(out_object_file)
@@ -2001,20 +2001,11 @@
 convert.o: c-tree.h c-common.h
 # APPLE LOCAL 4133801
 langhooks.o : debug.h
-# APPLE LOCAL begin loops-to-memset
-tree-ssa-loop-memset.o : tree-ssa-loop-memset.c $(TREE_FLOW_H) $(CONFIG_H) \
-   $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) cfgloop.h $(PARAMS_H) tree-inline.h \
-   output.h diagnostic.h $(TM_H) coretypes.h $(TREE_DUMP_H) flags.h \
-   tree-pass.h $(SCEV_H)
-# APPLE LOCAL end loops-to-memset
-# APPLE LOCAL begin lno
-tree-ssa-loop.o : $(TREE_DATA_REF_H) function.h
 tree-ssa-loop-prefetch.o : tree-ssa-loop-prefetch.c $(TREE_FLOW_H) $(CONFIG_H) \
    $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) varray.h $(EXPR_H) \
    output.h diagnostic.h $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
    tree-pass.h $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H)
 tree-ssa-loop-manip.o : tree-inline.h $(FLAGS_H)
-# APPLE LOCAL end lno
 # APPLE LOCAL 4321079 options.h
 cfgloopmanip.o : options.h
 # APPLE LOCAL 4133801

Modified: llvm-gcc-4.2/trunk/gcc/bitmap.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/bitmap.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/bitmap.h (original)
+++ llvm-gcc-4.2/trunk/gcc/bitmap.h Thu Nov  8 20:30:15 2007
@@ -565,9 +565,4 @@
        bmp_iter_and_compl (&(ITER), &(BITNUM));				\
        bmp_iter_next (&(ITER), &(BITNUM)))
 
-/* APPLE LOCAL begin loops-to-memset  */
-/* True if MAP is an empty bitmap.  */
-#define bitmap_empty_p(MAP) (!(MAP)->first)
-/* APPLE LOCAL end loops-to-memset  */
-
 #endif /* GCC_BITMAP_H */

Modified: llvm-gcc-4.2/trunk/gcc/builtins.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/builtins.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/builtins.c (original)
+++ llvm-gcc-4.2/trunk/gcc/builtins.c Thu Nov  8 20:30:15 2007
@@ -199,6 +199,8 @@
 static tree fold_builtin_printf (tree, tree, bool, enum built_in_function);
 static tree fold_builtin_fprintf (tree, tree, bool, enum built_in_function);
 static bool init_target_chars (void);
+/* APPLE LOCAL 3399553 */
+static rtx expand_builtin_flt_rounds (void);
 
 static unsigned HOST_WIDE_INT target_newline;
 static unsigned HOST_WIDE_INT target_percent;
@@ -319,9 +321,9 @@
 	      else if (offset)
 		inner = MIN (inner, BITS_PER_UNIT);
 	    }
-	  if (TREE_CODE (exp) == FUNCTION_DECL)
-	    align = FUNCTION_BOUNDARY;
-	  else if (DECL_P (exp))
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  if (DECL_P (exp))
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	    align = MIN (inner, DECL_ALIGN (exp));
 #ifdef CONSTANT_ALIGNMENT
 	  else if (CONSTANT_CLASS_P (exp))
@@ -595,14 +597,21 @@
       tem = copy_to_reg (tem);
     }
 
+  /* APPLE LOCAL begin ARM reliable backtraces */
   /* For __builtin_frame_address, return what we've got.  But, on
      the SPARC for example, we may have to add a bias.  */
   if (fndecl_code == BUILT_IN_FRAME_ADDRESS)
+    {
+      current_function_calls_builtin_frame_addr = 1;
 #ifdef FRAME_ADDR_RTX
-    return FRAME_ADDR_RTX (tem);
+      return FRAME_ADDR_RTX (tem);
 #else
-    return tem;
+      return tem;
 #endif
+    }
+  else
+    current_function_calls_builtin_ret_addr = 1;
+  /* APPLE LOCAL begin ARM reliable backtraces */
 
   /* For __builtin_return_address, get the return address from that frame.  */
 #ifdef RETURN_ADDR_RTX
@@ -690,12 +699,18 @@
 #ifdef HAVE_nonlocal_goto
   if (! HAVE_nonlocal_goto)
 #endif
+/* APPLE LOCAL begin ARM reliable backtraces */
+/* If we have chosen a different definition of
+   builtin_setjmp_frame_value, then it's up to us to manually restore
+   it as needed in builtin_setjmp_receiver.  */
+  if (targetm.builtin_setjmp_frame_value () == virtual_stack_vars_rtx)
     {
       emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx);
       /* This might change the hard frame pointer in ways that aren't
 	 apparent to early optimization passes, so force a clobber.  */
       emit_insn (gen_rtx_CLOBBER (VOIDmode, hard_frame_pointer_rtx));
     }
+/* APPLE LOCAL end ARM reliable backtraces */
 
 #if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
   if (fixed_regs[ARG_POINTER_REGNUM])
@@ -4272,8 +4287,10 @@
 
   /* va_list pointer is aligned to PARM_BOUNDARY.  If argument actually
      requires greater alignment, we must perform dynamic alignment.  */
+  /* APPLE LOCAL begin unbreak ppc64 abi 5103220 */
   if (boundary > align
-      && !integer_zerop (TYPE_SIZE (type)))
+      /* && !integer_zerop (TYPE_SIZE (type)) */)
+  /* APPLE LOCAL end unbreak ppc64 abi 5103220 */
     {
       t = fold_convert (TREE_TYPE (valist), size_int (boundary - 1));
       t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
@@ -4590,6 +4607,11 @@
   result = allocate_dynamic_stack_space (op0, target, BITS_PER_UNIT);
   result = convert_memory_address (ptr_mode, result);
 
+  /* APPLE LOCAL begin ARM 5051776 */
+  /* EH with sjlj needs to know when the stack layout has changed.  */
+  emit_note (NOTE_INSN_ALLOCA);
+  /* APPLE LOCAL end ARM 5051776 */
+
   return result;
 }
 /* APPLE LOCAL begin mainline bswap */
@@ -6509,6 +6531,11 @@
       maybe_emit_sprintf_chk_warning (exp, fcode);
       break;
 
+    /* APPLE LOCAL begin 3399553 */
+    case BUILT_IN_FLT_ROUNDS:
+      return expand_builtin_flt_rounds ();
+    /* APPLE LOCAL end 3399553 */
+
     default:	/* just do library call, if unknown builtin */
       break;
     }
@@ -11314,3 +11341,26 @@
     }
   return true;
 }
+
+/* APPLE LOCAL begin 3399553 */
+
+/* Evaluate FLT_ROUNDS, whose value is dependent upon the current
+   rounding mode and which may be changed by a call to fesetround.  */
+
+static rtx
+expand_builtin_flt_rounds (void)
+{
+#ifdef HAVE_flt_rounds
+  if (HAVE_flt_rounds)
+    {
+      rtx target = gen_reg_rtx (TYPE_MODE (integer_type_node));
+      emit_insn (gen_flt_rounds (target));
+      return target;
+    }
+  else
+#endif
+  /* Default: round to nearest.  */
+  return const1_rtx;
+}
+/* APPLE LOCAL end 3399553 */
+

Modified: llvm-gcc-4.2/trunk/gcc/builtins.def
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/builtins.def?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/builtins.def (original)
+++ llvm-gcc-4.2/trunk/gcc/builtins.def Thu Nov  8 20:30:15 2007
@@ -240,6 +240,8 @@
 DEF_LIB_BUILTIN        (BUILT_IN_FLOOR, "floor", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LIST)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FLOORF, "floorf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LIST)
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FLOORL, "floorl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LIST)
+/* APPLE LOCAL 3399553 */
+DEF_GCC_BUILTIN        (BUILT_IN_FLT_ROUNDS, "flt_rounds", BT_FN_INT, ATTR_NOTHROW_LIST)
 DEF_C99_BUILTIN        (BUILT_IN_FMA, "fma", BT_FN_DOUBLE_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_FMAF, "fmaf", BT_FN_FLOAT_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
 DEF_C99_BUILTIN        (BUILT_IN_FMAL, "fmal", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING)

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.c Thu Nov  8 20:30:15 2007
@@ -486,13 +486,6 @@
 int flag_preprocessed = 0;
 /* APPLE LOCAL end private extern  Radar 2872481 --ilr */
 
-/* APPLE LOCAL begin structor thunks */
-/* Nonzero if we prefer to clone con/de/structors.  Alternative is to
-   gen multiple tiny thunk-esque things that call/jump to a unified
-   con/de/structor.  This is a classic size/speed tradeoff.  */
-int flag_clone_structors = 0;
-/* APPLE LOCAL end structor thunks */
-
 /* Nonzero means to generate thread-safe code for initializing local
    statics.  */
 
@@ -556,22 +549,23 @@
    not quite the same as any of the states of iasm_state.  */
 bool inside_iasm_block;
 
+/* This is true if we should kill the registers at the front of the
+   next block.  */
+bool iasm_kill_regs;
+
 /* True when the lexer/parser is handling operands.  */
 bool iasm_in_operands;
 
 /* Working buffer for building the assembly string.  */
 static char *iasm_buffer;
 
-/* Two arrays used as a map from user-supplied labels, local to an asm
-   block, to unique global labels that the assembler will like.  */
-static GTY(()) varray_type iasm_labels;
-static GTY(()) varray_type iasm_labels_uniq;
 static tree iasm_identifier (tree expr);
 
 /* Return true iff the opcode wants memory to be stable.  We arrange
    for a memory clobber in these instances.  */
 extern bool iasm_memory_clobber (const char *);
-static tree iasm_get_label (tree);
+static tree iasm_lookup_label (tree);
+static tree iasm_define_label (tree);
 /* APPLE LOCAL end CW asm blocks */
 
 static tree handle_packed_attribute (tree *, tree, tree, int, bool *);
@@ -2661,8 +2655,8 @@
 		     Hope it doesn't break something else.  */
 		  | TREE_THIS_VOLATILE (array));
 	    r = fold (r);
-	    r = build1 (ADDR_EXPR, result_type, r);
-	    r = fold (r);
+	    r = fold_build1 (ADDR_EXPR, result_type, r);
+	    fold_undefer_and_ignore_overflow_warnings ();
 	    return r;
 	  }
       }
@@ -4595,7 +4589,10 @@
       if (TREE_CODE (decl) == PARM_DECL
 	  || TREE_CODE (decl) == VAR_DECL
 	  || TREE_CODE (decl) == FUNCTION_DECL
-	  || TREE_CODE (decl) == LABEL_DECL
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  || (TREE_CODE (decl) == LABEL_DECL
+	      && ! DECL_ARTIFICIAL (decl))
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	  || TREE_CODE (decl) == TYPE_DECL)
 	TREE_USED (decl) = 1;
       else
@@ -5043,7 +5040,10 @@
       TYPE_USER_ALIGN (*type) = 1;
     }
   else if (TREE_CODE (decl) != VAR_DECL
-	   && TREE_CODE (decl) != FIELD_DECL)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	   && TREE_CODE (decl) != FIELD_DECL
+	   && TREE_CODE (decl) != LABEL_DECL)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
     {
       error ("alignment may not be specified for %q+D", decl);
       *no_add_attrs = true;
@@ -5565,7 +5565,6 @@
 	  || objc_method_decl (TREE_CODE (decl)))
 	  /* APPLE LOCAL end radar 3803157 - objc attribute */
 	{
-	  TREE_DEPRECATED (decl) = 1;
 	  TREE_UNAVAILABLE (decl) = 1;
 	}
       else
@@ -5575,7 +5574,6 @@
     {
       if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
 	*node = build_variant_type_copy (*node);
-      TREE_DEPRECATED (*node) = 1;
       TREE_UNAVAILABLE (*node) = 1;
       type = *node;
     }
@@ -7133,7 +7131,8 @@
       /* This is the default constraint used for all instructions.  */
 #if defined(TARGET_TOC)
       s = "+b";
-#elif defined(TARGET_386)
+/* APPLE LOCAL ARM CW asm */
+#elif defined(TARGET_386) || defined(TARGET_ARM)
       s = "+r";
 #endif
     }
@@ -7142,7 +7141,8 @@
 
   if (TREE_CODE (var) == FUNCTION_DECL)
     {
-#if defined(TARGET_TOC)
+/* APPLE LOCAL ARM CW asm */
+#if defined(TARGET_TOC) || defined(TARGET_ARM)
       str = build_string (1, "s");
 #elif defined (TARGET_386)
       str = build_string (strlen (s), s);
@@ -7167,7 +7167,8 @@
 	    /* This is the default constraint used for all instructions.  */
 #if defined(TARGET_TOC)
 	    str = build_string (2, "+b");
-#elif defined(TARGET_386)
+/* APPLE LOCAL ARM CW asm */
+#elif defined(TARGET_386) || defined(TARGET_ARM)
 	    str = build_string (2, "+r");
 #endif
 	  }
@@ -7558,6 +7559,46 @@
   if (iasm_buffer == NULL)
     iasm_buffer = xmalloc (4000);
 
+#ifdef TARGET_386
+  if (iasm_kill_regs)
+    {
+      iasm_kill_regs = false;
+      /* One cannot use these registers across inline asm blocks per
+	 MS docs.  We explicitly kill them to ensure that the register
+	 allocator can use them as it sees fit.  We really only have
+	 to kill the registers used in the block, but, until we
+	 understand the entire block perfectly, this is conservatively
+	 correct.  The down side, we can't enregister variables into
+	 any of these registers across an asm block and we use 3 words
+	 more stack space to save ebx/esi/edi.  */
+      clobbers = tree_cons (NULL_TREE,
+			    build_string (3, "eax"),
+			    clobbers);
+      if (MACHO_DYNAMIC_NO_PIC_P)
+	clobbers = tree_cons (NULL_TREE,
+			      build_string (3, "ebx"),
+			      clobbers);
+      clobbers = tree_cons (NULL_TREE,
+			    build_string (3, "ecx"),
+			    clobbers);
+      clobbers = tree_cons (NULL_TREE,
+			    build_string (3, "edx"),
+			    clobbers);
+      clobbers = tree_cons (NULL_TREE,
+			    build_string (3, "esi"),
+			    clobbers);
+      clobbers = tree_cons (NULL_TREE,
+			    build_string (3, "edi"),
+			    clobbers);
+      sprintf(iasm_buffer, "%s top of block", ASM_COMMENT_START);
+      sexpr = build_string (strlen (iasm_buffer), iasm_buffer);
+      stmt = build_stmt (ASM_EXPR, sexpr, NULL_TREE, NULL_TREE, clobbers, NULL_TREE);
+      clobbers = NULL_TREE;
+      ASM_VOLATILE_P (stmt) = 1;
+      (void)add_stmt (stmt);
+    }
+#endif
+
   /* Build .file "file-name" directive. */
   sprintf(iasm_buffer, "%s \"%s\"", ".file", input_filename);
   sexpr = build_string (strlen (iasm_buffer), iasm_buffer);
@@ -7842,7 +7883,10 @@
      clobbering memory anyway with iasm_memory_clobber.  */
   if (! (TREE_CODE (arg) == VAR_DECL && DECL_HARD_REGISTER (arg))
       && e->dat[e->num].constraint == 0)
-    iasm_force_constraint ("m", e);
+    {
+      lang_hooks.mark_addressable (arg);
+      iasm_force_constraint ("m", e);
+    }
 #endif
   iasm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
 #if defined (TARGET_386)
@@ -7876,7 +7920,6 @@
       break;
 
     case LABEL_DECL:
-      TREE_USED (arg) = 1;
       if (e->no_label_map
 	  && strncmp (IDENTIFIER_POINTER (DECL_NAME (arg)),
 		      "LASM$", 5) == 0)
@@ -7893,9 +7936,14 @@
 	    }
 #endif
 	  /* APPLE LOCAL end remove when 4512478 is fixed */
+	  TREE_USED (arg) = 1;
+	  DECL_SOURCE_LOCATION (arg) = input_location;
+	  /* Mark label as having been defined.  */
+	  DECL_INITIAL (arg) = error_mark_node;
 	  sprintf (buf + strlen (buf), "%s", name);
 	  break;
 	}
+      TREE_USED (arg) = 1;
       IASM_OFFSET_PREFIX (e, buf);
       arg = build1 (ADDR_EXPR, ptr_type_node, arg);
       /* There was no other spelling I could find that would work.
@@ -8228,20 +8276,11 @@
   if (iasm_buffer == NULL)
     iasm_buffer = xmalloc (4000);
 
-  if (TREE_CODE (labid) == INTEGER_CST)
-    {
-      /* In C, for asm @ 1: nop, we can't switch the lexer
-	 fast enough to see the number as an identifier, so
-	 we also allow INTEGER_CST.  */
-      sprintf (iasm_buffer, HOST_WIDE_INT_PRINT_UNSIGNED, tree_low_cst (labid, 0));
-      labid = get_identifier (iasm_buffer);
-    }
-
   if (atsign)
     labid = prepend_char_identifier (labid, '@');
 
   iasm_buffer[0] = '\0';
-  label = iasm_get_label (labid);
+  label = iasm_define_label (labid);
 /* LLVM LOCAL begin */
 #if 1
 /* LLVM LOCAL end */
@@ -8259,18 +8298,17 @@
 	nop
 	jmp L2
 
-     for some odd reason.  The statement list seems correct.  */
+     because the backend knows that asms can't do jumps, and since
+     there are no found non-asm jumps, the label isn't `used' and so
+     can be deleted.  It knows there is a reference to the label, so,
+     it merely moves it to the top of the previous basic block.
+     Because of this we have to hide the fact this is a label.  */
   
   stmt = add_stmt (build_stmt (LABEL_EXPR, label));
 #else
-#if 0
-  strcat (iasm_buffer, IDENTIFIER_POINTER (DECL_NAME (label)));
-  strcat (iasm_buffer, ":");
-#else
   /* Arrange for the label to be a parameter to the ASM_EXPR, as only then will the
      backend `manage it' for us, say, making a unique copy for inline expansion.  */
   sprintf (iasm_buffer, "%%l0: # %s", IDENTIFIER_POINTER (DECL_NAME (label)));
-#endif
 
   l = build1 (ADDR_EXPR, ptr_type_node, label);
 
@@ -8316,20 +8354,13 @@
   return get_identifier (buf);
 }
 
-void
-iasm_clear_labels (void)
-{
-  if (!iasm_labels)
-    VARRAY_TREE_INIT (iasm_labels, 40, "iasm_labels");
-  if (!iasm_labels_uniq)
-    VARRAY_TREE_INIT (iasm_labels_uniq, 40, "iasm_labels_uniq");
-  VARRAY_POP_ALL (iasm_labels);
-  VARRAY_POP_ALL (iasm_labels_uniq);
-}
-
 static GTY(()) tree iasm_ha16;
 static GTY(()) tree iasm_hi16;
 static GTY(()) tree iasm_lo16;
+/* APPLE LOCAL begin ARM CW asm */
+static GTY(()) tree cw_cpsr;
+static GTY(()) tree cw_cpsr_c;
+/* APPLE LOCAL end ARM cw_asm */
 
 /* Given an identifier not otherwise found in the high level language, create up
    a meaning for it.  */
@@ -8370,7 +8401,7 @@
 #endif
 
   /* Assume undeclared symbols are labels. */
-  return iasm_get_label (id);
+  return iasm_lookup_label (id);
 }
 
 /* Given a label identifier and a flag indicating whether it had an @
@@ -8378,9 +8409,8 @@
    assembler will like.  */
 
 static tree
-iasm_get_label (tree labid)
+iasm_lookup_label (tree labid)
 {
-  unsigned int n;
   const char *labname;
   char *buf;
   tree newid;
@@ -8390,6 +8420,12 @@
       iasm_ha16 = get_identifier ("ha16");
       iasm_hi16 = get_identifier ("hi16");
       iasm_lo16 = get_identifier ("lo16");
+/* APPLE LOCAL begin ARM CW asm */
+#if defined(TARGET_ARM)
+      cw_cpsr = get_identifier ("cpsr");
+      cw_cpsr_c = get_identifier ("cpsr_c");
+#endif
+/* APPLE LOCAL end ARM CW asm */
     }
 
   /* lo16(), ha16() and hi16() should be left unmolested.  */
@@ -8400,13 +8436,42 @@
   else if (labid == iasm_hi16)
     return iasm_hi16;
 
-  for (n = 0; n < VARRAY_ACTIVE_SIZE (iasm_labels); ++n)
+/* APPLE LOCAL begin ARM CW asm */
+#if defined(TARGET_ARM)
+  if (labid == cw_cpsr)
+    return cw_cpsr;
+  else if (labid == cw_cpsr_c)
+    return cw_cpsr_c;
+#endif
+/* APPLE LOCAL end ARM CW asm */
+
+  buf = (char *) alloca (IDENTIFIER_LENGTH (labid) + 20);
+  sprintf (buf, "LASM$");
+  /* Assembler won't like a leading @-sign, so make it into a $ if
+     seen.  */
+  labname = IDENTIFIER_POINTER (labid);
+  if (*labname == '@')
     {
-      if (labid == VARRAY_TREE (iasm_labels, n))
-	return VARRAY_TREE (iasm_labels_uniq, n);
+      strcat (buf, "$");
+      ++labname;
     }
-  /* Not already seen, make up a label.  */
-  VARRAY_PUSH_TREE (iasm_labels, labid);
+  strcat (buf, labname);
+  newid = get_identifier (buf);
+  newid = lookup_label (newid);
+  return newid;
+}
+
+/* Given a label identifier and a flag indicating whether it had an @
+   preceding it, return a synthetic and unique label that the
+   assembler will like.  */
+
+static tree
+iasm_define_label (tree labid)
+{
+  const char *labname;
+  char *buf;
+  tree newid;
+
   buf = (char *) alloca (IDENTIFIER_LENGTH (labid) + 20);
   sprintf (buf, "LASM$");
   /* Assembler won't like a leading @-sign, so make it into a $ if
@@ -8420,7 +8485,6 @@
   strcat (buf, labname);
   newid = get_identifier (buf);
   newid = define_label (input_location, newid);
-  VARRAY_PUSH_TREE (iasm_labels_uniq, newid);
   return newid;
 }
 

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-common.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-common.h Thu Nov  8 20:30:15 2007
@@ -625,14 +625,6 @@
 
 extern int flag_enforce_eh_specs;
 
-/* APPLE LOCAL begin structor thunks */
-/* Nonzero if we prefer to clone con/de/structors.
-   Alternative is to gen multiple tiny thunk-esque things that
-   call/jump to a unified con/de/structor.  This is a classic
-   size/speed tradeoff.  */
-extern int flag_clone_structors;
-/* APPLE LOCAL end structor thunks */
-
 /* APPLE LOCAL begin private extern  Radar 2872481 --ilr */
 /* Nonzero if -fpreprocessed specified.  This is needed by init_reswords()
    so that it can make __private_extern__ have the same rid code as extern
@@ -802,13 +794,6 @@
 #define STATEMENT_LIST_HAS_LABEL(NODE) \
   TREE_LANG_FLAG_3 (STATEMENT_LIST_CHECK (NODE))
 
-/* APPLE LOCAL begin C* language */
-/* Used as a flag to indicate synthesized inner do-while loop of a 
-   foreach statement.  Used for generation of break/continue statement 
-   of the loop. */
-#define DO_FOREACH(NODE)           TREE_OPERAND (DO_STMT_CHECK (NODE), 2)
-/* APPLE LOCAL end C* language */
-
 /* COMPOUND_LITERAL_EXPR accessors.  */
 #define COMPOUND_LITERAL_EXPR_DECL_STMT(NODE)		\
   TREE_OPERAND (COMPOUND_LITERAL_EXPR_CHECK (NODE), 0)
@@ -1004,7 +989,8 @@
 extern tree objc_is_id (tree);
 extern void objc_declare_alias (tree, tree);
 extern void objc_declare_class (tree);
-extern void objc_declare_protocols (tree);
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+extern void objc_declare_protocols (tree, tree);
 extern tree objc_build_message_expr (tree);
 extern tree objc_finish_message_expr (tree, tree, tree);
 extern tree objc_build_selector_expr (tree);
@@ -1021,13 +1007,12 @@
 /* APPLE LOCAL radar 4548636 */
 extern void objc_start_class_interface (tree, tree, tree, tree);
 extern void objc_start_category_interface (tree, tree, tree);
-extern void objc_start_protocol (tree, tree);
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+extern void objc_start_protocol (tree, tree, tree);
 extern void objc_continue_interface (void);
 extern void objc_finish_interface (void);
 extern void objc_start_class_implementation (tree, tree);
 extern void objc_start_category_implementation (tree, tree);
-/* APPLE LOCAL radar 4533974 - ObjC new protocol */
-extern void objc_protocol_implementation (tree);
 /* APPLE LOCAL radar 4592503 */
 extern void objc_checkon_weak_attribute (tree);
 extern void objc_continue_implementation (void);

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-decl.c Thu Nov  8 20:30:15 2007
@@ -4191,7 +4191,7 @@
 
   /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
   if (declspecs->unavailable_p)
-    warn_unavailable_use (declspecs->type);
+    error_unavailable_use (declspecs->type);
   else
   /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
   if (declspecs->deprecated_p && deprecated_state != DEPRECATED_SUPPRESS)
@@ -5569,12 +5569,20 @@
 	    error ("nested redefinition of %<union %E%>", name);
 	  else
 	    error ("nested redefinition of %<struct %E%>", name);
+            /* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+            /* Don't create structures that contain themselves.  */
+            ref = NULL_TREE;
+            /* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 	}
     }
-  else
-    {
-      /* Otherwise create a forward-reference just so the tag is in scope.  */
+  /* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+  /* Otherwise create a forward-reference just so the tag is in scope.  */
+  /* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 
+  /* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+  if (ref == NULL_TREE || TREE_CODE (ref) != code)
+    {
+  /* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
       ref = make_node (code);
       pushtag (name, ref);
     }

Modified: llvm-gcc-4.2/trunk/gcc/c-lex.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-lex.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-lex.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-lex.c Thu Nov  8 20:30:15 2007
@@ -436,7 +436,6 @@
 	    {
 	      iasm_state = iasm_asm;
 	      inside_iasm_block = true;
-	      iasm_clear_labels ();
 	    }
 	  else
 	    {
@@ -610,7 +609,7 @@
 	   out with or eat as a comment as appropriate.  */
 	if (flag_iasm_blocks_local)
 	  {
-	    *value = NULL;
+	    *value = build_int_cst_wide (char_type_node, c, 0);
 	    break;
 	  }
 	/* APPLE LOCAL end CW asm blocks C++ comments 4248139 */

Modified: llvm-gcc-4.2/trunk/gcc/c-opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-opts.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-opts.c Thu Nov  8 20:30:15 2007
@@ -716,12 +716,6 @@
       flag_signed_char = !value;
       break;
 
-      /* APPLE LOCAL begin structor decloning */
-    case OPT_fclone_structors:
-      flag_clone_structors = value;
-      break;
-      /* APPLE LOCAL end structor decloning */
-
     case OPT_fcheck_new:
       flag_check_new = value;
       break;

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-parser.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-parser.c Thu Nov  8 20:30:15 2007
@@ -661,6 +661,8 @@
 	{
 	case RID_STATIC:
 	case RID_EXTERN:
+	  /* APPLE LOCAL private extern 5487726 */
+	case RID_PRIVATE_EXTERN:
 	case RID_REGISTER:
 	case RID_TYPEDEF:
 	case RID_INLINE:
@@ -1162,7 +1164,8 @@
 static void c_parser_objc_class_instance_variables (c_parser *);
 static void c_parser_objc_class_declaration (c_parser *);
 static void c_parser_objc_alias_declaration (c_parser *);
-static void c_parser_objc_protocol_definition (c_parser *);
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+static void c_parser_objc_protocol_definition (c_parser *, tree);
 static enum tree_code c_parser_objc_method_type (c_parser *);
 static void c_parser_objc_method_definition (c_parser *);
 /* APPLE LOCAL C* property (Radar 4436866) (in 4.2 b) */
@@ -1279,8 +1282,10 @@
 	  break;
 	case RID_AT_PROTOCOL:
 	  gcc_assert (c_dialect_objc ());
-	  c_parser_objc_protocol_definition (parser);
+	  /* APPLE LOCAL begin radar 4947311 - protocol attributes */
+	  c_parser_objc_protocol_definition (parser, NULL_TREE);
 	  break;
+	  /* APPLE LOCAL end radar 4947311 - protocol attributes */
 	  /* APPLE LOCAL begin C* property (Radar 4436866) (in 4.2 x) */
 	case RID_AT_PROPERTY:
 	  c_parser_objc_property_declaration (parser);
@@ -1437,6 +1442,17 @@
       return;
     }
   /* APPLE LOCAL end radar 4548636 - class attributes. */
+  /* APPLE LOCAL begin radar 4947311 - protocol attributes */
+  else if (c_parser_next_token_is_keyword (parser, RID_AT_PROTOCOL))
+    {
+      gcc_assert (c_dialect_objc ());
+      if (!specs->declspecs_seen_p || specs->attrs == NULL_TREE
+	  || specs->type_seen_p || specs->non_sc_seen_p)
+	c_parser_error (parser, "no type or storage class may be specified here");
+      c_parser_objc_protocol_definition (parser, specs->attrs);
+      return;
+    }
+  /* APPLE LOCAL end radar 4947311 - protocol attributes */
   pending_xref_error ();
   prefix_attrs = specs->attrs;
   all_prefix_attrs = prefix_attrs;
@@ -3091,6 +3107,8 @@
 		case RID_LONG:
 		case RID_CONST:
 		case RID_EXTERN:
+		  /* APPLE LOCAL private extern 5487726 */
+		case RID_PRIVATE_EXTERN:
 		case RID_REGISTER:
 		case RID_TYPEDEF:
 		case RID_SHORT:
@@ -4056,6 +4074,7 @@
 	{
 	  iasm_state = iasm_asm;
 	  inside_iasm_block = true;
+	  iasm_kill_regs = true;
 	  iasm_in_decl = false;
 	  c_parser_iasm_line_seq_opt (parser);
 	  stmt = NULL_TREE;
@@ -4201,16 +4220,25 @@
 /* Parse a while statement (C90 6.6.5, C99 6.8.5).
 
    while-statement:
-      while (expression) statement
+   APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+      while attributes (expression) statement
+
+   The use of attributes is a GNU extension.
+   APPLE LOCAL end for-fsf-4_4 3274130 5295549
 */
 
 static void
 c_parser_while_statement (c_parser *parser)
 {
-  tree block, cond, body, save_break, save_cont;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  tree block, cond, body, save_break, save_cont, attrs;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   location_t loc;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_WHILE));
   c_parser_consume_token (parser);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  attrs = c_parser_attributes (parser);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   block = c_begin_compound_stmt (flag_isoc99);
   loc = c_parser_peek_token (parser)->location;
   cond = c_parser_paren_condition (parser);
@@ -4219,7 +4247,10 @@
   save_cont = c_cont_label;
   c_cont_label = NULL_TREE;
   body = c_parser_c99_block_statement (parser);
-  c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, true);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, attrs,
+		 true);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   add_stmt (c_end_compound_stmt (block, flag_isoc99));
   c_break_label = save_break;
   c_cont_label = save_cont;
@@ -4228,16 +4259,25 @@
 /* Parse a do statement (C90 6.6.5, C99 6.8.5).
 
    do-statement:
-     do statement while ( expression ) ;
+   APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+     do attributes statement while ( expression ) ;
+
+   The use of attributes is a GNU extension.
+   APPLE LOCAL end for-fsf-4_4 3274130 5295549
 */
 
 static void
 c_parser_do_statement (c_parser *parser)
 {
-  tree block, cond, body, save_break, save_cont, new_break, new_cont;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  tree block, cond, body, save_break, save_cont, new_break, new_cont, attrs;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   location_t loc;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_DO));
   c_parser_consume_token (parser);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  attrs = c_parser_attributes (parser);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   block = c_begin_compound_stmt (flag_isoc99);
   loc = c_parser_peek_token (parser)->location;
   save_break = c_break_label;
@@ -4253,18 +4293,26 @@
   cond = c_parser_paren_condition (parser);
   if (!c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>"))
     c_parser_skip_to_end_of_block_or_statement (parser);
-  c_finish_loop (loc, cond, NULL, body, new_break, new_cont, false);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  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));
 }
 
 /* Parse a for statement (C90 6.6.5, C99 6.8.5).
 
    for-statement:
-     for ( expression[opt] ; expression[opt] ; expression[opt] ) statement
-     for ( nested-declaration expression[opt] ; expression[opt] ) statement
+   APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+     for attributes ( expression[opt] ; expression[opt] ; expression[opt] ) \
+         statement
+     for attributes ( nested-declaration expression[opt] ; expression[opt] ) \
+         statement
 
    The form with a declaration is new in C99.
 
+   The use of attributes is a GNU extension.
+
+   APPLE LOCAL end for-fsf-4_4 3274130 5295549
    ??? In accordance with the old parser, the declaration may be a
    nested function, which is then rejected in check_for_loop_decls,
    but does it make any sense for this to be included in the grammar?
@@ -4276,13 +4324,18 @@
 static void
 c_parser_for_statement (c_parser *parser)
 {
-  tree block, cond, incr, save_break, save_cont, body;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  tree block, cond, incr, save_break, save_cont, body, attrs;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   location_t loc;
   /* APPLE LOCAL radar 4708210 (for_objc_collection in 4.2) */
   bool foreach_p = false;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_FOR));
   loc = c_parser_peek_token (parser)->location;
   c_parser_consume_token (parser);
+/* 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 4472881 (in 4.2 ah) */
   block = c_begin_compound_stmt (flag_isoc99 || c_dialect_objc ());
   if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
@@ -4399,7 +4452,10 @@
   if (foreach_p)
     objc_finish_foreach_loop (loc, cond, body, c_break_label, c_cont_label);
   else
-    c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+    c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, attrs,
+		   true);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   /* 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 ()));
@@ -4461,17 +4517,18 @@
 	{
 	  c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, NULL);
 	  c_parser_error (parser, "asm blocks not enabled, use `-fasm-blocks'");
+ 	  iasm_state = iasm_none;
 	}
       return NULL_TREE;
     }
   if (quals == NULL_TREE
       && (c_parser_next_token_is (parser, CPP_DOT)
-	  || c_parser_next_token_is (parser, CPP_ATSIGN)
-	  || c_parser_next_token_is (parser, CPP_NAME)
-	  || c_parser_next_token_is_keyword (parser, RID_ASM)
-	  || c_parser_next_token_is (parser, CPP_SEMICOLON)
-	  || (c_parser_iasm_bol (parser)
-	      && ! c_parser_next_token_is (parser, CPP_OPEN_PAREN))))
+ 	  || c_parser_next_token_is (parser, CPP_ATSIGN)
+ 	  || c_parser_next_token_is (parser, CPP_NAME)
+ 	  || c_parser_next_token_is_keyword (parser, RID_ASM)
+ 	  || c_parser_next_token_is (parser, CPP_SEMICOLON)
+ 	  || (c_parser_iasm_bol (parser)
+ 	      && ! c_parser_next_token_is (parser, CPP_OPEN_PAREN))))
     {
       if (flag_iasm_blocks)
 	c_parser_iasm_top_statement (parser);
@@ -5869,6 +5926,29 @@
 	      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");
@@ -6152,14 +6232,6 @@
   else
     gcc_unreachable ();
   c_parser_consume_token (parser);
-  /* APPLE LOCAL begin radar 4533974 - ObjC new protocol (in 4.2 v) */
-  if (c_parser_next_token_is (parser, CPP_LESS))
-    {
-      tree proto = c_parser_objc_protocol_refs (parser);
-      objc_protocol_implementation (proto);
-      return;
-    }
-  /* APPLE LOCAL end radar 4533974 - ObjC new protocol (in 4.2 v) */
   if (c_parser_next_token_is_not (parser, CPP_NAME))
     {
       /* APPLE LOCAL radar 4533974 - ObjC new protocol (in 4.2 v) */
@@ -6615,7 +6687,8 @@
    omitted.  */
 
 static void
-c_parser_objc_protocol_definition (c_parser *parser)
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+c_parser_objc_protocol_definition (c_parser *parser, tree attributes)
 {
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_AT_PROTOCOL));
   c_parser_consume_token (parser);
@@ -6647,7 +6720,8 @@
 	    break;
 	}
       c_parser_skip_until_found (parser, CPP_SEMICOLON, "expected %<;%>");
-      objc_declare_protocols (list);
+      /* APPLE LOCAL radar 4947311 - protocol attributes */
+      objc_declare_protocols (list, attributes);
     }
   else
     {
@@ -6657,7 +6731,8 @@
       if (c_parser_next_token_is (parser, CPP_LESS))
 	proto = c_parser_objc_protocol_refs (parser);
       objc_pq_context = 1;
-      objc_start_protocol (id, proto);
+      /* APPLE LOCAL radar 4947311 - protocol attributes */
+      objc_start_protocol (id, proto, attributes);
       /* APPLE LOCAL C* property (Radar 4436866) (in 4.2 r) */
       c_parser_objc_interfacedecllist (parser);
       c_parser_require_keyword (parser, RID_AT_END, "expected %<@end%>");
@@ -8843,7 +8918,7 @@
 
   iasm_state = iasm_asm;
   inside_iasm_block = true;
-  iasm_clear_labels ();
+  iasm_kill_regs = true;
   stmt = c_begin_compound_stmt (true);
   /* Parse an (optional) statement-seq.  */
   c_parser_iasm_line_seq_opt (parser);
@@ -8863,7 +8938,7 @@
 
   iasm_state = iasm_asm;
   inside_iasm_block = true;
-  iasm_clear_labels ();
+  iasm_kill_regs = true;
   stmt = c_begin_compound_stmt (true);
   if (!c_parser_iasm_bol (parser))
     {    
@@ -9074,6 +9149,17 @@
       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/c-tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-tree.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/c-tree.h Thu Nov  8 20:30:15 2007
@@ -585,7 +585,10 @@
 extern tree c_begin_compound_stmt (bool);
 extern tree c_end_compound_stmt (tree, bool);
 extern void c_finish_if_stmt (location_t, tree, tree, tree, bool);
-extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, tree,
+			   bool);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 extern tree c_begin_stmt_expr (void);
 extern tree c_finish_stmt_expr (tree);
 extern tree c_process_expr_stmt (tree);

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Thu Nov  8 20:30:15 2007
@@ -1871,7 +1871,7 @@
 
 	  /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
 	  if (TREE_UNAVAILABLE (subdatum))
-	    warn_unavailable_use (subdatum);
+	    error_unavailable_use (subdatum);
 	  /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
 
 	  datum = ref;
@@ -2122,7 +2122,14 @@
 	  /* Locals and parms just need to be left alone for now.  */
 	}
       else
-	return iasm_do_id (id);
+	{
+	  location_t save = input_location;
+	  tree r;
+	  input_location = loc;
+	  r = iasm_do_id (id);
+	  input_location = save;
+	  return r;
+	}
     }
   /* APPLE LOCAL end CW asm blocks */
 
@@ -2153,7 +2160,7 @@
 
   /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
   if (TREE_UNAVAILABLE (ref))
-    warn_unavailable_use (ref);
+    error_unavailable_use (ref);
   /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
 
   if (!skip_evaluation)
@@ -2696,14 +2703,24 @@
   struct c_expr result;
 
   /* APPLE LOCAL begin CW asm blocks (in 4.2 bc) */
-  if (inside_iasm_block
-      && code == ADDR_EXPR
-      && TREE_CODE (arg.value) == LABEL_DECL)
+  if (inside_iasm_block)
     {
-      result.original_code = ERROR_MARK;
-      result.value = finish_label_address_expr (DECL_NAME (arg.value));
-      overflow_warning (result.value);
-      return result;
+      if (TREE_CODE (arg.value) == COMPOUND_EXPR)
+	{
+	  tree neg = build_unary_op (code, TREE_OPERAND (arg.value, 0), 0);
+	  tree reg = TREE_OPERAND (arg.value, 1);
+	  result.original_code = ERROR_MARK;
+	  result.value = iasm_build_register_offset (neg, reg);
+	  return result;
+	}
+      else if (code == ADDR_EXPR
+	       && TREE_CODE (arg.value) == LABEL_DECL)
+	{
+	  result.original_code = ERROR_MARK;
+	  result.value = finish_label_address_expr (DECL_NAME (arg.value));
+	  overflow_warning (result.value);
+	  return result;
+	}
     }
   /* APPLE LOCAL end CW asm blocks (in 4.2 bc) */
     
@@ -2753,6 +2770,7 @@
 	    || TREE_CODE (arg1.value) == IDENTIFIER_NODE
 	    || TREE_CODE (arg2.value) == IDENTIFIER_NODE)
         {
+	  error ("block assembly operand not recognized");
           result.value = error_mark_node;
           result.original_code = code;
           return result;
@@ -7379,7 +7397,7 @@
 
 	  /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
 	  if (TREE_UNAVAILABLE (subdatum))
-	    warn_unavailable_use (subdatum);
+	    error_unavailable_use (subdatum);
 	  /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
 
 	  fake_datum = ref;
@@ -7719,15 +7737,22 @@
   add_stmt (stmt);
 }
 
-/* Emit a general-purpose loop construct.  START_LOCUS is the location of
-   the beginning of the loop.  COND is the loop condition.  COND_IS_FIRST
-   is false for DO loops.  INCR is the FOR increment expression.  BODY is
-   the statement controlled by the loop.  BLAB is the break label.  CLAB is
-   the continue label.  Everything is allowed to be NULL.  */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* Emit a general-purpose loop construct.  START_LOCUS is the location
+   of the beginning of the loop.  COND is the loop condition.
+   COND_IS_FIRST is false for DO loops.  INCR is the FOR increment
+   expression.  BODY is the statement controlled by the loop.  BLAB is
+   the break label.  CLAB is the continue label.  ATTRS is the
+   attributes associated with the loop, which at present are
+   associated with the topmost label.  Everything is allowed to be
+   NULL.  */
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 void
 c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
-	       tree blab, tree clab, bool cond_is_first)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	       tree blab, tree clab, tree attrs, bool cond_is_first)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 {
   tree entry = NULL, exit = NULL, t;
 
@@ -7750,6 +7775,11 @@
 	 then we just build a jump back to the top.  */
       exit = build_and_jump (&LABEL_EXPR_LABEL (top));
 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      /* Add the attributes to the 'top' label.  */
+      decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       if (cond && !integer_nonzerop (cond))
 	{
 	  /* Canonicalize the loop condition to the end.  This means

Modified: llvm-gcc-4.2/trunk/gcc/c.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c.opt?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/c.opt Thu Nov  8 20:30:15 2007
@@ -346,6 +346,12 @@
 Warn about assignment to casts and conditional expressions of lvalues
 ; APPLE LOCAL end non lvalue assign
 
+; APPLE LOCAL begin radar 5376125
+Wdirect-ivar-access
+ObjC ObjC++ Var(warn_direct_ivar_access)
+Warn about direct access to gc-enabled ivars
+; APPLE LOCAL end radar 5376125
+
 Wnon-template-friend
 C++ ObjC++ Var(warn_nontemplate_friend) Init(1)
 Warn when non-templatized friend functions are declared within a template
@@ -560,11 +566,14 @@
 C++ ObjC++
 Check the return value of new
 
-; APPLE LOCAL begin structor decloning
+; APPLE LOCAL begin ARM structor thunks
+; Nonzero if we prefer to clone con/de/structors.  Alternative is to
+; gen multiple tiny thunk-esque things that call/jump to a unified
+; con/de/structor.  This is a classic size/speed tradeoff.
 fclone-structors
-C++ ObjC++
+C++ ObjC++ Var(flag_clone_structors)
 Factor out certain duplicate code in constructors and destructors
-; APPLE LOCAL end structor decloning
+; APPLE LOCAL end ARM structor thunks
 
 fcond-mismatch
 C ObjC C++ ObjC++

Modified: llvm-gcc-4.2/trunk/gcc/calls.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/calls.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/calls.c (original)
+++ llvm-gcc-4.2/trunk/gcc/calls.c Thu Nov  8 20:30:15 2007
@@ -4451,11 +4451,24 @@
 		  if (arg->locate.offset.constant < i + INTVAL (size_rtx))
 		    sibcall_failure = 1;
 		}
+	      /* APPLE LOCAL begin ARM mainline 4567449 */
+	      /* Use arg->locate.size.constant instead of size_rtx because
+		 we only care about the part of the argument on the stack.  */
 	      else if (arg->locate.offset.constant < i)
 		{
-		  if (i < arg->locate.offset.constant + INTVAL (size_rtx))
+		  if (i < arg->locate.offset.constant + arg->locate.size.constant)
 		    sibcall_failure = 1;
 		}
+	      /* Even though they appear to be at the same location, if
+		 part of the outgoing argument is in registers, they aren't
+		 really at the same location.  Check for this by making sure
+		 that the incoming size is the same as the outgoing size.  */
+	      else
+		{
+		  if (arg->locate.size.constant != INTVAL (size_rtx))
+		    sibcall_failure = 1;
+		}
+	      /* APPLE LOCAL end ARM mainline 4567449 */
 	    }
 	}
 

Modified: llvm-gcc-4.2/trunk/gcc/cfghooks.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cfghooks.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cfghooks.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cfghooks.c Thu Nov  8 20:30:15 2007
@@ -330,10 +330,9 @@
   new_bb->count = bb->count;
   new_bb->frequency = bb->frequency;
   new_bb->loop_depth = bb->loop_depth;
-  /* APPLE LOCAL begin 4203984 mainline candidate */
+  /* APPLE LOCAL 4203984 mainline candidate */
   new_bb->loop_father = bb->loop_father;
-  /* APPLE LOCAL end 4203984 mainline candidate */
- 
+
   if (dom_info_available_p (CDI_DOMINATORS))
     {
       redirect_immediate_dominators (CDI_DOMINATORS, bb, new_bb);

Modified: llvm-gcc-4.2/trunk/gcc/common.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/common.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/common.opt Thu Nov  8 20:30:15 2007
@@ -770,12 +770,6 @@
 Common Report Var(flag_pack_struct)
 Pack structure members together without holes
 
-; APPLE LOCAL begin pascal strings
-fpascal-strings
-Common
-Allow Pascal-style string literals
-; APPLE LOCAL end pascal strings
-
 fpack-struct=
 Common RejectNegative Joined UInteger
 -fpack-struct=<number>	Set initial maximum structure member alignment

Modified: llvm-gcc-4.2/trunk/gcc/config.gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config.gcc (original)
+++ llvm-gcc-4.2/trunk/gcc/config.gcc Thu Nov  8 20:30:15 2007
@@ -779,6 +779,13 @@
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h"
 	tmake_file="arm/t-arm arm/t-arm-elf"
 	;;
+# APPLE LOCAL begin ARM darwin target
+arm*-*-darwin*)
+	extra_options="${extra_options} arm/darwin.opt"
+        tm_file="${tm_file} arm/darwin.h"
+        tmake_file="${tmake_file} arm/t-darwin"
+        ;;
+# APPLE LOCAL end ARM darwin target
 arm*-wince-pe*)
 	tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h arm/pe.h arm/wince-pe.h"
 	tmake_file="arm/t-arm arm/t-wince-pe"
@@ -1040,11 +1047,10 @@
 	# Deleted a comment here.
 	# APPLE LOCAL mainline
 	with_cpu=${with_cpu:-core2}
+ 	# APPLE LOCAL Macintosh alignment 2002-2-19 --ff
 	extra_options="${extra_options} i386/darwin.opt"
 	# APPLE LOCAL 4099000
 	tmake_file="${tmake_file} i386/t-darwin"
-	# APPLE LOCAL mainline
-	need_64bit_hwint=yes
 	;;
 x86_64-*-darwin*)
 	# APPLE LOCAL mainline

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-protos.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm-protos.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm-protos.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm-protos.h Thu Nov  8 20:30:15 2007
@@ -24,6 +24,10 @@
 #ifndef GCC_ARM_PROTOS_H
 #define GCC_ARM_PROTOS_H
 
+/* APPLE LOCAL ARM darwin optimization defaults */
+extern void optimization_options (int, int);
+/* APPLE LOCAL ARM prefer SP to FP */
+extern HOST_WIDE_INT arm_local_debug_offset (rtx);
 extern void arm_override_options (void);
 extern int use_return_insn (int, rtx);
 extern int arm_regno_class (int);
@@ -79,6 +83,8 @@
 
 extern int tls_mentioned_p (rtx);
 extern int symbol_mentioned_p (rtx);
+/* APPLE LOCAL ARM -mdynamic-no-pic support */
+extern int non_local_symbol_mentioned_p (rtx);
 extern int label_mentioned_p (rtx);
 extern RTX_CODE minmax_code (rtx);
 extern int adjacent_mem_locations (rtx, rtx);

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Thu Nov  8 20:30:15 2007
@@ -52,6 +52,10 @@
 #include "target-def.h"
 #include "debug.h"
 #include "langhooks.h"
+/* APPLE LOCAL ARM needed for SUBSUBTARGET_OVERRIDE_OPTIONS */
+#include "../../libcpp/internal.h"
+/* APPLE LOCAL ARM needed for set_param_value */
+#include "params.h"
 
 /* Forward definitions of types.  */
 typedef struct minipool_node    Mnode;
@@ -155,6 +159,13 @@
 
 static void arm_file_end (void);
 
+/* APPLE LOCAL begin ARM asm file hooks */
+#if TARGET_MACHO
+static void arm_darwin_file_start (void);
+static void arm_darwin_file_end (void);
+#endif
+/* APPLE LOCAL end ARM asm file hooks */
+
 #ifdef AOF_ASSEMBLER
 static void aof_globalize_label (FILE *, const char *);
 static void aof_dump_imports (FILE *);
@@ -191,6 +202,17 @@
 static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
 static bool arm_cannot_copy_insn_p (rtx);
 static bool arm_tls_symbol_p (rtx x);
+/* APPLE LOCAL begin ARM -mdynamic-no-pic support */
+static int symbol_mentioned_with_filter (rtx, int);
+static bool arm_cannot_force_const_mem (rtx x);
+/* APPLE LOCAL end ARM -mdynamic-no-pic support */
+/* APPLE LOCAL ARM reliable backtraces */
+static rtx arm_builtin_setjmp_frame_value (void);
+/* APPLE LOCAL begin ARM darwin local binding */
+#if TARGET_MACHO
+static bool arm_binds_local_p (tree);
+#endif
+/* APPLE LOCAL end ARM darwin local binding */
 
 
 /* Initialize the GCC target structure.  */
@@ -205,6 +227,15 @@
 #undef TARGET_ASM_FILE_END
 #define TARGET_ASM_FILE_END arm_file_end
 
+/* APPLE LOCAL begin ARM asm file hooks */
+#if TARGET_MACHO
+#undef  TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START arm_darwin_file_start
+#undef  TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END arm_darwin_file_end
+#endif
+/* APPLE LOCAL end ARM asm file hooks */
+
 #ifdef AOF_ASSEMBLER
 #undef  TARGET_ASM_BYTE_OP
 #define TARGET_ASM_BYTE_OP "\tDCB\t"
@@ -225,6 +256,13 @@
 #define TARGET_ASM_INTEGER arm_assemble_integer
 #endif
 
+/* APPLE LOCAL begin ARM MACH assembler */
+#ifdef OBJECT_FORMAT_MACHO
+#undef TARGET_ASM_ALIGNED_SI_OP
+#define TARGET_ASM_ALIGNED_SI_OP "\t.long\t"
+#endif
+/* APPLE LOCAL end ARM MACH assembler */
+
 #undef  TARGET_ASM_FUNCTION_PROLOGUE
 #define TARGET_ASM_FUNCTION_PROLOGUE arm_output_function_prologue
 
@@ -366,7 +404,20 @@
 #endif
 
 #undef TARGET_CANNOT_FORCE_CONST_MEM
-#define TARGET_CANNOT_FORCE_CONST_MEM arm_tls_referenced_p
+/* APPLE LOCAL ARM -mdynamic-no-pic support */
+#define TARGET_CANNOT_FORCE_CONST_MEM arm_cannot_force_const_mem
+
+/* APPLE LOCAL begin ARM darwin local binding */
+#if TARGET_MACHO
+#undef TARGET_BINDS_LOCAL_P
+#define TARGET_BINDS_LOCAL_P arm_binds_local_p
+#endif
+/* APPLE LOCAL end ARM darwin local binding */
+
+/* APPLE LOCAL begin ARM reliable backtraces */
+#undef TARGET_BUILTIN_SETJMP_FRAME_VALUE
+#define TARGET_BUILTIN_SETJMP_FRAME_VALUE arm_builtin_setjmp_frame_value
+/* APPLE LOCAL end ARM reliable backtraces */
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -587,14 +638,29 @@
   {"armv4",   arm7tdmi,   "4",   FL_CO_PROC | FL_MODE26 | FL_FOR_ARCH4, NULL},
   /* Strictly, FL_MODE26 is a permitted option for v4t, but there are no
      implementations that support it, so we will leave it out for now.  */
+/* APPLE LOCAL begin ARM custom architectures */
+#if TARGET_MACHO
+  {"armv4t",  arm7tdmi,   "4T",  FL_CO_PROC |             FL_FOR_ARCH4, NULL},
+#else
   {"armv4t",  arm7tdmi,   "4T",  FL_CO_PROC |             FL_FOR_ARCH4T, NULL},
+#endif
+/* APPLE LOCAL end ARM custom architectures */
   {"armv5",   arm10tdmi,  "5",   FL_CO_PROC |             FL_FOR_ARCH5, NULL},
   {"armv5t",  arm10tdmi,  "5T",  FL_CO_PROC |             FL_FOR_ARCH5T, NULL},
   {"armv5e",  arm1026ejs, "5E",  FL_CO_PROC |             FL_FOR_ARCH5E, NULL},
   {"armv5te", arm1026ejs, "5TE", FL_CO_PROC |             FL_FOR_ARCH5TE, NULL},
+/* APPLE LOCAL begin ARM custom architectures */
+#if TARGET_MACHO
+  {"armv5tej",arm926ejs,  "5TEJ",FL_CO_PROC |             FL_FOR_ARCH5TEJ, NULL},
+  {"xscale",  xscale,     "5TE", FL_CO_PROC | FL_XSCALE | FL_FOR_ARCH5TE, NULL},
+  {"armv6",   arm1136jfs, "6",   FL_CO_PROC |             FL_FOR_ARCH6, NULL},
+  {"armv6j",  arm1136js,  "6J",  FL_CO_PROC |             FL_FOR_ARCH6J, NULL},
+  {"armv6k",  arm1136jfs, "6K",  FL_CO_PROC |             FL_FOR_ARCH6K, NULL},
+#else
   {"armv6",   arm1136js,  "6",   FL_CO_PROC |             FL_FOR_ARCH6, NULL},
   {"armv6j",  arm1136js,  "6J",  FL_CO_PROC |             FL_FOR_ARCH6J, NULL},
   {"armv6k",  mpcore,	  "6K",  FL_CO_PROC |             FL_FOR_ARCH6K, NULL},
+#endif
   {"armv6z",  arm1176jzs, "6Z",  FL_CO_PROC |             FL_FOR_ARCH6Z, NULL},
   {"armv6zk", arm1176jzs, "6ZK", FL_CO_PROC |             FL_FOR_ARCH6ZK, NULL},
   {"ep9312",  ep9312,     "4T",  FL_LDSCHED | FL_CIRRUS | FL_FOR_ARCH4, NULL},
@@ -732,6 +798,16 @@
   return count;
 }
 
+/* APPLE LOCAL begin ARM custom frame layout */
+/* Generate a bitmask that has bits end:start (inclusive) set.  */
+static unsigned long
+inclusive_bitmask (int start, int end)
+{
+  return (((unsigned long) 1 << start) - 1)
+	 ^ (((unsigned long) 1 << (end + 1)) - 1);
+}
+/* APPLE LOCAL end ARM custom frame layout */
+
 /* Set up library functions unique to ARM.  */
 
 static void
@@ -913,6 +989,8 @@
 
 		if (i != ARM_OPT_SET_TUNE)
 		  {
+/* APPLE LOCAL begin ARM darwin driver */
+#if !TARGET_MACHO
 		    /* If we have been given an architecture and a processor
 		       make sure that they are compatible.  We only generate
 		       a warning though, and we prefer the CPU over the
@@ -920,6 +998,13 @@
 		    if (insn_flags != 0 && (insn_flags ^ sel->flags))
 		      warning (0, "switch -mcpu=%s conflicts with -march= switch",
 			       ptr->string);
+#else
+		    /* More likely the -march was inherited from -arch which
+		       had to be given to the darwin driver to get the correct
+		       compiler.  So, make it relatively painless to specify
+		       -mcpu=... by not warning that it supercedes -march.   */
+#endif
+/* APPLE LOCAL end ARM darwin driver */
 
 		    insn_flags = sel->flags;
 		  }
@@ -1038,8 +1123,13 @@
      other command line choices.  */
   if (TARGET_INTERWORK && !(insn_flags & FL_THUMB))
     {
-      warning (0, "target CPU does not support interworking" );
-      target_flags &= ~MASK_INTERWORK;
+      /* APPLE LOCAL begin ARM interworking */
+      /* Don't emit warning for MACHO -- see radar://4825264 */
+      if (! TARGET_MACHO)
+	warning (0, "target CPU does not support interworking" );
+
+      interwork_option = 0;
+      /* APPLE LOCAL end ARM interworking */
     }
 
   if (TARGET_THUMB && !(insn_flags & FL_THUMB))
@@ -1057,7 +1147,8 @@
   /* Callee super interworking implies thumb interworking.  Adding
      this to the flags here simplifies the logic elsewhere.  */
   if (TARGET_THUMB && TARGET_CALLEE_INTERWORKING)
-      target_flags |= MASK_INTERWORK;
+    /* APPLE LOCAL ARM interworking */
+    interwork_option = 1;
 
   /* TARGET_BACKTRACE calls leaf_function_p, which causes a crash if done
      from here where no function is being compiled currently.  */
@@ -1095,7 +1186,8 @@
 
   /* If stack checking is disabled, we can use r10 as the PIC register,
      which keeps r9 available.  */
-  if (flag_pic && TARGET_SINGLE_PIC_BASE)
+  /* APPLE LOCAL ARM pic support */
+  if (flag_pic && TARGET_SINGLE_PIC_BASE && !TARGET_MACHO)
     arm_pic_register = TARGET_APCS_STACK ? 9 : 10;
 
   if (TARGET_APCS_FLOAT)
@@ -1119,16 +1211,17 @@
   arm_tune_xscale = (tune_flags & FL_XSCALE) != 0;
   arm_arch_iwmmxt = (insn_flags & FL_IWMMXT) != 0;
 
-  /* V5 code we generate is completely interworking capable, so we turn off
-     TARGET_INTERWORK here to avoid many tests later on.  */
+  /* APPLE LOCAL begin ARM interworking */
+  /* Choose a default interworking setting if not specified on the
+     command line.  */
+  if (interwork_option == -1)
+    interwork_option = arm_arch5 ? 1 : 0;
 
   /* XXX However, we must pass the right pre-processor defines to CPP
      or GLD can get confused.  This is a hack.  */
   if (TARGET_INTERWORK)
     arm_cpp_interwork = 1;
-
-  if (arm_arch5)
-    target_flags &= ~MASK_INTERWORK;
+  /* APPLE LOCAL end ARM interworking */
 
   if (target_abi_name)
     {
@@ -1335,6 +1428,16 @@
         max_insns_skipped = 3;
     }
 
+/* APPLE LOCAL begin ARM darwin options */
+#ifdef SUBTARGET_OVERRIDE_OPTIONS
+  SUBTARGET_OVERRIDE_OPTIONS;
+#endif
+
+#ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
+  SUBSUBTARGET_OVERRIDE_OPTIONS;
+#endif
+/* APPLE LOCAL end ARM darwin options */
+
   /* Register global variables with the garbage collector.  */
   arm_add_gc_roots ();
 }
@@ -1438,7 +1541,8 @@
     a = lookup_attribute ("interrupt", attr);
 
   if (a == NULL_TREE)
-    type |= TARGET_INTERWORK ? ARM_FT_INTERWORKED : ARM_FT_NORMAL;
+    /* APPLE LOCAL ARM interworking */
+    type |= (TARGET_INTERWORK && !arm_arch5) ? ARM_FT_INTERWORKED : ARM_FT_NORMAL;
   else
     type |= arm_isr_value (TREE_VALUE (a));
 
@@ -1494,9 +1598,10 @@
       || current_function_calls_eh_return
       /* Or if the function calls alloca */
       || current_function_calls_alloca
-      /* Or if there is a stack adjustment.  However, if the stack pointer
-	 is saved on the stack, we can use a pre-incrementing stack load.  */
-      || !(stack_adjust == 0 || (frame_pointer_needed && stack_adjust == 4)))
+      /* APPLE LOCAL begin ARM custom frame layout */
+      /* Or if there is a stack adjustment.  */
+      || !(stack_adjust == 0))
+      /* APPLE LOCAL end ARM custom frame layout */
     return 0;
 
   saved_int_regs = arm_compute_save_reg_mask ();
@@ -1542,7 +1647,8 @@
 
   /* Can't be done if interworking with Thumb, and any registers have been
      stacked.  */
-  if (TARGET_INTERWORK && saved_int_regs != 0)
+  /* APPLE LOCAL ARM interworking */
+  if (TARGET_INTERWORK && !arm_arch5 && saved_int_regs != 0)
     return 0;
 
   /* On StrongARM, conditional returns are expensive if they aren't
@@ -1583,6 +1689,16 @@
       if (regs_ever_live[regno] && ! call_used_regs [regno])
 	return 0;
 
+  /* APPLE LOCAL begin ARM custom frame layout */
+  /* If anything above the frame pointer was saved, they were saved
+     below r0, which means we have to pop them in a separate
+     instruction.  */
+  if (saved_int_regs & (1 << LR_REGNUM))
+    for (regno = ARM_HARD_FRAME_POINTER_REGNUM + 1; regno <= 11; regno++)
+      if (saved_int_regs & (1 << regno))
+	return 0;
+  /* APPLE LOCAL end ARM custom frame layout */
+
   return 1;
 }
 
@@ -2860,6 +2976,11 @@
   { "dllexport",    0, 0, false, false, false, handle_dll_attribute },
   { "notshared",    0, 0, false, true, false, arm_handle_notshared_attribute },
 #endif
+/* APPLE LOCAL begin ARM darwin attributes */
+#ifdef SUBTARGET_ATTRIBUTE_TABLE
+  SUBTARGET_ATTRIBUTE_TABLE,
+#endif
+/* APPLE LOCAL end ARM darwin attributes */
   { NULL,           0, 0, false, false, false, NULL }
 };
 
@@ -3008,11 +3129,21 @@
   return 1;
 }
 
+/* APPLE LOCAL begin ARM longcall */
 /*  Encode long_call or short_call attribute by prefixing
     symbol name in DECL with a special character FLAG.  */
 void
 arm_encode_call_attribute (tree decl, int flag)
 {
+#if TARGET_MACHO
+  rtx sym_ref = XEXP (DECL_RTL (decl), 0);
+
+  /* Do not allow weak functions to be treated as short call.  */
+  if (DECL_WEAK (decl) && flag == SYMBOL_SHORT_CALL)
+    return;
+
+  SYMBOL_REF_FLAGS (sym_ref) |= flag;
+#else
   const char * str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
   int          len = strlen (str);
   char *       newstr;
@@ -3027,7 +3158,9 @@
 
   newstr = (char *) ggc_alloc_string (newstr, len + 1);
   XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
+#endif
 }
+/* APPLE LOCAL end ARM longcall */
 
 /*  Assigns default attributes to newly defined type.  This is used to
     set short_call/long_call attributes for function types of
@@ -3064,8 +3197,14 @@
   /* This is a bit of a fib.  A function will have a short call flag
      applied to its name if it has the short call attribute, or it has
      already been defined within the current compilation unit.  */
+/* APPLE LOCAL begin ARM longcall */
+#if TARGET_MACHO
+  if (SYMBOL_SHORT_CALL_ATTR_P (sym_ref))
+#else
   if (ENCODED_SHORT_CALL_ATTR_P (XSTR (sym_ref, 0)))
+#endif
     return 1;
+/* APPLE LOCAL end ARM longcall */
 
   /* The current function is always defined within the current compilation
      unit.  If it s a weak definition however, then this may not be the real
@@ -3131,9 +3270,17 @@
   if (current_file_function_operand (sym_ref))
     return 0;
 
+  /* APPLE LOCAL begin ARM longcall */
+#if TARGET_MACHO
+  return (call_cookie & CALL_LONG)
+    || SYMBOL_LONG_CALL_ATTR_P (sym_ref)
+    || TARGET_LONG_CALLS;
+#else
   return (call_cookie & CALL_LONG)
     || ENCODED_LONG_CALL_ATTR_P (XSTR (sym_ref, 0))
     || TARGET_LONG_CALLS;
+#endif
+  /* APPLE LOCAL end ARM longcall */
 }
 
 /* Return nonzero if it is ok to make a tail-call to DECL.  */
@@ -3165,8 +3312,22 @@
   /* If we are interworking and the function is not declared static
      then we can't tail-call it unless we know that it exists in this
      compilation unit (since it might be a Thumb routine).  */
-  if (TARGET_INTERWORK && TREE_PUBLIC (decl) && !TREE_ASM_WRITTEN (decl))
+  /* APPLE LOCAL begin ARM interworking */
+  if (TREE_PUBLIC (decl) && !TREE_ASM_WRITTEN (decl) && TARGET_INTERWORK)
+    {
+      if (TARGET_MACHO)
+	return false;
+      else if (!arm_arch5)
+	return false;
+    }
+  /* APPLE LOCAL end ARM interworking */
+
+  /* APPLE LOCAL begin ARM 4956366 */
+  /* If it's weak, the function called may end up being from a different
+     compilation unit.  */
+  if (arm_cpp_interwork && TREE_PUBLIC (decl) && DECL_WEAK (decl))
     return false;
+  /* APPLE LOCAL end ARM 4956366 */
 
   /* Never tailcall from an ISR routine - it needs a special exit sequence.  */
   if (IS_INTERRUPT (arm_current_func_type ()))
@@ -3202,8 +3363,12 @@
 #ifndef AOF_ASSEMBLER
       rtx pic_ref, address;
 #endif
+      /* APPLE LOCAL ARM pic support */
+      rtx norig, l1 = NULL_RTX;
       rtx insn;
       int subregs = 0;
+      /* APPLE LOCAL ARM pic support */
+      bool avoid_ind = true;
 
       /* If this function doesn't have a pic register, create one now.
 	 A lot of the logic here is made obscure by the fact that this
@@ -3212,7 +3377,8 @@
 	 about the real function; and further, we can't call
 	 entry_of_function() until we start the real expansion
 	 process.  */
-      if (!current_function_uses_pic_offset_table)
+      /* APPLE LOCAL ARM pic support */
+      if (!TARGET_MACHO && !current_function_uses_pic_offset_table)
 	{
 	  gcc_assert (!no_new_pseudos);
 	  if (arm_pic_register != INVALID_REGNUM)
@@ -3266,10 +3432,76 @@
       else
 	address = reg;
 
-      if (TARGET_ARM)
-	emit_insn (gen_pic_load_addr_arm (address, orig));
+      /* APPLE LOCAL begin ARM pic support */
+      norig = orig;
+#if TARGET_MACHO
+      if (TARGET_MACHO)
+	{
+	  if (GET_CODE (orig) == SYMBOL_REF
+	      || GET_CODE (orig) == LABEL_REF)
+	    {
+	      rtx x, ptr_ref = orig;
+
+	      l1 = gen_label_rtx ();
+
+	      if (GET_CODE (orig) == SYMBOL_REF)
+		{
+		  bool defined = machopic_data_defined_p (orig);
+
+		  if (defined && MACHO_DYNAMIC_NO_PIC_P)
+		    return orig;
+
+		  if (! defined)
+		    {
+		      avoid_ind = false;
+		      ptr_ref = gen_rtx_SYMBOL_REF (Pmode,
+						    machopic_indirection_name (orig, false));
+		      SET_SYMBOL_REF_DECL (ptr_ref, SYMBOL_REF_DECL (orig));
+		      SYMBOL_REF_FLAGS (ptr_ref) |= MACHO_SYMBOL_FLAG_DEFINED;
+		    }
+		}
+	      else
+		{
+		  if (MACHO_DYNAMIC_NO_PIC_P)
+		    return orig;
+		}
+
+	      if (! MACHO_DYNAMIC_NO_PIC_P)
+		{
+		  x = plus_constant (gen_rtx_LABEL_REF (Pmode, l1), TARGET_ARM ? 8 : 4);
+		  ptr_ref = gen_rtx_CONST (Pmode, gen_rtx_MINUS (Pmode, ptr_ref, x));
+		}
+	      norig = ptr_ref;
+	    }
+	}
+#endif
+      if (TARGET_MACHO && ! MACHO_DYNAMIC_NO_PIC_P)
+	{
+	  if (GET_CODE (orig) == SYMBOL_REF
+	      || GET_CODE (orig) == LABEL_REF)
+	    {
+	      if (TARGET_ARM)
+		{
+		  emit_insn (gen_pic_load_addr_arm (address, norig, l1));
+		  emit_insn (gen_pic_add_dot_plus_eight (address, l1, address));
+		}
+	      else
+		{
+		  emit_insn (gen_pic_load_addr_thumb (address, norig, l1));
+		  emit_insn (gen_pic_add_dot_plus_four (address, l1, address));
+		}
+	    }
+	  else
+	    abort ();
+	}
       else
-	emit_insn (gen_pic_load_addr_thumb (address, orig));
+	{
+	  if (TARGET_ARM)
+	    emit_insn (gen_pic_load_addr_arm (address, norig, l1));
+	  else
+	    emit_insn (gen_pic_load_addr_thumb (address, norig, l1));
+	}
+      /* APPLE LOCAL end ARM pic support */
 
       if ((GET_CODE (orig) == LABEL_REF
 	   || (GET_CODE (orig) == SYMBOL_REF &&
@@ -3278,9 +3510,16 @@
 	pic_ref = gen_rtx_PLUS (Pmode, cfun->machine->pic_reg, address);
       else
 	{
-	  pic_ref = gen_const_mem (Pmode,
-				   gen_rtx_PLUS (Pmode, cfun->machine->pic_reg,
-					         address));
+	  /* APPLE LOCAL begin ARM pic support */
+	  if (! TARGET_MACHO)
+	    pic_ref = gen_const_mem (Pmode,
+				     gen_rtx_PLUS (Pmode, cfun->machine->pic_reg,
+						   address));
+	  else if (avoid_ind)
+	    pic_ref = address;
+	  else
+	    pic_ref = gen_const_mem (Pmode, address);
+	  /* APPLE LOCAL end ARM pic support */
 	}
 
       insn = emit_move_insn (reg, pic_ref);
@@ -3436,12 +3675,15 @@
 
   if (TARGET_ARM)
     {
-      emit_insn (gen_pic_load_addr_arm (cfun->machine->pic_reg, pic_rtx));
-      emit_insn (gen_pic_add_dot_plus_eight (cfun->machine->pic_reg,
-					     cfun->machine->pic_reg, labelno));
+      /* APPLE LOCAL begin ARM pic support */
+      emit_insn (gen_pic_load_addr_arm (cfun->machine->pic_reg, pic_rtx, l1));
+      emit_insn (gen_pic_add_dot_plus_eight (cfun->machine->pic_reg, l1,
+					     cfun->machine->pic_reg));
+      /* APPLE LOCAL end ARM pic support */
     }
   else
     {
+      /* APPLE LOCAL begin ARM pic support */
       if (arm_pic_register != INVALID_REGNUM
 	  && REGNO (cfun->machine->pic_reg) > LAST_LO_REGNUM)
 	{
@@ -3449,13 +3691,14 @@
 	     able to find a work register.  */
 	  pic_tmp = gen_rtx_REG (SImode,
 				 thumb_find_work_register (saved_regs));
-	  emit_insn (gen_pic_load_addr_thumb (pic_tmp, pic_rtx));
+	  emit_insn (gen_pic_load_addr_thumb (pic_tmp, pic_rtx, l1));
 	  emit_insn (gen_movsi (pic_offset_table_rtx, pic_tmp));
 	}
       else
-	emit_insn (gen_pic_load_addr_thumb (cfun->machine->pic_reg, pic_rtx));
-      emit_insn (gen_pic_add_dot_plus_four (cfun->machine->pic_reg,
-					    cfun->machine->pic_reg, labelno));
+	emit_insn (gen_pic_load_addr_thumb (cfun->machine->pic_reg, pic_rtx, l1));
+      emit_insn (gen_pic_add_dot_plus_four (cfun->machine->pic_reg, l1,
+					    cfun->machine->pic_reg));
+      /* APPLE LOCAL end ARM pic support */
     }
 
   /* Need to emit this whether or not we obey regdecls,
@@ -3594,7 +3837,8 @@
 
   /* Standard coprocessor addressing modes.  */
   if (TARGET_HARD_FLOAT
-      && (TARGET_FPA || TARGET_MAVERICK)
+      /* APPLE LOCAL ARM 4480764 */
+      && (TARGET_FPA || TARGET_MAVERICK || TARGET_VFP)
       && (GET_MODE_CLASS (mode) == MODE_FLOAT
 	  || (TARGET_MAVERICK && mode == DImode)))
     return (code == CONST_INT && INTVAL (index) < 1024
@@ -4257,6 +4501,15 @@
 
   return for_each_rtx (&x, arm_tls_operand_p_1, NULL);
 }
+
+/* APPLE LOCAL begin ARM -mdynamic-no-pic support */
+static bool
+arm_cannot_force_const_mem (rtx x)
+{
+  return arm_tls_referenced_p (x)
+	 || ! LEGITIMATE_INDIRECT_OPERAND_P (x);
+}
+/* APPLE LOCAL end ARM -mdynamic-no-pic support */
 
 #define REG_OR_SUBREG_REG(X)						\
   (GET_CODE (X) == REG							\
@@ -5626,15 +5879,39 @@
     }
 }
 
+/* APPLE LOCAL begin ARM -mdynamic-no-pic support */
 /* Return TRUE if X references a SYMBOL_REF.  */
 int
 symbol_mentioned_p (rtx x)
 {
+  return symbol_mentioned_with_filter (x, 0);
+}
+
+/* Return TRUE if X references a non-local SYMBOL_REF.  */
+int
+non_local_symbol_mentioned_p (rtx x)
+{
+  return symbol_mentioned_with_filter (x, 1);
+}
+
+/* Return TRUE if X references a SYMBOL_REF.  If filter_local is set,
+   then references to local symbols (as per machopic_data_defined_p)
+   are ignored.  */
+static int
+symbol_mentioned_with_filter (rtx x, int filter_local)
+{
   const char * fmt;
   int i;
 
   if (GET_CODE (x) == SYMBOL_REF)
-    return 1;
+    {
+#if TARGET_MACHO
+      if (filter_local && machopic_data_defined_p (x))
+	return 0;
+      else
+#endif
+	return 1;
+    }
 
   /* UNSPEC_TLS entries for a symbol include the SYMBOL_REF, but they
      are constant offsets, not symbols.  */
@@ -5659,6 +5936,7 @@
 
   return 0;
 }
+/* APPLE LOCAL end ARM -mdynmaic-no-pic support */
 
 /* Return TRUE if X references a LABEL_REF.  */
 int
@@ -5717,6 +5995,17 @@
 {
   rtx pat = PATTERN (insn);
 
+  /* APPLE LOCAL begin ARM pic support */
+  if (GET_CODE (pat) == SET)
+    {
+      rtx rhs = SET_SRC (pat);
+
+      if (GET_CODE (rhs) == UNSPEC
+	  && XINT (rhs, 1) == UNSPEC_PIC_BASE)
+	return TRUE;
+    }
+  /* APPLE LOCAL end ARM pic support */
+
   if (GET_CODE (pat) == PARALLEL
       && GET_CODE (XVECEXP (pat, 0, 0)) == SET)
     {
@@ -9300,18 +9589,17 @@
     }
   else
     {
+      /* APPLE LOCAL begin ARM custom frame layout */
       /* In the normal case we only need to save those registers
 	 which are call saved and which are used by this function.  */
-      for (reg = 0; reg <= 10; reg++)
+      for (reg = 0; reg <= 11; reg++)
 	if (regs_ever_live[reg] && ! call_used_regs [reg])
 	  save_reg_mask |= (1 << reg);
 
       /* Handle the frame pointer as a special case.  */
-      if (! TARGET_APCS_FRAME
-	  && ! frame_pointer_needed
-	  && regs_ever_live[HARD_FRAME_POINTER_REGNUM]
-	  && ! call_used_regs[HARD_FRAME_POINTER_REGNUM])
+      if (frame_pointer_needed)
 	save_reg_mask |= 1 << HARD_FRAME_POINTER_REGNUM;
+      /* APPLE LOCAL end ARM use custom frame layout */
 
       /* If we aren't loading the PIC register,
 	 don't stack it even though it may be live.  */
@@ -9353,21 +9641,12 @@
     /* This should never really happen.  */
     return 0;
 
-  /* If we are creating a stack frame, then we must save the frame pointer,
-     IP (which will hold the old stack pointer), LR and the PC.  */
-  if (frame_pointer_needed)
-    save_reg_mask |=
-      (1 << ARM_HARD_FRAME_POINTER_REGNUM)
-      | (1 << IP_REGNUM)
-      | (1 << LR_REGNUM)
-      | (1 << PC_REGNUM);
-
+  /* APPLE LOCAL begin ARM use custom frame layout */
   /* Volatile functions do not return, so there
      is no need to save any other registers.  */
-  if (IS_VOLATILE (func_type))
-    return save_reg_mask;
-
-  save_reg_mask |= arm_compute_save_reg0_reg12_mask ();
+  if (!IS_VOLATILE (func_type))
+    save_reg_mask |= arm_compute_save_reg0_reg12_mask ();
+  /* APPLE LOCAL end ARM use custom frame layout */
 
   /* Decide if we need to save the link register.
      Interrupt routines have their own banked link register,
@@ -9388,7 +9667,14 @@
   if (cfun->machine->lr_save_eliminated)
     save_reg_mask &= ~ (1 << LR_REGNUM);
 
+  /* APPLE LOCAL begin ARM custom frame layout */
+  if (frame_pointer_needed)
+    save_reg_mask |= (1 << LR_REGNUM | 1 << HARD_FRAME_POINTER_REGNUM);
+  /* APPLE LOCAL end ARM custom frame layout */
+
   if (TARGET_REALLY_IWMMXT
+      /* APPLE LOCAL ARM custom frame layout */
+      && (!IS_VOLATILE (func_type))
       && ((bit_count (save_reg_mask)
 	   + ARM_NUM_INTS (current_function_pretend_args_size)) % 2) != 0)
     {
@@ -9433,6 +9719,11 @@
     if (regs_ever_live[reg] && !call_used_regs[reg])
       mask |= 1 << reg;
 
+  /* APPLE LOCAL begin ARM thumb requires FP */
+  if (frame_pointer_needed)
+    mask |= 1 << THUMB_HARD_FRAME_POINTER_REGNUM;
+  /* APPLE LOCAL end ARM thumb requires FP */
+
   if (flag_pic
       && !TARGET_SINGLE_PIC_BASE
       && arm_pic_register != INVALID_REGNUM
@@ -9457,12 +9748,26 @@
 	 we will use.  If the register is live then we will
 	 have to push it.  Use LAST_LO_REGNUM as our fallback
 	 choice for the register to select.  */
-      reg = thumb_find_work_register (1 << LAST_LO_REGNUM);
+      /* APPLE LOCAL ARM thumb requires FP */
+      reg = thumb_find_work_register (1 << (LAST_LO_REGNUM - 1));
 
       if (! call_used_regs[reg])
 	mask |= 1 << reg;
     }
 
+  /* APPLE LOCAL begin ARM custom frame layout */
+  /* Also need a scratch register in the case where the frame size is
+     too big for the subtract instruction.  This is not exactly the right
+     computation for frame size, there's a circular dependency on which
+     registers get saved, but it should catch most of the problem cases
+     and there is (very inefficient) code to handle the rare case where
+     we didn't allocate a scratch reg and need one. */
+  if (frame_pointer_needed && ((mask & 0x70) == 0)
+      && (ROUND_UP_WORD (get_frame_size ())
+            + current_function_outgoing_args_size) >= 512)
+    mask |= 1 << (LAST_LO_REGNUM - 1);
+  /* APPLE LOCAL end ARM custom frame layout */
+
   return mask;
 }
 
@@ -9563,7 +9868,8 @@
 	 (e.g. interworking, or ISR) then we can load the return address
 	 directly into the PC.  Otherwise we must load it into LR.  */
       if (really_return
-	  && ! TARGET_INTERWORK)
+	  /* APPLE LOCAL ARM interworking */
+	  && (! TARGET_INTERWORK || arm_arch5))
 	return_reg = reg_names[PC_REGNUM];
       else
 	return_reg = reg_names[LR_REGNUM];
@@ -9879,6 +10185,10 @@
     {
       /* This variable is for the Virtual Frame Pointer, not VFP regs.  */
       int vfp_offset = offsets->frame;
+      /* APPLE LOCAL begin ARM custom frame layout */
+      unsigned long regs_above_fp =
+        inclusive_bitmask (ARM_HARD_FRAME_POINTER_REGNUM + 1, 11);
+      /* APPLE LOCAL end ARM custom frame layout */
 
       if (arm_fpu_arch == FPUTYPE_FPA_EMU2)
 	{
@@ -9978,26 +10288,8 @@
 	      }
 	}
 
-      /* saved_regs_mask should contain the IP, which at the time of stack
-	 frame generation actually contains the old stack pointer.  So a
-	 quick way to unwind the stack is just pop the IP register directly
-	 into the stack pointer.  */
-      gcc_assert (saved_regs_mask & (1 << IP_REGNUM));
-      saved_regs_mask &= ~ (1 << IP_REGNUM);
-      saved_regs_mask |=   (1 << SP_REGNUM);
-
-      /* There are two registers left in saved_regs_mask - LR and PC.  We
-	 only need to restore the LR register (the return address), but to
-	 save time we can load it directly into the PC, unless we need a
-	 special function exit sequence, or we are not really returning.  */
-      if (really_return
-	  && ARM_FUNC_TYPE (func_type) == ARM_FT_NORMAL
-	  && !current_function_calls_eh_return)
-	/* Delete the LR from the register mask, so that the LR on
-	   the stack is loaded into the PC in the register mask.  */
-	saved_regs_mask &= ~ (1 << LR_REGNUM);
-      else
-	saved_regs_mask &= ~ (1 << PC_REGNUM);
+      /* APPLE LOCAL ARM custom frame layout */
+      /* Removed lines.  */
 
       /* We must use SP as the base register, because SP is one of the
          registers being restored.  If an interrupt or page fault
@@ -10008,11 +10300,47 @@
          be reset correctly to the original value, should an interrupt
          occur.  If the stack pointer already points at the right
          place, then omit the subtraction.  */
-      if (offsets->outgoing_args != (1 + (int) bit_count (saved_regs_mask))
-	  || current_function_calls_alloca)
+
+      /* APPLE LOCAL begin ARM custom frame layout */
+      if ((offsets->outgoing_args - offsets->saved_args
+	   != (signed) bit_count (saved_regs_mask) * 4)
+	  || ! current_function_sp_is_unchanging)
+	/* FP points 8 bytes into the frame.  */
 	asm_fprintf (f, "\tsub\t%r, %r, #%d\n", SP_REGNUM, FP_REGNUM,
-		     4 * bit_count (saved_regs_mask));
-      print_multi_reg (f, "ldmfd\t%r", SP_REGNUM, saved_regs_mask);
+		     (bit_count (saved_regs_mask) - 2) * 4);
+
+      /* If we can, restore the LR into the PC.  */
+      if (ARM_FUNC_TYPE (func_type) == ARM_FT_NORMAL
+	  && really_return
+	  && current_function_pretend_args_size == 0
+	  && saved_regs_mask & (1 << LR_REGNUM)
+	  && !current_function_calls_eh_return)
+	{
+	  saved_regs_mask &= ~ (1 << LR_REGNUM);
+	  saved_regs_mask |=   (1 << PC_REGNUM);
+	}
+
+      /* We mustn't be trying to restore SP from the stack.  */
+      gcc_assert (! (saved_regs_mask & (1 << SP_REGNUM)));
+
+      if (saved_regs_mask & regs_above_fp)
+	{
+	  print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM,
+			   saved_regs_mask & regs_above_fp);
+	  print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM,
+			   saved_regs_mask & ~regs_above_fp);
+	}
+      else
+	print_multi_reg (f, "ldmfd\t%r!", SP_REGNUM, saved_regs_mask);
+
+      if (current_function_pretend_args_size)
+	{
+	  /* Unwind the pre-pushed regs.  */
+	  operands[0] = operands[1] = stack_pointer_rtx;
+	  operands[2] = GEN_INT (current_function_pretend_args_size);
+	  output_add_immediate (operands);
+	}
+      /* APPLE LOCAL end ARM custom frame layout */
 
       if (IS_INTERRUPT (func_type))
 	/* Interrupt handlers will have pushed the
@@ -10210,6 +10538,25 @@
       /* Reset the ARM-specific per-function variables.  */
       after_arm_reorg = 0;
     }
+
+/* APPLE LOCAL begin ARM label addresses */
+#if TARGET_MACHO
+  /* Mach-O doesn't support labels at the end of objects, so if
+     it looks like we might want one, insert a NOP.  */
+  {
+    rtx insn = get_last_insn ();
+    while (insn
+	   && NOTE_P (insn)
+	   && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL)
+      insn = PREV_INSN (insn);
+    if (insn
+	&& (LABEL_P (insn)
+	    || (NOTE_P (insn)
+		&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL)))
+      fputs ("\tnop\n", file);
+  }
+#endif
+/* APPLE LOCAL end ARM label addresses */
 }
 
 /* Generate and emit an insn that we will recognize as a push_multi.
@@ -10505,7 +10852,8 @@
   /* Space for variadic functions.  */
   offsets->saved_args = current_function_pretend_args_size;
 
-  offsets->frame = offsets->saved_args + (frame_pointer_needed ? 4 : 0);
+  /* APPLE LOCAL ARM custom frame layout */
+  offsets->frame = offsets->saved_args + (frame_pointer_needed ? 8 : 0);
 
   if (TARGET_ARM)
     {
@@ -10599,23 +10947,18 @@
     case ARG_POINTER_REGNUM:
       switch (to)
 	{
-	case THUMB_HARD_FRAME_POINTER_REGNUM:
-	  return 0;
+	/* APPLE LOCAL ARM custom frame layout */
+        /* Removed lines.  */
 
 	case FRAME_POINTER_REGNUM:
 	  /* This is the reverse of the soft frame pointer
 	     to hard frame pointer elimination below.  */
 	  return offsets->soft_frame - offsets->saved_args;
 
-	case ARM_HARD_FRAME_POINTER_REGNUM:
-	  /* If there is no stack frame then the hard
-	     frame pointer and the arg pointer coincide.  */
-	  if (offsets->frame == offsets->saved_regs)
-	    return 0;
-	  /* FIXME:  Not sure about this.  Maybe we should always return 0 ?  */
-	  return (frame_pointer_needed
-		  && cfun->static_chain_decl != NULL
-		  && ! cfun->machine->uses_anonymous_args) ? 4 : 0;
+	/* APPLE LOCAL begin ARM custom frame layout */
+	case HARD_FRAME_POINTER_REGNUM:
+	  return offsets->frame - (offsets->saved_args + 4);
+	/* APPLE LOCAL end ARM custom frame layout */
 
 	case STACK_POINTER_REGNUM:
 	  /* If nothing has been pushed on the stack at all
@@ -10630,10 +10973,9 @@
     case FRAME_POINTER_REGNUM:
       switch (to)
 	{
-	case THUMB_HARD_FRAME_POINTER_REGNUM:
-	  return 0;
-
-	case ARM_HARD_FRAME_POINTER_REGNUM:
+	/* APPLE LOCAL begin ARM custom frame layout */
+	case HARD_FRAME_POINTER_REGNUM:
+	/* APPLE LOCAL end ARM custom frame layout */
 	  /* The hard frame pointer points to the top entry in the
 	     stack frame.  The soft frame pointer to the bottom entry
 	     in the stack frame.  If there is no stack frame at all,
@@ -10670,8 +11012,8 @@
   rtx ip_rtx;
   unsigned long live_regs_mask;
   unsigned long func_type;
-  int fp_offset = 0;
-  int saved_pretend_args = 0;
+  /* APPLE LOCAL ARM custom frame layout */
+  /* Remove unused variable definitions.  */
   int saved_regs = 0;
   unsigned HOST_WIDE_INT args_to_push;
   arm_stack_offsets *offsets;
@@ -10711,68 +11053,12 @@
 	     Anyway this instruction is not really part of the stack
 	     frame creation although it is part of the prologue.  */
 	}
+      /* APPLE LOCAL begin ARM custom frame layout */
       else if (IS_NESTED (func_type))
 	{
-	  /* The Static chain register is the same as the IP register
-	     used as a scratch register during stack frame creation.
-	     To get around this need to find somewhere to store IP
-	     whilst the frame is being created.  We try the following
-	     places in order:
-
-	       1. The last argument register.
-	       2. A slot on the stack above the frame.  (This only
-	          works if the function is not a varargs function).
-	       3. Register r3, after pushing the argument registers
-	          onto the stack.
-
-	     Note - we only need to tell the dwarf2 backend about the SP
-	     adjustment in the second variant; the static chain register
-	     doesn't need to be unwound, as it doesn't contain a value
-	     inherited from the caller.  */
-
-	  if (regs_ever_live[3] == 0)
-	    insn = emit_set_insn (gen_rtx_REG (SImode, 3), ip_rtx);
-	  else if (args_to_push == 0)
-	    {
-	      rtx dwarf;
-
-	      insn = gen_rtx_PRE_DEC (SImode, stack_pointer_rtx);
-	      insn = emit_set_insn (gen_frame_mem (SImode, insn), ip_rtx);
-	      fp_offset = 4;
-
-	      /* Just tell the dwarf backend that we adjusted SP.  */
-	      dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
-				   plus_constant (stack_pointer_rtx,
-						  -fp_offset));
-	      RTX_FRAME_RELATED_P (insn) = 1;
-	      REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
-						    dwarf, REG_NOTES (insn));
-	    }
-	  else
-	    {
-	      /* Store the args on the stack.  */
-	      if (cfun->machine->uses_anonymous_args)
-		insn = emit_multi_reg_push
-		  ((0xf0 >> (args_to_push / 4)) & 0xf);
-	      else
-		insn = emit_insn
-		  (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
-			       GEN_INT (- args_to_push)));
-
-	      RTX_FRAME_RELATED_P (insn) = 1;
-
-	      saved_pretend_args = 1;
-	      fp_offset = args_to_push;
-	      args_to_push = 0;
-
-	      /* Now reuse r3 to preserve IP.  */
-	      emit_set_insn (gen_rtx_REG (SImode, 3), ip_rtx);
-	    }
+	  /* Our prologue doesn't corrupt IP, so no need to save it.  */
 	}
-
-      insn = emit_set_insn (ip_rtx,
-			    plus_constant (stack_pointer_rtx, fp_offset));
-      RTX_FRAME_RELATED_P (insn) = 1;
+      /* APPLE LOCAL end ARM custom frame layout */
     }
 
   if (args_to_push)
@@ -10804,9 +11090,40 @@
 
   if (live_regs_mask)
     {
-      insn = emit_multi_reg_push (live_regs_mask);
+      /* APPLE LOCAL begin ARM custom frame layout */
+      if (frame_pointer_needed)
+	{
+	  unsigned long regs_above_fp =
+	    inclusive_bitmask (ARM_HARD_FRAME_POINTER_REGNUM + 1, 11);
+	  unsigned long initial_push_regs = live_regs_mask
+					    & ~regs_above_fp;
+	  unsigned long second_push_regs = live_regs_mask
+					    & regs_above_fp;
+
+	  /* Save everything up to the FP, and the LR  */
+	  emit_multi_reg_push (initial_push_regs);
+
+	  /* Configure FP to point to the saved FP.  */
+	  insn = emit_insn (
+		   gen_addsi3 (hard_frame_pointer_rtx, stack_pointer_rtx,
+			       GEN_INT ((bit_count (initial_push_regs) - 2)
+					* 4)));
+	  RTX_FRAME_RELATED_P (insn) = 1;
+
+	  /* Prevent attempts to optimize away the frame pointer.  */
+	  emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
+
+	  /* Push remaining regs.  */
+	  if (second_push_regs)
+	    emit_multi_reg_push (second_push_regs);
+	}
+      else
+	{
+	  insn = emit_multi_reg_push (live_regs_mask);
+	  RTX_FRAME_RELATED_P (insn) = 1;
+	}
       saved_regs += bit_count (live_regs_mask) * 4;
-      RTX_FRAME_RELATED_P (insn) = 1;
+      /* APPLE LOCAL end ARM custom frame layout */
     }
 
   if (TARGET_IWMMXT)
@@ -10894,30 +11211,8 @@
 	}
     }
 
-  if (frame_pointer_needed)
-    {
-      /* Create the new frame pointer.  */
-      insn = GEN_INT (-(4 + args_to_push + fp_offset));
-      insn = emit_insn (gen_addsi3 (hard_frame_pointer_rtx, ip_rtx, insn));
-      RTX_FRAME_RELATED_P (insn) = 1;
-
-      if (IS_NESTED (func_type))
-	{
-	  /* Recover the static chain register.  */
-	  if (regs_ever_live [3] == 0
-	      || saved_pretend_args)
-	    insn = gen_rtx_REG (SImode, 3);
-	  else /* if (current_function_pretend_args_size == 0) */
-	    {
-	      insn = plus_constant (hard_frame_pointer_rtx, 4);
-	      insn = gen_frame_mem (SImode, insn);
-	    }
-
-	  emit_set_insn (ip_rtx, insn);
-	  /* Add a USE to stop propagate_one_insn() from barfing.  */
-	  emit_insn (gen_prologue_use (ip_rtx));
-	}
-    }
+  /* APPLE LOCAL ARM custom frame layout */
+  /* Removed lines.  */
 
   offsets = arm_get_frame_offsets ();
   if (offsets->outgoing_args != offsets->saved_args + saved_regs)
@@ -10986,6 +11281,14 @@
 {
   switch (code)
     {
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case '.':
+#ifdef LOCAL_LABEL_PREFIX
+      fputs (LOCAL_LABEL_PREFIX, stream);
+#endif
+      return;
+    /* APPLE LOCAL end ARM MACH assembler */
+
     case '@':
       fputs (ASM_COMMENT_START, stream);
       return;
@@ -11343,9 +11646,16 @@
 static bool
 arm_assemble_integer (rtx x, unsigned int size, int aligned_p)
 {
+  /* APPLE LOCAL begin ARM MACH assembler */
+  /* We can always handle unaligned data with the normal pseudoops.  */
+  if (TARGET_MACHO)
+    aligned_p = 1;
+  /* APPLE LOCAL end ARM MACH assembler */
+
   if (size == UNITS_PER_WORD && aligned_p)
     {
-      fputs ("\t.word\t", asm_out_file);
+      /* APPLE LOCAL ARM MACH assembler */
+      fputs ("\t" DOT_WORD "\t", asm_out_file);
       output_addr_const (asm_out_file, x);
 
       /* Mark symbols as position independent.  We only do this in the
@@ -11399,6 +11709,8 @@
 }
 
 
+/* APPLE LOCAL ARM macho file format */
+#ifdef OBJECT_FORMAT_ELF
 /* Add a function to the list of static constructors.  */
 
 static void
@@ -11417,6 +11729,8 @@
   output_addr_const (asm_out_file, symbol);
   fputs ("(target1)\n", asm_out_file);
 }
+/* APPLE LOCAL ARM macho file format */
+#endif
 #endif
 
 /* A finite state machine takes care of noticing whether or not instructions
@@ -12033,9 +12347,25 @@
 {
   rtx insn;
 
+  /* APPLE LOCAL begin ARM prefer SP to FP */
+  /* If we generated a frame, but the offset is from the SP anyway, then
+     we have to adjust the offset to be FP-relative, as that's what gdb
+     will be expecting.  */
+  if (frame_pointer_needed)
+    {
+      if ((GET_CODE (addr) == REG) && (REGNO (addr) == SP_REGNUM))
+	return arm_local_debug_offset (addr);
+
+      if (GET_CODE (addr) == PLUS
+	  && GET_CODE (XEXP (addr, 0)) == REG
+	  && REGNO (XEXP (addr, 0)) == SP_REGNUM)
+	return arm_local_debug_offset (addr);
+    }
+
   /* We are only interested if dbxout_parms() failed to compute the offset.  */
   if (value != 0)
-    return 0;
+    return value;
+  /* APPLE LOCAL end ARM prefer SP to FP */
 
   /* We can only cope with the case where the address is held in a register.  */
   if (GET_CODE (addr) != REG)
@@ -12598,6 +12928,12 @@
 
   if (TARGET_REALLY_IWMMXT)
     arm_init_iwmmxt_builtins ();
+
+/* APPLE LOCAL begin ARM darwin builtins */
+#ifdef SUBTARGET_INIT_BUILTINS
+  SUBTARGET_INIT_BUILTINS;
+#endif
+/* APPLE LOCAL end ARM darwin builtins */
 }
 
 /* Errors in the source file can cause expand_expr to return const0_rtx
@@ -13005,8 +13341,11 @@
   else if (!push && (mask & (1 << PC_REGNUM)))
     {
       /* Catch popping the PC.  */
-      if (TARGET_INTERWORK || TARGET_BACKTRACE
+      /* APPLE LOCAL begin ARM interworking */
+      if ((TARGET_INTERWORK && !arm_arch5)
+	  || TARGET_BACKTRACE
 	  || current_function_calls_eh_return)
+      /* APPLE LOCAL end ARM interworking */
 	{
 	  /* The PC is never poped directly, instead
 	     it is popped into r3 and then BX is used.  */
@@ -13090,7 +13429,8 @@
   /* Otherwise if we are not supporting interworking and we have not created
      a backtrace structure and the function was not entered in ARM mode then
      just pop the return address straight into the PC.  */
-  else if (!TARGET_INTERWORK
+  /* APPLE LOCAL ARM interworking */
+  else if ((!TARGET_INTERWORK || arm_arch5)
 	   && !TARGET_BACKTRACE
 	   && !is_called_in_ARM_mode (current_function_decl)
 	   && !current_function_calls_eh_return)
@@ -13609,14 +13949,16 @@
 
 /* Return an RTX indicating where the return address to the
    calling function can be found.  */
+/* APPLE LOCAL begin ARM reliable backtraces */
 rtx
-arm_return_addr (int count, rtx frame ATTRIBUTE_UNUSED)
+arm_return_addr (int count, rtx frame)
 {
   if (count != 0)
-    return NULL_RTX;
+    return gen_rtx_MEM (Pmode, plus_constant (frame, 4));
 
   return get_hard_reg_initial_val (Pmode, LR_REGNUM);
 }
+/* APPLE LOCAL end ARM reliable backtraces */
 
 /* Do anything needed before RTL is emitted for each function.  */
 void
@@ -13656,11 +13998,10 @@
 	case FRAME_POINTER_REGNUM:
 	  return offsets->soft_frame - offsets->saved_args;
 
-	case ARM_HARD_FRAME_POINTER_REGNUM:
-	  return offsets->saved_regs - offsets->saved_args;
-
-	case THUMB_HARD_FRAME_POINTER_REGNUM:
-	  return offsets->locals_base - offsets->saved_args;
+	/* APPLE LOCAL begin ARM custom frame layout */
+	case HARD_FRAME_POINTER_REGNUM:
+	  return offsets->frame - offsets->saved_args;
+	/* APPLE LOCAL end ARM custom frame layout */
 
 	default:
 	  gcc_unreachable ();
@@ -13673,11 +14014,10 @@
 	case STACK_POINTER_REGNUM:
 	  return offsets->outgoing_args - offsets->soft_frame;
 
-	case ARM_HARD_FRAME_POINTER_REGNUM:
-	  return offsets->saved_regs - offsets->soft_frame;
-
-	case THUMB_HARD_FRAME_POINTER_REGNUM:
-	  return offsets->locals_base - offsets->soft_frame;
+	/* APPLE LOCAL begin ARM custom frame layout */
+	case HARD_FRAME_POINTER_REGNUM:
+	  return offsets->frame - offsets->soft_frame;
+	/* APPLE LOCAL end ARM custom frame layout */
 
 	default:
 	  gcc_unreachable ();
@@ -13720,11 +14060,24 @@
   if (flag_pic && arm_pic_register != INVALID_REGNUM)
     arm_load_pic_register (live_regs_mask);
 
-  if (!frame_pointer_needed && CALLER_INTERWORKING_SLOT_SIZE > 0)
-    emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
-		    stack_pointer_rtx);
-
   offsets = arm_get_frame_offsets ();
+
+  /* APPLE LOCAL begin ARM custom frame layout */
+  if (frame_pointer_needed)
+    {
+      insn = emit_insn (gen_addsi3 (hard_frame_pointer_rtx,
+				    stack_pointer_rtx,
+				    GEN_INT (offsets->saved_regs
+					     - offsets->frame)));
+      RTX_FRAME_RELATED_P (insn) = 1;
+    }
+  else if (CALLER_INTERWORKING_SLOT_SIZE > 0)
+    {
+      emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
+		      stack_pointer_rtx);
+    }
+  /* APPLE LOCAL end ARM custom frame layout */
+
   amount = offsets->outgoing_args - offsets->saved_regs;
   if (amount)
     {
@@ -13763,7 +14116,8 @@
 	      rtx spare = gen_rtx_REG (SImode, IP_REGNUM);
 
 	      /* Choose an arbitrary, non-argument low register.  */
-	      reg = gen_rtx_REG (SImode, LAST_LO_REGNUM);
+	      /* APPLE LOCAL ARM custom frame layout */
+	      reg = gen_rtx_REG (SImode, LAST_LO_REGNUM - 1);
 
 	      /* Save it by copying it into a high, scratch register.  */
 	      emit_insn (gen_movsi (spare, reg));
@@ -13812,28 +14166,9 @@
 	}
     }
 
-  if (frame_pointer_needed)
-    {
-      amount = offsets->outgoing_args - offsets->locals_base;
-
-      if (amount < 1024)
-	insn = emit_insn (gen_addsi3 (hard_frame_pointer_rtx,
-				      stack_pointer_rtx, GEN_INT (amount)));
-      else
-	{
-	  emit_insn (gen_movsi (hard_frame_pointer_rtx, GEN_INT (amount)));
-	  insn = emit_insn (gen_addsi3 (hard_frame_pointer_rtx,
-					hard_frame_pointer_rtx,
-					stack_pointer_rtx));
-	  dwarf = gen_rtx_SET (VOIDmode, hard_frame_pointer_rtx,
-			       plus_constant (stack_pointer_rtx, amount));
-	  RTX_FRAME_RELATED_P (dwarf) = 1;
-	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
-						REG_NOTES (insn));
-	}
-
-      RTX_FRAME_RELATED_P (insn) = 1;
-    }
+  /* APPLE LOCAL begin ARM custom frame layout */
+  /* Removed lines.  */
+  /* APPLE LOCAL end ARM custom frame layout */
 
   /* If we are profiling, make sure no instructions are scheduled before
      the call to mcount.  Similarly if the user has requested no
@@ -13869,14 +14204,32 @@
   offsets = arm_get_frame_offsets ();
   amount = offsets->outgoing_args - offsets->saved_regs;
 
-  if (frame_pointer_needed)
+  /* APPLE LOCAL begin ARM custom frame layout */
+  /* Because popping the stack frame using the frame pointer is so much
+     more expensive than just popping it from the SP, only use the FP
+     when we must -- i.e., when we don't know the SP offset because it
+     has changed since the beginning of the function.  */
+  if (! current_function_sp_is_unchanging)
     {
-      emit_insn (gen_movsi (stack_pointer_rtx, hard_frame_pointer_rtx));
-      amount = offsets->locals_base - offsets->saved_regs;
-    }
+      int fp_offset = offsets->frame - offsets->saved_regs;
 
-  gcc_assert (amount >= 0);
-  if (amount)
+      if (fp_offset)
+	{
+	  /* r3 is always free in the epilogue.  */
+	  rtx reg = gen_rtx_REG (SImode, LAST_ARG_REGNUM);
+
+	  emit_insn (gen_movsi (reg, hard_frame_pointer_rtx));
+	  emit_insn (gen_addsi3 (reg, reg, GEN_INT (fp_offset)));
+	  emit_insn (gen_movsi (stack_pointer_rtx, reg));
+	}
+      else
+	{
+	  emit_insn (gen_movsi (stack_pointer_rtx,
+				hard_frame_pointer_rtx));
+	}
+    }
+  else if (amount)
+  /* APPLE LOCAL end ARM custom frame layout */
     {
       if (amount < 512)
 	emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
@@ -14103,7 +14456,8 @@
 	if (live_regs_mask & (1 << next_hi_reg))
 	  break;
 
-      pushable_regs = l_mask & 0xff;
+      /* APPLE LOCAL ARM thumb requires FP */
+      pushable_regs = l_mask & 0x7f;
 
       if (pushable_regs == 0)
 	pushable_regs = 1 << thumb_find_work_register (live_regs_mask);
@@ -14480,6 +14834,24 @@
     }
 }
 
+/* APPLE LOCAL begin ARM asm file hooks */
+#if TARGET_MACHO
+static void
+arm_darwin_file_start (void)
+{
+  default_file_start();
+  darwin_file_start();
+}
+
+static void
+arm_darwin_file_end (void)
+{
+  darwin_file_end ();
+  arm_file_end ();
+}
+#endif
+/* APPLE LOCAL end ARM asm file hooks */
+
 rtx aof_pic_label;
 
 #ifdef AOF_ASSEMBLER
@@ -14723,6 +15095,12 @@
 static void
 arm_encode_section_info (tree decl, rtx rtl, int first)
 {
+  /* APPLE LOCAL begin ARM darwin section_info */
+#if TARGET_MACHO
+  darwin_encode_section_info (decl, rtl, first);
+#endif
+  /* APPLE LOCAL end ARM darwin section_info */
+
   /* This doesn't work with AOF syntax, since the string table may be in
      a different AREA.  */
 #ifndef AOF_ASSEMBLER
@@ -14735,10 +15113,19 @@
      or known to be defined in this file then encode a short call flag.  */
   if (first && DECL_P (decl))
     {
+/* APPLE LOCAL begin ARM longcall */
+#if TARGET_MACHO
+      if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl))
+        arm_encode_call_attribute (decl, SYMBOL_LONG_CALL);
+      else if (! TREE_PUBLIC (decl))
+        arm_encode_call_attribute (decl, SYMBOL_SHORT_CALL);
+#else
       if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl))
         arm_encode_call_attribute (decl, LONG_CALL_FLAG_CHAR);
       else if (! TREE_PUBLIC (decl))
         arm_encode_call_attribute (decl, SHORT_CALL_FLAG_CHAR);
+#endif
+/* APPLE LOCAL end ARM longcall */
     }
 
   default_encode_section_info (decl, rtl, first);
@@ -14773,6 +15160,20 @@
   int shift = 0;
   int this_regno = (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function)
                     ? 1 : 0);
+  /* APPLE LOCAL ARM begin 4745175 */
+  rtx function_rtx = XEXP (DECL_RTL (function), 0);
+  const char *function_name;
+
+  /* Darwin/mach-o: use a stub for dynamic references.  */
+  if (TARGET_MACHO
+      && (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
+      && ! machopic_data_defined_p (function_rtx))
+    function_name =
+       machopic_indirection_name (function_rtx, true);
+  else
+    function_name = XSTR (function_rtx, 0);
+  /* APPLE LOCAL ARM end 4745175 */
+
   if (mi_delta < 0)
     mi_delta = - mi_delta;
   if (TARGET_THUMB)
@@ -14821,9 +15222,21 @@
       fputs (":\n", file);
       if (flag_pic)
 	{
-	  /* Output ".word .LTHUNKn-7-.LTHUNKPCn".  */
-	  rtx tem = XEXP (DECL_RTL (function), 0);
-	  tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7));
+	  /* APPLE LOCAL begin ARM 4745175 */
+	  /* If we're branching to a local routine, output:
+	       ".word .LTHUNKn-7-.LTHUNKPCn".
+	     Otherwise, output:
+	       ".word .LTHUNKn-8-.LTHUNKPCn".
+	     (inter-module thumbness is fixed up by the linker).  */
+	  rtx tem = gen_rtx_SYMBOL_REF (Pmode, function_name);
+
+	  if (TARGET_MACHO
+	      && ! machopic_data_defined_p (function_rtx))
+	    tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-8));
+	  else
+	    tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7));
+	  /* APPLE LOCAL end ARM 4745175 */
+
 	  tem = gen_rtx_MINUS (GET_MODE (tem),
 			       tem,
 			       gen_rtx_SYMBOL_REF (Pmode,
@@ -14832,12 +15245,16 @@
 	}
       else
 	/* Output ".word .LTHUNKn".  */
-	assemble_integer (XEXP (DECL_RTL (function), 0), 4, BITS_PER_WORD, 1);
+	/* APPLE LOCAL begin ARM 4745175 */
+	assemble_integer (gen_rtx_SYMBOL_REF (Pmode, function_name),
+			  4, BITS_PER_WORD, 1);
+	/* APPLE LOCAL end ARM 4745175 */
     }
   else
     {
       fputs ("\tb\t", file);
-      assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0));
+      /* APPLE LOCAL ARM 4745175 */
+      assemble_name (file, function_name);
       if (NEED_PLT_RELOC)
         fputs ("(PLT)", file);
       fputc ('\n', file);
@@ -15141,6 +15558,12 @@
 static bool
 arm_cxx_class_data_always_comdat (void)
 {
+/* APPLE LOCAL begin ARM follow Darwin semantics on Darwin */
+#if TARGET_MACHO
+  return false;
+#endif
+/* APPLE LOCAL end ARM follow Darwin semantics on Darwin */
+
   /* \S 3.2.5.4 of the ARM C++ ABI says that class data only have
      vague linkage if the class has no key function.  */
   return !TARGET_AAPCS_BASED;
@@ -15172,12 +15595,14 @@
   else
     {
       if (frame_pointer_needed)
-	addr = plus_constant(hard_frame_pointer_rtx, -4);
+	/* APPLE LOCAL ARM custom frame layout */
+	addr = plus_constant(hard_frame_pointer_rtx, 4);
       else
 	{
 	  /* LR will be the first saved register.  */
 	  offsets = arm_get_frame_offsets ();
-	  delta = offsets->outgoing_args - (offsets->frame + 4);
+	  /* APPLE LOCAL ARM custom frame layout */
+	  delta = offsets->outgoing_args - (offsets->frame - 4);
 
 
 	  if (delta >= 4096)
@@ -15216,19 +15641,21 @@
       /* Find the saved regs.  */
       if (frame_pointer_needed)
 	{
-	  delta = offsets->soft_frame - offsets->saved_args;
+	  /* APPLE LOCAL ARM custom frame layout */
+	  delta = 4;
 	  reg = THUMB_HARD_FRAME_POINTER_REGNUM;
 	}
       else
 	{
-	  delta = offsets->outgoing_args - offsets->saved_args;
+	  /* APPLE LOCAL ARM custom frame layout */
+	  delta = offsets->outgoing_args - (offsets->saved_args + 4);
 	  reg = SP_REGNUM;
 	}
       /* Allow for the stack frame.  */
       if (TARGET_BACKTRACE)
 	delta -= 16;
-      /* The link register is always the first saved register.  */
-      delta -= 4;
+      /* APPLE LOCAL ARM custom frame layout */
+      /* Removed lines.  */
 
       /* Construct the address.  */
       addr = gen_rtx_REG (SImode, reg);
@@ -15636,4 +16063,187 @@
   return FALSE;
 }
 
+/* APPLE LOCAL begin ARM darwin local binding */
+#if TARGET_MACHO
+/* Cross-module name binding.  Darwin does not support overriding
+   functions at dynamic-link time.  */
+
+static bool
+arm_binds_local_p (tree decl)
+{
+  return default_binds_local_p_1 (decl,
+        flag_apple_kext && lang_hooks.vtable_p (decl));
+}
+#endif
+/* APPLE LOCAL end ARM darwin local binding */
+
+/* APPLE LOCAL begin ARM setjmp/longjmp interworking */
+static rtx
+arm_builtin_setjmp_frame_value (void)
+{
+  static rtx arm_hard_frame_pointer_rtx;
+  if (! arm_hard_frame_pointer_rtx)
+    arm_hard_frame_pointer_rtx =
+      gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM);
+  return arm_hard_frame_pointer_rtx;
+}
+/* APPLE LOCAL end ARM setjmp/longjmp interworking */
+
+/* APPLE LOCAL begin ARM optimization pragmas */
+/* Version of the above for use from #pragma optimization_level.  Only
+   per-function flags are reset.  */
+#if TARGET_MACHO
+void
+reset_optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
+{
+}
+#endif
+/* APPLE LOCAL end ARM optimization pragmas */
+
+/* APPLE LOCAL begin ARM pic support */
+#ifdef OBJECT_FORMAT_MACHO
+
+/* Generate PIC and indirect symbol stubs.  */
+
+void
+machopic_output_stub (FILE *file, const char *symb, const char *stub)
+{
+  unsigned int length;
+  char *symbol_name, *lazy_ptr_name;
+  static int label = 0;
+
+  /* Lose our funky encoding stuff so it doesn't contaminate the stub.  */
+  symb = (*targetm.strip_name_encoding) (symb);
+
+  length = strlen (symb);
+  symbol_name = alloca (length + 32);
+  GEN_SYMBOL_NAME_FOR_SYMBOL (symbol_name, symb, length);
+
+  lazy_ptr_name = alloca (length + 32);
+  GEN_LAZY_PTR_NAME_FOR_SYMBOL (lazy_ptr_name, symb, length);
+
+  if (flag_pic == 2)
+    switch_to_section (darwin_sections[machopic_picsymbol_stub4_section]);
+  else
+    switch_to_section (darwin_sections[machopic_symbol_stub4_section]);
+
+  fprintf (file, "\t.align 2\n");
+
+  if (TARGET_THUMB)
+    fprintf (file, "\t.code 32\n");
+
+  fprintf (file, "%s:\n", stub);
+  fprintf (file, "\t.indirect_symbol %s\n", symbol_name);
+  fprintf (file, "\tldr\tip, L%s$slp\n", symbol_name);
+
+  label++;
+
+  if (flag_pic == 2)
+    fprintf (file, "L%d$scv:\tadd\tip, pc, ip\n", label);
+
+  fprintf (file, "\tldr\tpc, [ip, #0]\n");
+
+  if (flag_pic == 2)
+    fprintf (file, "L%s$slp:\n\t.long\tL%s$lazy_ptr - (L%d$scv + 8)\n",
+	     symbol_name, symbol_name, label);
+  else
+    fprintf (file, "L%s$slp:\n\t.long\tL%s$lazy_ptr\n",
+	     symbol_name, symbol_name);
+      
+  switch_to_section (darwin_sections[machopic_lazy_symbol_ptr_section]);
+  fprintf (file, "%s:\n", lazy_ptr_name);
+  fprintf (file, "\t.indirect_symbol\t%s\n", symbol_name);
+  fprintf (file, "\t.long\tdyld_stub_binding_helper\n");
+}
+
+#endif
+/* APPLE LOCAL end ARM pic support */
+
+/* APPLE LOCAL begin ARM MACH assembler */
+extern bool iasm_memory_clobber (const char *);
+
+/* FIXME: we can be more specific here.  */
+bool iasm_memory_clobber (const char *ARG_UNUSED (opcode))
+{
+  return true;
+}
+/* APPLE LOCAL end ARM MACH assembler */
+
+/* APPLE LOCAL begin ARM darwin optimization defaults */
+void
+optimization_options (int level, int size ATTRIBUTE_UNUSED)
+{
+  /* disable strict aliasing; breaks too much existing code.  */
+#if TARGET_MACHO
+  flag_strict_aliasing = 0;
+
+  /* Trapping math is not needed by many users, and is expensive.
+     C99 permits us to default it off and we do that.  It is
+     turned on when <fenv.h> is included (see darwin_pragma_fenv
+     in darwin-c.c).  */
+  flag_trapping_math = 0;
+
+  /* Disable local RA.  */
+  /* APPLE LOCAL conditionally disable local RA */
+  /* flag_local_alloc = 0; */
+  /* APPLE LOCAL rerun cse after combine */
+  /* flag_rerun_cse_after_combine = 1; */
+  
+  /* For -O2 and beyond, turn off -fschedule-insns by default.  It tends to
+     make the problem with not enough registers even worse.  */
+#ifdef INSN_SCHEDULING
+  if (level > 1)
+    flag_schedule_insns = 0;
+#endif
+
+  /* radar 4094534. */
+  /* The Darwin libraries never set errno, so we might as well
+     avoid calling them when that's the only reason we would.  */
+  flag_errno_math = 0;
+#endif
+
+#ifdef SUBTARGET_OPTIMIZATION_OPTIONS
+  SUBTARGET_OPTIMIZATION_OPTIONS;
+#endif
+}
+/* APPLE LOCAL end ARM darwin optimization defaults */
+
+/* APPLE LOCAL begin ARM prefer SP to FP */
+/* Stabs is so much fun.  Stabs doesn't distinguish between a SP and a
+   FP offset -- if your function has a frame pointer, it is assumed
+   that is what offsets to locals are from.  So, in the cases where we
+   have a FP, but are using a SP anyway, we have to adjust the values
+   to be FP-based.  */
+HOST_WIDE_INT
+arm_local_debug_offset (rtx var)
+{
+  int offset;
+  int reg;
+
+  if (GET_CODE (var) == PLUS)
+    {
+      reg = REGNO (XEXP (var, 0));
+      offset = INTVAL (XEXP (var, 1));
+    }
+  else if (GET_CODE (var) == REG)
+    {
+      reg = REGNO (var);
+      offset = 0;
+    }
+  else
+    {
+      return 0;
+    }
+
+  if (frame_pointer_needed && reg == SP_REGNUM)
+    {
+      arm_stack_offsets *offsets = arm_get_frame_offsets();
+
+      return offset + (offsets->frame - offsets->outgoing_args);
+    }
+  else
+    return offset;
+}
+/* APPLE LOCAL end ARM prefer SP to FP */
+
 #include "gt-arm.h"

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Thu Nov  8 20:30:15 2007
@@ -26,6 +26,16 @@
 #ifndef GCC_ARM_H
 #define GCC_ARM_H
 
+/* APPLE LOCAL begin ARM darwin target */
+/* Overridden by arm/darwin.h, whether it is included first or not. */
+#ifndef TARGET_MACHO
+#define TARGET_MACHO 0
+#endif
+/* APPLE LOCAL end ARM darwin target */
+
+/* APPLE LOCAL ARM interworking */
+#define TARGET_INTERWORK (interwork_option == 1)
+
 /* The architecture define.  */
 extern char arm_arch_name[];
 
@@ -824,7 +834,8 @@
    backtrace structures on the stack (if required to do so via a command line
    option) using r11.  This is the only 'user visible' use of r11 as a frame
    pointer.  */
-#define ARM_HARD_FRAME_POINTER_REGNUM	11
+/* APPLE LOCAL ARM custom frame layout */
+#define ARM_HARD_FRAME_POINTER_REGNUM    7
 #define THUMB_HARD_FRAME_POINTER_REGNUM	 7
 
 #define HARD_FRAME_POINTER_REGNUM		\
@@ -887,10 +898,17 @@
 #define SUBTARGET_FRAME_POINTER_REQUIRED 0
 #endif
 
+/* APPLE LOCAL begin ARM thumb requires FP */
 #define FRAME_POINTER_REQUIRED					\
   (current_function_has_nonlocal_label				\
    || SUBTARGET_FRAME_POINTER_REQUIRED				\
-   || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()))
+   || current_function_calls_builtin_ret_addr			\
+   || current_function_calls_builtin_frame_addr			\
+   || ! flag_omit_frame_pointer				 	\
+   || (TARGET_THUMB && ! leaf_function_p ())			\
+   || (TARGET_ARM && TARGET_APCS_FRAME && ! leaf_function_p ()) \
+   || (TARGET_ARM && regs_ever_live [LR_REGNUM]))
+/* APPLE LOCAL end ARM thumb requires FP */
 
 /* Return number of consecutive hard regs needed starting at reg REGNO
    to hold something of mode MODE.
@@ -1589,14 +1607,13 @@
    pointer.  Note we have to use {ARM|THUMB}_HARD_FRAME_POINTER_REGNUM
    because the definition of HARD_FRAME_POINTER_REGNUM is not a constant.  */
 
+/* APPLE LOCAL begin ARM custom frame layout */
 #define ELIMINABLE_REGS						\
 {{ ARG_POINTER_REGNUM,        STACK_POINTER_REGNUM            },\
- { ARG_POINTER_REGNUM,        FRAME_POINTER_REGNUM            },\
- { ARG_POINTER_REGNUM,        ARM_HARD_FRAME_POINTER_REGNUM   },\
- { ARG_POINTER_REGNUM,        THUMB_HARD_FRAME_POINTER_REGNUM },\
+ { ARG_POINTER_REGNUM,        HARD_FRAME_POINTER_REGNUM       },\
  { FRAME_POINTER_REGNUM,      STACK_POINTER_REGNUM            },\
- { FRAME_POINTER_REGNUM,      ARM_HARD_FRAME_POINTER_REGNUM   },\
- { FRAME_POINTER_REGNUM,      THUMB_HARD_FRAME_POINTER_REGNUM }}
+ { FRAME_POINTER_REGNUM,      HARD_FRAME_POINTER_REGNUM       }}
+/* APPLE LOCAL end ARM custom frame layout */
 
 /* Given FROM and TO register numbers, say whether this elimination is
    allowed.  Frame pointer elimination is automatically handled.
@@ -1608,9 +1625,12 @@
    ARG_POINTER_REGNUM.  */
 #define CAN_ELIMINATE(FROM, TO)						\
   (((TO) == FRAME_POINTER_REGNUM && (FROM) == ARG_POINTER_REGNUM) ? 0 :	\
-   ((TO) == STACK_POINTER_REGNUM && frame_pointer_needed) ? 0 :		\
-   ((TO) == ARM_HARD_FRAME_POINTER_REGNUM && TARGET_THUMB) ? 0 :	\
-   ((TO) == THUMB_HARD_FRAME_POINTER_REGNUM && TARGET_ARM) ? 0 :	\
+   /* APPLE LOCAL begin ARM prefer SP to FP */				\
+   ((TO) == STACK_POINTER_REGNUM					\
+            && !current_function_sp_is_unchanging) ? 0 :		\
+   /* APPLE LOCAL end ARM prefer SP to FP */				\
+   /* APPLE LOCAL ARM custom frame layout */				\
+   /* Removed lines.  */						\
    1)
 
 /* Define the offset between two registers, one to be eliminated, and the
@@ -1622,7 +1642,8 @@
     (OFFSET) = thumb_compute_initial_elimination_offset (FROM, TO)
 
 /* Special case handling of the location of arguments passed on the stack.  */
-#define DEBUGGER_ARG_OFFSET(value, addr) value ? value : arm_debugger_arg_offset (value, addr)
+/* APPLE LOCAL ARM prefer SP to FP */
+#define DEBUGGER_ARG_OFFSET(value, addr) arm_debugger_arg_offset (value, addr)
 
 /* Initialize data used by insn expanders.  This is called from insn_emit,
    once for every function before code is generated.  */
@@ -1648,6 +1669,10 @@
   assemble_aligned_integer (UNITS_PER_WORD, const0_rtx);	\
 }
 
+/* APPLE LOCAL begin ARM MACH assembler */
+#define DOT_WORD ".word"
+/* APPLE LOCAL end ARM MACH assembler */
+
 /* On the Thumb we always switch into ARM mode to execute the trampoline.
    Why - because it is easier.  This code will always be branched to via
    a BX instruction and since the compiler magically generates the address
@@ -1666,8 +1691,10 @@
   asm_fprintf (FILE, "\torr\t%r, %r, #1\n",     \
 	       IP_REGNUM, IP_REGNUM);     	\
   asm_fprintf (FILE, "\tbx\t%r\n", IP_REGNUM);	\
-  fprintf (FILE, "\t.word\t0\n");		\
-  fprintf (FILE, "\t.word\t0\n");		\
+  /* APPLE LOCAL begin ARM MACH assembler */	\
+  fprintf (FILE, "\t" DOT_WORD "\t0\n");	\
+  fprintf (FILE, "\t" DOT_WORD "\t0\n");	\
+  /* APPLE LOCAL end ARM MACH assembler */	\
   fprintf (FILE, "\t.code 16\n");		\
 }
 
@@ -1793,17 +1820,21 @@
    && (TARGET_ARM ? ARM_LEGITIMATE_CONSTANT_P (X)	\
 		  : THUMB_LEGITIMATE_CONSTANT_P (X)))
 
+/* APPLE LOCAL begin ARM longcall */
+#define SYMBOL_SHORT_CALL ((SYMBOL_FLAG_MACH_DEP) << 3)
+#define SYMBOL_LONG_CALL ((SYMBOL_FLAG_MACH_DEP) << 4)
+
 /* Special characters prefixed to function names
    in order to encode attribute like information.
    Note, '@' and '*' have already been taken.  */
 #define SHORT_CALL_FLAG_CHAR	'^'
 #define LONG_CALL_FLAG_CHAR	'#'
 
-#define ENCODED_SHORT_CALL_ATTR_P(SYMBOL_NAME)	\
-  (*(SYMBOL_NAME) == SHORT_CALL_FLAG_CHAR)
+#define SYMBOL_SHORT_CALL_ATTR_P(SYMBOL) \
+  (SYMBOL_REF_FLAGS (SYMBOL) & SYMBOL_SHORT_CALL)
 
-#define ENCODED_LONG_CALL_ATTR_P(SYMBOL_NAME)	\
-  (*(SYMBOL_NAME) == LONG_CALL_FLAG_CHAR)
+#define SYMBOL_LONG_CALL_ATTR_P(SYMBOL) \
+  (SYMBOL_REF_FLAGS (SYMBOL) & SYMBOL_LONG_CALL)
 
 #ifndef SUBTARGET_NAME_ENCODING_LENGTHS
 #define SUBTARGET_NAME_ENCODING_LENGTHS
@@ -1814,10 +1845,9 @@
    be stripped from the start of a function's name, if that
    name starts with the indicated character.  */
 #define ARM_NAME_ENCODING_LENGTHS		\
-  case SHORT_CALL_FLAG_CHAR: return 1;		\
-  case LONG_CALL_FLAG_CHAR:  return 1;		\
   case '*':  return 1;				\
   SUBTARGET_NAME_ENCODING_LENGTHS
+/* APPLE LOCAL end ARM longcall */
 
 /* This is how to output a reference to a user-level label named NAME.
    `assemble_name' uses this.  */
@@ -1882,9 +1912,11 @@
    attribute when long-calls are in effect as this tells the compiler
    that the section might be placed a long way from the caller.
    See arm_is_longcall_p() for more information.  */
+/* APPLE LOCAL begin ARM longcall */
 #define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)	\
   if (!TARGET_LONG_CALLS || ! DECL_SECTION_NAME (DECL)) \
-    arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR)
+    arm_encode_call_attribute (DECL, SYMBOL_SHORT_CALL)
+/* APPLE LOCAL end ARM longcall */
 
 #define ARM_OUTPUT_FN_UNWIND(F, PROLOGUE) arm_output_fn_unwind (F, PROLOGUE)
 
@@ -2118,6 +2150,20 @@
 		   || label_mentioned_p (get_pool_constant (X)))))	\
 	 || tls_mentioned_p (X))
 
+/* APPLE LOCAL begin ARM -mdynamic-no-pic support */
+#define LEGITIMATE_DYNAMIC_NO_PIC_OPERAND_P(X)				\
+	(! non_local_symbol_mentioned_p (X))
+
+/* Unfortunately, the places where LEGITIMATE_PIC_OPERAND_P appear in
+   the source code are potential hazards for -mdynamic-no-pic, too.
+   This macro is similar in usage to LEGITIMATE_PIC_OPERAND_P, but it
+   doesn't assume flag_pic is set.  */
+#define LEGITIMATE_INDIRECT_OPERAND_P(X)				\
+	((! flag_pic || LEGITIMATE_PIC_OPERAND_P(X))			\
+	 && (! MACHO_DYNAMIC_NO_PIC_P					\
+	     || LEGITIMATE_DYNAMIC_NO_PIC_OPERAND_P(X)))
+/* APPLE LOCAL end ARM -mdynamic-no-pic support */
+
 /* We need to know when we are making a constant pool; this determines
    whether data needs to be in the GOT or can be referenced via a GOT
    offset.  */
@@ -2207,7 +2253,15 @@
 			  || current_function_is_thunk)		\
             fprintf (STREAM, "\t.code 32\n") ;		\
           else						\
-           fprintf (STREAM, "\t.code 16\n\t.thumb_func\n") ;	\
+/* APPLE LOCAL begin ARM thumb_func <symbol_name> */	\
+	    {						\
+	      fputs ("\t.code 16\n", STREAM);		\
+	      fputs ("\t.thumb_func ", STREAM);		\
+	      if (TARGET_MACHO)				\
+		assemble_name (STREAM, (char *) NAME);	\
+	      putc ('\n', STREAM);			\
+}							\
+/* APPLE LOCAL end ARM thumb_func <symbol_name> */	\
         }						\
       if (TARGET_POKE_FUNCTION_NAME)			\
         arm_poke_function_name (STREAM, (char *) NAME);	\
@@ -2259,6 +2313,8 @@
 
 #define PRINT_OPERAND_PUNCT_VALID_P(CODE)	\
   (CODE == '@' || CODE == '|'			\
+   /* APPLE LOCAL ARM MACH assembler */		\
+   || CODE == '.'				\
    || (TARGET_ARM   && (CODE == '?'))		\
    || (TARGET_THUMB && (CODE == '_')))
 
@@ -2428,6 +2484,16 @@
    ? (gen_int_mode ((unsigned long)0xffffffff, Pmode))			\
    : arm_gen_return_addr_mask ())
 
+/* APPLE LOCAL begin ARM darwin optimization defaults */
+/* Define this to change the optimizations performed by default.  */
+#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \
+  optimization_options ((LEVEL), (SIZE))
+/* APPLE LOCAL end ARM darwin optimization defaults */
+
+/* APPLE LOCAL begin ARM prefer SP to FP */
+#define DEBUGGER_AUTO_OFFSET(X) arm_local_debug_offset (X)
+#define ALLOW_ELIMINATION_TO_SP
+/* APPLE LOCAL end ARM prefer SP to FP */
 
 enum arm_builtins
 {

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.md
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.md?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.md (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.md Thu Nov  8 20:30:15 2007
@@ -93,6 +93,8 @@
    (UNSPEC_TLS      20) ; A symbol that has been treated properly for TLS usage.
    (UNSPEC_PIC_LABEL 21) ; A label used for PIC access that does not appear in the
                          ; instruction stream.
+   ; APPLE LOCAL ARM setjmp/longjmp interworking
+   (UNSPEC_JMP_XCHG 22) ; Indirect jump with possible change in ARM/Thumb state.
   ]
 )
 
@@ -4025,7 +4027,8 @@
         && GET_CODE (XEXP (mem, 0)) == LABEL_REF)
       return \"ldr\\t%0, %1\";
       
-    if (which_alternative == 0)
+    /* APPLE LOCAL ARM fix obvious typo */
+    if (which_alternative == 1)
       return \"ldrsb\\t%0, %1\";
       
     ops[0] = operands[0];
@@ -4379,10 +4382,8 @@
         }
       operands[1] = tmp;
     }
-  else if (flag_pic
-	   && (CONSTANT_P (operands[1])
-	       || symbol_mentioned_p (operands[1])
-	       || label_mentioned_p (operands[1])))
+  /* APPLE LOCAL ARM pic support */
+  else if (! LEGITIMATE_INDIRECT_OPERAND_P (operands[1]))
       operands[1] = legitimize_pic_address (operands[1], SImode,
 					    (no_new_pseudos ? operands[0] : 0));
   "
@@ -4484,10 +4485,13 @@
 ;; the insn alone, and to force the minipool generation pass to then move
 ;; the GOT symbol to memory.
 
+;; APPLE LOCAL begin ARM pic support
 (define_insn "pic_load_addr_arm"
   [(set (match_operand:SI 0 "s_register_operand" "=r")
-	(unspec:SI [(match_operand:SI 1 "" "mX")] UNSPEC_PIC_SYM))]
-  "TARGET_ARM && flag_pic"
+	(unspec:SI [(match_operand:SI 1 "" "mX")
+		    (label_ref (match_operand 2 "" ""))] UNSPEC_PIC_SYM))
+   (use (label_ref (match_dup 2)))]
+  "TARGET_ARM && (flag_pic || (TARGET_MACHO && MACHO_DYNAMIC_NO_PIC_P))"
   "ldr%?\\t%0, %1"
   [(set_attr "type" "load1")
    (set (attr "pool_range")     (const_int 4096))
@@ -4496,12 +4500,16 @@
 
 (define_insn "pic_load_addr_thumb"
   [(set (match_operand:SI 0 "s_register_operand" "=l")
-	(unspec:SI [(match_operand:SI 1 "" "mX")] UNSPEC_PIC_SYM))]
-  "TARGET_THUMB && flag_pic"
+	(unspec:SI [(match_operand:SI 1 "" "mX")
+		    (label_ref (match_operand 2 "" ""))] UNSPEC_PIC_SYM))
+   (use (label_ref (match_dup 2)))]
+  "TARGET_THUMB && (flag_pic || (TARGET_MACHO && MACHO_DYNAMIC_NO_PIC_P))"
   "ldr\\t%0, %1"
   [(set_attr "type" "load1")
-   (set (attr "pool_range") (const_int 1024))]
+   (set (attr "pool_range") (const_int 1024))
+   (set_attr "length" "2")]
 )
+;; APPLE LOCAL end ARM pic support
 
 ;; This variant is used for AOF assembly, since it needs to mention the
 ;; pic register in the rtl.
@@ -4536,16 +4544,17 @@
 		      (const_int 4084)))]
 )
 
+;; APPLE LOCAL begin ARM pic support
 (define_insn "pic_add_dot_plus_four"
   [(set (match_operand:SI 0 "register_operand" "=r")
-	(unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "0")
+	(unspec:SI [(label_ref (match_operand 1 "" ""))
+		    (plus:SI (match_operand:SI 2 "register_operand" "0")
 			     (const (plus:SI (pc) (const_int 4))))]
-		   UNSPEC_PIC_BASE))
-   (use (match_operand 2 "" ""))]
-  "TARGET_THUMB"
+		   UNSPEC_PIC_BASE))]
+  "TARGET_THUMB && (flag_pic || (TARGET_MACHO && MACHO_DYNAMIC_NO_PIC_P))"
   "*
-  (*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\",
-				     INTVAL (operands[2]));
+  (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
+				     CODE_LABEL_NUMBER (operands[1]));
   return \"add\\t%0, %|pc\";
   "
   [(set_attr "length" "2")]
@@ -4553,18 +4562,19 @@
 
 (define_insn "pic_add_dot_plus_eight"
   [(set (match_operand:SI 0 "register_operand" "=r")
-	(unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "r")
+	(unspec:SI [(label_ref (match_operand 1 "" ""))
+		    (plus:SI (match_operand:SI 2 "register_operand" "r")
 			     (const (plus:SI (pc) (const_int 8))))]
-		   UNSPEC_PIC_BASE))
-   (use (match_operand 2 "" ""))]
-  "TARGET_ARM"
+		   UNSPEC_PIC_BASE))]
+  "TARGET_ARM && (flag_pic || (TARGET_MACHO && MACHO_DYNAMIC_NO_PIC_P))"
   "*
-    (*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\",
-				       INTVAL (operands[2]));
-    return \"add%?\\t%0, %|pc, %1\";
+    (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
+				       CODE_LABEL_NUMBER (operands[1]));
+    return \"add%?\\t%0, %|pc, %2\";
   "
   [(set_attr "predicable" "yes")]
 )
+;; APPLE LOCAL end ARM pic support
 
 (define_insn "tls_load_dot_plus_eight"
   [(set (match_operand:SI 0 "register_operand" "+r")
@@ -4601,17 +4611,64 @@
   ""
 )
 
-(define_expand "builtin_setjmp_receiver"
-  [(label_ref (match_operand 0 "" ""))]
-  "flag_pic"
+;; APPLE LOCAL begin ARM setjmp/longjmp interworking
+;; If we'll be  returning to thumb code, we need to set the low-order
+;; bit of the resume address.  builtin_setjmp_setup doesn't handle all
+;; of the setup, it just augments the logic in builtins.c, to post-
+;; process the already-initialized mini-jmp_buf.
+(define_expand "builtin_setjmp_setup"
+  [(use (match_operand 0 "register_operand"))]
+  "TARGET_THUMB"
+{
+  rtx resume_addr =
+    gen_rtx_MEM (Pmode, plus_constant (operands[0],
+				       GET_MODE_SIZE (Pmode)));
+  rtx resume_reg;
+
+  /* Set low-order bit of resume address */
+  resume_reg = force_reg (Pmode, resume_addr);
+  resume_reg = gen_rtx_IOR (Pmode, resume_reg, GEN_INT (1));
+  emit_move_insn (resume_addr, resume_reg);
+})
+
+;; Very similar to the logic in builtins.c, except that we always
+;; restore both ARM_HARD_FRAME_POINTER and THUMB_HARD_FRAME_POINTER,
+;; and we emit an "indirect_jump_exchange" instead of the standard
+;; "indirect_jump".  If we're jumping back into ARM code, we will
+;; unnecessarily (but harmlessly) trash the Thumb FP register.
+(define_expand "builtin_longjmp"
+  [(use (match_operand 0 "register_operand"))]
+  ""
   "
 {
-  /* r3 is clobbered by set/longjmp, so we can use it as a scratch
-     register.  */
-  if (arm_pic_register != INVALID_REGNUM)
-    arm_load_pic_register (1UL << 3);
+  rtx arm_saved_fp = gen_rtx_MEM (Pmode, operands[0]);
+  rtx lab =
+    gen_rtx_MEM (Pmode, plus_constant (operands[0],
+				       GET_MODE_SIZE (Pmode)));
+  rtx stack =
+    gen_rtx_MEM (Pmode, plus_constant (operands[0],
+				       2 * GET_MODE_SIZE (Pmode)));
+  rtx arm_fp = gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM);
+
+  emit_insn (gen_rtx_CLOBBER (VOIDmode, gen_rtx_MEM (BLKmode, arm_fp)));
+
+  emit_move_insn (arm_fp, arm_saved_fp);
+
+  emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+
+  if (arm_arch4t)
+    {
+      lab = copy_to_mode_reg (Pmode, lab);
+      emit_insn (gen_rtx_USE (VOIDmode, arm_fp));
+      emit_jump_insn (gen_indirect_jump_exchange (lab));
+      emit_barrier ();
+    }
+  else
+    emit_indirect_jump (lab);
+
   DONE;
 }")
+;; APPLE LOCAL end ARM setjmp/longjmp interworking
 
 ;; If copying one reg to another we can set the condition codes according to
 ;; its value.  Such a move is common after a return from subroutine and the
@@ -5831,8 +5888,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d0\\t%l3\";
-    case 6:  return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D0\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D0\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   "
   [(set (attr "far_jump")
@@ -5867,8 +5926,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d4\\t%l3\";
-    case 6:  return \"b%D4\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D4\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D4\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D4\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   "
   [(set (attr "far_jump")
@@ -5914,8 +5975,10 @@
   switch (get_attr_length (insn) - ((which_alternative > 1) ? 2 : 0))
     {
     case 4:  return \"b%d3\\t%l2\";
-    case 6:  return \"b%D3\\t.LCB%=\;b\\t%l2\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D3\\t.LCB%=\;bl\\t%l2\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D3\\t%.LCB%=\;b\\t%l2\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D3\\t%.LCB%=\;bl\\t%l2\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -5964,8 +6027,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d0\\t%l3\";
-    case 6:  return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D0\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D0\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   "
   [(set (attr "far_jump")
@@ -6008,8 +6073,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d0\\t%l3\";
-    case 6:  return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D0\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D0\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6052,8 +6119,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d0\\t%l3\";
-    case 6:  return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D0\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D0\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6089,8 +6158,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d3\\t%l2\";
-    case 6:  return \"b%D3\\t.LCB%=\;b\\t%l2\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D3\\t.LCB%=\;bl\\t%l2\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D3\\t%.LCB%=\;b\\t%l2\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D3\\t%.LCB%=\;bl\\t%l2\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6141,8 +6212,10 @@
   switch (get_attr_length (insn) - (which_alternative ? 2 : 0))
     {
     case 4:  return \"b%d5\\t%l4\";
-    case 6:  return \"b%D5\\t.LCB%=\;b\\t%l4\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D5\\t.LCB%=\;bl\\t%l4\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D5\\t%.LCB%=\;b\\t%l4\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D5\\t%.LCB%=\;bl\\t%l4\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6194,8 +6267,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d4\\t%l3\";
-    case 6:  return \"b%D4\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D4\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D4\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D4\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6246,8 +6321,10 @@
   switch (get_attr_length (insn) - (which_alternative ? 2 : 0))
     {
     case 4:  return \"b%d5\\t%l4\";
-    case 6:  return \"b%D5\\t.LCB%=\;b\\t%l4\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D5\\t.LCB%=\;bl\\t%l4\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D5\\t%.LCB%=\;b\\t%l4\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D5\\t%.LCB%=\;bl\\t%l4\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6299,8 +6376,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d4\\t%l3\";
-    case 6:  return \"b%D4\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D4\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D4\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D4\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6351,8 +6430,10 @@
   switch (get_attr_length (insn) - (which_alternative ? 2 : 0))
     {
     case 4:  return \"b%d5\\t%l4\";
-    case 6:  return \"b%D5\\t.LCB%=\;b\\t%l4\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D5\\t.LCB%=\;bl\\t%l4\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D5\\t%.LCB%=\;b\\t%l4\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D5\\t%.LCB%=\;bl\\t%l4\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6404,8 +6485,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d4\\t%l3\";
-    case 6:  return \"b%D4\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D4\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D4\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D4\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6458,8 +6541,10 @@
   switch (get_attr_length (insn) - (which_alternative ? 2 : 0))
     {
     case 4:  return \"b%d5\\t%l4\";
-    case 6:  return \"b%D5\\t.LCB%=\;b\\t%l4\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D5\\t.LCB%=\;bl\\t%l4\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D5\\t%.LCB%=\;b\\t%l4\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D5\\t%.LCB%=\;bl\\t%l4\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   }"
   [(set (attr "far_jump")
@@ -6533,15 +6618,17 @@
 
      switch (get_attr_length (insn) - (which_alternative ? 2 : 0))
        {
+	 /* APPLE LOCAL begin ARM MACH assembler */
 	 case 4:
 	   output_asm_insn (\"b%d0\\t%l1\", cond);
 	   return \"\";
 	 case 6:
-	   output_asm_insn (\"b%D0\\t.LCB%=\", cond);
-	   return \"b\\t%l4\\t%@long jump\\n.LCB%=:\";
+	   output_asm_insn (\"b%D0\\t%.LCB%=\", cond);
+	   return \"b\\t%l4\\t%@long jump\\n%.LCB%=:\";
 	 default:
-	   output_asm_insn (\"b%D0\\t.LCB%=\", cond);
-	   return \"bl\\t%l4\\t%@far jump\\n.LCB%=:\";
+	   output_asm_insn (\"b%D0\\t%.LCB%=\", cond);
+	   return \"bl\\t%l4\\t%@far jump\\n%.LCB%=:\";
+	 /* APPLE LOCAL end ARM MACH assembler */
        }
    }
   "
@@ -6640,10 +6727,12 @@
        {
 	 case 4:
 	   return \"b%d4\\t%l5\";
+	 /* APPLE LOCAL begin ARM MACH assembler */
 	 case 6:
-	   return \"b%D4\\t.LCB%=\;b\\t%l5\\t%@long jump\\n.LCB%=:\";
+	   return \"b%D4\\t%.LCB%=\;b\\t%l5\\t%@long jump\\n%.LCB%=:\";
 	 default:
-	   return \"b%D4\\t.LCB%=\;bl\\t%l5\\t%@far jump\\n.LCB%=:\";
+	   return \"b%D4\\t%.LCB%=\;bl\\t%l5\\t%@far jump\\n%.LCB%=:\";
+	 /* APPLE LOCAL end ARM MACH assembler */
        }
    }
   "
@@ -6723,10 +6812,12 @@
        {
 	 case 4:
 	   return \"b%d3\\t%l4\";
+	 /* APPLE LOCAL begin ARM MACH assembler */
 	 case 6:
-	   return \"b%D3\\t.LCB%=\;b\\t%l4\\t%@long jump\\n.LCB%=:\";
+	   return \"b%D3\\t%.LCB%=\;b\\t%l4\\t%@long jump\\n%.LCB%=:\";
 	 default:
-	   return \"b%D3\\t.LCB%=\;bl\\t%l4\\t%@far jump\\n.LCB%=:\";
+	   return \"b%D3\\t%.LCB%=\;bl\\t%l4\\t%@far jump\\n%.LCB%=:\";
+	 /* APPLE LOCAL end ARM MACH assembler */
        }
    }
   "
@@ -6789,10 +6880,12 @@
        {
 	 case 4:
 	   return \"b%d4\\t%l5\";
+	 /* APPLE LOCAL begin ARM MACH assembler */
 	 case 6:
-	   return \"b%D4\\t.LCB%=\;b\\t%l5\\t%@long jump\\n.LCB%=:\";
+	   return \"b%D4\\t%.LCB%=\;b\\t%l5\\t%@long jump\\n%.LCB%=:\";
 	 default:
-	   return \"b%D4\\t.LCB%=\;bl\\t%l5\\t%@far jump\\n.LCB%=:\";
+	   return \"b%D4\\t%.LCB%=\;bl\\t%l5\\t%@far jump\\n%.LCB%=:\";
+	 /* APPLE LOCAL end ARM MACH assembler */
        }
    }
   "
@@ -6847,8 +6940,10 @@
   switch (get_attr_length (insn))
     {
     case 4:  return \"b%d0\\t%l3\";
-    case 6:  return \"b%D0\\t.LCB%=\;b\\t%l3\\t%@long jump\\n.LCB%=:\";
-    default: return \"b%D0\\t.LCB%=\;bl\\t%l3\\t%@far jump\\n.LCB%=:\";
+    /* APPLE LOCAL begin ARM MACH assembler */
+    case 6:  return \"b%D0\\t%.LCB%=\;b\\t%l3\\t%@long jump\\n%.LCB%=:\";
+    default: return \"b%D0\\t%.LCB%=\;bl\\t%l3\\t%@far jump\\n%.LCB%=:\";
+    /* APPLE LOCAL end ARM MACH assembler */
     }
   "
   [(set (attr "far_jump")
@@ -7619,6 +7714,13 @@
   {
     rtx callee;
     
+    /* APPLE LOCAL begin ARM dynamic */
+#if TARGET_MACHO
+    if (MACHOPIC_INDIRECT)
+      operands[0] = machopic_indirect_call_target (operands[0]);
+#endif
+    /* APPLE LOCAL end ARM dynamic */
+
     /* In an untyped call, we can get NULL for operand 2.  */
     if (operands[2] == NULL_RTX)
       operands[2] = const0_rtx;
@@ -7720,7 +7822,16 @@
   "TARGET_EITHER"
   "
   {
-    rtx callee = XEXP (operands[1], 0);
+    /* APPLE LOCAL begin ARM dynamic */
+    rtx callee;
+
+#if TARGET_MACHO
+    if (MACHOPIC_INDIRECT)
+      operands[1] = machopic_indirect_call_target (operands[1]);
+#endif
+
+    callee = XEXP (operands[1], 0);
+    /* APPLE LOCAL end ARM dynamic */
     
     /* In an untyped call, we can get NULL for operand 2.  */
     if (operands[3] == 0)
@@ -7810,8 +7921,14 @@
 ;; Allow calls to SYMBOL_REFs specially as they are not valid general addresses
 ;; The 'a' causes the operand to be treated as an address, i.e. no '#' output.
 
+;; APPLE LOCAL begin ARM pic support
+;; Prevent these patterns from being used with dynamic symbol_refs.  An
+;; alternate approach would be to generate a stub, but this would be
+;; of questionnable value, as these patterns are not generally used
+;; for dynamic code anyway (see rdar://4514281 for an example of what it
+;; takes to get here).
 (define_insn "*call_symbol"
-  [(call (mem:SI (match_operand:SI 0 "" ""))
+  [(call (mem:SI (match_operand:SI 0 "arm_branch_target" ""))
 	 (match_operand 1 "" ""))
    (use (match_operand 2 "" ""))
    (clobber (reg:SI LR_REGNUM))]
@@ -7827,7 +7944,7 @@
 
 (define_insn "*call_value_symbol"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand:SI 1 "" ""))
+	(call (mem:SI (match_operand:SI 1 "arm_branch_target" ""))
 	(match_operand:SI 2 "" "")))
    (use (match_operand 3 "" ""))
    (clobber (reg:SI LR_REGNUM))]
@@ -7840,33 +7957,52 @@
   }"
   [(set_attr "type" "call")]
 )
+;; APPLE LOCAL end ARM pic support
 
+;; APPLE LOCAL begin ARM dynamic
 (define_insn "*call_insn"
-  [(call (mem:SI (match_operand:SI 0 "" ""))
+  [(call (mem:SI (match_operand:SI 0 "arm_branch_target" ""))
 	 (match_operand:SI 1 "" ""))
    (use (match_operand 2 "" ""))
    (clobber (reg:SI LR_REGNUM))]
   "TARGET_THUMB
    && GET_CODE (operands[0]) == SYMBOL_REF
    && !arm_is_longcall_p (operands[0], INTVAL (operands[2]), 1)"
-  "bl\\t%a0"
+  "*
+  {
+#if TARGET_MACHO
+    if (machopic_lookup_stub_or_non_lazy_ptr (XSTR (operands[0], 0)))
+      return \"blx\\t%a0\";
+    else
+#endif
+      return \"bl\\t%a0\";
+  }"
   [(set_attr "length" "4")
    (set_attr "type" "call")]
 )
 
 (define_insn "*call_value_insn"
   [(set (match_operand 0 "" "")
-	(call (mem:SI (match_operand 1 "" ""))
+	(call (mem:SI (match_operand 1 "arm_branch_target" ""))
 	      (match_operand 2 "" "")))
    (use (match_operand 3 "" ""))
    (clobber (reg:SI LR_REGNUM))]
   "TARGET_THUMB
    && GET_CODE (operands[1]) == SYMBOL_REF
    && !arm_is_longcall_p (operands[1], INTVAL (operands[3]), 1)"
-  "bl\\t%a1"
+  "*
+  {
+#if TARGET_MACHO
+    if (machopic_lookup_stub_or_non_lazy_ptr (XSTR (operands[1], 0)))
+      return \"blx\\t%a1\";
+    else
+#endif
+      return \"bl\\t%a1\";
+  }"
   [(set_attr "length" "4")
    (set_attr "type" "call")]
 )
+;; APPLE LOCAL end ARM dynamic
 
 ;; We may also be able to do sibcalls for Thumb, but it's much harder...
 (define_expand "sibcall"
@@ -7877,6 +8013,13 @@
   "TARGET_ARM"
   "
   {
+/* APPLE LOCAL begin ARM dynamic */
+#if TARGET_MACHO
+    if (MACHOPIC_INDIRECT)
+      operands[0] = machopic_indirect_call_target (operands[0]);
+#endif
+/* APPLE LOCAL end ARM dynamic */
+
     if (operands[2] == NULL_RTX)
       operands[2] = const0_rtx;
   }"
@@ -7891,6 +8034,13 @@
   "TARGET_ARM"
   "
   {
+/* APPLE LOCAL begin ARM dynamic */
+#if TARGET_MACHO
+    if (MACHOPIC_INDIRECT)
+      operands[1] = machopic_indirect_call_target (operands[1]);
+#endif
+/* APPLE LOCAL end ARM dynamic */
+
     if (operands[3] == NULL_RTX)
       operands[3] = const0_rtx;
   }"
@@ -8190,6 +8340,33 @@
    (set_attr "length" "12")]
 )
 
+;; APPLE LOCAL begin ARM setjmp/longjmp interworking
+;; Indirect jump with possible change between ARM/Thumb state
+(define_expand "indirect_jump_exchange"
+  [(unspec:SI [(match_operand:SI 0 "s_register_operand" "")]
+	      UNSPEC_JMP_XCHG)]
+  "TARGET_EITHER"
+  ""
+)
+
+(define_insn "*arm_indirect_jump_exchange"
+  [(unspec:SI [(match_operand:SI 0 "s_register_operand" "r")]
+	      UNSPEC_JMP_XCHG)]
+  "TARGET_ARM && (arm_arch4t)"
+  "bx\\t%0"
+  [(set_attr "predicable" "yes")]
+)
+
+(define_insn "*thumb_indirect_jump_exchange"
+  [(unspec:SI [(match_operand:SI 0 "s_register_operand" "l*r")]
+	      UNSPEC_JMP_XCHG)]
+  "TARGET_THUMB"
+  "bx\\t%0"
+  [(set_attr "conds" "clob")
+   (set_attr "length" "2")]
+)
+;; APPLE LOCAL end ARM setjmp/longjmp interworking
+
 (define_expand "indirect_jump"
   [(set (pc)
 	(match_operand:SI 0 "s_register_operand" ""))]
@@ -10293,6 +10470,16 @@
   [(set_attr "conds" "clob")]
 )
 
+;; APPLE LOCAL begin ARM builtin_trap
+
+;; Darwin support
+
+(define_insn "trap"
+  [(trap_if (const_int 1) (const_int 0))]
+  ""
+  "trap")
+;; APPLE LOCAL end ARM builtin_trap
+ 
 ;; Load the FPA co-processor patterns
 (include "fpa.md")
 ;; Load the Maverick co-processor patterns

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.opt?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.opt Thu Nov  8 20:30:15 2007
@@ -98,10 +98,18 @@
 Target Report RejectNegative InverseMask(BIG_END)
 Assume target CPU is configured as little endian
 
+mlong-branch
+Target Mask(LONG_CALLS)
+Alias for -mlong-calls
+
 mlong-calls
-Target Report Mask(LONG_CALLS)
+Target Report Mask(LONG_CALLS) MaskExists
 Generate call insns as indirect calls, if necessary
 
+mlongcall
+Target Mask(LONG_CALLS) MaskExists
+Alias for -mlong-calls
+
 mpic-register=
 Target RejectNegative Joined Var(arm_pic_register_string)
 Specify the register to be used for PIC addressing
@@ -130,9 +138,11 @@
 Target Report Mask(THUMB)
 Compile for the Thumb not the ARM
 
+; APPLE LOCAL begin ARM interworking
 mthumb-interwork
-Target Report Mask(INTERWORK)
+Target Report Var(interwork_option) Init(-1)
 Support calls between Thumb and ARM instruction sets
+; APPLE LOCAL end ARM interworking
 
 mtp=
 Target RejectNegative Joined Var(target_thread_switch)

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-df.S
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-df.S?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-df.S (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-df.S Thu Nov  8 20:30:15 2007
@@ -59,7 +59,8 @@
 #ifdef L_negdf2
 
 ARM_FUNC_START negdf2
-ARM_FUNC_ALIAS aeabi_dneg negdf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_dneg, negdf2)
 
 	@ flip sign bit
 	eor	xh, xh, #0x80000000
@@ -78,7 +79,8 @@
 	b	1f	
 
 ARM_FUNC_START subdf3
-ARM_FUNC_ALIAS aeabi_dsub subdf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_dsub, subdf3)
 
 	eor	yh, yh, #0x80000000	@ flip sign bit of second arg
 #if defined(__INTERWORKING_STUBS__)
@@ -86,7 +88,8 @@
 #endif
 
 ARM_FUNC_START adddf3
-ARM_FUNC_ALIAS aeabi_dadd adddf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_dadd, adddf3)
 
 1:	stmfd	sp!, {r4, r5, lr}
 
@@ -119,7 +122,8 @@
 	@ already in xh-xl.  We need up to 54 bit to handle proper rounding
 	@ of 0x1p54 - 1.1.
 	cmp	r5, #54
-	RETLDM	"r4, r5" hi
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(hi, r4, r5)
 
 	@ Convert mantissa to signed integer.
 	tst	xh, #0x80000000
@@ -199,7 +203,8 @@
 	adcs	xl, xl, #0
 	adc	xh, xh, r4, lsl #20
 	orr	xh, xh, r5
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 	@ Result must be shifted left and exponent adjusted.
 LSYM(Lad_a):
@@ -272,7 +277,8 @@
 3:	subs	r4, r4, r3
 	addge	xh, xh, r4, lsl #20
 	orrge	xh, xh, r5
-	RETLDM	"r4, r5" ge
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(ge, r4, r5)
 
 	@ Exponent too small, denormalize result.
 	@ Find out proper shift value.
@@ -288,7 +294,8 @@
 	mov	xl, xl, lsr r4
 	orr	xl, xl, xh, lsl r2
 	orr	xh, r5, xh, lsr r4
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 	@ shift result right of 21 to 31 bits, or left 11 to 1 bits after
 	@ a register switch from xh to xl.
@@ -297,13 +304,15 @@
 	mov	xl, xl, lsr r2
 	orr	xl, xl, xh, lsl r4
 	mov	xh, r5
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 	@ Shift value right of 32 to 64 bits, or 0 to 32 bits after a switch
 	@ from xh to xl.
 2:	mov	xl, xh, lsr r4
 	mov	xh, r5
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 	@ Adjust exponents for denormalized arguments.
 	@ Note that r4 must not remain equal to 0.
@@ -329,14 +338,16 @@
 	orrs	ip, r4, xl
 	moveq	xh, yh
 	moveq	xl, yl
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 1:	teq	xh, yh
 
 	@ Result is x - x = 0.
 	movne	xh, #0
 	movne	xl, #0
-	RETLDM	"r4, r5" ne
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(ne, r4, r5)
 
 	@ Result is x + x = 2x.
 	movs	ip, r4, lsr #21
@@ -344,10 +355,12 @@
 	movs	xl, xl, lsl #1
 	adcs	xh, xh, xh
 	orrcs	xh, xh, #0x80000000
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 2:	adds	r4, r4, #(2 << 21)
 	addcc	xh, xh, #(1 << 20)
-	RETLDM	"r4, r5" cc
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(cc, r4, r5)
 	and	r5, xh, #0x80000000
 
 	@ Overflow: return INF.
@@ -355,7 +368,8 @@
 	orr	xh, r5, #0x7f000000
 	orr	xh, xh, #0x00f00000
 	mov	xl, #0
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 	@ At least one of x or y is INF/NAN.
 	@   if xh-xl != INF/NAN: return yh-yl (which is INF/NAN)
@@ -374,7 +388,8 @@
 	orreqs	r5, yl, yh, lsl #12
 	teqeq	xh, yh
 	orrne	xh, xh, #0x00080000	@ quiet NAN
-	RETLDM	"r4, r5"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5)
 
 	FUNC_END aeabi_dsub
 	FUNC_END subdf3
@@ -382,7 +397,8 @@
 	FUNC_END adddf3
 
 ARM_FUNC_START floatunsidf
-ARM_FUNC_ALIAS aeabi_ui2d floatunsidf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_ui2d,floatunsidf)
 
 	teq	r0, #0
 	moveq	r1, #0
@@ -391,9 +407,11 @@
 	mov	r4, #0x400		@ initial exponent
 	add	r4, r4, #(52-1 - 1)
 	mov	r5, #0			@ sign bit is 0
-	.ifnc	xl, r0
+	/* APPLE LOCAL begin ARM MACH assembler */
+#if !defined(__VFP_FP__) || defined(__ARMEB__)
 	mov	xl, r0
-	.endif
+#endif
+	/* APPLE LOCAL end ARM MACH assembler */
 	mov	xh, #0
 	b	LSYM(Lad_l)
 
@@ -401,7 +419,8 @@
 	FUNC_END floatunsidf
 
 ARM_FUNC_START floatsidf
-ARM_FUNC_ALIAS aeabi_i2d floatsidf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_i2d,floatsidf)
 
 	teq	r0, #0
 	moveq	r1, #0
@@ -411,9 +430,11 @@
 	add	r4, r4, #(52-1 - 1)
 	ands	r5, r0, #0x80000000	@ sign bit in r5
 	rsbmi	r0, r0, #0		@ absolute value
-	.ifnc	xl, r0
+	/* APPLE LOCAL begin ARM MACH assembler */
+#if !defined(__VFP_FP__) || defined(__ARMEB__)
 	mov	xl, r0
-	.endif
+#endif
+	/* APPLE LOCAL end ARM MACH assembler */
 	mov	xh, #0
 	b	LSYM(Lad_l)
 
@@ -421,7 +442,8 @@
 	FUNC_END floatsidf
 
 ARM_FUNC_START extendsfdf2
-ARM_FUNC_ALIAS aeabi_f2d extendsfdf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_f2d,extendsfdf2)
 
 	movs	r2, r0, lsl #1		@ toss sign bit
 	mov	xh, r2, asr #3		@ stretch exponent
@@ -447,7 +469,8 @@
 	FUNC_END extendsfdf2
 
 ARM_FUNC_START floatundidf
-ARM_FUNC_ALIAS aeabi_ul2d floatundidf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_ul2d,floatundidf)
 
 	orrs	r2, r0, r1
 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
@@ -469,7 +492,8 @@
 	b	2f
 
 ARM_FUNC_START floatdidf
-ARM_FUNC_ALIAS aeabi_l2d floatdidf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_l2d,floatdidf)
 
 	orrs	r2, r0, r1
 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
@@ -496,11 +520,13 @@
 	add	r4, r4, #(52-1 - 1)
 
 	@ FPA little-endian: must swap the word order.
-	.ifnc	xh, ah
+	/* APPLE LOCAL begin ARM MACH assembler */
+#if !defined(__VFP_FP__) && !defined(__ARMEB__)
 	mov	ip, al
 	mov	xh, ah
 	mov	xl, ip
-	.endif
+#endif
+	/* APPLE LOCAL end ARM MACH assembler */
 
 	movs	ip, xh, lsr #22
 	beq	LSYM(Lad_p)
@@ -542,7 +568,8 @@
 #ifdef L_muldivdf3
 
 ARM_FUNC_START muldf3
-ARM_FUNC_ALIAS aeabi_dmul muldf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_dmul,muldf3)
 	stmfd	sp!, {r4, r5, r6, lr}
 
 	@ Mask out exponents, trap any zero/denormal/INF/NAN.
@@ -674,7 +701,8 @@
 	moveqs	lr, xl, lsr #1
 	adcs	xl, xl, #0
 	adc	xh, xh, r4, lsl #20
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	@ Multiplication by 0x1p*: let''s shortcut a lot of code.
 LSYM(Lml_1):
@@ -685,7 +713,8 @@
 	subs	r4, r4, ip, lsr #1
 	rsbgts	r5, r4, ip
 	orrgt	xh, xh, r4, lsl #20
-	RETLDM	"r4, r5, r6" gt
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(gt, r4, r5, r6)
 
 	@ Under/overflow: fix things up for the code below.
 	orr	xh, xh, #0x00100000
@@ -700,7 +729,8 @@
 	cmn	r4, #(53 + 1)
 	movle	xl, #0
 	bicle	xh, xh, #0x7fffffff
-	RETLDM	"r4, r5, r6" le
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(le, r4, r5, r6)
 
 	@ Find out proper shift value.
 	rsb	r4, r4, #0
@@ -721,7 +751,8 @@
 	adc	xh, r2, xh, lsr r4
 	orrs	lr, lr, r3, lsl #1
 	biceq	xl, xl, r3, lsr #31
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	@ shift result right of 21 to 31 bits, or left 11 to 1 bits after
 	@ a register switch from xh to xl. Then round.
@@ -735,7 +766,8 @@
 	adc	xh, xh, #0
 	orrs	lr, lr, r3, lsl #1
 	biceq	xl, xl, r3, lsr #31
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	@ Shift value right of 32 to 64 bits, or 0 to 32 bits after a switch
 	@ from xh to xl.  Leftover bits are in r3-r6-lr for rounding.
@@ -749,7 +781,8 @@
 	add	xl, xl, r3, lsr #31
 	orrs	lr, lr, r3, lsl #1
 	biceq	xl, xl, r3, lsr #31
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	@ One or both arguments are denormalized.
 	@ Scale them leftwards and preserve sign bit.
@@ -791,7 +824,8 @@
 	eor	xh, xh, yh
 	bic	xh, xh, #0x7fffffff
 	mov	xl, #0
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 1:	@ One or both args are INF or NAN.
 	orrs	r6, xl, xh, lsl #1
@@ -820,19 +854,22 @@
 	orr	xh, xh, #0x7f000000
 	orr	xh, xh, #0x00f00000
 	mov	xl, #0
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	@ Return a quiet NAN.
 LSYM(Lml_n):
 	orr	xh, xh, #0x7f000000
 	orr	xh, xh, #0x00f80000
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	FUNC_END aeabi_dmul
 	FUNC_END muldf3
 
 ARM_FUNC_START divdf3
-ARM_FUNC_ALIAS aeabi_ddiv divdf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_ddiv,divdf3)
 	
 	stmfd	sp!, {r4, r5, r6, lr}
 
@@ -950,7 +987,8 @@
 	moveqs	ip, xl, lsr #1
 	adcs	xl, xl, #0
 	adc	xh, xh, r4, lsl #20
-	RETLDM	"r4, r5, r6"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r4, r5, r6)
 
 	@ Division by 0x1p*: shortcut a lot of code.
 LSYM(Ldv_1):
@@ -959,7 +997,8 @@
 	adds	r4, r4, ip, lsr #1
 	rsbgts	r5, r4, ip
 	orrgt	xh, xh, r4, lsl #20
-	RETLDM	"r4, r5, r6" gt
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM2(gt, r4, r5, r6)
 
 	orr	xh, xh, #0x00100000
 	mov	lr, #0
@@ -1015,18 +1054,22 @@
 @ Note: only r0 (return value) and ip are clobbered here.
 
 ARM_FUNC_START gtdf2
-ARM_FUNC_ALIAS gedf2 gtdf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(gedf2,gtdf2)
 	mov	ip, #-1
 	b	1f
 
 ARM_FUNC_START ltdf2
-ARM_FUNC_ALIAS ledf2 ltdf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(ledf2,ltdf2)
 	mov	ip, #1
 	b	1f
 
 ARM_FUNC_START cmpdf2
-ARM_FUNC_ALIAS nedf2 cmpdf2
-ARM_FUNC_ALIAS eqdf2 cmpdf2
+/* APPLE LOCAL begin ARM MACH assembler */
+ARM_FUNC_ALIAS(nedf2,cmpdf2)
+ARM_FUNC_ALIAS(eqdf2,cmpdf2)
+/* APPLE LOCAL end ARM MACH assembler */
 	mov	ip, #1			@ how should we specify unordered here?
 
 1:	str	ip, [sp, #-4]
@@ -1096,7 +1139,8 @@
 	b	6f
 	
 ARM_FUNC_START aeabi_cdcmpeq
-ARM_FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_cdcmple,aeabi_cdcmpeq)
 
 	@ The status-returning routines are required to preserve all
 	@ registers except ip, lr, and cpsr.
@@ -1107,7 +1151,8 @@
 	@ Clear the C flag if the return value was -1, indicating
 	@ that the first operand was smaller than the second.
 	cmnmi	 r0, #0
-	RETLDM   "r0"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r0)
 
 	FUNC_END aeabi_cdcmple
 	FUNC_END aeabi_cdcmpeq
@@ -1169,7 +1214,8 @@
 #ifdef L_unorddf2
 
 ARM_FUNC_START unorddf2
-ARM_FUNC_ALIAS aeabi_dcmpun unorddf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_dcmpun,unorddf2)
 
 	mov	ip, xh, lsl #1
 	mvns	ip, ip, asr #21
@@ -1195,7 +1241,8 @@
 #ifdef L_fixdfsi
 
 ARM_FUNC_START fixdfsi
-ARM_FUNC_ALIAS aeabi_d2iz fixdfsi
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_d2iz,fixdfsi)
 
 	@ check exponent range.
 	mov	r2, xh, lsl #1
@@ -1235,7 +1282,8 @@
 #ifdef L_fixunsdfsi
 
 ARM_FUNC_START fixunsdfsi
-ARM_FUNC_ALIAS aeabi_d2uiz fixunsdfsi
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_d2uiz,fixunsdfsi)
 
 	@ check exponent range.
 	movs	r2, xh, lsl #1
@@ -1273,7 +1321,8 @@
 #ifdef L_truncdfsf2
 
 ARM_FUNC_START truncdfsf2
-ARM_FUNC_ALIAS aeabi_d2f truncdfsf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_d2f,truncdfsf2)
 
 	@ check exponent range.
 	mov	r2, xh, lsl #1

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-sf.S
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-sf.S?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-sf.S (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/ieee754-sf.S Thu Nov  8 20:30:15 2007
@@ -41,7 +41,8 @@
 #ifdef L_negsf2
 	
 ARM_FUNC_START negsf2
-ARM_FUNC_ALIAS aeabi_fneg negsf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_fneg,negsf2)
 
 	eor	r0, r0, #0x80000000	@ flip sign bit
 	RET
@@ -59,7 +60,8 @@
 	b	1f
 
 ARM_FUNC_START subsf3
-ARM_FUNC_ALIAS aeabi_fsub subsf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_fsub,subsf3)
 
 	eor	r1, r1, #0x80000000	@ flip sign bit of second arg
 #if defined(__INTERWORKING_STUBS__)
@@ -67,7 +69,8 @@
 #endif
 
 ARM_FUNC_START addsf3
-ARM_FUNC_ALIAS aeabi_fadd addsf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_fadd,addsf3)
 
 1:	@ Look for zeroes, equal values, INF, or NAN.
 	movs	r2, r0, lsl #1
@@ -269,13 +272,15 @@
 	FUNC_END subsf3
 
 ARM_FUNC_START floatunsisf
-ARM_FUNC_ALIAS aeabi_ui2f floatunsisf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_ui2f,floatunsisf)
 		
 	mov	r3, #0
 	b	1f
 
 ARM_FUNC_START floatsisf
-ARM_FUNC_ALIAS aeabi_i2f floatsisf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_i2f,floatsisf)
 	
 	ands	r3, r0, #0x80000000
 	rsbmi	r0, r0, #0
@@ -286,9 +291,11 @@
 	@ Add initial exponent to sign
 	orr	r3, r3, #((127 + 23) << 23)
 
-	.ifnc	ah, r0
+	/* APPLE LOCAL begin ARM MACH assembler */
+#ifndef __ARMEB__
 	mov	ah, r0
-	.endif
+#endif
+	/* APPLE LOCAL end ARM MACH assembler */
 	mov	al, #0
 	b	2f
 
@@ -298,7 +305,8 @@
 	FUNC_END floatunsisf
 
 ARM_FUNC_START floatundisf
-ARM_FUNC_ALIAS aeabi_ul2f floatundisf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_ul2f,floatundisf)
 
 	orrs	r2, r0, r1
 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
@@ -310,7 +318,8 @@
 	b	1f
 
 ARM_FUNC_START floatdisf
-ARM_FUNC_ALIAS aeabi_l2f floatdisf
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_l2f,floatdisf)
 
 	orrs	r2, r0, r1
 #if !defined (__VFP_FP__) && !defined(__SOFTFP__)
@@ -403,7 +412,8 @@
 #ifdef L_muldivsf3
 
 ARM_FUNC_START mulsf3
-ARM_FUNC_ALIAS aeabi_fmul mulsf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_fmul,mulsf3)
 
 	@ Mask out exponents, trap any zero/denormal/INF/NAN.
 	mov	ip, #0xff
@@ -592,7 +602,8 @@
 	FUNC_END mulsf3
 
 ARM_FUNC_START divsf3
-ARM_FUNC_ALIAS aeabi_fdiv divsf3
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_fdiv,divsf3)
 
 	@ Mask out exponents, trap any zero/denormal/INF/NAN.
 	mov	ip, #0xff
@@ -739,18 +750,22 @@
 	@   ip, r0, r1, r2, r3
 
 ARM_FUNC_START gtsf2
-ARM_FUNC_ALIAS gesf2 gtsf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(gesf2,gtsf2)
 	mov	ip, #-1
 	b	1f
 
 ARM_FUNC_START ltsf2
-ARM_FUNC_ALIAS lesf2 ltsf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(lesf2,ltsf2)
 	mov	ip, #1
 	b	1f
 
 ARM_FUNC_START cmpsf2
-ARM_FUNC_ALIAS nesf2 cmpsf2
-ARM_FUNC_ALIAS eqsf2 cmpsf2
+/* APPLE LOCAL begin ARM MACH assembler */
+ARM_FUNC_ALIAS(nesf2,cmpsf2)
+ARM_FUNC_ALIAS(eqsf2,cmpsf2)
+/* APPLE LOCAL end ARM MACH assembler */
 	mov	ip, #1			@ how should we specify unordered here?
 
 1:	str	ip, [sp, #-4]
@@ -802,7 +817,8 @@
 	b	6f
 
 ARM_FUNC_START aeabi_cfcmpeq
-ARM_FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_cfcmple,aeabi_cfcmpeq)
 
 	@ The status-returning routines are required to preserve all
 	@ registers except ip, lr, and cpsr.
@@ -813,7 +829,8 @@
 	@ Clear the C flag if the return value was -1, indicating
 	@ that the first operand was smaller than the second.
 	cmnmi	 r0, #0
-	RETLDM  "r0, r1, r2, r3"
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1(r0, r1, r2, r3)
 
 	FUNC_END aeabi_cfcmple
 	FUNC_END aeabi_cfcmpeq
@@ -875,7 +892,8 @@
 #ifdef L_unordsf2
 
 ARM_FUNC_START unordsf2
-ARM_FUNC_ALIAS aeabi_fcmpun unordsf2
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_fcmpun,unordsf2)
 
 	mov	r2, r0, lsl #1
 	mov	r3, r1, lsl #1
@@ -900,7 +918,8 @@
 #ifdef L_fixsfsi
 
 ARM_FUNC_START fixsfsi
-ARM_FUNC_ALIAS aeabi_f2iz fixsfsi
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_f2iz,fixsfsi)
 
 	@ check exponent range.
 	mov	r2, r0, lsl #1
@@ -940,7 +959,8 @@
 #ifdef L_fixunssfsi
 
 ARM_FUNC_START fixunssfsi
-ARM_FUNC_ALIAS aeabi_f2uiz fixunssfsi
+/* APPLE LOCAL ARM MACH assembler */
+ARM_FUNC_ALIAS(aeabi_f2uiz,fixunssfsi)
 
 	@ check exponent range.
 	movs	r2, r0, lsl #1

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/lib1funcs.asm Thu Nov  8 20:30:15 2007
@@ -179,42 +179,48 @@
 #endif
 .endm
 
-/* Don't pass dirn, it's there just to get token pasting right.  */
-
-.macro	RETLDM	regs=, cond=, unwind=, dirn=ia
+/* APPLE LOCAL begin ARM MACH assembler macros */
 #if defined (__INTERWORKING__)
-	.ifc "\regs",""
-	ldr\cond	lr, [sp], #8
-	.else
-	ldm\cond\dirn	sp!, {\regs, lr}
-	.endif
-	.ifnc "\unwind", ""
-	/* Mark LR as restored.  */
-97:	cfi_pop 97b - \unwind, 0xe, 0x0
-	.endif
-	bx\cond	lr
-#else
-	.ifc "\regs",""
-	ldr\cond	pc, [sp], #8
-	.else
-	ldm\cond\dirn	sp!, {\regs, pc}
-	.endif
+#define RETLDM \
+	ldr     lr, [sp], #8 ; \
+	bx      lr
+#define RETLDM1(...) \
+	ldmia   sp!, {__VA_ARGS__, lr} ; \
+	bx      lr
+#define RETLDM2(cond,...) \
+	ldm##cond##ia   sp!, {__VA_ARGS__, lr} ; \
+	bx##cond        lr
+#define RETLDM_unwind(addr) \
+	ldr	lr, [sp], #8 ; \
+9:	cfi_pop	9b - addr, 0xe, 0x0 ; \
+	bx	lr
+#else
+#define RETLDM \
+	ldr     pc, [sp], #8
+#define RETLDM1(...) \
+	ldmia   sp!, {__VA_ARGS__, pc}
+#define RETLDM2(cond,...) \
+	ldm##cond##ia   sp!, {__VA_ARGS__, pc}
+#define RETLDM_unwind(addr) \
+	ldr	pc, [sp], #8
 #endif
-.endm
-
 
 .macro ARM_LDIV0 name
 	str	lr, [sp, #-8]!
+#if !defined(__MACH__)
 98:	cfi_push 98b - __\name, 0xe, -0x8, 0x8
+#endif
 	bl	SYM (__div0) __PLT__
 	mov	r0, #0			@ About as wrong as it could be.
-	RETLDM	unwind=98b
+	RETLDM_unwind (8b)
 .endm
 
 
 .macro THUMB_LDIV0 name
 	push	{ r1, lr }
-98:	cfi_push 98b - __\name, 0xe, -0x4, 0x8
+#if !defined(__MACH__)
+7:	cfi_push 7b - __\name, 0xe, -0x4, 0x8
+#endif
 	bl	SYM (__div0)
 	mov	r0, #0			@ About as wrong as it could be.
 #if defined (__INTERWORKING__)
@@ -226,39 +232,71 @@
 .endm
 
 .macro FUNC_END name
+#if defined(__MACH__)
+	SIZE (__$0)
+#else
 	SIZE (__\name)
+#endif
 .endm
 
 .macro DIV_FUNC_END name
+#if !defined(__MACH__)
 	cfi_start	__\name, LSYM(Lend_div0)
+#endif
 LSYM(Ldiv0):
 #ifdef __thumb__
 	THUMB_LDIV0 \name
 #else
 	ARM_LDIV0 \name
 #endif
+#if defined(__MACH__)
+	FUNC_END $0
+#else
 	cfi_end	LSYM(Lend_div0)
 	FUNC_END \name
+#endif
 .endm
 
 .macro THUMB_FUNC_START name
+#if defined(__MACH__)
+	.globl	SYM ($0)
+	TYPE	($0)
+	.thumb_func
+SYM ($0):
+#else
 	.globl	SYM (\name)
 	TYPE	(\name)
 	.thumb_func
 SYM (\name):
+#endif
 .endm
+/* APPLE LOCAL end ARM MACH assembler */
 
 /* Function start macros.  Variants for ARM and Thumb.  */
 
 #ifdef __thumb__
 #define THUMB_FUNC .thumb_func
 #define THUMB_CODE .force_thumb
+/* APPLE LOCAL ARM function alignment */
+#define FUNC_ALIGN .align 1
 #else
 #define THUMB_FUNC
 #define THUMB_CODE
+/* APPLE LOCAL ARM function alignment */
+#define FUNC_ALIGN .align 2
 #endif
 	
+/* APPLE LOCAL begin ARM MACH assembler */
 .macro FUNC_START name
+#if defined(__MACH__)
+	.text
+	.globl SYM (__$0)
+	TYPE (__$0)
+	FUNC_ALIGN
+	THUMB_CODE
+	THUMB_FUNC
+SYM (__$0):
+#else
 	.text
 	.globl SYM (__\name)
 	TYPE (__\name)
@@ -266,6 +304,7 @@
 	THUMB_CODE
 	THUMB_FUNC
 SYM (__\name):
+#endif
 .endm
 
 /* Special function that will always be coded in ARM assembly, even if
@@ -273,51 +312,82 @@
 
 #if defined(__INTERWORKING_STUBS__)
 .macro	ARM_FUNC_START name
+
+#if defined(__MACH)
+	FUNC_START $0
+#else
 	FUNC_START \name
+#endif
 	bx	pc
 	nop
 	.arm
 /* A hook to tell gdb that we've switched to ARM mode.  Also used to call
    directly from other local arm routines.  */
+#if defined(__MACH__)
+_L__$0:
+#else
 _L__\name:		
+#endif
 .endm
 #define EQUIV .thumb_set
 /* Branch directly to a function declared with ARM_FUNC_START.
    Must be called in arm mode.  */
 .macro  ARM_CALL name
+#if defined(__MACH__)
+	bl	_L__$0
+#else
 	bl	_L__\name
+#endif
 .endm
 #else
 .macro	ARM_FUNC_START name
+#if defined(__MACH__)
+	.text
+	.globl SYM (__$0)
+	TYPE (__$0)
+	.align 0
+	.arm
+SYM (__$0):
+#else
 	.text
 	.globl SYM (__\name)
 	TYPE (__\name)
 	.align 0
 	.arm
 SYM (__\name):
+#endif
 .endm
 #define EQUIV .set
 .macro  ARM_CALL name
+#if defined(__MACH__)
+	bl	SYM (__$0)
+#else
 	bl	__\name
+#endif
 .endm
 #endif
 
-.macro	FUNC_ALIAS new old
-	.globl	SYM (__\new)
 #if defined (__thumb__)
-	.thumb_set	SYM (__\new), SYM (__\old)
+#define FUNC_ALIAS(new,old)				  \
+	.globl  SYM (__##new)				; \
+	.thumb_set	SYM (__##new), SYM (__##old)
 #else
-	.set	SYM (__\new), SYM (__\old)
+#define FUNC_ALIAS(new,old)				  \
+	.globl  SYM (__##new)				; \
+	.set    SYM (__##new), SYM (__##old)
 #endif
-.endm
 
-.macro	ARM_FUNC_ALIAS new old
-	.globl	SYM (__\new)
-	EQUIV	SYM (__\new), SYM (__\old)
 #if defined(__INTERWORKING_STUBS__)
-	.set	SYM (_L__\new), SYM (_L__\old)
+#define ARM_FUNC_ALIAS(new,old)				  \
+	.globl  SYM (__##new)				; \
+	EQUIV   SYM (_##new), SYM (__##old)		; \
+	.set    SYM (_L__##new), SYM (_L__##old)
+#else
+#define ARM_FUNC_ALIAS(new,old)				  \
+	.globl  SYM (__##new)				; \
+	EQUIV   SYM (__##new), SYM (__##old)
 #endif
-.endm
+/* APPLE LOCAL end ARM MACH assembler */
 
 #ifdef __thumb__
 /* Register aliases.  */
@@ -339,374 +409,429 @@
 /* ------------------------------------------------------------------------ */
 /*		Bodies of the division and modulo routines.		    */
 /* ------------------------------------------------------------------------ */	
-.macro ARM_DIV_BODY dividend, divisor, result, curbit
-
+/* APPLE LOCAL begin ARM MACH assembler */
 #if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
-
-	clz	\curbit, \dividend
-	clz	\result, \divisor
-	sub	\curbit, \result, \curbit
-	rsbs	\curbit, \curbit, #31
-	addne	\curbit, \curbit, \curbit, lsl #1
-	mov	\result, #0
-	addne	pc, pc, \curbit, lsl #2
-	nop
-	.set	shift, 32
-	.rept	32
-	.set	shift, shift - 1
-	cmp	\dividend, \divisor, lsl #shift
-	adc	\result, \result, \result
-	subcs	\dividend, \dividend, \divisor, lsl #shift
-	.endr
-
+#define ARMV5_DIV_LOOP(dividend, divisor, result)		  \
+	.set	shift, shift - 1				; \
+	cmp	dividend, divisor, lsl #shift			; \
+	adc	result, result, result				; \
+	subcs	dividend, dividend, divisor, lsl #shift
+#define ARM_DIV_BODY(dividend, divisor, result, curbit)	  	  \
+	clz	curbit, dividend				; \
+	clz	result, divisor					; \
+	sub	curbit, result, curbit				; \
+	rsbs	curbit, curbit, #31				; \
+	addne	curbit, curbit, curbit, lsl #1			; \
+	mov	result, #0					; \
+	addne	pc, pc, curbit, lsl #2				; \
+	nop							; \
+	.set	shift, 32					; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)		; \
+	ARMV5_DIV_LOOP (dividend, divisor, result)
 #else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
 #if __ARM_ARCH__ >= 5
-
-	clz	\curbit, \divisor
-	clz	\result, \dividend
-	sub	\result, \curbit, \result
-	mov	\curbit, #1
-	mov	\divisor, \divisor, lsl \result
-	mov	\curbit, \curbit, lsl \result
-	mov	\result, #0
-	
+#define ARM_DIV_BODY_P1(dividend, divisor, result, curbit)	  \
+	clz	curbit, divisor					; \
+	clz	result, dividend				; \
+	sub	result, curbit, result				; \
+	mov	curbit, #1					; \
+	mov	divisor, divisor, lsl result 			; \
+	mov	curbit, curbit, lsl result 			; \
+	mov	result, #0
 #else /* __ARM_ARCH__ < 5 */
-
-	@ Initially shift the divisor left 3 bits if possible,
-	@ set curbit accordingly.  This allows for curbit to be located
-	@ at the left end of each 4 bit nibbles in the division loop
-	@ to save one loop in most cases.
-	tst	\divisor, #0xe0000000
-	moveq	\divisor, \divisor, lsl #3
-	moveq	\curbit, #8
-	movne	\curbit, #1
-
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is 
-	@ larger than the dividend.
-1:	cmp	\divisor, #0x10000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #4
-	movlo	\curbit, \curbit, lsl #4
-	blo	1b
-
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-1:	cmp	\divisor, #0x80000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #1
-	movlo	\curbit, \curbit, lsl #1
-	blo	1b
-
-	mov	\result, #0
-
+#define ARM_DIV_BODY_P1(dividend, divisor, result, curbit)	  \
+	/* Initially shift the divisor left 3 bits if possible,	*/; \
+	/* set curbit accordingly.  This allows for curbit to be located	*/; \
+	/* at the left end of each 4 bit nibbles in the division loop */; \
+	/* to save one loop in most cases. 			*/; \
+	tst	divisor, #0xe0000000 				; \
+	moveq	divisor, divisor, lsl #3			; \
+	moveq	curbit, #8					; \
+	movne	curbit, #1					; \
+								; \
+	/* Unless the divisor is very big, shift it up in multiples of */; \
+	/* four bits, since this is the amount of unwinding in the main */; \
+	/* division loop.  Continue shifting until the divisor is*/; \
+	/* larger than the dividend. 				*/; \
+1:	cmp	divisor, #0x10000000 				; \
+	cmplo	divisor, dividend 				; \
+	movlo	divisor, divisor, lsl #4			; \
+	movlo	curbit, curbit, lsl #4				; \
+	blo	1b						; \
+								; \
+	/* For very big divisors, we must shift it a bit at a time, or */; \
+	/* we will be in danger of overflowing.			*/; \
+1:	cmp	divisor, #0x80000000 				; \
+	cmplo	divisor, dividend 				; \
+	movlo	divisor, divisor, lsl #1			; \
+	movlo	curbit, curbit, lsl #1				; \
+	blo	1b						; \
+								; \
+	mov	result, #0
 #endif /* __ARM_ARCH__ < 5 */
 
-	@ Division loop
-1:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	orrhs	\result,   \result,   \curbit
-	cmp	\dividend, \divisor,  lsr #1
-	subhs	\dividend, \dividend, \divisor, lsr #1
-	orrhs	\result,   \result,   \curbit,  lsr #1
-	cmp	\dividend, \divisor,  lsr #2
-	subhs	\dividend, \dividend, \divisor, lsr #2
-	orrhs	\result,   \result,   \curbit,  lsr #2
-	cmp	\dividend, \divisor,  lsr #3
-	subhs	\dividend, \dividend, \divisor, lsr #3
-	orrhs	\result,   \result,   \curbit,  lsr #3
-	cmp	\dividend, #0			@ Early termination?
-	movnes	\curbit,   \curbit,  lsr #4	@ No, any more bits to do?
-	movne	\divisor,  \divisor, lsr #4
+#define ARM_DIV_BODY(dividend, divisor, result, curbit)		  \
+	ARM_DIV_BODY_P1(dividend, divisor, result, curbit)	; \
+								; \
+	/* Division loop						*/; \
+1:	cmp	dividend, divisor 				; \
+	subhs	dividend, dividend, divisor 			; \
+	orrhs	result,   result,   curbit 			; \
+	cmp	dividend, divisor,  lsr #1 			; \
+	subhs	dividend, dividend, divisor, lsr #1		; \
+	orrhs	result,   result,   curbit,  lsr #1		; \
+	cmp	dividend, divisor,  lsr #2 			; \
+	subhs	dividend, dividend, divisor, lsr #2		; \
+	orrhs	result,   result,   curbit,  lsr #2		; \
+	cmp	dividend, divisor,  lsr #3 			; \
+	subhs	dividend, dividend, divisor, lsr #3		; \
+	orrhs	result,   result,   curbit,  lsr #3		; \
+	cmp	dividend, #0			/* Early termination?	*/; \
+	movnes	curbit,   curbit,  lsr #4	/* No, any more bits to do?*/; \
+	movne	divisor,  divisor, lsr #4			; \
 	bne	1b
-
 #endif /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
 
-.endm
 /* ------------------------------------------------------------------------ */	
-.macro ARM_DIV2_ORDER divisor, order
-
 #if __ARM_ARCH__ >= 5
-
-	clz	\order, \divisor
-	rsb	\order, \order, #31
-
+#define ARM_DIV2_ORDER(divisor, order)				  \
+	clz	order, divisor					; \
+	rsb	order, order, #31
 #else
-
-	cmp	\divisor, #(1 << 16)
-	movhs	\divisor, \divisor, lsr #16
-	movhs	\order, #16
-	movlo	\order, #0
-
-	cmp	\divisor, #(1 << 8)
-	movhs	\divisor, \divisor, lsr #8
-	addhs	\order, \order, #8
-
-	cmp	\divisor, #(1 << 4)
-	movhs	\divisor, \divisor, lsr #4
-	addhs	\order, \order, #4
-
-	cmp	\divisor, #(1 << 2)
-	addhi	\order, \order, #3
-	addls	\order, \order, \divisor, lsr #1
-
+#define ARM_DIV2_ORDER(divisor, order)				  \
+	cmp	divisor, #(1 << 16) 				; \
+	movhs	divisor, divisor, lsr #16			; \
+	movhs	order, #16					; \
+	movlo	order, #0					; \
+								; \
+	cmp	divisor, #(1 << 8) 				; \
+	movhs	divisor, divisor, lsr #8			; \
+	addhs	order, order, #8 				; \
+								; \
+	cmp	divisor, #(1 << 4) 				; \
+	movhs	divisor, divisor, lsr #4			; \
+	addhs	order, order, #4 				; \
+								; \
+	cmp	divisor, #(1 << 2) 				; \
+	addhi	order, order, #3 				; \
+	addls	order, order, divisor, lsr #1
 #endif
-
-.endm
 /* ------------------------------------------------------------------------ */
-.macro ARM_MOD_BODY dividend, divisor, order, spare
-
 #if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
 
-	clz	\order, \divisor
-	clz	\spare, \dividend
-	sub	\order, \order, \spare
-	rsbs	\order, \order, #31
-	addne	pc, pc, \order, lsl #3
-	nop
-	.set	shift, 32
-	.rept	32
-	.set	shift, shift - 1
-	cmp	\dividend, \divisor, lsl #shift
-	subcs	\dividend, \dividend, \divisor, lsl #shift
-	.endr
+#define ARMV5_MOD_LOOP(dividend, divisor)			  \
+	.set	shift, shift - 1				; \
+	cmp	dividend, divisor, lsl #shift			; \
+	subcs	dividend, dividend, divisor, lsl #shift
+#define ARM_MOD_BODY(dividend, divisor, order, spare)	 	  \
+	clz	order, divisor					; \
+	clz	spare, dividend					; \
+	sub	order, order, spare				; \
+	rsbs	order, order, #31				; \
+	addne	pc, pc, order, lsl #3				; \
+	nop							; \
+	.set	shift, 32					; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)			; \
+	ARMV5_MOD_LOOP (dividend, divisor)
 
 #else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
 #if __ARM_ARCH__ >= 5
 
-	clz	\order, \divisor
-	clz	\spare, \dividend
-	sub	\order, \order, \spare
-	mov	\divisor, \divisor, lsl \order
+#define ARM_MOD_BODY_P1(dividend, divisor, order, spare)	  \
+	clz	order, divisor					; \
+	clz	spare, dividend					; \
+	sub	order, order, spare				; \
+	mov	divisor, divisor, lsl order
 	
 #else /* __ARM_ARCH__ < 5 */
 
-	mov	\order, #0
-
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is 
-	@ larger than the dividend.
-1:	cmp	\divisor, #0x10000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #4
-	addlo	\order, \order, #4
-	blo	1b
-
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-1:	cmp	\divisor, #0x80000000
-	cmplo	\divisor, \dividend
-	movlo	\divisor, \divisor, lsl #1
-	addlo	\order, \order, #1
+#define ARM_MOD_BODY_P1(dividend, divisor, order, spare)	  \
+	mov	order, #0					; \
+								; \
+	/* Unless the divisor is very big, shift it up in multiples of */; \
+	/* four bits, since this is the amount of unwinding in the main */; \
+	/* division loop.  Continue shifting until the divisor is */; \
+	/* larger than the dividend.				*/; \
+1:	cmp	divisor, #0x10000000				; \
+	cmplo	divisor, dividend				; \
+	movlo	divisor, divisor, lsl #4			; \
+	addlo	order, order, #4				; \
+	blo	1b						; \
+								; \
+	/* For very big divisors, we must shift it a bit at a time, or */; \
+	/* we will be in danger of overflowing.			*/; \
+1:	cmp	divisor, #0x80000000				; \
+	cmplo	divisor, dividend				; \
+	movlo	divisor, divisor, lsl #1			; \
+	addlo	order, order, #1				; \
 	blo	1b
 
 #endif /* __ARM_ARCH__ < 5 */
-
-	@ Perform all needed substractions to keep only the reminder.
-	@ Do comparisons in batch of 4 first.
-	subs	\order, \order, #3		@ yes, 3 is intended here
-	blt	2f
-
-1:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	cmp	\dividend, \divisor,  lsr #1
-	subhs	\dividend, \dividend, \divisor, lsr #1
-	cmp	\dividend, \divisor,  lsr #2
-	subhs	\dividend, \dividend, \divisor, lsr #2
-	cmp	\dividend, \divisor,  lsr #3
-	subhs	\dividend, \dividend, \divisor, lsr #3
-	cmp	\dividend, #1
-	mov	\divisor, \divisor, lsr #4
-	subges	\order, \order, #4
-	bge	1b
-
-	tst	\order, #3
-	teqne	\dividend, #0
-	beq	5f
-
-	@ Either 1, 2 or 3 comparison/substractions are left.
-2:	cmn	\order, #2
-	blt	4f
-	beq	3f
-	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	mov	\divisor,  \divisor,  lsr #1
-3:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-	mov	\divisor,  \divisor,  lsr #1
-4:	cmp	\dividend, \divisor
-	subhs	\dividend, \dividend, \divisor
-5:
+#define ARM_MOD_BODY(dividend, divisor, order, spare) \
+ARM_MOD_BODY_P1(dividend, divisor, order, spare)	  	; \
+								; \
+	/* Perform all needed substractions to keep only the reminder. */; \
+	/* Do comparisons in batch of 4 first.			*/; \
+	subs	order, order, #3		/* yes, 3 is intended here */; \
+	blt	2f						; \
+								; \
+1:	cmp	dividend, divisor				; \
+	subhs	dividend, dividend, divisor			; \
+	cmp	dividend, divisor,  lsr #1			; \
+	subhs	dividend, dividend, divisor, lsr #1		; \
+	cmp	dividend, divisor,  lsr #2			; \
+	subhs	dividend, dividend, divisor, lsr #2		; \
+	cmp	dividend, divisor,  lsr #3			; \
+	subhs	dividend, dividend, divisor, lsr #3		; \
+	cmp	dividend, #1					; \
+	mov	divisor, divisor, lsr #4			; \
+	subges	order, order, #4				; \
+	bge	1b						; \
+								; \
+	tst	order, #3					; \
+	teqne	dividend, #0					; \
+	beq	5f						; \
+								; \
+	/* Either 1, 2 or 3 comparison/substractions are left.	*/; \
+2:	cmn	order, #2					; \
+	blt	4f						; \
+	beq	3f						; \
+	cmp	dividend, divisor 				; \
+	subhs	dividend, dividend, divisor			; \
+	mov	divisor,  divisor,  lsr #1 			; \
+3:	cmp	dividend, divisor 				; \
+	subhs	dividend, dividend, divisor			; \
+	mov	divisor,  divisor,  lsr #1 			; \
+4:	cmp	dividend, divisor 				; \
+	subhs	dividend, dividend, divisor			; \
+5:								; \
 
 #endif /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
-
-.endm
 /* ------------------------------------------------------------------------ */
-.macro THUMB_DIV_MOD_BODY modulo
-	@ Load the constant 0x10000000 into our work register.
-	mov	work, #1
-	lsl	work, #28
-LSYM(Loop1):
-	@ Unless the divisor is very big, shift it up in multiples of
-	@ four bits, since this is the amount of unwinding in the main
-	@ division loop.  Continue shifting until the divisor is 
-	@ larger than the dividend.
-	cmp	divisor, work
-	bhs	LSYM(Lbignum)
-	cmp	divisor, dividend
-	bhs	LSYM(Lbignum)
-	lsl	divisor, #4
-	lsl	curbit,  #4
-	b	LSYM(Loop1)
-LSYM(Lbignum):
-	@ Set work to 0x80000000
-	lsl	work, #3
-LSYM(Loop2):
-	@ For very big divisors, we must shift it a bit at a time, or
-	@ we will be in danger of overflowing.
-	cmp	divisor, work
-	bhs	LSYM(Loop3)
-	cmp	divisor, dividend
-	bhs	LSYM(Loop3)
-	lsl	divisor, #1
-	lsl	curbit,  #1
-	b	LSYM(Loop2)
-LSYM(Loop3):
-	@ Test for possible subtractions ...
-  .if \modulo
-	@ ... On the final pass, this may subtract too much from the dividend, 
-	@ so keep track of which subtractions are done, we can fix them up 
-	@ afterwards.
-	mov	overdone, #0
-	cmp	dividend, divisor
-	blo	LSYM(Lover1)
-	sub	dividend, dividend, divisor
-LSYM(Lover1):
-	lsr	work, divisor, #1
-	cmp	dividend, work
-	blo	LSYM(Lover2)
-	sub	dividend, dividend, work
-	mov	ip, curbit
-	mov	work, #1
-	ror	curbit, work
-	orr	overdone, curbit
-	mov	curbit, ip
-LSYM(Lover2):
-	lsr	work, divisor, #2
-	cmp	dividend, work
-	blo	LSYM(Lover3)
-	sub	dividend, dividend, work
-	mov	ip, curbit
-	mov	work, #2
-	ror	curbit, work
-	orr	overdone, curbit
-	mov	curbit, ip
-LSYM(Lover3):
-	lsr	work, divisor, #3
-	cmp	dividend, work
-	blo	LSYM(Lover4)
-	sub	dividend, dividend, work
-	mov	ip, curbit
-	mov	work, #3
-	ror	curbit, work
-	orr	overdone, curbit
-	mov	curbit, ip
-LSYM(Lover4):
-	mov	ip, curbit
-  .else
-	@ ... and note which bits are done in the result.  On the final pass,
-	@ this may subtract too much from the dividend, but the result will be ok,
-	@ since the "bit" will have been shifted out at the bottom.
-	cmp	dividend, divisor
-	blo	LSYM(Lover1)
-	sub	dividend, dividend, divisor
-	orr	result, result, curbit
-LSYM(Lover1):
-	lsr	work, divisor, #1
-	cmp	dividend, work
-	blo	LSYM(Lover2)
-	sub	dividend, dividend, work
-	lsr	work, curbit, #1
-	orr	result, work
-LSYM(Lover2):
-	lsr	work, divisor, #2
-	cmp	dividend, work
-	blo	LSYM(Lover3)
-	sub	dividend, dividend, work
-	lsr	work, curbit, #2
-	orr	result, work
-LSYM(Lover3):
-	lsr	work, divisor, #3
-	cmp	dividend, work
-	blo	LSYM(Lover4)
-	sub	dividend, dividend, work
-	lsr	work, curbit, #3
-	orr	result, work
-LSYM(Lover4):
-  .endif
-	
-	cmp	dividend, #0			@ Early termination?
-	beq	LSYM(Lover5)
-	lsr	curbit,  #4			@ No, any more bits to do?
-	beq	LSYM(Lover5)
-	lsr	divisor, #4
-	b	LSYM(Loop3)
-LSYM(Lover5):
-  .if \modulo
-	@ Any subtractions that we should not have done will be recorded in
-	@ the top three bits of "overdone".  Exactly which were not needed
-	@ are governed by the position of the bit, stored in ip.
-	mov	work, #0xe
-	lsl	work, #28
-	and	overdone, work
-	beq	LSYM(Lgot_result)
-	
-	@ If we terminated early, because dividend became zero, then the 
-	@ bit in ip will not be in the bottom nibble, and we should not
-	@ perform the additions below.  We must test for this though
-	@ (rather relying upon the TSTs to prevent the additions) since
-	@ the bit in ip could be in the top two bits which might then match
-	@ with one of the smaller RORs.
-	mov	curbit, ip
-	mov	work, #0x7
-	tst	curbit, work
-	beq	LSYM(Lgot_result)
-	
-	mov	curbit, ip
-	mov	work, #3
-	ror	curbit, work
-	tst	overdone, curbit
-	beq	LSYM(Lover6)
-	lsr	work, divisor, #3
-	add	dividend, work
-LSYM(Lover6):
-	mov	curbit, ip
-	mov	work, #2
-	ror	curbit, work
-	tst	overdone, curbit
-	beq	LSYM(Lover7)
-	lsr	work, divisor, #2
-	add	dividend, work
-LSYM(Lover7):
-	mov	curbit, ip
-	mov	work, #1
-	ror	curbit, work
-	tst	overdone, curbit
-	beq	LSYM(Lgot_result)
-	lsr	work, divisor, #1
-	add	dividend, work
-  .endif
+#define THUMB_DIV_MOD_BODY(modulo)				  \
+	/* Load the constant 0x10000000 into our work register.	*/; \
+	mov	work, #1					; \
+	lsl	work, #28					; \
+LSYM(Loop1):							; \
+	/* Unless the divisor is very big, shift it up in multiples of	*/; \
+	/* four bits, since this is the amount of unwinding in the main 	*/; \
+	/* division loop.  Continue shifting until the divisor is 	*/; \
+	/* larger than the dividend. 				*/; \
+	cmp	divisor, work					; \
+	bhs	LSYM(Lbignum)					; \
+	cmp	divisor, dividend 				; \
+	bhs	LSYM(Lbignum)					; \
+	lsl	divisor, #4					; \
+	lsl	curbit,  #4					; \
+	b	LSYM(Loop1)					; \
+LSYM(Lbignum):							; \
+	/* Set work to 0x80000000				*/; \
+	lsl	work, #3					; \
+LSYM(Loop2):							; \
+	/* For very big divisors, we must shift it a bit at a time, or	*/; \
+	/* we will be in danger of overflowing. 			*/; \
+	cmp	divisor, work					; \
+	bhs	LSYM(Loop3)					; \
+	cmp	divisor, dividend 				; \
+	bhs	LSYM(Loop3)					; \
+	lsl	divisor, #1					; \
+	lsl	curbit,  #1					; \
+	b	LSYM(Loop2)					; \
+LSYM(Loop3):							; \
+	/* Test for possible subtractions ... 			*/; \
+  .if modulo							; \
+	/* ... On the final pass, this may subtract too much from the dividend, */; \
+	/* so keep track of which subtractions are done, we can fix them up */; \
+	/* afterwards.						*/; \
+	mov	overdone, #0					; \
+	cmp	dividend, divisor 				; \
+	blo	LSYM(Lover1)					; \
+	sub	dividend, dividend, divisor 			; \
+LSYM(Lover1):							; \
+	lsr	work, divisor, #1 				; \
+	cmp	dividend, work					; \
+	blo	LSYM(Lover2)					; \
+	sub	dividend, dividend, work 			; \
+	mov	ip, curbit					; \
+	mov	work, #1					; \
+	ror	curbit, work					; \
+	orr	overdone, curbit				; \
+	mov	curbit, ip					; \
+LSYM(Lover2):							; \
+	lsr	work, divisor, #2 				; \
+	cmp	dividend, work					; \
+	blo	LSYM(Lover3)					; \
+	sub	dividend, dividend, work 			; \
+	mov	ip, curbit					; \
+	mov	work, #2					; \
+	ror	curbit, work					; \
+	orr	overdone, curbit				; \
+	mov	curbit, ip					; \
+LSYM(Lover3):							; \
+	lsr	work, divisor, #3 				; \
+	cmp	dividend, work					; \
+	blo	LSYM(Lover4)					; \
+	sub	dividend, dividend, work 			; \
+	mov	ip, curbit					; \
+	mov	work, #3					; \
+	ror	curbit, work					; \
+	orr	overdone, curbit				; \
+	mov	curbit, ip					; \
+LSYM(Lover4):							; \
+	mov	ip, curbit					; \
+  .else								; \
+	/* ... and note which bits are done in the result.  On the final pass, 	*/; \
+	/* this may subtract too much from the dividend, but the result will be ok, */; \
+	/* since the "bit" will have been shifted out at the bottom. */; \
+	cmp	dividend, divisor 				; \
+	blo	LSYM(Lover1)					; \
+	sub	dividend, dividend, divisor 			; \
+	orr	result, result, curbit 				; \
+LSYM(Lover1):							; \
+	lsr	work, divisor, #1 				; \
+	cmp	dividend, work					; \
+	blo	LSYM(Lover2)					; \
+	sub	dividend, dividend, work 			; \
+	lsr	work, curbit, #1				; \
+	orr	result, work					; \
+LSYM(Lover2):							; \
+	lsr	work, divisor, #2 				; \
+	cmp	dividend, work					; \
+	blo	LSYM(Lover3)					; \
+	sub	dividend, dividend, work 			; \
+	lsr	work, curbit, #2				; \
+	orr	result, work					; \
+LSYM(Lover3):							; \
+	lsr	work, divisor, #3 				; \
+	cmp	dividend, work					; \
+	blo	LSYM(Lover4)					; \
+	sub	dividend, dividend, work 			; \
+	lsr	work, curbit, #3				; \
+	orr	result, work					; \
+LSYM(Lover4):							; \
+  .endif							; \
+								; \
+	cmp	dividend, #0			/* Early termination?	*/; \
+	beq	LSYM(Lover5)						; \
+	lsr	curbit,  #4			/* No, any more bits to do?*/; \
+	beq	LSYM(Lover5)					; \
+	lsr	divisor, #4					; \
+	b	LSYM(Loop3)					; \
+LSYM(Lover5):							; \
+  .if modulo							; \
+	/* Any subtractions that we should not have done will be recorded in */; \
+	/* the top three bits of "overdone".  Exactly which were not needed */; \
+	/* are governed by the position of the bit, stored in ip. 	*/; \
+	mov	work, #0xe					; \
+	lsl	work, #28					; \
+	and	overdone, work					; \
+	beq	LSYM(Lgot_result) 				; \
+								; \
+	/* If we terminated early, because dividend became zero, then the*/; \
+	/* bit in ip will not be in the bottom nibble, and we should not	*/; \
+	/* perform the additions below.  We must test for this though 	*/; \
+	/* (rather relying upon the TSTs to prevent the additions) since	*/; \
+	/* the bit in ip could be in the top two bits which might then match*/; \
+	/* with one of the smaller RORs.				*/; \
+	mov	curbit, ip					; \
+	mov	work, #0x7					; \
+	tst	curbit, work					; \
+	beq	LSYM(Lgot_result) 				; \
+								; \
+	mov	curbit, ip					; \
+	mov	work, #3					; \
+	ror	curbit, work					; \
+	tst	overdone, curbit				; \
+	beq	LSYM(Lover6)					; \
+	lsr	work, divisor, #3 				; \
+	add	dividend, work					; \
+LSYM(Lover6):							; \
+	mov	curbit, ip					; \
+	mov	work, #2					; \
+	ror	curbit, work					; \
+	tst	overdone, curbit				; \
+	beq	LSYM(Lover7)					; \
+	lsr	work, divisor, #2 				; \
+	add	dividend, work					; \
+LSYM(Lover7):							; \
+	mov	curbit, ip					; \
+	mov	work, #1					; \
+	ror	curbit, work					; \
+	tst	overdone, curbit				; \
+	beq	LSYM(Lgot_result) 				; \
+	lsr	work, divisor, #1 				; \
+	add	dividend, work					; \
+  .endif							; \
 LSYM(Lgot_result):
-.endm	
+/* APPLE LOCAL end ARM MACH assembler macros */
 /* ------------------------------------------------------------------------ */
 /*		Start of the Real Functions				    */
 /* ------------------------------------------------------------------------ */
 #ifdef L_udivsi3
 
 	FUNC_START udivsi3
-	FUNC_ALIAS aeabi_uidiv udivsi3
+	/* APPLE LOCAL ARM MACH assembler */
+	FUNC_ALIAS (aeabi_uidiv, udivsi3)
 
 #ifdef __thumb__
 
@@ -731,20 +856,25 @@
 	RETc(eq)
 	bcc	LSYM(Ldiv0)
 	cmp	r0, r1
-	bls	11f
+	/* APPLE LOCAL ARM MACH assembler */
+	bls	L11
 	tst	r1, r2
-	beq	12f
+	/* APPLE LOCAL ARM MACH assembler */
+	beq	L12
 	
-	ARM_DIV_BODY r0, r1, r2, r3
+	/* APPLE LOCAL ARM MACH assembler */
+	ARM_DIV_BODY(r0, r1, r2, r3)
 	
 	mov	r0, r2
 	RET	
 
-11:	moveq	r0, #1
+/* APPLE LOCAL ARM MACH assembler */
+L11:	moveq	r0, #1
 	movne	r0, #0
 	RET
 
-12:	ARM_DIV2_ORDER r1, r2
+/* APPLE LOCAL ARM MACH assembler */
+L12:	ARM_DIV2_ORDER(r1, r2)
 
 	mov	r0, r0, lsr r2
 	RET
@@ -804,7 +934,8 @@
 	andeq	r0, r0, r2
 	RETc(ls)
 
-	ARM_MOD_BODY r0, r1, r2, r3
+	/* APPLE LOCAL ARM MACH assembler */
+	ARM_MOD_BODY(r0, r1, r2, r3)
 	
 	RET	
 
@@ -817,7 +948,8 @@
 #ifdef L_divsi3
 
 	FUNC_START divsi3	
-	FUNC_ALIAS aeabi_idiv divsi3
+	/* APPLE LOCAL ARM MACH assembler */
+	FUNC_ALIAS (aeabi_idiv, divsi3)
 
 #ifdef __thumb__
 	cmp	divisor, #0
@@ -858,30 +990,37 @@
 	beq	LSYM(Ldiv0)
 	rsbmi	r1, r1, #0			@ loops below use unsigned.
 	subs	r2, r1, #1			@ division by 1 or -1 ?
-	beq	10f
+	/* APPLE LOCAL ARM MACH assembler */
+	beq	L10
 	movs	r3, r0
 	rsbmi	r3, r0, #0			@ positive dividend value
 	cmp	r3, r1
-	bls	11f
+	/* APPLE LOCAL ARM MACH assembler */
+	bls	L11
 	tst	r1, r2				@ divisor is power of 2 ?
-	beq	12f
+	/* APPLE LOCAL ARM MACH assembler */
+	beq	L12
 
-	ARM_DIV_BODY r3, r1, r0, r2
+	/* APPLE LOCAL ARM MACH assembler */
+	ARM_DIV_BODY(r3, r1, r0, r2)
 	
 	cmp	ip, #0
 	rsbmi	r0, r0, #0
 	RET	
 
-10:	teq	ip, r0				@ same sign ?
+/* APPLE LOCAL ARM MACH assembler */
+L10:	teq	ip, r0				@ same sign ?
 	rsbmi	r0, r0, #0
 	RET	
 
-11:	movlo	r0, #0
+/* APPLE LOCAL ARM MACH assembler */
+L11:	movlo	r0, #0
 	moveq	r0, ip, asr #31
 	orreq	r0, r0, #1
 	RET
 
-12:	ARM_DIV2_ORDER r1, r2
+/* APPLE LOCAL ARM MACH assembler */
+L12:	ARM_DIV2_ORDER(r1, r2)
 
 	cmp	ip, #0
 	mov	r0, r3, lsr r2
@@ -958,11 +1097,14 @@
 	moveq	r0, #0
 	tsthi	r1, r2				@ see if divisor is power of 2
 	andeq	r0, r0, r2
-	bls	10f
+	/* APPLE LOCAL ARM MACH assembler */
+	bls	L10
 
-	ARM_MOD_BODY r0, r1, r2, r3
+	/* APPLE LOCAL ARM MACH assembler */
+	ARM_MOD_BODY(r0, r1, r2, r3)
 
-10:	cmp	ip, #0
+/* APPLE LOCAL ARM MACH assembler */
+L10:	cmp	ip, #0
 	rsbmi	r0, r0, #0
 	RET	
 
@@ -975,8 +1117,10 @@
 #ifdef L_dvmd_tls
 
 	FUNC_START div0
-	FUNC_ALIAS aeabi_idiv0 div0
-	FUNC_ALIAS aeabi_ldiv0 div0
+	/* APPLE LOCAL begin ARM MACH assembler */
+	FUNC_ALIAS(aeabi_idiv0,div0)
+	FUNC_ALIAS(aeabi_ldiv0,div0)
+	/* APPLE LOCAL end ARM MACH assembler */
 
 	RET
 
@@ -998,7 +1142,8 @@
 	stmfd	sp!, {r1, lr}
 	mov	r0, #SIGFPE
 	bl	SYM(raise) __PLT__
-	RETLDM	r1
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM1 (r1)
 
 	FUNC_END div0
 	
@@ -1026,7 +1171,8 @@
 #ifdef L_lshrdi3
 
 	FUNC_START lshrdi3
-	FUNC_ALIAS aeabi_llsr lshrdi3
+	/* APPLE LOCAL ARM MACH assembler */
+	FUNC_ALIAS (aeabi_llsr, lshrdi3)
 	
 #ifdef __thumb__
 	lsr	al, r2
@@ -1058,7 +1204,8 @@
 #ifdef L_ashrdi3
 	
 	FUNC_START ashrdi3
-	FUNC_ALIAS aeabi_lasr ashrdi3
+	/* APPLE LOCAL ARM MACH assembler */
+	FUNC_ALIAS (aeabi_lasr, ashrdi3)
 	
 #ifdef __thumb__
 	lsr	al, r2
@@ -1095,7 +1242,8 @@
 #ifdef L_ashldi3
 
 	FUNC_START ashldi3
-	FUNC_ALIAS aeabi_llsl ashldi3
+	/* APPLE LOCAL ARM MACH assembler */
+	FUNC_ALIAS (aeabi_llsl, ashldi3)
 	
 #ifdef __thumb__
 	lsl	ah, r2
@@ -1149,30 +1297,31 @@
 	.align 0
         .force_thumb
 
-.macro call_via register
-	THUMB_FUNC_START _call_via_\register
-
-	bx	\register
-	nop
-
-	SIZE	(_call_via_\register)
-.endm
-
-	call_via r0
-	call_via r1
-	call_via r2
-	call_via r3
-	call_via r4
-	call_via r5
-	call_via r6
-	call_via r7
-	call_via r8
-	call_via r9
-	call_via sl
-	call_via fp
-	call_via ip
-	call_via sp
-	call_via lr
+/* APPLE LOCAL begin ARM MACH assembler */
+#define call_via(register)						  \
+	THUMB_FUNC_START _call_via_##register				; \
+									; \
+	bx	register						; \
+	nop								; \
+									; \
+	SIZE	(_call_via_##register)
+
+	call_via(r0)
+	call_via(r1)
+	call_via(r2)
+	call_via(r3)
+	call_via(r4)
+	call_via(r5)
+	call_via(r6)
+	call_via(r7)
+	call_via(r8)
+	call_via(r9)
+	call_via(sl)
+	call_via(fp)
+	call_via(ip)
+	call_via(sp)
+	call_via(lr)
+/* APPLE LOCAL end ARM MACH assembler macros */
 
 #endif /* L_call_via_rX */
 
@@ -1213,7 +1362,8 @@
 	nop	@ This nop is for the benefit of debuggers, so that
 		@ backtraces will use the correct unwind information.
 _arm_return:
-	RETLDM	unwind=LSYM(Lstart_arm_return)
+	/* APPLE LOCAL ARM MACH assembler */
+	RETLDM_unwind (LSYM(Lstart_arm_return))
 	cfi_end	LSYM(Lend_arm_return)
 
 	.globl _arm_return_r7

Modified: llvm-gcc-4.2/trunk/gcc/config/arm/predicates.md
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/predicates.md?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/predicates.md (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/predicates.md Thu Nov  8 20:30:15 2007
@@ -455,4 +455,19 @@
   (and (match_code "const_int")
        (match_test "((unsigned HOST_WIDE_INT) INTVAL (op)) < 64")))
 
+;; APPLE LOCAL begin ARM pic support
+;; Allow local symbols and stub references
+(define_predicate "arm_branch_target"
+  (match_code "reg,symbol_ref")
+{
+#if TARGET_MACHO
+  return GET_CODE (op) == REG
+         || ! (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
+         || machopic_data_defined_p (op)
+         || machopic_lookup_stub_or_non_lazy_ptr (XSTR (op, 0));
+#else
+  return 1;
+#endif
+})
+;; APPLE LOCAL end ARM pic support
 

Modified: llvm-gcc-4.2/trunk/gcc/config/asm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/asm.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/asm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/asm.h Thu Nov  8 20:30:15 2007
@@ -22,6 +22,7 @@
 extern enum iasm_states iasm_state;
 extern bool iasm_in_decl;
 extern bool inside_iasm_block;
+extern bool iasm_kill_regs;
 extern bool iasm_in_operands;
 extern tree iasm_do_id (tree);
 /* Maximum number of arguments.  */
@@ -69,7 +70,6 @@
 extern tree iasm_build_register_offset (tree, tree);
 extern tree iasm_label (tree, bool);
 extern tree prepend_char_identifier (tree, char);
-extern void iasm_clear_labels (void);
 extern tree iasm_reg_name (tree);
 extern void iasm_entry (int, tree);
 extern int iasm_typename_or_reserved (tree);

Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-c.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin-c.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin-c.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin-c.c Thu Nov  8 20:30:15 2007
@@ -443,7 +443,7 @@
 {
   set_flags_from_O (false);
 
-  /* MERGE FIXME - flag_loop_optimize2 is gone now */
+  /* MERGE FIXME 5416402 flag_loop_optimize2 is gone now */
 #if 0
   /* Enable new loop optimizer pass if any of its optimizations is called.  */
   if (flag_move_loop_invariants

Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-protos.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin-protos.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin-protos.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin-protos.h Thu Nov  8 20:30:15 2007
@@ -21,6 +21,8 @@
 extern void darwin_init_sections (void);
 extern int name_needs_quotes (const char *);
 
+/* APPLE LOCAL ARM pic support */
+extern int machopic_lookup_stub_or_non_lazy_ptr (const char *);
 extern void machopic_validate_stub_or_non_lazy_ptr (const char *);
 
 extern const char *machopic_function_base_name (void);
@@ -42,6 +44,8 @@
 
 extern void machopic_asm_out_constructor (rtx, int);
 extern void machopic_asm_out_destructor (rtx, int);
+/* APPLE LOCAL ARM pic support */
+extern int machopic_data_defined_p (rtx sym_ref);
 #endif /* RTX_CODE */
 
 #ifdef TREE_CODE

Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def Thu Nov  8 20:30:15 2007
@@ -67,6 +67,11 @@
 DEF_SECTION (machopic_symbol_stub1_section, 0,
 	     ".section __TEXT,__symbol_stub1,symbol_stubs,"
 	     "pure_instructions,16", 0)
+/* APPLE LOCAL begin ARM pic support */
+DEF_SECTION (machopic_symbol_stub4_section, 0,
+	     ".section __TEXT,__symbol_stub4,symbol_stubs,"
+	     "none,12", 0)
+/* APPLE LOCAL end ARM pic support */
 DEF_SECTION (machopic_picsymbol_stub_section, 0, ".picsymbol_stub", 0)
 DEF_SECTION (machopic_picsymbol_stub1_section, 0,
 	     ".section __TEXT,__picsymbolstub1,symbol_stubs,"
@@ -79,6 +84,10 @@
 DEF_SECTION (machopic_picsymbol_stub3_section, 0,
 	     ".section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5", 0)
 /* APPLE LOCAL end AT&T-style stub 4164563 */
+/* APPLE LOCAL begin ARM pic support */
+DEF_SECTION (machopic_picsymbol_stub4_section, 0,
+	     ".section __TEXT,__picsymbolstub4,symbol_stubs,none,16", 0)
+/* APPLE LOCAL end ARM pic support */
 DEF_SECTION (darwin_exception_section, 0,
 	     ".section __DATA,__gcc_except_tab", 0)
 DEF_SECTION (darwin_eh_frame_section, 0,

Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Thu Nov  8 20:30:15 2007
@@ -139,6 +139,7 @@
 	  objc_class_ext_section,
 	  objc_prop_list_section
 	  /* APPLE LOCAL end objc2 */
+	  /* APPLE LOCAL curly braces confuse me */
 	};
       /* APPLE LOCAL begin ObjC abi v2 - radar 4792158 */
       static const enum darwin_section_enum tomarkv2[] =
@@ -288,7 +289,8 @@
 }
 
 
-static int
+/* APPLE LOCAL ARM pic support */
+int
 machopic_data_defined_p (rtx sym_ref)
 {
   if (indirect_data (sym_ref))
@@ -391,6 +393,10 @@
   bool stub_p;
   /* True iff this stub or pointer pointer has been referenced.  */
   bool used;
+  /* APPLE LOCAL begin ARM 5440570 */
+  /* True iff this stub or pointer pointer has been outputted.  */
+  bool emitted;
+  /* APPLE LOCAL end ARM 5440570 */
 } machopic_indirection;
 
 /* A table mapping stub names and non-lazy pointer names to
@@ -399,6 +405,12 @@
 static GTY ((param_is (struct machopic_indirection))) htab_t
   machopic_indirections;
 
+/* APPLE LOCAL begin 5440570 */
+/* Used to identify that usage information has changed while
+   outputting the stubs.  */
+static GTY (()) bool indirection_uses_changed;
+/* APPLE LOCAL end 5440570 */
+
 /* Return a hash value for a SLOT in the indirections hash table.  */
 
 static hashval_t
@@ -497,6 +509,8 @@
       p->ptr_name = xstrdup (buffer);
       p->stub_p = stub_p;
       p->used = false;
+      /* APPLE LOCAL ARM 5440570 */
+      p->emitted = false;
       *slot = p;
     }
 
@@ -512,6 +526,26 @@
   return machopic_indirection_name (symbol, /*stub_p=*/true);
 }
 
+/* APPLE LOCAL begin ARM pic support */
+/* Determine whether the specified symbol is in the indirections table.  */
+int
+machopic_lookup_stub_or_non_lazy_ptr (const char *name)
+{
+  machopic_indirection *p;
+
+  if (! machopic_indirections)
+    return 0;
+
+  p = (machopic_indirection *)
+       htab_find_with_hash (machopic_indirections, name,
+			    htab_hash_string (name));
+  if (p)
+    return 1;
+  else
+    return 0;
+}
+/* APPLE LOCAL end ARM pic support */
+
 /* If NAME is the name of a stub or a non-lazy pointer , mark the stub
    or non-lazy pointer as used -- and mark the object to which the
    pointer/stub refers as used as well, since the pointer/stub will
@@ -531,6 +565,8 @@
       tree id;
 
       p->used = true;
+      /* APPLE LOCAL ARM 5440570 */
+      indirection_uses_changed = true;
 
       /* Do what output_addr_const will do when we actually call it.  */
       if (SYMBOL_REF_DECL (p->symbol))
@@ -1091,7 +1127,8 @@
   const char *sym_name;
   const char *ptr_name;
 
-  if (!p->used)
+  /* APPLE LOCAL ARM 5440570 */
+  if (!p->used || p->emitted)
     return 1;
 
   symbol = p->symbol;
@@ -1168,6 +1205,8 @@
       assemble_integer (init, GET_MODE_SIZE (Pmode),
 			GET_MODE_ALIGNMENT (Pmode), 1);
     }
+  /* APPLE LOCAL ARM 5440570 */
+  p->emitted = true;
 
   return 1;
 }
@@ -1176,9 +1215,16 @@
 machopic_finish (FILE *asm_out_file)
 {
   if (machopic_indirections)
-    htab_traverse_noresize (machopic_indirections,
-			    machopic_output_indirection,
-			    asm_out_file);
+    /* APPLE LOCAL begin 5440570 */
+    do
+      {
+	indirection_uses_changed = false;
+	htab_traverse_noresize (machopic_indirections,
+				machopic_output_indirection,
+				asm_out_file);
+      }
+    while (indirection_uses_changed == true);
+    /* APPLE LOCAL end 5440570 */
 }
 
 int
@@ -1294,7 +1340,8 @@
       /* Copied from varasm.c:output_constant_def_contents().  5346453 */
       && (MAX ((HOST_WIDE_INT)TREE_STRING_LENGTH (exp),
 	       int_size_in_bytes (TREE_TYPE (exp)))
-	  == strlen (TREE_STRING_POINTER (exp)) + 1))
+	  /* APPLE LOCAL ARM signedness mismatch */
+	  == (HOST_WIDE_INT) strlen (TREE_STRING_POINTER (exp)) + 1))
       && ! flag_writable_strings)
     return darwin_sections[cstring_section];
   /* APPLE LOCAL end fwritable strings, 5346453 */
@@ -1851,12 +1898,8 @@
   return NULL_TREE;
 }
 
-static void
-no_dead_strip (FILE *file, const char *lab)
-{
-  fprintf (file, ".no_dead_strip %s\n", lab);
-}
-
+/* APPLE LOCAL begin for-fsf-4_4 5480287 */ \
+/* APPLE LOCAL end for-fsf-4_4 5480287 */ \
 /* Emit a label for an FDE, making it global and/or weak if appropriate.
    The third parameter is nonzero if this is for exception handling.
    The fourth parameter is nonzero if this is just a placeholder for an
@@ -1865,47 +1908,47 @@
 void
 darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty)
 {
-  const char *base;
+/* APPLE LOCAL begin for-fsf-4_4 5480287 */ \
   char *lab;
-  bool need_quotes;
-
-  if (DECL_ASSEMBLER_NAME_SET_P (decl))
-    base = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
-  else
-    base = IDENTIFIER_POINTER (DECL_NAME (decl));
-
-  base = targetm.strip_name_encoding (base);
-  need_quotes = name_needs_quotes (base);
 
   if (! for_eh)
     return;
 
-  lab = concat (need_quotes ? "\"" : "", user_label_prefix, base, ".eh",
-		need_quotes ? "\"" : "", NULL);
+  lab = concat (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), ".eh", NULL);
 
   if (TREE_PUBLIC (decl))
-    fprintf (file, "\t%s %s\n",
-	     (DECL_VISIBILITY (decl) != VISIBILITY_HIDDEN
-	      ? ".globl"
-	      : ".private_extern"),
-	     lab);
+    {
+      targetm.asm_out.globalize_label (file, lab);
+      if (DECL_VISIBILITY (decl) == VISIBILITY_HIDDEN)
+	{
+	  fputs ("\t.private_extern ", file);
+	  assemble_name (file, lab);
+	  fputc ('\n', file);
+	}
+    }
 
   if (DECL_WEAK (decl))
-    fprintf (file, "\t.weak_definition %s\n", lab);
+    {
+      fputs ("\t.weak_definition ", file);
+      assemble_name (file, lab);
+      fputc ('\n', file);
+    }
 
+  assemble_name (file, lab);
   if (empty)
     {
-      fprintf (file, "%s = 0\n", lab);
+      fputs (" = 0\n", file);
 
       /* Mark the absolute .eh and .eh1 style labels as needed to
 	 ensure that we don't dead code strip them and keep such
 	 labels from another instantiation point until we can fix this
 	 properly with group comdat support.  */
-      no_dead_strip (file, lab);
+      darwin_mark_decl_preserved (lab);
     }
   else
-    fprintf (file, "%s:\n", lab);
+    fputs (":\n", file);
 
+/* APPLE LOCAL end for-fsf-4_4 5480287 */ \
   free (lab);
 }
 
@@ -2107,6 +2150,9 @@
 darwin_init_cfstring_builtins (void)
 {
   tree field, fields, pccfstring_ftype_pcchar;
+  /* APPLE LOCAL begin 3996036 */
+  int save_warn_padded;
+  /* APPLE LOCAL end 3996036 */
 
   /* struct __builtin_CFString {
        const int *isa;		(will point at
@@ -2132,8 +2178,15 @@
   TREE_CHAIN (field) = fields; fields = field;
   /* NB: The finish_builtin_struct() routine expects FIELD_DECLs in
      reverse order!  */
+  /* APPLE LOCAL begin 3996036 */
+  save_warn_padded = warn_padded;
+  warn_padded = 0;
+  /* APPLE LOCAL end 3996036 */
   finish_builtin_struct (cfstring_type_node, "__builtin_CFString",
 			 fields, NULL_TREE);
+  /* APPLE LOCAL begin 3996036 */
+  warn_padded = save_warn_padded; 
+  /* APPLE LOCAL end 3996036 */
 
   /* const struct __builtin_CFstring *
      __builtin___CFStringMakeConstantString (const char *); */

Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Nov  8 20:30:15 2007
@@ -289,15 +289,6 @@
 #define CC1PLUS_SPEC "-D__private_extern__=extern"
 /* APPLE LOCAL end private extern */
 
-/* LLVM LOCAL begin */
-#ifdef HAVE_DSYMUTIL
-#define DARWIN_DSYMUTIL_SPEC  "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
-                                 %{.c|.cc|.C|.cpp|.c++|.CPP|.m|.mm: \
-                                 %{g*:%{!gstabs*:%{!g0: dsymutil %{o*:%*}%{!o:a.out}}}}}}}}}}}}"
-#else
-#define DARWIN_DSYMUTIL_SPEC ""
-#endif
-/* LLVM LOCAL end */
 /* This is mostly a clone of the standard LINK_COMMAND_SPEC, plus
    precomp, libtool, and fat build additions.  Also we
    don't specify a second %G after %L because libSystem is
@@ -320,10 +311,11 @@
     %{fnested-functions: -allow_stack_execute} \
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %G %L}} \
 "/* APPLE LOCAL begin mainline 4.3 2006-10-31 4370146 */"\
-"/* LLVM LOCAL begin */"\
-    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}} \n %(darwin_dsymutil) "
-/* LLVM LOCAL end */
-/* APPLE LOCAL end mainline 4.3 2006-10-31 4370146 */
+    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}\n\
+%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+"/* APPLE LOCAL end mainline 4.3 2006-10-31 4370146 */"\
+"/* APPLE LOCAL ARM 5342595 */"\
+    %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: %(darwin_dsymutil) }}}}}}}}"
 /* APPLE LOCAL end mainline */
 
 #ifdef TARGET_SYSTEM_ROOT
@@ -484,10 +476,13 @@
 #define DARWIN_EXTRA_SPECS						\
   { "darwin_crt1", DARWIN_CRT1_SPEC },					\
   { "darwin_dylib1", DARWIN_DYLIB1_SPEC },				\
-  /* LLVM LOCAL */                                                \
-  { "darwin_dsymutil", DARWIN_DSYMUTIL_SPEC },                          \
-  { "darwin_minversion", DARWIN_MINVERSION_SPEC },
-
+  { "darwin_minversion", DARWIN_MINVERSION_SPEC },			\
+/* APPLE LOCAL end mainline */						\
+/* APPLE LOCAL begin ARM 5342595 */					\
+  { "darwin_dsymutil", DARWIN_DSYMUTIL_SPEC },
+/* APPLE LOCAL end ARM 5342595 */
+ 
+/* APPLE LOCAL begin mainline */
 #define DARWIN_DYLIB1_SPEC						\
   "%:version-compare(!> 10.5 mmacosx-version-min= -ldylib1.o)		\
    %:version-compare(>= 10.5 mmacosx-version-min= -ldylib1.10.5.o)"
@@ -778,9 +773,17 @@
       assemble_zeros (1);						\
   } while (0)
 
+/* APPLE LOCAL begin ARM darwin target */
+#ifndef SUBTARGET_ASM_DECLARE_FUNCTION_NAME
+#define SUBTARGET_ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)
+#endif
+/* APPLE LOCAL end ARM darwin target */
+
 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
   do {									\
     const char *xname = NAME;						\
+    /* APPLE LOCAL ARM darwin target */					\
+    SUBTARGET_ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL);		\
     if (GET_CODE (XEXP (DECL_RTL (DECL), 0)) != SYMBOL_REF)		\
       xname = IDENTIFIER_POINTER (DECL_NAME (DECL));			\
     if (! DECL_WEAK (DECL)						\
@@ -1125,7 +1128,10 @@
 
 #define DARWIN_REGISTER_TARGET_PRAGMAS()			\
   do {								\
-    c_register_pragma (0, "mark", darwin_pragma_ignore);	\
+    /* APPLE LOCAL begin mainline 2007-10-10 5497482 */		\
+    cpp_register_pragma (parse_in, NULL, "mark",		\
+			 darwin_pragma_ignore, false);		\
+    /* APPLE LOCAL end mainline 2007-10-10 5497482 */		\
     c_register_pragma (0, "options", darwin_pragma_options);	\
     c_register_pragma (0, "segment", darwin_pragma_ignore);	\
     /* APPLE LOCAL pragma fenv */                               \

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/cygming.h Thu Nov  8 20:30:15 2007
@@ -1,394 +1,3 @@
-/* Operating system specific defines to be used when targeting GCC for
-   hosting on Windows32, using a Unix style C library and tools.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005
-   Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
-
-#define DBX_DEBUGGING_INFO 1
-#define SDB_DEBUGGING_INFO 1
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#ifdef HAVE_GAS_PE_SECREL32_RELOC
-#define DWARF2_DEBUGGING_INFO 1
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) (write_symbols == DWARF2_DEBUG   \
-                                ? svr4_dbx_register_map[n]      \
-                                : dbx_register_map[n])
-
-/* Use section relative relocations for debugging offsets.  Unlike
-   other targets that fake this by putting the section VMA at 0, PE
-   won't allow it.  */
-#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION)	\
-  do {								\
-    if (SIZE != 4)						\
-      abort ();							\
-								\
-    fputs ("\t.secrel32\t", FILE);				\
-    assemble_name (FILE, LABEL);				\
-  } while (0)
-#endif
-
-#define TARGET_EXECUTABLE_SUFFIX ".exe"
-
-#include <stdio.h>
-
-#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing.  */
-
-#define TARGET_OS_CPP_BUILTINS()					\
-  do									\
-    {									\
-	builtin_define ("_X86_=1");					\
-	builtin_assert ("system=winnt");				\
-	builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
-	builtin_define ("__fastcall=__attribute__((__fastcall__))");	\
-	builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
-	if (!flag_iso)							\
-	  {								\
-	    builtin_define ("_stdcall=__attribute__((__stdcall__))");	\
-	    builtin_define ("_fastcall=__attribute__((__fastcall__))");	\
-	    builtin_define ("_cdecl=__attribute__((__cdecl__))");	\
-	  }								\
-	/* Even though linkonce works with static libs, this is needed 	\
-	    to compare typeinfo symbols across dll boundaries.  */	\
-	builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0");		\
-	MAYBE_UWIN_CPP_BUILTINS ();					\
-	EXTRA_OS_CPP_BUILTINS ();					\
-  }									\
-  while (0)
-
-/* Get tree.c to declare a target-specific specialization of
-   merge_decl_attributes.  */
-#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
-
-/* This macro defines names of additional specifications to put in the specs
-   that can be used in various specifications like CC1_SPEC.  Its definition
-   is an initializer with a subgrouping for each command option.
-
-   Each subgrouping contains a string constant, that defines the
-   specification name, and a string constant that used by the GCC driver
-   program.
-
-   Do not define this macro if it does not need to do anything.  */
-
-#undef  SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS						\
-  { "mingw_include_path", DEFAULT_TARGET_MACHINE }
-
-#undef MATH_LIBRARY
-#define MATH_LIBRARY ""
-
-#define SIZE_TYPE "unsigned int"
-#define PTRDIFF_TYPE "int"
-#define WCHAR_TYPE_SIZE 16
-#define WCHAR_TYPE "short unsigned int"
-
-
-/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
-#define HANDLE_PRAGMA_PACK_PUSH_POP 1
-
-union tree_node;
-#define TREE union tree_node *
-
-#define drectve_section() \
-  (fprintf (asm_out_file, "\t.section .drectve\n"), \
-   in_section = NULL)
-
-/* Older versions of gas don't handle 'r' as data.
-   Explicitly set data flag with 'd'.  */  
-#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
-
-/* Don't allow flag_pic to propagate since gas may produce invalid code
-   otherwise.  */
-
-#undef  SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS					\
-do {									\
-  if (flag_pic)								\
-    {									\
-      warning (0, "-f%s ignored for target (all code is position independent)",\
-	       (flag_pic > 1) ? "PIC" : "pic");				\
-      flag_pic = 0;							\
-    }									\
-} while (0)								\
-
-/* Define this macro if references to a symbol must be treated
-   differently depending on something about the variable or
-   function named by the symbol (such as what section it is in).
-
-   On i386 running Windows NT, modify the assembler name with a suffix
-   consisting of an atsign (@) followed by string of digits that represents
-   the number of bytes of arguments passed to the function, if it has the
-   attribute STDCALL.
-
-   In addition, we must mark dll symbols specially. Definitions of
-   dllexport'd objects install some info in the .drectve section.
-   References to dllimport'd objects are fetched indirectly via
-   _imp__.  If both are declared, dllexport overrides.  This is also
-   needed to implement one-only vtables: they go into their own
-   section and we need to set DECL_SECTION_NAME so we do that here.
-   Note that we can be called twice on the same decl.  */
-
-#undef SUBTARGET_ENCODE_SECTION_INFO
-#define SUBTARGET_ENCODE_SECTION_INFO  i386_pe_encode_section_info
-#undef  TARGET_STRIP_NAME_ENCODING
-#define TARGET_STRIP_NAME_ENCODING  i386_pe_strip_name_encoding_full
-
-/* Output a reference to a label.  */
-#undef ASM_OUTPUT_LABELREF
-#define ASM_OUTPUT_LABELREF  i386_pe_output_labelref
-
-#undef  COMMON_ASM_OP
-#define COMMON_ASM_OP	"\t.comm\t"
-
-/* Output a common block.  */
-#undef ASM_OUTPUT_COMMON
-#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED)	\
-do {							\
-  if (i386_pe_dllexport_name_p (NAME))			\
-    i386_pe_record_exported_symbol (NAME, 1);		\
-  if (! i386_pe_dllimport_name_p (NAME))		\
-    {							\
-      fprintf ((STREAM), "\t.comm\t");			\
-      assemble_name ((STREAM), (NAME));			\
-      fprintf ((STREAM), ", %d\t%s %d\n",		\
-	       (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE));	\
-    }							\
-} while (0)
-
-/* Output the label for an initialized variable.  */
-#undef ASM_DECLARE_OBJECT_NAME
-#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)	\
-do {							\
-  if (i386_pe_dllexport_name_p (NAME))			\
-    i386_pe_record_exported_symbol (NAME, 1);		\
-  ASM_OUTPUT_LABEL ((STREAM), (NAME));			\
-} while (0)
-
-
-/* Emit code to check the stack when allocating more that 4000
-   bytes in one go.  */
-
-#define CHECK_STACK_LIMIT 4000
-
-/* By default, target has a 80387, uses IEEE compatible arithmetic,
-   returns float values in the 387 and needs stack probes.
-   We also align doubles to 64-bits for MSVC default compatibility.  */
-
-#undef TARGET_SUBTARGET_DEFAULT
-#define TARGET_SUBTARGET_DEFAULT \
-   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE \
-    | MASK_ALIGN_DOUBLE)
-
-/* This is how to output an assembler line
-   that says to advance the location counter
-   to a multiple of 2**LOG bytes.  */
-
-#undef ASM_OUTPUT_ALIGN
-#define ASM_OUTPUT_ALIGN(FILE,LOG)	\
-    if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
-
-/* Windows uses explicit import from shared libraries.  */
-#define MULTIPLE_SYMBOL_SPACES 1
-
-extern void i386_pe_unique_section (TREE, int);
-#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
-#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
-
-#define SUPPORTS_ONE_ONLY 1
-
-/* Switch into a generic section.  */
-#define TARGET_ASM_NAMED_SECTION  i386_pe_asm_named_section
-
-/* Select attributes for named sections.  */
-#define TARGET_SECTION_TYPE_FLAGS  i386_pe_section_type_flags
-
-/* Write the extra assembler code needed to declare a function
-   properly.  If we are generating SDB debugging information, this
-   will happen automatically, so we only need to handle other cases.  */
-#undef ASM_DECLARE_FUNCTION_NAME
-#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)			\
-  do									\
-    {									\
-      if (i386_pe_dllexport_name_p (NAME))				\
-	i386_pe_record_exported_symbol (NAME, 0);			\
-      if (write_symbols != SDB_DEBUG)					\
-	i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL));	\
-      ASM_OUTPUT_LABEL (FILE, NAME);					\
-    }									\
-  while (0)
-
-/* Add an external function to the list of functions to be declared at
-   the end of the file.  */
-#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)				\
-  do									\
-    {									\
-      if (TREE_CODE (DECL) == FUNCTION_DECL)				\
-	i386_pe_record_external_function ((DECL), (NAME));		\
-    }									\
-  while (0)
-
-/* Declare the type properly for any external libcall.  */
-#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
-  i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
-
-/* This says out to put a global symbol in the BSS section.  */
-#undef ASM_OUTPUT_ALIGNED_BSS
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-  asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
-
-/* Output function declarations at the end of the file.  */
-#undef TARGET_ASM_FILE_END
-#define TARGET_ASM_FILE_END i386_pe_file_end
-
-#undef ASM_COMMENT_START
-#define ASM_COMMENT_START " #"
-
-/* DWARF2 Unwinding doesn't work with exception handling yet.  To make
-   it work, we need to build a libgcc_s.dll, and dcrt0.o should be
-   changed to call __register_frame_info/__deregister_frame_info.  */
-#define DWARF2_UNWIND_INFO 0
-
-/* Don't assume anything about the header files.  */
-#define NO_IMPLICIT_EXTERN_C
-
-#undef PROFILE_HOOK
-#define PROFILE_HOOK(LABEL)						\
-  if (MAIN_NAME_P (DECL_NAME (current_function_decl)))			\
-    {									\
-      emit_call_insn (gen_rtx_CALL (VOIDmode,				\
-	gen_rtx_MEM (FUNCTION_MODE,					\
-		     gen_rtx_SYMBOL_REF (Pmode, "_monstartup")),	\
-	const0_rtx));							\
-    }
-
-/* Java Native Interface (JNI) methods on Win32 are invoked using the
-   stdcall calling convention.  */
-#undef MODIFY_JNI_METHOD_CALL
-#define MODIFY_JNI_METHOD_CALL(MDECL)					      \
-  build_type_attribute_variant ((MDECL),				      \
-			       build_tree_list (get_identifier ("stdcall"),   \
-						NULL))
-
-/* External function declarations.  */
-
-extern void i386_pe_record_external_function (tree, const char *);
-extern void i386_pe_declare_function_type (FILE *, const char *, int);
-extern void i386_pe_record_exported_symbol (const char *, int);
-extern void i386_pe_file_end (void);
-extern int i386_pe_dllexport_name_p (const char *);
-extern int i386_pe_dllimport_name_p (const char *);
-
-/* For Win32 ABI compatibility */
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
-
-/* MSVC returns aggregate types of up to 8 bytes via registers.
-   See i386.c:ix86_return_in_memory.  */
-#undef MS_AGGREGATE_RETURN
-#define MS_AGGREGATE_RETURN 1
-
-/* No data type wants to be aligned rounder than this.  */
-#undef	BIGGEST_ALIGNMENT
-#define BIGGEST_ALIGNMENT 128
-
-/* Biggest alignment supported by the object file format of this
-   machine.  Use this macro to limit the alignment which can be
-   specified using the `__attribute__ ((aligned (N)))' construct.  If
-   not defined, the default value is `BIGGEST_ALIGNMENT'.  */
-#undef MAX_OFILE_ALIGNMENT
-/* IMAGE_SCN_ALIGN_8192BYTES is the largest section alignment flag
-   specified in the PECOFF60 spec.  Native MS compiler also limits
-   user-specified alignment to 8192 bytes.  */
-#define MAX_OFILE_ALIGNMENT (8192 * 8)
-
-/* Native complier aligns internal doubles in structures on dword boundaries.  */
-#undef	BIGGEST_FIELD_ALIGNMENT
-#define BIGGEST_FIELD_ALIGNMENT 64
-
-/* A bit-field declared as `int' forces `int' alignment for the struct.  */
-#undef PCC_BITFIELD_TYPE_MATTERS
-#define PCC_BITFIELD_TYPE_MATTERS 1
-#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
-
-/* Enable alias attribute support.  */
-#ifndef SET_ASM_OP
-#define SET_ASM_OP "\t.set\t"
-#endif
-/* This implements the `alias' attribute, keeping any stdcall or
-   fastcall decoration.  */
-#undef	ASM_OUTPUT_DEF_FROM_DECLS
-#define	ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET) 		\
-  do									\
-    {									\
-      const char *alias;						\
-      rtx rtlname = XEXP (DECL_RTL (DECL), 0);				\
-      if (GET_CODE (rtlname) == SYMBOL_REF)				\
-	alias = XSTR (rtlname, 0);					\
-      else								\
-	abort ();							\
-      if (TREE_CODE (DECL) == FUNCTION_DECL)				\
-	i386_pe_declare_function_type (STREAM, alias,			\
-				       TREE_PUBLIC (DECL));		\
-      ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET));	\
-    } while (0)
-
-/* GNU as supports weak symbols on PECOFF. */
-#ifdef HAVE_GAS_WEAK
-#define ASM_WEAKEN_LABEL(FILE, NAME)  \
-  do                                  \
-    {                                 \
-      fputs ("\t.weak\t", (FILE));    \
-      assemble_name ((FILE), (NAME)); \
-      fputc ('\n', (FILE));           \
-    }                                 \
-  while (0)
-#endif /* HAVE_GAS_WEAK */
-
-/* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
-   but for .jcr section to work we also need crtbegin and crtend
-   objects.  */
-#define TARGET_USE_JCR_SECTION 0
-
-/* Decide whether it is safe to use a local alias for a virtual function
-   when constructing thunks.  */
-#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
-#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
-
-#define SUBTARGET_ATTRIBUTE_TABLE \
-  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ \
-  { "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute }
-
-/*  mcount() does not need a counter variable.  */
-#undef NO_PROFILE_COUNTERS
-#define NO_PROFILE_COUNTERS 1
-
-#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p
-#define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition
-
-#undef TREE
-
-#ifndef BUFSIZ
-# undef FILE
-#endif
 
 /* LLVM LOCAL begin */
 #ifdef ENABLE_LLVM

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin.h Thu Nov  8 20:30:15 2007
@@ -93,6 +93,8 @@
 
 #undef CC1_SPEC
 #define CC1_SPEC "%{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \
+  "/* APPLE LOCAL ARM ignore -mthumb and -mno-thumb */"\
+  %<mthumb %<mno-thumb \
 "/* APPLE LOCAL mainline 2007-02-20 5005743 */" \
   %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \
   "/* APPLE LOCAL ignore -mcpu=G4 -mcpu=G5 */"\
@@ -120,6 +122,11 @@
     :10.4}"
 
 /* APPLE LOCAL end mainline 2007-03-13 5005743 5040758 */ \
+/* APPLE LOCAL begin 5342595 */
+#define DARWIN_DSYMUTIL_SPEC \
+  "%{g*:%{!gstabs*:%{!g0: dsymutil %{o*:%*}%{!o:a.out}}}}"
+/* APPLE LOCAL end 5342595 */
+
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                                   \
   DARWIN_EXTRA_SPECS                                            \

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386-protos.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386-protos.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386-protos.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386-protos.h Thu Nov  8 20:30:15 2007
@@ -252,4 +252,6 @@
 extern tree iasm_raise_reg (tree);
 /* APPLE LOCAL end CW asm blocks */
 
+/* APPLE LOCAL 3399553 */
+extern void ix86_expand_flt_rounds (rtx);
 extern int asm_preferred_eh_data_format (int, int);

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Thu Nov  8 20:30:15 2007
@@ -1967,6 +1967,13 @@
         target_flags
           |= ((MASK_SSE2 | MASK_SSE | MASK_MMX | MASK_128BIT_LONG_DOUBLE
                | TARGET_SUBTARGET64_DEFAULT) & ~target_flags_explicit);
+      /* APPLE LOCAL begin mainline candidate */
+      /* Disable the red zone for kernel compilation.
+	 ??? Why aren't we using -mcmodel=kernel?  */
+      if (TARGET_MACHO
+	  && (flag_mkernel || flag_apple_kext))
+	target_flags |= MASK_NO_RED_ZONE;
+      /* APPLE LOCAL end mainline candidate */
     }
   else
     {
@@ -2139,7 +2146,7 @@
   /* APPLE LOCAL begin 4812082 -fast */
   /* These flags were the best on the software H264 codec, and have therefore
      been lumped into -fast per 4812082.  They have not been evaluated on
-     any other code, except that -fno-tree-pre is known to lose on the 
+     any other code, except that -fno-tree-pre is known to lose on the
      hardware accelerated version of the codec. */
   if (flag_fast || flag_fastf || flag_fastcp)
     {
@@ -4072,6 +4079,10 @@
     align = TYPE_ALIGN (type);
   else
     align = GET_MODE_ALIGNMENT (mode);
+  /* APPLE LOCAL begin unbreak ppc64 abi 5103220 */
+  if (type && integer_zerop (TYPE_SIZE (type)))
+    align = PARM_BOUNDARY;
+  /* APPLE LOCAL end unbreak ppc64 abi 5103220 */
   if (align < PARM_BOUNDARY)
     align = PARM_BOUNDARY;
   if (!TARGET_64BIT)
@@ -4166,8 +4177,8 @@
 }
 
 /* APPLE LOCAL begin radar 4781080 */
-/* Return true iff must generate call to objcMsgSend for an 
-   fp-returning method. */ 
+/* Return true iff must generate call to objcMsgSend for an
+   fp-returning method. */
 bool
 ix86_objc_fpreturn_msgcall (tree ret_type, bool no_long_double)
 {
@@ -4206,7 +4217,10 @@
       /* MMX/3dNow values are returned in MM0,
 	 except when it doesn't exits.  */
       if (size == 8)
-	return (TARGET_MMX ? 0 : 1);
+        /* APPLE LOCAL begin radar 4875125. */
+        /* Undo the mainline patch which broke MACHO ABI compatibility. */
+	return (TARGET_MACHO) ? 1 : (TARGET_MMX ? 0 : 1);
+        /* APPLE LOCAL end radar 4875125. */
 
       /* SSE values are returned in XMM0, except when it doesn't exist.  */
       if (size == 16)
@@ -5681,6 +5695,50 @@
     }
 }
 
+/* APPLE LOCAL begin 3399553 */
+/* Calculate the value of FLT_ROUNDS into DEST.
+
+   The rounding mode is in bits 11:10 of FPSR, and has the following
+   settings:
+     00 Round to nearest
+     01 Round to -inf
+     10 Round to +inf
+     11 Round to 0
+
+  FLT_ROUNDS, on the other hand, expects the following:
+    -1 Undefined
+     0 Round to 0
+     1 Round to nearest
+     2 Round to +inf
+     3 Round to -inf
+
+  To perform the conversion, we do:
+    (((((FPSR & 0x800) >> 11) | ((FPSR & 0x400) >> 9)) + 1) & 3)
+*/
+void
+ix86_expand_flt_rounds (rtx dest)
+{
+  rtx mem = assign_stack_temp (HImode, GET_MODE_SIZE (HImode), 0);
+  rtx temp = gen_reg_rtx (SImode);
+
+  /* Step #1: Read FPSR.  Unfortunately, this can only be done into a
+     16-bit memory location.  */
+  emit_insn (gen_x86_fnstcw_1 (mem));
+
+  /* Step #2: Copy into a register.  */
+  emit_insn (gen_zero_extendhisi2 (dest, mem));
+
+  /* Step #3: Perform conversion described above.  */
+  emit_insn (gen_andsi3 (temp, dest, GEN_INT (0x400)));
+  emit_insn (gen_andsi3 (dest, dest, GEN_INT (0x800)));
+  emit_insn (gen_lshrsi3 (temp, temp, GEN_INT (9)));
+  emit_insn (gen_lshrsi3 (dest, dest, GEN_INT (11)));
+  emit_insn (gen_iorsi3 (dest, dest, temp));
+  emit_insn (gen_addsi3 (dest, dest, const1_rtx));
+  emit_insn (gen_andsi3 (dest, dest, GEN_INT (3)));
+}
+/* APPLE LOCAL end 3399553 */
+
 /* APPLE LOCAL begin fix-and-continue x86 */
 #ifndef TARGET_FIX_AND_CONTINUE
 #define TARGET_FIX_AND_CONTINUE 0
@@ -6476,7 +6534,9 @@
       break;
 
     case CONST_VECTOR:
-      if (x == CONST0_RTX (GET_MODE (x)))
+      /* APPLE LOCAL begin radar 4874197 mainline candidate */
+      if (standard_sse_constant_p (x))
+      /* APPLE LOCAL end radar 4874197 mainline candidate */
 	return true;
       return false;
 
@@ -9895,7 +9955,7 @@
   ix86_expand_vector_move2 (V2DFmode, fp_value,
 			    gen_rtx_SUBREG (V2DFmode, incoming_value, 0));
   large_xmm = gen_reg_rtx (V2DFmode);
-  
+
   v_rtx = gen_rtx_CONST_VECTOR (V2DFmode,
 				gen_2_4_rtvec (2, int_two31_as_fp, DFmode));
   ix86_expand_vector_move2 (DFmode, large_xmm, v_rtx);
@@ -9922,7 +9982,7 @@
   zero_or_two31_xmm = gen_reg_rtx (V2DFmode);
   v_rtx = gen_rtx_CONST_VECTOR (V2DFmode,
 				gen_2_4_rtvec (2, int_two31_as_fp, DFmode));
-  ix86_expand_vector_move2 (DFmode, zero_or_two31_xmm, v_rtx);  
+  ix86_expand_vector_move2 (DFmode, zero_or_two31_xmm, v_rtx);
 
   /* zero_or_two31 = (large_xmm) ? 2**31 : 0; */
   emit_insn (gen_andv2df3 (zero_or_two31_xmm, zero_or_two31_xmm, large_xmm));
@@ -9991,7 +10051,7 @@
   ix86_expand_vector_move2 (V4SFmode, fp_value,
 			    gen_rtx_SUBREG (V4SFmode, incoming_value, 0));
   large_xmm = gen_reg_rtx (V4SFmode);
-  
+
   /* fp_value = MAX (fp_value, 0.0); */
   /* Preclude negative values; truncate at zero.  */
   int_zero_as_xmm = gen_reg_rtx (V4SFmode);
@@ -16870,13 +16930,23 @@
       op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
       op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0);
 
-      if (GET_CODE (op1) != CONST_INT)
-	{
-	  error ("shift must be an immediate");
-	  return const0_rtx;
-	}
-      if (INTVAL (op1) < 0 || INTVAL (op1) > 255)
-	op1 = GEN_INT (255);
+     /* APPLE LOCAL begin radar 5543378 mainline candidate */
+      if (GET_CODE (op1) == CONST_INT)
+        {
+          if (INTVAL (op1) < 0 || INTVAL (op1) > 255)
+            op1 = GEN_INT (255);
+        }   
+      else
+        {
+          mode2 = insn_data[icode].operand[2].mode;
+          if (! (*insn_data[icode].operand[2].predicate) (op1, mode2))
+          {
+	    op1 = copy_to_reg (op1);
+            if (GET_MODE (op1) != mode2)
+              op1 = convert_to_mode (mode2, op1, 0);
+          }
+        } 
+      /* APPLE LOCAL end radar 5543378 mainline candidate */
 
       tmode = insn_data[icode].operand[0].mode;
       mode1 = insn_data[icode].operand[1].mode;
@@ -19982,7 +20052,7 @@
     = copy_list (TYPE_ATTRIBUTES (TREE_TYPE (trad_fndecl)));
   ix86_make_regparmandstackparmee (&TREE_TYPE (new_fndecl));
   /* Kludge: block copied from tree-inline.c(save_body).  Should
-     be refactored into a common shareable routine.  */	
+     be refactored into a common shareable routine.  */
   {
     tree *parg;
 
@@ -20074,7 +20144,7 @@
 
   if (!ix86_darwin_fntype_st)
     ix86_darwin_fntype_st = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
-  
+
   if (!ix86_darwin_regparmandstackparm_st)
     ix86_darwin_regparmandstackparm_st
       = splay_tree_new (splay_tree_compare_pointers, NULL, NULL);
@@ -20833,7 +20903,7 @@
       TREE_OPERAND (arg, 0) = integer_zero_node;
       TREE_OPERAND (arg, 1) = swp;
     }
-    
+
   if (TREE_OPERAND (arg, 1))
     {
       rtype = iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), arg);
@@ -20910,11 +20980,20 @@
   tree args = iargs;
   int argnum = 1;
   const char *opcode = *opcode_p;
+  bool fp_style = false;
+  bool fpi_style = false;
 
   /* Don't transform if output format is the same as input format.  */
   if (ASSEMBLER_DIALECT == ASM_INTEL)
     return iargs;
 
+  if (strncasecmp (opcode, "f", 1) == 0)
+    fp_style = true;
+
+  if (fp_style
+      && strncasecmp (opcode+1, "i", 1) == 0)
+    fpi_style = true;
+
   while (args)
     {
       tree arg = TREE_VALUE (args);
@@ -20945,7 +21024,7 @@
 	}
       else if (TREE_CODE (arg) == BRACKET_EXPR)
 	TREE_VALUE (args) = arg = iasm_canonicalize_bracket (arg);
-	  
+
       switch (TREE_CODE (arg))
 	{
 	case ARRAY_REF:
@@ -20955,9 +21034,9 @@
 	  if (TYPE_MODE (TREE_TYPE (arg)) == QImode)
 	    e->mod[argnum-1] = 'b';
 	  else if (TYPE_MODE (TREE_TYPE (arg)) == HImode)
-	    e->mod[argnum-1] = 'w';
+	    e->mod[argnum-1] = fpi_style ? 's' : 'w';
 	  else if (TYPE_MODE (TREE_TYPE (arg)) == SImode)
-	    e->mod[argnum-1] = 'l';
+	    e->mod[argnum-1] = fpi_style ? 'l' : (fp_style ? 's' : 'l');
 	  else if (TYPE_MODE (TREE_TYPE (arg)) == DImode)
 	    e->mod[argnum-1] = 'q';
 	  else if (TYPE_MODE (TREE_TYPE (arg)) == SFmode)
@@ -20976,9 +21055,9 @@
 	      if (strcasecmp (s, "byte") == 0)
 		e->mod[argnum-1] = 'b';
 	      else if (strcasecmp (s, "word") == 0)
-		e->mod[argnum-1] = 'w';
+		e->mod[argnum-1] = fpi_style ? 's' : 'w';
 	      else if (strcasecmp (s, "dword") == 0)
-		e->mod[argnum-1] = 'l';
+		e->mod[argnum-1] = fpi_style ? 'l' : (fp_style ? 's' : 'l');
 	      else if (strcasecmp (s, "qword") == 0)
 		e->mod[argnum-1] = 'q';
 	      else if (strcasecmp (s, "real4") == 0)

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Thu Nov  8 20:30:15 2007
@@ -677,8 +677,9 @@
 #define BIGGEST_FIELD_ALIGNMENT 32
 #endif
 #else
-/* APPLE LOCAL Macintosh alignment */
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED, FIRST_FIELD_P) \
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */ \
    x86_field_alignment (FIELD, COMPUTED)
 #endif
 

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.md
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.md?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/i386.md (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.md Thu Nov  8 20:30:15 2007
@@ -133,6 +133,8 @@
    (UNSPEC_FRNDINT_MASK_PM	73)
    (UNSPEC_FIST_FLOOR		74)
    (UNSPEC_FIST_CEIL 		75)
+   ; APPLE LOCAL 3399553
+   (UNSPEC_FLT_ROUNDS		76)
 
    ; x87 Double output FP
    (UNSPEC_SINCOS_COS		80)
@@ -18898,7 +18900,8 @@
   "")
 
 (define_insn "*darwin_cmpstrnqi_nz_1"
-  [(set (match_operand:SI 0 "register_operand" "=r")
+;; APPLE LOCAL 5379188
+  [(set (match_operand:SI 0 "register_operand" "=&r")
 	(subreg:SI (compare:CC (mem:BLK (match_operand:SI 5 "register_operand" "1"))
 		    (mem:BLK (match_operand:SI 6 "register_operand" "2"))) 0))
    (use (match_operand:SI 8 "register_operand" "3"))
@@ -18934,7 +18937,8 @@
   "")
 
 (define_insn "*darwin_cmpstrqi_1"
-  [(set (match_operand:SI 0 "register_operand" "=r")
+;; APPLE LOCAL 5379188
+  [(set (match_operand:SI 0 "register_operand" "=&r")
 	(subreg:SI (if_then_else:CC (ne (match_operand:SI 8 "register_operand" "3")
 			     (const_int 0))
 	  (compare:CC (mem:BLK (match_operand:SI 5 "register_operand" "1"))
@@ -21180,6 +21184,22 @@
   }
   [(set_attr "type" "multi")])
 
+; APPLE LOCAL begin 3399553
+
+; Expand the builtin FLT_ROUNDS by reading the x87 FPSR rounding bits.
+
+(define_expand "flt_rounds"
+ [(set (match_operand 0 "nonimmediate_operand" "")
+       (unspec:SI [(reg:CCFP FPSR_REG)] UNSPEC_FLT_ROUNDS))]
+  ""
+  "
+  {
+    ix86_expand_flt_rounds (operands[0]);
+    DONE;
+  }
+  "
+)
+; APPLE LOCAL end 3399553
 ;  APPLE LOCAL begin mainline
 (include "mmx.md")
 (include "sse.md")

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/linux.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/linux.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/linux.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/linux.h Thu Nov  8 20:30:15 2007
@@ -1,197 +1,3 @@
-/* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2005,
-   2006 Free Software Foundation, Inc.
-   Contributed by Eric Youngdale.
-   Modified for stabs-in-ELF by H.J. Lu.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to
-the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
-
-/* Output at beginning of assembler file.  */
-/* The .file command should always begin the output.  */
-#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
-
-#define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
-
-/* The svr4 ABI for the i386 says that records and unions are returned
-   in memory.  */
-#undef DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 1
-
-/* We arrange for the whole %gs segment to map the tls area.  */
-#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
-#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
-
-#undef ASM_COMMENT_START
-#define ASM_COMMENT_START "#"
-
-#undef DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
-
-/* Output assembler code to FILE to call the profiler.
-   To the best of my knowledge, no Linux libc has required the label
-   argument to mcount.  */
-
-#define NO_PROFILE_COUNTERS	1
-
-#undef MCOUNT_NAME
-#define MCOUNT_NAME "mcount"
-
-/* The GLIBC version of mcount for the x86 assumes that there is a
-   frame, so we cannot allow profiling without a frame pointer.  */
-
-#undef SUBTARGET_FRAME_POINTER_REQUIRED
-#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
-
-#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
- 
-#undef PTRDIFF_TYPE
-#define PTRDIFF_TYPE "int"
-  
-#undef WCHAR_TYPE
-#define WCHAR_TYPE "long int"
-   
-#undef WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE BITS_PER_WORD
-    
-#define TARGET_OS_CPP_BUILTINS()		\
-  do						\
-    {						\
-	LINUX_TARGET_OS_CPP_BUILTINS();		\
-    }						\
-  while (0)
-
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
-
-#undef CC1_SPEC
-#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
-
-/* Provide a LINK_SPEC appropriate for Linux.  Here we provide support
-   for the special GCC options -static and -shared, which allow us to
-   link things in one of these three modes by applying the appropriate
-   combinations of options at link-time. We like to support here for
-   as many of the other GNU linker options as possible. But I don't
-   have the time to search for those flags. I am sure how to add
-   support for -soname shared_object_name. H.J.
-
-   I took out %{v:%{!V:-V}}. It is too much :-(. They can use
-   -Wl,-V.
-
-   When the -shared link option is used a final link is not being
-   done.  */
-
-/* If ELF is the default format, we should not use /lib/elf.  */
-
-/* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
-#define LINK_EMULATION "elf_i386"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
-#undef  SUBTARGET_EXTRA_SPECS
-#define SUBTARGET_EXTRA_SPECS \
-  { "link_emulation", LINK_EMULATION },\
-  { "dynamic_linker", LINUX_DYNAMIC_LINKER }
-
-#undef	LINK_SPEC
-#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
-  %{!shared: \
-    %{!ibcs: \
-      %{!static: \
-	%{rdynamic:-export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker %(dynamic_linker)}} \
-	%{static:-static}}}"
-
-/* Similar to standard Linux, but adding -ffast-math support.  */
-#undef  ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
-   %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
-
-/* A C statement (sans semicolon) to output to the stdio stream
-   FILE the assembler definition of uninitialized global DECL named
-   NAME whose size is SIZE bytes and alignment is ALIGN bytes.
-   Try to use asm_output_aligned_bss to implement this macro.  */
-
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-
-/* A C statement to output to the stdio stream FILE an assembler
-   command to advance the location counter to a multiple of 1<<LOG
-   bytes if it is within MAX_SKIP bytes.
-
-   This is used to align code labels according to Intel recommendations.  */
-
-#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
-#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)			\
-  do {									\
-    if ((LOG) != 0) {							\
-      if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
-      else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
-    }									\
-  } while (0)
-#endif
-
-/* Handle special EH pointer encodings.  Absolute, pc-relative, and
-   indirect are handled automatically.  */
-#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
-  do {									\
-    if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)		\
-      {									\
-        fputs (ASM_LONG, FILE);			\
-        assemble_name (FILE, XSTR (ADDR, 0));				\
-	fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
-        goto DONE;							\
-      }									\
-  } while (0)
-
-/* Used by crtstuff.c to initialize the base of data-relative relocations.
-   These are GOT relative on x86, so return the pic register.  */
-#ifdef __PIC__
-#define CRT_GET_RFIB_DATA(BASE)			\
-  {						\
-    register void *ebx_ __asm__("ebx");		\
-    BASE = ebx_;				\
-  }
-#else
-#define CRT_GET_RFIB_DATA(BASE)						\
-  __asm__ ("call\t.LPR%=\n"						\
-	   ".LPR%=:\n\t"						\
-	   "popl\t%0\n\t"						\
-	   /* Due to a GAS bug, this cannot use EAX.  That encodes	\
-	      smaller than the traditional EBX, which results in the	\
-	      offset being off by one.  */				\
-	   "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"			\
-	   : "=d"(BASE))
-#endif
-
-#undef NEED_INDICATE_EXEC_STACK
-#define NEED_INDICATE_EXEC_STACK 1
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
-
-/* This macro may be overridden in i386/k*bsd-gnu.h.  */
-#define REG_NAME(reg) reg
-
-#ifdef TARGET_LIBC_PROVIDES_SSP
-/* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
-#define TARGET_THREAD_SSP_OFFSET	0x14
-#endif
 
 /* LLVM LOCAL begin */
 #ifdef ENABLE_LLVM

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/t-mingw32
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/t-mingw32?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/t-mingw32 (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/t-mingw32 Thu Nov  8 20:30:15 2007
@@ -1,3 +1 @@
-# Match SYSTEM_INCLUDE_DIR
-NATIVE_SYSTEM_HEADER_DIR = /mingw/include
 

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/darwin.h Thu Nov  8 20:30:15 2007
@@ -101,6 +101,8 @@
    the kernel or some such.  */
 
 #define CC1_SPEC "\
+  "/* APPLE LOCAL ARM ignore -mthumb and -mno-thumb */"\
+  %<mthumb %<mno-thumb \
   "/* APPLE LOCAL ignore -msse and -msse2 and other x86 options */"\
   %<msse  %<msse2 %<msse3 %<march=pentium4 %<mcpu=pentium4 \
   %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }} \
@@ -148,6 +150,16 @@
      :10.1}"
 
 /* APPLE LOCAL end mainline 2007-03-13 5040758 5005743 */
+/* APPLE LOCAL begin 5342595 */
+/* LLVM LOCAL begin */
+#ifdef HAVE_DSYMUTIL
+#define DARWIN_DSYMUTIL_SPEC	\
+  "%{g*:%{!gstabs*:%{!g0: dsymutil %{o*:%*}%{!o:a.out}}}}"
+#else
+#define DARWIN_DSYMUTIL_SPEC ""
+#endif
+/* LLVM LOCAL end */
+/* APPLE LOCAL end 5342595 */
 /* APPLE LOCAL begin mainline */
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS			\
@@ -280,6 +292,8 @@
     "vrsave", "vscr",							\
     "spe_acc", "spefscr",                                               \
     "sfp"								\
+    /* APPLE LOCAL 3399553 */                                           \
+    , "fpscr"								\
 }
 
 /* This outputs NAME to FILE.  */
@@ -418,26 +432,27 @@
 #define darwin_alignment_flags rs6000_alignment_flags
 #define OPTION_ALIGN_NATURAL TARGET_ALIGN_NATURAL
 #define OPTION_MASK_ALIGN_NATURAL MASK_ALIGN_NATURAL
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
 /* This now supports the Macintosh power, mac68k, and natural 
-   alignment modes.  It now has one more parameter than the standard 
-   version of the ADJUST_FIELD_ALIGN macro.  
-   
-   The macro works as follows: We use the computed alignment of the 
-   field if we are in the natural alignment mode or if the field is 
-   a vector.  Otherwise, if we are in the mac68k alignment mode, we
-   use the minimum of the computed alignment and 16 (pegging at
-   2-byte alignment).  If we are in the power mode, we peg at 32
-   (word alignment) unless it is the first field of the struct, in 
-   which case we use the computed alignment.  */
+   alignment modes.
+
+   Compute field alignment.  This is similar to the version of the
+   macro in the Apple version of GCC, except that version supports
+   'mac68k' alignment, and that version uses the computed alignment
+   always for the first field of a structure.  The first-field
+   behavior is dealt with by
+   darwin_rs6000_special_round_type_align.  */
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 #undef ADJUST_FIELD_ALIGN
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED, FIRST_FIELD_P)	\
-  (TARGET_ALIGN_NATURAL ? (COMPUTED) :				\
-   (((COMPUTED) == RS6000_VECTOR_ALIGNMENT)			\
-    ? RS6000_VECTOR_ALIGNMENT					\
-    : (MIN ((COMPUTED), 					\
-    	    (OPTION_ALIGN_MAC68K ? 16 				\
-    	    			 : ((FIRST_FIELD_P) ? (COMPUTED) \
-    	    			 		    : 32))))))
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)	\
+  (TARGET_ALIGN_NATURAL ? (COMPUTED)		\
+   : (((COMPUTED) == RS6000_VECTOR_ALIGNMENT)	\
+      ? RS6000_VECTOR_ALIGNMENT			\
+      : (MIN ((COMPUTED), 			\
+	      (OPTION_ALIGN_MAC68K ? 16		\
+	       : 32)))))
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 
 /* When adjusting (lowering) the alignment of fields when in the
    mac68k alignment mode, the 128-bit alignment of vectors *MUST*
@@ -447,14 +462,20 @@
         ((DESIRED) == RS6000_VECTOR_ALIGNMENT ? RS6000_VECTOR_ALIGNMENT	\
          : MIN ((DESIRED), 16))
 
-#undef ROUND_TYPE_ALIGN
-/* Macintosh alignment modes require more complicated handling
-   of alignment, so we replace the macro with a call to a
-   out-of-line function.  */
-union tree_node;
-extern unsigned round_type_align (union tree_node*, unsigned, unsigned); /* rs6000.c  */
-#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)	\
-  round_type_align(STRUCT, COMPUTED, SPECIFIED)
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+/* Darwin increases natural record alignment to doubleword if the first
+   field is an FP double while the FP fields remain word aligned.  */
+#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			  \
+  ((TREE_CODE (STRUCT) == RECORD_TYPE					  \
+    || TREE_CODE (STRUCT) == UNION_TYPE					  \
+    || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)				  \
+   && TARGET_ALIGN_NATURAL == 0						  \
+   ? darwin_rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
+   : (TREE_CODE (STRUCT) == VECTOR_TYPE					  \
+      && ALTIVEC_VECTOR_MODE (TYPE_MODE (STRUCT)))			  \
+   ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128)				  \
+   : MAX ((COMPUTED), (SPECIFIED)))
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 /* APPLE LOCAL end Macintosh alignment 2002-2-26 --ff */
 
 /* APPLE LOCAL begin alignment */

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000-protos.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000-protos.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000-protos.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000-protos.h Thu Nov  8 20:30:15 2007
@@ -114,6 +114,10 @@
 #ifdef TREE_CODE
 extern unsigned int rs6000_special_round_type_align (tree, unsigned int,
 						     unsigned int);
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int,
+							    unsigned int);
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
 				  tree, int, int);
 extern int function_arg_boundary (enum machine_mode, tree);
@@ -160,6 +164,8 @@
 extern tree rs6000_fold_builtin (tree, tree, bool);
 /* APPLE LOCAL CW asm blocks */
 extern const char *rs6000_iasm_register_name (const char *, char *);
+/* APPLE LOCAL 3399553 */
+extern void rs6000_expand_flt_rounds (rtx);
 
 /* Declare functions in rs6000-c.c */
 

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.c Thu Nov  8 20:30:15 2007
@@ -862,6 +862,8 @@
       "spe_acc", "spefscr",
       /* Soft frame pointer.  */
       "sfp"
+      /* APPLE LOCAL 3399553 */
+      , "fpscr"
 };
 
 #ifdef TARGET_REGNAMES
@@ -888,6 +890,8 @@
   "spe_acc", "spefscr",
   /* Soft frame pointer.  */
   "sfp"
+  /* APPLE LOCAL 3399553 */
+  , "fpscr"
 };
 #endif
 
@@ -1113,6 +1117,10 @@
 #define TARGET_ASM_OUTPUT_DWARF_DTPREL rs6000_output_dwarf_dtprel
 #endif
 
+/* APPLE LOCAL begin radar 5155743, mainline candidate */
+#undef TARGET_HAVE_DYNAMIC_STACK_SPACE
+#define TARGET_HAVE_DYNAMIC_STACK_SPACE true
+/* APPLE LOCAL end radar 5155743, mainline candidate */
 /* Use a 32-bit anchor range.  This leads to sequences like:
 
 	addis	tmp,anchor,high
@@ -1368,9 +1376,9 @@
 
   /* APPLE LOCAL begin -mmultiple/-mstring fixme */
   /* Save current -mmultiple/-mno-multiple status.  */
-  int multiple = TARGET_MULTIPLE;
+  int multiple = (target_flags & MASK_MULTIPLE);
   /* Save current -mstring/-mno-string status.  */
-  int string = TARGET_STRING;
+  int string = (target_flags & MASK_STRING);
   /* APPLE LOCAL end -mmultiple/-mstring fixme */
 
   /* Some OSs don't support saving the high part of 64-bit registers on
@@ -2290,7 +2298,9 @@
 	     forbid its use.  */
 	  if (DEFAULT_ABI == ABI_DARWIN && TARGET_64BIT)
 	    error ("-malign-mac68k is not allowed for 64-bit Darwin");
-	  rs6000_alignment_flags = OPTION_ALIGN_MAC68K;
+	  /* APPLE LOCAL begin radar 5134231 */
+	  rs6000_alignment_flags = OPTION_MASK_ALIGN_MAC68K;
+	  /* APPLE LOCAL end radar 5134231 */
 	}
     /* APPLE LOCAL end Macintosh alignment 2002-2-26 --ff */
       else
@@ -2370,7 +2380,8 @@
       switch_to_section (text_section);
     }
 
-  /* APPLE LOCAL begin lno */
+  /* APPLE LOCAL begin hot/cold */
+  /* MERGE FIXME push to FSF or remove as unneeded? */
 #if TARGET_MACHO
   if (DEFAULT_ABI == ABI_DARWIN)
     {
@@ -2400,7 +2411,7 @@
        }
     }
 #endif
-  /* APPLE LOCAL end lno */
+  /* APPLE LOCAL end hot/cold */
 }
 
 
@@ -3062,6 +3073,70 @@
   return align;
 }
 
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+/* Darwin increases record alignment to the natural alignment of
+   the first field.  */
+
+unsigned int
+darwin_rs6000_special_round_type_align (tree type, unsigned int computed,
+					unsigned int specified)
+{
+  unsigned int align = MAX (computed, specified);
+
+  if (TYPE_PACKED (type))
+    return align;
+
+  /* Find the first field, looking down into aggregates.  */
+  /* APPLE LOCAL begin radar 4869885 */
+  {
+    tree field = TYPE_FIELDS (type);
+    /* Skip all non field decls */
+    while (field != NULL && TREE_CODE (field) != FIELD_DECL)
+      field = TREE_CHAIN (field);
+    if (field)
+    {
+      if (TREE_CODE (type) == UNION_TYPE)
+      {
+        tree union_field = field;
+        tree union_type = TREE_TYPE (union_field);
+        tree next_union_type;
+        do
+        {
+          union_field = TREE_CHAIN (union_field);
+          if (!union_field)
+            break;
+          /* Skip all non field decls */
+          if (TREE_CODE (TREE_TYPE (union_field)) == ARRAY_TYPE)
+            next_union_type = get_inner_array_type (union_field);
+          else
+            next_union_type = TREE_TYPE (union_field);
+          if (TYPE_ALIGN (next_union_type) > TYPE_ALIGN (union_type))
+            union_type = next_union_type;
+        } while (1);
+        type = union_type;
+      }
+      else
+        type = TREE_TYPE (field);
+      while (TREE_CODE (type) == ARRAY_TYPE)
+        type = TREE_TYPE (type);
+    }
+  }
+  /* APPLE LOCAL end radar 4869885 */
+
+  /* APPLE LOCAL begin Macintosh alignment 2002-1-22 --ff */
+  if (OPTION_ALIGN_MAC68K)
+    align = MAX (align, 16);
+  /* APPLE LOCAL end Macintosh alignment 2002-1-22 --ff */
+
+  /* APPLE LOCAL begin radar 4869885 */
+  else if (type != error_mark_node && ! TYPE_PACKED (type) &&
+           maximum_field_alignment == 0 && (TARGET_ALIGN_NATURAL == 0))
+  /* APPLE LOCAL end radar 4869885 */
+    align = MAX (align, TYPE_ALIGN (type));
+
+  return align;
+}
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 /* Return 1 for an operand in small memory on V.4/eabi.  */
 
 int
@@ -3218,10 +3293,13 @@
     case V8HImode:
     case V4SFmode:
     case V4SImode:
+      /* APPLE LOCAL begin radar 4994150 */
       /* AltiVec vector modes.  Only reg+reg addressing is valid and
 	 constant offset zero should not occur due to canonicalization.
-	 Allow any offset when not strict before reload.  */
-      return !strict;
+	 Allow any offset when not strict before reload.
+      */
+      return false;
+      /* APPLE LOCAL end radar 4994150 */
 
     case V4HImode:
     case V2SImode:
@@ -6703,7 +6781,7 @@
 struct altivec_pim_info GTY(())
 {
   tree rettype;	/* Return type (unless pim_rt_... flags are used).  */
-  int insn;	/* FUNCTION_DECL_CODE of the underlying '__builtin_...'.  */
+  int insn;	/* DECL_FUNCTION_CODE of the underlying '__builtin_...'.  */
   enum pim_flags flags;		/* See 'enum pim_flags' above.  */
 };
 
@@ -7461,7 +7539,10 @@
 altivec_ovl_resolve (struct altivec_pim_info *info, tree t1, tree t2)
 {
   /* Make sure we have all the types that we need.  */
-  if (!t1 || (!t2 && (info->flags & pim_ovl_MASK) >= pim_ovl_16u_16u))
+  if (!t1)
+    return 0;
+
+  if (!t2 && (info->flags & pim_ovl_MASK) >= pim_ovl_16u_16u)
     return 0;
 
   /* Examine overload candidates in order, and return the first one
@@ -7549,7 +7630,7 @@
 altivec_convert_args (tree types, tree args)
 {
   tree t, a;
-
+  
   for (t = types, a = args; t && a; t = TREE_CHAIN (t), a = TREE_CHAIN (a))
     {
       TREE_VALUE (a) = convert (TREE_VALUE (t), TREE_VALUE (a));
@@ -7563,21 +7644,31 @@
 	}
     }
 
+  /* At this point we've converted all of the arguments we're supposed
+     to have. Anything extra is an error and we should mark it as such.  */
+  for (a = args; a; a = TREE_CHAIN (a))
+    {
+      if (VOID_TYPE_P (TREE_TYPE (TREE_VALUE (a))))
+	{
+	  error ("Too many arguments to altivec builtin.");
+	  TREE_VALUE (a) = error_mark_node;
+	}
+    }
+  
   return args;
 }
 
-/* The following function rewrites EXP by substituting AltiVec PIM operations
-   or predicates with built-in instructions defined above.  Type casts are
-   provided if needed.  */
+/* The following function rewrites FNDECL and ARGLIST by substituting AltiVec
+   PIM operations or predicates with built-in instructions defined above.
+   Type casts are provided if needed.  */
 
 tree
-/* MERGE FIXME arglist added to build_builtin, ensure it was done correctly
-   also fndecl was exp and used to do fndecl = get_callee_fndecl (exp); */
 rs6000_fold_builtin (tree fndecl, tree arglist, bool ARG_UNUSED (ignore))
 {
   tree rettype;
   tree typ1 = NULL_TREE, typ2 = NULL_TREE;
-  int fcode, ovl_error = 0;
+  int ovl_error = 0;
+  enum built_in_function fcode;
   struct altivec_pim_info *info;
 
   /* Bail out if not in Apple AltiVec mode.  */
@@ -7595,27 +7686,31 @@
   /* Point at the first (and possibly only) entry in ALTIVEC_PIM_TABLE
      describing this PIM operation/predicate, and how to convert it to
      a __builtin_... call.  */
-
+  
   info = altivec_pim_table + (fcode - ALTIVEC_PIM__FIRST);
-
+  
   if (arglist)
-  /* APPLE LOCAL begin radar 5021057 */
-  {
-    if (TREE_VALUE (arglist) == error_mark_node)
-      return NULL_TREE;
-    typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (arglist)));
-  }
+    /* APPLE LOCAL begin radar 5021057 */
+    {
+      if (TREE_VALUE (arglist) == error_mark_node)
+	return NULL_TREE;
+      typ1 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (arglist)));
+    }
   /* APPLE LOCAL end radar 5021057 */
-
+  
   if (arglist && TREE_CHAIN (arglist))
-    typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist))));
-
+    {
+      if (TREE_VALUE (TREE_CHAIN (arglist)) == error_mark_node)
+	return NULL_TREE;
+      typ2 = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_VALUE (TREE_CHAIN (arglist))));
+    }
+  
   /* Select from a list of overloaded functions, if needed.  */
-
+  
   if (info->flags & pim_ovl_MASK)
     {
       info = altivec_ovl_resolve (info, typ1, typ2);
-
+      
       if (!info)
 	{
 	  /* No suitable overload candidate was found!  */
@@ -7792,10 +7887,22 @@
 altivec_expand_abs_builtin (enum insn_code icode, tree arglist, rtx target)
 {
   rtx pat, scratch1, scratch2;
-  tree arg0 = TREE_VALUE (arglist);
-  rtx op0 = expand_normal (arg0);
-  enum machine_mode tmode = insn_data[icode].operand[0].mode;
-  enum machine_mode mode0 = insn_data[icode].operand[1].mode;
+  /* APPLE LOCAL begin Alitvec radar 5447227 */
+  tree arg0;
+  rtx op0;
+  enum machine_mode tmode;
+  enum machine_mode mode0;
+  if (!arglist
+      || !TREE_VALUE (arglist))
+    {
+      error ("too few arguments to function");
+      return const0_rtx;
+    }
+  arg0 = TREE_VALUE (arglist);
+  op0 = expand_normal (arg0);
+  tmode = insn_data[icode].operand[0].mode;
+  mode0 = insn_data[icode].operand[1].mode;
+  /* APPLE LOCAL end Alitvec radar 5447227 */
 
   /* If we have invalid arguments, bail out before generating bad rtl.  */
   if (arg0 == error_mark_node)
@@ -7916,15 +8023,35 @@
 				  tree arglist, rtx target)
 {
   rtx pat, scratch;
-  tree cr6_form = TREE_VALUE (arglist);
-  tree arg0 = TREE_VALUE (TREE_CHAIN (arglist));
-  tree arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
-  rtx op0 = expand_normal (arg0);
-  rtx op1 = expand_normal (arg1);
-  enum machine_mode tmode = SImode;
-  enum machine_mode mode0 = insn_data[icode].operand[1].mode;
-  enum machine_mode mode1 = insn_data[icode].operand[2].mode;
+  /* APPLE LOCAL begin Alitvec radar 5447227 */
+  tree cr6_form;
+  tree arg0;
+  tree arg1;
+  rtx op0;
+  rtx op1;
+  enum machine_mode tmode;
+  enum machine_mode mode0;
+  enum machine_mode mode1;
   int cr6_form_int;
+  if (!arglist
+      || !TREE_VALUE (arglist)
+      || !TREE_CHAIN (arglist)
+      || !TREE_VALUE (TREE_CHAIN (arglist))
+      || !TREE_CHAIN (TREE_CHAIN (arglist))
+      || !TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))
+    {
+      error ("too few arguments to function");
+      return const0_rtx;
+    }
+  cr6_form = TREE_VALUE (arglist);
+  arg0 = TREE_VALUE (TREE_CHAIN (arglist));
+  arg1 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+  op0 = expand_normal (arg0);
+  op1 = expand_normal (arg1);
+  tmode = SImode;
+  mode0 = insn_data[icode].operand[1].mode;
+  mode1 = insn_data[icode].operand[2].mode;
+  /* APPLE LOCAL end Alitvec radar 5447227 */
 
   if (TREE_CODE (cr6_form) != INTEGER_CST)
     {
@@ -7992,13 +8119,30 @@
 altivec_expand_lv_builtin (enum insn_code icode, tree arglist, rtx target)
 {
   rtx pat, addr;
-  tree arg0 = TREE_VALUE (arglist);
-  tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
-  enum machine_mode tmode = insn_data[icode].operand[0].mode;
-  enum machine_mode mode0 = Pmode;
-  enum machine_mode mode1 = Pmode;
-  rtx op0 = expand_normal (arg0);
-  rtx op1 = expand_normal (arg1);
+  /* APPLE LOCAL begin Alitvec radar 5447227 */
+  tree arg0;
+  tree arg1;
+  enum machine_mode tmode;
+  enum machine_mode mode0;
+  enum machine_mode mode1;
+  rtx op0;
+  rtx op1;
+  if (!arglist
+      || !TREE_VALUE (arglist)
+      || !TREE_CHAIN (arglist)
+      || !TREE_VALUE (TREE_CHAIN (arglist)))
+    {
+      error ("too few arguments to function");
+      return const0_rtx;
+    }
+  arg0 = TREE_VALUE (arglist);
+  arg1 = TREE_VALUE (TREE_CHAIN (arglist));
+  tmode = insn_data[icode].operand[0].mode;
+  mode0 = Pmode;
+  mode1 = Pmode;
+  op0 = expand_normal (arg0);
+  op1 = expand_normal (arg1);
+  /* APPLE LOCAL end Alitvec radar 5447227 */
 
   if (icode == CODE_FOR_nothing)
     /* Builtin not supported on this processor.  */
@@ -8070,16 +8214,37 @@
 static rtx
 altivec_expand_stv_builtin (enum insn_code icode, tree arglist)
 {
-  tree arg0 = TREE_VALUE (arglist);
-  tree arg1 = TREE_VALUE (TREE_CHAIN (arglist));
-  tree arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
-  rtx op0 = expand_normal (arg0);
-  rtx op1 = expand_normal (arg1);
-  rtx op2 = expand_normal (arg2);
+  /* APPLE LOCAL begin Alitvec radar 5447227 */
+  tree arg0;
+  tree arg1;
+  tree arg2;
+  rtx op0;
+  rtx op1;
+  rtx op2;
   rtx pat, addr;
-  enum machine_mode tmode = insn_data[icode].operand[0].mode;
-  enum machine_mode mode1 = Pmode;
-  enum machine_mode mode2 = Pmode;
+  enum machine_mode tmode;
+  enum machine_mode mode1;
+  enum machine_mode mode2;
+  if (!arglist
+      || !TREE_VALUE (arglist)
+      || !TREE_CHAIN (arglist)
+      || !TREE_VALUE (TREE_CHAIN (arglist))
+      || !TREE_CHAIN (TREE_CHAIN (arglist))
+      || !TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))
+    {
+      error ("too few arguments to function");
+      return const0_rtx;
+    }
+  arg0 = TREE_VALUE (arglist);
+  arg1 = TREE_VALUE (TREE_CHAIN (arglist));
+  arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
+  op0 = expand_normal (arg0);
+  op1 = expand_normal (arg1);
+  op2 = expand_normal (arg2);
+  tmode = insn_data[icode].operand[0].mode;
+  mode1 = Pmode;
+  mode2 = Pmode;
+  /* APPLE LOCAL end Alitvec radar 5447227 */
 
   /* Invalid arguments.  Bail before doing anything stoopid!  */
   if (arg0 == error_mark_node
@@ -8218,6 +8383,14 @@
 
   *expandedp = true;
 
+  /* APPLE LOCAL begin Alitvec radar 5447227 */
+  if (!arglist
+      || !TREE_VALUE (arglist))
+    {
+      error ("too few arguments to function");
+      return const0_rtx;
+    }
+  /* APPLE LOCAL end Alitvec radar 5447227 */
   arg0 = TREE_VALUE (arglist);
   op0 = expand_normal (arg0);
   tmode = insn_data[icode].operand[0].mode;
@@ -8270,6 +8443,16 @@
       return NULL_RTX;
     }
 
+  /* APPLE LOCAL begin Alitvec radar 5447227 */
+  if (!arglist
+      || !TREE_VALUE (arglist)
+      || !TREE_CHAIN (arglist)
+      || !TREE_VALUE (TREE_CHAIN (arglist)))
+    {
+      error ("too few arguments to function");
+      return const0_rtx;
+    }
+  /* APPLE LOCAL end Alitvec radar 5447227 */
   arg0 = TREE_VALUE (arglist);
   arg1 = TREE_VALUE (TREE_CHAIN (arglist));
   op0 = expand_normal (arg0);
@@ -8311,6 +8494,18 @@
   for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
     if (d->code == fcode)
       {
+        /* APPLE LOCAL begin Alitvec radar 5447227 */
+        if (!arglist
+          || !TREE_VALUE (arglist)
+          || !TREE_CHAIN (arglist)
+          || !TREE_VALUE (TREE_CHAIN (arglist))
+          || !TREE_CHAIN (TREE_CHAIN (arglist))
+          || !TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))))
+        {
+          error ("too few arguments to function");
+          return const0_rtx;
+        }
+        /* APPLE LOCAL end Alitvec radar 5447227 */
 	arg0 = TREE_VALUE (arglist);
 	arg1 = TREE_VALUE (TREE_CHAIN (arglist));
 	arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
@@ -20597,133 +20792,6 @@
 
 #endif /* TARGET_MACHO */
 
-/* APPLE LOCAL begin Macintosh alignment 2002-1-22 --ff */
-/* Return the alignment of a struct based on the Macintosh PowerPC
-   alignment rules.  In general the alignment of a struct is
-   determined by the greatest alignment of its elements.  However, the
-   PowerPC rules cause the alignment of a struct to peg at word
-   alignment except when the first field has greater than word
-   (32-bit) alignment, in which case the alignment is determined by
-   the alignment of the first field.  */
-
-unsigned
-round_type_align (tree the_struct, unsigned computed, unsigned specified)
-{
-  if (TREE_CODE (the_struct) == VECTOR_TYPE
-      && ALTIVEC_VECTOR_MODE (TYPE_MODE (the_struct)))
-    {
-      /* All vectors are (at least) 16-byte aligned.  A struct or
-	 union with a vector element is also 16-byte aligned.  */
-      return MAX (RS6000_VECTOR_ALIGNMENT, MAX (computed, specified));
-    }
-
-  if (TREE_CODE (the_struct) == RECORD_TYPE
-      || TREE_CODE (the_struct) == UNION_TYPE
-      || TREE_CODE (the_struct) == QUAL_UNION_TYPE)
-    {
-      tree first_field = TYPE_FIELDS (the_struct);
-
-      /* Skip past static fields, enums, and constant fields that are
-         not really a part of the record layout.  */
-      while ((first_field != 0)
-             && (TREE_CODE (first_field) != FIELD_DECL))
-	first_field = TREE_CHAIN (first_field);
-
-      if (first_field != 0)
-        {
-	  /* If other-than-default alignment (which includes mac68k
-	     mode) is in effect, then no adjustments to the alignment
-	     should be necessary.  Ditto if the struct has the
-	     __packed__ attribute.  */
-	  if (TYPE_PACKED (the_struct) || OPTION_ALIGN_MAC68K
-	      || TARGET_ALIGN_NATURAL || maximum_field_alignment != 0)
-	    /* Do nothing  */ ;
-	  else
-            {
-              /* The following code handles Macintosh PowerPC
-                 alignment.  The implementation is complicated by the
-                 fact that BIGGEST_ALIGNMENT is 128 when AltiVec is
-                 enabled and 32 when it is not.  So when AltiVec is
-                 not enabled, alignment is generally limited to word
-                 alignment.  Consequently, the alignment of unions has
-                 to be recalculated if AltiVec is not enabled.
-
-                 Below we explicitly test for fields with greater than
-                 word alignment: doubles, long longs, and structs and
-                 arrays with greater than word alignment.  */
-              unsigned val;
-              tree field_type;
-
-              val = MAX (computed, specified);
-
-              if (TREE_CODE (the_struct) == UNION_TYPE && !TARGET_ALTIVEC)
-                {
-                  tree field = first_field;
-
-                  while (field != 0)
-                    {
-                      /* Don't consider statics, enums and constant fields
-                         which are not really a part of the record.  */
-                      if (TREE_CODE (field) != FIELD_DECL)
-                        {
-                          field = TREE_CHAIN (field);
-                          continue;
-                        }
-                      field_type = TREE_TYPE(field);
-                      if (TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE)
-                        field_type = get_inner_array_type (field);
-                      else
-                        field_type = TREE_TYPE (field);
-		      if (field_type != error_mark_node)
-			{
-			  val = MAX (TYPE_ALIGN (field_type), val);
-			  if (FLOAT_TYPE_P (field_type)
-			      && TYPE_MODE (field_type) == DFmode)
-			    val = MAX (RS6000_DOUBLE_ALIGNMENT, val);
-			  else if (INTEGRAL_TYPE_P (field_type)
-				   && TYPE_MODE (field_type) == DImode)
-			    val = MAX (RS6000_LONGLONG_ALIGNMENT, val);
-			}
-                      field = TREE_CHAIN (field);
-                    }
-                }
-              else
-                {
-                  if (TREE_CODE (TREE_TYPE (first_field)) == ARRAY_TYPE)
-                    field_type = get_inner_array_type (first_field);
-                  else
-                    field_type = TREE_TYPE (first_field);
-
-		  if (field_type == error_mark_node)
-		    return val;
-                  val = MAX (TYPE_ALIGN (field_type), val);
-
-                  if (FLOAT_TYPE_P (field_type)
-				&& TYPE_MODE (field_type) == DFmode)
-                    val = MAX (RS6000_DOUBLE_ALIGNMENT, val);
-                  else if (INTEGRAL_TYPE_P (field_type)
-				&& TYPE_MODE (field_type) == DImode)
-                    val = MAX (RS6000_LONGLONG_ALIGNMENT, val);
-                }
-
-	      return val;
-            }
-        }					/* first_field != 0  */
-
-      /* Ensure all MAC68K structs are at least 16-bit aligned.
-	 Unless the struct has __attribute__ ((packed)).  */
-
-      if (OPTION_ALIGN_MAC68K && ! TYPE_PACKED (the_struct))
-	{
-	  if (computed < 16)
-	    computed = 16;
-	}
-    }						/* RECORD_TYPE, etc  */
-
-  return (MAX (computed, specified));
-}
-/* APPLE LOCAL end Macintosh alignment 2002-1-22 --ff */
-
 #if TARGET_ELF
 static int
 rs6000_elf_reloc_rw_mask (void)
@@ -22059,4 +22127,57 @@
 	 : default_external_stack_protect_fail ();
 }
 
+/* APPLE LOCAL 3399553 */
+/* Calculate the value of FLT_ROUNDS into DEST.
+
+   The rounding mode is in bits 30:31 of FPSCR, and has the following
+   settings:
+     00 Round to nearest
+     01 Round to 0
+     10 Round to +inf
+     11 Round to -inf
+
+  FLT_ROUNDS, on the other hand, expects the following:
+    -1 Undefined
+     0 Round to 0
+     1 Round to nearest
+     2 Round to +inf
+     3 Round to -inf
+
+  To perform the conversion, we do: 
+    ((FPSCR & 0x3) ^ ((~FPSCR & 0x3) >> 1))
+*/
+extern void
+rs6000_expand_flt_rounds (rtx dest)
+{
+  if (TARGET_HARD_FLOAT && TARGET_FPRS)
+    {
+      rtx mem = assign_stack_temp (DFmode, GET_MODE_SIZE (DFmode), 0);
+      rtx temp_fp = gen_reg_rtx (DFmode);
+      rtx temp_int = gen_reg_rtx (SImode);
+
+      /* Step #1: Read FPSCR.  Unfortunately, this can only be done into
+	 bits 32:63 of a FP reg.  */
+      emit_insn (gen_mffs (temp_fp));
+
+      /* Step #2: Copy onto a stack temp.  */
+      emit_move_insn (mem, temp_fp);
+
+      /* Step #3: Copy into an integer register.  */
+      emit_move_insn (dest, adjust_address (mem, SImode,
+					    WORDS_BIG_ENDIAN ? 4 : 0));
+
+      /* Step #4: Perform conversion described above.  */
+      emit_insn (gen_one_cmplsi2 (temp_int, dest));
+      emit_insn (gen_andsi3 (dest, dest, GEN_INT (0x3)));
+      emit_insn (gen_andsi3 (temp_int, temp_int, GEN_INT (0x3)));
+      emit_insn (gen_lshrsi3 (temp_int, temp_int, const1_rtx));
+      emit_insn (gen_xorsi3 (dest, dest, temp_int));
+    }
+  else
+    {
+      /* Default: return 1 (round to nearest).  */
+      emit_move_insn (dest, const1_rtx);
+    }
+}
 #include "gt-rs6000.h"

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.h Thu Nov  8 20:30:15 2007
@@ -606,13 +606,23 @@
    Another pseudo (not included in DWARF_FRAME_REGISTERS) is soft frame
    pointer, which is eventually eliminated in favor of SP or FP.  */
 
-#define FIRST_PSEUDO_REGISTER 114
+/* APPLE LOCAL begin 3399553 */
+/* OK, so this isn't technically the last physical register on the
+   processor.  It's the last register we want mapped into the EH
+   information.  Typically, this would be the last physical register,
+   however in our case we'd like to maintain backwards compatibility
+   instead of defining space we won't use anyway.  */
+#define LAST_PHYSICAL_REGISTER	113
+
+#define FIRST_PSEUDO_REGISTER 115
+/* APPLE LOCAL end 3399553 */
 
 /* This must be included for pre gcc 3.0 glibc compatibility.  */
 #define PRE_GCC3_DWARF_FRAME_REGISTERS 77
 
 /* Add 32 dwarf columns for synthetic SPE registers.  */
-#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 1) + 32)
+/* APPLE LOCAL 3399553 */
+#define DWARF_FRAME_REGISTERS (LAST_PHYSICAL_REGISTER + 32)
 
 /* The SPE has an additional 32 synthetic registers, with DWARF debug
    info numbering for these registers starting at 1200.  While eh_frame
@@ -628,7 +638,7 @@
    We must map them here to avoid huge unwinder tables mostly consisting
    of unused space.  */
 #define DWARF_REG_TO_UNWIND_COLUMN(r) \
-  ((r) > 1200 ? ((r) - 1200 + FIRST_PSEUDO_REGISTER - 1) : (r))
+  ((r) > 1200 ? ((r) - 1200 + LAST_PHYSICAL_REGISTER) : (r))
 
 /* Use standard DWARF numbering for DWARF debugging information.  */
 #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
@@ -669,6 +679,8 @@
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    1, 1						   \
    , 1, 1, 1                                       \
+   /* APPLE LOCAL 3399553 */                       \
+   , 1                                             \
 }
 
 /* 1 for registers not available across function calls.
@@ -689,6 +701,8 @@
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    1, 1						   \
    , 1, 1, 1                                       \
+   /* APPLE LOCAL 3399553 */                       \
+   , 1                                             \
 }
 
 /* Like `CALL_USED_REGISTERS' except this macro doesn't require that
@@ -708,6 +722,8 @@
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    0, 0						   \
    , 0, 0, 0                                       \
+   /* APPLE LOCAL 3399553 */                       \
+   , 0						   \
 }
 
 #define MQ_REGNO     64
@@ -725,11 +741,14 @@
 #define VSCR_REGNO		110
 #define SPE_ACC_REGNO		111
 #define SPEFSCR_REGNO		112
+/* APPLE LOCAL 3399553 */
+#define FPSCR_REGNO		114
 
 #define FIRST_SAVED_ALTIVEC_REGNO (FIRST_ALTIVEC_REGNO+20)
 #define FIRST_SAVED_FP_REGNO    (14+32)
 #define FIRST_SAVED_GP_REGNO 13
 
+/* APPLE LOCAL begin 3399553 */
 /* List the order in which to allocate registers.  Each register must be
    listed once, even those in FIXED_REGISTERS.
 
@@ -760,7 +779,9 @@
 	vrsave, vscr	(fixed)
 	spe_acc, spefscr (fixed)
 	sfp		(fixed)
+        fpscr		(fixed)
 */
+/* APPLE LOCAL end 3399553 */
 
 #if FIXED_R2 == 1
 #define MAYBE_R2_AVAILABLE
@@ -791,7 +812,8 @@
    96, 95, 94, 93, 92, 91,					\
    108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97,	\
    109, 110,							\
-   111, 112, 113						\
+   /* APPLE LOCAL 3399553 */					\
+   111, 112, 113, 114						\
 }
 
 /* True if register is floating-point.  */
@@ -1061,7 +1083,8 @@
   { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */	     \
   { 0xffffffff, 0x00000000, 0x0000efff, 0x00020000 }, /* NON_FLOAT_REGS */   \
   { 0x00000000, 0x00000000, 0x00001000, 0x00000000 }, /* XER_REGS */	     \
-  { 0xffffffff, 0xffffffff, 0xffffffff, 0x0003ffff }  /* ALL_REGS */	     \
+  /* APPLE LOCAL 3399553 */						     \
+  { 0xffffffff, 0xffffffff, 0xffffffff, 0x0007ffff }  /* ALL_REGS */	     \
 }
 
 /* The same information, inverted:
@@ -2166,6 +2189,8 @@
   &rs6000_reg_names[111][0],	/* spe_acc */				\
   &rs6000_reg_names[112][0],	/* spefscr */				\
   &rs6000_reg_names[113][0],	/* sfp  */				\
+  /* APPLE LOCAL 3399553 */						\
+  &rs6000_reg_names[114][0],	/* fpscr */				\
 }
 
 /* Table of additional register names to use in user input.  */

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.md
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.md?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.md (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/rs6000.md Thu Nov  8 20:30:15 2007
@@ -74,6 +74,10 @@
    (UNSPEC_DLMZB		45)
    (UNSPEC_DLMZB_CR		46)
    (UNSPEC_DLMZB_STRLEN		47)
+   ;; APPLE LOCAL begin 3399553
+   (UNSPEC_MFFS			48)
+   (UNSPEC_FLT_ROUNDS		49)
+   ;; APPLE LOCAL end 3399553
   ])
 
 ;;
@@ -14414,6 +14418,32 @@
   return INTVAL (operands[1]) ? \"dcbtst %a0\" : \"dcbt %a0\";
 }"
   [(set_attr "type" "load")])
+
+; APPLE LOCAL begin 3399553
+
+; Load FPSCR into bits 32:63 of a floating point register.
+
+(define_insn "mffs"
+  [(set (match_operand:DF 0 "gpc_reg_operand" "")
+	(unspec:DF [(reg:SI 114)] UNSPEC_MFFS))]
+  "TARGET_HARD_FLOAT && TARGET_FPRS"
+  "mffs %0"
+)
+
+; Expand the builtin_flt_rounds by reading the x87 FPSCR rounding bits.
+
+(define_expand "flt_rounds"
+  [(set (match_operand:SI 0 "register_operand" "")
+        (unspec:SI [(reg:SI 114)] UNSPEC_FLT_ROUNDS))]
+  ""
+  "
+  {
+    rs6000_expand_flt_rounds (operands[0]);
+    DONE;
+  }
+  "
+)
+; APPLE LOCAL end 3399553
 
 
 (include "sync.md")

Modified: llvm-gcc-4.2/trunk/gcc/cp/ChangeLog
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/ChangeLog?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/ChangeLog (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/ChangeLog Thu Nov  8 20:30:15 2007
@@ -1,3 +1,28 @@
+ # APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+2007-08-03  Geoffrey Keating  <geoffk at apple.com>
+
+	Radar 5295549
+	* parser.c (cp_parser_iteration_statement): Handle attributes.
+	* semantics.c (begin_for_stmt): Put attributes in built tree.
+	(begin_while_stmt): Put attributes in built tree.
+	(begin_do_stmt): Put attributes in built tree.
+	* pt.c (tsubst_expr): Handle attributes for FOR_STMT, WHILE_STMT,
+	DO_STMT.
+	* cp-gimplify.c (gimplify_cp_loop): Handle attributes.
+	(gimplify_for_stmt): Pass attributes to gimplify_cp_loop.
+	(gimplify_while_stmt): Pass attributes to gimplify_cp_loop.
+	(gimplify_do_stmt): Pass attributes to gimplify_cp_loop.
+	* dump.c (cp_dump_tree): Dump attributes for FOR_STMT, WHILE_STMT,
+	DO_STMT.
+	* cp-tree.h (begin_while_stmt): Update prototype.
+	(begin_do_stmt): Likewise.
+	(begin_for_stmt): Likewise.
+	* cp-tree.def (FOR_STMT): Add extra parameter.
+	(WHILE_STMT): Likewise.
+	(DO_STMT): Likewise.
+	* init.c (build_vec_init): Update for change to begin_for_stmt.
+
+ # APPLE LOCAL end for-fsf-4_4 3274130 5295549
 2007-06-28  Geoffrey Keating  <geoffk at apple.com>
 
 	* decl2.c (start_objects): Mark constructor-runnning function

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple Thu Nov  8 20:30:15 2007
@@ -1,3 +1,29 @@
+1007-10-26  Josh Conner  <jconner at apple.com>
+
+	Radar 5562046
+	* typeck.c (build_ptrmemfunc1): Add kext support for ARM.
+
+2007-08-23  Hui-May Chang <hm.chang at apple.com>
+
+        Radar 4869885
+	* class.c: Removed darwin_align_is_first_member_of_class.
+
+2007-08-22  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 4947311
+	* parser.c (cp_parser_objc_protocol_declaration): Takes attribute list
+	as extra argument and passes it down to 
+	objc_declare_protocols/objc_start_protocol.
+	(cp_parser_objc_class_interface): Now receives attribute list as input.
+	(cp_parser_objc_declaration): Parses attribute list and passes it down 
+	to cp_parser_objc_class_interface/cp_parser_objc_protocol_declaration.
+	
+2007-08-20  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5422751
+	* parser.c (cp_parser_objc_class_implementation): Unused syntax recognition
+	removed.
+
 2007-07-27  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 3742561

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/call.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/call.c Thu Nov  8 20:30:15 2007
@@ -5105,6 +5105,10 @@
         fn = (build_vfn_ref_using_vtable
               (BINFO_VTABLE (TYPE_BINFO (call_site_type)),
                DECL_VINDEX (fn)));
+	/* We have to construct something for which we can directly
+	   alter the TREE_TYPE.  We can't allow the INDIRECT_REF built
+	   above to be so altered, as that would be invalid.  */
+	fn = build1 (NOP_EXPR, t, fn);
       }
       /* APPLE LOCAL end KEXT indirect-virtual-calls --sts */
       else

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/class.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/class.c Thu Nov  8 20:30:15 2007
@@ -224,10 +224,6 @@
 int n_inner_fields_searched = 0;
 #endif
 
-/* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff  */
-extern int darwin_align_is_first_member_of_class;
-/* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff  */
-
 /* Convert to or from a base subobject.  EXPR is an expression of type
    `A' or `A*', an expression of type `B' or `B*' is returned.  To
    convert A to a base B, CODE is PLUS_EXPR and BINFO is the binfo for
@@ -4660,13 +4656,6 @@
 				       NULL, NULL);
   build_base_fields (rli, empty_base_offsets, next_field);
 
-  /* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff  */
-  /* Turn on this flag until the first real member of the class is
-     laid out.  (Enums and such things declared in the class do not
-     count.)  */
-  darwin_align_is_first_member_of_class = 1;	  
-  /* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff  */
-
   /* Layout the non-static data members.  */
   for (field = non_static_data_members; field; field = TREE_CHAIN (field))
     {
@@ -4792,12 +4781,6 @@
 	layout_nonempty_base_or_field (rli, field, NULL_TREE,
 				       empty_base_offsets);
 
-      /* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff  */
-      /* When we reach here we have laid out the first real member of
-         the class.  */
-      darwin_align_is_first_member_of_class = 0;	  
-      /* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff  */
-
       /* Remember the location of any empty classes in FIELD.  */
       if (abi_version_at_least (2))
 	record_subobject_offsets (TREE_TYPE (field),
@@ -4877,12 +4860,6 @@
       last_field_was_bitfield = DECL_C_BIT_FIELD (field);
     }
 
-  /* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff  */
-  /* Make sure the flag is turned off in cases where there were no
-     real members in the class.  */
-  darwin_align_is_first_member_of_class = 0;	  
-
-  /* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff  */
   if (abi_version_at_least (2) && !integer_zerop (rli->bitpos))
     {
       /* Make sure that we are on a byte boundary so that the size of

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cp-gimplify.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cp-gimplify.c Thu Nov  8 20:30:15 2007
@@ -210,8 +210,12 @@
    loop body as in do-while loops.  */
 
 static tree
-/* APPLE LOCAL C* language */
-gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first, tree inner_foreach)
+/* APPLE LOCAL begin C* language */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs,
+		  bool cond_is_first, tree inner_foreach)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end C* language */
 {
   tree top, entry, exit, cont_block, break_block, stmt_list, t;
   location_t stmt_locus;
@@ -258,6 +262,12 @@
 	 out of the loop, or to the top of it.  If there's no exit condition,
 	 then we just build a jump back to the top.  */
       exit = build_and_jump (&LABEL_EXPR_LABEL (top));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+
+      /* Add the attributes to the 'top' label.  */
+      decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       if (cond && !integer_nonzerop (cond))
 	{
 	  /* APPLE LOCAL begin radar 4667060 */
@@ -345,9 +355,13 @@
   if (FOR_INIT_STMT (stmt))
     gimplify_and_add (FOR_INIT_STMT (stmt), pre_p);
 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* APPLE LOCAL begin C* language */
   *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt),
-			      /* APPLE LOCAL C* language */
-			      FOR_EXPR (stmt), 1, NULL_TREE);
+			      FOR_EXPR (stmt), FOR_ATTRIBUTES (stmt), 1,
+			      NULL_TREE);
+  /* APPLE LOCAL end C* language */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 }
 
 /* Gimplify a WHILE_STMT node.  */
@@ -356,9 +370,13 @@
 gimplify_while_stmt (tree *stmt_p)
 {
   tree stmt = *stmt_p;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* APPLE LOCAL begin C* language */
   *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt),
-			      /* APPLE LOCAL C* language */
-			      NULL_TREE, 1, NULL_TREE);
+			      NULL_TREE, WHILE_ATTRIBUTES (stmt), 1,
+			      NULL_TREE);
+  /* APPLE LOCAL end C* language */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 }
 
 /* Gimplify a DO_STMT node.  */
@@ -367,9 +385,13 @@
 gimplify_do_stmt (tree *stmt_p)
 {
   tree stmt = *stmt_p;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* APPLE LOCAL begin C* language */
   *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt),
-			      /* APPLE LOCAL C* language */
-			      NULL_TREE, 0, DO_FOREACH (stmt));
+			      NULL_TREE, DO_ATTRIBUTES (stmt), 0,
+			      DO_FOREACH (stmt));
+  /* APPLE LOCAL end C* language */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 }
 
 /* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR.  */

Modified: llvm-gcc-4.2/trunk/gcc/cp/cp-tree.def
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cp-tree.def?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cp-tree.def (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cp-tree.def Thu Nov  8 20:30:15 2007
@@ -281,19 +281,23 @@
    and COND_EXPR for the benefit of templates.  */
 DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 3)
 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
 /* Used to represent a `for' statement. The operands are
-   FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively.  */
-DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 4)
+   FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY and FOR_ATTRIBUTES
+   respectively.  */
+DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 5)
 
 /* Used to represent a 'while' statement. The operands are WHILE_COND
-   and WHILE_BODY, respectively.  */
-DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 2)
+   WHILE_BODY, and WHILE_ATTRIBUTES respectively.  */
+DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 3)
 
-/* Used to represent a 'do' statement. The operands are DO_BODY and
-   DO_COND, respectively.  */
-/* APPLE LOCAL radar 4445586 */
-DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 3)
+/* APPLE LOCAL begin radar 4445586 */
+/* Used to represent a 'do' statement. The operands are DO_BODY, 
+   DO_COND, DO_ATTRIBUTES, and DO_FOREACH respectively.  */
+DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 4)
+/* APPLE LOCAL end radar 4445586 */
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 /* Used to represent a 'break' statement.  */
 DEFTREECODE (BREAK_STMT, "break_stmt", tcc_statement, 0)
 

Modified: llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h Thu Nov  8 20:30:15 2007
@@ -3099,12 +3099,25 @@
    while statement and the body of the while statement, respectively.  */
 #define WHILE_COND(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
 #define WHILE_BODY(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+#define WHILE_ATTRIBUTES(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 2)
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 /* DO_STMT accessors. These give access to the condition of the do
    statement and the body of the do statement, respectively.  */
 #define DO_COND(NODE)		TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
 #define DO_BODY(NODE)		TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+#define DO_ATTRIBUTES(NODE)	TREE_OPERAND (DO_STMT_CHECK (NODE), 2)
+/* APPLE LOCAL begin C* language */
+/* Used as a flag to indicate synthesized inner do-while loop of a 
+   foreach statement.  Used for generation of break/continue statement 
+   of the loop. */
+#define DO_FOREACH(NODE)           TREE_OPERAND (DO_STMT_CHECK (NODE), 3)
+/* APPLE LOCAL end C* language */
 
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 /* FOR_STMT accessors. These give access to the init statement,
    condition, update expression, and body of the for statement,
    respectively.  */
@@ -3112,7 +3125,10 @@
 #define FOR_COND(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
 #define FOR_EXPR(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
 #define FOR_BODY(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+#define FOR_ATTRIBUTES(NODE)	TREE_OPERAND (FOR_STMT_CHECK (NODE), 4)
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 #define SWITCH_STMT_COND(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
 #define SWITCH_STMT_BODY(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
 #define SWITCH_STMT_TYPE(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
@@ -4283,14 +4299,20 @@
 extern void begin_else_clause			(tree);
 extern void finish_else_clause			(tree);
 extern void finish_if_stmt			(tree);
-extern tree begin_while_stmt			(void);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern tree begin_while_stmt			(tree);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 extern void finish_while_stmt_cond		(tree, tree);
 extern void finish_while_stmt			(tree);
-extern tree begin_do_stmt			(void);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern tree begin_do_stmt			(tree);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 extern void finish_do_body			(tree);
 extern void finish_do_stmt			(tree, tree);
 extern tree finish_return_stmt			(tree);
-extern tree begin_for_stmt			(void);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+extern tree begin_for_stmt			(tree);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 extern void finish_for_init_stmt		(tree);
 extern void finish_for_cond			(tree, tree);
 extern void finish_for_expr			(tree, tree);

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cvt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cvt.c Thu Nov  8 20:30:15 2007
@@ -1008,6 +1008,8 @@
 	}
       expr = build1 (CONVERT_EXPR, void_type_node, expr);
     }
+  /* APPLE LOCAL Altivec 4869813 */
+  if (! targetm.cast_expr_as_vector_init)
   if (! TREE_SIDE_EFFECTS (expr))
     expr = void_zero_node;
   return expr;

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Thu Nov  8 20:30:15 2007
@@ -2380,12 +2380,16 @@
 {
   struct cp_binding_level *b;
   bool identified = false, saw_eh = false, saw_omp = false;
+  /* APPLE LOCAL pedwarn for a release 5493351 */
+  bool errored_out = false;
 
   if (exited_omp)
     {
       identify_goto (decl, locus);
       error ("  exits OpenMP structured block");
       identified = saw_omp = true;
+      /* APPLE LOCAL pedwarn for a release 5493351 */
+      errored_out = true;
     }
 
   for (b = current_binding_level; b ; b = b->level_chain)
@@ -2405,7 +2409,8 @@
 	      identified = true;
 	    }
 	  if (problem > 1)
-	    error ("  crosses initialization of %q+#D", new_decls);
+	    /* APPLE LOCAL pedwarn for a release 5493351 */
+	    pedwarn ("  crosses initialization of %q+#D", new_decls);
 	  else
 	    pedwarn ("  enters scope of non-POD %q+#D", new_decls);
 	}
@@ -2423,6 +2428,8 @@
 	    error ("  enters try block");
 	  else
 	    error ("  enters catch block");
+	  /* APPLE LOCAL pedwarn for a release 5493351 */
+	  errored_out = true;
 	  saw_eh = true;
 	}
       if (b->kind == sk_omp && !saw_omp)
@@ -2433,11 +2440,14 @@
 	      identified = true;
 	    }
 	  error ("  enters OpenMP structured block");
+	  /* APPLE LOCAL pedwarn for a release 5493351 */
+	  errored_out = true;
 	  saw_omp = true;
 	}
     }
 
-  return !identified;
+  /* APPLE LOCAL pedwarn for a release 5493351 */
+  return !errored_out;
 }
 
 static void

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/dump.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/dump.c Thu Nov  8 20:30:15 2007
@@ -433,6 +433,9 @@
       dump_stmt (di, t);
       dump_child ("body", DO_BODY (t));
       dump_child ("cond", DO_COND (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      dump_child ("attrs", DO_ATTRIBUTES (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       break;
 
     case FOR_STMT:
@@ -441,6 +444,9 @@
       dump_child ("cond", FOR_COND (t));
       dump_child ("expr", FOR_EXPR (t));
       dump_child ("body", FOR_BODY (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      dump_child ("attrs", FOR_ATTRIBUTES (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       break;
 
     case SWITCH_STMT:
@@ -453,6 +459,9 @@
       dump_stmt (di, t);
       dump_child ("cond", WHILE_COND (t));
       dump_child ("body", WHILE_BODY (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      dump_child ("attrs", WHILE_ATTRIBUTES (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       break;
 
     case STMT_EXPR:

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/init.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/init.c Thu Nov  8 20:30:15 2007
@@ -2569,7 +2569,9 @@
       tree elt_init;
       tree to;
 
-      for_stmt = begin_for_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      for_stmt = begin_for_stmt (NULL_TREE);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       finish_for_init_stmt (for_stmt);
       finish_for_cond (build2 (NE_EXPR, boolean_type_node, iterator,
 			       build_int_cst (TREE_TYPE (iterator), -1)),

Modified: llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/name-lookup.c Thu Nov  8 20:30:15 2007
@@ -3487,6 +3487,21 @@
   return s1;
 }
 
+/* APPLE LOCAL begin C++ using lookup 4329536 */
+static bool
+same_entity (tree e1, tree e2)
+{
+  /* Should we just call decls_match instead?  */
+  if (e1 == e2)
+    return true;
+  if (TREE_CODE (e1) == TYPE_DECL
+      && decls_match (e1, e2))
+    return true;
+
+  return false;
+}
+/* APPLE LOCAL end C++ using lookup 4329536 */
+
 /* This should return an error not all definitions define functions.
    It is not an error if we find two functions with exactly the
    same signature, only if these are selected in overload resolution.
@@ -3534,7 +3549,8 @@
 
   if (!old->value)
     old->value = val;
-  else if (val && val != old->value)
+  /* APPLE LOCAL C++ using lookup 4329536 */
+  else if (val && !same_entity (val, old->value))
     {
       if (is_overloaded_fn (old->value) && is_overloaded_fn (val))
 	old->value = merge_functions (old->value, val);

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/parser.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/parser.c Thu Nov  8 20:30:15 2007
@@ -540,6 +540,7 @@
 cp_lexer_peek_token (cp_lexer *lexer)
 {
   /* APPLE LOCAL begin CW asm blocks */
+ top:
   if (flag_ms_asms)
     while (lexer->next_token->type == CPP_NUMBER
 	   && lexer->next_token->u.value == error_mark_node)
@@ -548,6 +549,35 @@
 	error ("invalid suffix on integer constant");
 	cp_lexer_consume_token (lexer);
       }
+  if (!inside_iasm_block)
+    {
+      if (lexer->next_token->type == CPP_HASH)
+	{
+	  cp_lexer_consume_token (lexer);
+	  error ("stray %qs in program", "#");
+	  goto top;
+	}
+      else if (lexer->next_token->type == CPP_PASTE)
+	{
+	  cp_lexer_consume_token (lexer);
+	  error ("stray %qs in program", "##");
+	  goto top;
+	}
+      else if (lexer->next_token->type == CPP_OTHER)
+	{
+	  tree value = lexer->next_token->u.value;
+	  int c;
+	  c = TREE_INT_CST_LOW (value);
+	  cp_lexer_consume_token (lexer);
+	  if (c == '"' || c == '\'')
+	    error ("missing terminating %c character", (int) c);
+	  else if (ISGRAPH (c))
+	    error ("stray %qc in program", (int) c);
+	  else
+	    error ("stray %<\\%o%> in program", (int) c);
+	  goto top;
+	}
+    }
   /* APPLE LOCAL end CW asm blocks */
   /* APPLE LOCAL 4137741 */
   cp_lexer_consume_bincl_eincl_token (lexer);
@@ -7031,7 +7061,7 @@
       iasm_in_decl = false;
       iasm_state = iasm_asm;
       inside_iasm_block = true;
-      iasm_clear_labels ();
+      iasm_kill_regs = true;
       cp_parser_iasm_line_seq_opt (parser);
       iasm_state = iasm_none;
       iasm_end_block ();
@@ -7467,6 +7497,16 @@
      for ( for-init-statement condition [opt] ; expression [opt] )
        statement
 
+   APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+   GNU extension:
+
+     while attributes [opt] ( condition ) statement
+     do attributes [opt] statement while ( expression ) ;
+     for attributes [opt] 
+       ( for-init-statement condition [opt] ; expression [opt] )
+       statement
+
+   APPLE LOCAL end for-fsf-4_4 3274130 5295549
    Returns the new WHILE_STMT, DO_STMT, or FOR_STMT.  */
 
 static tree
@@ -7474,10 +7514,14 @@
 {
   cp_token *token;
   enum rid keyword;
-  tree statement;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  tree statement, attributes;
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   unsigned char in_statement;
 
-  /* Peek at the next token.  */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* Get the keyword at the start of the loop.  */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   token = cp_parser_require (parser, CPP_KEYWORD, "iteration-statement");
   if (!token)
     return error_mark_node;
@@ -7486,6 +7530,11 @@
      statement.  */
   in_statement = parser->in_statement;
 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* Parse the attributes, if any.  */
+  attributes = cp_parser_attributes_opt (parser);
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   /* See what kind of keyword it is.  */
   keyword = token->keyword;
   switch (keyword)
@@ -7495,7 +7544,9 @@
 	tree condition;
 
 	/* Begin the while-statement.  */
-	statement = begin_while_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	statement = begin_while_stmt (attributes);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	/* Look for the `('.  */
 	cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
 	/* Parse the condition.  */
@@ -7519,7 +7570,9 @@
 	tree expression;
 
 	/* Begin the do-statement.  */
-	statement = begin_do_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	statement = begin_do_stmt (attributes);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	/* Parse the body of the do-statement.  */
 	parser->in_statement = IN_ITERATION_STMT;
 	cp_parser_implicitly_scoped_statement (parser);
@@ -7546,7 +7599,9 @@
 	tree expression = NULL_TREE;
 
 	/* Begin the for-statement.  */
-	statement = begin_for_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	statement = begin_for_stmt (attributes);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	/* Look for the `('.  */
 	cp_parser_require (parser, CPP_OPEN_PAREN, "`('");
 	/* APPLE LOCAL begin radar 4631818 */
@@ -11786,13 +11841,14 @@
 	error ("asm blocks not enabled, use `-fasm-blocks'");
       return;
     }
-  if (cp_lexer_next_token_is (parser->lexer, CPP_DOT)
-      || cp_lexer_next_token_is (parser->lexer, CPP_ATSIGN)
-      || cp_lexer_next_token_is (parser->lexer, CPP_NAME)
-      || cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM)
-      || cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
-      || (cp_lexer_iasm_bol (parser->lexer)
-          && !cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN)))
+  if (! volatile_p
+      && (cp_lexer_next_token_is (parser->lexer, CPP_DOT)
+	  || cp_lexer_next_token_is (parser->lexer, CPP_ATSIGN)
+	  || cp_lexer_next_token_is (parser->lexer, CPP_NAME)
+	  || cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM)
+	  || cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
+	  || (cp_lexer_iasm_bol (parser->lexer)
+	      && ! cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))))
     {
       if (flag_iasm_blocks)
 	cp_parser_iasm_top_statement (parser);
@@ -17845,7 +17901,7 @@
 
   iasm_state = iasm_asm;
   inside_iasm_block = true;
-  iasm_clear_labels ();
+  iasm_kill_regs = true;
   if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"))
     return error_mark_node;
   /* Begin the compound-statement.  */
@@ -17869,7 +17925,7 @@
 
   iasm_state = iasm_asm;
   inside_iasm_block = true;
-  iasm_clear_labels ();
+  iasm_kill_regs = true;
   /* Begin the compound-statement.  */
   compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
   if (!cp_lexer_iasm_bol (parser->lexer))
@@ -17955,7 +18011,10 @@
 
       /* Do CPP_NUMBER specially to avoid errors on things like ; 1st
 	 when doing MS-style asms.  */
-      if ((token = parser->lexer->next_token)->type == CPP_NUMBER)
+      if ((token = parser->lexer->next_token)->type == CPP_NUMBER
+	  || token->type == CPP_HASH
+	  || token->type == CPP_PASTE
+	  || token->type == CPP_OTHER)
 	;
       else
 	/* Peek at the next token.  */
@@ -19741,7 +19800,8 @@
 /* Parse an Objective-C protocol declaration.  */
 
 static void
-cp_parser_objc_protocol_declaration (cp_parser* parser)
+/* APPLE LOCAL radar 4947311 */
+cp_parser_objc_protocol_declaration (cp_parser* parser, tree attributes)
 {
   tree proto, protorefs;
   cp_token *tok;
@@ -19759,7 +19819,8 @@
   /* Try a forward declaration first.  */
   if (tok->type == CPP_COMMA || tok->type == CPP_SEMICOLON)
     {
-      objc_declare_protocols (cp_parser_objc_identifier_list (parser));
+      /* APPLE LOCAL radar 4947311 */
+      objc_declare_protocols (cp_parser_objc_identifier_list (parser), attributes);
      finish:
       cp_parser_consume_semicolon_at_end_of_statement (parser);
     }
@@ -19769,7 +19830,8 @@
     {
       proto = cp_parser_identifier (parser);
       protorefs = cp_parser_objc_protocol_refs_opt (parser);
-      objc_start_protocol (proto, protorefs);
+      /* APPLE LOCAL radar 4947311 */
+      objc_start_protocol (proto, protorefs, attributes);
       cp_parser_objc_method_prototype_list (parser);
     }
 }
@@ -19806,15 +19868,14 @@
 /* Parse an Objective-C class interface.  */
 
 static void
-cp_parser_objc_class_interface (cp_parser* parser)
+/* APPLE LOCAL radar 4947311 */
+cp_parser_objc_class_interface (cp_parser* parser, tree attributes)
 {
   tree name, super, categ, protos;
   /* APPLE LOCAL radar 4965989 */
   bool is_categ;
-  /* APPLE LOCAL begin radar 4548636 */
-  tree attributes = NULL_TREE;
-  cp_parser_objc_maybe_attributes (parser, &attributes);
-  /* APPLE LOCAL end radar 4548636 */
+  /* APPLE LOCAL radar 4947311 */
+  /* Code for radar 4548636 removed. */
   cp_lexer_consume_token (parser->lexer);  /* Eat '@interface'.  */
   name = cp_parser_identifier (parser);
   /* APPLE LOCAL radar 4965989 */
@@ -19852,18 +19913,6 @@
   /* APPLE LOCAL radar 4965989 */
   bool is_categ;
   cp_lexer_consume_token (parser->lexer);  /* Eat '@implementation'.  */
-  /* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
-  if(cp_lexer_next_token_is (parser->lexer, CPP_LESS))
-    {
-      tree protorefs;
-      cp_lexer_consume_token (parser->lexer);  /* Eat '<'.  */
-      protorefs = cp_parser_objc_identifier_list (parser);
-      cp_parser_require (parser, CPP_GREATER, "`>'");
-      objc_protocol_implementation (protorefs);
-      return;
-    }
-
-  /* APPLE LOCAL end radar 4533974 - ObjC new protocol */
   name = cp_parser_identifier (parser);
   /* APPLE LOCAL radar 4965989 */
   cp_parser_objc_superclass_or_category (parser, &super, &categ, &is_categ);
@@ -19917,12 +19966,24 @@
       cp_parser_objc_class_declaration (parser);
       break;
     case RID_AT_PROTOCOL:
-      cp_parser_objc_protocol_declaration (parser);
+      /* APPLE LOCAL radar 4947311 */
+      cp_parser_objc_protocol_declaration (parser, NULL_TREE);
       break;
-    /* APPLE LOCAL radar 4548636 */
+    /* APPLE LOCAL begin radar 4548636 - radar 4947311 */
     case RID_ATTRIBUTE:
+      {
+        tree attributes = NULL_TREE;
+        cp_parser_objc_maybe_attributes (parser, &attributes);
+        if (cp_lexer_peek_token (parser->lexer)->keyword == RID_AT_INTERFACE)
+	  cp_parser_objc_class_interface (parser, attributes);
+        else if (cp_lexer_peek_token (parser->lexer)->keyword == RID_AT_PROTOCOL)
+	  cp_parser_objc_protocol_declaration (parser, attributes);
+        break;
+      }
+    /* APPLE LOCAL end radar 4548636 - radar 4947311 */
     case RID_AT_INTERFACE:
-      cp_parser_objc_class_interface (parser);
+      /* APPLE LOCAL radar 4947311 */
+      cp_parser_objc_class_interface (parser, NULL_TREE);
       break;
     case RID_AT_IMPLEMENTATION:
       cp_parser_objc_class_implementation (parser);
@@ -20218,8 +20279,10 @@
   add_stmt (bind);
  
   /* do { */
-  outer_do_stmt = begin_do_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  outer_do_stmt = begin_do_stmt (NULL_TREE);
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   /* Body of the outer do-while loop */
   /* unsigned int counter = 0; */
   exp = build2 (MODIFY_EXPR, void_type_node, counter_decl,
@@ -20229,8 +20292,10 @@
   add_stmt (bind);
 
   /*   do { */
-  inner_do_stmt = begin_do_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  inner_do_stmt = begin_do_stmt (NULL_TREE);
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   /* Body of the inner do-while loop */
   
   /* if (startMutations != *enumState.mutationsPtr) objc_enumerationMutation (collection); */

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/pt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/pt.c Thu Nov  8 20:30:15 2007
@@ -8608,8 +8608,11 @@
       }
 
     case FOR_STMT:
-      stmt = begin_for_stmt ();
-			  RECUR (FOR_INIT_STMT (t));
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      tmp = RECUR (FOR_ATTRIBUTES (t));
+      stmt = begin_for_stmt (tmp);
+      RECUR (FOR_INIT_STMT (t));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       finish_for_init_stmt (stmt);
       tmp = RECUR (FOR_COND (t));
       finish_for_cond (tmp, stmt);
@@ -8620,7 +8623,10 @@
       break;
 
     case WHILE_STMT:
-      stmt = begin_while_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      tmp = RECUR (WHILE_ATTRIBUTES (t));
+      stmt = begin_while_stmt (tmp);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       tmp = RECUR (WHILE_COND (t));
       finish_while_stmt_cond (tmp, stmt);
       RECUR (WHILE_BODY (t));
@@ -8628,7 +8634,10 @@
       break;
 
     case DO_STMT:
-      stmt = begin_do_stmt ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      tmp = RECUR (DO_ATTRIBUTES (t));
+      stmt = begin_do_stmt (tmp);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       RECUR (DO_BODY (t));
       finish_do_body (stmt);
       tmp = RECUR (DO_COND (t));

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/semantics.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/semantics.c Thu Nov  8 20:30:15 2007
@@ -694,10 +694,14 @@
    appropriate.  */
 
 tree
-begin_while_stmt (void)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+begin_while_stmt (tree attribs)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 {
   tree r;
-  r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  r = build_stmt (WHILE_STMT, NULL_TREE, NULL_TREE, attribs);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   add_stmt (r);
   WHILE_BODY (r) = do_pushlevel (sk_block);
   begin_cond (&WHILE_COND (r));
@@ -727,10 +731,14 @@
    appropriate.  */
 
 tree
-begin_do_stmt (void)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+begin_do_stmt (tree attribs)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 {
   /* APPLE LOCAL radar 4445586 */
-  tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE, NULL_TREE);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  tree r = build_stmt (DO_STMT, NULL_TREE, NULL_TREE, attribs, NULL_TREE);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   add_stmt (r);
   DO_BODY (r) = push_stmt_list ();
   return r;
@@ -794,13 +802,17 @@
 /* Begin a for-statement.  Returns a new FOR_STMT if appropriate.  */
 
 tree
-begin_for_stmt (void)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+begin_for_stmt (tree attribs)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 {
   tree r;
 
   r = build_stmt (FOR_STMT, NULL_TREE, NULL_TREE,
-		  NULL_TREE, NULL_TREE);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+		  NULL_TREE, NULL_TREE, attribs);
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   if (flag_new_for_scope > 0)
     TREE_CHAIN (r) = do_pushlevel (sk_for);
 

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/typeck.c Thu Nov  8 20:30:15 2007
@@ -5618,7 +5618,7 @@
      initializer if this target supports it.  */
   if (TREE_CODE (type) == VECTOR_TYPE 
       && targetm.cast_expr_as_vector_init
-      && !IS_AGGR_TYPE (TREE_TYPE(expr)))
+      && !IS_AGGR_TYPE (TREE_TYPE (expr)))
     return vector_constructor_from_expr (expr, type);
   /* APPLE LOCAL end AltiVec */
 
@@ -6193,10 +6193,13 @@
 	 Won't this be fun.  Much of this is snarfed from 2.95.
 	 Note that the __delta2 val, if required, will always be __delta.  */
 
+      /* APPLE LOCAL begin ARM kext */
       tree subtype, pfn_or_delta2_field, idx, idx_field, delta2_field;
-      tree delta2 = integer_zero_node;
       int ixval = 0;
       int allconstant = 0, allsimple = 0, allinvariant = 0;
+      tree virt_p;
+      int pfn_offset = 0;
+      /* APPLE LOCAL end ARM kext */
 
       delta_field = TYPE_FIELDS (type);
       idx_field = TREE_CHAIN (delta_field);
@@ -6205,58 +6208,62 @@
       pfn_field = TYPE_FIELDS (subtype);
       delta2_field = TREE_CHAIN (pfn_field);
 
+      /* APPLE LOCAL begin ARM kext */
       if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn)
 	{
-	  /* If the low bit of PFN is set, the virtual index is PFN >> 1.
-	     Else it's nonvirtual.  */
-	  allconstant = TREE_CONSTANT (pfn);
-	  allinvariant = TREE_INVARIANT (pfn);
-	  allsimple = !! initializer_constant_valid_p (pfn, TREE_TYPE (pfn));
-	  if (TREE_CODE (pfn) == INTEGER_CST && (TREE_INT_CST_LOW (pfn) & 1))
-	    {
-	      /* It's a virtual function.  PFN is the vt offset + 1.  */
+	  /* If the low bit of PFN is set, the virtual index is PFN >> 1,
+	     else it's non-virtual.  */
+	  virt_p = pfn;
+	  pfn_offset = 1;
+	}
+      else	/* Low bit of DELTA is set if we're virtual.  */
+	{
+	  virt_p = delta;
+	}
+      allconstant = TREE_CONSTANT (virt_p);
+      allinvariant = TREE_INVARIANT (virt_p);
+      allsimple = !! initializer_constant_valid_p (virt_p, TREE_TYPE (virt_p));
 
-	      int vt_entry_sz = 4;
-	      tree vt_entry_sz_tree = TYPE_SIZE_UNIT (vtable_entry_type);
-	      if (TREE_CODE (vt_entry_sz_tree) == INTEGER_CST)
-		vt_entry_sz = TREE_INT_CST_LOW (vt_entry_sz_tree);
-
-	      ixval = (TREE_INT_CST_LOW (pfn) - 1);
-	      ixval /= vt_entry_sz;
-
-	      /* Now add 2 for that spadgey VPTR index hack, plus one because
-		 2.95 indices are offset by 1.  */
-	      ixval += 2 + 1;
+      if (TREE_CODE (virt_p) == INTEGER_CST && (TREE_INT_CST_LOW (virt_p) & 1))
+	{
+	  /* It's a virtual function.  PFN is the vt offset + 1.  */
 
-	      /* __delta2 is the same as __delta.  */
-	      u = tree_cons (delta2_field, delta, NULL_TREE);
-	    }
-	  else
-	  if (TREE_CODE (pfn) == INTEGER_CST && TREE_INT_CST_LOW (pfn) == 0)
-	    {
-	      /* NULL pfn.  Just zero out everything.  */
-	      ixval = 0;
-	      pfn = integer_zero_node;
-	      delta = integer_zero_node;
-	      u = tree_cons (pfn_field, pfn, NULL_TREE);
-	    }
-	  else
+	  int vt_entry_sz = 4;
+	  tree vt_entry_sz_tree = TYPE_SIZE_UNIT (vtable_entry_type);
+	  if (TREE_CODE (vt_entry_sz_tree) == INTEGER_CST)
+	    vt_entry_sz = TREE_INT_CST_LOW (vt_entry_sz_tree);
+
+	  ixval = (TREE_INT_CST_LOW (pfn) - pfn_offset);
+	  ixval /= vt_entry_sz;
+
+	  /* Now add 2 for that spadgey VPTR index hack, plus one
+	     because 2.95 indices are offset by 1.  */
+	  ixval += 2 + 1;
+
+	  if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta)
 	    {
-	      ixval = -1;  /* -1 ==> PFN is the pointer  */
-	      u = tree_cons (pfn_field, pfn, NULL_TREE);
+	      delta = build2 (RSHIFT_EXPR, TREE_TYPE (delta),
+			      delta, integer_one_node);
+	      delta = fold_if_not_in_template (delta);
 	    }
+
+	  /* __delta2 is the same as __delta.  */
+	  u = tree_cons (delta2_field, delta, NULL_TREE);
 	}
-      else	/* Low bit of DELTA is set if we're virtual.  */
+      else if (TREE_CODE (pfn) == INTEGER_CST && TREE_INT_CST_LOW (pfn) == 0)
+	{
+	  /* NULL pfn.  Just zero out everything.  */
+	  ixval = 0;
+	  pfn = integer_zero_node;
+	  delta = integer_zero_node;
+	  u = tree_cons (pfn_field, pfn, NULL_TREE);
+	}
+      else
 	{
-	  /* Don't know how to do this yet. Much like the above, probably.  */
-	  abort ();
-	  allconstant = TREE_CONSTANT (delta);
-	  allinvariant = TREE_INVARIANT (delta);
-	  allsimple = !! initializer_constant_valid_p (delta,
-							TREE_TYPE (delta));
-	  
-	  u = tree_cons (delta2_field, delta2, NULL_TREE);
+	  ixval = -1;  /* -1 ==> PFN is the pointer  */
+	  u = tree_cons (pfn_field, pfn, NULL_TREE);
 	}
+      /* APPLE LOCAL end ARM kext */
 
       delta = convert_and_check (delta_type_node, delta);
       idx = convert_and_check (delta_type_node, ssize_int (ixval));

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/typeck2.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/typeck2.c Thu Nov  8 20:30:15 2007
@@ -756,6 +756,15 @@
 	  return error_mark_node;
 	}
 
+      /* APPLE LOCAL begin AltiVec */
+      if (code == VECTOR_TYPE
+          && TREE_CODE (init) == CONSTRUCTOR
+          && TREE_CODE (TREE_TYPE (init)) == VECTOR_TYPE
+          && vector_types_convertible_p (TREE_TYPE (init), type)
+          && TREE_CONSTANT (init))
+        return build_vector_from_ctor (type, CONSTRUCTOR_ELTS (init));
+      /* APPLE LOCAL end AltiVec */
+
       return convert_for_initialization (NULL_TREE, type, init,
 					 LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING,
 					 "initialization", NULL_TREE, 0);

Modified: llvm-gcc-4.2/trunk/gcc/cse.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cse.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cse.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cse.c Thu Nov  8 20:30:15 2007
@@ -4145,6 +4145,8 @@
 				  && rtx_equal_p (ent->comparison_const,
 						  const_arg1))
 			      || (REG_P (folded_arg1)
+				  /* APPLE LOCAL ARM 4587904 */
+				  && (REGNO_QTY_VALID_P (REGNO (folded_arg1)))
 				  && (REG_QTY (REGNO (folded_arg1)) == ent->comparison_qty))))
 			return (comparison_dominates_p (ent->comparison_code, code)
 				? true_rtx : false_rtx);

Modified: llvm-gcc-4.2/trunk/gcc/dbxout.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/dbxout.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/dbxout.c (original)
+++ llvm-gcc-4.2/trunk/gcc/dbxout.c Thu Nov  8 20:30:15 2007
@@ -1334,7 +1334,10 @@
      Delay it until we actually emit BINCL.  */
   n->file_number = 0;
   n->prev = NULL;
-  current_file->prev = n;
+  /* APPLE LOCAL begin bincl 4549901 */
+  if (current_file)
+    current_file->prev = n;
+  /* APPLE LOCAL end bincl 4549901 */
   n->bincl_status = BINCL_PENDING;
   n->pending_bincl_name = filename;
   pending_bincls = 1;
@@ -1362,6 +1365,10 @@
     }
   current_file->bincl_status = BINCL_NOT_REQUIRED;
   current_file = current_file->next;
+  /* APPLE LOCAL begin bincl 4549901 */
+  if (current_file == 0)
+    pending_bincls = 0;
+  /* APPLE LOCAL end bincl 4549901 */
 #endif
 }
 
@@ -4002,6 +4009,13 @@
 	    else
 	      number = 0;
 
+	    /* APPLE LOCAL begin ARM prefer SP to FP */
+	    /* I'm not sure why this wasn't here in the first place --
+	       we surely need it.  */
+	    number = DEBUGGER_ARG_OFFSET (number,
+					  XEXP (DECL_RTL (parms), 0));
+	    /* APPLE LOCAL end ARM prefer SP to FP */
+
 	    /* Make a big endian correction if the mode of the type of the
 	       parameter is not the same as the mode of the rtl.  */
 	    if (BYTES_BIG_ENDIAN

Modified: llvm-gcc-4.2/trunk/gcc/defaults.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/defaults.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/defaults.h (original)
+++ llvm-gcc-4.2/trunk/gcc/defaults.h Thu Nov  8 20:30:15 2007
@@ -874,6 +874,12 @@
 #define LEGITIMATE_PIC_OPERAND_P(X) 1
 #endif
 
+/* APPLE LOCAL begin ARM -mdynamic-no-pic support */
+#ifndef LEGITIMATE_INDIRECT_OPERAND_P
+#define LEGITIMATE_INDIRECT_OPERAND_P(X) (! flag_pic || LEGITIMATE_PIC_OPERAND_P(X))
+#endif
+/* APPLE LOCAL end ARM -mdynamic-no-pic support */
+
 #ifndef REVERSIBLE_CC_MODE
 #define REVERSIBLE_CC_MODE(MODE) 0
 #endif

Modified: llvm-gcc-4.2/trunk/gcc/doc/extend.texi
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/extend.texi?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/doc/extend.texi (original)
+++ llvm-gcc-4.2/trunk/gcc/doc/extend.texi Thu Nov  8 20:30:15 2007
@@ -62,6 +62,9 @@
 @c APPLE LOCAL end pascal strings
 * Variable Attributes::	Specifying attributes of variables.
 * Type Attributes::	Specifying attributes of types.
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+* Label Attributes::	Specifying attributes of labels and statements.
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 * Alignment::           Inquiring about the alignment of a type or variable.
 * Inline::              Defining inline functions (as fast as macros).
 * Extended Asm::        Assembler instructions with C expressions as operands.
@@ -1600,8 +1603,11 @@
 @code{gnu_inline} and @code{externally_visible}.  Several other
 attributes are defined for functions on particular target systems.  Other
 attributes, including @code{section} are supported for variables declarations
-(@pxref{Variable Attributes}) and for types (@pxref{Type Attributes}).
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+(@pxref{Variable Attributes}), for types (@pxref{Type Attributes}),
+and labels (@pxref{Label Attributes}).
 
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 You may also specify attributes with @samp{__} preceding and following
 each keyword.  This allows you to use them in header files without
 being concerned about a possible macro of the same name.  For example,
@@ -2697,10 +2703,14 @@
 
 @xref{Function Attributes}, for details of the semantics of attributes
 applying to functions.  @xref{Variable Attributes}, for details of the
-semantics of attributes applying to variables.  @xref{Type Attributes},
-for details of the semantics of attributes applying to structure, union
-and enumerated types.
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+semantics of attributes applying to variables.  @xref{Type
+Attributes}, for details of the semantics of attributes applying to
+structure, union and enumerated types.  @xref{Label Attributes}, for
+details of the semantics of attributes applying to labels and
+statements.
 
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 An @dfn{attribute specifier} is of the form
 @code{__attribute__ ((@var{attribute-list}))}.  An @dfn{attribute list}
 is a possibly empty comma-separated sequence of @dfn{attributes}, where
@@ -2737,19 +2747,18 @@
 An @dfn{attribute specifier list} is a sequence of one or more attribute
 specifiers, not separated by any other tokens.
 
-In GNU C, an attribute specifier list may appear after the colon following a
-label, other than a @code{case} or @code{default} label.  The only
-attribute it makes sense to use after a label is @code{unused}.  This
-feature is intended for code generated by programs which contains labels
-that may be unused but which is compiled with @option{-Wall}.  It would
-not normally be appropriate to use in it human-written code, though it
-could be useful in cases where the code that jumps to the label is
-contained within an @code{#ifdef} conditional.  GNU C++ does not permit
-such placement of attribute lists, as it is permissible for a
-declaration, which could begin with an attribute list, to be labelled in
-C++.  Declarations cannot be labelled in C90 or C99, so the ambiguity
-does not arise there.
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+In GNU C, an attribute specifier list may appear after the colon
+following a label, other than a @code{case} or @code{default} label.
+GNU C++ does not permit such placement of attribute lists, as it is
+permissible for a declaration, which could begin with an attribute
+list, to be labelled in C++.  Declarations cannot be labelled in C90
+or C99, so the ambiguity does not arise there.
 
+In GNU C an attribute specifier list may also appear after the keyword
+ at code{while} in a while loop, after @code{do} and after @code{for}.
+
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 An attribute specifier list may appear as part of a @code{struct},
 @code{union} or @code{enum} specifier.  It may go either immediately
 after the @code{struct}, @code{union} or @code{enum} keyword, or after
@@ -3109,10 +3118,12 @@
 attributes are currently defined generically for variables.
 Other attributes are defined for variables on particular target
 systems.  Other attributes are available for functions
-(@pxref{Function Attributes}) and for types (@pxref{Type Attributes}).
-Other front ends might define more attributes
-(@pxref{C++ Extensions,,Extensions to the C++ Language}).
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+(@pxref{Function Attributes}), types (@pxref{Type Attributes}) and 
+labels (@pxref{Label Attributes}).  Other front ends might define
+more attributes (@pxref{C++ Extensions,,Extensions to the C++ Language}).
 
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 You may also specify attributes with @samp{__} preceding and following
 each keyword.  This allows you to use them in header files without
 being concerned about a possible macro of the same name.  For example,
@@ -3634,9 +3645,11 @@
 types: @code{aligned}, @code{packed}, @code{transparent_union},
 @code{unused}, @code{deprecated}, @code{visibility}, and
 @code{may_alias}.  Other attributes are defined for functions
-(@pxref{Function Attributes}) and for variables (@pxref{Variable
-Attributes}).
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+(@pxref{Function Attributes}), variables (@pxref{Variable
+Attributes}), and labels (@pxref{Label Attributes}).
 
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 You may also specify any one of these attributes with @samp{__}
 preceding and following its keyword.  This allows you to use these
 attributes in header files without being concerned about a possible
@@ -3993,6 +4006,67 @@
 @code{__vector} keyword.
 
 
+ at c APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+ at node Label Attributes
+ at section Specifying Attributes of Labels and Statements
+ at cindex attribute of labels
+ at cindex label attributes
+ at cindex attribute of statements
+ at cindex statement attributes
+
+The keyword @code{__attribute__} allows you to specify special
+attributes of labels and statements.
+
+Some attributes are currently defined generically for variables.
+Other attributes are defined for variables on particular target
+systems.  Other attributes are available for functions
+(@pxref{Function Attributes}), types (@pxref{Type Attributes}) and
+variables (@pxref{Variable Attributes}).
+
+You may also specify attributes with @samp{__} preceding and following
+each keyword.  This allows you to use them in header files without
+being concerned about a possible macro of the same name.  For example,
+you may use @code{__aligned__} instead of @code{aligned}.
+
+ at xref{Attribute Syntax}, for details of the exact syntax for using
+attributes.
+
+ at table @code
+ at cindex @code{aligned} attribute
+ at item aligned (@var{alignment})
+This attribute specifies a minimum alignment for the label,
+measured in bytes.  For example, the declaration:
+
+ at smallexample
+  some_label: __attribute__((aligned(16)))
+ at end smallexample
+
+ at noindent
+requests the compiler to align the label, inserting @code{nop}s as necessary,
+to a 16-byte boundary.
+
+The alignment is only a request.  The compiler will usually be able to
+honour it but sometimes the label will be eliminated by the compiler,
+in which case its alignment will be eliminated too.
+
+When applied to loops, the @code{aligned} attribute causes the loop to
+be aligned.
+
+ at item unused
+When attached to a label this attribute means that the label might not
+be used.  GCC will not produce a warning for the label, even if the
+label doesn't seem to be referenced.  This feature is intended for
+code generated by programs which contains labels that may be unused
+but which is compiled with @option{-Wall}.  It would not normally be
+appropriate to use in it human-written code, though it could be useful
+in cases where the code that jumps to the label is contained within an
+ at code{#ifdef} conditional.
+
+This attribute can only be applied to labels, not statements, because
+there is no warning if a statement is removed.
+ at end table
+
+ at c APPLE LOCAL end for-fsf-4_4 3274130 5295549
 @node Inline
 @section An Inline Function is As Fast As a Macro
 @cindex inline functions
@@ -4881,9 +4955,8 @@
 used to put several instructions on one line in CW-style, and
 @code{asm} in either style.)  You write labels with either a preceding
 @code{'@@'} or a trailing @code{':'} (or both, if you prefer); labels
-are always local to the asm block, and there is no way for a label in
-one block to refer to a label in another block.  Comments and lexical
-rules are as for standard C/C++.
+are always local to the asm blocks of the function.  Comments and
+lexical rules are as for standard C/C++.
 
 @verbatim
 int foo (int arg) {
@@ -11535,9 +11608,11 @@
 
 The G++ minimum and maximum operators (@samp{<?} and @samp{>?}) and
 their compound forms (@samp{<?=}) and @samp{>?=}) have been deprecated
-and will be removed in a future version.  Code using these operators
-should be modified to use @code{std::min} and @code{std::max} instead.
+ at c APPLE LOCAL begin for-fsf-4_4 5482863
+and are now removed from G++.  Code using these operators should be
+modified to use @code{std::min} and @code{std::max} instead.
 
+ at c APPLE LOCAL end for-fsf-4_4 5482863
 The named return value extension has been deprecated, and is now
 removed from G++.
 

Modified: llvm-gcc-4.2/trunk/gcc/doc/invoke.texi
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/invoke.texi?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/doc/invoke.texi (original)
+++ llvm-gcc-4.2/trunk/gcc/doc/invoke.texi Thu Nov  8 20:30:15 2007
@@ -47,8 +47,7 @@
 
 @c APPLE LOCAL begin manual
 In Apple's version of GCC, both @samp{cc} and @samp{gcc} are actually
-symbolic links to a compiler named like gcc- at var{version}; which compiler
-is linked to may be changed using the command @samp{gcc_select}.
+symbolic links to a compiler named like gcc- at var{version}.
 Similarly, @samp{c++} and @samp{g++} are links to a compiler named like
 g++- at var{version}.
 
@@ -206,8 +205,6 @@
 @c APPLE LOCAL pch distcc --mrs
 -fpch-preprocess (APPLE ONLY) @gol
 -fsigned-bitfields  -fsigned-char @gol
- at c APPLE LOCAL pascal strings
--fpascal-strings (APPLE ONLY) @gol
 @c APPLE LOCAL -Wno-#warnings
 -Wno-#warnings (APPLE ONLY) @gol
 @c APPLE LOCAL -Wextra-tokens 2001-08-02 --sts **
@@ -329,11 +326,6 @@
 -fdump-tree-ssa at r{[}- at var{n}@r{]} -fdump-tree-pre at r{[}- at var{n}@r{]} @gol
 -fdump-tree-ccp at r{[}- at var{n}@r{]} -fdump-tree-dce at r{[}- at var{n}@r{]} @gol
 -fdump-tree-gimple at r{[}-raw at r{]} -fdump-tree-mudflap at r{[}- at var{n}@r{]} @gol
- at c APPLE LOCAL begin lno
--fdump-tree-scev @r{[}- at var{n}@r{]} @gol
--fdump-tree-ddall @r{[}- at var{n}@r{]}@gol
--fdump-tree-elck @r{[}- at var{n}@r{]} @gol
- at c APPLE LOCAL end lno
 -fdump-tree-dom at r{[}- at var{n}@r{]} @gol
 -fdump-tree-dse at r{[}- at var{n}@r{]} @gol
 -fdump-tree-phiopt at r{[}- at var{n}@r{]} @gol
@@ -344,10 +336,6 @@
 -fdump-tree-sra at r{[}- at var{n}@r{]} @gol
 -fdump-tree-salias @gol
 -fdump-tree-fre at r{[}- at var{n}@r{]} @gol
- at c APPLE LOCAL begin lno
--fdump-tree-loop at r{[}- at var{n}@r{]} @gol
--fdump-tree-vect at r{[}- at var{n}@r{]} @gol
- at c APPLE LOCAL end lno
 -fdump-tree-vrp at r{[}- at var{n}@r{]} @gol
 -ftree-vectorizer-verbose=@var{n} @gol
 -fdump-tree-storeccp at r{[}- at var{n}@r{]} @gol
@@ -420,8 +408,6 @@
 @c APPLE LOCAL add fuse-profile
 -ftree-vect-loop-version -ftree-salias -fuse-profile -fipa-pta -fweb @gol
 -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
- at c APPLE LOCAL lno
--fscalar-evolutions -fall-data-deps @gol
 --param @var{name}=@var{value}
 @c LLVM LOCAL -fast, -Oz,
 -O  -O0  -O1  -O2  -O3 -O4 (APPLE ONLY) -Os -Oz (APPLE ONLY) -fast (APPLE ONLY)}
@@ -476,6 +462,8 @@
 @gccoptlist{-EB  -EL @gol
 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
+ at c APPLE LOCAL ARM prune man page
+ at end ignore
 
 @emph{ARM Options}
 @gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
@@ -501,6 +489,8 @@
 -mcaller-super-interworking  -mcallee-super-interworking @gol
 -mtp=@var{name}}
 
+ at c APPLE LOCAL ARM prune man page
+ at ignore
 @emph{AVR Options}
 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
 -mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
@@ -552,6 +542,8 @@
 -twolevel_namespace  -umbrella  -undefined @gol
 -unexported_symbols_list  -weak_reference_mismatches @gol
 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
+ at c APPLE LOCAL pascal strings
+-mpascal-strings (APPLE ONLY) @gol
 -mkernel -mone-byte-bool}
 
 @c APPLE LOCAL prune man page
@@ -1629,18 +1621,6 @@
 (default behavior)
 @c APPLE LOCAL end radar 3506309
 
- at c APPLE LOCAL begin pascal strings
- at item -fpascal-strings
-Allow Pascal-style string literals to be constructed.  This option
-implies @option{-Wpointer-sign} so that conversions between
-Pascal-style strings and C-style strings are warned about.  (APPLE
-ONLY)
-
- at xref{Pascal Strings,,Constructing String Literals with a Pascal-style
-Length Byte}, for more information on the syntax and semantics of Pascal
-string literals.
- at c APPLE LOCAL end pascal strings
-
 @c APPLE LOCAL begin fwritable strings. 
 @item -fwritable-strings
 @opindex fwritable-strings
@@ -2509,6 +2489,13 @@
 a property of pointer to object type. Property is then assumed to be
 ``assign'' by default.
 @c APPLE LOCAL end radar 5172645
+
+ at c APPLE LOCAL begin radar 5376125
+ at item -Wdirect-ivar-access
+ at opindex Wdirect-ivar-access
+Warn if ivar of pointer to object type is directly accessed in non-gc
+mode, instead of using property syntax access.
+ at c APPLE LOCAL end radar 5376125
  
 @item -Wstrict-selector-match
 @opindex Wstrict-selector-match
@@ -4710,24 +4697,6 @@
 Dump each function after adding mudflap instrumentation.  The file name is
 made by appending @file{.mudflap} to the source file name.
 
- at c APPLE LOCAL begin lno
- at item scev
- at opindex fdump-tree-scev
-Dump the information gathered by the scalar evolution analyzer.
-The file name is made by appending @file{.scev} to the source file name.
-
- at item ddall
- at opindex fdump-tree-ddall
-Dump all the data dependence relations.
-The file name is made by appending @file{.ddall} to the source file name.
-
- at item elck
- at opindex fdump-tree-elck
-Dump each function after performing checks elimination based on scalar
-evolution informations.  The file name is made by appending
- at file{.elck} to the source file name.
- at c APPLE LOCAL end lno
-
 @item sra
 @opindex fdump-tree-sra
 Dump each function after performing scalar replacement of aggregates.  The
@@ -4769,13 +4738,6 @@
 generic trees.  The file name is made by appending @file{.nrv} to the source
 file name.
 
- at c APPLE LOCAL begin lno
- at item loop
- at opindex fdump-tree-loop
-Dump each function after applying tree-level loop optimizations.  The file
-name is made by appending @file{.loop} to the source file name.
- at c APPLE LOCAL end lno
-
 @item vect
 @opindex fdump-tree-vect
 Dump each function after applying vectorization of loops.  The file name is
@@ -5784,12 +5746,6 @@
 @c APPLE LOCAL 4231761 -Oz
 for @option{-Os} or @option{-Oz} (APPLE ONLY), since it usually increases code size.
 
- at c APPLE LOCAL begin lno
- at item -ftree-elim-checks 
-Perform elimination of checks based on scalar evolution informations.
-This flag is disabled by default.  
- at c APPLE LOCAL end lno
-
 @item -ftree-loop-optimize
 Perform loop optimizations on trees.  This flag is enabled by default
 at @option{-O} and higher.
@@ -8052,7 +8008,11 @@
 @c APPLE LOCAL prune man page
 @ignore
 * ARC Options::
+ at c APPLE LOCAL ARM prune man page
+ at end ignore
 * ARM Options::
+ at c APPLE LOCAL ARM prune man page
+ at ignore
 * AVR Options::
 * Blackfin Options::
 * CRIS Options::
@@ -8151,6 +8111,8 @@
 @xref{Variable Attributes}.
 
 @end table
+ at c APPLE LOCAL ARM prune man page
+ at end ignore
 
 @node ARM Options
 @subsection ARM Options
@@ -8472,6 +8434,8 @@
 
 @end table
 
+ at c APPLE LOCAL ARM prune man page
+ at ignore
 @node AVR Options
 @subsection AVR Options
 @cindex AVR Options
@@ -8928,14 +8892,21 @@
 this flag.  @option{-findirect-virtual-calls} and
 @option{-fterminated-vtables} are accepted for backwards compatibility
 but will be removed in the future.
-On Intel x86-based Apple platforms, the kernel and its extensions run
-with a four-byte aligned stack
-(@option{-mpreferred-stack-boundary=2}); function prologues inside
-kernel extentions won't keep the usual 16-byte alignment required
-everywhere else in OS X.
 (APPLE ONLY)
 @c APPLE LOCAL end KEXT
 
+ at c APPLE LOCAL begin pascal strings
+ at item -mpascal-strings
+Allow Pascal-style string literals to be constructed.  This option
+implies @option{-Wpointer-sign} so that conversions between
+Pascal-style strings and C-style strings are warned about.  (APPLE
+ONLY)
+
+ at xref{Pascal Strings,,Constructing String Literals with a Pascal-style
+Length Byte}, for more information on the syntax and semantics of Pascal
+string literals.
+ at c APPLE LOCAL end pascal strings
+
 @item -all_load
 @opindex all_load
 Loads all members of static archive libraries.

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/dwarf2out.c (original)
+++ llvm-gcc-4.2/trunk/gcc/dwarf2out.c Thu Nov  8 20:30:15 2007
@@ -2196,6 +2196,9 @@
      specialization doesn't.  */
   if (TARGET_USES_WEAK_UNWIND_INFO
       && ! flag_asynchronous_unwind_tables
+/* APPLE LOCAL begin for-fsf-4_4 5480287 */ \
+      && flag_exceptions
+/* APPLE LOCAL end for-fsf-4_4 5480287 */ \
       && for_eh)
     for (i = 0; i < fde_table_in_use; i++)
       if ((fde_table[i].nothrow || fde_table[i].all_throwers_are_sibcalls)
@@ -8643,6 +8646,14 @@
   if (sub_die != NULL)
     add_AT_die_ref (mod_type_die, DW_AT_type, sub_die);
 
+  /* APPLE LOCAL begin radar 5359827 add named pointer types to
+     pubtype table  */
+  if (mod_type_die
+      && mod_type_die->die_tag  == DW_TAG_pointer_type 
+      && get_AT (mod_type_die, DW_AT_name))
+    add_pubtype (type, mod_type_die);
+  /* APPLE LOCAL end radar 5359827 add named pointer types to pubtype table  */
+
   return mod_type_die;
 }
 

Modified: llvm-gcc-4.2/trunk/gcc/emit-rtl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/emit-rtl.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/emit-rtl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/emit-rtl.c Thu Nov  8 20:30:15 2007
@@ -2062,7 +2062,9 @@
 gen_label_rtx (void)
 {
   return gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
-			     NULL, label_num++, NULL);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+			     NULL, label_num++, NULL, 0);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 }
 
 /* For procedure integration.  */

Modified: llvm-gcc-4.2/trunk/gcc/except.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/except.c (original)
+++ llvm-gcc-4.2/trunk/gcc/except.c Thu Nov  8 20:30:15 2007
@@ -280,7 +280,10 @@
 static bool sjlj_find_directly_reachable_regions (struct sjlj_lp_info *);
 static void sjlj_assign_call_site_values (rtx, struct sjlj_lp_info *);
 static void sjlj_mark_call_sites (struct sjlj_lp_info *);
-static void sjlj_emit_function_enter (rtx);
+/* APPLE LOCAL begin ARM 5051776 */
+static rtx  sjlj_generate_setjmp_sequence (rtx, bool);
+static void sjlj_emit_function_setjmps (rtx);
+/* APPLE LOCAL end ARM 5051776 */
 static void sjlj_emit_function_exit (void);
 static void sjlj_emit_dispatch_table (rtx, struct sjlj_lp_info *);
 static void sjlj_build_landing_pads (void);
@@ -1903,16 +1906,21 @@
 
 /* Construct the SjLj_Function_Context.  */
 
-static void
-sjlj_emit_function_enter (rtx dispatch_label)
+/* APPLE LOCAL begin ARM 5051776 */
+static rtx
+sjlj_generate_setjmp_sequence (rtx dispatch_label, bool unregister_first)
 {
-  rtx fn_begin, fc, mem, seq;
-  bool fn_begin_outside_block;
+  rtx fc, mem, seq;
 
   fc = cfun->eh->sjlj_fc;
 
   start_sequence ();
 
+  /* We're reusing the old context, unregister it.  */
+  if (unregister_first == true)
+    emit_library_call (unwind_sjlj_unregister_libfunc, LCT_NORMAL, VOIDmode,
+		       1, XEXP (fc, 0), Pmode);
+
   /* We're storing this libcall's address into memory instead of
      calling it directly.  Thus, we must call assemble_external_libcall
      here, as we can not depend on emit_library_call to do it for us.  */
@@ -1958,6 +1966,20 @@
 
   seq = get_insns ();
   end_sequence ();
+  return seq;
+}
+
+/* Insert SjLj_Function_Context at the start of the current function,
+   and following any calls to alloca().  */
+
+static void
+sjlj_emit_function_setjmps (rtx dispatch_label)
+{
+  rtx seq, fn_begin;
+  bool fn_begin_outside_block;
+
+  /* Create a new context for this function.  */
+  seq = sjlj_generate_setjmp_sequence (dispatch_label, false);
 
   /* ??? Instead of doing this at the beginning of the function,
      do this in a block that is at loop level 0 and dominates all
@@ -1977,6 +1999,22 @@
     insert_insn_on_edge (seq, single_succ_edge (ENTRY_BLOCK_PTR));
   else
     emit_insn_after (seq, fn_begin);
+
+  /* Any time we call alloca(), we need to re-calculate our stack context.
+     Ideally, we would only update a minimal context (i.e., stack pointer),
+     but that is a riskier solution to an uncommon problem.  Someday...  */
+  if (current_function_calls_alloca)
+    {
+      for (fn_begin = get_insns ();
+	   fn_begin;
+	   fn_begin = NEXT_INSN (fn_begin))
+	if (NOTE_P (fn_begin)
+	    && NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_ALLOCA)
+	  {
+	    seq = sjlj_generate_setjmp_sequence (dispatch_label, true);
+	    emit_insn_after (seq, fn_begin);
+	  }
+    }
 }
 
 /* Call back from expand_function_end to know where we should put
@@ -2033,6 +2071,7 @@
       insert_insn_on_edge (seq, e);
     }
 }
+/* APPLE LOCAL end ARM 5051776 */
 
 static void
 sjlj_emit_dispatch_table (rtx dispatch_label, struct sjlj_lp_info *lp_info)
@@ -2125,7 +2164,8 @@
       sjlj_assign_call_site_values (dispatch_label, lp_info);
       sjlj_mark_call_sites (lp_info);
 
-      sjlj_emit_function_enter (dispatch_label);
+      /* APPLE LOCAL ARM 5051776 */
+      sjlj_emit_function_setjmps (dispatch_label);
       sjlj_emit_dispatch_table (dispatch_label, lp_info);
       sjlj_emit_function_exit ();
     }

Modified: llvm-gcc-4.2/trunk/gcc/explow.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/explow.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/explow.c (original)
+++ llvm-gcc-4.2/trunk/gcc/explow.c Thu Nov  8 20:30:15 2007
@@ -1140,10 +1140,30 @@
 #endif
 
   if (MUST_ALIGN)
+  /* APPLE LOCAL begin radar 5155743, mainline candidate */
+  {  
+    /* Reserve space for the outgoing args and register saved area
+       whose information is available from STACK_DYNAMIC_OFFEST of
+       the current function. 
+       The stack pointer is saved on the stack before being changed
+       for alloca. If setjmp is called before alloca, the old stack
+       pointer will be used when longjmp returns.
+    */
+#if defined (STACK_DYNAMIC_OFFSET)
+    if (current_function_calls_setjmp
+        && targetm.have_dynamic_stack_space)
+      size = gen_rtx_PLUS (GET_MODE (size), size,
+        gen_rtx_CONST_INT (GET_MODE (size),
+        abs (STACK_DYNAMIC_OFFSET (current_function_decl))));
+#endif
+    /* APPLE LOCAL end radar 5155743, mainline candidate */
     size
       = force_operand (plus_constant (size,
 				      BIGGEST_ALIGNMENT / BITS_PER_UNIT - 1),
 		       NULL_RTX);
+  /* APPLE LOCAL begin radar 5155743, mainline candidate */
+  }
+  /* APPLE LOCAL end radar 5155743, mainline candidate */
 
 #ifdef SETJMP_VIA_SAVE_AREA
   /* If setjmp restores regs from a save area in the stack frame,

Modified: llvm-gcc-4.2/trunk/gcc/expr.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/expr.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/expr.c (original)
+++ llvm-gcc-4.2/trunk/gcc/expr.c Thu Nov  8 20:30:15 2007
@@ -4596,7 +4596,8 @@
       HOST_WIDE_INT mult;
 
       mult = 1;
-      if (TREE_CODE (purpose) == RANGE_EXPR)
+      /* APPLE LOCAL Altivec initializers 4869813 */
+      if (purpose && TREE_CODE (purpose) == RANGE_EXPR)
 	{
 	  tree lo_index = TREE_OPERAND (purpose, 0);
 	  tree hi_index = TREE_OPERAND (purpose, 1);

Modified: llvm-gcc-4.2/trunk/gcc/final.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/final.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/final.c (original)
+++ llvm-gcc-4.2/trunk/gcc/final.c Thu Nov  8 20:30:15 2007
@@ -352,16 +352,13 @@
    for each insn we'll call the alignment chain of this insn in the following
    comments.  */
 
-struct label_alignment
-{
-  short alignment;
-  short max_skip;
-};
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 static rtx *uid_align;
 static int *uid_shuid;
-static struct label_alignment *label_align;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 /* Indicate that branch shortening hasn't yet been done.  */
 
 void
@@ -564,20 +561,16 @@
 
 #define INSN_SHUID(INSN) (uid_shuid[INSN_UID (INSN)])
 
-static int min_labelno, max_labelno;
-
-#define LABEL_TO_ALIGNMENT(LABEL) \
-  (label_align[CODE_LABEL_NUMBER (LABEL) - min_labelno].alignment)
-
-#define LABEL_TO_MAX_SKIP(LABEL) \
-  (label_align[CODE_LABEL_NUMBER (LABEL) - min_labelno].max_skip)
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 /* For the benefit of port specific code do this also as a function.  */
 
 int
 label_to_alignment (rtx label)
 {
-  return LABEL_TO_ALIGNMENT (label);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  return LABEL_ALIGN_LOG (label);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 }
 
 #ifdef HAVE_ATTR_length
@@ -626,7 +619,9 @@
       align_addr = INSN_ADDRESSES (uid) - insn_lengths[uid];
       if (uid_shuid[uid] > end_shuid)
 	break;
-      known_align_log = LABEL_TO_ALIGNMENT (align_label);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      known_align_log = LABEL_ALIGN_LOG (align_label);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       new_align = 1 << known_align_log;
       if (new_align < known_align)
 	continue;
@@ -691,19 +686,12 @@
 static unsigned int
 compute_alignments (void)
 {
-  int log, max_skip, max_log;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   basic_block bb;
 
-  if (label_align)
-    {
-      free (label_align);
-      label_align = 0;
-    }
-
-  max_labelno = max_label_num ();
-  min_labelno = get_first_label_num ();
-  label_align = XCNEWVEC (struct label_alignment, max_labelno - min_labelno + 1);
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   /* If not optimizing or optimizing for size, don't assign any alignments.  */
   if (! optimize || optimize_size)
     return 0;
@@ -714,10 +702,19 @@
       int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
       edge e;
       edge_iterator ei;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      int log, max_skip, max_log;
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       if (!LABEL_P (label)
 	  || probably_never_executed_bb_p (bb))
 	continue;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      /* If user has specified an alignment, honour it.  */
+      if (LABEL_ALIGN_LOG (label) > 0)
+	continue;
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       max_log = LABEL_ALIGN (label);
       max_skip = LABEL_ALIGN_MAX_SKIP;
 
@@ -766,8 +763,9 @@
 	      max_skip = LOOP_ALIGN_MAX_SKIP;
 	    }
 	}
-      LABEL_TO_ALIGNMENT (label) = max_log;
-      LABEL_TO_MAX_SKIP (label) = max_skip;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      SET_LABEL_ALIGN (label, max_log, max_skip);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
     }
   return 0;
 }
@@ -820,7 +818,9 @@
 
 #endif
 
-  /* Compute maximum UID and allocate label_align / uid_shuid.  */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* Compute maximum UID and allocate uid_shuid.  */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   max_uid = get_max_uid ();
 
   /* Free uid_shuid before reallocating it.  */
@@ -828,29 +828,8 @@
 
   uid_shuid = XNEWVEC (int, max_uid);
 
-  if (max_labelno != max_label_num ())
-    {
-      int old = max_labelno;
-      int n_labels;
-      int n_old_labels;
-
-      max_labelno = max_label_num ();
-
-      n_labels = max_labelno - min_labelno + 1;
-      n_old_labels = old - min_labelno + 1;
-
-      label_align = xrealloc (label_align,
-			      n_labels * sizeof (struct label_alignment));
-
-      /* Range of labels grows monotonically in the function.  Failing here
-         means that the initialization of array got lost.  */
-      gcc_assert (n_old_labels <= n_labels);
-
-      memset (label_align + n_old_labels, 0,
-	      (n_labels - n_old_labels) * sizeof (struct label_alignment));
-    }
-
-  /* Initialize label_align and set up uid_shuid to be strictly
+  /* APPLE LOCAL for-fsf-4_4 3274130 5295549 */ \
+  /* Initialize set up uid_shuid to be strictly
      monotonically rising with insn order.  */
   /* We use max_log here to keep track of the maximum alignment we want to
      impose on the next CODE_LABEL (or the current one if we are processing
@@ -872,11 +851,15 @@
 	  rtx next;
 
 	  /* Merge in alignments computed by compute_alignments.  */
-	  log = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  log = LABEL_ALIGN_LOG (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	  if (max_log < log)
 	    {
 	      max_log = log;
-	      max_skip = LABEL_TO_MAX_SKIP (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	      max_skip = LABEL_MAX_SKIP (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	    }
 
 	  log = LABEL_ALIGN (insn);
@@ -904,8 +887,9 @@
 		      }
 		  }
 	      }
-	  LABEL_TO_ALIGNMENT (insn) = max_log;
-	  LABEL_TO_MAX_SKIP (insn) = max_skip;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  SET_LABEL_ALIGN (insn, max_log, max_skip);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	  max_log = 0;
 	  max_skip = 0;
 	}
@@ -952,7 +936,9 @@
     {
       int uid = INSN_UID (seq);
       int log;
-      log = (LABEL_P (seq) ? LABEL_TO_ALIGNMENT (seq) : 0);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      log = (LABEL_P (seq) ? LABEL_ALIGN_LOG (seq) : 0);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       uid_align[uid] = align_tab[0];
       if (log)
 	{
@@ -1000,8 +986,10 @@
 		  max = shuid;
 		  max_lab = lab;
 		}
-	      if (min_align > LABEL_TO_ALIGNMENT (lab))
-		min_align = LABEL_TO_ALIGNMENT (lab);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	      if (min_align > LABEL_ALIGN_LOG (lab))
+		min_align = LABEL_ALIGN_LOG (lab);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	    }
 	  XEXP (pat, 2) = gen_rtx_LABEL_REF (Pmode, min_lab);
 	  XEXP (pat, 3) = gen_rtx_LABEL_REF (Pmode, max_lab);
@@ -1030,7 +1018,9 @@
 
       if (LABEL_P (insn))
 	{
-	  int log = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  int log = LABEL_ALIGN_LOG (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	  if (log)
 	    {
 	      int align = 1 << log;
@@ -1136,7 +1126,9 @@
 
 	  if (LABEL_P (insn))
 	    {
-	      int log = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	      int log = LABEL_ALIGN_LOG (insn);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	      if (log > insn_current_align)
 		{
 		  int align = 1 << log;
@@ -1185,7 +1177,9 @@
 		   prev = PREV_INSN (prev))
 		if (varying_length[INSN_UID (prev)] & 2)
 		  {
-		    rel_align = LABEL_TO_ALIGNMENT (prev);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+		    rel_align = LABEL_ALIGN_LOG (prev);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 		    break;
 		  }
 
@@ -1717,6 +1711,8 @@
 	case NOTE_INSN_FUNCTION_END:
 	case NOTE_INSN_REPEATED_LINE_NUMBER:
 	case NOTE_INSN_EXPECTED_VALUE:
+	/* APPLE LOCAL ARM 5051776 */
+	case NOTE_INSN_ALLOCA:
 	  break;
 
 	case NOTE_INSN_SWITCH_TEXT_SECTIONS:
@@ -1862,26 +1858,27 @@
     case CODE_LABEL:
       /* The target port might emit labels in the output function for
 	 some insn, e.g. sh.c output_branchy_insn.  */
-      if (CODE_LABEL_NUMBER (insn) <= max_labelno)
-	{
-	  int align = LABEL_TO_ALIGNMENT (insn);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      {
+	int align = LABEL_ALIGN_LOG (insn);
 #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
-	  int max_skip = LABEL_TO_MAX_SKIP (insn);
+	int max_skip = LABEL_MAX_SKIP (insn);
 #endif
-
-	  if (align && NEXT_INSN (insn))
-	    {
+	
+	if (align && NEXT_INSN (insn))
+	  {
 #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
-	      ASM_OUTPUT_MAX_SKIP_ALIGN (file, align, max_skip);
+	    ASM_OUTPUT_MAX_SKIP_ALIGN (file, align, max_skip);
 #else
 #ifdef ASM_OUTPUT_ALIGN_WITH_NOP
-              ASM_OUTPUT_ALIGN_WITH_NOP (file, align);
+	    ASM_OUTPUT_ALIGN_WITH_NOP (file, align);
 #else
-	      ASM_OUTPUT_ALIGN (file, align);
+	    ASM_OUTPUT_ALIGN (file, align);
 #endif
 #endif
-	    }
-	}
+	  }
+      }
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 #ifdef HAVE_cc0
       CC_STATUS_INIT;
       /* If this label is reached from only one place, set the condition

Modified: llvm-gcc-4.2/trunk/gcc/function.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/function.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/function.h (original)
+++ llvm-gcc-4.2/trunk/gcc/function.h Thu Nov  8 20:30:15 2007
@@ -460,6 +460,11 @@
   unsigned int uses_vector : 1;
   /* APPLE LOCAL end 3837835  */
 
+  /* APPLE LOCAL begin ARM reliable backtraces */
+  unsigned int calls_builtin_ret_addr : 1;
+  unsigned int calls_builtin_frame_addr : 1;
+  /* APPLE LOCAL end ARM reliable backtraces */
+
   unsigned int after_inlining : 1;
 
   /* Set when the call to function itself has been emit.  */
@@ -525,6 +530,10 @@
 #define current_function_epilogue_delay_list (cfun->epilogue_delay_list)
 #define current_function_has_nonlocal_label (cfun->has_nonlocal_label)
 #define current_function_has_nonlocal_goto (cfun->has_nonlocal_goto)
+/* APPLE LOCAL begin ARM reliable backtraces */
+#define current_function_calls_builtin_ret_addr (cfun->calls_builtin_ret_addr)
+#define current_function_calls_builtin_frame_addr (cfun->calls_builtin_frame_addr)
+/* APPLE LOCAL end ARM reliable backtraces */
 
 #define return_label (cfun->x_return_label)
 #define naked_return_label (cfun->x_naked_return_label)

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gcc.c (original)
+++ llvm-gcc-4.2/trunk/gcc/gcc.c Thu Nov  8 20:30:15 2007
@@ -6716,11 +6716,23 @@
 			concat (gcc_exec_prefix, machine_suffix,
 				standard_startfile_prefix, NULL),
 			NULL, PREFIX_PRIORITY_LAST, 0, 1);
-	  add_prefix (&startfile_prefixes,
-		      concat (standard_exec_prefix,
-			      machine_suffix,
-			      standard_startfile_prefix, NULL),
-		      NULL, PREFIX_PRIORITY_LAST, 0, 1);
+
+	  /* APPLE LOCAL begin ARM sysroot startfile_prefixes */
+	  /* All absolute startfile_prefixes must be sysrooted so we
+	     don't pick up host headers.  */
+	  if (IS_ABSOLUTE_PATH (standard_exec_prefix))
+	    add_sysrooted_prefix (&startfile_prefixes,
+				  concat (standard_exec_prefix,
+					  machine_suffix,
+					  standard_startfile_prefix, NULL),
+				  NULL, PREFIX_PRIORITY_LAST, 0, 1);
+	  else
+	    add_prefix (&startfile_prefixes,
+			concat (standard_exec_prefix,
+				machine_suffix,
+				standard_startfile_prefix, NULL),
+			NULL, PREFIX_PRIORITY_LAST, 0, 1);
+	  /* APPLE LOCAL end ARM sysroot startfile_prefixes */
 	}
 
       if (*standard_startfile_prefix_1)
@@ -8291,7 +8303,33 @@
   if (! result)
     return NULL;
 
-  return argv[nargs + 2];
+  /* APPLE LOCAL begin version-compare quoting 5378841 */
+  {
+    /* Escape all spec special characters.  */
+    const char *p = argv[nargs + 2];
+    char *q, *b;
+    while (*p)
+      {
+	if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '%' || *p == '\\')
+	  break;
+	++p;
+      }
+
+    if (*p == 0)
+      return argv[nargs + 2];
+
+    q = b = xmalloc (strlen (p)*2 + 1);
+    p = argv[nargs + 2];
+    while (*p)
+      {
+	if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '%' || *p == '\\')
+	  *q++ = '\\';
+	*q++ = *p++;
+      }
+    *q = *p;
+    return b;
+  }
+  /* APPLE LOCAL end version-compare quoting 5378841 */
 }
 
 /* %:include builtin spec function.  This differs from %include in that it

Modified: llvm-gcc-4.2/trunk/gcc/gcse.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcse.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gcse.c (original)
+++ llvm-gcc-4.2/trunk/gcc/gcse.c Thu Nov  8 20:30:15 2007
@@ -724,17 +724,6 @@
       changed = one_cprop_pass (pass + 1, false, false);
       timevar_pop (TV_CPROP1);
 
-      /* APPLE LOCAL begin div by const */
-      /* div by const optimization can introduce new instructions.
-	 All this stuff needs to be recomputed. */
-      free_gcse_mem ();
-      max_gcse_regno = max_reg_num ();
-      alloc_gcse_mem ();
-      free_reg_set_mem ();
-      alloc_reg_set_mem (max_reg_num ());
-      compute_sets ();
-      /* APPLE LOCAL end div by const */
-
       if (optimize_size)
 	/* Do nothing.  */ ;
       else
@@ -2981,64 +2970,6 @@
 	      if (INSN_DELETED_P (insn))
 		return 1;
 	    }
-	  /* APPLE LOCAL begin div by const */
-	  /* Look for int div by constant and expand if found. */
-	  if ( GET_CODE (insn) == INSN
-	       && GET_CODE (PATTERN (insn)) == SET
-	       && ( GET_CODE (XEXP (PATTERN (insn), 1)) == DIV 
-		    || GET_CODE (XEXP (PATTERN (insn), 1)) == UDIV)
-	       && GET_MODE (XEXP (PATTERN (insn), 1)) == SImode
-	       && GET_CODE (XEXP (XEXP (PATTERN (insn), 1), 1)) == CONST_INT )
-	    {
-	      rtx seq, result, target;
-	      target = XEXP (PATTERN (insn), 0);
-	      start_sequence ();
-	      result = expand_divmod (0, TRUNC_DIV_EXPR, SImode,
-		    XEXP (XEXP (PATTERN (insn), 1), 0),
-		    XEXP (XEXP (PATTERN (insn), 1), 1),
-		    target,
-		    GET_CODE (XEXP (PATTERN (insn), 1))==DIV ? 0 : 1);
-	      if ( result != target )
-		emit_move_insn (target, result);
-	      seq = get_insns ();
-	      end_sequence ();
-	      emit_insn_after (seq, insn);
-	      PUT_CODE (insn, NOTE);
-	      NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-	      NOTE_SOURCE_FILE (insn) = 0;
-	      update_bb_for_insn (BLOCK_FOR_INSN (insn));
-	      changed = 1;
-	      break;
-	    }
-	  else if ( GET_CODE (insn) == INSN
-		   && GET_CODE (PATTERN (insn)) == SET
-		   && (note = find_reg_equal_equiv_note (insn))
-		   && (GET_CODE (XEXP (note, 0)) == DIV
-		       || GET_CODE (XEXP (note, 0)) == UDIV)
-		   && GET_MODE (XEXP (note, 0)) == SImode
-		   && GET_CODE (XEXP (XEXP (note, 0), 1)) == CONST_INT )
-	    {
-	      rtx seq, result, target;
-	      target = XEXP (PATTERN (insn), 0);
-	      start_sequence ();
-	      result = expand_divmod (0, TRUNC_DIV_EXPR, SImode,
-		    XEXP (XEXP (note, 0), 0),
-		    XEXP (XEXP (note, 0), 1),
-		    target,
-		    GET_CODE (XEXP (note, 0))==DIV ? 0 : 1);
-	      if ( result != target )
-		emit_move_insn (target, result);
-	      seq = get_insns ();
-	      end_sequence ();
-	      emit_insn_after (seq, insn);
-	      PUT_CODE (insn, NOTE);
-	      NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
-	      NOTE_SOURCE_FILE (insn) = 0;
-	      update_bb_for_insn (BLOCK_FOR_INSN (insn));
-	      changed = 1;
-	      break;
-	    }
-	  /* APPLE LOCAL end div by const */
 	}
       else if (REG_P (src)
 	       && REGNO (src) >= FIRST_PSEUDO_REGISTER

Modified: llvm-gcc-4.2/trunk/gcc/gimplify.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gimplify.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gimplify.c (original)
+++ llvm-gcc-4.2/trunk/gcc/gimplify.c Thu Nov  8 20:30:15 2007
@@ -5621,16 +5621,6 @@
 	case MISALIGNED_INDIRECT_REF:
 	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
 			       is_gimple_reg, fb_rvalue);
-
-	  /* APPLE LOCAL begin Radar 4124724 */
-	  /* Useless type conversions may have been discarded, so ensure
-	     that the INDIRECT_REF has a type corresponding to the pointee
-	     type of its operand.  */
-	  if (TREE_CODE (*expr_p) == INDIRECT_REF)
-	    TREE_TYPE (*expr_p)
-	      = TREE_TYPE (TREE_TYPE (TREE_OPERAND (*expr_p, 0)));
-	  /* APPLE LOCAL end Radar 4124724 */
-
 	  recalculate_side_effects (*expr_p);
 	  break;
 

Modified: llvm-gcc-4.2/trunk/gcc/ginclude/float.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ginclude/float.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ginclude/float.h (original)
+++ llvm-gcc-4.2/trunk/gcc/ginclude/float.h Thu Nov  8 20:30:15 2007
@@ -126,9 +126,11 @@
 #define LDBL_MIN	__LDBL_MIN__
 
 /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown.  */
-/* ??? This is supposed to change with calls to fesetround in <fenv.h>.  */
+/* APPLE LOCAL begin 3399553 */
+/* This changes with calls to fesetround in <fenv.h>.  */
 #undef FLT_ROUNDS
-#define FLT_ROUNDS 1
+#define FLT_ROUNDS (__builtin_flt_rounds ())
+/* APPLE LOCAL end 3399553 */
 
 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 /* The floating-point expression evaluation method.

Modified: llvm-gcc-4.2/trunk/gcc/global.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/global.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/global.c (original)
+++ llvm-gcc-4.2/trunk/gcc/global.c Thu Nov  8 20:30:15 2007
@@ -457,7 +457,17 @@
     {
       bool cannot_elim
 	= (! CAN_ELIMINATE (eliminables[i].from, eliminables[i].to)
+/* APPLE LOCAL begin ARM prefer SP to FP */
+#ifdef ALLOW_ELIMINATION_TO_SP
+	   /* There are certain performance benefits for some targets
+	      in using SP instead of FP.  CAN_ELIMINATE must prevent us
+	      from using SP when we can't so there's no need for us to
+	      prevent elimination to the SP.  */
+	   );
+#else
 	   || (eliminables[i].to == STACK_POINTER_REGNUM && need_fp));
+#endif
+/* APPLE LOCAL end ARM prefer SP to FP */
 
       if (!regs_asm_clobbered[eliminables[i].from])
 	{

Modified: llvm-gcc-4.2/trunk/gcc/insn-notes.def
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/insn-notes.def?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/insn-notes.def (original)
+++ llvm-gcc-4.2/trunk/gcc/insn-notes.def Thu Nov  8 20:30:15 2007
@@ -92,4 +92,10 @@
    between hot and cold text sections.  */
 INSN_NOTE (SWITCH_TEXT_SECTIONS)
 
+/* APPLE LOCAL begin ARM 5051776 */
+/* Record that we have just executed an alloca() -- used for
+   implementation of sjlj exception handling.  */
+INSN_NOTE (ALLOCA)
+/* APPLE LOCAL end ARM 5051776 */
+
 #undef INSN_NOTE

Modified: llvm-gcc-4.2/trunk/gcc/jump.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/jump.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/jump.c (original)
+++ llvm-gcc-4.2/trunk/gcc/jump.c Thu Nov  8 20:30:15 2007
@@ -1882,6 +1882,17 @@
       if (LABEL_REF_NONLOCAL_P (x) || LABEL_REF_NONLOCAL_P (y))
 	return XEXP (x, 0) == XEXP (y, 0);
 
+      /* APPLE LOCAL begin ARM pic support */
+      /* ARM uses label_refs to contant pool entries in
+         pic_add_dot_plus_eight that must not compare equal, but, they
+         are not emitted into the function body, so, there is no
+         next_real_insn for them.  Unfortunately, different labels
+         both return 0, leading to a false equality.  Found on
+         libiberty build.  */
+      if (next_real_insn (XEXP (x, 0)) == 0)
+        return 0;
+      /* APPLE LOCAL end ARM pic support */
+
       /* Two label-refs are equivalent if they point at labels
 	 in the same position in the instruction stream.  */
       return (next_real_insn (XEXP (x, 0))

Modified: llvm-gcc-4.2/trunk/gcc/libgcc2.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libgcc2.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/libgcc2.c (original)
+++ llvm-gcc-4.2/trunk/gcc/libgcc2.c Thu Nov  8 20:30:15 2007
@@ -1430,11 +1430,9 @@
 #define F_MODE_OK(SIZE) \
   (SIZE < DI_SIZE							\
    && SIZE > (DI_SIZE - SIZE + FSSIZE)					\
-   /* Don't use IBM Extended Double TFmode for TI->SF calculations.	\
-      The conversion from long double to float suffers from double	\
-      rounding, because we convert via double.  In any case, the	\
-      fallback code is faster.  */					\
-   && !IS_IBM_EXTENDED (SIZE))
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */			\
+   && !AVOID_FP_TYPE_CONVERSION(SIZE))
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
 #if defined(L_floatdisf)
 #define FUNC __floatdisf
 #define FSTYPE SFtype
@@ -1525,13 +1523,25 @@
   hi = u >> shift;
 
   /* If we lost any nonzero bits, set the lsb to ensure correct rounding.  */
-  if (u & (((DWtype)1 << shift) - 1))
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */
+  if ((UWtype)u << (W_TYPE_SIZE - shift))
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
     hi |= 1;
 
   /* Convert the one word of data, and rescale.  */
-  FSTYPE f = hi;
-  f *= (UDWtype)1 << shift;
-  return f;
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */
+  FSTYPE f = hi, e;
+  if (shift == W_TYPE_SIZE)
+    e = Wtype_MAXp1_F;
+  /* The following two cases could be merged if we knew that the target
+     supported a native unsigned->float conversion.  More often, we only
+     have a signed conversion, and have to add extra fixup code.  */
+  else if (shift == W_TYPE_SIZE - 1)
+    e = Wtype_MAXp1_F / 2;
+  else
+    e = (Wtype)1 << shift;
+  return f * e;
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
 #endif
 }
 #endif
@@ -1542,11 +1552,9 @@
 #define F_MODE_OK(SIZE) \
   (SIZE < DI_SIZE							\
    && SIZE > (DI_SIZE - SIZE + FSSIZE)					\
-   /* Don't use IBM Extended Double TFmode for TI->SF calculations.	\
-      The conversion from long double to float suffers from double	\
-      rounding, because we convert via double.  In any case, the	\
-      fallback code is faster.  */					\
-   && !IS_IBM_EXTENDED (SIZE))
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */			\
+   && !AVOID_FP_TYPE_CONVERSION(SIZE))
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
 #if defined(L_floatundisf)
 #define FUNC __floatundisf
 #define FSTYPE SFtype
@@ -1630,13 +1638,25 @@
   hi = u >> shift;
 
   /* If we lost any nonzero bits, set the lsb to ensure correct rounding.  */
-  if (u & (((UDWtype)1 << shift) - 1))
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */
+  if ((UWtype)u << (W_TYPE_SIZE - shift))
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
     hi |= 1;
 
   /* Convert the one word of data, and rescale.  */
-  FSTYPE f = hi;
-  f *= (UDWtype)1 << shift;
-  return f;
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */
+  FSTYPE f = hi, e;
+  if (shift == W_TYPE_SIZE)
+    e = Wtype_MAXp1_F;
+  /* The following two cases could be merged if we knew that the target
+     supported a native unsigned->float conversion.  More often, we only
+     have a signed conversion, and have to add extra fixup code.  */
+  else if (shift == W_TYPE_SIZE - 1)
+    e = Wtype_MAXp1_F / 2;
+  else
+    e = (Wtype)1 << shift;
+  return f * e;
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
 #endif
 }
 #endif

Modified: llvm-gcc-4.2/trunk/gcc/libgcc2.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libgcc2.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/libgcc2.h (original)
+++ llvm-gcc-4.2/trunk/gcc/libgcc2.h Thu Nov  8 20:30:15 2007
@@ -119,11 +119,19 @@
 
 /* FIXME: This #ifdef probably should be removed, ie. enable the test
    for mips too.  */
+/* APPLE LOCAL begin mainline 4.3 2007-04-24 4876451 */
+/* Don't use IBM Extended Double TFmode for TI->SF calculations.
+   The conversion from long double to float suffers from double
+   rounding, because we convert via double.  In other cases, going
+   through the software fp routines is much slower than the fallback.  */
 #ifdef __powerpc__
-#define IS_IBM_EXTENDED(SIZE) (SIZE == 106)
+#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE == 106)
+#elif defined(WIDEST_HARDWARE_FP_SIZE)
+#define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE > WIDEST_HARDWARE_FP_SIZE)
 #else
-#define IS_IBM_EXTENDED(SIZE) 0
+#define AVOID_FP_TYPE_CONVERSION(SIZE) 0
 #endif
+/* APPLE LOCAL end mainline 4.3 2007-04-24 4876451 */
 
 /* In the first part of this file, we are interfacing to calls generated
    by the compiler itself.  These calls pass values into these routines

Modified: llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple Thu Nov  8 20:30:15 2007
@@ -1,3 +1,96 @@
+2007-11-05  Josh Conner  <jconner at apple.com>
+
+	Radar 5569420
+	* objc-act.c (build_objc_method_call): Use aggregate_value_p
+	to determine dispatch mechanism.
+
+2007-10-26  Josh Conner  <jconner at apple.com>
+
+	Radar 5562046
+	* objc-act.c (generate_v2_shared_structures): Fix signedness
+	mismatch.
+
+2007-08-22  Fariborz Jahanian <fjahanian at apple.com>
+
+	Radar 4947311
+	* objc-act.c (objc_start_protocol): Takes attribute list as new argument
+	(start_protocol): Takes attribute list as new argument and
+	Sets protocol's PROTOCOL_ATTRIBUTES field.
+	(objc_declare_protocols): Ditto.
+	(objc_handle_protocol_attrs): New routine to warn on 'deprecated' and
+	'unavailable' protocols.
+	(lookup_and_install_protocols): Call objc_handle_protocol_attrs to warn
+	on protocol attributes.
+	* objc-act.h (PROTOCOL_ATTRIBUTES): Macro for protocol's attributes.
+	
+2007-08-21  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5424473
+	* objc-act.c (start_method_def): Exclude +finalize from
+	warning issuance (was radar 4757423).
+
+2007-08-20  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5422751
+	* objc-act.c (objc_protocol_implementation): Function removed.
+
+2007-08-17  Fariborz Jahanian <fjahanian at apple.com>
+
+	Radar 5376125 (64bit abi)
+	* objc-act.c (objc_property_access_info): Warning check for 32bit abi only.
+	(objc_v2_build_ivar_ref): Warning for 64bit abi.
+
+2007-08-16  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 3533972
+	* objc-act.c (objc_finish_message_expr): Do the receiver type
+	conversion if user has provided one.
+
+2007-08-14  Fariborz Jahanian <fjahanian at apple.com>
+
+	Radar 5409313
+	* objc-act.c (objc_build_selector_expr): Diagnose empty @selector
+	directive.
+
+2007-08-14  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5407792
+	* objc-act.c (objc_v2_encode_prop_attr): Add 'N' for nonatomic
+	property attribute encoding.
+
+2007-08-10  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5376125
+        * objc-act.c (objc_warn_direct_ivar_access): New
+        (objc_build_getter_call): Warn if 'ivar' accessed outside
+        property context.
+        (objc_synthesize_new_getter): Turn off above warning if 'ivar' is
+        accessed for getter synthesis.
+        (objc_synthesize_new_setter): Turn off above warning if 'ivar' is
+        accessed for setter synthesis.
+
+2007-08-10  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5398274
+        * objc-act.c (objc_synthesize_new_setter): Set 'used' flag 
+        on '_value' argument when doing lhs = _value;
+
+2007-08-08  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5389292
+	* objc-act.c (objc_declare_property_impl): For ivar decl. get the 
+	underlying bitfield type for comparison.
+
+2007-08-07  Fariborz Jahanian <fjahanian at apple.com>
+
+        Radar 5390587
+	* objc-act.c (objc_build_property_reference_expr): Preserve the original
+	receiver.property_name information.
+	(objc_resolve_build_property_setter_name): Get 'setter' name from original property name.
+	(objc_finish_message_expr): return error_mark_node on error.
+	(finish_class): Set property context field only when new getter is
+	introduced (but not when existing one is found).
+
 2007-07-31  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 5259868

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Nov  8 20:30:15 2007
@@ -199,7 +199,8 @@
 #else
 static void objc_start_function (tree, tree, tree, struct c_arg_info *);
 #endif
-static tree start_protocol (enum tree_code, tree, tree);
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+static tree start_protocol (tree, tree, tree);
 static tree build_method_decl (enum tree_code, tree, tree, tree, bool);
 /* APPLE LOCAL C* language */
 static tree objc_add_method (tree, tree, int, int);
@@ -242,6 +243,8 @@
 static char * objc_build_property_ivar_name (tree);
 /* APPLE LOCAL end C* property (Radar 4436866) */
 static void objc_xref_basetypes (tree, tree);
+/* APPLE LOCAL radar 5376125 */
+static void objc_warn_direct_ivar_access (tree, tree);
 
 /* APPLE LOCAL begin ObjC new abi */
 static void build_v2_class_template (void);
@@ -931,10 +934,12 @@
 }
 
 void
-objc_start_protocol (tree name, tree protos)
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+objc_start_protocol (tree name, tree protos, tree prefix_attrs)
 {
   objc_interface_context
-    = start_protocol (PROTOCOL_INTERFACE_TYPE, name, protos);
+    /* APPLE LOCAL radar 4947311 - protocol attributes */
+    = start_protocol (name, protos, prefix_attrs);
   /* APPLE LOCAL C* language */
   objc_method_optional_flag = 0;
 }
@@ -999,17 +1004,6 @@
     = continue_class (objc_implementation_context);
 }
 
-/* APPLE LOCAL begin radar 4695109 */
-/* This routine which used to implement new abi's
-   @implementation <proto-name> @end
-   feature to generate meta-data for the protocol is now disallowed. */
-void
-objc_protocol_implementation (tree protolist ATTRIBUTE_UNUSED)
-{
-  error ("use of @implementation <proto-name> @end not allowed");
-}
-/* APPLE LOCAL end radar 4695109 */
-
 void
 objc_continue_implementation (void)
 {
@@ -1155,7 +1149,8 @@
              IDENTIFIER_POINTER (PROPERTY_NAME (x)));
     }
   else
-    objc_add_method (class, setter_decl, false, false);
+    /* APPLE LOCAL radar 4653422 */
+    objc_add_method (class, setter_decl, false, OPTIONAL_PROPERTY (x));
   METHOD_PROPERTY_CONTEXT (setter_decl) = x;
   return;
 }
@@ -1200,6 +1195,8 @@
   PROPERTY_DYNAMIC (property_decl) = NULL_TREE;
   /* APPLE LOCAL radar 4712415 */
   TREE_DEPRECATED (property_decl) = TREE_DEPRECATED (decl);
+  /* APPLE LOCAL radar 4653422 */
+  OPTIONAL_PROPERTY (property_decl) = objc_method_optional_flag;
   /* assign, retain and copy are mutually exclusive. */
   if ((property_assign && property_retain)
       || (property_assign && property_copy) 
@@ -1269,7 +1266,8 @@
                     {
                       tree id_NSCopying = get_identifier ("NSCopying");
                       tree lproto = lookup_protocol (id_NSCopying);
-                      objc_declare_protocols (tree_cons (NULL_TREE, id_NSCopying, NULL_TREE));
+		      /* APPLE LOCAL radar 4947311 - protocol attributes */
+                      objc_declare_protocols (tree_cons (NULL_TREE, id_NSCopying, NULL_TREE), NULL_TREE);
                       /* APPLE LOCAL begin radar 5096644 */
                       if (lproto && TREE_CODE (lproto) == PROTOCOL_INTERFACE_TYPE
                           && objc_lookup_protocol (lproto , TYPE_OBJC_INTERFACE (ltyp), ltyp, false))
@@ -1507,7 +1505,15 @@
       if (basetype != NULL_TREE && TREE_CODE (basetype) == POINTER_TYPE)
         basetype = TREE_TYPE (basetype);
       else if (check_prop_cond)
-	return NULL_TREE;
+	/* APPLE LOCAL begin radar 5376125 */
+	{
+	  /* Note that for objc2, this warning is issued when ivar reference
+	     tree is generated in call to objc_v2_build_ivar_ref */
+	  if (!flag_objc_gc && warn_direct_ivar_access && flag_objc_abi != 2)
+            objc_warn_direct_ivar_access (basetype, component);
+	  return NULL_TREE;
+	}
+	/* APPLE LOCAL end radar 5376125 */
 
       while (basetype != NULL_TREE
              && TREE_CODE (basetype) == RECORD_TYPE && OBJC_TYPE_NAME (basetype)
@@ -1572,15 +1578,9 @@
     return res;
 
   prop_type = NULL_TREE;
-  if (prop)
-    {
-      prop_type = TREE_TYPE (prop);
-      if (PROPERTY_GETTER_NAME (prop))
-        /* If 'getter=getter_name' attribute is specified, must use the user provided
-           getter name in generating messaging call. */
-        component = PROPERTY_GETTER_NAME (prop);
-    }
-  else if (interface_type && !receiver_is_class)
+  /* APPLE LOCAL begin objc2 5512183 */
+  if (interface_type && !receiver_is_class)
+  /* APPLE LOCAL end objc2 5512183 */
     {
       /* type of the expression is either the property type or, if no property declared,
 	 then ivar type used in receiver.ivar expression. */
@@ -1606,9 +1606,24 @@
     }
   /* APPLE LOCAL end radar 5277239 */
 
+  /* APPLE LOCAL begin objc2 5512183 */
+  if (prop)
+    {
+      if (prop_type
+	  && comptypes (prop_type, TREE_TYPE (prop)) != 1)
+	error ("type of accessor does not match the type of property %qs",
+	       IDENTIFIER_POINTER (PROPERTY_NAME (prop)));
+      else
+	prop_type = TREE_TYPE (prop);
+    }
+  /* APPLE LOCAL end objc2 5512183 */
+
   if (prop_type)
     {
-      tree prop_expr = build2 (OBJC_PROPERTY_REFERENCE_EXPR, prop_type, receiver, component);
+      /* APPLE LOCAL begin 5494488 */
+      tree prop_expr = build3 (OBJC_PROPERTY_REFERENCE_EXPR, prop_type,
+			       receiver, component, UOBJC_SUPER_decl);
+      /* APPLE LOCAL end 5494488 */
       TREE_SIDE_EFFECTS (prop_expr) = 1;
       return prop_expr;
     }
@@ -1675,7 +1690,6 @@
 objc_resolve_build_property_setter_name (tree receiver, tree property_ident)
 {
   tree rtype, basetype,x,class=NULL_TREE;
-  tree getter_decl;
   bool receiver_is_class = false;
   gcc_assert (receiver && TREE_TYPE (receiver));
   rtype = TREE_TYPE (receiver);
@@ -1726,22 +1740,12 @@
       return setter_name; 
     }
   /* APPLE LOCAL end radar 5277239 */
-  getter_decl = lookup_method_static (class, property_ident, 0, true, false);
-  if (getter_decl)
-    {
-      x = METHOD_PROPERTY_CONTEXT (getter_decl);
-      gcc_assert (x && PROPERTY_NAME (x));
-      if (PROPERTY_SETTER_NAME (x))
-        return IDENTIFIER_POINTER (PROPERTY_SETTER_NAME (x));
-      else
-        return objc_build_property_setter_name (PROPERTY_NAME (x), true);
-    }
-  else
-    {
-      /* Allow for direct access of 'setter' using dot syntax. */
-      char *setter_name = objc_build_property_setter_name (property_ident, true);
-      return setter_name;
-    }
+  /* APPLE LOCAL begin radar 5390587 */
+  x = lookup_property (class, property_ident);
+  return (x && PROPERTY_SETTER_NAME (x)) ? IDENTIFIER_POINTER (PROPERTY_SETTER_NAME (x))
+					 : objc_build_property_setter_name 
+					     (property_ident, true);
+  /* APPLE LOCAL end radar 5390587 */
 }
 
 /* This routine builds a call to property's 'setter' function. RECEIVER is the 
@@ -1915,6 +1919,7 @@
     kPropertyType = 't'                         // followed by old-style type encoding.
     kPropertyWeak = 'W'				// 'weak' property
     kPropertyStrong = 'P'			// property GC'able
+    kPropertyNonAtomic = 'N'			// property non-atomic
 };  */
 
 static tree
@@ -1942,6 +1947,11 @@
   if (PROPERTY_DYNAMIC (property) == boolean_true_node)
     obstack_grow (&util_obstack, ",D", 2);
 
+  /* APPLE LOCAL begin radar 5407792 */
+  if (!IS_ATOMIC (property))
+    obstack_grow (&util_obstack, ",N", 2);
+  /* APPLE LOCAL end radar 5407792 */
+
   if (PROPERTY_GETTER_NAME (property))
     {
       obstack_grow (&util_obstack, ",G", 2);
@@ -2143,6 +2153,8 @@
   do {
     tree type;
     int strong;
+    /* APPLE LOCAL objc gc 5547128 */
+
     /* Unnamed bitfields are ignored. */
     if (!DECL_NAME (field_decl) || DECL_BIT_FIELD_TYPE (field_decl))
       {
@@ -2233,11 +2245,21 @@
         strong = objc_is_strong_p (type);
         if (strong)
           break;
-        if (TREE_CODE (type) == FUNCTION_TYPE)
+
+	/* APPLE LOCAL begin objc gc 5547128 */
+        if (TREE_CODE (type) == FUNCTION_TYPE
+	    || TREE_CODE (type) == METHOD_TYPE)
           break;
+	/* APPLE LOCAL end objc gc 5547128 */
 
         if (objc_is_object_ptr (type))
-          strong = (objc_is_strong_p (TREE_TYPE (type)) >= 0) ? 1 : -1;
+	/* APPLE LOCAL begin objc gc 5547128 */
+	  {
+	    strong = ((objc_is_strong_p (TREE_TYPE (type)) >= 0) ? 1 : -1);
+	    break;
+	  }
+	/* APPLE LOCAL end objc gc 5547128 */
+
         type = TREE_TYPE (type);
       }
     while (!strong && type);
@@ -3814,6 +3836,26 @@
     }
 }
 
+/* APPLE LOCAL begin radar 4947311 - protocol attributes */
+static void
+objc_handle_protocol_attrs (tree proto)
+{
+  tree chain;
+
+  for (chain = PROTOCOL_ATTRIBUTES (proto); chain; chain = TREE_CHAIN (chain))
+    {
+      if (is_attribute_p ("deprecated", TREE_PURPOSE (chain)))
+	warning (0, "protocol %qs is deprecated",
+		 IDENTIFIER_POINTER (CLASS_NAME (proto)));
+      if (is_attribute_p ("unavailable", TREE_PURPOSE (chain)))
+	warning (0, "protocol %qs is unavailable",
+	         IDENTIFIER_POINTER (CLASS_NAME (proto)));
+    }
+  return;
+}
+
+/* APPLE LOCAL end radar 4947311 - protocol attributes */
+
 /* Look up PROTOCOLS, and return a list of those that are found.
    If none are found, return NULL.  */
 
@@ -3835,6 +3877,8 @@
 	  if (defNeeded && !PROTOCOL_DEFINED (p))
 	    warning (0, "no definition of protocol %qs is found",
 		     IDENTIFIER_POINTER (ident));
+	  /* APPLE LOCAL radar 4947311 - protocol attributes */
+	  objc_handle_protocol_attrs (p);
 	  return_value = chainon (return_value,
 				  build_tree_list (NULL_TREE, p));
 	}
@@ -5247,7 +5291,7 @@
 }
 
 /* APPLE LOCAL begin radar 4349690 */
-/* MERGE FIXME See how
+/* MERGE FIXME 5416374 See how
 
    2005-08-31  Andrew Pinski  <pinskia at physics.uc.edu> PR objc/23306
 
@@ -6310,6 +6354,10 @@
 /* APPLE LOCAL ObjC GC */
 objc_is_gcable_type (tree type)
 {
+  /* APPLE LOCAL begin objc gc 5547128 */
+  int strong;
+  /* APPLE LOCAL end objc gc 5547128 */
+
   /* APPLE LOCAL ObjC GC */
   /* CODE FRAGMENT REMOVED.  */
   /* APPLE LOCAL begin radar 4829803 */
@@ -6322,31 +6370,44 @@
     return 0;
   /* APPLE LOCAL begin ObjC GC */
 
+  /* APPLE LOCAL objc gc 5547128 */
+  strong = 0;
   do
     {
       /* The '__strong' and '__weak' keywords trump all.  */
-      int strong = objc_is_strong_p (type);
+      /* APPLE LOCAL objc gc 5547128 */
+      strong = objc_is_strong_p (type);
 
       /* APPLE LOCAL begin radar 4426814 */
       if (strong)
-	return strong;
+	/* APPLE LOCAL objc gc 5547128 */
+	break;
       /* APPLE LOCAL end radar 4426814 */
 
+      /* APPLE LOCAL begin objc gc 5547128 */
       /* Function pointers are not GC-able.  */
-      if (TREE_CODE (type) == FUNCTION_TYPE)
-	return 0;
+      if (TREE_CODE (type) == FUNCTION_TYPE
+	  || TREE_CODE (type) == METHOD_TYPE)
+	break;
+      /* APPLE LOCAL end objc gc 5547128 */
 
       /* Objective-C objects are GC-able, unless they were tagged with
 	 '__weak'.  */
       if (objc_is_object_ptr (type))
  	/* APPLE LOCAL radar 4426814 */
-	return (objc_is_strong_p (TREE_TYPE (type)) >= 0 ? 1 : -1);
+	/* APPLE LOCAL begin objc gc 5547128 */
+	{
+	  strong = (objc_is_strong_p (TREE_TYPE (type)) >= 0 ? 1 : -1);
+	  break;
+	}
+      /* APPLE LOCAL end objc gc 5547128 */
 
       type = TREE_TYPE (type);
     }
   while (type);
 
-  return 0;
+  /* APPLE LOCAL objc gc 5547128 */
+  return strong;
 }
 /* APPLE LOCAL end ObjC GC */
 /* APPLE LOCAL begin radar 4982951 */
@@ -6447,7 +6508,8 @@
   func = objc_assign_ivar_decl;
   /* APPLE LOCAL end radar 4783068 */
 
-  offs = convert (integer_type_node, build_unary_op (ADDR_EXPR, offs, 0));
+  /* APPLE LOCAL objc gc 5547128 */
+  offs = convert (ptrdiff_type_node, build_unary_op (ADDR_EXPR, offs, 0));
   offs = fold (offs);
   func_params = tree_cons (NULL_TREE,
 	convert (objc_object_type, rhs),
@@ -6533,11 +6595,14 @@
 static tree
 objc_build_strong_cast_assignment (tree lhs, tree rhs)
 {
-  tree func_params = tree_cons (NULL_TREE,
-	convert (objc_object_type, rhs),
-	    tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type),
-		      build_unary_op (ADDR_EXPR, lhs, 0)),
-		    NULL_TREE));
+  /* APPLE LOCAL begin objc gc 5547128 */
+  tree func_params
+    = tree_cons (NULL_TREE,
+		 convert (objc_object_type, rhs),
+		 tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type),
+						build_unary_op (ADDR_EXPR, lhs, 0)),
+			    NULL_TREE));
+  /* APPLE LOCAL end objc gc 5547128 */
 
   assemble_external (objc_assign_strong_cast_decl);
   return build_function_call (objc_assign_strong_cast_decl, func_params);
@@ -6811,6 +6876,14 @@
     }
   /* APPLE LOCAL end radar 3742561 */
 
+  /* APPLE LOCAL begin objc gc 5547128 */
+  /* Only pointers need barriers.  We can get here when
+       __strong float *p; p[0] = 3.14;  */
+  if (TREE_CODE (lhs_type) != POINTER_TYPE
+      && TREE_CODE (TREE_TYPE (rhs)) != POINTER_TYPE)
+    return NULL_TREE;
+  /* APPLE LOCAL end objc gc 5547128 */
+
   /* the lhs must be of a suitable type, regardless of its underlying
      structure.  Furthermore, __weak must not have been used.  */
   /* APPLE LOCAL radar 4426814 */
@@ -7100,9 +7173,14 @@
 
   /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) */
   if (TREE_UNAVAILABLE (field))
-    warn_unavailable_use (field);
+    error_unavailable_use (field);
   /* APPLE LOCAL end "unavailable" attribute (radar 2809697) */
 
+  /* APPLE LOCAL begin radar 5376125 */
+  if (!flag_objc_gc && warn_direct_ivar_access)
+    objc_warn_direct_ivar_access (TYPE_MAIN_VARIANT (TREE_TYPE (datum)), 
+				  component);
+  /* APPLE LOCAL end radar 5376125 */
   return ref;
 }
 /* APPLE LOCAL end ObjC new abi */
@@ -11787,12 +11865,12 @@
       gcc_assert (TREE_CODE (expr) == PROTOCOL_INTERFACE_TYPE);
       /* APPLE LOCAL begin radar 4695109 */
       /* APPLE LOCAL begin - LLVM radar 5476262 */
+      /* LLVM LOCAL - add 'L' prefix */
       sprintf (string, "L_OBJC_PROTOCOL_$_%s", 
 	       IDENTIFIER_POINTER (PROTOCOL_NAME (expr)));
-#ifdef ENABLE_LLVM
       expr = lookup_name (get_identifier(string));
       if (expr == NULL_TREE)
-#endif
+        /* LLVM LOCAL - &string[1] because of 'L' prefix */
 	expr = start_var_decl (objc_v2_protocol_template, &string[1]);
       /* APPLE LOCAL end - LLVM radar 5476262 */
       /* APPLE LOCAL end radar 4695109 */
@@ -12073,7 +12151,11 @@
 
   /* If the class has no ivars, instanceStart should be set to the superclass's 
      instanceSize */
-  instanceStart = UOBJC_V2_INSTANCE_VARIABLES_decl ? int_byte_position (firstIvar) : instanceSize;
+  /* APPLE LOCAL begin ARM signedness mismatch */
+  instanceStart = UOBJC_V2_INSTANCE_VARIABLES_decl
+		  ? (unsigned int) int_byte_position (firstIvar)
+		  : instanceSize;
+  /* APPLE LOCAL end ARM signedness mismatch */
 
   decl = start_var_decl (objc_v2_class_ro_template,
                          newabi_append_ro (IDENTIFIER_POINTER
@@ -12954,6 +13036,19 @@
 	  exp.value = receiver;
 	  exp = default_function_array_conversion (exp);
 	  receiver = exp.value;
+	/* APPLE LOCAL begin radar 3533972 */
+#else
+	  if (can_convert_arg (objc_object_type, TREE_TYPE (receiver), 
+				receiver, LOOKUP_NORMAL))
+	    {
+	      /* In rare cases, 'receiver' must be converted to type 'id' using
+	         user-defined type conversion. 'id' is type of the 1st argument to
+	         objc_msgSend (id self, SEL op, ...); */
+	      tree cnv_rec = perform_implicit_conversion (objc_object_type, receiver);
+              if (cnv_rec && cnv_rec != error_mark_node)
+	        return objc_finish_message_expr (cnv_rec, sel_name, method_params);
+	    }
+	/* APPLE LOCAL end radar 3533972 */
 #endif
 	  /* APPLE LOCAL end decay function/array receivers */
 	  warning (0, "invalid receiver type %qs",
@@ -12992,6 +13087,8 @@
   if (!method_prototype && in_objc_property_setter_name_context)
     {
       error ("object cannot be set - either readonly property or no setter found");
+      /* APPLE LOCAL radar 5390587 */
+      return error_mark_node;
     }
   /* APPLE LOCAL end objc new property */
   else if (!method_prototype) 
@@ -13162,7 +13259,7 @@
       if (TREE_DEPRECATED (method_prototype))
         warn_deprecated_use (method_prototype);
       if (TREE_UNAVAILABLE (method_prototype))
-        warn_unavailable_use (method_prototype);
+        error_unavailable_use (method_prototype);
     }
   /* APPLE LOCAL end radar 5005756 */
   lookup_object = build_c_cast (rcv_p, lookup_object);
@@ -13183,8 +13280,9 @@
 	 argument, then change which messenger entry point this
 	 expr will call.  NB: Note that sender_cast remains
 	 unchanged (it already has a struct return type).  */
-      /* LLVM LOCAL pr 1654 */
+      /* APPLE LOCAL begin ARM 4961719 */
       if (aggregate_value_p (ret_type, 0))
+      /* APPLE LOCAL end ARM 4961719 */
 	sender = (super_flag ? umsg_super_stret_decl :
 		flag_nil_receivers ? umsg_stret_decl : umsg_nonnil_stret_decl);
       /* APPLE LOCAL begin radar 4280641 */
@@ -13263,7 +13361,7 @@
       if (TREE_DEPRECATED (method_prototype))
         warn_deprecated_use (method_prototype);
       if (TREE_UNAVAILABLE (method_prototype))
-        warn_unavailable_use (method_prototype);
+        error_unavailable_use (method_prototype);
     }
   /* APPLE LOCAL end radar 5005756 */
   /* APPLE LOCAL end radar 3803157 - objc attribute */
@@ -13328,9 +13426,7 @@
   proto_name = synth_id_with_class_suffix ("_OBJC_PROTOCOL_$", p);
   decl = start_var_decl (objc_v2_protocol_template, proto_name);
   PROTOCOL_V2_FORWARD_DECL (p) = decl;
-  /* APPLE LOCAL begin - LLVM radar 5476262 */
   pushdecl_top_level(decl);
-  /* APPLE LOCAL end - LLVM radar 5476262 */
 }
 /* APPLE LOCAL end radar 4695109 */
 
@@ -13565,6 +13661,13 @@
 {
   tree selname;
 
+  /* APPLE LOCAL begin radar 5409313 */
+  if (selnamelist == NULL_TREE)
+    {
+      error ("method name missing in @selector");
+      return error_mark_node;
+    }
+  /* APPLE LOCAL end radar 5409313 */
   /* Obtain the full selector name.  */
   if (TREE_CODE (selnamelist) == IDENTIFIER_NODE)
     /* A unary selector.  */
@@ -15532,7 +15635,12 @@
  	bool isStrong = false;
         tree ret_type = TREE_TYPE (TREE_TYPE (current_function_decl));
         /* return self->ivar_name; */
+        /* APPLE LOCAL begin radar 5376125 */
+        int save_warn_direct_ivar_access = warn_direct_ivar_access;
+        warn_direct_ivar_access = 0;
         ret_val = build_ivar_reference (PROPERTY_IVAR_NAME (property));
+        warn_direct_ivar_access = save_warn_direct_ivar_access;
+        /* APPLE LOCAL end radar 5376125 */
 
 	/* Handle struct-valued functions */
 	if ((TREE_CODE (ret_type) == RECORD_TYPE || TREE_CODE (ret_type) == UNION_TYPE)
@@ -15641,6 +15749,8 @@
       gcc_assert (cmd);
       arg = TREE_CHAIN (cmd);
       gcc_assert (arg);
+      /* APPLE LOCAL radar 5398274 */
+      TREE_USED (arg) = 1;
       func_params = tree_cons (NULL_TREE, self_decl,
                       tree_cons (NULL_TREE, cmd,
                         tree_cons (NULL_TREE, offset,
@@ -15654,7 +15764,12 @@
     {
       tree ivar_type;
       tree rhs = lookup_name (get_identifier ("_value"));
+      /* APPLE LOCAL begin radar 5376125 */
+      int save_warn_direct_ivar_access = warn_direct_ivar_access;
+      warn_direct_ivar_access = 0;
       lhs = build_ivar_reference (PROPERTY_IVAR_NAME (property));
+      warn_direct_ivar_access = save_warn_direct_ivar_access;
+      /* APPLE LOCAL end radar 5376125 */
       /* Recover when method does not have '_value' argument. This is because user
          provided its own accessor and for which an error is already issued. */
       if (!rhs)
@@ -15774,11 +15889,12 @@
 	{
 	  if (PROPERTY_GETTER_NAME (x))
 	    objc_process_getter_setter (class_methods, x, true);
-	  /* APPLE LOCAL begin radar 4966565 */
+	  /* APPLE LOCAL begin radar 4966565 - radar 4653422 */
 	  else if (!lookup_method (CLASS_NST_METHODS (objc_implementation_context), PROPERTY_NAME (x))
 	           && !lookup_accessor_in_base_class_impl (objc_implementation_context, class,
-						           PROPERTY_NAME (x)))
-	  /* APPLE LOCAL end radar 4966565 */
+						           PROPERTY_NAME (x))
+		   && !OPTIONAL_PROPERTY (x))
+	  /* APPLE LOCAL end radar 4966565 - radar 4653422 */
 	    warning (0, "property %qs requires method '-%s' to be defined - use @synthesize, "
 			"@dynamic or provide a method implementation", 
 		     IDENTIFIER_POINTER (PROPERTY_NAME (x)), IDENTIFIER_POINTER (PROPERTY_NAME (x)));
@@ -15788,14 +15904,15 @@
 	  else if (PROPERTY_READONLY (x) == boolean_false_node)
 	    {
 	      char *setter_string_name = objc_build_property_setter_name (PROPERTY_NAME (x), true);
-	      /* APPLE LOCAL begin radar 4966565 */
+	      /* APPLE LOCAL begin radar 4966565 - radar 4653422 */
 	      tree ident = get_identifier (setter_string_name);
 	      if (!lookup_method (CLASS_NST_METHODS (objc_implementation_context), ident)
-	          && !lookup_accessor_in_base_class_impl (objc_implementation_context, class, ident))
+	          && !lookup_accessor_in_base_class_impl (objc_implementation_context, class, ident)
+		  && !OPTIONAL_PROPERTY (x))
 		warning (0, "property %qs requires the method '%s' to be defined - use @synthesize, "
 			    "@dynamic or provide a method implementation",
 			 IDENTIFIER_POINTER (PROPERTY_NAME (x)), setter_string_name);
-	      /* APPLE LOCAL end radar 4966565 */
+	      /* APPLE LOCAL end radar 4966565 - radar 4653422 */
 	    }
 	}
       }
@@ -16028,16 +16145,21 @@
 		  if (METHOD_SEL_ARGS (getter_decl) != NULL_TREE)
 		    error ("accessor %<%c%s%> cannot have any argument", 
 		           '-', IDENTIFIER_POINTER (prop_name));	
+	          METHOD_PROPERTY_CONTEXT (getter_decl) = x;
+	          TREE_DEPRECATED (getter_decl) = TREE_DEPRECATED (x);
 	    	}
-	      else
+	      /* APPLE LOCAL radar begin 4653422 */
+	      else if (!OPTIONAL_PROPERTY (x) || TREE_CODE (class) == PROTOCOL_INTERFACE_TYPE)
 	        {
 	          tree rettype = build_tree_list (NULL_TREE, type);
 	          getter_decl = build_method_decl (INSTANCE_METHOD_DECL,
 	     				           rettype, prop_name, NULL_TREE,
 						   false);
-	  	  objc_add_method (class, getter_decl, false, false);
+	  	  objc_add_method (class, getter_decl, false, OPTIONAL_PROPERTY (x));
+	          METHOD_PROPERTY_CONTEXT (getter_decl) = x;
+	          TREE_DEPRECATED (getter_decl) = TREE_DEPRECATED (x);
 	        }
-	      METHOD_PROPERTY_CONTEXT (getter_decl) = x;
+	      /* APPLE LOCAL radar end 4653422 */
 	    }
 	  else
 	    {
@@ -16052,6 +16174,8 @@
 	     				           rettype, PROPERTY_GETTER_NAME (x), 
 						   NULL_TREE, false);
 	  	  objc_add_method (class, getter_decl, false, false);
+		  /* APPLE LOCAL radar 5390587 */
+	          METHOD_PROPERTY_CONTEXT (getter_decl) = x;
 		}
 	      else
 		{
@@ -16063,10 +16187,9 @@
 		    error ("existing accessor %<%c%s%> cannot have any argument",
 			   '-', IDENTIFIER_POINTER (PROPERTY_GETTER_NAME (x)));	
 		}
-	     METHOD_PROPERTY_CONTEXT (getter_decl) = x;
+	     /* APPLE LOCAL radar 4712415 */
+	     TREE_DEPRECATED (getter_decl) = TREE_DEPRECATED (x);
 	    }
-	  /* APPLE LOCAL radar 4712415 */
-	  TREE_DEPRECATED (getter_decl) = TREE_DEPRECATED (x);
 	  if (PROPERTY_SETTER_NAME (x) == NULL_TREE
 	      && PROPERTY_READONLY (x) == boolean_false_node)
 	    {
@@ -16099,8 +16222,11 @@
 	    	  /* APPLE LOCAL radar 4712415 */
 	    	  TREE_DEPRECATED (setter_decl) = TREE_DEPRECATED (x);
 		}
-	      else
+	      /* APPLE LOCAL radar begin 4653422 */
+	      else if (!OPTIONAL_PROPERTY (x) 
+		       || TREE_CODE (class) == PROTOCOL_INTERFACE_TYPE)
 		objc_add_property_setter_method (class, x);
+	      /* APPLE LOCAL radar end 4653422 */
 	    }
 	  else if (PROPERTY_SETTER_NAME (x))
 	    {
@@ -16237,7 +16363,8 @@
    they are already declared or defined, the function has no effect.  */
 
 void
-objc_declare_protocols (tree names)
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+objc_declare_protocols (tree names, tree prefix_attrs)
 {
   tree list;
 
@@ -16264,12 +16391,15 @@
 	  PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
 	  /* APPLE LOCAL ObjC abi v2 */
 	  PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;
+	  /* APPLE LOCAL radar 4947311 - protocol attributes */
+	  PROTOCOL_ATTRIBUTES (protocol) = prefix_attrs;
 	}
     }
 }
 
 static tree
-start_protocol (enum tree_code code, tree name, tree list)
+/* APPLE LOCAL radar 4947311 - protocol attributes */
+start_protocol (tree name, tree list, tree prefix_attrs)
 {
   tree protocol;
 
@@ -16283,7 +16413,8 @@
 
   if (!protocol)
     {
-      protocol = make_node (code);
+      /* APPLE LOCAL radar 4947311 - protocol attributes */
+      protocol = make_node (PROTOCOL_INTERFACE_TYPE);
       TYPE_LANG_SLOT_1 (protocol) = make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
 
       PROTOCOL_NAME (protocol) = name;
@@ -16294,12 +16425,18 @@
       PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
       /* APPLE LOCAL ObjC abi v2 */
       PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;
-
+      /* APPLE LOCAL radar 4947311 - protocol attributes */
+      PROTOCOL_ATTRIBUTES (protocol) = prefix_attrs;
       check_protocol_recursively (protocol, list);
     }
   else if (! PROTOCOL_DEFINED (protocol))
     {
       PROTOCOL_DEFINED (protocol) = 1;
+      /* APPLE LOCAL begin radar 4947311 - protocol attributes */
+      PROTOCOL_ATTRIBUTES (protocol) = merge_attributes 
+					 (PROTOCOL_ATTRIBUTES (protocol), 
+					  prefix_attrs);
+      /* APPLE LOCAL end radar 4947311 - protocol attributes */
       /* APPLE LOCAL radar 4398221 */
       PROTOCOL_LIST (protocol) = lookup_and_install_protocols (list, false);
 
@@ -16967,6 +17104,8 @@
      to check if a [super finalize] is missing, and warn if it is.  */
   should_call_super_finalize =
     CLASS_SUPER_NAME (objc_implementation_context)
+    /* APPLE LOCAL radar 5424473 */
+    && TREE_CODE (method) == INSTANCE_METHOD_DECL
     && !strcmp ("finalize", IDENTIFIER_POINTER (METHOD_SEL_NAME (method)));
   /* APPLE LOCAL end radar 4757423 */
 
@@ -18403,11 +18542,16 @@
       *expr_p = expr;
     }
   /* APPLE LOCAL end radar 5276085 */
-  /* APPLE LOCAL begin radar 5285911 */
+  /* APPLE LOCAL begin radar 5285911 5494488 */
   else if (objc_property_reference_expr (*expr_p))
-    *expr_p = objc_build_getter_call (TREE_OPERAND (*expr_p, 0), 
-				      TREE_OPERAND (*expr_p, 1));
-  /* APPLE LOCAL end radar 5285911 */
+    {
+      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 end radar 5285911 5494488 */
 
 #ifdef OBJCPLUS
   return cp_gimplify_expr (expr_p, pre_p, post_p);
@@ -18752,7 +18896,10 @@
   /*   } while (counter < limit ); */
   do_condition  = build_binary_op (LT_EXPR, counter_decl, limit_decl, 1); 
   inner_do_body = c_end_compound_stmt (inner_do_body, true);
-  c_finish_loop (location, do_condition, NULL, inner_do_body, NULL_TREE, clab, false); 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  c_finish_loop (location, do_condition, NULL, inner_do_body, NULL_TREE, clab,
+		 NULL_TREE, false); 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   add_stmt (c_end_compound_stmt (inner_do_block_start, true));
 
   /* } while (limit = [collection countByEnumeratingWithState:&enumState objects:items count:16]);  */
@@ -18765,7 +18912,10 @@
      no match, 'elem' be set to nil. So, we use a new label for getting out of
      of the outer while loop and set 'elem=nill' after this label. */ 
   exit_label = create_artificial_label ();
-  c_finish_loop (location, do_condition, NULL, outer_do_body, exit_label, NULL_TREE, false); 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  c_finish_loop (location, do_condition, NULL, outer_do_body, exit_label,
+		 NULL_TREE, NULL_TREE, false);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   /* elem = nil */
   add_stmt (build2 (MODIFY_EXPR, void_type_node, elem_decl, 
 		    fold_convert (TREE_TYPE (elem_decl), integer_zero_node)));
@@ -18999,9 +19149,14 @@
 		  ivar_decl = nested_ivar_lookup (class, ivar_name);
 		  if (ivar_decl)
 		    {
+		      /* APPLE LOCAL begin radar 5389292 */
 		    /* Check for semnatic correctness of the existing ivar. */
-		      if (comptypes (TREE_TYPE (ivar_decl), TREE_TYPE (property_decl)) != 1
-			  && !objc_compare_types (TREE_TYPE (property_decl), TREE_TYPE (ivar_decl), -5, NULL_TREE))
+		      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 end radar 5389292 */
 			{
 		          error ("type of property %qs does not match type of ivar %qs", 
 			         IDENTIFIER_POINTER (property_name), IDENTIFIER_POINTER (ivar_name));
@@ -19012,7 +19167,8 @@
 			  int strong = objc_is_gcable_type (TREE_TYPE (property_decl));
 			  if (strong)
 			    {
-			      int gc_able = objc_is_gcable_type (TREE_TYPE (ivar_decl));
+		              /* APPLE LOCAL radar 5389292 */
+			      int gc_able = objc_is_gcable_type (ivar_type);
 			      if (strong != gc_able)
 				{
 				  if (strong == -1)
@@ -19170,4 +19326,30 @@
   return true;
 }
 /* APPLE LOCAL end radar 5355344 */
+/* APPLE LOCAL begin radar 5376125 */
+/* This routine checks for direct access to a pointer to object ivar and issues a warning
+   if done so. */
+static void
+objc_warn_direct_ivar_access (tree basetype, tree component)
+{
+  while (basetype != NULL_TREE
+         && TREE_CODE (basetype) == RECORD_TYPE && OBJC_TYPE_NAME (basetype)
+         && TREE_CODE (OBJC_TYPE_NAME (basetype)) == TYPE_DECL
+         && DECL_ORIGINAL_TYPE (OBJC_TYPE_NAME (basetype)))
+    basetype = DECL_ORIGINAL_TYPE (OBJC_TYPE_NAME (basetype));
+  if (basetype != NULL_TREE && TYPED_OBJECT (basetype))
+    {
+      tree interface_type = TYPE_OBJC_INTERFACE (basetype);
+      if (interface_type &&
+          TREE_CODE (interface_type) == CLASS_INTERFACE_TYPE)
+        {
+          tree ivar = nested_ivar_lookup (interface_type, component);
+          if (ivar && managed_objc_object_pointer (TREE_TYPE (ivar)))
+            warning (0, "ivar %qs is being directly accessed", IDENTIFIER_POINTER (component));
+        }
+    }
+  return;
+}
+/* APPLE LOCAL end radar 5376125 */
+
 #include "gt-objc-objc-act.h"

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.h (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.h Thu Nov  8 20:30:15 2007
@@ -47,8 +47,8 @@
 
 /* APPLE LOCAL radar 4291785, 4548636 */
 #define CLASS_LANG_SLOT_ELTS		9
-/* APPLE LOCAL ObjC abi v2 */
-#define PROTOCOL_LANG_SLOT_ELTS		8
+/* APPLE LOCAL ObjC abi v2 - radar 4947311 */
+#define PROTOCOL_LANG_SLOT_ELTS		9
 #define OBJC_INFO_SLOT_ELTS		2
 
 /* KEYWORD_DECL */
@@ -130,6 +130,9 @@
 /* For CLASS_INTERFACE_TYPE only */
 #define CLASS_ATTRIBUTES(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 8)
 /* APPLE LOCAL end radar 4548636 */
+/* APPLE LOCAL begin radar 4947311 - protocol attributes */
+#define PROTOCOL_ATTRIBUTES(PROTO) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (PROTO), 8)
+/* APPLE LOCAL end radar 4947311 - protocol attributes */
 /* APPLE LOCAL radar 4695101 */
 /* declaration of  PROTOCOL_IMPL_OBJ removed. */
 
@@ -748,4 +751,6 @@
 #define ATOMIC_PROPERTY(NODE) (TREE_LANG_FLAG_1 (NODE))
 #define IS_ATOMIC(PROPERTY)   (ATOMIC_PROPERTY(PROPERTY))
 /* APPLE LOCAL end radar 4947014 - objc atomic property */
+/* APPLE LOCAL radar 4653422 */
+#define OPTIONAL_PROPERTY(PROPERTY_NODE) (TREE_LANG_FLAG_2 (PROPERTY_NODE))
 #endif /* GCC_OBJC_ACT_H */

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-tree.def
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-tree.def?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-tree.def (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-tree.def Thu Nov  8 20:30:15 2007
@@ -45,8 +45,8 @@
 DEFTREECODE (CLASS_REFERENCE_EXPR, "class_reference_expr", tcc_expression, 1)
 /* APPLE LOCAL radar 5276085 */
 DEFTREECODE (OBJC_WEAK_REFERENCE_EXPR, "weak_object_reference_expr", tcc_expression, 1)
-/* APPLE LOCAL radar 5285911 */
-DEFTREECODE (OBJC_PROPERTY_REFERENCE_EXPR, "property_reference_expr", tcc_expression, 2)
+/* APPLE LOCAL radar 5285911 5494488 */
+DEFTREECODE (OBJC_PROPERTY_REFERENCE_EXPR, "property_reference_expr", tcc_expression, 3)
 
 /*
 Local variables:

Modified: llvm-gcc-4.2/trunk/gcc/opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/opts.c Thu Nov  8 20:30:15 2007
@@ -443,6 +443,8 @@
     {
       if (cmdline)
 	flag_merge_constants = 0;
+      /* APPLE LOCAL ARM structor thunks */
+      flag_clone_structors = 1;
     }
 
   if (optimize >= 1)

Modified: llvm-gcc-4.2/trunk/gcc/passes.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/passes.c (original)
+++ llvm-gcc-4.2/trunk/gcc/passes.c Thu Nov  8 20:30:15 2007
@@ -640,9 +640,6 @@
   NEXT_PASS (pass_record_bounds);
   NEXT_PASS (pass_linear_transform);
   NEXT_PASS (pass_iv_canon);
-  /* APPLE LOCAL begin loops-to-memset */
-  NEXT_PASS (pass_memset);
-  /* APPLE LOCAL end loops-to-memset */
   NEXT_PASS (pass_if_conversion);
   NEXT_PASS (pass_vectorize);
   /* NEXT_PASS (pass_may_alias) cannot be done again because the
@@ -984,281 +981,6 @@
   while (pass);
 }
 
-/* APPLE LOCAL begin MERGE FIXME 4708086 - 4095567 4229407 4120689 */
-
-#if 0
-/* This function is called from the pass manager in tree-optimize.c
-   after all tree passes have finished for a single function, and we
-   have expanded the function body from trees to RTL.
-   Once we are here, we have decided that we're supposed to output
-   that function, i.e. that we should write assembler code for it.
-
-   We run a series of low-level passes here on the function's RTL
-   representation.  Each pass is called via a rest_of_* function.  */
-
-static void
-rest_of_compilation (void)
-{
-  /* If we're emitting a nested function, make sure its parent gets
-     emitted as well.  Doing otherwise confuses debug info.  */
-  {
-    tree parent;
-    for (parent = DECL_CONTEXT (current_function_decl);
-	 parent != NULL_TREE;
-	 parent = get_containing_scope (parent))
-      if (TREE_CODE (parent) == FUNCTION_DECL)
-	TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1;
-  }
-
-  /* We are now committed to emitting code for this function.  Do any
-     preparation, such as emitting abstract debug info for the inline
-     before it gets mangled by optimization.  */
-/* APPLE LOCAL begin mainline 2006-05-15 rewrite 4548482  */
-  if (cgraph_function_possibly_inlined_p (current_function_decl))
-    (*debug_hooks->outlining_inline_function) (current_function_decl, NULL);
-/* APPLE LOCAL end mainline 2006-05-15 rewrite 4548482  */
-
-  /* Remove any notes we don't need.  That will make iterating
-     over the instruction sequence faster, and allow the garbage
-     collector to reclaim the memory used by the notes.  */
-  remove_unnecessary_notes ();
-
-  /* Initialize some variables used by the optimizers.  */
-  init_function_for_compilation ();
-
-  TREE_ASM_WRITTEN (current_function_decl) = 1;
-
-  /* Early return if there were errors.  We can run afoul of our
-     consistency checks, and there's not really much point in fixing them.  */
-  if (rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount)
-    goto exit_rest_of_compilation;
-
-  rest_of_handle_jump ();
-
-  rest_of_handle_eh ();
-
-  /* Delay emitting hard_reg_initial_value sets until after EH landing pad
-     generation, which might create new sets.  */
-  emit_initial_value_sets ();
-
-#ifdef FINALIZE_PIC
-  /* If we are doing position-independent code generation, now
-     is the time to output special prologues and epilogues.
-     We do not want to do this earlier, because it just clutters
-     up inline functions with meaningless insns.  */
-  if (flag_pic)
-    FINALIZE_PIC;
-#endif
-
-  /* Copy any shared structure that should not be shared.  */
-  unshare_all_rtl ();
-
-#ifdef SETJMP_VIA_SAVE_AREA
-  /* This must be performed before virtual register instantiation.
-     Please be aware that everything in the compiler that can look
-     at the RTL up to this point must understand that REG_SAVE_AREA
-     is just like a use of the REG contained inside.  */
-  if (current_function_calls_alloca)
-    optimize_save_area_alloca ();
-#endif
-
-  /* Instantiate all virtual registers.  */
-  instantiate_virtual_regs ();
-
-  rest_of_handle_jump2 ();
-
-  if (optimize > 0)
-    rest_of_handle_cse ();
-
-  if (optimize > 0)
-    {
-      if (flag_gcse)
-	rest_of_handle_gcse ();
-
-      if (flag_loop_optimize)
-	rest_of_handle_loop_optimize ();
-
-      if (flag_gcse)
-	rest_of_handle_jump_bypass ();
-    }
-
-  timevar_push (TV_FLOW);
-  rest_of_handle_cfg ();
-
-  if (!flag_tree_based_profiling
-      && (optimize > 0 || profile_arc_flag
-	  || flag_test_coverage || flag_branch_probabilities))
-    {
-      rtl_register_profile_hooks ();
-      rtl_register_value_prof_hooks ();
-      rest_of_handle_branch_prob ();
-
-      if (flag_branch_probabilities
-	  && flag_profile_values
-	  && (flag_value_profile_transformations
-	      || flag_speculative_prefetching))
-	rest_of_handle_value_profile_transformations ();
-
-      /* Remove the death notes created for vpt.  */
-      if (flag_profile_values)
-	count_or_remove_death_notes (NULL, 1);
-    }
-
-  if (optimize > 0)
-    rest_of_handle_if_conversion ();
-
-  if (optimize > 0 && flag_tracer)
-    rest_of_handle_tracer ();
-
-  if (optimize > 0
-      && flag_loop_optimize2)
-    rest_of_handle_loop2 ();
-
-  if (optimize > 0 && flag_web)
-    rest_of_handle_web ();
-
-  if (optimize > 0 && flag_rerun_cse_after_loop)
-    rest_of_handle_cse2 ();
-
-  cse_not_expected = 1;
-
-  rest_of_handle_life ();
-  timevar_pop (TV_FLOW);
-
-  if (optimize > 0)
-    rest_of_handle_combine ();
-
-  if (optimize > 0 && flag_if_conversion)
-    rest_of_handle_if_after_combine ();
-
-  /* The optimization to partition hot/cold basic blocks into separate
-     sections of the .o file does not work well with linkonce or with
-     user defined section attributes.  Don't call it if either case
-     arises.  */
-
-  if (flag_reorder_blocks_and_partition 
-      && !DECL_ONE_ONLY (current_function_decl)
-      && !user_defined_section_attribute)
-    rest_of_handle_partition_blocks ();
-
-  if (optimize > 0 && flag_regmove)
-    rest_of_handle_regmove ();
-
-  /* Do unconditional splitting before register allocation to allow machine
-     description to add extra information not needed previously.  */
-  split_all_insns (1);
-
-#ifdef OPTIMIZE_MODE_SWITCHING
-  rest_of_handle_mode_switching ();
-#endif
-
-  /* Any of the several passes since flow1 will have munged register
-     lifetime data a bit.  We need it to be up to date for scheduling
-     (see handling of reg_known_equiv in init_alias_analysis).  */
-  recompute_reg_usage ();
-
-#ifdef INSN_SCHEDULING
-  if (optimize > 0 && flag_modulo_sched)
-    rest_of_handle_sms ();
-
-  if (flag_schedule_insns)
-    rest_of_handle_sched ();
-#endif
-
-  /* Determine if the current function is a leaf before running reload
-     since this can impact optimizations done by the prologue and
-     epilogue thus changing register elimination offsets.  */
-  current_function_is_leaf = leaf_function_p ();
-
-  if (rest_of_handle_old_regalloc ())
-    goto exit_rest_of_compilation;
-
-  if (optimize > 0)
-    rest_of_handle_postreload ();
-
-  if (optimize > 0 && flag_gcse_after_reload)
-    rest_of_handle_gcse2 ();
-
-  rest_of_handle_flow2 ();
-
-#ifdef HAVE_peephole2
-  if (optimize > 0 && flag_peephole2)
-    rest_of_handle_peephole2 ();
-#endif
-
-  if (optimize > 0)
-    rest_of_handle_if_after_reload ();
-
-  if (optimize > 0)
-    {
-      if (flag_rename_registers || flag_cprop_registers)
-	rest_of_handle_regrename ();
-
-      rest_of_handle_reorder_blocks ();
-    }
-
-  if (flag_branch_target_load_optimize2)
-    rest_of_handle_branch_target_load_optimize ();
-
-#ifdef LEAF_REGISTERS
-  current_function_uses_only_leaf_regs
-    = optimize > 0 && only_leaf_regs_used () && leaf_function_p ();
-#endif
-
-#ifdef INSN_SCHEDULING
-  if (optimize > 0 && flag_schedule_insns_after_reload)
-    rest_of_handle_sched2 ();
-#endif
-
-#ifdef STACK_REGS
-  rest_of_handle_stack_regs ();
-#endif
-
-  compute_alignments ();
-
-  /* Aggressively duplicate basic blocks ending in computed gotos to the
-     tails of their predecessors, unless we are optimizing for size.  */
-  if (flag_expensive_optimizations && !optimize_size)
-    duplicate_computed_gotos ();
-
-  if (flag_var_tracking)
-    rest_of_handle_variable_tracking ();
-
-  /* CFG is no longer maintained up-to-date.  */
-  free_bb_for_insn ();
-
-  if (targetm.machine_dependent_reorg != 0)
-    rest_of_handle_machine_reorg ();
-
-  purge_line_number_notes (get_insns ());
-  cleanup_barriers ();
-
-#ifdef DELAY_SLOTS
-  if (flag_delayed_branch)
-    rest_of_handle_delay_slots ();
-#endif
-
-#if defined (HAVE_ATTR_length) && !defined (STACK_REGS)
-  timevar_push (TV_SHORTEN_BRANCH);
-  split_all_insns_noflow ();
-  timevar_pop (TV_SHORTEN_BRANCH);
-#endif
-
-  convert_to_eh_region_ranges ();
-
-  rest_of_handle_shorten_branches ();
-
-  set_nothrow_function_flags ();
-
-  rest_of_handle_final ();
-
- exit_rest_of_compilation:
-
-  rest_of_clean_state ();
-}
-#endif
-/* APPLE LOCAL end MERGE FIXME 4708086 - 4095567 4229407 4120689 */
-
 /* Same as execute_pass_list but assume that subpasses of IPA passes
    are local passes.  */
 void

Modified: llvm-gcc-4.2/trunk/gcc/print-rtl.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/print-rtl.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/print-rtl.c (original)
+++ llvm-gcc-4.2/trunk/gcc/print-rtl.c Thu Nov  8 20:30:15 2007
@@ -610,6 +610,11 @@
 	  case LABEL_WEAK_ENTRY: fputs (" [weak entry]", outfile); break;
 	  default: gcc_unreachable ();
 	}
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      if (LABEL_ALIGN_LOG (in_rtx) > 0)
+	fprintf (outfile, " [log_align %u skip %u]", LABEL_ALIGN_LOG (in_rtx),
+		 LABEL_MAX_SKIP (in_rtx));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       break;
 
     default:

Modified: llvm-gcc-4.2/trunk/gcc/recog.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/recog.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/recog.c (original)
+++ llvm-gcc-4.2/trunk/gcc/recog.c Thu Nov  8 20:30:15 2007
@@ -960,7 +960,8 @@
   if (CONSTANT_P (op))
     return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode
 	     || mode == VOIDmode)
-	    && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
+	    /* APPLE LOCAL ARM -mdynamic-no-pic support */
+	    && LEGITIMATE_INDIRECT_OPERAND_P (op)
 	    && LEGITIMATE_CONSTANT_P (op));
 
   /* Except for certain constants with VOIDmode, already checked for,
@@ -1137,7 +1138,8 @@
   return (CONSTANT_P (op)
 	  && (GET_MODE (op) == mode || mode == VOIDmode
 	      || GET_MODE (op) == VOIDmode)
-	  && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
+	  /* APPLE LOCAL ARM -mdynamic-no-pic support */
+	  && LEGITIMATE_INDIRECT_OPERAND_P (op)
 	  && LEGITIMATE_CONSTANT_P (op));
 }
 
@@ -1203,7 +1205,8 @@
 
       return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode
 	       || mode == VOIDmode)
-	      && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
+	      /* APPLE LOCAL ARM -mdynamic-no-pic support */
+	      && LEGITIMATE_INDIRECT_OPERAND_P (op)
 	      && LEGITIMATE_CONSTANT_P (op));
     }
 
@@ -1720,7 +1723,8 @@
 	  /* Fall through.  */
 
 	case 'i':
-	  if (CONSTANT_P (op) && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op)))
+	  /* APPLE LOCAL ARM -mdynamic-no-pic support */
+	  if (CONSTANT_P (op) && LEGITIMATE_INDIRECT_OPERAND_P (op))
 	    result = 1;
 	  break;
 

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/regclass.c (original)
+++ llvm-gcc-4.2/trunk/gcc/regclass.c Thu Nov  8 20:30:15 2007
@@ -1628,7 +1628,8 @@
 		    break;
 		case 'i':
 		  if (CONSTANT_P (op)
-		      && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op)))
+		      /* APPLE LOCAL ARM -mdynamic-no-pic support */
+		      && LEGITIMATE_INDIRECT_OPERAND_P (op))
 		    win = 1;
 		  break;
 
@@ -1659,7 +1660,8 @@
 		case 'g':
 		  if (MEM_P (op)
 		      || (CONSTANT_P (op)
-			  && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))))
+			  /* APPLE LOCAL ARM -mdynamic-no-pic support */
+			  && LEGITIMATE_INDIRECT_OPERAND_P (op)))
 		    win = 1;
 		  allows_mem[i] = 1;
 		case 'r':

Modified: llvm-gcc-4.2/trunk/gcc/reload.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/reload.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/reload.c (original)
+++ llvm-gcc-4.2/trunk/gcc/reload.c Thu Nov  8 20:30:15 2007
@@ -3310,7 +3310,8 @@
 		  break;
 	      case 'i':
 		if (CONSTANT_P (operand)
-		    && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (operand)))
+		    /* APPLE LOCAL ARM -mdynamic-no-pic support */
+		    && LEGITIMATE_INDIRECT_OPERAND_P (operand))
 		  win = 1;
 		break;
 
@@ -3347,8 +3348,8 @@
 		    /* A SCRATCH is not a valid operand.  */
 		    && GET_CODE (operand) != SCRATCH
 		    && (! CONSTANT_P (operand)
-			|| ! flag_pic
-			|| LEGITIMATE_PIC_OPERAND_P (operand))
+			/* APPLE LOCAL ARM -mdynamic-no-pic support */
+			|| LEGITIMATE_INDIRECT_OPERAND_P (operand))
 		    && (GENERAL_REGS == ALL_REGS
 			|| !REG_P (operand)
 			|| (REGNO (operand) >= FIRST_PSEUDO_REGISTER

Modified: llvm-gcc-4.2/trunk/gcc/reload1.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/reload1.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/reload1.c (original)
+++ llvm-gcc-4.2/trunk/gcc/reload1.c Thu Nov  8 20:30:15 2007
@@ -766,13 +766,15 @@
 	  if (i <= LAST_VIRTUAL_REGISTER)
 	    continue;
 
+	  /* APPLE LOCAL begin ARM -mdynamic-no-pic support */
 	  if (! function_invariant_p (x)
 	      || ! flag_pic
 	      /* A function invariant is often CONSTANT_P but may
 		 include a register.  We promise to only pass
-		 CONSTANT_P objects to LEGITIMATE_PIC_OPERAND_P.  */
+		 CONSTANT_P objects to LEGITIMATE_INDIRECT_OPERAND_P.  */
 	      || (CONSTANT_P (x)
-		  && LEGITIMATE_PIC_OPERAND_P (x)))
+		  && LEGITIMATE_INDIRECT_OPERAND_P (x)))
+	  /* APPLE LOCAL end ARM -mdynamic-no-pic support */
 	    {
 	      /* It can happen that a REG_EQUIV note contains a MEM
 		 that is not a legitimate memory operand.  As later
@@ -3545,7 +3547,17 @@
   struct elim_table *ep;
 
   for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+/* APPLE LOCAL begin ARM prefer SP to FP */
+#ifdef ALLOW_ELIMINATION_TO_SP
+    /* Don't prevent elimination to SP -- on some targets it can be more
+       efficient than the FP.  For those cases where elimination to the SP
+       isn't valid (e.g., alloca present in function), CAN_ELIMINATE must
+       be specific enough to detect and disallow them.  */
+    if (0
+#else
     if ((ep->from == HARD_FRAME_POINTER_REGNUM && FRAME_POINTER_REQUIRED)
+#endif
+/* APPLE LOCAL end ARM prefer SP to FP */
 #ifdef ELIMINABLE_REGS
 	|| ! CAN_ELIMINATE (ep->from, ep->to)
 #endif
@@ -3595,6 +3607,16 @@
   for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
     {
       if (ep->can_eliminate && ep->from == FRAME_POINTER_REGNUM
+/* APPLE LOCAL begin ARM prefer SP to FP */
+#ifdef ALLOW_ELIMINATION_TO_SP
+	  /* Because we allow the FP to eliminate into SP, even when
+	     FRAME_POINTER_REQUIRED is 1, we can end up with the case
+	     that all instances of FP are removed but we still have
+	     FRAME_POINTER_REQUIRED.  In that case, don't allow
+	     frame_pointer_needed to be set to 0.  */
+	  && !FRAME_POINTER_REQUIRED
+#endif
+/* APPLE LOCAL end ARM prefer SP to FP */
 	  && ep->to != HARD_FRAME_POINTER_REGNUM)
 	frame_pointer_needed = 0;
 
@@ -3652,7 +3674,17 @@
       ep->to = ep1->to;
       ep->can_eliminate = ep->can_eliminate_previous
 	= (CAN_ELIMINATE (ep->from, ep->to)
+/* APPLE LOCAL begin ARM prefer SP to FP */
+#ifdef ALLOW_ELIMINATION_TO_SP
+	  /* Sometimes we do want to eliminate to the SP even when a FP
+	     is present, for performance benefits.  Note that this
+	     means that the target definition of CAN_ELIMIATE must
+	     be adequate to describe all allowable transformations.  */
+	  );
+#else
 	   && ! (ep->to == STACK_POINTER_REGNUM && frame_pointer_needed));
+#endif
+/* APPLE LOCAL end ARM prefer SP to FP */
     }
 #else
   reg_eliminate[0].from = reg_eliminate_1[0].from;

Modified: llvm-gcc-4.2/trunk/gcc/rtl.def
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/rtl.def?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/rtl.def (original)
+++ llvm-gcc-4.2/trunk/gcc/rtl.def Thu Nov  8 20:30:15 2007
@@ -139,9 +139,13 @@
    4: is used in jump.c for the use-count of the label.
    5: is used in flow.c to point to the chain of label_ref's to this label.
    6: is a number that is unique in the entire compilation.
-   7: is the user-given name of the label, if any.  */
-DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00is", RTX_EXTRA)
+   APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+   7: is the user-given name of the label, if any.
+   8: is the alignment of the label, made up of two parts,
+      LABEL_ALIGNMENT and LABEL_MAX_SKIP.  */
+DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00isi", RTX_EXTRA)
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 #ifdef USE_MAPPED_LOCATION
 /* Say where in the code a source line starts, for symbol table's sake.
    Operand:

Modified: llvm-gcc-4.2/trunk/gcc/rtl.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/rtl.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/rtl.h (original)
+++ llvm-gcc-4.2/trunk/gcc/rtl.h Thu Nov  8 20:30:15 2007
@@ -914,6 +914,15 @@
    of LABEL_REFs that point at it, so unused labels can be deleted.  */
 #define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* The alignment of the label, as the log-base-2 of the alignment in bytes.  */
+#define LABEL_ALIGN_LOG(RTX) (XCUINT (RTX, 8, CODE_LABEL) & 0xFF)
+/* The maximum number of bytes to skip to achieve that alignment.  */
+#define LABEL_MAX_SKIP(RTX) (XCUINT (RTX, 8, CODE_LABEL) >> 8)
+#define SET_LABEL_ALIGN(RTX, ALIGN, MAX_SKIP) \
+  (XCUINT (RTX, 8, CODE_LABEL) = (ALIGN) | ((MAX_SKIP) << 8))
+
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 /* Labels carry a two-bit field composed of the ->jump and ->call
    bits.  This field indicates whether the label is an alternate
    entry point, and if so, what kind.  */

Modified: llvm-gcc-4.2/trunk/gcc/stmt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/stmt.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/stmt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/stmt.c Thu Nov  8 20:30:15 2007
@@ -136,9 +136,19 @@
   if (!DECL_RTL_SET_P (label))
     {
       rtx r = gen_label_rtx ();
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      unsigned align = DECL_ALIGN_UNIT (label);
+      int align_log2 = exact_log2 (align);
+      
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       SET_DECL_RTL (label, r);
       if (FORCED_LABEL (label) || DECL_NONLOCAL (label))
 	LABEL_PRESERVE_P (r) = 1;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+
+      if (align_log2 >= 0 && align_log2 <= 0xFF)
+	SET_LABEL_ALIGN (r, align_log2, align - 1);
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
     }
 
   return DECL_RTL (label);
@@ -194,11 +204,12 @@
 /* Specify the location in the RTL code of a label LABEL,
    which is a LABEL_DECL tree node.
 
-   This is used for the kind of label that the user can jump to with a
-   goto statement, and for alternatives of a switch or case statement.
-   RTL labels generated for loops and conditionals don't go through here;
-   they are generated directly at the RTL level, by other functions below.
+   APPLE LOCAL begin for-fsf-4_4 3274130 5295549
+   This is used for those labels created by the front-end that survive
+   through CFG generation, including all user labels.  (Some labels
+   are removed by cleanup_dead_labels in tree-cfg.c.)
 
+   APPLE LOCAL end for-fsf-4_4 3274130 5295549
    Note that this has nothing to do with defining label *names*.
    Languages vary in how they do that and what that even means.  */
 

Modified: llvm-gcc-4.2/trunk/gcc/stor-layout.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/stor-layout.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/stor-layout.c (original)
+++ llvm-gcc-4.2/trunk/gcc/stor-layout.c Thu Nov  8 20:30:15 2007
@@ -70,15 +70,6 @@
 /* Show that REFERENCE_TYPES are internal and should be Pmode.  Called only
    by front end.  */
 
-/* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff  */
-/* Keep track of whether we are laying out the first declared member
-   of a C++ class.  We need this flag to handle the case of classes
-   with v-tables where the test to see if the offset in the record
-   is zero is not sufficient to determine if we are dealing with the
-   first declared member.  */
-int darwin_align_is_first_member_of_class = 0;
-/* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff  */
-
 void
 internal_reference_types (void)
 {
@@ -450,10 +441,9 @@
 	    = MIN (DECL_ALIGN (decl), (unsigned) BIGGEST_FIELD_ALIGNMENT);
 #endif
 #ifdef ADJUST_FIELD_ALIGN
-      /* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff */
-	  DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl),
-						  known_align == 0);
-      /* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff */
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+	  DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl));
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 #endif
 	}
 
@@ -556,6 +546,11 @@
   rli->offset_align = MAX (rli->record_align, BIGGEST_ALIGNMENT);
 
 #ifdef STRUCTURE_SIZE_BOUNDARY
+/* APPLE LOCAL begin ARM Macintosh alignment */
+#ifdef PEG_ALIGN_FOR_MAC68K
+  if (! OPTION_ALIGN_MAC68K)
+#endif
+/* APPLE LOCAL end ARM Macintosh alignment */
   /* Packed structures don't need to have minimum size.  */
   if (! TYPE_PACKED (t))
     rli->record_align = MAX (rli->record_align, (unsigned) STRUCTURE_SIZE_BOUNDARY);
@@ -713,17 +708,10 @@
   /* APPLE LOCAL begin Macintosh alignment 2002-5-24 --ff */
 #ifdef ADJUST_FIELD_ALIGN
   if (! user_align && TREE_CODE (rli->t) == RECORD_TYPE)
-    /* The third argument to ADJUST_FIELD_ALIGN indicates whether
-       we are dealing with the first field of the structure.  
-       Only adjust the alignment for structs. For unions, every
-       field is the 'first' field and thus holds to its
-       natural alignment. Alignment of union is later deterimined 
-       by the maximum alignment among all its fields. */
     desired_align = 
-      ADJUST_FIELD_ALIGN (field, desired_align,
-			  (darwin_align_is_first_member_of_class 
-			   || (integer_zerop (rli->offset)
-			       && integer_zerop (rli->bitpos))));
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+      ADJUST_FIELD_ALIGN (field, desired_align);
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 #endif
   /* APPLE LOCAL end Macintosh alignment 2002-5-24 --ff */
 
@@ -766,12 +754,9 @@
 
 #ifdef ADJUST_FIELD_ALIGN
 	  if (! TYPE_USER_ALIGN (type))
-	    /* APPLE LOCAL begin Macintosh alignment */
-	    type_align = ADJUST_FIELD_ALIGN (field, type_align,
-					     (darwin_align_is_first_member_of_class 
-					      || (integer_zerop (rli->offset)
-						  && integer_zerop (rli->bitpos))));
-	  /* APPLE LOCAL end Macintosh alignment */
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+	    type_align = ADJUST_FIELD_ALIGN (field, type_align);
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 #endif
 
 	  /* Targets might chose to handle unnamed and hence possibly
@@ -1023,12 +1008,9 @@
 
 #ifdef ADJUST_FIELD_ALIGN
       if (! TYPE_USER_ALIGN (type))
-	/* APPLE LOCAL begin Macintosh alignment */
-	type_align = ADJUST_FIELD_ALIGN (field, type_align,
-					 (darwin_align_is_first_member_of_class 
-					  || (integer_zerop (rli->offset)
-					      && integer_zerop (rli->bitpos))));
-      /* APPLE LOCAL end Macintosh alignment */
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+	type_align = ADJUST_FIELD_ALIGN (field, type_align);
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 #endif
 
       /* A bit field may not span more units of alignment of its type
@@ -1060,12 +1042,9 @@
 
 #ifdef ADJUST_FIELD_ALIGN
       if (! TYPE_USER_ALIGN (type))
-	/* APPLE LOCAL begin Macintosh alignment */
-	type_align = ADJUST_FIELD_ALIGN (field, type_align,
-					 (darwin_align_is_first_member_of_class 
-					  || (integer_zerop (rli->offset)
-					      && integer_zerop (rli->bitpos))));
-      /* APPLE LOCAL end Macintosh alignment */
+/* APPLE LOCAL begin mainline 2006-10-31 PR 23067, radar 4869885 */
+	type_align = ADJUST_FIELD_ALIGN (field, type_align);
+/* APPLE LOCAL end mainline 2006-10-31 PR 23067, radar 4869885 */
 #endif
 
       if (maximum_field_alignment != 0)
@@ -1160,7 +1139,7 @@
 				       TYPE_SIZE (type),
 				       bitsize_int (rli->remaining_in_alignment)));
 		      rli->prev_field = field;
-		      /* MERGE FIXME: audit for correctness wrt:
+		      /* MERGE FIXME 5416334 audit for correctness wrt:
 
 			 2006-07-15  Kaz Kojima  <kkojima at gcc.gnu.org>
 

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/stub-objc.c (original)
+++ llvm-gcc-4.2/trunk/gcc/stub-objc.c Thu Nov  8 20:30:15 2007
@@ -150,15 +150,18 @@
 }
 
 void
-objc_declare_protocols (tree ARG_UNUSED (list))
+/* APPLE LOCAL begin radar 4947311 - protocol attributes */
+objc_declare_protocols (tree ARG_UNUSED (list), tree ARG_UNUSED (attributes))
 {
 }
 
 void
 objc_start_protocol (tree ARG_UNUSED (proto),
-		     tree ARG_UNUSED (protorefs))
+		     tree ARG_UNUSED (protorefs),
+		     tree ARG_UNUSED (attributes))
 {
 }
+/* APPLE LOCAL end radar 4947311 - protocol attributes */
 
 void
 objc_start_class_interface (tree ARG_UNUSED (name),
@@ -494,13 +497,6 @@
 }
 /* APPLE LOCAL end radar 3803157 - objc attribute */
 
-/* APPLE LOCAL begin radar 4533974 - ObjC new protocol */
-void 
-objc_protocol_implementation (tree ARG_UNUSED (protolist))
-{
-  return;
-}
-/* APPLE LOCAL end radar 4533974 - ObjC new protocol */
 /* APPLE LOCAL begin radar 4708210 (for_objc_collection in 4.2) */
 void
 objc_finish_foreach_loop (location_t ARG_UNUSED (location), tree ARG_UNUSED (cond), 

Modified: llvm-gcc-4.2/trunk/gcc/target-def.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/target-def.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/target-def.h (original)
+++ llvm-gcc-4.2/trunk/gcc/target-def.h Thu Nov  8 20:30:15 2007
@@ -547,6 +547,10 @@
 #define TARGET_FUNCTION_VALUE default_function_value
 #define TARGET_INTERNAL_ARG_POINTER default_internal_arg_pointer
 
+/* APPLE LOCAL begin radar 5155743, mainline candidate */
+#define TARGET_HAVE_DYNAMIC_STACK_SPACE false
+/* APPLE LOCAL end radar 5155743, mainline candidate */
+
 #define TARGET_CALLS {						\
    TARGET_PROMOTE_FUNCTION_ARGS,				\
    TARGET_PROMOTE_FUNCTION_RETURN,				\
@@ -763,7 +767,10 @@
   TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME,	\
   TARGET_HANDLE_PRAGMA_EXTERN_PREFIX,		\
   TARGET_RELAXED_ORDERING,			\
-  TARGET_ARM_EABI_UNWINDER			\
+  /* APPLE LOCAL begin radar 5155743, mainline candidate */	\
+  TARGET_ARM_EABI_UNWINDER,			\
+  TARGET_HAVE_DYNAMIC_STACK_SPACE		\
+  /* APPLE LOCAL end radar 5155743, mainline candidate */	\
 }
 
 #include "hooks.h"

Modified: llvm-gcc-4.2/trunk/gcc/target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/target.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/target.h Thu Nov  8 20:30:15 2007
@@ -882,6 +882,9 @@
    */
   bool arm_eabi_unwinder;
 
+/* APPLE LOCAL begin radar 5155743, mainline candidate */
+  bool have_dynamic_stack_space;
+/* APPLE LOCAL end radar 5155743, mainline candidate */
   /* Leave the boolean fields at the end.  */
 };
 

Modified: llvm-gcc-4.2/trunk/gcc/toplev.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/toplev.c (original)
+++ llvm-gcc-4.2/trunk/gcc/toplev.c Thu Nov  8 20:30:15 2007
@@ -113,8 +113,6 @@
 static void finalize (void);
 
 static void crash_signal (int) ATTRIBUTE_NORETURN;
-/* APPLE LOCAL interrupt signal handler (radar 2941633)  --ilr */
-static void interrupt_signal (int) ATTRIBUTE_NORETURN;
 static void setup_core_dumping (void);
 static void compile_file (void);
 
@@ -605,30 +603,6 @@
   return t;
 }
 
-/* APPLE LOCAL begin interrupt signal handler (radar 2941633)  --ilr */
-/* If the compilation is interrupted do some cleanup. Any files created
-   by the compilation are deleted.  The compilation is terminated from
-   here.  */
-static void
-interrupt_signal (int signo ATTRIBUTE_UNUSED)
-{
-  /* Close the dump files.  */
-  if (flag_gen_aux_info)
-    {
-      fclose (aux_info_file);
-      unlink (aux_info_file_name);
-    }
-  if (asm_out_file)
-    {
-      fclose (asm_out_file);
-      if (asm_file_name && *asm_file_name)
-      	unlink (asm_file_name);
-    }
-
-  exit (FATAL_EXIT_CODE);
-}
-/* APPLE LOCAL end interrupt signal handler */
-
 /* Return the logarithm of X, base 2, considering X unsigned,
    if X is a power of 2.  Otherwise, returns -1.  */
 
@@ -1012,15 +986,15 @@
 /* APPLE LOCAL begin "unavailable" attribute (radar 2809697) --ilr */
 /* Warn about a use of an identifier which was marked deprecated.  */
 void
-warn_unavailable_use (tree node)
+error_unavailable_use (tree node)
 {
   if (node == 0)
     return;
 
   if (DECL_P (node))
-    warning (0, "%qs is unavailable (declared at %s:%d)",
-	     IDENTIFIER_POINTER (DECL_NAME (node)),
-	     DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+    error ("%qs is unavailable (declared at %s:%d)",
+	   IDENTIFIER_POINTER (DECL_NAME (node)),
+	   DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
   else if (TYPE_P (node))
     {
       const char *what = NULL;
@@ -1035,16 +1009,16 @@
       if (what)
 	{
 	  if (decl)
-	    warning (0, "%qs is unavailable (declared at %s:%d)", what,
-		     DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+	    error ("%qs is unavailable (declared at %s:%d)", what,
+		   DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
 	  else
-	    warning (0, "%qs is unavailable", what);
+	    error ("%qs is unavailable", what);
 	}
       else if (decl)
-	warning (0, "type is unavailable (declared at %s:%d)",
-		 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+	error ("type is unavailable (declared at %s:%d)",
+	       DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
       else
-	warning (0, "type is unavailable");
+	error ("type is unavailable");
     }
 }
 /* APPLE LOCAL end "unavailable" attribute (radar 2809697) --ilr */
@@ -1695,13 +1669,6 @@
 #if defined SIGIOT && (!defined SIGABRT || SIGABRT != SIGIOT)
   signal (SIGIOT, crash_signal);
 #endif
-  /* APPLE LOCAL begin interrupt signal handler (radar 2941633)  --ilr */
-  /* Handle compilation interrupts.  */
-  if (signal (SIGINT, SIG_IGN) != SIG_IGN)
-    signal (SIGINT, interrupt_signal);
-  if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
-    signal (SIGTERM, interrupt_signal);
-  /* APPLE LOCAL end interrupt signal handler */
 #ifdef SIGFPE
   signal (SIGFPE, crash_signal);
 #endif

Modified: llvm-gcc-4.2/trunk/gcc/toplev.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/toplev.h (original)
+++ llvm-gcc-4.2/trunk/gcc/toplev.h Thu Nov  8 20:30:15 2007
@@ -80,7 +80,7 @@
 extern void warning_for_asm (rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
 extern void warn_deprecated_use (tree);
 /* APPLE LOCAL "unavailable" attribute (radar 2809697) */
-extern void warn_unavailable_use (tree);
+extern void error_unavailable_use (tree);
 
 #ifdef BUFSIZ
 extern void output_quoted_string	(FILE *, const char *);

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-cfg.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-cfg.c Thu Nov  8 20:30:15 2007
@@ -1051,9 +1051,12 @@
 
   for_each_eh_region (update_eh_label);
 
-  /* Finally, purge dead labels.  All user-defined labels and labels that
-     can be the target of non-local gotos and labels which have their
-     address taken are preserved.  */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+  /* Finally, purge dead labels.  All user-defined labels, labels that
+     can be the target of non-local gotos, labels which have their
+     address taken and labels which have attributes or alignment are
+     preserved.  */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   FOR_EACH_BB (bb)
     {
       block_stmt_iterator i;
@@ -1073,6 +1076,10 @@
 
 	  if (label == label_for_this_bb
 	      || ! DECL_ARTIFICIAL (label)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	      || DECL_ATTRIBUTES (label)
+	      || DECL_USER_ALIGN (label)
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	      || DECL_NONLOCAL (label)
 	      || FORCED_LABEL (label))
 	    bsi_next (&i);

Modified: llvm-gcc-4.2/trunk/gcc/tree-flow.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-flow.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-flow.h (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-flow.h Thu Nov  8 20:30:15 2007
@@ -807,9 +807,6 @@
 
 /* In tree-ssa-loop*.c  */
 
-/* APPLE LOCAL begin loops-to-memset  */
-void tree_ssa_memset (struct loops *);
-/* APPLE LOCAL end loops-to-memset  */
 void tree_ssa_lim (struct loops *);
 unsigned int tree_ssa_unswitch_loops (struct loops *);
 unsigned int canonicalize_induction_variables (struct loops *);

Modified: llvm-gcc-4.2/trunk/gcc/tree-pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-pass.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-pass.h (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-pass.h Thu Nov  8 20:30:15 2007
@@ -244,9 +244,6 @@
 extern struct tree_opt_pass pass_tree_loop;
 extern struct tree_opt_pass pass_tree_loop_init;
 extern struct tree_opt_pass pass_lim;
-/* APPLE LOCAL begin loops-to-memset */
-extern struct tree_opt_pass pass_memset;
-/* APPLE LOCAL end loops-to-memset */
 extern struct tree_opt_pass pass_tree_unswitch;
 extern struct tree_opt_pass pass_iv_canon;
 extern struct tree_opt_pass pass_scev_cprop;

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-sra.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-sra.c Thu Nov  8 20:30:15 2007
@@ -1561,7 +1561,6 @@
 
       /* Groups behave like their parent.  */
       for (c = elt->groups; c; c = c->sibling)
-	/* APPLE LOCAL MERGE FIXME like this? */
 	/* APPLE LOCAL 4158356 PR 22156/22157 */
 	c->how_to_copy = how_to_copy;
 

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-memset.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-ssa-loop-memset.c Thu Nov  8 20:30:15 2007
@@ -1,738 +0,0 @@
-/* APPLE LOCAL file loops-to-memset */
-/*  Loops to memset.
-    Copyright (C) 2004 Free Software Foundation, Inc.
-    Contributed by Andrew Pinski <apinski at apple.com>.
-  
-    This file is part of GCC.
-    
-    GCC is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2, or (at your option) any
-    later version.
-    
-    GCC is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-    
-    You should have received a copy of the GNU General Public License
-    along with GCC; see the file COPYING.  If not, write to the Free
-    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-    02111-1307, USA.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "ggc.h"
-#include "tree.h"
-#include "rtl.h"
-#include "tm_p.h"
-#include "hard-reg-set.h"
-#include "basic-block.h"
-#include "output.h"
-#include "diagnostic.h"
-#include "tree-flow.h"
-#include "tree-dump.h"
-#include "timevar.h"
-#include "cfgloop.h"
-#include "domwalk.h"
-#include "params.h"
-#include "tree-pass.h"
-#include "flags.h"
-#include "tree-data-ref.h"
-#include "tree-scalar-evolution.h"
-#include "tree-chrec.h"
-#include "tree-vectorizer.h"
-
-/* MERGE FIXME 4709514 */
-#if 0
-static bool memset_debug_stats (struct loop *loop);
-static bool memset_debug_details (struct loop *loop);
-
-/* Function memset_analyze_data_refs.
-
-   Find all the data references in the loop.
-
-   Handle INDIRECT_REFs and one dimensional ARRAY_REFs 
-   which base is really an array (not a pointer).
-
-   This is different from vect_analyze_data_refs in tree-vectorizer.c as
-   we handle unaligned data stores and we only handle data stores.  */
-
-static bool
-memset_analyze_data_refs (loop_vec_info loop_vinfo)
-{
-  struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
-  basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
-  int nbbs = loop->num_nodes;
-  block_stmt_iterator si;
-  int j;
-  struct data_reference *dr;
-  
-  if (memset_debug_details (NULL))
-    fprintf (dump_file, "\n<<memset_analyze_data_refs>>\n");
-  
-  for (j = 0; j < nbbs; j++)
-    {
-      basic_block bb = bbs[j];
-      for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
-	{
-	  tree stmt = bsi_stmt (si);
-	  stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-	  v_may_def_optype v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
-	  v_must_def_optype v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
-	  vuse_optype vuses = STMT_VUSE_OPS (stmt);
-	  varray_type *datarefs = NULL;
-	  int nvuses, nv_may_defs, nv_must_defs;
-	  tree memref = NULL;
-	  tree array_base;
-	  tree symbl;
-	  
-	  /* Assumption: there exists a data-ref in stmt, if and only if 
-	     it has vuses/vdefs.  */
-	  
-	  if (!vuses && !v_may_defs && !v_must_defs)
-	    continue;
-	  
-	  nvuses = NUM_VUSES (vuses);
-	  nv_may_defs = NUM_V_MAY_DEFS (v_may_defs);
-	  nv_must_defs = NUM_V_MUST_DEFS (v_must_defs);
-	  
-	  if (nvuses && (nv_may_defs || nv_must_defs))
-	    {
-	      if (memset_debug_details (NULL))
-		{
-		  fprintf (dump_file, "unexpected vdefs and vuses in stmt: ");
-		  print_generic_expr (dump_file, stmt, TDF_SLIM);
-		}
-	      return false;
-	    }
-	  
-	  if (TREE_CODE (stmt) != MODIFY_EXPR)
-	    {
-	      if (memset_debug_details (NULL))
-		{
-		  fprintf (dump_file, "unexpected vops in stmt: ");
-		  print_generic_expr (dump_file, stmt, TDF_SLIM);
-		}
-	      return false;
-	    }
-	  
-	  if (vuses)
-	    {
-	      if (memset_debug_details (NULL))
-		{
-		  fprintf (dump_file, "Memory access in the loop: ");
-		  print_generic_expr (dump_file, stmt, TDF_SLIM);
-		}
-	      return false;
-	    } 
-	  else /* vdefs */
-	    {
-	      memref = TREE_OPERAND (stmt, 0);
-	      datarefs = &(LOOP_VINFO_DATAREF_WRITES (loop_vinfo));
-	    }
-	  
-	  if (TREE_CODE (memref) == INDIRECT_REF)
-            {
-	      /* MERGE FIXME 4709514 */
-	      abort ();
-	      /* dr = vect_analyze_pointer_ref_access (memref, stmt, false); */
-	      if (! dr)
-		return false; 
-	      symbl = DR_BASE_NAME (dr);	
-            }
-	  else if (TREE_CODE (memref) == ARRAY_REF)
-	    {
-	      tree base;		
-	      array_base = TREE_OPERAND (memref, 0);
-	      
-	      if (TREE_CODE (array_base) == ARRAY_REF)
-                {
-		  if (memset_debug_stats (loop) || memset_debug_details (loop))
-		    {
-		      fprintf (dump_file, 
-			       "not vectorized: multi-dimensional array.");
-		      print_generic_expr (dump_file, stmt, TDF_SLIM);
-		    }
-		  return false;
-                }
-	      
-	      dr = analyze_array (stmt, memref, false);
-	      
-	      /* Find the relevant symbol for aliasing purposes.  */	
-	      base = DR_BASE_NAME (dr);
-	      switch (TREE_CODE (base))	
-		{
-		case VAR_DECL:
-		  symbl = base;
-		  break;
-		default:
-		  if (memset_debug_stats (loop) 
-		      || memset_debug_details (loop))
-		    {
-		      fprintf (dump_file,
-			       "not transformed: unhandled struct/class field access ");
-		      print_generic_expr (dump_file, stmt, TDF_SLIM);
-		    }
-		  return false;
-		} /* switch */
-	    }
-	  else
-	    {
-	      if (memset_debug_stats (loop) || memset_debug_details (loop))
-		{
-		  fprintf (dump_file, "not transformed: unhandled data ref: ");
-		  print_generic_expr (dump_file, stmt, TDF_SLIM);
-		}
-	      return false;
-	    }
-		
-	  /* Find and record the memtag assigned to this data-ref.  */
-	  if (TREE_CODE (symbl) == VAR_DECL 
-	      || (TREE_CODE (symbl) == COMPONENT_REF 
-		  && TREE_CODE (TREE_OPERAND (symbl, 0)) == VAR_DECL))
-	    STMT_VINFO_MEMTAG (stmt_info) = symbl;
-	  else if (TREE_CODE (symbl) == SSA_NAME)
-	    {
-	      tree tag;
-	      symbl = SSA_NAME_VAR (symbl);
-	      tag = get_var_ann (symbl)->type_mem_tag;
-	      if (!tag)
-		{
-		  tree ptr = TREE_OPERAND (memref, 0);
-		  if (TREE_CODE (ptr) == SSA_NAME)
-		    tag = get_var_ann (SSA_NAME_VAR (ptr))->type_mem_tag;
-		}
-	      if (!tag)
-		{
-		  if (memset_debug_stats (loop) || memset_debug_details (loop))
-		    fprintf (dump_file, "not vectorized: no memtag for ref.");
-		  return false;
-		}
-	      STMT_VINFO_MEMTAG (stmt_info) = tag;
-	    }
-	  else
-	    {
-	      if (memset_debug_stats (loop) || memset_debug_details (loop))
-		{
-		  fprintf (dump_file, "not vectorized: unsupported data-ref: ");
-		  print_generic_expr (dump_file, memref, TDF_SLIM);
-		}
-	      return false;
-	    }
-	  
-	  VARRAY_PUSH_GENERIC_PTR (*datarefs, dr);
-	  STMT_VINFO_DATA_REF (stmt_info) = dr;
-	}
-    }
-  
-  return true;
-}
-
-/* Function memset_analyze_loop_with_symbolic_num_of_iters.
-
-   In case the number of iterations that LOOP iterates in unknown at compile 
-   time, an epilog loop will be generated, and the loop induction variables 
-   (IVs) will be "advanced" to the value they are supposed to take just before 
-   the epilog loop. Here we check that the access function of the loop IVs
-   and the expression that represents the loop bound are simple enough.
-   These restrictions will be relxed in the future.  */
-
-static bool 
-memset_analyze_loop_with_symbolic_num_of_iters (tree niters, 
-					        struct loop *loop)
-{
-  basic_block bb = loop->header;
-  tree phi;
-
-  if (memset_debug_details (NULL))
-    fprintf (dump_file, 
-	     "\n<<memset_analyze_loop_with_symbolic_num_of_iters>>\n");
-  
-  if (chrec_contains_undetermined (niters))
-    {
-      if (memset_debug_details (NULL))
-        fprintf (dump_file, "Infinite number of iterations.");
-      return false;
-    }
-
-  if (!niters)
-    {
-      if (memset_debug_details (NULL))
-        fprintf (dump_file, "niters is NULL pointer.");
-      return false;
-    }
-
-  if (memset_debug_details (NULL))
-    {
-      fprintf (dump_file, "Symbolic number of iterations is ");
-      print_generic_expr (dump_file, niters, TDF_DETAILS);
-    }
-   
-  /* Analyze phi functions of the loop header.  */
-
-  for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
-    {
-      tree access_fn = NULL;
-      tree evolution_part;
-
-      if (memset_debug_details (NULL))
-	{
-          fprintf (dump_file, "Analyze phi: ");
-          print_generic_expr (dump_file, phi, TDF_SLIM);
-	}
-
-      /* Skip virtual phi's. The data dependences that are associated with
-         virtual defs/uses (i.e., memory accesses) are analyzed elsewhere.  */
-
-      if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi))))
-	{
-	  if (memset_debug_details (NULL))
-	    fprintf (dump_file, "virtual phi. skip.");
-	  continue;
-	}
-
-      /* Analyze the evolution function.  */
-
-      access_fn = instantiate_parameters
-	(loop, analyze_scalar_evolution (loop, PHI_RESULT (phi)));
-
-      if (!access_fn)
-	{
-	  if (memset_debug_details (NULL))
-	    fprintf (dump_file, "No Access function.");
-	  return false;
-	}
-
-      if (memset_debug_details (NULL))
-        {
-	  fprintf (dump_file, "Access function of PHI: ");
-	  print_generic_expr (dump_file, access_fn, TDF_SLIM);
-        }
-
-      evolution_part = evolution_part_in_loop_num (access_fn, loop->num);
-      
-      if (evolution_part == NULL_TREE)
-	return false;
-  
-      /* FORNOW: We do not transform initial conditions of IVs 
-	 which evolution functions are a polynomial of degree >= 2.  */
-
-      if (tree_is_chrec (evolution_part))
-	return false;  
-    }
-
-  return  true;
-}
-
-
-/* Function debug_loop_details.
-
-   For memset debug dumps.  */
-
-static bool
-memset_debug_details (struct loop *loop)
-{
-   basic_block bb;
-   block_stmt_iterator si;
-   tree node = NULL_TREE;
-
-  if (!dump_file || !(dump_flags & TDF_DETAILS))
-    return false;
-
-  if (!loop)
-    {
-      fprintf (dump_file, "\n");
-      return true;
-    }
-
-  if (!loop->header)
-    return false;
-
-  bb = loop->header;
-
-  for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
-    {
-      node = bsi_stmt (si);
-      if (node && EXPR_P (node) && EXPR_LOCUS (node))
-	break;
-    }
-
-  if (node && EXPR_P (node) && EXPR_LOCUS (node)
-      && EXPR_FILENAME (node) && EXPR_LINENO (node))
-    {
-      fprintf (dump_file, "\nloop at %s:%d: ", 
-               EXPR_FILENAME (node), EXPR_LINENO (node));
-      return true;
-    }
-
-  return false;
-}
-
-/* Function debug_loop_stats.
-
-   For vectorization statistics dumps.  */
-
-static bool
-memset_debug_stats (struct loop *loop)
-{
-  basic_block bb;
-  block_stmt_iterator si;
-  tree node = NULL_TREE;
-
-  if (!dump_file || !(dump_flags & TDF_STATS))
-    return false;
-
-  if (!loop)
-    {
-      fprintf (dump_file, "\n");
-      return true;
-    }
-
-  if (!loop->header)
-    return false;
-
-  bb = loop->header;
-
-  for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
-    {
-      node = bsi_stmt (si);
-      if (node && EXPR_P (node) && EXPR_LOCUS (node))
-        break;
-    }
-
-  if (node && EXPR_P (node) && EXPR_LOCUS (node) 
-      && EXPR_FILENAME (node) && EXPR_LINENO (node))
-    {
-      fprintf (dump_file, "\nloop at %s:%d: ", 
-	EXPR_FILENAME (node), EXPR_LINENO (node));
-      return true;
-    }
-
-  return false;
-}
-
-/* Function memset_analyze_loop_form.
-
-   Verify the following restrictions:
-   - it's an inner-most loop
-   - number of BBs = 2 (which are the loop header and the latch)
-   - the loop has a pre-header
-   - the loop has a single entry and exit
-   - the loop exit condition is simple enough, and the number of iterations
-     can be analyzed (a countable loop).
-
-   This differs from vect_analyze_loop_form by we handle non constant
-   interations.  */
-
-static loop_vec_info
-memset_analyze_loop_form (struct loop *loop)
-{
-  loop_vec_info loop_vinfo;
-  tree loop_cond;
-  tree number_of_iterations = NULL_TREE;
-
-  if (memset_debug_details (loop))
-    fprintf (dump_file, "\n<<memset_analyze_loop_form>>\n");
-
-  if (loop->level > 1		/* FORNOW: inner-most loop  */
-      || loop->num_exits > 1 || loop->num_entries > 1 || loop->num_nodes != 2
-      || !loop->pre_header || !loop->header || !loop->latch)
-    {
-      if (memset_debug_stats (loop) || memset_debug_details (loop))	
-	{
-	  fprintf (dump_file, "not vectorized: bad loop form.\n");
-	  if (loop->level > 1)
-	    fprintf (dump_file, "nested loop.\n");
-	  else if (loop->num_exits > 1 || loop->num_entries > 1)
-	    fprintf (dump_file, "multiple entries or exits.\n");
-	  else if (loop->num_nodes != 2 || !loop->header || !loop->latch)
-	    fprintf (dump_file, "too many BBs in loop.\n");
-	  else if (!loop->pre_header)
-	    fprintf (dump_file, "no pre-header BB for loop.\n");
-	}
-      
-      return NULL;
-    }
-
-  /* We assume that the loop exit condition is at the end of the loop. i.e,
-     that the loop is represented as a do-while (with a proper if-guard
-     before the loop if needed), where the loop header contains all the
-     executable statements, and the latch is empty.  */
-  if (!empty_block_p (loop->latch))
-    {
-      if (memset_debug_stats (loop) || memset_debug_details (loop))     
-        fprintf (dump_file, "not vectorized: unexpectd loop form.");
-      return NULL;
-    }
-
-  if (empty_block_p (loop->header))
-    {
-      if (memset_debug_stats (loop) || memset_debug_details (loop))     
-        fprintf (dump_file, "not transformed: empty loop.");
-      return NULL;
-    }
-
-  loop_cond = vect_get_loop_niters (loop, &number_of_iterations);
-  if (!loop_cond)
-    {
-      if (memset_debug_stats (loop) || memset_debug_details (loop))
-	fprintf (dump_file, "not vectorized: complicated exit condition.\n");
-      return NULL;
-    }
-    
-  if (!number_of_iterations) 
-    {
-      if (memset_debug_stats (loop) || memset_debug_details (loop))
-	fprintf (dump_file, 
-		 "not vectorized: number of iterations cannot be computed.");
-      return NULL;
-    }
-
-  loop_vinfo = new_loop_vec_info (loop);
-  LOOP_VINFO_NITERS (loop_vinfo) = number_of_iterations;
-  
-  if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
-    {
-      if (memset_debug_details (NULL))
-	fprintf (dump_file, "loop bound unknown.");
-
-      /* Unknown loop bound.  */
-      if (!memset_analyze_loop_with_symbolic_num_of_iters (number_of_iterations,
-							   loop))
-	{
-          if (memset_debug_stats (loop) || memset_debug_details (loop))
-	    fprintf (dump_file, "not transformed: can't determine loop bound.\n");
-	  return NULL;
-	}
-      else
-	{
-	  /* We need only one loop entry for unknown loop bound support.  */
-	  if (loop->num_entries != 1 || !loop->pre_header)
-	    {	      
-	      if (memset_debug_stats (loop) || memset_debug_details (loop))
-		fprintf (dump_file, 
-			 "not transformed: more than one loop entry.");
-	      return NULL;
-	    }
-	}
-    }
-  else if (LOOP_VINFO_INT_NITERS (loop_vinfo) == 0)
-    {
-      if (memset_debug_stats (loop) || memset_debug_details (loop))
-	fprintf (dump_file, "not transformed: number of iterations = 0.\n");
-      return NULL;
-    }
-
-  LOOP_VINFO_EXIT_COND (loop_vinfo) = loop_cond;
-
-  return loop_vinfo;
-}
-
-/* Mark all the variables in V_MAY_DEF or V_MUST_DEF operands for STMT for
-   renaming. This becomes necessary when we modify all of a non-scalar.  */
-
-static void
-mark_all_v_defs (tree stmt)
-{
-  tree sym;
-  ssa_op_iter iter;
-
-  get_stmt_operands (stmt);
-
-  FOR_EACH_SSA_TREE_OPERAND (sym, stmt, iter, SSA_OP_VIRTUAL_DEFS)
-    { 
-      if (TREE_CODE (sym) == SSA_NAME) 
-	sym = SSA_NAME_VAR (sym);
-      bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
-    }
-}
-/* MERGE FIXME 4709514 */
-#endif
-
-/* This is the main entry point for the transformation.  */
-void
-tree_ssa_memset (struct loops *ARG_UNUSED (loops))
-{
-  /* MERGE FIXME 4709514 */
-#if 0
-  unsigned i;
-  
-  for (i = 1; i < loops->num; i++)
-    {
-      struct loop *loop = loops->parray[i];
-      loop_vec_info vectorizer_info;
-      varray_type writes;
-      struct data_reference *drw;
-      tree access_chrec;
-      tree noi;
-      
-      if (!loop)
-        continue;
-      
-      flow_loop_scan (loop, LOOP_ALL);
-      vectorizer_info = memset_analyze_loop_form (loop);
-      if (!vectorizer_info)
-        continue;
-      
-      if (!memset_analyze_data_refs (vectorizer_info))
-	{
-	  if (memset_debug_details (loop))
-	    fprintf (dump_file, "bad data references.");
-	  destroy_loop_vec_info (vectorizer_info);
-	  continue;
-	}
-      
-      writes = LOOP_VINFO_DATAREF_WRITES (vectorizer_info);
-      
-      /* TODO: handle more than data write.  */
-      if (VARRAY_ACTIVE_SIZE (writes) != 1)
-	{
-	  if (memset_debug_details (loop))
-	    fprintf (dump_file, "no or more than one store.");
-	  destroy_loop_vec_info (vectorizer_info);
-	  continue;
-	}
-      
-      drw = VARRAY_GENERIC_PTR (writes, 0);
-      
-      /* TODO: handle multi-dimension arrays.  */
-      if (DR_NUM_DIMENSIONS (drw) != 1)
-	{
-	  if (memset_debug_details (loop))
-	    fprintf (dump_file, "cannot handle multiple dimension array.");
-	  destroy_loop_vec_info (vectorizer_info);
-	  continue;
-	}
-      
-      if (TREE_CODE (TREE_OPERAND (DR_STMT (drw), 1)) != INTEGER_CST)
-	{
-	  if (memset_debug_details (loop))
-	    fprintf (dump_file, "non constant store value.");
-	  destroy_loop_vec_info (vectorizer_info);
-	  continue;
-	}
-      
-      /* TODO: handle other than zero values in types
-         where the unit size is greater than one. */
-      if (!integer_zerop (TREE_OPERAND (DR_STMT (drw), 1))
-	  && !integer_onep (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drw)))))
-	{
-	  if (memset_debug_details (loop))
-	    fprintf (dump_file, "cannot handle other zero value for types of other than char (for now).");
-	  destroy_loop_vec_info (vectorizer_info);
-	  continue;
-	}
-      
-      access_chrec = DR_ACCESS_FN (drw, 0);
-      
-      noi = LOOP_VINFO_NITERS (vectorizer_info);      
-      
-      /* Build the memset call.  */
-      {
-        tree array = DR_BASE_NAME (drw);
-	tree value = TREE_OPERAND (DR_STMT (drw), 1);
-	tree function = implicit_built_in_decls[BUILT_IN_MEMSET];
-	tree args = NULL_TREE;
-	block_stmt_iterator bsi = bsi_last (loop->pre_header);
-	tree array_1 = make_rename_temp (ptr_type_node, NULL);
-	tree temp, stmt, var;
-	tree ni_name;
-	
-	stmt = DR_STMT (drw);
-	
-	/* Remove the array access stmt. */
-	{
-	  block_stmt_iterator access_bsi;
-	  /* Mark the MAY_DEF as needed to be renamed. */
-	  mark_all_v_defs (stmt);
-	  access_bsi = bsi_for_stmt (stmt);
-	  bsi_remove (&access_bsi);
-	}
-	
-	if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE)
-	  {
-	    tree type = TREE_TYPE (TREE_TYPE (array));
-	    tree base = array;
-	    
-	    while (TREE_CODE (base) == REALPART_EXPR
-		   || TREE_CODE (base) == IMAGPART_EXPR
-		   || handled_component_p (base))
-	      base = TREE_OPERAND (base, 0);
-	    
-	    if (DECL_P (base))
-	      TREE_ADDRESSABLE (base) = 1;
-	    
-	    array = build4 (ARRAY_REF, type, array, size_zero_node,
-	                    NULL_TREE, NULL_TREE);
-	    array = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (array)),
-	                    array);
-	  }
-	
-	{
-	  tree start = CHREC_LEFT (access_chrec);
-	  tree size_mult;
-	  tree array_var;
-	  start = fold_convert (TREE_TYPE (array), start);
-	  size_mult = fold_convert (TREE_TYPE (array),
-			            TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (array))));
-	  array = fold (build2 (PLUS_EXPR, 
-				TREE_TYPE (array),
-				array, 
-				fold (build2 (MULT_EXPR, 
-					      TREE_TYPE (array), 
-					      start, 
-					      size_mult))));
-	  array_var = create_tmp_var (TREE_TYPE (array), "tmp");
-	  add_referenced_tmp_var (array_var);
-	  array = force_gimple_operand (array, &stmt, false, array_var);
-
-	  if (stmt)
-	    bsi_insert_after (&bsi, stmt, BSI_CONTINUE_LINKING);
-	}
-	
-	var = create_tmp_var (size_type_node, "tmp");
-	add_referenced_tmp_var (var);
-	
-	noi = fold (build2 (MULT_EXPR, TREE_TYPE (noi), noi,
-	                    fold_convert (TREE_TYPE (noi),
-			                  TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (array))))));
-
-	stmt = NULL_TREE;
-	ni_name = force_gimple_operand (noi, &stmt, false, var);
-
-	if (stmt)
-	  bsi_insert_after (&bsi, stmt, BSI_CONTINUE_LINKING);
-      
-	temp = build2 (MODIFY_EXPR, void_type_node, array_1,
-		       array);
-	
-	bsi_insert_after (&bsi, temp, BSI_CONTINUE_LINKING);
-	
-	args = tree_cons (NULL, ni_name, args);
-	args = tree_cons (NULL, fold_convert (integer_type_node, value), args);
-	args = tree_cons (NULL, array_1, args);
-	
-	temp = build_function_call_expr (function, args);
-	
-	bsi_insert_after (&bsi, temp, BSI_CONTINUE_LINKING);
-      }
-      
-      destroy_loop_vec_info (vectorizer_info);
-      
-    }
-  
-  rewrite_into_ssa (false);
-  if (!bitmap_empty_p (vars_to_rename))
-    {
-      /* The rewrite of ssa names may cause violation of loop closed ssa
-         form invariants.  TODO -- avoid these rewrites completely.
-         Information in virtual phi nodes is sufficient for it.  */
-      rewrite_into_loop_closed_ssa (); 
-    }
-  bitmap_clear (vars_to_rename);
-/* MERGE FIXME 4709514 */
-#endif
-}

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-ssa-loop.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-ssa-loop.c Thu Nov  8 20:30:15 2007
@@ -185,43 +185,6 @@
 };
 
 
-/* APPLE LOCAL begin loops-to-memset  */
-/* Loops to memset pass.  */
-
-static unsigned int
-tree_ssa_loop_memset (void)
-{
-  if (!current_loops)
-    return 0;
-  
-  tree_ssa_memset (current_loops);
-  return 0;
-}
-
-static bool
-gate_tree_ssa_loop_memset (void)
-{
-  return flag_tree_loop_memset != 0;
-}
-
-struct tree_opt_pass pass_memset =
-{
-  "memset",                            /* name */
-  gate_tree_ssa_loop_memset,           /* gate */
-  tree_ssa_loop_memset,                        /* execute */
-  NULL,                                        /* sub */
-  NULL,                                        /* next */
-  0,                                   /* static_pass_number */
-  TV_LIM,                              /* tv_id */
-  PROP_cfg,                            /* properties_required */
-  0,                                   /* properties_provided */
-  0,                                   /* properties_destroyed */
-  0,                                   /* todo_flags_start */
-  TODO_dump_func,                      /* todo_flags_finish */
-  0                                    /* letter */
-};
-/* APPLE LOCAL end loops-to-memset */
-
 /* Loop autovectorization.  */
 
 static unsigned int

Modified: llvm-gcc-4.2/trunk/gcc/tree-vect-analyze.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-vect-analyze.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-vect-analyze.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-vect-analyze.c Thu Nov  8 20:30:15 2007
@@ -56,8 +56,7 @@
 static bool exist_non_indexing_operands_for_use_p (tree, tree);
 static void vect_mark_relevant (VEC(tree,heap) **, tree, bool, bool);
 static bool vect_stmt_relevant_p (tree, loop_vec_info, bool *, bool *);
-/* APPLE LOCAL loops-to-memset  */
-extern tree vect_get_loop_niters (struct loop *, tree *);
+static tree vect_get_loop_niters (struct loop *, tree *);
 static bool vect_analyze_data_ref_dependence
   (struct data_dependence_relation *, loop_vec_info);
 static bool vect_compute_data_ref_alignment (struct data_reference *); 
@@ -1836,8 +1835,7 @@
    can be constructed, place it in NUMBER_OF_ITERATIONS.
    Return the loop exit condition.  */
 
-/* APPLE LOCAL loops-to-memset */
-tree
+static tree
 vect_get_loop_niters (struct loop *loop, tree *number_of_iterations)
 {
   tree niters;

Modified: llvm-gcc-4.2/trunk/gcc/tree-vectorizer.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-vectorizer.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-vectorizer.h (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-vectorizer.h Thu Nov  8 20:30:15 2007
@@ -335,10 +335,6 @@
 /* Main driver.  */
 extern void vectorize_loops (struct loops *);
 
-/* APPLE LOCAL begin loops-to-memset  */
-extern struct data_reference * vect_analyze_pointer_ref_access (tree, tree, bool, tree, tree *, tree *);
-extern tree vect_get_loop_niters (struct loop *, tree *);
-/* APPLE LOCAL end loops-to-memset  */
 
 /** In tree-vect-analyze.c  **/
 /* Driver for analysis stage.  */

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

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree.c Thu Nov  8 20:30:15 2007
@@ -542,9 +542,17 @@
 	DECL_IN_SYSTEM_HEADER (t) = in_system_header;
       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
 	{
-	  if (code != FUNCTION_DECL)
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  if (code == FUNCTION_DECL)
+	    {
+	      DECL_ALIGN (t) = FUNCTION_BOUNDARY;
+	      DECL_MODE (t) = FUNCTION_MODE;
+	    }
+	  else
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	    DECL_ALIGN (t) = 1;
-	  DECL_USER_ALIGN (t) = 0;	  
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	  /* We have not yet computed the alias set for this declaration.  */
 	  DECL_POINTER_ALIAS_SET (t) = -1;
 	}
@@ -962,7 +970,9 @@
   int over1 = 0, over2 = 0;
   tree link;
   /* APPLE LOCAL begin AltiVec */
-  int max_index, count = 0;
+  /* APPLE LOCAL begin AltiVec, radar 4870336, 4874471, 4874208 */
+  int count = 0;
+  /* APPLE LOCAL end AltiVec, radar 4870336, 4874471, 4874208 */
   tree list = NULL_TREE;
   /* APPLE LOCAL end AltiVec */
 
@@ -989,8 +999,11 @@
       over2 |= TREE_CONSTANT_OVERFLOW (value);
     }
 
-  /* APPLE LOCAL begin AltiVec */
-  max_index = TYPE_VECTOR_SUBPARTS (type);
+  /* APPLE LOCAL begin AltiVec, radar 4870336, 4874471, 4874208 */
+#ifdef TARGET_PIM_ALTIVEC
+  if (TARGET_PIM_ALTIVEC)
+  {
+  int max_index = TYPE_VECTOR_SUBPARTS (type);
   if (count > 0 && count < max_index)
     {
       int index;
@@ -1000,7 +1013,9 @@
                          build_tree_list (NULL_TREE,
                                           convert (TREE_TYPE (type), expr)));
     }
-  /* APPLE LOCAL end AltiVec */
+  }
+#endif
+  /* APPLE LOCAL end AltiVec, radar 4870336, 4874471, 4874208 */
 
   TREE_OVERFLOW (v) = over1;
   TREE_CONSTANT_OVERFLOW (v) = over2;
@@ -1910,15 +1925,20 @@
       align1 = expr_align (TREE_OPERAND (t, 2));
       return MIN (align0, align1);
 
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      /* FIXME: LABEL_DECL and CONST_DECL never have DECL_ALIGN set
+	 meaningfully, it's always 1.  */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
     case LABEL_DECL:     case CONST_DECL:
     case VAR_DECL:       case PARM_DECL:   case RESULT_DECL:
-      if (DECL_ALIGN (t) != 0)
-	return DECL_ALIGN (t);
-      break;
-
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
     case FUNCTION_DECL:
-      return FUNCTION_BOUNDARY;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      gcc_assert (DECL_ALIGN (t) != 0);
+      return DECL_ALIGN (t);
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
     default:
       break;
     }
@@ -3226,9 +3246,9 @@
 
   if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
     layout_decl (t, 0);
-  else if (code == FUNCTION_DECL)
-    DECL_MODE (t) = FUNCTION_MODE;
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
 
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
   return t;
 }
 

Modified: llvm-gcc-4.2/trunk/gcc/tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/tree.h Thu Nov  8 20:30:15 2007
@@ -2449,10 +2449,10 @@
 #define DECL_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.u1.a.align)
 /* The alignment of NODE, in bytes.  */
 #define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT)
-/* For FIELD_DECLs, off_align holds the number of low-order bits of
-   DECL_FIELD_OFFSET which are known to be always zero.
-   DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
-   has.  */
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+/* Set if the alignment of this DECL has been set by the user, for
+   example with an 'aligned' attribute.  */
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 #define DECL_USER_ALIGN(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.user_align)
 /* Holds the machine mode corresponding to the declaration of a variable or
    field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a

Modified: llvm-gcc-4.2/trunk/gcc/varasm.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/varasm.c?rev=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/varasm.c (original)
+++ llvm-gcc-4.2/trunk/gcc/varasm.c Thu Nov  8 20:30:15 2007
@@ -1432,7 +1432,9 @@
   if (flag_reorder_blocks_and_partition)
     {
       switch_to_section (unlikely_text_section ());
-      assemble_align (FUNCTION_BOUNDARY);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+      assemble_align (DECL_ALIGN (decl));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
       ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_label);
 
       /* When the function starts with a cold section, we need to explicitly
@@ -1442,7 +1444,9 @@
 	  && BB_PARTITION (ENTRY_BLOCK_PTR->next_bb) == BB_COLD_PARTITION)
 	{
 	  switch_to_section (text_section);
-	  assemble_align (FUNCTION_BOUNDARY);
+/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \
+	  assemble_align (DECL_ALIGN (decl));
+/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \
 	  ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label);
 	  hot_label_written = true;
 	  first_function_block_is_cold = true;
@@ -1909,7 +1913,7 @@
   /* APPLE LOCAL begin zerofill 20020218 --turly  */
 #ifdef ASM_OUTPUT_ZEROFILL
   /* We need a ZEROFILL COALESCED option!  */
-  if (!DECL_COMMON (decl)
+  if ((sect->common.flags & SECTION_COMMON) == 0
       && ! dont_output_data
       && ! DECL_ONE_ONLY (decl)
       && ! DECL_WEAK (decl)
@@ -2455,7 +2459,12 @@
 {
   tree target = TREE_OPERAND (exp, 0);
   int offset = 0;
-  rtx x;
+  /* APPLE LOCAL begin handle CONST_DECLs 5494472 */
+  rtx x = NULL_RTX;
+
+  if (TREE_CODE (target) == CONST_DECL)
+    target = DECL_INITIAL (target);
+  /* APPLE LOCAL end handle CONST_DECLs 5494472 */
 
   while (1)
     {

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=43927&r1=43926&r2=43927&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/version.c (original)
+++ llvm-gcc-4.2/trunk/gcc/version.c Thu Nov  8 20:30:15 2007
@@ -9,7 +9,7 @@
    the revision of your modified compiler.  */
 
 /* APPLE LOCAL begin Apple version */
-#define VERSUFFIX "(llvm) (Based on Apple Inc. build 5530)"
+#define VERSUFFIX "(llvm) (Based on Apple Inc. build 5546)"
 /* APPLE LOCAL end Apple version */
 
 /* This is the location of the online document giving instructions for





More information about the llvm-commits mailing list