aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-02 01:04:46 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-02 01:04:46 +0000
commitcebf4ca8b69899001dc52a79e10b62156c1d3476 (patch)
treed03d9d5901ec8f1af0a3a165a0bda77ce9fc42d6
parent05154761be319de895195809e92cbcae2dd71d75 (diff)
Merged -r112764:113438 branches/apple-local-200502-branch.apple/gcc-5402
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/apple/trunk@113449 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog131
-rw-r--r--gcc/ChangeLog.apple-ppc294
-rw-r--r--gcc/c-common.c635
-rw-r--r--gcc/c-decl.c22
-rw-r--r--gcc/c-lex.c112
-rw-r--r--gcc/c-opts.c2
-rw-r--r--gcc/c-parse.in288
-rw-r--r--gcc/c-tree.h2
-rw-r--r--gcc/c-typeck.c33
-rw-r--r--gcc/config/asm.h81
-rw-r--r--gcc/config/darwin-c.c88
-rw-r--r--gcc/config/darwin-protos.h8
-rw-r--r--gcc/config/darwin.c2
-rw-r--r--gcc/config/darwin.h20
-rw-r--r--gcc/config/i386/darwin.h17
-rw-r--r--gcc/config/i386/i386-protos.h11
-rw-r--r--gcc/config/i386/i386.c427
-rw-r--r--gcc/config/i386/i386.h126
-rw-r--r--gcc/config/i386/mmintrin.h3
-rw-r--r--gcc/config/rs6000/rs6000-protos.h2
-rw-r--r--gcc/config/rs6000/rs6000.c236
-rw-r--r--gcc/config/rs6000/rs6000.h8
-rw-r--r--gcc/config/rs6000/rs6000.md40
-rw-r--r--gcc/config/rs6000/t-darwin3
-rw-r--r--gcc/config/t-darwin3
-rw-r--r--gcc/cp/ChangeLog.apple-ppc54
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c20
-rw-r--r--gcc/cp/parser.c328
-rw-r--r--gcc/cp/semantics.c6
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/doc/invoke.texi19
-rw-r--r--gcc/dwarf2asm.c9
-rw-r--r--gcc/dwarf2out.c836
-rw-r--r--gcc/fortran/f95-lang.c6
-rw-r--r--gcc/function.c12
-rw-r--r--gcc/function.h6
-rw-r--r--gcc/gimple-low.c2
-rw-r--r--gcc/global.c6
-rw-r--r--gcc/java/lang.c6
-rw-r--r--gcc/loop.c7
-rw-r--r--gcc/print-tree.c8
-rw-r--r--gcc/reload.c8
-rw-r--r--gcc/reload1.c2
-rw-r--r--gcc/scan-decls.c6
-rw-r--r--gcc/stmt.c2
-rw-r--r--gcc/stor-layout.c364
-rw-r--r--gcc/target-def.h6
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog.apple-ppc250
-rw-r--r--gcc/testsuite/g++.apple/asm-block-13.C64
-rw-r--r--gcc/testsuite/g++.apple/asm-block-31.C2
-rw-r--r--gcc/testsuite/g++.apple/asm-block-35.C2
-rw-r--r--gcc/testsuite/g++.apple/asm-block-49.C17
-rw-r--r--gcc/testsuite/g++.apple/asm-block-50.C38
-rw-r--r--gcc/testsuite/g++.apple/asm-block-51.C8
-rw-r--r--gcc/testsuite/g++.dg/R4475058.C54
-rw-r--r--gcc/testsuite/g++.dg/bitreverse-10.C11
-rw-r--r--gcc/testsuite/g++.dg/bitreverse-23.C3
-rw-r--r--gcc/testsuite/g++.dg/pascal-strings-2.C2
-rw-r--r--gcc/testsuite/gcc.apple/4516827.c67
-rw-r--r--gcc/testsuite/gcc.apple/R4499790-2.c21
-rw-r--r--gcc/testsuite/gcc.apple/R4499790.c22
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-13.c64
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-31.c2
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-35.c2
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-46.c4
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-49.c17
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-50.c38
-rw-r--r--gcc/testsuite/gcc.apple/asm-block-51.c8
-rw-r--r--gcc/testsuite/gcc.apple/asm-function-10.c11
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-1.c13
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-10.c11
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-11.c1
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-12.c3
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-13.c233
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-14.c1
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-15.c1
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-16.c1
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-17.c6
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-18.c3
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-19.c44
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-2.c88
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-20.c38
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-21.c145
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-22.c7
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-24.c77
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-25.c7
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-26.c7
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-27.c37
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-3.c1
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-4.c92
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-5.c92
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-6.c93
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-7.c94
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-8.c90
-rw-r--r--gcc/testsuite/gcc.apple/bitreverse-9.c1
-rw-r--r--gcc/testsuite/gcc.apple/pascal-strings-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pragma-ms_struct.c22
-rw-r--r--gcc/testsuite/gcc.target/i386/m64-1.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/m64-2.c8
-rw-r--r--gcc/tree-inline.c2
-rw-r--r--gcc/tree-ssa-forwprop.c3
-rw-r--r--gcc/tree-ssa-loop-ivopts.c7
-rw-r--r--gcc/tree.h17
-rw-r--r--libcpp/ChangeLog.apple-ppc16
-rw-r--r--libcpp/charset.c30
-rw-r--r--libcpp/lex.c22
-rw-r--r--libcpp/macro.c4
-rw-r--r--libcpp/makedepend.c6
110 files changed, 3439 insertions, 2941 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3f758fd3ba2..3903edc8327 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -11,6 +11,135 @@
* toplev.c (check_global_declarations): Check anonymous
decl name.
+2006-04-25 Eric Christopher <echristo@apple.com>
+
+ Radar 4529978
+ * target-def.h (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Bracket
+ with #ifndef/#endif.
+ * config/darwin-c.c (darwin_ms_struct): New.
+ (darwin_pragma_ms_struct): Ditto.
+ (darwin_set_default_type_attributes): Ditto.
+ * config/darwin-protos.h (darwin_pragma_ms_struct): Declare.
+ * config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS):
+ Register ms_struct pragma.
+ * config/i386/darwin.h (REGISTER_TARGET_PRAGMAS): Declare.
+ (TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Ditto.
+ * config/rs6000/rs6000.c (rs6000_set_default_type_attributes): Call
+ darwin_set_default_type_attributes if TARGET_MACHO.
+
+2006-04-25 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (size_of_locs): Don't fill dw_loc_addr if there
+ are no branches.
+
+ Radar 4498201
+ * dwarf2asm.c (dw2_asm_output_data): Don't generate RTL just
+ to print an integer.
+
+2006-04-24 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (verify_marks_clear): New.
+ (prune_unused_types): Call verify_marks_clear initially, not
+ prune_unmark_dies.
+
+2006-04-21 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (struct die_struct): Document that die_sib makes
+ a circular linked list.
+ (FOR_EACH_CHILD): New.
+ (reverse_die_lists): Delete.
+ (reverse_all_dies): Delete.
+ (add_dwarf_attr): Correct documentation.
+ (remove_child_with_prev): New.
+ (remove_child_TAG): Update for change to die_struct, use
+ remove_child_with_prev.
+ (add_child_die): Update for change to die_struct.
+ (splice_child_die): Use remove_child_with_prev and add_child_die.
+ (print_die): Use FOR_EACH_CHILD.
+ (die_checksum): Likewise.
+ (assign_symbol_names): Likewise.
+ (output_location_lists): Likewise.
+ (build_abbrev_table): Likewise.
+ (calc_die_sizes): Likewise.
+ (mark_dies): Likewise.
+ (unmark_dies): Likewise.
+ (unmark_all_dies): Likewise.
+ (output_die): Likewise.
+ (prune_unused_types_mark): Likewise.
+ (prune_unused_types_walk): Likewise.
+ (same_die_p): Update for change to die_struct.
+ (break_out_includes): Likewise.
+ (prune_unused_types_prune): Likewise.
+ (add_sibling_attributes): Use FOR_EACH_CHILD, simplify logic.
+ (prune_unmark_dies): Use FOR_EACH_CHILD, don't clear die_mark if
+ it's already clear.
+ (dwarf2out_finish): Don't call reverse_all_dies.
+
+2006-04-04 Eric Christopher <echristo@apple.com>
+
+ Radar 4525014
+ * config/rs6000/rs6000.c (TARGET_MS_BITFIELD_LAYOUT_P): Define.
+ (TARGET_USE_MS_BITFIELD_LAYOUT): Ditto.
+ (rs6000_handle_struct_attribute): New.
+ (rs6000_ms_bitfield_layout_p): Ditto.
+
+2006-04-17 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (free_AT): Delete.
+ (remove_AT): Update string ref counts.
+ (remove_child_TAG): Don't call free_die.
+ (free_die): Delete.
+ (break_out_includes): Don't call free_die on DW_TAG_GNU_BINCL
+ or DW_TAG_GNU_EINCL.
+ (prune_unused_types_walk_attribs): Reset string refcounts.
+ (prune_unused_types_update_strings): New.
+ (prune_unused_types_prune): Don't make unnecessary stores. Don't
+ call free_die. Do call prune_unused_types_update_strings.
+ (prune_unused_types): Empty debug_str_hash.
+
+2006-04-10 Geoffrey Keating <geoffk@apple.com>
+
+ Radar 4498201
+ * dwarf2out.c (struct dw_attr_struct): Remove dw_attr_next.
+ Declare VECs of this type.
+ (struct die_struct): Make field die_attr a VEC of dw_attr_struct.
+ (remove_children): Delete.
+ (add_dwarf_attr): Use VEC routines.
+ (add_AT_flag): Update for changes to add_dwarf_attr.
+ (add_AT_int): Likewise.
+ (add_AT_unsigned): Likewise.
+ (add_AT_long_long): Likewise.
+ (add_AT_vec): Likewise.
+ (add_AT_string): Likewise.
+ (add_AT_die_ref): Likewise.
+ (add_AT_fde_ref): Likewise.
+ (add_AT_loc): Likewise.
+ (add_AT_loc_list): Likewise.
+ (add_AT_addr): Likewise.
+ (add_AT_lbl_id): Likewise.
+ (add_AT_lineptr): Likewise.
+ (add_AT_macptr): Likewise.
+ (add_AT_offset): Likewise.
+ (add_AT_range_list): Likewise.
+ (get_AT): Use VEC_iterate.
+ (remove_AT): Use VEC_ordered_remove.
+ (free_die): Fold remove_children into here; have it use VEC_iterate.
+ (print_die): Use VEC_iterate on attrs.
+ (reverse_die_lists): Don't reverse attr lists.
+ (die_checksum): Use VEC_iterate on attrs.
+ (same_die_p): Likewise.
+ (output_location_lists): Likewise.
+ (build_abbrev_table): Likewise.
+ (size_of_die): Likewise.
+ (unmark_all_dies): Likewise.
+ (output_abbrev_section): Likewise.
+ (output_die): Likewise.
+ (prune_unused_types_walk_attribs): Likewise.
+
2006-04-04 Geoffrey Keating <geoffk@apple.com>
Radar 4502209
@@ -18,7 +147,7 @@
NULL for dso parameter to atexit_common.
Radar 4383613
- * doc/extend.texi (Function Attributes): Rewrite visibility
+ * doc/extend.texi (Function Attributes): Rewrite visibility
attribute documentation.
* doc/invoke.texi (C++ Dialect Options): Rewrite
-fvisibility-inlines-hidden documentation to describe something
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc
index b227d44fc84..0df13d209c2 100644
--- a/gcc/ChangeLog.apple-ppc
+++ b/gcc/ChangeLog.apple-ppc
@@ -317,6 +317,300 @@
* c-typeck.c (build_component_ref): Generate the new ivar reference
tree.
+2006-05-01 Stuart Hastings <stuart@apple.com>
+
+ Radar 4222119
+ * gcc/doc/invoke.texi: Document -mlong-branch.
+
+2006-04-27 Eric Christopher <echristo@apple.com>
+
+ Radar 4454599
+ Radar 4481146
+ * stor-layout.c (update_alignment_for_field): Unconditionalize
+ ms_bitfield_layout_p code. Handle non-bitfield fields. Remove
+ extra alignment code.
+ (place_field): Don't realign if ms_bitfield_layout_p. Unconditionalize
+ ms_bitfield_layout_p code. Rewrite handling of structure fields.
+ Rewrite bitfield reversal handling.
+
+2006-04-27 Hui-May Chang <hm.chang@apple.com>
+
+ Radar 4314956
+ Revert 2006-04-26 patch.
+
+2006-04-27 Mike Stump <mrs@apple.com>
+
+ Radar 4529992
+ * c-common.c (pointer_int_sum): Only form ARRAY_REF for ARRAY_TYPEs.
+ (iasm_maybe_force_mem): Ensure that we only use DECL_HARD_REGISTER on
+ VAR_DECLs.
+ * c-typeck.c (iasm_c_build_component_ref): Move [eax].16 code up,
+ to avoid calling lookup_name on [eax].
+
+2006-04-26 Hui-May Chang <hm.chang@apple.com>
+
+ Radar 4491613
+ * loop.c (general_induction_var) : If an induction variable
+ may trap, it shouldn't be a general induction variable.
+
+2006-04-26 Hui-May Chang <hm.chang@apple.com>
+
+ Radar 4314956
+ Import from mainline:
+ 2005-08-31 Richard Henderson <rth@redhat.com>
+ * config/i386/i386.c (ix86_function_ok_for_sibcall): Fix test for
+ fp return matching.
+
+2006-04-26 Mike Stump <mrs@apple.com>
+
+ Radar 4505697
+ * config/i386/i386.c (iasm_x86_canonicalize_operands): Fix movzx handling.
+
+2006-04-26 Mike Stump <mrs@apple.com>
+
+ Radar 4505741
+ * c-common.c (iasm_print_operand): Fix .machine all for ppc64.
+
+ (iasm_addr): Add.
+ (pointer_int_sum): Handle ptr+4 correctly.
+ (iasm_stmt): Set up the line number correctly for C.
+ (IASM_VALID_PIC): Add.
+ (iasm_type_for): Move to i386.h
+ (iasm_maybe_force_mem): Add.
+ (iasm_print_operand): Split code out to new functions.
+ Add warnings for non-pic code when in PIC mode.
+ Add ARRAY_REF handling.
+ * i386/i386-protos.h (iasm_raise_reg): Add
+ * i386/i386.c:
+ Rename x86_canonicalize_operands to iasm_x86_canonicalize_operands.
+ (iasm_type_for): Add.
+ (iasm_raise_reg): Add.
+ (iasm_default_conv): Add.
+ (iasm_is_offset): Imrove support for ADDR_EXPR.
+ (iasm_canonicalize_bracket_1): Handle constants better.
+ Ensure that stack based addresses occur as one argument to the asm.
+ Ensure that expressions form adderess exrepssions.
+ (iasm_indirect): Add.
+ (iasm_add): Add.
+ (iasm_canonicalize_bracket): Split out code.
+ Ensure that stack based addresses occur as one argument to the asm.
+ Ensure that expressions form adderess exrepssions.
+ (iasm_x86_canonicalize_operands): Handle ARRAY_REF.
+ (iasm_warn_extra_reg): Add.
+ (iasm_print_op): Don't indirect here.
+ Handle address constant memory expressions.
+ Add warnings for extra registers.
+ Handle ADDR_EXPR better.
+ * i386/i386.h (IASM_VALID_PIC): Add.
+
+ Rename cw_ to iasm_:
+ * c-common.c:
+ Rename flag_cw_asm_blocks to flag_iasm_blocks.
+ Rename cw_asm_states to iasm_states.
+ Rename cw_asm_state to iasm_state.
+ Rename cw_asm_in_decl to iasm_in_decl.
+ Rename inside_cw_asm_block to inside_iasm_block.
+ Rename cw_asm_at_bol to iasm_at_bol.
+ Rename cw_asm_in_operands to iasm_in_operands.
+ Rename cw_split_next to iasm_split_next.
+ Rename cw_asm_buffer to iasm_buffer.
+ Rename cw_asm_labels to iasm_labels.
+ Rename cw_asm_labels_uniq to iasm_labels_uniq.
+ Rename cw_asm_identifier to iasm_identifier.
+ Rename cw_memory_clobber to iasm_memory_clobber.
+ Rename get_cw_asm_label to iasm_get_label.
+ Rename cw_get_mode to iasm_get_mode.
+ Rename cw_ptr_conv to iasm_ptr_conv.
+ Rename cw_build_bracket to iasm_build_bracket.
+ Rename cw_asm_default_function_conversion to iasm_default_function_conversion.
+ Rename cw_is_pseudo to iasm_is_pseudo.
+ Rename cw_op_constraint to iasm_op_constraint.
+ Rename TARGET_CW_OP_CONSTRAINT to TARGET_IASM_OP_CONSTRAINT.
+ Rename cw_op_comp to iasm_op_comp.
+ Rename TARGET_CW_REORDER_ARG to TARGET_IASM_REORDER_ARG.
+ Rename CW_SYNTH_CONSTRAINTS to IASM_SYNTH_CONSTRAINTS.
+ Rename cw_constraint_for to iasm_constraint_for.
+ Rename cw_process_arg to iasm_process_arg.
+ Rename CW_CANONICALIZE_OPERANDS to IASM_CANONICALIZE_OPERANDS.
+ Rename CW_IS_PREFIX to IASM_IS_PREFIX.
+ Rename CW_PRINT_PREFIX to IASM_PRINT_PREFIX.
+ Rename cw_is_prefix to iasm_is_prefix.
+ Rename cw_num_constraints_1 to iasm_num_constraints_1.
+ Rename cw_num_constraints to iasm_num_constraints.
+ Rename cw_set_constraints_1 to iasm_set_constraints_1.
+ Rename cw_set_constraints to iasm_set_constraints.
+ Rename CW_MAX_CLOBBERS to IASM_MAX_CLOBBERS.
+ Rename cw_op_clobber to iasm_op_clobber.
+ Rename cw_op_clobber_comp to iasm_op_clobber_comp.
+ Rename TARGET_CW_EXTRA_CLOBBERS to TARGET_IASM_EXTRA_CLOBBERS.
+ Rename cw_extra_clobbers to iasm_extra_clobbers.
+ Rename cw_asm_stmt to iasm_stmt.
+ Rename cw_asm_field_offset to iasm_field_offset.
+ Rename cw_simple_expr to iasm_simple_expr.
+ Rename cw_asm_expr_val to iasm_expr_val.
+ Rename TARGET_CW_PRINT_OP to TARGET_IASM_PRINT_OP.
+ Rename CW_IMMED_PREFIX to IASM_IMMED_PREFIX.
+ Rename CW_OFFSET_PREFIX to IASM_OFFSET_PREFIX.
+ Rename CW_HIDE_REG to IASM_HIDE_REG.
+ Rename CW_SEE_IMMEDIATE to IASM_SEE_IMMEDIATE.
+ Rename CW_SEE_NO_IMMEDIATE to IASM_SEE_NO_IMMEDIATE.
+ Rename CW_FUNCTION_MODIFIER to IASM_FUNCTION_MODIFIER.
+ Rename cw_force_constraint to iasm_force_constraint.
+ Rename print_cw_asm_operand to iasm_print_operand.
+ Rename cw_asm_get_register_var to iasm_get_register_var.
+ Rename cw_asm_reg_name to iasm_reg_name.
+ Rename cw_asm_label to iasm_label.
+ Rename cw_get_identifier to iasm_get_identifier.
+ Rename clear_cw_asm_labels to iasm_clear_labels.
+ Rename cw_ha16 to iasm_ha16.
+ Rename cw_hi16 to iasm_hi16.
+ Rename cw_lo16 to iasm_lo16.
+ Rename cw_do_id to iasm_do_id.
+ Rename cw_asm_build_register_offset to iasm_build_register_offset.
+ Rename cw_asm_entry to iasm_entry.
+ * c-lex.c: Likewise
+ Rename cw_skip_to_eol to iasm_skip_to_eol.
+ Rename cw_asm_saved_token to iasm_saved_token.
+ Rename cw_insert_saved_token to iasm_insert_saved_token.
+ * c-parse.in: Likewise.
+ Rename CW_ASM_KEYWORD to IASM_ASM_KEYWORD.
+ Rename CW_ASM_BOL to IASM_BOL.
+ Rename CW_ASM_EOL to IASM_EOL.
+ Rename cw_asm_lineno to iasm_lineno.
+ Rename CW_SEE_OPCODE to IASM_SEE_OPCODE.
+ Rename c_parse_cw_maybe_prefix to c_parse_iasm_maybe_prefix.
+ Rename cw_save_location to iasm_save_location.
+ Rename cw_asm_stmt_nobol to iasm_stmt_nobol.
+ Rename cw_asm_stmt_list to iasm_stmt_list.
+ Rename cw_maybe_comment to iasm_maybe_comment.
+ Rename cw_identifier to iasm_identifier.
+ Rename cw_identifier1 to iasm_identifier1.
+ Rename cw_maybe_prefix to iasm_maybe_prefix.
+ Rename single_cw_asm_stmt to single_iasm_stmt.
+ Rename cw_asm_stmts to iasm_stmts.
+ Rename cw_asm_compstmt_start to iasm_compstmt_start.
+ Rename cw_asm_compstmt to iasm_compstmt.
+ Rename cw_asm_compstmt_nostart to iasm_compstmt_nostart.
+ Rename cw_asm_compstmt_contents_nonempty to iasm_compstmt_contents_nonempty.
+ Rename cw_asm_operands to iasm_operands.
+ Rename cw_nonnull_asm_operands to iasm_nonnull_operands.
+ Rename cw_asm_operand to iasm_operand.
+ Rename cw_asm_expr_no_commas to iasm_expr_no_commas.
+ Rename cw_asm_unary_expr to iasm_unary_expr.
+ Rename cw_asm_primary to iasm_primary.
+ Rename cw_asm_specbit to iasm_asm_specbit.
+ Rename cw_asm_typename_or_reserved to iasm_typename_or_reserved.
+ Rename cw_asm_c_build_component_ref to iasm_c_build_component_ref.
+ * config/asm.h: Likewise.
+ Rename cw_asm_none to iasm_none.
+ Rename cw_asm_decls to iasm_decls.
+ Rename cw_asm_asm to iasm_asm.
+ Rename CW_MAX_ARG to IASM_MAX_ARG.
+ Rename TARGET_CW_EXTRA_INFO to TARGET_IASM_EXTRA_INFO.
+ Rename cw_md_Extra_info to iasm_md_Extra_info.
+ Rename cw_md_extra_info to iasm_md_extra_info.
+ * config/darwin-protos.h: Likewise.
+ Rename CW_ASM_SPECIAL_LABEL to IASM_SPECIAL_LABEL.
+ * config/darwin.c: Likewise.
+ Rename darwin_cw_asm_special_label to darwin_iasm_special_label.
+ * i386/darwin.h: Likewise.
+ Rename CW_ASM_REGISTER_NAME to IASM_REGISTER_NAME.
+ * i386/i386-protos.h: Likewise.
+ * i386/i386.c: Likewise.
+ Rename cw_reg_comp to iasm_reg_comp.
+ Rename i386_cw_asm_register_name to i386_iasm_register_name.
+ Rename cw_x86_needs_swapping to iasm_x86_needs_swapping.
+ Rename x86_swap_operands to iasm_x86_swap_operands.
+ Rename cw_is_offset to iasm_is_offset.
+ Rename cw_combine_type to iasm_combine_type.
+ Rename cw_canonicalize_bracket_1 to iasm_canonicalize_bracket_1.
+ Rename cw_canonicalize_bracket to iasm_canonicalize_bracket.
+ Rename x86_canonicalize_operands to iasm_x86_canonicalize_operands.
+ Rename CW_PREFIX_SEP to IASM_PREFIX_SEP.
+ Rename x86_cw_print_prefix to iasm_x86_print_prefix.
+ Rename cw_print_op to iasm_print_op.
+ * i386/i386.h: Likewise.
+ * rs6000/rs6000-protos.h: Likewise.
+ * rs6000/rs6000.c: Likewise.
+ Rename rs6000_cw_asm_register_name to rs6000_iasm_register_name.
+ * rs6000/rs6000.h: Likewise.
+ * rs6000/rs6000.md: Likewise.
+ * function.c: Likewise.
+ * function.h: Likewise.
+ Rename cw_asm_function to iasm_asm_function.
+ Rename cw_asm_noreturn to iasm_noreturn.
+ Rename cw_asm_frame_size to iasm_frame_size.
+ * gimple-low.c: Likewise.
+ * global.c: Likewise.
+ * print-tree.c: Likewise.
+ * reload1.c: Likewise.
+ * scan-decls.c: Likewise.
+ * stmt.c: Likewise.
+ * tree-inline.c: Likewise.
+ * tree.h: Likewise.
+ Rename cw_asm_function_flag to iasm_asm_function_flag.
+ Rename cw_asm_noreturn_flag to iasm_noreturn_flag.
+
+2006-04-25 Devang Patel <dpatel@apple.com>
+
+ Radar 4505813
+ * config/i386/mmintrin.h (__m64): Update def.
+
+2005-04-21 Dale Johannesen <dalej@apple.com>
+
+ Radar 4506160
+ Bring in Joern Rennecke's fix from mainline:
+ PR middle-end/23135
+ * reload.c (find_reloads_subreg_address): Pass down TYPE
+ unchanged. Change all callers except find_reloads_toplev.
+
+2006-04-18 Stuart Hastings <stuart@apple.com>
+
+ Radar 4505290
+ * config/rs6000/rs6000.c (rs6000_initialize_trampoline): Use
+ pmode for SYMBOL_REFs.
+
+2006-04-18 Dale Johannesen <dalej@apple.com>
+
+ Radar 4516827
+ * tree-ssa-loop-ivopts.c (find_interesting_uses_address):
+ Apply Zdenek's fix from mainline (PR 26643).
+
+2006-04-18 Stuart Hastings <stuart@apple.com>
+
+ Radar 4505290
+ * config/rs6000/t-darwin (DARWIN_EXTRA_CRT_BUILD_CFLAGS): New.
+ * config/t-darwin (crt3.o): Use it.
+ * config/rs6000/rs6000.md (call_indirect_nonlocal_sysv,
+ call_nonlocal_sysv, call_value_indirect_nonlocal_sysv,
+ call_value_nonlocal_sysv, sibcall_nonlocal_sysv,
+ sibcall_value_nonlocal_sysv): Use the P macro for 32/64 support.
+
+2006-04-18 Devang Patel <dpatel@apple.com>
+
+ Radar 4475058
+ * tree-ssa-forwprop.c (all_uses_are_replacable): Processing of one
+ worklist stmt may remove casts from another worklist item.
+
+2006-04-17 Devang Patel <dpatel@apple.com>
+
+ Radar 4499790
+ * c-lex.c (lex_string): Enable pascal strings for wchars.
+
+2006-04-12 Mike Stump <mrs@apple.com>
+
+ Radar 4477426 4466768 4498501
+ * c-common.c (cw_is_pseudo): Add.
+ (cw_asm_stmt): Handle _emit, opword and .machine better.
+ (print_cw_asm_operand): Handle .machine better.
+ * config/asm.h (struct cw_md_Extra_info, no_label_map): Add
+ (cw_is_pseudo): Add.
+ * i386/i386.c (cw_x86_needs_swapping): Handle pseduo instructions better.
+ (x86_canonicalize_operands): Likewise.
+ * i386/i386.h (TARGET_CW_EXTRA_INFO): Add.
+ (CW_IMMED_PREFIX): Handle pseduo instructions better.
+ (TARGET_CW_OP_CONSTRAINT): Add missing cmp.*{pd,ps,sd,ss} instructions.
+
2006-04-06 Stuart Hastings <stuart@apple.com>
Radar 4499627
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 053256a0010..0494f425eba 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -279,7 +279,7 @@ int flag_no_asm;
/* APPLE LOCAL begin CW asm blocks */
/* Nonzero means accept CW-style asm blocks. */
-int flag_cw_asm_blocks;
+int flag_iasm_blocks;
/* APPLE LOCAL end CW asm blocks */
/* Nonzero means give string constants the type `const char *', as mandated
@@ -578,40 +578,40 @@ static bool check_case_bounds (tree, tree, tree *, tree *);
/* APPLE LOCAL begin CW asm blocks */
/* State variable telling the lexer what to do. */
-enum cw_asm_states cw_asm_state = cw_asm_none;
+enum iasm_states iasm_state = iasm_none;
/* True in an asm block while parsing a decl. */
-int cw_asm_in_decl;
+bool iasm_in_decl;
/* This is true exactly within the interior of an asm block. It is
- not quite the same as any of the states of cw_asm_state. */
-int inside_cw_asm_block;
+ not quite the same as any of the states of iasm_state. */
+bool inside_iasm_block;
/* An additional state variable, true when the next token returned
should be a BOL, false otherwise. */
-int cw_asm_at_bol;
+bool iasm_at_bol;
/* True when the lexer/parser is handling operands. */
-int cw_asm_in_operands;
+int iasm_in_operands;
/* Saved token when the next token is one of [.+-] and it is preceeded
by a whitespace; used when we are parsing an identifier for an
- opcode, used to split up [.+-] from the id for cw_identifier1. */
-const cpp_token *cw_split_next;
+ opcode, used to split up [.+-] from the id for iasm_identifier1. */
+const cpp_token *iasm_split_next;
/* Working buffer for building the assembly string. */
-static char *cw_asm_buffer;
+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 cw_asm_labels;
-static GTY(()) varray_type cw_asm_labels_uniq;
-static tree cw_asm_identifier (tree expr);
+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 cw_memory_clobber (const char *);
-static tree get_cw_asm_label (tree);
+extern bool iasm_memory_clobber (const char *);
+static tree iasm_get_label (tree);
/* APPLE LOCAL end CW asm blocks */
static tree handle_packed_attribute (tree *, tree, tree, int, bool *);
@@ -2430,7 +2430,15 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
/* APPLE LOCAL begin CW asm blocks */
{
- tree array = ptrop;
+ tree array;
+ /* foo+4 is &(char*)foo + 4 in MS asm land, not foo + 4*(elt size). */
+ if (inside_iasm_block && flag_ms_asms)
+ {
+ ptrop = iasm_addr (ptrop);
+ result_type = TREE_TYPE (ptrop);
+ }
+
+ array = ptrop;
STRIP_NOPS (array);
/* We want to canonicalize PLUS_EXPR into ARRAY_REF for data
@@ -2439,10 +2447,11 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
is useful as otherwise when all registers are in use by the
assembly code, we can run reload out of registers. */
- if (inside_cw_asm_block
+ if (inside_iasm_block
&& flag_ms_asms
&& resultcode == PLUS_EXPR
&& TREE_CODE (array) == ADDR_EXPR
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (array, 0))) == ARRAY_TYPE
&& !(TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == FUNCTION_TYPE
|| TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == METHOD_TYPE))
{
@@ -2485,7 +2494,7 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
}
/* foo+4 is &(char*)foo + 4 in MS asm land, not foo + 4*(elt size). */
- if (inside_cw_asm_block && flag_ms_asms)
+ if (inside_iasm_block && flag_ms_asms)
size_exp = integer_one_node;
/* APPLE LOCAL end CW asm blocks */
@@ -6270,10 +6279,28 @@ vector_constructor_from_expr (tree expr, tree vector_type)
/* APPLE LOCAL end AltiVec */
/* APPLE LOCAL begin CW asm blocks */
+/* Wrap a variable with &, as variables refer to their address. */
+
+tree
+iasm_addr (tree e)
+{
+ tree type = TREE_TYPE (e);
+ if (TREE_CODE (type) == ARRAY_TYPE)
+ type = TREE_TYPE (type);
+ if ((TREE_CODE (e) == VAR_DECL
+ || TREE_CODE (e) == PARM_DECL)
+ && ! C_DECL_REGISTER (e))
+ {
+ type = build_pointer_type (type);
+ e = build1 (ADDR_EXPR, type, e);
+ }
+ return e;
+}
+
/* Get the mode associated with the type, else VOIDmode if none. */
static enum machine_mode
-cw_get_mode (tree type)
+iasm_get_mode (tree type)
{
const char *s = IDENTIFIER_POINTER (type);
if (strcasecmp (s, "byte") == 0)
@@ -6303,7 +6330,7 @@ cw_get_mode (tree type)
/* Build up a ``type ptr exp'' expression. */
tree
-cw_ptr_conv (tree type, tree exp)
+iasm_ptr_conv (tree type, tree exp)
{
tree rhstype, ntype = NULL_TREE;
enum machine_mode to_mode;
@@ -6328,7 +6355,7 @@ cw_ptr_conv (tree type, tree exp)
rhstype = TREE_TYPE (exp);
- to_mode = cw_get_mode (type);
+ to_mode = iasm_get_mode (type);
/* Allow trivial conversions. */
if (to_mode != VOIDmode)
@@ -6351,7 +6378,7 @@ cw_ptr_conv (tree type, tree exp)
}
tree
-cw_build_bracket (tree v1, tree v2)
+iasm_build_bracket (tree v1, tree v2)
{
tree type = void_type_node;
@@ -6371,7 +6398,7 @@ cw_build_bracket (tree v1, tree v2)
return EXP. */
static tree
-cw_asm_default_function_conversion (tree exp)
+iasm_default_function_conversion (tree exp)
{
tree type = TREE_TYPE (exp);
enum tree_code code = TREE_CODE (type);
@@ -6392,10 +6419,23 @@ cw_asm_default_function_conversion (tree exp)
return exp;
}
+/* Return true iff op is a pseudo-op that doesn't need swapping on x86. */
+
+bool
+iasm_is_pseudo (const char *opcode)
+{
+ return strcmp (opcode, ".long") == 0
+ || strcmp (opcode, ".word") == 0
+ || strcmp (opcode, ".byte") == 0
+ || strcmp (opcode, ".short") == 0
+ || strcmp (opcode, ".quad") == 0
+ || strcmp (opcode, ".machine") == 0;
+}
+
/* The constraints table for CW style assembly. Things not listed are
usually considered as "+b", "+v" or "+f" depending upon context. */
-struct cw_op_constraint
+struct iasm_op_constraint
{
const char *opcode;
unsigned argnum;
@@ -6404,18 +6444,18 @@ struct cw_op_constraint
/* Default value of the constraint table. */
/* ??? This should be in defaults.h or a CW asm specific header. */
-#ifndef TARGET_CW_OP_CONSTRAINT
-#define TARGET_CW_OP_CONSTRAINT {}
+#ifndef TARGET_IASM_OP_CONSTRAINT
+#define TARGET_IASM_OP_CONSTRAINT {}
#endif
/* Comparison function for bsearch to find an opcode/argument number
in the opcode constraint table. */
static int
-cw_op_comp (const void *a, const void *b)
+iasm_op_comp (const void *a, const void *b)
{
- const struct cw_op_constraint *x = a;
- const struct cw_op_constraint *y = b;
+ const struct iasm_op_constraint *x = a;
+ const struct iasm_op_constraint *y = b;
int c = strcasecmp (x->opcode, y->opcode);
if (c)
return c;
@@ -6468,26 +6508,26 @@ cw_op_comp (const void *a, const void *b)
#define m32fpm64fpm80fp m32fp m64fp m80fp
#endif
-#ifndef TARGET_CW_REORDER_ARG
-#define TARGET_CW_REORDER_ARG(OPCODE, NEWARGNUM, NUM_ARGS, ARGNUM)
+#ifndef TARGET_IASM_REORDER_ARG
+#define TARGET_IASM_REORDER_ARG(OPCODE, NEWARGNUM, NUM_ARGS, ARGNUM)
#endif
-#ifndef CW_SYNTH_CONSTRAINTS
-#define CW_SYNTH_CONSTRAINTS(R, ARGNUM, NUM_ARGS, DB)
+#ifndef IASM_SYNTH_CONSTRAINTS
+#define IASM_SYNTH_CONSTRAINTS(R, ARGNUM, NUM_ARGS, DB)
#endif
/* We lookup the OPCODE and return the constraint for the ARGNUM
argument. This is used only for otherwise ambiguous cases. */
static const char*
-cw_constraint_for (const char *opcode, unsigned argnum, unsigned ARG_UNUSED (num_args))
+iasm_constraint_for (const char *opcode, unsigned argnum, unsigned ARG_UNUSED (num_args))
{
/* This table must be sorted. */
- const struct cw_op_constraint db[] = {
- TARGET_CW_OP_CONSTRAINT
+ const struct iasm_op_constraint db[] = {
+ TARGET_IASM_OP_CONSTRAINT
};
- struct cw_op_constraint key;
- struct cw_op_constraint *r;
+ struct iasm_op_constraint key;
+ struct iasm_op_constraint *r;
#ifdef ENABLE_CHECKING
/* Ensure that the table is sorted. */
@@ -6497,18 +6537,18 @@ cw_constraint_for (const char *opcode, unsigned argnum, unsigned ARG_UNUSED (num
size_t i;
once = 1;
for (i=0; i < sizeof (db) / sizeof(db[0]) - 1; ++i)
- gcc_assert (cw_op_comp (&db[i+1], &db[i]) >= 0);
+ gcc_assert (iasm_op_comp (&db[i+1], &db[i]) >= 0);
}
#endif
key.opcode = opcode;
key.argnum = argnum;
- TARGET_CW_REORDER_ARG(opcode, key.argnum, num_args, argnum);
+ TARGET_IASM_REORDER_ARG(opcode, key.argnum, num_args, argnum);
- r = bsearch (&key, db, sizeof (db) / sizeof (db[0]), sizeof (db[0]), cw_op_comp);
+ r = bsearch (&key, db, sizeof (db) / sizeof (db[0]), sizeof (db[0]), iasm_op_comp);
- CW_SYNTH_CONSTRAINTS(r, argnum, num_args, db);
+ IASM_SYNTH_CONSTRAINTS(r, argnum, num_args, db);
/* Any explicitly listed contraint is always used. */
if (r)
@@ -6558,9 +6598,9 @@ cw_constraint_for (const char *opcode, unsigned argnum, unsigned ARG_UNUSED (num
#endif
static void
-cw_process_arg (const char *opcodename, int op_num,
- tree *outputsp, tree *inputsp, tree *uses, unsigned num_args,
- cw_md_extra_info *e)
+iasm_process_arg (const char *opcodename, int op_num,
+ tree *outputsp, tree *inputsp, tree *uses, unsigned num_args,
+ iasm_md_extra_info *e)
{
const char *s;
bool was_output = true;
@@ -6585,7 +6625,7 @@ cw_process_arg (const char *opcodename, int op_num,
#endif
}
else
- s = cw_constraint_for (opcodename, argnum, num_args);
+ s = iasm_constraint_for (opcodename, argnum, num_args);
if (TREE_CODE (var) == FUNCTION_DECL)
{
@@ -6665,7 +6705,7 @@ cw_process_arg (const char *opcodename, int op_num,
parsed as a CW identifier. */
static tree
-cw_asm_identifier (tree expr)
+iasm_identifier (tree expr)
{
const char *opcodename = IDENTIFIER_POINTER (expr);
int len = IDENTIFIER_LENGTH (expr);
@@ -6684,21 +6724,21 @@ cw_asm_identifier (tree expr)
return expr;
}
-#ifndef CW_CANONICALIZE_OPERANDS
-#define CW_CANONICALIZE_OPERANDS(OPCODE, NEW_OPCODE, IARGS, E) (NEW_OPCODE = OPCODE)
+#ifndef IASM_CANONICALIZE_OPERANDS
+#define IASM_CANONICALIZE_OPERANDS(OPCODE, NEW_OPCODE, IARGS, E) (NEW_OPCODE = OPCODE)
#endif
-#ifndef CW_IS_PREFIX
-#define CW_IS_PREFIX(ID)
+#ifndef IASM_IS_PREFIX
+#define IASM_IS_PREFIX(ID)
#endif
-#ifndef CW_PRINT_PREFIX
-#define CW_PRINT_PREFIX(BUF, PREFIX_LIST)
+#ifndef IASM_PRINT_PREFIX
+#define IASM_PRINT_PREFIX(BUF, PREFIX_LIST)
#endif
/* Return true iff id is a instruction prefix. */
bool
-cw_is_prefix (tree ARG_UNUSED (id))
+iasm_is_prefix (tree ARG_UNUSED (id))
{
- CW_IS_PREFIX (id);
+ IASM_IS_PREFIX (id);
return false;
}
@@ -6708,7 +6748,7 @@ cw_is_prefix (tree ARG_UNUSED (id))
have one constraint. */
static int
-cw_num_constraints_1 (tree io)
+iasm_num_constraints_1 (tree io)
{
int num = 0;
while (io)
@@ -6730,13 +6770,13 @@ cw_num_constraints_1 (tree io)
have one constraint. */
static int
-cw_num_constraints (tree inputs, tree outputs)
+iasm_num_constraints (tree inputs, tree outputs)
{
int num;
- num = cw_num_constraints_1 (inputs);
+ num = iasm_num_constraints_1 (inputs);
if (num)
return num;
- num = cw_num_constraints_1 (outputs);
+ num = iasm_num_constraints_1 (outputs);
return num;
}
@@ -6747,7 +6787,7 @@ cw_num_constraints (tree inputs, tree outputs)
alternatives are ever given. "=r,m" "r" becomes "=r,m" "r,r". */
static void
-cw_set_constraints_1 (int num, tree io)
+iasm_set_constraints_1 (int num, tree io)
{
if (num < 2)
return;
@@ -6782,35 +6822,35 @@ cw_set_constraints_1 (int num, tree io)
alternatives are ever given. "=r,m" "r" becomes "=r,m" "r,r". */
static void
-cw_set_constraints (int num, tree inputs, tree outputs)
+iasm_set_constraints (int num, tree inputs, tree outputs)
{
- cw_set_constraints_1 (num, inputs);
- cw_set_constraints_1 (num, outputs);
+ iasm_set_constraints_1 (num, inputs);
+ iasm_set_constraints_1 (num, outputs);
}
-#define CW_MAX_CLOBBERS 3
+#define IASM_MAX_CLOBBERS 3
/* The clobber table for CW style assembly. */
-struct cw_op_clobber
+struct iasm_op_clobber
{
const char *opcode;
- const char *clobbers[CW_MAX_CLOBBERS];
+ const char *clobbers[IASM_MAX_CLOBBERS];
};
/* Comparison function for bsearch to find an opcode/argument number
in the opcode clobber table. */
static int
-cw_op_clobber_comp (const void *a, const void *b)
+iasm_op_clobber_comp (const void *a, const void *b)
{
- const struct cw_op_clobber *x = a;
- const struct cw_op_clobber *y = b;
+ const struct iasm_op_clobber *x = a;
+ const struct iasm_op_clobber *y = b;
return strcasecmp (x->opcode, y->opcode);
}
-#ifndef TARGET_CW_EXTRA_CLOBBERS
-#define TARGET_CW_EXTRA_CLOBBERS { "zzzzz", { 0 } }
+#ifndef TARGET_IASM_EXTRA_CLOBBERS
+#define TARGET_IASM_EXTRA_CLOBBERS { "zzzzz", { 0 } }
#endif
/* Add any extra clobbers to the clobbers list, if they are not
@@ -6820,11 +6860,11 @@ cw_op_clobber_comp (const void *a, const void *b)
rdtsc. */
static void
-cw_extra_clobbers (const char *opcode, tree *clobbersp)
+iasm_extra_clobbers (const char *opcode, tree *clobbersp)
{
- struct cw_op_clobber db[] = { TARGET_CW_EXTRA_CLOBBERS };
- struct cw_op_clobber key;
- struct cw_op_clobber *r;
+ struct iasm_op_clobber db[] = { TARGET_IASM_EXTRA_CLOBBERS };
+ struct iasm_op_clobber key;
+ struct iasm_op_clobber *r;
const char **clobbers;
int num;
@@ -6836,17 +6876,17 @@ cw_extra_clobbers (const char *opcode, tree *clobbersp)
size_t i;
once = 1;
for (i=0; i < sizeof (db) / sizeof(db[0]) - 1; ++i)
- gcc_assert (cw_op_clobber_comp (&db[i+1], &db[i]) >= 0);
+ gcc_assert (iasm_op_clobber_comp (&db[i+1], &db[i]) >= 0);
}
#endif
key.opcode = opcode;
- r = bsearch (&key, db, sizeof (db) / sizeof (db[0]), sizeof (db[0]), cw_op_clobber_comp);
+ r = bsearch (&key, db, sizeof (db) / sizeof (db[0]), sizeof (db[0]), iasm_op_clobber_comp);
if (r == 0)
return;
- for (clobbers = r->clobbers, num = 0; num < CW_MAX_CLOBBERS && *clobbers; ++clobbers, ++num)
+ for (clobbers = r->clobbers, num = 0; num < IASM_MAX_CLOBBERS && *clobbers; ++clobbers, ++num)
{
tree reg = build_string (strlen (*clobbers), *clobbers);
*clobbersp = tree_cons (NULL_TREE, reg, *clobbersp);
@@ -6855,8 +6895,9 @@ cw_extra_clobbers (const char *opcode, tree *clobbersp)
/* Build an asm statement from CW-syntax bits. */
tree
-cw_asm_stmt (tree expr, tree args, int lineno)
+iasm_stmt (tree expr, tree args, int lineno)
{
+ int saved_lineno = input_location.line;
tree sexpr;
tree arg, tail;
tree inputs, outputs, clobbers, uses;
@@ -6864,11 +6905,12 @@ cw_asm_stmt (tree expr, tree args, int lineno)
tree stmt;
unsigned int n, num_args;
const char *opcodename, *new_opcode;
- cw_md_extra_info e;
+ iasm_md_extra_info e;
char *buf;
memset (&e, 0, sizeof (e));
- cw_asm_in_operands = 0;
+ input_location.line = lineno;
+ iasm_in_operands = false;
outputs = NULL_TREE;
inputs = NULL_TREE;
clobbers = NULL_TREE;
@@ -6885,18 +6927,18 @@ cw_asm_stmt (tree expr, tree args, int lineno)
if (TREE_CODE (expr) == ADDR_EXPR)
expr = TREE_OPERAND (expr, 0);
- expr = cw_asm_identifier (expr);
+ expr = iasm_identifier (expr);
opcodename = IDENTIFIER_POINTER (expr);
/* Handle special directives specially. */
if (strcmp (opcodename, "entry") == 0)
- return cw_asm_entry (expr, NULL_TREE, TREE_VALUE (args));
+ return iasm_entry (expr, NULL_TREE, TREE_VALUE (args));
else if (strcmp (opcodename, "fralloc") == 0)
{
/* The correct default size is target-specific, so leave this as
a cookie for the backend. */
- DECL_CW_ASM_FRAME_SIZE (current_function_decl) = -1;
+ DECL_IASM_FRAME_SIZE (current_function_decl) = -1;
if (args)
{
arg = TREE_VALUE (args);
@@ -6905,7 +6947,7 @@ cw_asm_stmt (tree expr, tree args, int lineno)
{
int intval = tree_low_cst (arg, 0);
if (intval >= 0)
- DECL_CW_ASM_FRAME_SIZE (current_function_decl) = intval;
+ DECL_IASM_FRAME_SIZE (current_function_decl) = intval;
else
error ("fralloc argument must be nonnegative");
}
@@ -6916,60 +6958,61 @@ cw_asm_stmt (tree expr, tree args, int lineno)
}
else if (strcmp (opcodename, "frfree") == 0)
{
- DECL_CW_ASM_NORETURN (current_function_decl) = 1;
+ DECL_IASM_NORETURN (current_function_decl) = 1;
/* Create a default-size frame retroactively. */
- if (DECL_CW_ASM_FRAME_SIZE (current_function_decl) == (unsigned int)-2)
- DECL_CW_ASM_FRAME_SIZE (current_function_decl) = (unsigned int)-1;
+ if (DECL_IASM_FRAME_SIZE (current_function_decl) == (unsigned int)-2)
+ DECL_IASM_FRAME_SIZE (current_function_decl) = (unsigned int)-1;
return NULL_TREE;
}
else if (strcmp (opcodename, "nofralloc") == 0)
{
- DECL_CW_ASM_NORETURN (current_function_decl) = 1;
- DECL_CW_ASM_FRAME_SIZE (current_function_decl) = -2;
+ DECL_IASM_NORETURN (current_function_decl) = 1;
+ DECL_IASM_FRAME_SIZE (current_function_decl) = -2;
return NULL_TREE;
}
else if (strcmp (opcodename, "machine") == 0)
- {
- return NULL_TREE;
- }
+ return NULL_TREE;
else if (strcmp (opcodename, "opword") == 0)
- {
- opcodename = ".long";
- }
+ opcodename = " .long";
+ else if (strncmp (opcodename, "_emit", 5) == 0)
+ opcodename = " .byte";
- if (cw_asm_buffer == NULL)
- cw_asm_buffer = xmalloc (4000);
+ if (iasm_buffer == NULL)
+ iasm_buffer = xmalloc (4000);
/* Build .file "file-name" directive. */
- sprintf(cw_asm_buffer, "%s \"%s\"", ".file", input_filename);
- sexpr = build_string (strlen (cw_asm_buffer), cw_asm_buffer);
+ sprintf(iasm_buffer, "%s \"%s\"", ".file", input_filename);
+ sexpr = build_string (strlen (iasm_buffer), iasm_buffer);
stmt = build_stmt (ASM_EXPR, sexpr, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE);
ASM_VOLATILE_P (stmt) = 1;
(void)add_stmt (stmt);
/* Build .line "line-number" directive. */
- sprintf(cw_asm_buffer, "%s %d", ".line", lineno);
- sexpr = build_string (strlen (cw_asm_buffer), cw_asm_buffer);
+ sprintf(iasm_buffer, "%s %d", ".line", lineno);
+ sexpr = build_string (strlen (iasm_buffer), iasm_buffer);
stmt = build_stmt (ASM_EXPR, sexpr, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE);
ASM_VOLATILE_P (stmt) = 1;
(void)add_stmt (stmt);
- cw_asm_buffer[0] = '\0';
+ iasm_buffer[0] = '\0';
- CW_CANONICALIZE_OPERANDS (opcodename, new_opcode, args, &e);
+ IASM_CANONICALIZE_OPERANDS (opcodename, new_opcode, args, &e);
- CW_PRINT_PREFIX(cw_asm_buffer, prefix_list);
+ IASM_PRINT_PREFIX(iasm_buffer, prefix_list);
- strcat (cw_asm_buffer, new_opcode);
- strcat (cw_asm_buffer, " ");
+ if (strcmp (opcodename, " .machine") == 0)
+ e.no_label_map = true;
+
+ strcat (iasm_buffer, new_opcode);
+ strcat (iasm_buffer, " ");
n = 1;
/* Iterate through operands, "printing" each into the asm string. */
for (tail = args; tail; tail = TREE_CHAIN (tail))
{
arg = TREE_VALUE (tail);
if (tail != args)
- strcat (cw_asm_buffer, ", ");
- print_cw_asm_operand (cw_asm_buffer, arg, n, &uses, false, false, &e);
+ strcat (iasm_buffer, ", ");
+ iasm_print_operand (iasm_buffer, arg, n, &uses, false, false, &e);
++n;
}
num_args = n-1;
@@ -6977,11 +7020,11 @@ cw_asm_stmt (tree expr, tree args, int lineno)
/* Treat each C function seen as a input, and all parms/locals as
both inputs and outputs. */
for (n = 0; (int)n < e.num; ++n)
- cw_process_arg (opcodename, n,
- &outputs, &inputs, &uses, num_args, &e);
+ iasm_process_arg (opcodename, n,
+ &outputs, &inputs, &uses, num_args, &e);
/* First, process output args, as they come first to the asm. */
- buf = cw_asm_buffer + strlen (cw_asm_buffer);
+ buf = iasm_buffer + strlen (iasm_buffer);
{
int i = 0;
for (n = 0; (int)n < e.num; ++n)
@@ -7004,10 +7047,10 @@ cw_asm_stmt (tree expr, tree args, int lineno)
}
}
- sexpr = build_string (strlen (cw_asm_buffer), cw_asm_buffer);
+ sexpr = build_string (strlen (iasm_buffer), iasm_buffer);
clobbers = uses;
- if (cw_memory_clobber (opcodename))
+ if (iasm_memory_clobber (opcodename))
{
/* To not clobber all of memory, we would need to know what
memory locations were accessed; for now, punt. */
@@ -7020,17 +7063,18 @@ cw_asm_stmt (tree expr, tree args, int lineno)
Don't do this for other types as it would screw up operands
expected to be in memory. */
for (tail = inputs; tail; tail = TREE_CHAIN (tail))
- TREE_VALUE (tail) = cw_asm_default_function_conversion (TREE_VALUE (tail));
+ TREE_VALUE (tail) = iasm_default_function_conversion (TREE_VALUE (tail));
/* Readjust all the constraints so that the number of alternatives match. */
- cw_set_constraints (cw_num_constraints (inputs, outputs), inputs, outputs);
+ iasm_set_constraints (iasm_num_constraints (inputs, outputs), inputs, outputs);
- cw_extra_clobbers (opcodename, &clobbers);
+ iasm_extra_clobbers (opcodename, &clobbers);
/* Treat as volatile always. */
stmt = build_stmt (ASM_EXPR, sexpr, outputs, inputs, clobbers, uses);
ASM_VOLATILE_P (stmt) = 1;
stmt = add_stmt (stmt);
+ input_location.line = saved_lineno;
return stmt;
}
@@ -7038,7 +7082,7 @@ cw_asm_stmt (tree expr, tree args, int lineno)
offsets, but that's OK for use in asm code. */
static int
-cw_asm_field_offset (tree arg)
+iasm_field_offset (tree arg)
{
return (tree_low_cst (DECL_FIELD_OFFSET (arg), 0)
+ tree_low_cst (DECL_FIELD_BIT_OFFSET (arg), 0) / BITS_PER_UNIT);
@@ -7049,7 +7093,7 @@ cw_asm_field_offset (tree arg)
these all go away. */
static bool
-cw_simple_expr (tree arg)
+iasm_simple_expr (tree arg)
{
if (TREE_CODE (arg) == FIELD_DECL)
return true;
@@ -7062,16 +7106,16 @@ cw_simple_expr (tree arg)
if (TREE_CODE (arg) == PLUS_EXPR
|| TREE_CODE (arg) == MINUS_EXPR)
- return cw_simple_expr (TREE_OPERAND (arg, 0))
- && cw_simple_expr (TREE_OPERAND (arg, 1));
+ return iasm_simple_expr (TREE_OPERAND (arg, 0))
+ && iasm_simple_expr (TREE_OPERAND (arg, 1));
if (TREE_CODE (arg) == NEGATE_EXPR)
- return cw_simple_expr (TREE_OPERAND (arg, 0));
+ return iasm_simple_expr (TREE_OPERAND (arg, 0));
if (TREE_CODE (arg) == ARRAY_REF
&& TREE_CODE (TREE_OPERAND (arg, 1)) == INTEGER_CST
&& TREE_INT_CST_LOW (TREE_OPERAND (arg, 1)) == 0)
- return cw_simple_expr (TREE_OPERAND (arg, 0));
+ return iasm_simple_expr (TREE_OPERAND (arg, 0));
return false;
}
@@ -7081,10 +7125,10 @@ cw_simple_expr (tree arg)
these all go away. */
static int
-cw_asm_expr_val (tree arg)
+iasm_expr_val (tree arg)
{
if (TREE_CODE (arg) == FIELD_DECL)
- return cw_asm_field_offset (arg);
+ return iasm_field_offset (arg);
if (TREE_CODE (arg) == INTEGER_CST)
return int_cst_value (arg);
@@ -7093,98 +7137,89 @@ cw_asm_expr_val (tree arg)
return int_cst_value (convert (integer_type_node, arg));
if (TREE_CODE (arg) == PLUS_EXPR)
- return cw_asm_expr_val (TREE_OPERAND (arg, 0))
- + cw_asm_expr_val (TREE_OPERAND (arg, 1));
+ return iasm_expr_val (TREE_OPERAND (arg, 0))
+ + iasm_expr_val (TREE_OPERAND (arg, 1));
if (TREE_CODE (arg) == MINUS_EXPR)
- return cw_asm_expr_val (TREE_OPERAND (arg, 0))
- - cw_asm_expr_val (TREE_OPERAND (arg, 1));
+ return iasm_expr_val (TREE_OPERAND (arg, 0))
+ - iasm_expr_val (TREE_OPERAND (arg, 1));
if (TREE_CODE (arg) == NEGATE_EXPR)
- return - cw_asm_expr_val (TREE_OPERAND (arg, 0));
+ return - iasm_expr_val (TREE_OPERAND (arg, 0));
if (TREE_CODE (arg) == ARRAY_REF
&& TREE_CODE (TREE_OPERAND (arg, 1)) == INTEGER_CST
&& TREE_INT_CST_LOW (TREE_OPERAND (arg, 1)) == 0)
- return cw_asm_expr_val (TREE_OPERAND (arg, 0));
+ return iasm_expr_val (TREE_OPERAND (arg, 0));
error ("invalid operand for arithmetic in assembly block");
return 0;
}
-#ifndef TARGET_CW_PRINT_OP
-#define TARGET_CW_PRINT_OP(BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E) false
+#ifndef TARGET_IASM_PRINT_OP
+#define TARGET_IASM_PRINT_OP(BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E) false
+#endif
+#ifndef IASM_IMMED_PREFIX
+#define IASM_IMMED_PREFIX(E, BUF)
#endif
-#ifndef CW_IMMED_PREFIX
-#define CW_IMMED_PREFIX(E, BUF)
+#ifndef IASM_OFFSET_PREFIX
+#define IASM_OFFSET_PREFIX(E, BUF)
#endif
-#ifndef CW_OFFSET_PREFIX
-#define CW_OFFSET_PREFIX(E, BUF)
+#ifndef IASM_HIDE_REG
+#define IASM_HIDE_REG(R) false
#endif
-#ifndef CW_HIDE_REG
-#define CW_HIDE_REG(R) false
+#ifndef IASM_SEE_IMMEDIATE
+#define IASM_SEE_IMMEDIATE(E)
#endif
-#ifndef CW_SEE_IMMEDIATE
-#define CW_SEE_IMMEDIATE(E)
+#ifndef IASM_SEE_NO_IMMEDIATE
+#define IASM_SEE_NO_IMMEDIATE(E)
#endif
-#ifndef CW_SEE_NO_IMMEDIATE
-#define CW_SEE_NO_IMMEDIATE(E)
+#ifndef IASM_FUNCTION_MODIFIER
+#define IASM_FUNCTION_MODIFIER ""
#endif
-#ifndef CW_FUNCTION_MODIFIER
-#define CW_FUNCTION_MODIFIER ""
+#ifndef IASM_VALID_PIC
+#define IASM_VALID_PIC(D,E)
#endif
/* Force the last operand to have constraint C. */
void
-cw_force_constraint (const char *c, cw_md_extra_info *e)
+iasm_force_constraint (const char *c, iasm_md_extra_info *e)
{
e->dat[e->num].constraint = c;
}
-#if defined(TARGET_386)
-/* Map a register name to a high level tree type for a VAR_DECL of
- that type, whose RTL will refer to the given register. */
+/* We force some forms to come from memory to prevent the optimizer
+ from trying to put them in registers on x86. */
-static tree
-cw_type_for (tree arg)
+static void
+iasm_maybe_force_mem (tree arg, char *buf, unsigned argnum, bool must_be_reg, iasm_md_extra_info *e)
{
- tree type = NULL_TREE;
-
- if (IDENTIFIER_LENGTH (arg) > 2
- && IDENTIFIER_POINTER (arg)[0] == '%')
- {
- enum machine_mode mode = VOIDmode;
- if (IDENTIFIER_POINTER (arg)[1] == 'e')
- mode = SImode;
- else if (/* IDENTIFIER_POINTER (arg)[2] == 'h'
- || */ IDENTIFIER_POINTER (arg)[2] == 'l')
- mode = QImode;
- else if (IDENTIFIER_POINTER (arg)[2] == 'x')
- mode = HImode;
- else if (IDENTIFIER_POINTER (arg)[1] == 'r')
- mode = DImode;
- else if (IDENTIFIER_POINTER (arg)[1] == 'x')
- mode = SFmode;
- else if (IDENTIFIER_POINTER (arg)[1] == 'm')
- mode = SFmode;
-
- if (mode != VOIDmode)
- type = c_common_type_for_mode (mode, 1);
- }
-
- return type;
-}
+#if defined (TARGET_386)
+ /* For now, on x86, we want all arguments to be from memory, unless
+ they are tied to a register, or we're in a known context. SSA
+ doesn't like ARRAY_REFs and +m with will attempt to use
+ additional registers when not optimizing, so we punt with just
+ "m", as all memory instructions are currently marked as
+ 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);
+#endif
+ iasm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
+#if defined (TARGET_386)
+ iasm_force_constraint (0, e);
#endif
+}
/* Print an operand according to its tree type. MUST_BE_REG is true,
iff we know the operand must be a register. MUST_NOT_BE_REG is true,
iff we know the operand must not be a register. */
void
-print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
- tree *uses,
- bool must_be_reg, bool must_not_be_reg, cw_md_extra_info *e)
+iasm_print_operand (char *buf, tree arg, unsigned argnum,
+ tree *uses,
+ bool must_be_reg, bool must_not_be_reg, iasm_md_extra_info *e)
{
HOST_WIDE_INT bitsize, bitpos;
tree offset;
@@ -7197,54 +7232,48 @@ print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
switch (TREE_CODE (arg))
{
case INTEGER_CST:
- CW_IMMED_PREFIX (e, buf);
+ IASM_IMMED_PREFIX (e, buf);
sprintf (buf + strlen (buf), HOST_WIDE_INT_PRINT_DEC, tree_low_cst (arg, 0));
break;
case LABEL_DECL:
TREE_USED (arg) = 1;
- CW_OFFSET_PREFIX (e, buf);
+ if (e->no_label_map
+ && strncmp (IDENTIFIER_POINTER (DECL_NAME (arg)),
+ "LASM$", 5) == 0)
+ {
+ const char *name = IDENTIFIER_POINTER (DECL_NAME (arg)) + 5;
+ /* APPLE LOCAL begin remove when 4512478 is fixed */
+#if defined(TARGET_TOC)
+ if (strcmp (name, "all") == 0)
+ {
+ if (TARGET_64BIT)
+ name = "ppc64";
+ else
+ name = "ppc970";
+ }
+#endif
+ /* APPLE LOCAL end remove when 4512478 is fixed */
+ sprintf (buf + strlen (buf), "%s", name);
+ break;
+ }
+ IASM_OFFSET_PREFIX (e, buf);
arg = build1 (ADDR_EXPR, ptr_type_node, arg);
/* There was no other spelling I could find that would work.
:-( Hope this stays working. */
- cw_force_constraint ("X", e);
- cw_asm_get_register_var (arg, "l", buf, argnum, must_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("X", e);
+ iasm_get_register_var (arg, "l", buf, argnum, must_be_reg, e);
+ iasm_force_constraint (0, e);
break;
case IDENTIFIER_NODE:
#if defined(TARGET_386)
- {
- /* We raise the code from a named register into a VAR_DECL of
- an appropriate type that refers to the register so that
- reload doesn't run out of registers. */
-
- int regno = decode_reg_name (IDENTIFIER_POINTER (arg));
- if (regno >= 0)
- {
- tree decl = NULL_TREE;
-
- /* decl = cw_regs[arg]; */
- if (decl == 0)
- {
- tree type = cw_type_for (arg);
- if (type)
- {
- decl = /* cw_regs[arg] = */ build_decl (VAR_DECL, arg, type);
- DECL_REGISTER (decl) = 1;
- C_DECL_REGISTER (decl) = 1;
- DECL_HARD_REGISTER (decl) = 1;
- change_decl_assembler_name (decl, arg);
- }
- }
-
- if (decl)
- {
- cw_asm_get_register_var (decl, "", buf, argnum, must_be_reg, e);
- break;
- }
- }
- }
+ arg = iasm_raise_reg (arg);
+ if (TREE_CODE (arg) == VAR_DECL)
+ {
+ iasm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
+ break;
+ }
#endif
if (IDENTIFIER_LENGTH (arg) > 0 && IDENTIFIER_POINTER (arg)[0] == '%')
strcat (buf, "%");
@@ -7252,7 +7281,7 @@ print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
{
int regno = decode_reg_name (IDENTIFIER_POINTER (arg));
- if (CW_HIDE_REG (regno))
+ if (IASM_HIDE_REG (regno))
regno = -1;
if (regno >= 0)
@@ -7285,7 +7314,9 @@ print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
const char *real_name;
tree id;
- CW_OFFSET_PREFIX (e, buf);
+ IASM_VALID_PIC (arg, e);
+
+ IASM_OFFSET_PREFIX (e, buf);
mark_referenced (DECL_ASSEMBLER_NAME (arg));
real_name = targetm.strip_name_encoding (name);
id = maybe_get_identifier (real_name);
@@ -7303,66 +7334,53 @@ print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
mark_decl_referenced (arg);
}
else
- {
-#if defined (TARGET_386)
- /* For now, on x86, we for all arguments to be from memory,
- unless they are tied to a register, or we're in a known
- context. */
- if (! DECL_HARD_REGISTER (arg)
- && e->dat[e->num].constraint == 0)
- cw_force_constraint ("+m", e);
-#endif
- cw_asm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
-#if defined (TARGET_386)
- cw_force_constraint (0, e);
-#endif
- }
+ iasm_maybe_force_mem (arg, buf, argnum, must_be_reg, e);
break;
case FUNCTION_DECL:
- cw_asm_get_register_var (arg, CW_FUNCTION_MODIFIER, buf, argnum, must_be_reg, e);
+ iasm_get_register_var (arg, IASM_FUNCTION_MODIFIER, buf, argnum, must_be_reg, e);
break;
case COMPOUND_EXPR:
/* "Compound exprs" are really offset+register constructs. */
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- false, true, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ false, true, e);
strcat (buf, "(");
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
- ! must_not_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
+ ! must_not_be_reg, must_not_be_reg, e);
strcat (buf, ")");
break;
case MINUS_EXPR:
case PLUS_EXPR:
- if (cw_simple_expr (arg))
+ if (iasm_simple_expr (arg))
{
- sprintf (buf + strlen (buf), "%d", cw_asm_expr_val (arg));
+ sprintf (buf + strlen (buf), "%d", iasm_expr_val (arg));
break;
}
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- false, true, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ false, true, e);
if (TREE_CODE (arg) == MINUS_EXPR)
strcat (buf, "-");
else
strcat (buf, "+");
- CW_SEE_IMMEDIATE(e);
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
- false, true, e);
- CW_SEE_NO_IMMEDIATE(e);
+ IASM_SEE_IMMEDIATE(e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
+ false, true, e);
+ IASM_SEE_NO_IMMEDIATE(e);
break;
case FIELD_DECL:
- sprintf (buf + strlen (buf), "%d", cw_asm_field_offset (arg));
+ sprintf (buf + strlen (buf), "%d", iasm_field_offset (arg));
break;
case COMPONENT_REF:
/* APPLE LOCAL begin radar 4218231 */
op0 = TREE_OPERAND (arg, 0);
if (TREE_CODE (op0) == VAR_DECL || TREE_CODE (op0) == COMPONENT_REF)
- cw_asm_get_register_var (arg, "", buf, argnum, false, e);
+ iasm_get_register_var (arg, "", buf, argnum, false, e);
else
{
get_inner_reference (arg, &bitsize, &bitpos, &offset, &mode,
@@ -7374,34 +7392,39 @@ print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
(long long int) (bitpos / BITS_PER_UNIT));
strcat (buf, "(");
/* Catch a couple different flavors of component refs. */
- print_cw_asm_operand (buf, TREE_OPERAND (op0, 0), argnum, uses,
- true, false, e);
+ iasm_print_operand (buf, TREE_OPERAND (op0, 0), argnum, uses,
+ true, false, e);
strcat (buf, ")");
}
/* APPLE LOCAL end radar 4218231 */
break;
case ARRAY_REF:
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL)
+ {
+ iasm_maybe_force_mem (arg, buf, argnum, must_be_reg, e);
+ break;
+ }
if (TREE_CODE (TREE_OPERAND (arg, 1)) != INTEGER_CST
|| TREE_INT_CST_LOW (TREE_OPERAND (arg, 1)) != 0)
error ("array references, other than [0], not supported");
else
- sprintf (buf + strlen (buf), "%d", cw_asm_field_offset (TREE_OPERAND (arg, 0)));
+ sprintf (buf + strlen (buf), "%d", iasm_field_offset (TREE_OPERAND (arg, 0)));
break;
case NEGATE_EXPR:
strcat (buf, "-");
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
break;
case INDIRECT_REF:
- cw_asm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
+ iasm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
break;
default:
- if (TARGET_CW_PRINT_OP (buf, arg, argnum, uses,
- must_be_reg, must_not_be_reg, e))
+ if (TARGET_IASM_PRINT_OP (buf, arg, argnum, uses,
+ must_be_reg, must_not_be_reg, e))
break;
/* Something is wrong, most likely a user error. */
@@ -7415,8 +7438,8 @@ print_cw_asm_operand (char *buf, tree arg, unsigned argnum,
operand must be a register. */
void
-cw_asm_get_register_var (tree var, const char *modifier, char *buf, unsigned argnum,
- bool must_be_reg, cw_md_extra_info *e)
+iasm_get_register_var (tree var, const char *modifier, char *buf, unsigned argnum,
+ bool must_be_reg, iasm_md_extra_info *e)
{
unsigned int n;
@@ -7449,11 +7472,11 @@ cw_asm_get_register_var (tree var, const char *modifier, char *buf, unsigned arg
}
tree
-cw_asm_reg_name (tree id)
+iasm_reg_name (tree id)
{
-#ifdef CW_ASM_REGISTER_NAME
+#ifdef IASM_REGISTER_NAME
char buf[100];
- const char *newname = CW_ASM_REGISTER_NAME (IDENTIFIER_POINTER (id), buf);
+ const char *newname = IASM_REGISTER_NAME (IDENTIFIER_POINTER (id), buf);
if (newname)
return get_identifier (newname);
#else
@@ -7465,7 +7488,7 @@ cw_asm_reg_name (tree id)
/* Build an asm label from CW-syntax bits. */
tree
-cw_asm_label (tree labid, int atsign)
+iasm_label (tree labid, int atsign)
{
tree sexpr;
tree inputs = NULL_TREE, outputs = NULL_TREE, clobbers = NULL_TREE;
@@ -7475,23 +7498,23 @@ cw_asm_label (tree labid, int atsign)
STRIP_NOPS (labid);
- if (cw_asm_buffer == NULL)
- cw_asm_buffer = xmalloc (4000);
+ 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 (cw_asm_buffer, HOST_WIDE_INT_PRINT_UNSIGNED, tree_low_cst (labid, 0));
- labid = get_identifier (cw_asm_buffer);
+ 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, '@');
- cw_asm_buffer[0] = '\0';
- label = get_cw_asm_label (labid);
+ iasm_buffer[0] = '\0';
+ label = iasm_get_label (labid);
#if 0
/* Ideally I'd like to do this, but, it moves the label in:
@@ -7512,12 +7535,12 @@ cw_asm_label (tree labid, int atsign)
stmt = add_stmt (build_stmt (LABEL_EXPR, label));
#else
#if 0
- strcat (cw_asm_buffer, IDENTIFIER_POINTER (DECL_NAME (label)));
- strcat (cw_asm_buffer, ":");
+ 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 (cw_asm_buffer, "%%l0: # %s", IDENTIFIER_POINTER (DECL_NAME (label)));
+ sprintf (iasm_buffer, "%%l0: # %s", IDENTIFIER_POINTER (DECL_NAME (label)));
#endif
l = build1 (ADDR_EXPR, ptr_type_node, label);
@@ -7527,7 +7550,7 @@ cw_asm_label (tree labid, int atsign)
str = build_string (1, "X");
one = build_tree_list (build_tree_list (NULL_TREE, str), l);
inputs = chainon (NULL_TREE, one);
- sexpr = build_string (strlen (cw_asm_buffer), cw_asm_buffer);
+ sexpr = build_string (strlen (iasm_buffer), iasm_buffer);
/* Simple asm statements are treated as volatile. */
stmt = build_stmt (ASM_EXPR, sexpr, outputs, inputs, clobbers, NULL_TREE);
@@ -7553,7 +7576,7 @@ prepend_char_identifier (tree ident, char ch)
suffix. */
tree
-cw_get_identifier (tree id, const char *str)
+iasm_get_identifier (tree id, const char *str)
{
char *buf;
int len = strlen (str);
@@ -7565,19 +7588,19 @@ cw_get_identifier (tree id, const char *str)
}
void
-clear_cw_asm_labels (void)
+iasm_clear_labels (void)
{
- if (!cw_asm_labels)
- VARRAY_TREE_INIT (cw_asm_labels, 40, "cw_asm_labels");
- if (!cw_asm_labels_uniq)
- VARRAY_TREE_INIT (cw_asm_labels_uniq, 40, "cw_asm_labels_uniq");
- VARRAY_POP_ALL (cw_asm_labels);
- VARRAY_POP_ALL (cw_asm_labels_uniq);
+ 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 cw_ha16;
-static GTY(()) tree cw_hi16;
-static GTY(()) tree cw_lo16;
+static GTY(()) tree iasm_ha16;
+static GTY(()) tree iasm_hi16;
+static GTY(()) tree iasm_lo16;
/* Given an identifier not otherwise found in the high level language, create up
a meaning for it. */
@@ -7588,14 +7611,14 @@ static GTY(()) tree cw_lo16;
that are not labels. */
tree
-cw_do_id (tree id)
+iasm_do_id (tree id)
{
tree newid;
- if ((newid = cw_asm_reg_name (id)))
+ if ((newid = iasm_reg_name (id)))
return newid;
-#ifdef CW_ASM_SPECIAL_LABEL
- if ((newid = CW_ASM_SPECIAL_LABEL (id)))
+#ifdef IASM_SPECIAL_LABEL
+ if ((newid = IASM_SPECIAL_LABEL (id)))
return newid;
#endif
@@ -7618,7 +7641,7 @@ cw_do_id (tree id)
#endif
/* Assume undeclared symbols are labels. */
- return get_cw_asm_label (id);
+ return iasm_get_label (id);
}
/* Given a label identifier and a flag indicating whether it had an @
@@ -7626,35 +7649,35 @@ cw_do_id (tree id)
assembler will like. */
static tree
-get_cw_asm_label (tree labid)
+iasm_get_label (tree labid)
{
unsigned int n;
const char *labname;
char *buf;
tree newid;
- if (!cw_ha16)
+ if (!iasm_ha16)
{
- cw_ha16 = get_identifier ("ha16");
- cw_hi16 = get_identifier ("hi16");
- cw_lo16 = get_identifier ("lo16");
+ iasm_ha16 = get_identifier ("ha16");
+ iasm_hi16 = get_identifier ("hi16");
+ iasm_lo16 = get_identifier ("lo16");
}
/* lo16(), ha16() and hi16() should be left unmolested. */
- if (labid == cw_lo16)
- return cw_lo16;
- else if (labid == cw_ha16)
- return cw_ha16;
- else if (labid == cw_hi16)
- return cw_hi16;
+ if (labid == iasm_lo16)
+ return iasm_lo16;
+ else if (labid == iasm_ha16)
+ return iasm_ha16;
+ else if (labid == iasm_hi16)
+ return iasm_hi16;
- for (n = 0; n < VARRAY_ACTIVE_SIZE (cw_asm_labels); ++n)
+ for (n = 0; n < VARRAY_ACTIVE_SIZE (iasm_labels); ++n)
{
- if (labid == VARRAY_TREE (cw_asm_labels, n))
- return VARRAY_TREE (cw_asm_labels_uniq, n);
+ if (labid == VARRAY_TREE (iasm_labels, n))
+ return VARRAY_TREE (iasm_labels_uniq, n);
}
/* Not already seen, make up a label. */
- VARRAY_PUSH_TREE (cw_asm_labels, labid);
+ VARRAY_PUSH_TREE (iasm_labels, labid);
buf = (char *) alloca (IDENTIFIER_LENGTH (labid) + 20);
sprintf (buf, "LASM$");
/* Assembler won't like a leading @-sign, so make it into a $ if
@@ -7668,7 +7691,7 @@ get_cw_asm_label (tree labid)
strcat (buf, labname);
newid = get_identifier (buf);
newid = define_label (input_location, newid);
- VARRAY_PUSH_TREE (cw_asm_labels_uniq, newid);
+ VARRAY_PUSH_TREE (iasm_labels_uniq, newid);
return newid;
}
@@ -7677,7 +7700,7 @@ get_cw_asm_label (tree labid)
assembly statement. */
tree
-cw_asm_build_register_offset (tree offset, tree regname)
+iasm_build_register_offset (tree offset, tree regname)
{
tree t;
@@ -7693,7 +7716,7 @@ cw_asm_build_register_offset (tree offset, tree regname)
valid entry statement, and then generate traditional asm statements
to create the label. The entry may be either static or extern. */
tree
-cw_asm_entry (tree keyword, tree scspec, tree fn)
+iasm_entry (tree keyword, tree scspec, tree fn)
{
int externify = 0;
tree stmt, inputs, str, one, strlab;
@@ -7721,7 +7744,7 @@ cw_asm_entry (tree keyword, tree scspec, tree fn)
return error_mark_node;
}
- fn = cw_asm_default_function_conversion (fn);
+ fn = iasm_default_function_conversion (fn);
str = build_string (1, "s");
one = build_tree_list (build_tree_list (NULL_TREE, str), fn);
inputs = chainon (NULL_TREE, one);
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 8d71fa2769d..802ad75c7b2 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4829,14 +4829,14 @@ grokdeclarator (const struct c_declarator *declarator,
}
/* APPLE LOCAL begin CW asm blocks */
- if (declspecs->cw_asm_specbit)
+ if (declspecs->iasm_asm_specbit)
{
/* Record that this is a decl of a CW-style asm function. */
- if (flag_cw_asm_blocks)
+ if (flag_iasm_blocks)
{
- DECL_CW_ASM_FUNCTION (decl) = 1;
- DECL_CW_ASM_NORETURN (decl) = 0;
- DECL_CW_ASM_FRAME_SIZE (decl) = -2;
+ DECL_IASM_ASM_FUNCTION (decl) = 1;
+ DECL_IASM_NORETURN (decl) = 0;
+ DECL_IASM_FRAME_SIZE (decl) = -2;
}
else
error ("asm functions not enabled, use `-fasm-blocks'");
@@ -6201,10 +6201,10 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
/* If this was a function declared as an assembly function, change
the state to expect to see C decls, possibly followed by assembly
code. */
- if (DECL_CW_ASM_FUNCTION (current_function_decl))
+ if (DECL_IASM_ASM_FUNCTION (current_function_decl))
{
- cw_asm_state = cw_asm_decls;
- cw_asm_in_decl = 0;
+ iasm_state = iasm_decls;
+ iasm_in_decl = false;
current_function_returns_abnormally = 1;
TREE_NO_WARNING (current_function_decl) = 1;
}
@@ -7091,7 +7091,7 @@ build_null_declspecs (void)
ret->volatile_p = false;
ret->restrict_p = false;
/* APPLE LOCAL CW asm blocks */
- ret->cw_asm_specbit = false;
+ ret->iasm_asm_specbit = false;
/* APPLE LOCAL private extern */
ret->private_extern_p = false;
return ret;
@@ -7448,8 +7448,8 @@ declspecs_add_scspec (struct c_declspecs *specs, tree scspec)
{
/* APPLE LOCAL begin CW asm blocks */
case RID_ASM:
- dupe = specs->cw_asm_specbit;
- specs->cw_asm_specbit = true;
+ dupe = specs->iasm_asm_specbit;
+ specs->iasm_asm_specbit = true;
break;
/* APPLE LOCAL end CW asm blocks */
case RID_INLINE:
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index e5d77499496..559933d341e 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -67,13 +67,13 @@ int c_lex_string_translate = 1;
bool c_lex_return_raw_strings = false;
/* APPLE LOCAL begin CW asm blocks */
-void cw_skip_to_eol (void);
+void iasm_skip_to_eol (void);
/* This points to the token that we're going to save briefly while
returning EOL/BOL tokens. (This is global but static instead
static in c_lex() so as to avoid pointless init in non-asm
case.) */
-static const cpp_token *cw_asm_saved_token = NULL;
+static const cpp_token *iasm_saved_token = NULL;
/* This tracks recursion in c_lex calls. Lexer recursion can happen
in pragma processing for instance, but we don't any of the asm
@@ -81,7 +81,7 @@ static const cpp_token *cw_asm_saved_token = NULL;
static int c_lex_depth;
void
-cw_skip_to_eol (void)
+iasm_skip_to_eol (void)
{
const cpp_token *tok;
do
@@ -92,19 +92,19 @@ cw_skip_to_eol (void)
_cpp_backup_tokens (parse_in, 1);
}
-/* Insert cw_split_next as the next character read from the lexer.
+/* Insert iasm_split_next as the next character read from the lexer.
This is used in order to differentiate op. from op . in the parser,
- we insert a space after op when op . is seen. cw_split_next is the
- . and here we push it so the lexer will return it. When we move to
- an rd parser, rewrite in the C++ style and just use PREV_WHITE
- instead. */
+ we insert a space after op when op . is seen. iasm_split_next is
+ the . and here we push it so the lexer will return it. When we
+ move to an rd parser, rewrite in the C++ style and just use
+ PREV_WHITE instead. */
void
-cw_insert_saved_token (void)
+iasm_insert_saved_token (void)
{
- gcc_assert (cw_asm_saved_token == 0);
- cw_asm_saved_token = cw_split_next;
- cw_split_next = 0;
+ gcc_assert (iasm_saved_token == 0);
+ iasm_saved_token = iasm_split_next;
+ iasm_split_next = 0;
}
/* APPLE LOCAL end CW asm blocks */
@@ -395,28 +395,28 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
/* APPLE LOCAL begin CW asm blocks */
/* Make a local copy of the flag for efficiency, since the compiler can't
figure that it won't change during a compilation. */
- int flag_cw_asm_blocks_local = flag_cw_asm_blocks;
- if (flag_cw_asm_blocks_local)
+ int flag_iasm_blocks_local = flag_iasm_blocks;
+ if (flag_iasm_blocks_local)
++c_lex_depth;
/* APPLE LOCAL end CW asm blocks */
timevar_push (TV_CPP);
retry:
/* APPLE LOCAL begin CW asm blocks */
- if (cw_asm_at_bol)
+ if (iasm_at_bol)
{
- cw_asm_at_bol = 0;
+ iasm_at_bol = false;
--c_lex_depth;
timevar_pop (TV_CPP);
return CPP_BOL;
}
/* If there's a token we saved while returning the special BOL
token, return it now. */
- if (cw_asm_saved_token)
+ if (iasm_saved_token)
{
- tok = cw_asm_saved_token;
+ tok = iasm_saved_token;
type = tok->type;
- cw_asm_saved_token = NULL;
+ iasm_saved_token = NULL;
goto bypass;
}
/* APPLE LOCAL end CW asm blocks */
@@ -426,17 +426,17 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
/* APPLE LOCAL begin CW asm blocks */
/* This test should be as efficient as possible, because it affects
all lexing with or without CW asm enabled. */
- if (flag_cw_asm_blocks_local && cw_asm_state != cw_asm_none && c_lex_depth == 1
+ if (flag_iasm_blocks_local && iasm_state != iasm_none && c_lex_depth == 1
&& type != CPP_PADDING)
{
bool do_bol = false;
/* "}" switches us out of our special mode. */
- if (tok->type == CPP_CLOSE_BRACE && cw_asm_state >= cw_asm_decls)
+ if (tok->type == CPP_CLOSE_BRACE && iasm_state >= iasm_decls)
{
- cw_asm_state = cw_asm_none;
- cw_asm_saved_token = tok;
- cw_asm_at_bol = 0;
+ iasm_state = iasm_none;
+ iasm_saved_token = tok;
+ iasm_at_bol = false;
--c_lex_depth;
timevar_pop (TV_CPP);
return CPP_EOL;
@@ -452,50 +452,50 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
We're not quite as good as CW yet, because CW knows about the
complete list of valid opcodes, and will try to take anything
as a decl that is not in the opcode list. */
- if (cw_asm_state == cw_asm_decls
- && !cw_asm_in_decl)
+ if (iasm_state == iasm_decls
+ && !iasm_in_decl)
{
if (tok->type == CPP_ATSIGN
|| tok->type == CPP_DOT
|| (tok->type == CPP_SEMICOLON)
|| (tok->type == CPP_NAME
&& (*value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node)))
- && !cw_asm_typename_or_reserved (*value)))
+ && !iasm_typename_or_reserved (*value)))
{
- cw_asm_state = cw_asm_asm;
- inside_cw_asm_block = 1;
+ iasm_state = iasm_asm;
+ inside_iasm_block = true;
do_bol = true;
- cw_asm_at_bol = 1;
- clear_cw_asm_labels ();
+ iasm_at_bol = true;
+ iasm_clear_labels ();
}
else
{
- cw_asm_in_decl = 1;
+ iasm_in_decl = true;
}
}
- if (cw_asm_state == cw_asm_asm)
+ if (iasm_state == iasm_asm)
{
/* If we're in the asm block, save the token at the
beginning of the line and return a beginning-of-line
token instead. */
if ((tok->flags & BOL) || do_bol)
{
- cw_asm_saved_token = tok;
- cw_asm_at_bol = !cw_asm_at_bol;
+ iasm_saved_token = tok;
+ iasm_at_bol = !iasm_at_bol;
--c_lex_depth;
/* In between lines, return first the EOL. */
timevar_pop (TV_CPP);
- return (cw_asm_at_bol ? CPP_EOL : CPP_BOL);
+ return (iasm_at_bol ? CPP_EOL : CPP_BOL);
}
- if (! cw_asm_in_operands
+ if (! iasm_in_operands
&& (type == CPP_DOT
|| type == CPP_MINUS
|| type == CPP_PLUS))
{
if (tok->flags & PREV_WHITE)
- cw_split_next = tok;
+ iasm_split_next = tok;
else
- cw_split_next = 0;
+ iasm_split_next = 0;
}
}
}
@@ -511,7 +511,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
case CPP_NAME:
*value = HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node));
/* APPLE LOCAL begin CW asm blocks */
- if (cw_asm_state >= cw_asm_decls
+ if (iasm_state >= iasm_decls
&& flag_ms_asms
&& strcasecmp (IDENTIFIER_POINTER (HT_IDENT_TO_GCC_IDENT (HT_NODE (tok->val.node))),
"offset") == 0)
@@ -550,7 +550,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
case CPP_ATSIGN:
/* APPLE LOCAL begin CW asm blocks */
- if (cw_asm_state >= cw_asm_decls)
+ if (iasm_state >= iasm_decls)
{
/* Return the @-sign verbatim. */
*value = NULL_TREE;
@@ -588,11 +588,11 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
default:
/* APPLE LOCAL begin CW asm blocks C++ */
- if (flag_cw_asm_blocks_local)
+ if (flag_iasm_blocks_local)
{
/* This is necessary for C++, as we don't have the tight
integration between the lexer and the parser... */
- cw_asm_saved_token = tok;
+ iasm_saved_token = tok;
/* Return the @-sign verbatim. */
*value = NULL;
tok = lasttok;
@@ -608,14 +608,14 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
break;
}
/* APPLE LOCAL begin CW asm blocks C++ */
- if (flag_cw_asm_blocks_local)
+ if (flag_iasm_blocks_local)
{
do
tok = cpp_get_token (parse_in);
while (tok->type == CPP_PADDING);
/* This is necessary for C++, as we don't have the tight
integration between the lexer and the parser... */
- cw_asm_saved_token = tok;
+ iasm_saved_token = tok;
/* Return the @-sign verbatim. */
*value = NULL;
tok = lasttok;
@@ -631,7 +631,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
/* Because we don't recognize inline asm commments during
lexing, we have to pass this back to the parser to error out
with or eat as a comment as appropriate. */
- if (flag_cw_asm_blocks_local)
+ if (flag_iasm_blocks_local)
{
*value = NULL;
break;
@@ -656,7 +656,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
/* Because we don't recognize inline asm commments during
lexing, we have to pass this back to the parser to error
out with or eat as a comment as appropriate. */
- if (flag_cw_asm_blocks_local)
+ if (flag_iasm_blocks_local)
{
*value = NULL;
break;
@@ -692,7 +692,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
/* APPLE LOCAL begin CW asm blocks */
case CPP_MULT:
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
/* Check and replace use of '*' with '.' if '*' is followed by '-'
or '+'. This is to allow "b *+8" which is disallwed by darwin's
@@ -701,7 +701,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
do
tok = cpp_get_token (parse_in);
while (tok->type == CPP_PADDING);
- cw_asm_saved_token = tok;
+ iasm_saved_token = tok;
if (tok->type == CPP_PLUS || tok->type == CPP_MINUS)
type = CPP_DOT;
tok = lasttok;
@@ -734,7 +734,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
*cpp_flags = tok->flags;
/* APPLE LOCAL begin CW asm blocks */
- if (flag_cw_asm_blocks_local)
+ if (flag_iasm_blocks_local)
--c_lex_depth;
/* APPLE LOCAL end CW asm blocks */
@@ -995,9 +995,13 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
if (tok->type == CPP_WSTRING)
wide = true;
/* APPLE LOCAL begin pascal strings */
- else if (CPP_OPTION (parse_in, pascal_strings)
- && str.text[1] == '\\' && str.text[2] == 'p')
- pascal_p = true;
+ if (CPP_OPTION (parse_in, pascal_strings))
+ {
+ if (wide && str.text[0] == 'L' && str.text[2] == '\\' && str.text[3] == 'p')
+ pascal_p = true;
+ else if (str.text[1] == '\\' && str.text[2] == 'p')
+ pascal_p = true;
+ }
/* APPLE LOCAL end pascal strings */
retry:
@@ -1039,7 +1043,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
strs = (cpp_string *) obstack_finish (&str_ob);
/* APPLE LOCAL begin pascal strings */
- if (wide || objc_string)
+ if (objc_string)
pascal_p = false;
/* APPLE LOCAL end pascal strings */
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 66700badaf5..42868c5a36c 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -621,7 +621,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
/* APPLE LOCAL begin CW asm blocks */
case OPT_fasm_blocks:
- flag_cw_asm_blocks = value;
+ flag_iasm_blocks = value;
break;
/* APPLE LOCAL end CW asm blocks */
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index dd7d28b4e45..0b18564eefd 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -153,10 +153,10 @@ do { \
/* APPLE LOCAL begin CW asm blocks */
/* This token is a pseudo-storage-class. */
-%token CW_ASM_KEYWORD
-%type <ttype> CW_ASM_KEYWORD
+%token IASM_ASM_KEYWORD
+%type <ttype> IASM_ASM_KEYWORD
/* These tokens indicate beginning and end of each asm line. */
-%token CW_ASM_BOL CW_ASM_EOL
+%token IASM_BOL IASM_EOL
/* APPLE LOCAL end CW asm blocks */
/* Add precedence rules to solve dangling else s/r conflict */
@@ -257,14 +257,14 @@ do { \
%type <ttype> identifiers_or_typenames
/* APPLE LOCAL begin CW asm blocks */
-%type <ttype> cw_identifier cw_identifier1 cw_maybe_prefix
-%type <exprtype> cw_asm_expr_no_commas cw_asm_unary_expr
-%type <exprtype> cw_asm_primary
-%type <ttype> cw_asm_operands cw_nonnull_asm_operands
-%type <exprtype> cw_asm_operand
-%type <ttype> cw_asm_stmt cw_asm_stmt_nobol single_cw_asm_stmt
-%type <ttype> cw_asm_compstmt cw_asm_compstmt_start
-/*cw_asm_compstmt_nostart */
+%type <ttype> iasm_identifier iasm_identifier1 iasm_maybe_prefix
+%type <exprtype> iasm_expr_no_commas iasm_unary_expr
+%type <exprtype> iasm_primary
+%type <ttype> iasm_operands iasm_nonnull_operands
+%type <exprtype> iasm_operand
+%type <ttype> iasm_stmt iasm_stmt_nobol single_iasm_stmt
+%type <ttype> iasm_compstmt iasm_compstmt_start
+/* iasm_compstmt_nostart */
/* APPLE LOCAL end CW asm blocks */
%type <itype> setspecs setspecs_fp extension
@@ -396,12 +396,12 @@ static inline int _yylex (void);
static int yylex (void);
static void init_reswords (void);
/* APPLE LOCAL begin CW asm blocks */
-static int cw_asm_lineno = 0;
-#ifndef CW_SEE_OPCODE
-#define CW_SEE_OPCODE(YYCHAR, T) YYCHAR
+static int iasm_lineno = 0;
+#ifndef IASM_SEE_OPCODE
+#define IASM_SEE_OPCODE(YYCHAR, T) YYCHAR
#endif
-static tree c_parse_cw_maybe_prefix (tree id);
+static tree c_parse_iasm_maybe_prefix (tree id);
/* APPLE LOCAL end CW asm blocks */
/* Initialization routine for this file. */
@@ -897,7 +897,7 @@ datadecl:
lineno_decl:
save_location decl
/* APPLE LOCAL CW asm blocks */
- { if (flag_cw_asm_blocks) cw_asm_in_decl = 0; }
+ { if (flag_iasm_blocks) iasm_in_decl = false; }
;
/* records the type and storage class specs to use for processing
@@ -1478,7 +1478,7 @@ any_word:
scspec:
STATIC
/* APPLE LOCAL CW asm blocks */
- | CW_ASM_KEYWORD
+ | IASM_ASM_KEYWORD
| SCSPEC
;
@@ -2116,7 +2116,7 @@ compstmt_nostart: '}'
| maybe_label_decls compstmt_contents_nonempty '}'
/* APPLE LOCAL begin CW asm blocks */
{
- if (flag_cw_asm_blocks) inside_cw_asm_block = 0;
+ if (flag_iasm_blocks) inside_iasm_block = 0;
}
/* APPLE LOCAL end CW asm blocks */
;
@@ -2143,127 +2143,127 @@ compstmt: compstmt_start compstmt_nostart
;
/* APPLE LOCAL begin CW asm blocks */
-cw_save_location: save_location
- { cw_asm_lineno = input_line; }
+iasm_save_location: save_location
+ { iasm_lineno = input_line; }
;
/* A CW-style asm statement is recognized by having a BOL token preceding it. */
-cw_asm_stmt: CW_ASM_BOL cw_save_location cw_asm_stmt_list CW_ASM_EOL
+iasm_stmt: IASM_BOL iasm_save_location iasm_stmt_list IASM_EOL
{ $$ = NULL_TREE; }
;
-cw_asm_stmt_nobol: cw_save_location cw_asm_stmt_list CW_ASM_EOL
+iasm_stmt_nobol: iasm_save_location iasm_stmt_list IASM_EOL
{
$$ = NULL_TREE;
- cw_asm_state = cw_asm_none;
- cw_asm_at_bol = 0;
+ iasm_state = iasm_none;
+ iasm_at_bol = false;
}
;
/* A single line may have multiple statements separated by ';'. */
-cw_asm_stmt_list:
+iasm_stmt_list:
/* empty */
- | single_cw_asm_stmt
+ | single_iasm_stmt
{}
- | cw_asm_stmt_list ';' cw_maybe_comment single_cw_asm_stmt
- | cw_asm_stmt_list ';' cw_maybe_comment
- | cw_asm_stmt_list ASM_KEYWORD single_cw_asm_stmt
- | cw_asm_stmt_list ASM_KEYWORD cw_maybe_comment
+ | iasm_stmt_list ';' iasm_maybe_comment single_iasm_stmt
+ | iasm_stmt_list ';' iasm_maybe_comment
+ | iasm_stmt_list ASM_KEYWORD single_iasm_stmt
+ | iasm_stmt_list ASM_KEYWORD iasm_maybe_comment
;
-cw_maybe_comment:
+iasm_maybe_comment:
{
if (flag_ms_asms)
{
- cw_skip_to_eol ();
+ iasm_skip_to_eol ();
yychar = YYEMPTY;
}
}
;
-cw_identifier:
- cw_identifier1 ' '
+iasm_identifier:
+ iasm_identifier1 ' '
{ $$ = $1; }
- | cw_identifier1
- { $$ = $1; cw_split_next = 0; }
+ | iasm_identifier1
+ { $$ = $1; iasm_split_next = 0; }
;
-cw_identifier1:
+iasm_identifier1:
identifier
{
- if (cw_split_next &&
+ if (iasm_split_next &&
(yychar == '.'
|| yychar == '+'
|| yychar == '-'))
{
- cw_insert_saved_token ();
+ iasm_insert_saved_token ();
yychar = ' ';
}
}
- | cw_identifier1 '.'
- { $$ = cw_get_identifier ($1, "."); }
- | cw_identifier1 '+'
- { $$ = cw_get_identifier ($1, "+"); }
- | cw_identifier1 '-'
- { $$ = cw_get_identifier ($1, "-"); }
+ | iasm_identifier1 '.'
+ { $$ = iasm_get_identifier ($1, "."); }
+ | iasm_identifier1 '+'
+ { $$ = iasm_get_identifier ($1, "+"); }
+ | iasm_identifier1 '-'
+ { $$ = iasm_get_identifier ($1, "-"); }
| '.' identifier
{ $$ = prepend_char_identifier ($2, '.'); }
;
-cw_maybe_prefix:
- cw_identifier
- { $$ = c_parse_cw_maybe_prefix ($1); }
+iasm_maybe_prefix:
+ iasm_identifier
+ { $$ = c_parse_iasm_maybe_prefix ($1); }
;
/* A single statement consists of one or more labels (identified by a
leading '@' and/or a trailing ':'), optionally followed by opcode
and operands. */
-single_cw_asm_stmt:
- cw_maybe_prefix
- { cw_asm_in_operands = 1; }
- cw_asm_operands
- { $$ = cw_asm_stmt ($1, $3, cw_asm_lineno); }
- | identifier STATIC cw_asm_operand
- { $$ = cw_asm_entry ($1, $2, $3.value); }
- | identifier SCSPEC cw_asm_operand
- { $$ = cw_asm_entry ($1, $2, $3.value); }
- | cw_asm_label
+single_iasm_stmt:
+ iasm_maybe_prefix
+ { iasm_in_operands = true; }
+ iasm_operands
+ { $$ = iasm_stmt ($1, $3, iasm_lineno); }
+ | identifier STATIC iasm_operand
+ { $$ = iasm_entry ($1, $2, $3.value); }
+ | identifier SCSPEC iasm_operand
+ { $$ = iasm_entry ($1, $2, $3.value); }
+ | iasm_label
{}
- | cw_asm_label single_cw_asm_stmt
+ | iasm_label single_iasm_stmt
{}
;
-cw_asm_label:
+iasm_label:
identifier ':'
- { cw_asm_label ($1, 0); }
+ { iasm_label ($1, 0); }
| '@' identifier
- { cw_asm_label ($2, 1); }
+ { iasm_label ($2, 1); }
| '@' identifier ':'
- { cw_asm_label ($2, 1); }
+ { iasm_label ($2, 1); }
| '@' CONSTANT
- { cw_asm_label ($2, 1); }
+ { iasm_label ($2, 1); }
| '@' CONSTANT ':'
- { cw_asm_label ($2, 1); }
+ { iasm_label ($2, 1); }
;
-cw_asm_stmts:
+iasm_stmts:
stmt
{}
- | cw_asm_stmts stmt
+ | iasm_stmts stmt
{}
;
/* An asm block within a function is simpler than asm functions; no
declarations are possible, so we switch to the block interior state
immediately. */
-cw_asm_compstmt_start: ASM_KEYWORD '{'
+iasm_compstmt_start: ASM_KEYWORD '{'
{
- if (flag_cw_asm_blocks)
+ if (flag_iasm_blocks)
{
- cw_asm_state = cw_asm_asm;
- inside_cw_asm_block = 1;
- cw_asm_at_bol = 1;
- clear_cw_asm_labels ();
+ iasm_state = iasm_asm;
+ inside_iasm_block = true;
+ iasm_at_bol = true;
+ iasm_clear_labels ();
}
else
/* This will probably choke badly... */
@@ -2272,58 +2272,58 @@ cw_asm_compstmt_start: ASM_KEYWORD '{'
}
;
-cw_asm_compstmt: ASM_KEYWORD
+iasm_compstmt: ASM_KEYWORD
{
- if (flag_cw_asm_blocks)
+ if (flag_iasm_blocks)
{
- cw_asm_state = cw_asm_asm;
- inside_cw_asm_block = 1;
- clear_cw_asm_labels ();
+ iasm_state = iasm_asm;
+ inside_iasm_block = true;
+ iasm_clear_labels ();
if (yychar == ';' && flag_ms_asms)
{
- cw_skip_to_eol ();
+ iasm_skip_to_eol ();
yychar = YYEMPTY;
}
- yychar = CW_SEE_OPCODE (yychar, yylval.ttype);
+ yychar = IASM_SEE_OPCODE (yychar, yylval.ttype);
}
else
/* This will probably choke badly... */
error ("asm blocks not enabled, use `-fasm-blocks'");
$<ttype>$ = c_begin_compound_stmt (true);
}
- cw_asm_stmt_nobol
+ iasm_stmt_nobol
{
$$ = c_finish_expr_stmt ($3);
- inside_cw_asm_block = 0;
+ inside_iasm_block = false;
$<ttype>$ = c_end_compound_stmt ($<ttype>2, true);
}
;
-cw_asm_compstmt_nostart:
+iasm_compstmt_nostart:
'}'
- | cw_asm_compstmt_contents_nonempty '}'
- { inside_cw_asm_block = 0; }
+ | iasm_compstmt_contents_nonempty '}'
+ { inside_iasm_block = false; }
;
-cw_asm_compstmt_contents_nonempty:
- cw_asm_stmts
+iasm_compstmt_contents_nonempty:
+ iasm_stmts
| error
;
-cw_asm_compstmt: cw_asm_compstmt_start cw_asm_compstmt_nostart
+iasm_compstmt: iasm_compstmt_start iasm_compstmt_nostart
{ $$ = c_end_compound_stmt ($1, true); }
;
-cw_asm_operands:
+iasm_operands:
/* empty */
{ $$ = NULL_TREE; }
- | cw_nonnull_asm_operands
+ | iasm_nonnull_operands
;
-cw_nonnull_asm_operands:
- cw_asm_operand
+iasm_nonnull_operands:
+ iasm_operand
{ $$ = build_tree_list (NULL_TREE, $1.value); }
- | cw_nonnull_asm_operands ',' cw_asm_operand
+ | iasm_nonnull_operands ',' iasm_operand
{ $$ = chainon ($1, build_tree_list (NULL_TREE, $3.value)); }
;
@@ -2331,9 +2331,9 @@ cw_nonnull_asm_operands:
all the semantic actions would need to be tweaked to handle the
possibility of CW asm coming through. For example, "offset(reg)"
would be handled by function call code (bleah). */
-cw_asm_operand: cw_asm_expr_no_commas
- | cw_asm_operand '(' cw_asm_expr_no_commas ')'
- { $$.value = cw_asm_build_register_offset ($1.value, $3.value);
+iasm_operand: iasm_expr_no_commas
+ | iasm_operand '(' iasm_expr_no_commas ')'
+ { $$.value = iasm_build_register_offset ($1.value, $3.value);
$$.original_code = ERROR_MARK; }
;
/* APPLE LOCAL end CW asm blocks */
@@ -2574,9 +2574,9 @@ stmt_nocomp:
| switch_statement
{ $$ = NULL_TREE; }
/* APPLE LOCAL begin CW asm blocks */
- | cw_asm_compstmt
+ | iasm_compstmt
{ $$ = c_finish_expr_stmt ($1); }
- | cw_asm_stmt
+ | iasm_stmt
{ $$ = c_finish_expr_stmt ($1); }
/* APPLE LOCAL end CW asm blocks */
| BREAK ';'
@@ -2788,68 +2788,68 @@ start_string_translation:
;
/* APPLE LOCAL begin CW asm blocks */
-cw_asm_expr_no_commas:
- cw_asm_unary_expr
- | cw_asm_expr_no_commas '+' cw_asm_expr_no_commas
+iasm_expr_no_commas:
+ iasm_unary_expr
+ | iasm_expr_no_commas '+' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '-' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '-' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '*' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '*' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '/' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '/' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '%' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '%' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas LSHIFT cw_asm_expr_no_commas
+ | iasm_expr_no_commas LSHIFT iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas RSHIFT cw_asm_expr_no_commas
+ | iasm_expr_no_commas RSHIFT iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas ARITHCOMPARE cw_asm_expr_no_commas
+ | iasm_expr_no_commas ARITHCOMPARE iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas EQCOMPARE cw_asm_expr_no_commas
+ | iasm_expr_no_commas EQCOMPARE iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '&' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '&' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '|' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '|' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas '^' cw_asm_expr_no_commas
+ | iasm_expr_no_commas '^' iasm_expr_no_commas
{ $$ = parser_build_binary_op ($2, $1, $3); }
- | cw_asm_expr_no_commas ANDAND
+ | iasm_expr_no_commas ANDAND
{ $1.value = c_common_truthvalue_conversion
(default_conversion ($1.value));
skip_evaluation += $1.value == boolean_false_node; }
- cw_asm_expr_no_commas
+ iasm_expr_no_commas
{ skip_evaluation -= $1.value == boolean_false_node;
$$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); }
- | cw_asm_expr_no_commas OROR
+ | iasm_expr_no_commas OROR
{ $1.value = c_common_truthvalue_conversion
(default_conversion ($1.value));
skip_evaluation += $1.value == boolean_true_node; }
- cw_asm_expr_no_commas
+ iasm_expr_no_commas
{ skip_evaluation -= $1.value == boolean_true_node;
$$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); }
;
-cw_asm_unary_expr:
- cw_asm_primary
- | cw_asm_primary IDENTIFIER cw_asm_unary_expr
+iasm_unary_expr:
+ iasm_primary
+ | iasm_primary IDENTIFIER iasm_unary_expr
{
/* Handle things like: inc dword ptr [eax] */
if (strcasecmp (IDENTIFIER_POINTER ($2), "ptr") != 0)
error ("expected %<ptr%>");
- $$.value = cw_ptr_conv ($1.value, $3.value);
+ $$.value = iasm_ptr_conv ($1.value, $3.value);
$$.original_code = ERROR_MARK;
}
- | '*' cw_asm_unary_expr %prec UNARY
+ | '*' iasm_unary_expr %prec UNARY
{ $$.value = build_indirect_ref ($2.value, "unary *");
$$.original_code = ERROR_MARK; }
- | unop cw_asm_unary_expr %prec UNARY
+ | unop iasm_unary_expr %prec UNARY
{
if (TREE_CODE ($2.value) == COMPOUND_EXPR)
{
tree neg = build_unary_op ($1, TREE_OPERAND ($2.value, 0), 0);
tree reg = TREE_OPERAND ($2.value, 1);
- $$.value = cw_asm_build_register_offset (neg, reg);
+ $$.value = iasm_build_register_offset (neg, reg);
}
else
{
@@ -2862,7 +2862,7 @@ cw_asm_unary_expr:
}
$$.original_code = ERROR_MARK;
}
- | sizeof cw_asm_unary_expr %prec UNARY
+ | sizeof iasm_unary_expr %prec UNARY
{ skip_evaluation--;
if (TREE_CODE ($2.value) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND ($2.value, 1)))
@@ -2878,7 +2878,7 @@ cw_asm_unary_expr:
{ skip_evaluation--;
$$.value = c_sizeof (groktypename ($3));
$$.original_code = ERROR_MARK; }
- | alignof cw_asm_unary_expr %prec UNARY
+ | alignof iasm_unary_expr %prec UNARY
{ skip_evaluation--;
$$.value = c_alignof_expr ($2.value);
$$.original_code = ERROR_MARK; }
@@ -2888,7 +2888,7 @@ cw_asm_unary_expr:
$$.original_code = ERROR_MARK; }
;
-cw_asm_primary:
+iasm_primary:
IDENTIFIER
{
if (yychar == YYEMPTY)
@@ -2908,30 +2908,30 @@ cw_asm_primary:
{ $$.value = $1; $$.original_code = ERROR_MARK; }
| STRING
{ $$.value = $1; $$.original_code = STRING_CST; }
- | '(' cw_asm_expr_no_commas ')'
+ | '(' iasm_expr_no_commas ')'
{ char class = TREE_CODE_CLASS (TREE_CODE ($2.value));
if (IS_EXPR_CODE_CLASS (class))
$2.original_code = ERROR_MARK;
$$ = $2; }
| '(' error ')'
{ $$.value = error_mark_node; $$.original_code = ERROR_MARK; }
- | cw_asm_primary '[' cw_asm_expr_no_commas ']' %prec '.'
+ | iasm_primary '[' iasm_expr_no_commas ']' %prec '.'
{ $$.value = build_array_ref ($1.value, $3.value);
$$.original_code = ERROR_MARK; }
- | '[' cw_asm_expr_no_commas ']' %prec '.'
- { $$.value = cw_build_bracket ($2.value, NULL_TREE);
+ | '[' iasm_expr_no_commas ']' %prec '.'
+ { $$.value = iasm_build_bracket ($2.value, NULL_TREE);
$$.original_code = ERROR_MARK; }
| TYPENAME '.' identifier
- { $$.value = cw_asm_c_build_component_ref ($1, $3);
+ { $$.value = iasm_c_build_component_ref ($1, $3);
$$.original_code = ERROR_MARK; }
- | cw_asm_primary '.' identifier
- { $$.value = cw_asm_c_build_component_ref ($1.value, $3);
+ | iasm_primary '.' identifier
+ { $$.value = iasm_c_build_component_ref ($1.value, $3);
$$.original_code = ERROR_MARK; }
- | cw_asm_primary '.' CONSTANT
+ | iasm_primary '.' CONSTANT
{ /* We allow [eax].16 to refer to [eax + 16]. */
- $$.value = cw_asm_c_build_component_ref ($1.value, $3);
+ $$.value = iasm_c_build_component_ref ($1.value, $3);
$$.original_code = ERROR_MARK; }
- | cw_asm_primary POINTSAT identifier
+ | iasm_primary POINTSAT identifier
{
tree expr = build_indirect_ref ($1.value, "->");
$$.value = build_component_ref (expr, $3);
@@ -4018,11 +4018,11 @@ yylexname (void)
/* Change the code. No need to change the name though,
won't matter to parser. */
if (next_tok_type != CPP_OPEN_PAREN)
- yycode = CW_ASM_KEYWORD;
+ yycode = IASM_ASM_KEYWORD;
}
- if (CW_SEE_OPCODE (TYPESPEC, yylval.ttype) == IDENTIFIER
- && cw_asm_state >= cw_asm_decls
- && cw_asm_in_operands == 0)
+ if (IASM_SEE_OPCODE (TYPESPEC, yylval.ttype) == IDENTIFIER
+ && iasm_state >= iasm_decls
+ && iasm_in_operands == false)
{
/* If this was an opcode, prefer it. */
return IDENTIFIER;
@@ -4211,9 +4211,9 @@ _yylex (void)
/* Convert a lexer-returned beginning-of-line token into a
parser token. */
case CPP_BOL:
- return CW_ASM_BOL;
+ return IASM_BOL;
case CPP_EOL:
- return CW_ASM_EOL;
+ return IASM_EOL;
/* APPLE LOCAL end CW asm blocks */
case CPP_OBJC_STRING:
@@ -4304,11 +4304,11 @@ c_parse_file (void)
/* APPLE LOCAL begin CW asm blocks */
static tree
-c_parse_cw_maybe_prefix (tree id)
+c_parse_iasm_maybe_prefix (tree id)
{
tree prefix_list = NULL_TREE;;
- while (cw_is_prefix (id))
+ while (iasm_is_prefix (id))
{
if (yychar == YYEMPTY)
yychar = YYLEX;
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index b0577711c46..5c9bdb779a1 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -280,7 +280,7 @@ struct c_declspecs {
BOOL_BITFIELD private_extern_p : 1;
/* APPLE LOCAL end private extern */
/* APPLE LOCAL CW asm blocks */
- BOOL_BITFIELD cw_asm_specbit : 1;
+ BOOL_BITFIELD iasm_asm_specbit : 1;
/* Whether the type defaulted to "int" because there were no type
specifiers. */
BOOL_BITFIELD default_int_p;
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index dd737eea6a8..ad4b5820184 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1748,12 +1748,12 @@ build_array_ref (tree array, tree index)
return error_mark_node;
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
if (TREE_CODE (array) == BRACKET_EXPR
|| TREE_CODE (index) == IDENTIFIER_NODE
|| TREE_TYPE (index) == NULL_TREE)
- return cw_build_bracket (array, index);
+ return iasm_build_bracket (array, index);
}
/* APPLE LOCAL end CW asm blocks */
@@ -1888,7 +1888,7 @@ build_external_ref (tree id, int fun)
also handy to assume undeclared names as labels, although it
would be better to have a second pass and complain about names in
the block that are not labels. */
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
if (decl)
{
@@ -1897,7 +1897,7 @@ build_external_ref (tree id, int fun)
/* Locals and parms just need to be left alone for now. */
}
else
- return cw_do_id (id);
+ return iasm_do_id (id);
}
/* APPLE LOCAL end CW asm blocks */
@@ -2435,7 +2435,7 @@ parser_build_binary_op (enum tree_code code, struct c_expr arg1,
enum tree_code code2 = arg2.original_code;
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
if (TREE_CODE (arg1.value) == IDENTIFIER_NODE
|| TREE_CODE (arg2.value) == IDENTIFIER_NODE
@@ -6878,15 +6878,15 @@ c_finish_goto_ptr (tree expr)
}
/* APPLE LOCAL begin CW asm blocks */
-#ifndef CW_SEE_OPCODE
-#define CW_SEE_OPCODE(YYCHAR, T) YYCHAR
+#ifndef IASM_SEE_OPCODE
+#define IASM_SEE_OPCODE(YYCHAR, T) YYCHAR
#endif
#define TYPESPEC 1
#define IDENTIFIER 2
int
-cw_asm_typename_or_reserved (tree value)
+iasm_typename_or_reserved (tree value)
{
- if (CW_SEE_OPCODE (TYPESPEC, value) == IDENTIFIER)
+ if (IASM_SEE_OPCODE (TYPESPEC, value) == IDENTIFIER)
return 0;
return (C_IS_RESERVED_WORD (value));
@@ -6897,7 +6897,7 @@ cw_asm_typename_or_reserved (tree value)
through the usual process. */
tree
-cw_asm_c_build_component_ref (tree typename, tree component)
+iasm_c_build_component_ref (tree typename, tree component)
{
tree val, type, fake_datum;
enum tree_code code;
@@ -6912,6 +6912,13 @@ cw_asm_c_build_component_ref (tree typename, tree component)
else if (TREE_CODE (typename) == LABEL_DECL)
typename = DECL_NAME (typename);
+ /* We allow [eax].16 to refer to [eax + 16]. */
+ if (TREE_CODE (component) == INTEGER_CST
+ && TREE_CODE (typename) == BRACKET_EXPR)
+ {
+ return iasm_build_bracket (typename, component);
+ }
+
val = lookup_name (typename);
if (val)
{
@@ -6919,12 +6926,6 @@ cw_asm_c_build_component_ref (tree typename, tree component)
}
else
{
- /* We allow [eax].16 to refer to [eax + 16]. */
- if (TREE_CODE (component) == INTEGER_CST
- && TREE_CODE (typename) == BRACKET_EXPR)
- {
- return cw_build_bracket (typename, component);
- }
/* A structure tag will have been assumed to be a label; pick
out the original name. */
if (strncmp ("LASM", IDENTIFIER_POINTER (typename), 4) == 0)
diff --git a/gcc/config/asm.h b/gcc/config/asm.h
index 3c3c2e389b5..19d6fa1abcb 100644
--- a/gcc/config/asm.h
+++ b/gcc/config/asm.h
@@ -6,35 +6,35 @@
/* We use a small state machine to inform the lexer when to start
returning tokens marking the beginning of each asm line. */
-enum cw_asm_states {
+enum iasm_states {
/* Normal code. */
- cw_asm_none,
+ iasm_none,
/* '{' of asm block seen, decls may appear. */
- cw_asm_decls,
+ iasm_decls,
/* No more decls, in asm block proper, '}' not seen yet. */
- cw_asm_asm
+ iasm_asm
};
/* Nonzero means that CodeWarrior-style inline assembler is to be parsed. */
-extern int flag_cw_asm_blocks;
+extern int flag_iasm_blocks;
-extern enum cw_asm_states cw_asm_state;
-extern int cw_asm_in_decl;
-extern int inside_cw_asm_block;
-extern int cw_asm_at_bol;
-extern int cw_asm_in_operands;
-extern const cpp_token *cw_split_next;
-void cw_insert_saved_token (void);
-extern tree cw_do_id (tree);
+extern enum iasm_states iasm_state;
+extern bool iasm_in_decl;
+extern bool inside_iasm_block;
+extern bool iasm_at_bol;
+extern int iasm_in_operands;
+extern const cpp_token *iasm_split_next;
+void iasm_insert_saved_token (void);
+extern tree iasm_do_id (tree);
/* Maximum number of arguments. */
-#define CW_MAX_ARG 11
+#define IASM_MAX_ARG 11
-#ifndef TARGET_CW_EXTRA_INFO
-#define TARGET_CW_EXTRA_INFO
+#ifndef TARGET_IASM_EXTRA_INFO
+#define TARGET_IASM_EXTRA_INFO
#endif
-struct cw_md_Extra_info {
+struct iasm_md_Extra_info {
/* Number of operands to the ASM_expr. Note, this can be different
from the number of operands to the instruction, in cases like:
@@ -51,30 +51,35 @@ struct cw_md_Extra_info {
char *arg_p;
bool must_be_reg;
bool was_output;
- } dat[CW_MAX_ARG];
+ } dat[IASM_MAX_ARG];
- TARGET_CW_EXTRA_INFO
+ bool no_label_map;
+
+ TARGET_IASM_EXTRA_INFO
};
-typedef struct cw_md_Extra_info cw_md_extra_info;
+typedef struct iasm_md_Extra_info iasm_md_extra_info;
-void print_cw_asm_operand (char *buf, tree arg, unsigned argnum, tree *uses,
- bool must_be_reg, bool must_not_be_reg, cw_md_extra_info *e);
+void iasm_print_operand (char *buf, tree arg, unsigned argnum, tree *uses,
+ bool must_be_reg, bool must_not_be_reg, iasm_md_extra_info *e);
-extern tree cw_asm_stmt (tree, tree, int);
-extern tree cw_asm_build_register_offset (tree, tree);
-extern tree cw_asm_label (tree, int);
+extern tree iasm_stmt (tree, tree, int);
+extern tree iasm_build_register_offset (tree, tree);
+extern tree iasm_label (tree, int);
extern tree prepend_char_identifier (tree, char);
-extern void clear_cw_asm_labels (void);
-extern tree cw_asm_reg_name (tree);
-extern tree cw_asm_entry (tree, tree, tree);
-extern int cw_asm_typename_or_reserved (tree);
-extern tree cw_asm_c_build_component_ref (tree, tree);
-extern tree cw_get_identifier (tree, const char *);
-extern tree cw_build_bracket (tree, tree);
-extern bool cw_is_prefix (tree);
-extern void cw_skip_to_eol (void);
-extern void cw_force_constraint (const char *c, cw_md_extra_info *e);
-extern tree cw_ptr_conv (tree type, tree exp);
-extern void cw_asm_get_register_var (tree var, const char *modifier, char *buf,
- unsigned argnum, bool must_be_reg, cw_md_extra_info *e);
+extern void iasm_clear_labels (void);
+extern tree iasm_reg_name (tree);
+extern tree iasm_entry (tree, tree, tree);
+extern int iasm_typename_or_reserved (tree);
+extern tree iasm_c_build_component_ref (tree, tree);
+extern tree iasm_get_identifier (tree, const char *);
+extern tree iasm_build_bracket (tree, tree);
+extern bool iasm_is_prefix (tree);
+extern void iasm_skip_to_eol (void);
+extern bool iasm_memory_clobber (const char *);
+extern void iasm_force_constraint (const char *c, iasm_md_extra_info *e);
+extern tree iasm_ptr_conv (tree type, tree exp);
+extern void iasm_get_register_var (tree var, const char *modifier, char *buf,
+ unsigned argnum, bool must_be_reg, iasm_md_extra_info *e);
+extern bool iasm_is_pseudo (const char *);
+extern tree iasm_addr (tree);
#endif
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 4a586f8e841..0b33a2875c2 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -48,6 +48,11 @@ Boston, MA 02111-1307, USA. */
static bool using_frameworks = false;
+/* APPLE LOCAL begin mainline */
+/* True if we're setting __attribute__ ((ms_struct)). */
+static bool darwin_ms_struct = false;
+
+/* APPLE LOCAL end mainline */
/* APPLE LOCAL begin CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 --turly */
static void directive_with_named_function (const char *, void (*sec_f)(void));
/* APPLE LOCAL end CALL_ON_LOAD/CALL_ON_UNLOAD pragmas 20020202 --turly */
@@ -77,7 +82,7 @@ static const char *find_subframework_header (cpp_reader *pfile, const char *head
else
mode = power
These modes are saved on the alignment stack by saving the values
- of maximum_field_alignment, TARGET_ALIGN_MAC68K, and
+ of maximum_field_alignment, TARGET_ALIGN_MAC68K, and
TARGET_ALIGN_NATURAL. */
typedef struct align_stack
{
@@ -92,7 +97,7 @@ static struct align_stack * field_align_stack = NULL;
/* APPLE LOCAL begin Macintosh alignment 2001-12-17 --ff */
static void
-push_field_alignment (int bit_alignment,
+push_field_alignment (int bit_alignment,
int mac68k_alignment, int natural_alignment)
{
align_stack *entry = (align_stack *) xmalloc (sizeof (align_stack));
@@ -208,10 +213,10 @@ darwin_pragma_options (cpp_reader *pfile ATTRIBUTE_UNUSED)
/* APPLE LOCAL begin Macintosh alignment 2002-1-22 --ff */
/* #pragma pack ()
- #pragma pack (N)
+ #pragma pack (N)
#pragma pack (pop[,id])
#pragma pack (push[,id],N)
-
+
We have a problem handling the semantics of these directives since,
to play well with the Macintosh alignment directives, we want the
usual pack(N) form to do a push of the previous alignment state.
@@ -293,7 +298,7 @@ else
if (c_lex (&x) != CPP_EOF)
warning ("junk at end of '#pragma pack'");
-
+
if (action != pop)
{
switch (align)
@@ -310,7 +315,7 @@ else
BAD2 ("alignment must be a small power of two, not %d", align);
}
}
-
+
switch (action)
{
case pop: pop_field_alignment (); break;
@@ -354,6 +359,41 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
warning ("junk at end of '#pragma unused'");
}
+/* APPLE LOCAL begin mainline */
+/* Parse the ms_struct pragma. */
+void
+darwin_pragma_ms_struct (cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ const char *arg;
+ tree t;
+
+ if (c_lex (&t) != CPP_NAME)
+ BAD ("malformed '#pragma ms_struct', ignoring");
+ arg = IDENTIFIER_POINTER (t);
+
+ if (!strcmp (arg, "on"))
+ darwin_ms_struct = true;
+ else if (!strcmp (arg, "off") || !strcmp (arg, "reset"))
+ darwin_ms_struct = false;
+ else
+ warning ("malformed '#pragma ms_struct {on|off|reset}', ignoring");
+
+ if (c_lex (&t) != CPP_EOF)
+ warning ("junk at end of '#pragma ms_struct'");
+}
+
+/* Set darwin specific type attributes on TYPE. */
+void
+darwin_set_default_type_attributes (tree type)
+{
+ /* Handle the ms_struct pragma. */
+ if (darwin_ms_struct
+ && TREE_CODE (type) == RECORD_TYPE)
+ TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("ms_struct"),
+ NULL_TREE,
+ TYPE_ATTRIBUTES (type));
+}
+/* APPLE LOCAL end mainline */
/* APPLE LOCAL begin pragma reverse_bitfields */
/* Handle the reverse_bitfields pragma. */
@@ -618,7 +658,7 @@ framework_construct_pathname (const char *fname, cpp_dir *dir)
/* Append framework_header_dirs and header file name */
for (i = 0; framework_header_dirs[i].dirName; i++)
{
- strncpy (&frname[frname_len],
+ strncpy (&frname[frname_len],
framework_header_dirs[i].dirName,
framework_header_dirs[i].dirNameLen);
strcpy (&frname[frname_len + framework_header_dirs[i].dirNameLen],
@@ -642,8 +682,8 @@ find_subframework_file (const char *fname, const char *pname)
{
char *sfrname;
const char *dot_framework = ".framework/";
- char *bufptr;
- int sfrname_len, i, fname_len;
+ char *bufptr;
+ int sfrname_len, i, fname_len;
struct cpp_dir *fast_dir;
static struct cpp_dir subframe_dir;
struct stat st;
@@ -653,7 +693,7 @@ find_subframework_file (const char *fname, const char *pname)
/* Subframework files must have / in the name. */
if (bufptr == 0)
return 0;
-
+
fname_len = bufptr - fname;
fast_dir = find_framework (fname, fname_len);
@@ -668,7 +708,7 @@ find_subframework_file (const char *fname, const char *pname)
return 0;
/* Now translate. For example, +- bufptr
- fname = CarbonCore/OSUtils.h |
+ fname = CarbonCore/OSUtils.h |
pname = /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
into
sfrname = /System/Library/Frameworks/Foundation.framework/Frameworks/CarbonCore.framework/Headers/OSUtils.h */
@@ -676,10 +716,10 @@ find_subframework_file (const char *fname, const char *pname)
sfrname = (char *) xmalloc (strlen (pname) + strlen (fname) + 2 +
strlen ("Frameworks/") + strlen (".framework/")
+ strlen ("PrivateHeaders"));
-
+
bufptr += strlen (dot_framework);
- sfrname_len = bufptr - pname;
+ sfrname_len = bufptr - pname;
strncpy (&sfrname[0], pname, sfrname_len);
@@ -695,12 +735,12 @@ find_subframework_file (const char *fname, const char *pname)
/* Append framework_header_dirs and header file name */
for (i = 0; framework_header_dirs[i].dirName; i++)
{
- strncpy (&sfrname[sfrname_len],
+ strncpy (&sfrname[sfrname_len],
framework_header_dirs[i].dirName,
framework_header_dirs[i].dirNameLen);
strcpy (&sfrname[sfrname_len + framework_header_dirs[i].dirNameLen],
&fname[fname_len]);
-
+
if (stat (sfrname, &st) == 0)
{
if (fast_dir != &subframe_dir)
@@ -757,7 +797,7 @@ add_framework_path (char *path)
add_cpp_dir_path (p, BRACKET);
}
-static const char *framework_defaults [] =
+static const char *framework_defaults [] =
{
"/System/Library/Frameworks",
"/Library/Frameworks",
@@ -774,9 +814,9 @@ darwin_register_objc_includes (const char *sysroot, const char *iprefix,
/* We do not do anything if we do not want the standard includes. */
if (!stdinc)
return;
-
+
fname = GCC_INCLUDE_DIR "-gnu-runtime";
-
+
/* Register the GNU OBJC runtime include path if we are compiling OBJC
with GNU-runtime. */
@@ -793,13 +833,13 @@ darwin_register_objc_includes (const char *sysroot, const char *iprefix,
/* FIXME: wrap the headers for C++awareness. */
add_path (str, SYSTEM, /*c++aware=*/false, false);
}
-
+
/* Should this directory start with the sysroot? */
if (sysroot)
str = concat (sysroot, fname, NULL);
else
str = update_path (fname, "");
-
+
add_path (str, SYSTEM, /*c++aware=*/false, false);
}
}
@@ -923,13 +963,13 @@ darwin_pragma_call_on_unload (cpp_reader *pfile ATTRIBUTE_UNUSED)
/* Return the value of darwin_macosx_version_min suitable for the
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro,
- so '10.4.2' becomes 1042.
+ so '10.4.2' becomes 1042.
Print a warning if the version number is not known. */
static const char *
version_as_macro (void)
{
static char result[] = "1000";
-
+
if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
goto fail;
if (! ISDIGIT (darwin_macosx_version_min[3]))
@@ -947,9 +987,9 @@ version_as_macro (void)
}
else
result[3] = '0';
-
+
return result;
-
+
fail:
error ("Unknown value %qs of -mmacosx-version-min",
darwin_macosx_version_min);
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index d0cd39eae42..167b7627a3d 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -70,8 +70,10 @@ extern void machopic_asm_out_destructor (rtx, int);
extern void machopic_define_symbol (rtx);
extern void darwin_encode_section_info (tree, rtx, int);
+/* APPLE LOCAL mainline */
+extern void darwin_set_default_type_attributes (tree);
/* APPLE LOCAL CW asm blocks */
-extern tree darwin_cw_asm_special_label (tree);
+extern tree darwin_iasm_special_label (tree);
#endif /* TREE_CODE */
@@ -94,6 +96,8 @@ extern void darwin_emit_except_table_label (FILE *);
extern void darwin_pragma_ignore (struct cpp_reader *);
extern void darwin_pragma_options (struct cpp_reader *);
extern void darwin_pragma_unused (struct cpp_reader *);
+/* APPLE LOCAL mainline */
+extern void darwin_pragma_ms_struct (struct cpp_reader *);
/* APPLE LOCAL pragma fenv */
extern void darwin_pragma_fenv (struct cpp_reader *);
/* APPLE LOCAL pragma reverse_bitfields */
@@ -212,7 +216,7 @@ extern tree darwin_construct_objc_string (tree);
/* APPLE LOCAL end constant cfstrings */
/* APPLE LOCAL CW asm blocks */
-#define CW_ASM_SPECIAL_LABEL(ID) darwin_cw_asm_special_label (ID)
+#define IASM_SPECIAL_LABEL(ID) darwin_iasm_special_label (ID)
/* APPLE LOCAL begin KEXT */
#ifdef TREE_CODE
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index d0080ec7c5c..d97a6b27c73 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -2163,7 +2163,7 @@ darwin_build_constant_cfstring (tree str)
otherwise return NULL signifying that we have no special
knowledge. */
tree
-darwin_cw_asm_special_label (tree id)
+darwin_iasm_special_label (tree id)
{
const char *name = IDENTIFIER_POINTER (id);
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index af7c0e49a6e..c7c8ffcf246 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -106,12 +106,12 @@ extern int machopic_symbol_defined_p (rtx);
name, that also takes an argument, needs to be modified so the
prefix is different, otherwise a '*' after the shorter option will
match with the longer one.
-
+
The SUBTARGET_OPTION_TRANSLATE_TABLE macro, which _must_ be defined
in gcc/config/{i386,rs6000}/darwin.h, should contain any additional
command-line option translations specific to the particular target
architecture. */
-
+
#define TARGET_OPTION_TRANSLATE_TABLE \
/* APPLE LOCAL KEXT terminated-vtables */ \
{ "-fterminated-vtables", "-fapple-kext" }, \
@@ -181,7 +181,7 @@ extern int darwin_running_cxx;
but there are no more bits in rs6000 TARGET_SWITCHES. Note
that this switch has no "no-" variant. */
extern const char *darwin_one_byte_bool;
-
+
/* APPLE LOCAL begin pragma reverse_bitfields */
/* True if pragma reverse_bitfields is in effect. */
extern GTY(()) int darwin_reverse_bitfields;
@@ -485,7 +485,7 @@ do { \
you want to explicitly link against the static version of those
routines, because you know you don't need to unwind through system
libraries, you need to explicitly say -static-libgcc.
-
+
If it is linked against, it has to be before -lgcc, because it may
need symbols from -lgcc. */
#undef REAL_LIBGCC_SPEC
@@ -609,9 +609,9 @@ do { \
links to, so there's no need for weak-ness for that. */
#define GTHREAD_USE_WEAK 0
-/* The Darwin linker imposes two limitations on common symbols: they
+/* The Darwin linker imposes two limitations on common symbols: they
can't have hidden visibility, and they can't appear in dylibs. As
- a consequence, we should never use common symbols to represent
+ a consequence, we should never use common symbols to represent
vague linkage. */
#undef USE_COMMON_FOR_ONE_ONLY
#define USE_COMMON_FOR_ONE_ONLY 0
@@ -637,7 +637,7 @@ do { \
/* APPLE LOCAL mainline 2006-03-16 dwarf2 4392520 */
#define FRAME_BEGIN_LABEL (for_eh ? "EH_frame" : "Lframe")
-/* Emit a label for the FDE corresponding to DECL. EMPTY means
+/* Emit a label for the FDE corresponding to DECL. EMPTY means
emit a label for an empty FDE. */
#define TARGET_ASM_EMIT_UNWIND_LABEL darwin_emit_unwind_label
@@ -802,7 +802,7 @@ do { \
/* Ensure correct alignment of bss data. */
-#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
+#undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
do { \
fputs (".lcomm ", (FILE)); \
@@ -1379,6 +1379,10 @@ enum machopic_addr_class {
/* APPLE LOCAL pragma fenv */ \
c_register_pragma ("GCC", "fenv", darwin_pragma_fenv); \
c_register_pragma (0, "unused", darwin_pragma_unused); \
+ /* APPLE LOCAL begin mainline */ \
+ c_register_pragma (0, "ms_struct", \
+ darwin_pragma_ms_struct); \
+ /* APPLE LOCAL end mainline */ \
/* APPLE LOCAL begin pragma reverse_bitfields */ \
c_register_pragma (0, "reverse_bitfields", \
darwin_pragma_reverse_bitfields); \
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 75c6f895c0c..952231a78c3 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -169,8 +169,6 @@ extern void darwin_x86_file_end (void);
#define MASK_ALIGN_MAC68K 0x20000000
#define TARGET_ALIGN_MAC68K (target_flags & MASK_ALIGN_MAC68K)
-#define REGISTER_TARGET_PRAGMAS DARWIN_REGISTER_TARGET_PRAGMAS
-
#define ROUND_TYPE_ALIGN(TYPE, COMPUTED, SPECIFIED) \
(((TREE_CODE (TYPE) == RECORD_TYPE \
|| TREE_CODE (TYPE) == UNION_TYPE \
@@ -206,7 +204,7 @@ extern void darwin_x86_file_end (void);
} while (0)
/* APPLE LOCAL CW asm blocks */
-extern int flag_cw_asm_blocks;
+extern int flag_iasm_blocks;
/* APPLE LOCAL begin fix-and-continue x86 */
#undef SUBTARGET_OVERRIDE_OPTIONS
#define SUBTARGET_OVERRIDE_OPTIONS \
@@ -234,7 +232,7 @@ extern int flag_cw_asm_blocks;
} \
/* APPLE LOCAL end AT&T-style stub 4164563 */ \
/* APPLE LOCAL begin CW asm blocks */ \
- if (flag_cw_asm_blocks) \
+ if (flag_iasm_blocks) \
flag_ms_asms = 1; \
/* APPLE LOCAL end CW asm blocks */ \
} while (0)
@@ -254,10 +252,6 @@ extern int flag_cw_asm_blocks;
#define TARGET_FIX_AND_CONTINUE (darwin_fix_and_continue)
/* APPLE LOCAL end fix-and-continue x86 */
-/* APPLE LOCAL begin CW asm blocks */
-#define CW_ASM_REGISTER_NAME(STR, BUF) i386_cw_asm_register_name (STR, BUF)
-/* APPLE LOCAL end CW asm blocks */
-
/* APPLE LOCAL begin mainline 2006-02-21 4439051 */
/* Darwin uses the standard DWARF register numbers but the default
register numbers for STABS. Fortunately for 64-bit code the
@@ -286,3 +280,10 @@ extern int flag_cw_asm_blocks;
extern void ix86_darwin_init_expanders (void);
#define INIT_EXPANDERS (ix86_darwin_init_expanders ())
/* APPLE LOCAL end 4457939 stack alignment mishandled */
+/* APPLE LOCAL begin mainline */
+#undef REGISTER_TARGET_PRAGMAS
+#define REGISTER_TARGET_PRAGMAS() DARWIN_REGISTER_TARGET_PRAGMAS()
+
+#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
+#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes
+/* APPLE LOCAL end mainline */
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 5a1896ed218..06a66efeb97 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -279,11 +279,12 @@ extern enum rtx_code ix86_fp_compare_code_to_integer (enum rtx_code);
#endif
/* APPLE LOCAL begin CW asm blocks */
-extern const char *i386_cw_asm_register_name (const char *regname, char *buf);
-extern bool cw_x86_needs_swapping (const char *);
-extern bool cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
- bool must_be_reg, bool must_not_be_reg, void *);
-extern void x86_cw_print_prefix (char *buf, tree prefix_list);
+extern const char *i386_iasm_register_name (const char *regname, char *buf);
+extern bool iasm_x86_needs_swapping (const char *);
+extern bool iasm_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
+ bool must_be_reg, bool must_not_be_reg, void *);
+extern void iasm_x86_print_prefix (char *buf, tree prefix_list);
+extern tree iasm_raise_reg (tree);
/* APPLE LOCAL end CW asm blocks */
/* APPLE LOCAL begin 4356747 stack realign */
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7d1a535ff8b..4a81c09b1e9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4475,7 +4475,7 @@ ix86_save_reg (unsigned int regno, int maybe_eh_return)
/* APPLE LOCAL begin CW asm blocks */
/* For an asm function, we don't save any registers, instead, the
user is responsible. */
- if (cfun->cw_asm_function)
+ if (cfun->iasm_asm_function)
return 0;
/* APPLE LOCAL end CW asm blocks */
@@ -4971,7 +4971,7 @@ ix86_expand_prologue (void)
else if (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)
/* APPLE LOCAL begin CW asm blocks */
{
- if (! cfun->cw_asm_function)
+ if (! cfun->iasm_asm_function)
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (-allocate), -1);
}
@@ -5108,7 +5108,7 @@ ix86_expand_epilogue (int style)
/* APPLE LOCAL begin CW asm blocks */
/* For an asm function, don't generate an epilogue. */
- if (cfun->cw_asm_function)
+ if (cfun->iasm_asm_function)
{
emit_jump_insn (gen_return_internal ());
return;
@@ -18978,11 +18978,13 @@ ix86_darwin_handle_regparmandstackparm (tree fndecl)
#define CTI_MAX c_CTI_MAX
#include "c-common.h"
#undef CTI_MAX
+#undef GCC_DIAG_STYLE
+#include "c-tree.h"
/* Addition register names accepted for inline assembly that would
otherwise not be registers. This table must be sorted for
bsearch. */
-static const char *additional_names[] = {
+static const char *iasm_additional_names[] = {
"AH", "AL", "AX", "BH", "BL", "BP", "BX", "CH", "CL", "CX", "DH",
"DI", "DL", "DX", "EAX", "EBP", "EBX", "ECX", "EDI", "EDX", "ESI",
"ESP", "MM0", "MM1", "MM2", "MM3", "MM4", "MM5", "MM6", "MM7", "R10",
@@ -18994,7 +18996,7 @@ static const char *additional_names[] = {
/* Comparison function for bsearch to find additional register names. */
static int
-cw_reg_comp (const void *a, const void *b)
+iasm_reg_comp (const void *a, const void *b)
{
char *const*x = a;
char *const*y = b;
@@ -19006,7 +19008,7 @@ cw_reg_comp (const void *a, const void *b)
forms. */
const char *
-i386_cw_asm_register_name (const char *regname, char *buf)
+i386_iasm_register_name (const char *regname, char *buf)
{
const char **r;
@@ -19021,9 +19023,9 @@ i386_cw_asm_register_name (const char *regname, char *buf)
/* If we can find a lower case version of any registers in
additional_names, return it. */
- r = bsearch (&regname, additional_names,
- sizeof (additional_names) / sizeof (additional_names[0]),
- sizeof (additional_names[0]), cw_reg_comp);
+ r = bsearch (&regname, iasm_additional_names,
+ sizeof (iasm_additional_names) / sizeof (iasm_additional_names[0]),
+ sizeof (iasm_additional_names[0]), iasm_reg_comp);
if (r)
{
char *p;
@@ -19042,11 +19044,10 @@ i386_cw_asm_register_name (const char *regname, char *buf)
return NULL;
}
-extern bool cw_memory_clobber (const char *);
/* Return true iff the opcode wants memory to be stable. We arrange
for a memory clobber in these instances. */
bool
-cw_memory_clobber (const char *ARG_UNUSED (opcode))
+iasm_memory_clobber (const char *ARG_UNUSED (opcode))
{
return true;
}
@@ -19054,7 +19055,7 @@ cw_memory_clobber (const char *ARG_UNUSED (opcode))
/* Return true iff the operands need swapping. */
bool
-cw_x86_needs_swapping (const char *opcode)
+iasm_x86_needs_swapping (const char *opcode)
{
/* Don't swap if output format is the same as input format. */
if (ASSEMBLER_DIALECT == ASM_INTEL)
@@ -19065,6 +19066,8 @@ cw_x86_needs_swapping (const char *opcode)
return false;
if (strcasecmp (opcode, "invlpga") == 0)
return false;
+ if (opcode[0] == ' ' && iasm_is_pseudo (opcode+1))
+ return false;
return true;
}
@@ -19073,11 +19076,11 @@ cw_x86_needs_swapping (const char *opcode)
is in ATT syntax. */
static tree
-x86_swap_operands (const char *opcode, tree args)
+iasm_x86_swap_operands (const char *opcode, tree args)
{
int noperands;
- if (cw_x86_needs_swapping (opcode) == false)
+ if (iasm_x86_needs_swapping (opcode) == false)
return args;
#if 0
@@ -19095,27 +19098,123 @@ x86_swap_operands (const char *opcode, tree args)
return args;
}
+/* Map a register name to a high level tree type for a VAR_DECL of
+ that type, whose RTL will refer to the given register. */
+
+static tree
+iasm_type_for (tree arg)
+{
+ tree type = NULL_TREE;
+
+ if (IDENTIFIER_LENGTH (arg) > 2
+ && IDENTIFIER_POINTER (arg)[0] == '%')
+ {
+ enum machine_mode mode = VOIDmode;
+ if (IDENTIFIER_POINTER (arg)[1] == 'e')
+ mode = SImode;
+ else if (/* IDENTIFIER_POINTER (arg)[2] == 'h'
+ || */ IDENTIFIER_POINTER (arg)[2] == 'l')
+ mode = QImode;
+ else if (IDENTIFIER_POINTER (arg)[2] == 'x')
+ mode = HImode;
+ else if (IDENTIFIER_POINTER (arg)[1] == 'r')
+ mode = DImode;
+ else if (IDENTIFIER_POINTER (arg)[1] == 'x')
+ mode = SFmode;
+ else if (IDENTIFIER_POINTER (arg)[1] == 'm')
+ mode = SFmode;
+
+ if (mode != VOIDmode)
+ type = c_common_type_for_mode (mode, 1);
+ }
+
+ return type;
+}
+
+/* We raise the code from a named register into a VAR_DECL of an
+ appropriate type that refers to the register so that reload doesn't
+ run out of registers. */
+
+tree
+iasm_raise_reg (tree arg)
+{
+ int regno = decode_reg_name (IDENTIFIER_POINTER (arg));
+ if (regno >= 0)
+ {
+ tree decl = NULL_TREE;
+
+ decl = lookup_name_two (arg, 0);
+ if (decl == error_mark_node)
+ decl = 0;
+ if (decl == 0)
+ {
+ tree type = iasm_type_for (arg);
+ if (type)
+ {
+ decl = build_decl (VAR_DECL, arg, type);
+ DECL_ARTIFICIAL (decl) = 1;
+ DECL_REGISTER (decl) = 1;
+ C_DECL_REGISTER (decl) = 1;
+ DECL_HARD_REGISTER (decl) = 1;
+ change_decl_assembler_name (decl, arg);
+ decl = pushdecl (decl);
+ }
+ }
+
+ if (decl)
+ return decl;
+ }
+
+ return arg;
+}
+
+/* Allow constants and readonly variables to be used in instructions
+ in places that require constants. */
+
+static tree
+iasm_default_conv (tree e)
+{
+ if (e == NULL_TREE)
+ return e;
+
+ if (TREE_CODE (e) == CONST_DECL)
+ e = DECL_INITIAL (e);
+
+ if (DECL_P (e) && DECL_MODE (e) != BLKmode)
+ e = decl_constant_value (e);
+ return e;
+}
+
/* Return true iff the operand is suitible for as the offset for a
memory instruction. */
static bool
-cw_is_offset (tree v)
+iasm_is_offset (tree v)
{
if (TREE_CODE (v) == INTEGER_CST)
return true;
if (TREE_CODE (v) == ADDR_EXPR)
- return true;
+ {
+ v = TREE_OPERAND (v, 0);
+ if (TREE_CODE (v) == VAR_DECL
+ && TREE_STATIC (v)
+ && MEM_P (DECL_RTL (v)))
+ return true;
+ if (TREE_CODE (v) == LABEL_DECL)
+ return true;
+ return false;
+ }
if (TREE_CODE (v) == VAR_DECL
&& TREE_STATIC (v)
&& MEM_P (DECL_RTL (v)))
return true;
if ((TREE_CODE (v) == MINUS_EXPR
|| TREE_CODE (v) == PLUS_EXPR)
- && cw_is_offset (TREE_OPERAND (v, 0))
- && cw_is_offset (TREE_OPERAND (v, 1)))
+ && iasm_is_offset (TREE_OPERAND (v, 0))
+ && iasm_is_offset (TREE_OPERAND (v, 1)))
return true;
if (TREE_CODE (v) == NEGATE_EXPR
- && cw_is_offset (TREE_OPERAND (v, 0)))
+ && iasm_is_offset (TREE_OPERAND (v, 0)))
return true;
return false;
@@ -19124,7 +19223,7 @@ cw_is_offset (tree v)
/* Combine two types for [] expressions. */
static tree
-cw_combine_type (tree type0, tree type1)
+iasm_combine_type (tree type0, tree type1)
{
if (type0 == void_type_node
|| type0 == NULL_TREE)
@@ -19153,7 +19252,7 @@ cw_combine_type (tree type0, tree type1)
TREE_OPERAND (, 0) is the offset portion of the expression. ARGP
points to the current part of the tree we're walking.
- Thee tranformations we do:
+ The tranformations we do:
(A+O) ==> A
(A-O) ==> A
@@ -19162,13 +19261,15 @@ cw_combine_type (tree type0, tree type1)
where O are offset expressions. */
static tree
-cw_canonicalize_bracket_1 (tree* argp, tree top)
+iasm_canonicalize_bracket_1 (tree* argp, tree top)
{
tree arg = *argp;
tree offset = TREE_OPERAND (top, 0);
tree arg0, arg1;
tree rtype = NULL_TREE;
+ *argp = arg = iasm_default_conv (arg);
+
switch (TREE_CODE (arg))
{
case NOP_EXPR:
@@ -19186,7 +19287,10 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
arg0 = TREE_OPERAND (arg, 0);
arg1 = TREE_OPERAND (arg, 1);
- if (cw_is_offset (arg0))
+ arg0 = iasm_default_conv (arg0);
+ arg1 = iasm_default_conv (arg1);
+
+ if (iasm_is_offset (arg0))
{
if (offset != integer_zero_node)
arg0 = build2 (PLUS_EXPR, void_type_node, arg0, offset);
@@ -19194,24 +19298,24 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
*argp = arg1;
if (arg1)
- return cw_combine_type (rtype, cw_canonicalize_bracket_1 (argp, top));
+ return iasm_combine_type (rtype, iasm_canonicalize_bracket_1 (argp, top));
}
- else if (arg1 && cw_is_offset (arg1))
+ else if (arg1 && iasm_is_offset (arg1))
{
if (offset != integer_zero_node)
arg1 = build2 (PLUS_EXPR, void_type_node, arg1, offset);
TREE_OPERAND (top, 0) = arg1;
*argp = arg0;
- return cw_combine_type (rtype, cw_canonicalize_bracket_1 (argp, top));
+ return iasm_combine_type (rtype, iasm_canonicalize_bracket_1 (argp, top));
}
else
{
- rtype = cw_combine_type (rtype,
- cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top));
+ rtype = iasm_combine_type (rtype,
+ iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top));
if (arg1)
- rtype = cw_combine_type (rtype,
- cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), top));
+ rtype = iasm_combine_type (rtype,
+ iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), top));
if (TREE_OPERAND (arg, 0) == NULL_TREE)
{
if (TREE_OPERAND (arg, 1))
@@ -19222,14 +19326,29 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
else
*argp = NULL_TREE;
}
+ else if (TREE_OPERAND (arg, 1) == NULL_TREE && rtype == NULL_TREE)
+ *argp = TREE_OPERAND (arg, 0);
+ if (TREE_CODE (arg) == PLUS_EXPR
+ && TREE_TYPE (arg) == NULL_TREE
+ && TREE_TYPE (TREE_OPERAND (arg, 0))
+ && TREE_TYPE (TREE_OPERAND (arg, 1))
+ && (POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 1)))
+ || POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 0)))))
+ {
+ tree type = TREE_TYPE (TREE_OPERAND (arg, 1));
+ if (INTEGRAL_TYPE_P (type))
+ type = TREE_TYPE (TREE_OPERAND (arg, 0));
+ TREE_TYPE (arg) = type;
+ }
}
return rtype;
case MINUS_EXPR:
- rtype = cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top);
+ rtype = iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 0), top);
arg0 = TREE_OPERAND (arg, 0);
arg1 = TREE_OPERAND (arg, 1);
- if (cw_is_offset (arg1))
+ arg1 = iasm_default_conv (arg1);
+ if (iasm_is_offset (arg1))
{
offset = TREE_OPERAND (top, 0);
if (offset == integer_zero_node)
@@ -19240,10 +19359,36 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
arg1 = build2 (MINUS_EXPR, void_type_node, offset, arg1);
TREE_OPERAND (top, 0) = arg1;
*argp = arg0;
- return cw_combine_type (rtype, cw_canonicalize_bracket_1 (argp, top));;
+ return iasm_combine_type (rtype, iasm_canonicalize_bracket_1 (argp, top));;
}
return rtype;
+ case PARM_DECL:
+ case VAR_DECL:
+ {
+ *argp = iasm_addr (arg);
+ break;
+ }
+
+ case IDENTIFIER_NODE:
+ {
+ *argp = iasm_raise_reg (arg);
+ break;
+ }
+
+ case MULT_EXPR:
+ if (TREE_TYPE (arg) == NULL_TREE)
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 1)) == IDENTIFIER_NODE)
+ TREE_OPERAND (arg, 1) = iasm_raise_reg (TREE_OPERAND (arg, 1));
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == IDENTIFIER_NODE)
+ TREE_OPERAND (arg, 0) = iasm_raise_reg (TREE_OPERAND (arg, 0));
+ if (TREE_TYPE (TREE_OPERAND (arg, 0))
+ && TREE_TYPE (TREE_OPERAND (arg, 1)))
+ TREE_TYPE (arg) = TREE_TYPE (TREE_OPERAND (arg, 0));
+ }
+ break;
+
default:
break;
}
@@ -19251,11 +19396,47 @@ cw_canonicalize_bracket_1 (tree* argp, tree top)
return NULL_TREE;
}
+/* Form an indirection for an inline asm address expression operand.
+ We give a warning when we think the optimizer might have to be used
+ to reform complex addresses, &stack_var + %eax + 4 for example,
+ after gimplification rips the address apart. */
+
+static tree
+iasm_indirect (tree addr)
+{
+ if (TREE_CODE (addr) == ADDR_EXPR
+ /* && TREE_CODE (TREE_OPERAND (addr, 0)) == ARRAY_REF */)
+ return TREE_OPERAND (addr, 0);
+
+ addr = fold (build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (addr)), addr));
+
+ if (! optimize && TREE_CODE (addr) == INDIRECT_REF)
+ warning ("addressing mode too complex when not optimizing, will consume extra register(s)");
+
+ return addr;
+}
+
+/* For an address addition for an inline asm address expression. We
+ try and form ARRAY_REFs, as they will go through gimplification
+ without being ripped apart. */
+
+static tree
+iasm_add (tree addr, tree off)
+{
+ if (integer_zerop (off))
+ return addr;
+
+ /* We have to convert the offset to an int type, as we rip apart
+ trees whose type has been converted to a pointer type for the
+ offset already. */
+ return pointer_int_sum (PLUS_EXPR, addr, convert (integer_type_node, off));
+}
+
/* We canonicalize the inputs form of bracket expressions as the input
forms are less constrained than what the assembler will accept. */
-static void
-cw_canonicalize_bracket (tree arg)
+static tree
+iasm_canonicalize_bracket (tree arg)
{
tree rtype;
@@ -19268,11 +19449,16 @@ cw_canonicalize_bracket (tree arg)
if (TREE_OPERAND (arg, 1) == NULL_TREE
&& TREE_TYPE (TREE_OPERAND (arg, 0))
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 0))))
- return;
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
+ || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL)
+ return arg;
+ return iasm_indirect (TREE_OPERAND (arg, 0));
+ }
/* Ensure that 0 is an offset */
if (TREE_OPERAND (arg, 0)
- && cw_is_offset (TREE_OPERAND (arg, 0)))
+ && iasm_is_offset (TREE_OPERAND (arg, 0)))
{
/* we win if 0 is an offset already. */
}
@@ -19286,26 +19472,80 @@ cw_canonicalize_bracket (tree arg)
{
tree swp;
/* Just have to force it now */
- swp = cw_build_bracket (TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1));
+ swp = iasm_build_bracket (TREE_OPERAND (arg, 0), TREE_OPERAND (arg, 1));
TREE_OPERAND (arg, 0) = integer_zero_node;
TREE_OPERAND (arg, 1) = swp;
}
if (TREE_OPERAND (arg, 1))
{
- rtype = cw_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), arg);
+ rtype = iasm_canonicalize_bracket_1 (&TREE_OPERAND (arg, 1), arg);
if (rtype)
- TREE_TYPE (arg) = cw_combine_type (TREE_TYPE (arg), rtype);
+ TREE_TYPE (arg) = iasm_combine_type (TREE_TYPE (arg), rtype);
+ }
+
+ /* For correctness, pointer types should be raised to the tree
+ level, as they denote address calculations with stack based
+ objects, and we want print_operand to print the entire address so
+ that it can combine contants and hard registers into the address.
+ Unfortunnately we might have to rely upon the optimizer to reform
+ the address after the gimplification pass rips it apart. */
+
+ /* Handle [INTEGER_CST][ptr][op3] */
+ if (TREE_OPERAND (arg, 1)
+ && TREE_TYPE (arg) == void_type_node
+ && TREE_CODE (TREE_OPERAND (arg, 0)) == INTEGER_CST
+ && TREE_CODE (TREE_OPERAND (arg, 1)) == BRACKET_EXPR
+ && TREE_TYPE (TREE_OPERAND (TREE_OPERAND (arg, 1), 0))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (arg, 1), 0)))
+ && TREE_TYPE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (arg, 1), 0))) != void_type_node)
+ {
+ tree op3 = TREE_OPERAND (TREE_OPERAND (arg, 1), 1);
+ tree addr = iasm_add (TREE_OPERAND (TREE_OPERAND (arg, 1), 0),
+ TREE_OPERAND (arg, 0));
+ tree type;
+ addr = iasm_indirect (addr);
+ if (op3 == NULL_TREE)
+ return addr;
+ type = TREE_TYPE (addr);
+ type = build_pointer_type (type);
+ addr = build1 (ADDR_EXPR, type, addr);
+ addr = fold (build2 (PLUS_EXPR, type, addr, op3));
+ return iasm_indirect (addr);
}
+
+ /* Handle ptr + INTEGER_CST */
+ if (TREE_OPERAND (arg, 1)
+ && TREE_TYPE (arg) == void_type_node
+ && TREE_TYPE (TREE_OPERAND (arg, 1))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg, 1)))
+ && TREE_TYPE (TREE_TYPE (TREE_OPERAND (arg, 1))) != void_type_node)
+ {
+ if (TREE_CODE (TREE_OPERAND (arg, 1)) == ADDR_EXPR)
+ {
+ if (TREE_OPERAND (arg, 0) == integer_zero_node)
+ return TREE_OPERAND (TREE_OPERAND (arg, 1), 0);
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == INTEGER_CST)
+ return iasm_indirect (iasm_add (TREE_OPERAND (arg, 1), TREE_OPERAND (arg, 0)));
+ }
+ if (TREE_CODE (TREE_OPERAND (arg, 1)) == PLUS_EXPR)
+ {
+ if (TREE_OPERAND (arg, 0) == integer_zero_node)
+ return iasm_indirect (TREE_OPERAND (arg, 1));
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == INTEGER_CST)
+ return iasm_indirect (iasm_add (TREE_OPERAND (arg, 1), TREE_OPERAND (arg, 0)));
+ }
+ }
+ return arg;
}
/* We canonicalize the instruction by swapping operands and rewritting
the opcode if the output style is in ATT syntax. */
tree
-x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
+iasm_x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
{
- cw_md_extra_info *e = ep;
+ iasm_md_extra_info *e = ep;
static char buf[40];
tree args = iargs;
int argnum = 1;
@@ -19344,10 +19584,11 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
}
}
else if (TREE_CODE (arg) == BRACKET_EXPR)
- cw_canonicalize_bracket (arg);
+ TREE_VALUE (args) = arg = iasm_canonicalize_bracket (arg);
switch (TREE_CODE (arg))
{
+ case ARRAY_REF:
case VAR_DECL:
case PARM_DECL:
case INDIRECT_REF:
@@ -19414,7 +19655,9 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
}
--argnum;
- args = x86_swap_operands (opcode, iargs);
+ args = iasm_x86_swap_operands (opcode, iargs);
+ if (opcode[0] == ' ' && iasm_is_pseudo (opcode+1))
+ e->pseudo = true;
/* movsx isn't part of the AT&T syntax, they spell it movs. */
if (strcasecmp (opcode, "movsx") == 0)
@@ -19427,7 +19670,8 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
same before and after size is accepted and it just a normal
move. */
if (argnum == 2
- && e->mod[0] == e->mod[1])
+ && (e->mod[0] == e->mod[1]
+ || e->mod[1] == 0))
opcode = "mov";
else
opcode = "movz";
@@ -19450,7 +19694,9 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
e->mod[1] = 'l';
}
- if (strcasecmp (opcode, "out") == 0
+ if (e->pseudo)
+ e->mod[0] = e->mod[1] = 0;
+ else if (strcasecmp (opcode, "out") == 0
|| strcasecmp (opcode, "movntq") == 0
|| strcasecmp (opcode, "movd") == 0
|| strcasecmp (opcode, "movq") == 0
@@ -19489,10 +19735,10 @@ x86_canonicalize_operands (const char **opcode_p, tree iargs, void *ep)
/* Character used to seperate the prefix words. */
/* See radr://4141844 for the enhancement to make this uniformly ' '. */
-#define CW_PREFIX_SEP '/'
+#define IASM_PREFIX_SEP '/'
void
-x86_cw_print_prefix (char *buf, tree prefix_list)
+iasm_x86_print_prefix (char *buf, tree prefix_list)
{
buf += strlen (buf);
while (prefix_list)
@@ -19501,18 +19747,30 @@ x86_cw_print_prefix (char *buf, tree prefix_list)
size_t len = IDENTIFIER_LENGTH (prefix);
memcpy (buf, IDENTIFIER_POINTER (prefix), len);
buf += len;
- buf[0] = CW_PREFIX_SEP;
+ buf[0] = IASM_PREFIX_SEP;
++buf;
buf[0] = 0;
prefix_list = TREE_CHAIN (prefix_list);
}
}
+/* Warn when a variables address is used to form a memory address when
+ that address will use an extra register during reload. */
+
+static void
+iasm_warn_extra_reg (tree arg)
+{
+ if (TREE_CODE (arg) == ADDR_EXPR
+ && (TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL
+ || TREE_CODE (TREE_OPERAND (arg, 0)) == PARM_DECL))
+ warning ("addressing mode too complex, will consume an extra register");
+}
+
bool
-cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
- bool must_be_reg, bool must_not_be_reg, void *ep)
+iasm_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
+ bool must_be_reg, bool must_not_be_reg, void *ep)
{
- cw_md_extra_info *e = ep;
+ iasm_md_extra_info *e = ep;
switch (TREE_CODE (arg))
{
case BRACKET_EXPR:
@@ -19530,15 +19788,14 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
decompose it into parts so that things like (%esp + 20) + 4
can be output as 24(%esp) by the optimizer instead of 4(%0)
and burning an "R" with (%esp + 20). */
- cw_force_constraint ("m", e);
- op1 = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (op1)), op1);
- op1 = fold (op1);
- cw_asm_get_register_var (op1, "", buf, argnum, must_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("m", e);
+ iasm_get_register_var (op1, "", buf, argnum, must_be_reg, e);
+ iasm_force_constraint (0, e);
break;
}
- if (TREE_CODE (op2) == BRACKET_EXPR)
+ if (op2
+ && TREE_CODE (op2) == BRACKET_EXPR)
{
op3 = TREE_OPERAND (op2, 1);
op2 = TREE_OPERAND (op2, 0);
@@ -19550,12 +19807,6 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
}
if (op0)
return false;
- if (op2 == NULL_TREE)
- {
- op2 = op1;
- op1 = op0;
- op0 = NULL_TREE;
- }
if (ASSEMBLER_DIALECT == ASM_INTEL)
strcat (buf, "[");
@@ -19592,10 +19843,14 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
}
e->as_immediate = true;
- print_cw_asm_operand (buf, op1, argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, op1, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
e->as_immediate = false;
+ /* Just an immediate. */
+ if (op2 == NULL_TREE && op3 == NULL_TREE)
+ break;
+
if (ASSEMBLER_DIALECT == ASM_INTEL)
strcat (buf, "]");
if (ASSEMBLER_DIALECT == ASM_INTEL)
@@ -19606,10 +19861,11 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
if (op2)
{
/* We know by context, this has to be an R. */
- cw_force_constraint ("R", e);
- print_cw_asm_operand (buf, op2, argnum, uses,
- must_be_reg, must_not_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("R", e);
+ iasm_warn_extra_reg (op2);
+ iasm_print_operand (buf, op2, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
+ iasm_force_constraint (0, e);
}
if (op3)
{
@@ -19619,16 +19875,17 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
strcat (buf, ",");
/* We know by context, this has to be an l. */
- cw_force_constraint ("l", e);
- print_cw_asm_operand (buf, op3, argnum, uses,
- must_be_reg, must_not_be_reg, e);
- cw_force_constraint (0, e);
+ iasm_force_constraint ("l", e);
+ iasm_warn_extra_reg (op3);
+ iasm_print_operand (buf, op3, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
+ iasm_force_constraint (0, e);
if (scale)
{
strcat (buf, ",");
e->as_immediate = true;
- print_cw_asm_operand (buf, scale, argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, scale, argnum, uses,
+ must_be_reg, must_not_be_reg, e);
e->as_immediate = false;
}
}
@@ -19640,19 +19897,25 @@ cw_print_op (char *buf, tree arg, unsigned argnum, tree *uses,
break;
case ADDR_EXPR:
+ if (TREE_CODE (TREE_OPERAND (arg, 0)) == ARRAY_REF
+ || TREE_CODE (TREE_OPERAND (arg, 0)) == VAR_DECL)
+ {
+ iasm_get_register_var (arg, "", buf, argnum, must_be_reg, e);
+ break;
+ }
if (! e->as_immediate)
e->as_offset = true;
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
e->as_offset = false;
break;
case MULT_EXPR:
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 0), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
strcat (buf, "*");
- print_cw_asm_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
- must_be_reg, must_not_be_reg, e);
+ iasm_print_operand (buf, TREE_OPERAND (arg, 1), argnum, uses,
+ must_be_reg, must_not_be_reg, e);
break;
default:
return false;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 7fdf2564985..2342ce27067 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2616,21 +2616,22 @@ struct machine_function GTY(())
#define X86_FILE_START_FLTUSED false
/* APPLE LOCAL begin CW asm blocks */
-#undef TARGET_CW_EXTRA_INFO
-#define TARGET_CW_EXTRA_INFO \
+#undef TARGET_IASM_EXTRA_INFO
+#define TARGET_IASM_EXTRA_INFO \
char mod[3]; \
bool as_immediate; \
- bool as_offset;
+ bool as_offset; \
+ bool pseudo;
-#define TARGET_CW_REORDER_ARG(OPCODE, NEWARGNUM, NUM_ARGS, ARGNUM) \
+#define TARGET_IASM_REORDER_ARG(OPCODE, NEWARGNUM, NUM_ARGS, ARGNUM) \
do { \
/* If we are outputting AT&T style assembly language, the argument \
numbering is reversed. */ \
- if (cw_x86_needs_swapping (opcode)) \
+ if (iasm_x86_needs_swapping (opcode)) \
NEWARGNUM = NUM_ARGS - ARGNUM + 1; \
} while (0)
-#define CW_SYNTH_CONSTRAINTS(R, ARGNUM, NUM_ARGS, DB) \
+#define IASM_SYNTH_CONSTRAINTS(R, ARGNUM, NUM_ARGS, DB) \
do { \
/* On x86, operand 2 or 3 can be left out and the assembler will deal with it. \
\
@@ -2660,18 +2661,18 @@ struct machine_function GTY(())
} \
} while (0)
-#define TARGET_CW_PRINT_OP(BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E) \
- cw_print_op (BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E)
+#define TARGET_IASM_PRINT_OP(BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E) \
+ iasm_print_op (BUF, ARG, ARGNUM, USES, MUST_BE_REG, MUST_NOT_BE_REG, E)
-extern tree x86_canonicalize_operands (const char **, tree, void *);
+extern tree iasm_x86_canonicalize_operands (const char **, tree, void *);
/* On x86, we can rewrite opcodes, change argument ordering and so no... */
-#define CW_CANONICALIZE_OPERANDS(OPCODE, NEW_OPCODE, IARGS, E) \
- do { \
- NEW_OPCODE = OPCODE; \
- IARGS = x86_canonicalize_operands (&NEW_OPCODE, IARGS, E); \
+#define IASM_CANONICALIZE_OPERANDS(OPCODE, NEW_OPCODE, IARGS, E) \
+ do { \
+ NEW_OPCODE = OPCODE; \
+ IARGS = iasm_x86_canonicalize_operands (&NEW_OPCODE, IARGS, E); \
} while (0)
-#define CW_SEE_OPCODE(YYCHAR, T) \
+#define IASM_SEE_OPCODE(YYCHAR, T) \
/* If we see an int, arrange to see it as an identifier (opcode), \
not as a type. */ \
((YYCHAR == TYPESPEC \
@@ -2680,7 +2681,7 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
/* Return true iff the ID is a prefix for an instruction. */
-#define CW_IS_PREFIX(ID) \
+#define IASM_IS_PREFIX(ID) \
do { \
const char *myname = IDENTIFIER_POINTER (ID); \
if (strcasecmp (myname, "lock") == 0 \
@@ -2692,32 +2693,32 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
return true; \
} while (0)
-#define CW_PRINT_PREFIX(BUF, PREFIX_LIST) x86_cw_print_prefix(BUF, PREFIX_LIST)
+#define IASM_PRINT_PREFIX(BUF, PREFIX_LIST) iasm_x86_print_prefix(BUF, PREFIX_LIST)
-#define CW_IMMED_PREFIX(E, BUF) \
+#define IASM_IMMED_PREFIX(E, BUF) \
do { \
- if (! E->as_immediate) \
+ if (!E->pseudo && ! E->as_immediate) \
sprintf (BUF + strlen (BUF), "$"); \
} while (0)
-#define CW_OFFSET_PREFIX(E, BUF) \
+#define IASM_OFFSET_PREFIX(E, BUF) \
do { \
if (E->as_offset) \
sprintf (BUF + strlen (BUF), "$"); \
} while (0)
/* We can't yet expose ST(x) to reg-stack.c, don't try. */
-#define CW_HIDE_REG(R) FP_REGNO_P (R)
+#define IASM_HIDE_REG(R) FP_REGNO_P (R)
-#define CW_SEE_IMMEDIATE(E) \
+#define IASM_SEE_IMMEDIATE(E) \
E->as_immediate = true
-#define CW_SEE_NO_IMMEDIATE(E) \
+#define IASM_SEE_NO_IMMEDIATE(E) \
E->as_immediate = false
/* Table of instructions that need extra constraints. Keep this table sorted. */
-#undef TARGET_CW_OP_CONSTRAINT
-#define TARGET_CW_OP_CONSTRAINT \
+#undef TARGET_IASM_OP_CONSTRAINT
+#define TARGET_IASM_OP_CONSTRAINT \
{ "adc", 1, "+rm,r" }, \
{ "adc", 2, "ir,m" }, \
{ "add", 1, "+rm,r" }, \
@@ -2792,6 +2793,62 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
{ "cmovz", 2, U("rm")}, \
{ "cmp", 1, "rm,r"}, \
{ "cmp", 2, "ir,m"}, \
+ { "cmpeqpd", 1, "=x"}, \
+ { "cmpeqpd", 2, "xm"}, \
+ { "cmpeqps", 1, "=x"}, \
+ { "cmpeqps", 2, "xm"}, \
+ { "cmpeqsd", 1, "=x"}, \
+ { "cmpeqsd", 2, "xm"}, \
+ { "cmpeqss", 1, "=x"}, \
+ { "cmpeqss", 2, "xm"}, \
+ { "cmplepd", 1, "=x"}, \
+ { "cmplepd", 2, "xm"}, \
+ { "cmpleps", 1, "=x"}, \
+ { "cmpleps", 2, "xm"}, \
+ { "cmplesd", 1, "=x"}, \
+ { "cmplesd", 2, "xm"}, \
+ { "cmpless", 1, "=x"}, \
+ { "cmpless", 2, "xm"}, \
+ { "cmpltpd", 1, "=x"}, \
+ { "cmpltpd", 2, "xm"}, \
+ { "cmpltps", 1, "=x"}, \
+ { "cmpltps", 2, "xm"}, \
+ { "cmpltsd", 1, "=x"}, \
+ { "cmpltsd", 2, "xm"}, \
+ { "cmpltss", 1, "=x"}, \
+ { "cmpltss", 2, "xm"}, \
+ { "cmpneqpd", 1, "=x"}, \
+ { "cmpneqpd", 2, "xm"}, \
+ { "cmpneqps", 1, "=x"}, \
+ { "cmpneqps", 2, "xm"}, \
+ { "cmpneqsd", 1, "=x"}, \
+ { "cmpneqsd", 2, "xm"}, \
+ { "cmpneqss", 1, "=x"}, \
+ { "cmpneqss", 2, "xm"}, \
+ { "cmpnlepd", 1, "=x"}, \
+ { "cmpnlepd", 2, "xm"}, \
+ { "cmpnleps", 1, "=x"}, \
+ { "cmpnleps", 2, "xm"}, \
+ { "cmpnlesd", 1, "=x"}, \
+ { "cmpnlesd", 2, "xm"}, \
+ { "cmpnless", 1, "=x"}, \
+ { "cmpnless", 2, "xm"}, \
+ { "cmpnltpd", 1, "=x"}, \
+ { "cmpnltpd", 2, "xm"}, \
+ { "cmpnltps", 1, "=x"}, \
+ { "cmpnltps", 2, "xm"}, \
+ { "cmpnltsd", 1, "=x"}, \
+ { "cmpnltsd", 2, "xm"}, \
+ { "cmpnltss", 1, "=x"}, \
+ { "cmpnltss", 2, "xm"}, \
+ { "cmpordpd", 1, "=x"}, \
+ { "cmpordpd", 2, "xm"}, \
+ { "cmpordps", 1, "=x"}, \
+ { "cmpordps", 2, "xm"}, \
+ { "cmpordsd", 1, "=x"}, \
+ { "cmpordsd", 2, "xm"}, \
+ { "cmpordss", 1, "=x"}, \
+ { "cmpordss", 2, "xm"}, \
{ "cmppd", 1, "=x"}, \
{ "cmppd", 2, "xm"}, \
{ "cmppd", 3, "i"}, \
@@ -2804,6 +2861,14 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
{ "cmpss", 1, "=x"}, \
{ "cmpss", 2, "xm"}, \
{ "cmpss", 3, "i"}, \
+ { "cmpunordpd", 1, "=x"}, \
+ { "cmpunordpd", 2, "xm"}, \
+ { "cmpunordps", 1, "=x"}, \
+ { "cmpunordps", 2, "xm"}, \
+ { "cmpunordsd", 1, "=x"}, \
+ { "cmpunordsd", 2, "xm"}, \
+ { "cmpunordss", 1, "=x"}, \
+ { "cmpunordss", 2, "xm"}, \
{ "cmpxchg", 1, "+mr"}, \
{ "cmpxchg", 2, "r"}, \
{ "comisd", 1, "x"}, \
@@ -3400,10 +3465,19 @@ extern tree x86_canonicalize_operands (const char **, tree, void *);
{ "xorps", 1, "+x"}, \
{ "xorps", 2, "xm"},
-#define TARGET_CW_EXTRA_CLOBBERS \
+#define TARGET_IASM_EXTRA_CLOBBERS \
{ "rdtsc", { "edx", "eax"} }
-#define CW_FUNCTION_MODIFIER "P"
+#define IASM_FUNCTION_MODIFIER "P"
+
+#define IASM_VALID_PIC(DECL, E) \
+ do { \
+ if (E->as_immediate && ! TARGET_DYNAMIC_NO_PIC && flag_pic) \
+ warning ("non-pic addressing form not suitible for pic code"); \
+ } while (0)
+
+#define IASM_REGISTER_NAME(STR, BUF) i386_iasm_register_name (STR, BUF)
+
/* APPLE LOCAL end CW asm blocks */
/*
diff --git a/gcc/config/i386/mmintrin.h b/gcc/config/i386/mmintrin.h
index a366783cfa3..5820efb18f3 100644
--- a/gcc/config/i386/mmintrin.h
+++ b/gcc/config/i386/mmintrin.h
@@ -35,7 +35,8 @@
# error "MMX instruction set not enabled"
#else
/* The data type intended for user use. */
-typedef int __m64 __attribute__ ((__vector_size__ (8)));
+/* APPLE LOCAL 4505813 */
+typedef long long __m64 __attribute__ ((__vector_size__ (8)));
/* Internal data types for implementing the intrinsics. */
typedef int __v2si __attribute__ ((__vector_size__ (8)));
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 3562c7c5dab..9e6ad849b22 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -215,7 +215,7 @@ extern void rs6000_conditional_register_usage (void);
/* APPLE LOCAL AltiVec */
extern tree rs6000_fold_builtin (tree, bool);
/* APPLE LOCAL CW asm blocks */
-extern const char *rs6000_cw_asm_register_name (const char *, char *);
+extern const char *rs6000_iasm_register_name (const char *, char *);
/* Declare functions in rs6000-c.c */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c2c2b302839..39f7f78bf2d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -661,6 +661,10 @@ static void rs6000_assemble_visibility (tree, int);
static int rs6000_ra_ever_killed (void);
static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL begin mainline */
+static bool rs6000_ms_bitfield_layout_p (tree);
+static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *);
+/* APPLE LOCAL end mainline */
static void rs6000_eliminate_indexed_memrefs (rtx operands[2]);
static const char *rs6000_mangle_fundamental_type (tree);
extern const struct attribute_spec rs6000_attribute_table[];
@@ -1025,6 +1029,11 @@ static const char alt_reg_names[][8] =
/* APPLE LOCAL end pragma reverse_bitfields */
#endif
+/* APPLE LOCAL begin mainline */
+#undef TARGET_MS_BITFIELD_LAYOUT_P
+#define TARGET_MS_BITFIELD_LAYOUT_P rs6000_ms_bitfield_layout_p
+
+/* APPLE LOCAL end mainline */
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk
@@ -1385,10 +1394,10 @@ rs6000_override_options (const char *default_cpu)
flag_strict_aliasing = 1;
flag_schedule_interblock = 1;
flag_gcse_las = 1;
- align_jumps_max_skip = 15;
+ align_jumps_max_skip = 15;
align_loops_max_skip = 15;
align_functions = 16;
- align_loops = 16;
+ align_loops = 16;
align_jumps = 16;
set_fast_math_flags (1);
flag_reorder_blocks = 1;
@@ -1396,7 +1405,7 @@ rs6000_override_options (const char *default_cpu)
flag_reorder_blocks_and_partition = 1;
if (!flag_pic)
set_target_switch ("dynamic-no-pic");
-
+
if (mcpu_cpu == PROCESSOR_POWER4)
{
set_target_switch ("powerpc-gpopt");
@@ -1428,8 +1437,8 @@ rs6000_override_options (const char *default_cpu)
target_flags |= ~target_flags_explicit & MASK_MULTIPLE;
/* If we are optimizing big endian systems for space, use the
- string instructions. But do not do this for Darwin, as the
- kernel can't properly support some hardware that doesn't have
+ string instructions. But do not do this for Darwin, as the
+ kernel can't properly support some hardware that doesn't have
these instructions. It's not clear that the compiler is the
right place to fix this, but that's how it is for now. See
*extensive* discussion in Radar 3509006. */
@@ -2022,7 +2031,7 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
Do not reset things unless they're per-function. */
void
-reset_optimization_options (int level ATTRIBUTE_UNUSED,
+reset_optimization_options (int level ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED)
{
if (DEFAULT_ABI == ABI_DARWIN)
@@ -2392,10 +2401,10 @@ reg_or_cint_operand (rtx op, enum machine_mode mode)
int
scc_operand (rtx op, enum machine_mode mode)
{
- return ((GET_CODE (op) == CONST_INT
- && (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')
- || CONST_OK_FOR_LETTER_P (INTVAL (op), 'K')
- || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')
+ return ((GET_CODE (op) == CONST_INT
+ && (CONST_OK_FOR_LETTER_P (INTVAL (op), 'I')
+ || CONST_OK_FOR_LETTER_P (INTVAL (op), 'K')
+ || CONST_OK_FOR_LETTER_P (INTVAL (op), 'O')
|| CONST_OK_FOR_LETTER_P (INTVAL (op), (TARGET_32BIT ? 'L' : 'J'))))
|| gpc_reg_operand (op, mode));
}
@@ -3150,7 +3159,7 @@ mask64_1or2_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED,
{
HOST_WIDE_INT c, lsb;
bool one_ok;
-
+
c = INTVAL (op);
/* Disallow all zeros. */
@@ -3161,7 +3170,7 @@ mask64_1or2_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED,
AND there are zero, one or two transitions in the _whole_ of
C. */
one_ok = !(c & ~(HOST_WIDE_INT)0xffffffff);
-
+
/* We don't change the number of transitions by inverting,
so make sure we start with the LS bit zero. */
if (c & 1)
@@ -3488,7 +3497,7 @@ rs6000_special_round_type_align (tree type, int computed, int specified)
{
tree field = TYPE_FIELDS (type);
- /* Skip all non field decls */
+ /* Skip all non field decls */
while (field != NULL && TREE_CODE (field) != FIELD_DECL)
field = TREE_CHAIN (field);
@@ -5019,8 +5028,8 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
if (DEFAULT_ABI == ABI_DARWIN && MACHOPIC_INDIRECT)
{
/* APPLE LOCAL begin radar 4232296 */
- /* If a symbol node has been generated but its flags not set; such as in the course of
- cost computation of generated code, do not attempt to update the static tables which
+ /* If a symbol node has been generated but its flags not set; such as in the course of
+ cost computation of generated code, do not attempt to update the static tables which
rely on flags of the referenced symbol to have been set. Otherwise, bogus PIC stub
will be generated. */
if (!(GET_CODE (operands[1]) == SYMBOL_REF && SYMBOL_REF_FLAGS (operands[1]) == 0))
@@ -5609,7 +5618,7 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
/* APPLE LOCAL fix 64-bit varargs 4028089 */
cum->floats_in_gpr = 0;
rs6000_darwin64_record_arg_advance_recurse (cum, type, 0);
- rs6000_darwin64_record_arg_advance_flush (cum,
+ rs6000_darwin64_record_arg_advance_flush (cum,
/* APPLE LOCAL fix 64-bit varargs 4028089 */
size * BITS_PER_UNIT, 1);
}
@@ -5776,7 +5785,7 @@ rs6000_spe_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
structure between cum->intoffset and bitpos to integer registers. */
static void
-rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
+rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
HOST_WIDE_INT bitpos, rtx rvec[], int *k)
{
enum machine_mode mode;
@@ -5820,7 +5829,7 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
if (intregs > 0 && intregs > GP_ARG_NUM_REG - this_regno)
cum->use_stack = 1;
-
+
intregs = MIN (intregs, GP_ARG_NUM_REG - this_regno);
if (intregs <= 0)
return;
@@ -5844,7 +5853,7 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
/* Recursive workhorse for the following. */
static void
-rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
+rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
HOST_WIDE_INT startbitpos, rtx rvec[],
int *k)
{
@@ -5878,7 +5887,7 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
#endif
rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
rvec[(*k)++]
- = gen_rtx_EXPR_LIST (VOIDmode,
+ = gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (mode, cum->fregno++),
GEN_INT (bitpos / BITS_PER_UNIT));
if (mode == TFmode)
@@ -5888,8 +5897,8 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
{
rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
rvec[(*k)++]
- = gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_REG (mode, cum->vregno++),
+ = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_REG (mode, cum->vregno++),
GEN_INT (bitpos / BITS_PER_UNIT));
}
else if (cum->intoffset == -1)
@@ -5902,7 +5911,7 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
being passed by value, along with the offset of where the
register's value may be found in the block. FP fields go in FP
register, vector fields go in vector registers, and everything
- else goes in int registers, packed as in memory.
+ else goes in int registers, packed as in memory.
This code is also used for function return values. RETVAL indicates
whether this is the case.
@@ -6548,7 +6557,7 @@ setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static
bool skip_vec_args(tree arg_type, int pass, int *last_pass)
-{
+{
if (DEFAULT_ABI != ABI_DARWIN)
return false;
@@ -6559,9 +6568,9 @@ bool skip_vec_args(tree arg_type, int pass, int *last_pass)
return true;
}
else if (pass == 2)
- return true;
+ return true;
return false;
-}
+}
/* APPLE LOCAL end Altivec */
@@ -6870,7 +6879,7 @@ do { \
are stored in ALTIVEC_PIM_TABLE below, each annotated with flags indicating
how its arguments should be matched and/or how its return type is to be
determined. */
-
+
enum pim_flags
{
/* CR6 predicate modifiers. Not used for operations. For predicates,
@@ -6885,7 +6894,7 @@ enum pim_flags
/* Function overload argument matching. Operations and predicates with
multiple overload candidates will have multiple entries, listed
- contiguously, in the ALTIVEC_PIM_TABLE below. When the
+ contiguously, in the ALTIVEC_PIM_TABLE below. When the
rs6000_fold_builtin() routine is called, it will first point at
the first entry. If any of the pim_ovl_... flags is set for this
entry, the argument(s) to rs6000_fold_builtin() will be type-checked
@@ -6937,7 +6946,7 @@ enum pim_flags
/* Mark the beginning of instruction groups. For our purposes, an
instruction group is the collection of overload candidates for
a particular instruction or predicate. For example, the entries
- "vec_abss", "vec_abss.2" and "vec_abss.3" defined in
+ "vec_abss", "vec_abss.2" and "vec_abss.3" defined in
altivec_init_builtins() below constitute a group, as does the
singleton "vec_addc" entry. */
@@ -7413,7 +7422,7 @@ static struct builtin_description bdesc_1arg[] =
static tree
altivec_cov_rt_12 (tree t1, tree t2)
-{
+{
/* NB: The ordering of the following statements is important.
Matching of more specific types (e.g., 'vector pixel') should
precede matching of more general types, esp. if they subsume the
@@ -7443,7 +7452,7 @@ altivec_cov_rt_12 (tree t1, tree t2)
static tree
altivec_cov_rt_2p (tree t)
-{
+{
/* Must be a pointer. */
if (!t)
@@ -7586,17 +7595,17 @@ altivec_ovl_resolve (struct altivec_pim_info *info, tree t1, tree t2)
|| t2 == unsigned_V4SI_type_node);
case pim_ovl_pqi_2:
- OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
+ OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
&& (TYPE_MODE (TREE_TYPE (t2)) == QImode
|| TYPE_MODE (TREE_TYPE (t2)) == V16QImode));
case pim_ovl_phi_2:
- OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
+ OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
&& (TYPE_MODE (TREE_TYPE (t2)) == HImode
|| TYPE_MODE (TREE_TYPE (t2)) == V8HImode));
case pim_ovl_psi_2:
- OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
+ OVL_MATCH (TREE_CODE (t2) == POINTER_TYPE
&& (TYPE_MODE (TREE_TYPE (t2)) == SImode
|| TYPE_MODE (TREE_TYPE (t2)) == V4SImode
|| TYPE_MODE (TREE_TYPE (t2)) == SFmode
@@ -7645,7 +7654,7 @@ altivec_convert_args (tree types, tree args)
tree
rs6000_fold_builtin (tree exp, bool ARG_UNUSED (ignore))
-{
+{
tree fndecl, arglist, rettype;
tree typ1 = NULL_TREE, typ2 = NULL_TREE;
int fcode, ovl_error = 0;
@@ -14851,16 +14860,16 @@ rs6000_stack_info (void)
/* If we have an assembly function, maybe use an explicit size. To
be consistent with CW behavior (and because it's safer), let
RS6000_ALIGN round the explicit size up if necessary. */
- if (cfun->cw_asm_function && cfun->cw_asm_frame_size != -2)
+ if (cfun->iasm_asm_function && cfun->iasm_frame_size != -2)
{
- if (cfun->cw_asm_frame_size == -1)
+ if (cfun->iasm_frame_size == -1)
non_fixed_size = 32;
- else if (cfun->cw_asm_frame_size < 32)
+ else if (cfun->iasm_frame_size < 32)
error ("fralloc frame size must be at least 32");
else
- non_fixed_size = cfun->cw_asm_frame_size;
+ non_fixed_size = cfun->iasm_frame_size;
non_fixed_size += 24;
- info_ptr->total_size = RS6000_ALIGN (non_fixed_size,
+ info_ptr->total_size = RS6000_ALIGN (non_fixed_size,
ABI_STACK_BOUNDARY / BITS_PER_UNIT);
}
else
@@ -14881,7 +14890,7 @@ rs6000_stack_info (void)
that the debugger can handle stackless frames. */
/* APPLE LOCAL CW asm blocks */
- if (info_ptr->calls_p || (cfun->cw_asm_function && cfun->cw_asm_frame_size != -2))
+ if (info_ptr->calls_p || (cfun->iasm_asm_function && cfun->iasm_frame_size != -2))
info_ptr->push_p = 1;
else if (DEFAULT_ABI == ABI_V4)
@@ -15154,7 +15163,7 @@ rs6000_return_addr (int count, rtx frame)
/* APPLE LOCAL begin sibling calls
On Darwin only, indirect calls may be sibcalls. This is enabled
- primarily by target-specific logic in calls.c.
+ primarily by target-specific logic in calls.c.
APPLE LOCAL end sibling calls */
static bool
rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
@@ -15791,14 +15800,14 @@ static int name_encodes_objc_method_p (const char *piclabel_name)
/* APPLE LOCAL begin recompute PIC register use */
/* Sometimes a function has references that require the PIC register,
but optimization removes them all. To catch this case
- recompute current_function_uses_pic_offset_table here.
+ recompute current_function_uses_pic_offset_table here.
This may allow us to eliminate the prologue and epilogue. */
static int
recompute_PIC_register_use (void)
{
- if (DEFAULT_ABI == ABI_DARWIN
- && flag_pic && current_function_uses_pic_offset_table
+ if (DEFAULT_ABI == ABI_DARWIN
+ && flag_pic && current_function_uses_pic_offset_table
&& !cfun->machine->ra_needs_full_frame)
{
rtx insn;
@@ -15815,7 +15824,7 @@ recompute_PIC_register_use (void)
return 0;
}
/* APPLE LOCAL end recompute PIC register use */
-
+
/* APPLE LOCAL begin volatile pic base reg in leaves */
/* If this is a leaf function and we used any pic-based references,
see if there is an unused volatile reg we can use instead of R31.
@@ -15859,7 +15868,7 @@ try_leaf_pic_optimization (void)
{
if ( DEFAULT_ABI==ABI_DARWIN
&& flag_pic && current_function_uses_pic_offset_table
- && current_function_is_leaf
+ && current_function_is_leaf
&& !cfun->machine->ra_needs_full_frame )
{
int reg = alloc_volatile_reg ();
@@ -16013,33 +16022,33 @@ rs6000_emit_prologue (void)
int objc_method_using_pic = 0;
/* APPLE LOCAL begin CW asm block */
- if (cfun->cw_asm_function && cfun->cw_asm_frame_size == -2)
+ if (cfun->iasm_asm_function && cfun->iasm_frame_size == -2)
return;
/* APPLE LOCAL end CW asm block */
/* APPLE LOCAL begin special ObjC method use of R12 */
#if TARGET_MACHO
- if (DEFAULT_ABI == ABI_DARWIN
+ if (DEFAULT_ABI == ABI_DARWIN
&& current_function_uses_pic_offset_table && flag_pic
- && current_function_decl
+ && current_function_decl
&& DECL_ASSEMBLER_NAME_SET_P (current_function_decl))
{
/* At -O0, this will not be set yet, so we won't do this opt. */
- const char *piclabel_name
+ const char *piclabel_name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
-
+
if (name_encodes_objc_method_p (piclabel_name)
/* If we're saving vector or FP regs via a function call,
then don't bother with this ObjC R12 optimization.
This test also eliminates world_save. */
&& (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
|| VECTOR_SAVE_INLINE (info->first_altivec_reg_save))
- && (info->first_fp_reg_save == 64
+ && (info->first_fp_reg_save == 64
|| FP_SAVE_INLINE (info->first_fp_reg_save)))
{
rtx lr = gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM);
rtx src = machopic_function_base_sym ();
- objc_method_using_pic = 1;
- rs6000_maybe_dead (emit_insn (gen_load_macho_picbase_label (lr,
+ objc_method_using_pic = 1;
+ rs6000_maybe_dead (emit_insn (gen_load_macho_picbase_label (lr,
src)));
}
}
@@ -16362,7 +16371,7 @@ rs6000_emit_prologue (void)
#endif
/* If this is the last CALL in the prolog, then we've got our PC.
If we're saving AltiVec regs via a function, we're not last. */
- && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
+ && (info->first_altivec_reg_save > LAST_ALTIVEC_REGNO
|| VECTOR_SAVE_INLINE (info->first_altivec_reg_save)))
gen_following_label = lr_already_set_up_for_pic = 1;
/* APPLE LOCAL end reduce code size */
@@ -16431,7 +16440,7 @@ rs6000_emit_prologue (void)
rtx mem = gen_rtx_MEM (Pmode, addr);
/* This should not be of rs6000_sr_alias_set, because of
__builtin_return_address. */
- RTVEC_ELT (p, count++) = gen_rtx_SET (Pmode, mem,
+ RTVEC_ELT (p, count++) = gen_rtx_SET (Pmode, mem,
gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
}
#endif
@@ -16483,7 +16492,7 @@ rs6000_emit_prologue (void)
/* APPLE LOCAL begin volatile pic base reg in leaves */
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic
&& ((current_function_uses_pic_offset_table
- && cfun->machine->substitute_pic_base_reg
+ && cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM)
|| cfun->machine->ra_needs_full_frame)))))
/* APPLE LOCAL end volatile pic base reg in leaves */
@@ -16574,7 +16583,7 @@ rs6000_emit_prologue (void)
emit_move_insn (gen_rtx_REG (Pmode,
cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM
- ? PIC_OFFSET_TABLE_REGNUM
+ ? PIC_OFFSET_TABLE_REGNUM
: cfun->machine->substitute_pic_base_reg),
gen_rtx_REG (Pmode, 12)));
/* APPLE LOCAL end special ObjC method use of R12 */
@@ -16695,7 +16704,7 @@ rs6000_emit_prologue (void)
/* APPLE LOCAL begin volatile pic base reg in leaves */
insn = emit_move_insn (gen_rtx_REG (Pmode,
- (cfun->machine->substitute_pic_base_reg
+ (cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM)
? RS6000_PIC_OFFSET_TABLE_REGNUM
: cfun->machine->substitute_pic_base_reg),
@@ -16799,9 +16808,9 @@ rs6000_emit_epilogue (int sibcall)
int i;
/* APPLE LOCAL begin CW asm block */
- if (cfun->cw_asm_function && cfun->cw_asm_frame_size == -2)
+ if (cfun->iasm_asm_function && cfun->iasm_frame_size == -2)
{
-
+
rtvec p = rtvec_alloc (2);
RTVEC_ELT (p, 0) = gen_rtx_RETURN (VOIDmode);
@@ -17028,7 +17037,7 @@ rs6000_emit_epilogue (int sibcall)
set_mem_alias_set (mem, rs6000_sr_alias_set);
/* APPLE LOCAL begin use R11 because of ObjC use of R12 in sibcall to CTR */
- emit_move_insn (gen_rtx_REG (SImode,
+ emit_move_insn (gen_rtx_REG (SImode,
DEFAULT_ABI == ABI_DARWIN ? 11 : 12), mem);
/* APPLE LOCAL end use R11 because of ObjC use of R12 in sibcall to CTR */
}
@@ -17107,10 +17116,10 @@ rs6000_emit_epilogue (int sibcall)
/* APPLE LOCAL begin darwin native */
|| (DEFAULT_ABI == ABI_DARWIN && flag_pic
&& ((current_function_uses_pic_offset_table
- && cfun->machine->substitute_pic_base_reg
+ && cfun->machine->substitute_pic_base_reg
== INVALID_REGNUM)
|| cfun->machine->ra_needs_full_frame)))))
-
+
/* APPLE LOCAL end darwin native */
{
rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
@@ -17739,7 +17748,7 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
/* APPLE LOCAL end 4380289 */
/* APPLE LOCAL begin 3910248, 3915171 */
for (insn = get_last_insn ();
- insn && (GET_CODE (insn) != NOTE
+ insn && (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) < 0);
insn = PREV_INSN (insn))
;
@@ -18956,16 +18965,16 @@ rs6000_is_costly_dependence (rtx insn, rtx next, rtx link, int cost,
|| GET_CODE (sto_mem) == SIGN_EXTEND)
load_mem = XEXP (sto_mem, 0);
if (GET_CODE (load_mem) == MEM && GET_CODE (sto_mem) == MEM)
- /* Only consider those true-depenedence cases that memory conflict
- can be determined. Exclude cases, where true-dependency was
- decided because memory conflict could not be determined from
+ /* Only consider those true-depenedence cases that memory conflict
+ can be determined. Exclude cases, where true-dependency was
+ decided because memory conflict could not be determined from
aliasing info. */
return must_true_dependence (load_mem, sto_mem);
}
return true;
}
/* APPLE LOCAL end nop on true-dependence. */
-
+
/* The flag is set to X; dependences with latency >= X are considered costly,
and will not be scheduled in the same group. */
if (rs6000_sched_costly_dep <= max_dep_latency
@@ -19462,7 +19471,8 @@ rs6000_initialize_trampoline (rtx addr, rtx fnaddr, rtx cxt)
/* Under V.4/eabi/darwin, __trampoline_setup does the real work. */
case ABI_DARWIN:
case ABI_V4:
- emit_library_call (gen_rtx_SYMBOL_REF (SImode, "__trampoline_setup"),
+ /* APPLE LOCAL 4505290 */
+ emit_library_call (gen_rtx_SYMBOL_REF (pmode, "__trampoline_setup"),
FALSE, VOIDmode, 4,
addr, pmode,
GEN_INT (rs6000_trampoline_size ()), SImode,
@@ -19483,6 +19493,10 @@ const struct attribute_spec rs6000_attribute_table[] =
{ "altivec", 1, 1, false, true, false, rs6000_handle_altivec_attribute },
{ "longcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
{ "shortcall", 0, 0, false, true, true, rs6000_handle_longcall_attribute },
+ /* APPLE LOCAL begin mainline */
+ { "ms_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute },
+ { "gcc_struct", 0, 0, false, false, false, rs6000_handle_struct_attribute },
+ /* APPLE LOCAL end mainline */
#ifdef SUBTARGET_ATTRIBUTE_TABLE
SUBTARGET_ATTRIBUTE_TABLE,
#endif
@@ -19658,6 +19672,11 @@ rs6000_set_default_type_attributes (tree type)
TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("longcall"),
NULL_TREE,
TYPE_ATTRIBUTES (type));
+ /* APPLE LOCAL begin mainline */
+#if TARGET_MACHO
+ darwin_set_default_type_attributes (type);
+#endif
+ /* APPLE LOCAL end mainline */
}
/* Return a reference suitable for calling a function with the
@@ -19686,6 +19705,55 @@ rs6000_longcall_ref (rtx call_ref)
return force_reg (Pmode, call_ref);
}
+/* APPLE LOCAL begin mainline */
+#ifndef TARGET_USE_MS_BITFIELD_LAYOUT
+#define TARGET_USE_MS_BITFIELD_LAYOUT 0
+#endif
+
+/* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
+ struct attribute_spec.handler. */
+static tree
+rs6000_handle_struct_attribute (tree *node, tree name,
+ tree args ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+{
+ tree *type = NULL;
+ if (DECL_P (*node))
+ {
+ if (TREE_CODE (*node) == TYPE_DECL)
+ type = &TREE_TYPE (*node);
+ }
+ else
+ type = node;
+
+ if (!(type && (TREE_CODE (*type) == RECORD_TYPE
+ || TREE_CODE (*type) == UNION_TYPE)))
+ {
+ warning ("%qs attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ else if ((is_attribute_p ("ms_struct", name)
+ && lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (*type)))
+ || ((is_attribute_p ("gcc_struct", name)
+ && lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (*type)))))
+ {
+ warning ("%qs incompatible attribute ignored", IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
+static bool
+rs6000_ms_bitfield_layout_p (tree record_type)
+{
+ return (TARGET_USE_MS_BITFIELD_LAYOUT &&
+ !lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (record_type)))
+ || lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (record_type));
+}
+
+/* APPLE LOCAL end mainline */
#ifdef USING_ELFOS_H
/* A C statement or statements to switch to the appropriate section
@@ -19995,7 +20063,7 @@ output_call (rtx insn, rtx *operands, int dest_operand_number,
/* APPLE LOCAL begin 3910248, 3915171 */
for (;
- insn && (GET_CODE (insn) != NOTE
+ insn && (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) < 0);
insn = PREV_INSN (insn))
;
@@ -20016,7 +20084,7 @@ output_call (rtx insn, rtx *operands, int dest_operand_number,
away, the linkers (static and dynamic) won't know where
to send us. Ergo, when we're in a coalesced section, we
must always use a stub for all callees. */
-
+
operands[dest_operand_number] = in_text_section ()
? machopic_indirect_call_target (operands[dest_operand_number])
: machopic_force_indirect_call_target (operands[dest_operand_number]);
@@ -20244,14 +20312,14 @@ rs6000_darwin_file_start (void)
unsigned
round_type_align (tree the_struct, unsigned computed, unsigned specified)
{
- if (TREE_CODE (the_struct) == VECTOR_TYPE
+ 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)
@@ -20268,7 +20336,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
{
/* 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
+ should be necessary. Ditto if the struct has the
__packed__ attribute. */
if (TYPE_PACKED (the_struct) || TARGET_ALIGN_MAC68K
|| TARGET_ALIGN_NATURAL || maximum_field_alignment != 0)
@@ -20282,7 +20350,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
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. */
@@ -20294,7 +20362,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned 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
@@ -20337,7 +20405,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
&& TYPE_MODE (field_type) == DImode)
val = MAX (RS6000_LONGLONG_ALIGNMENT, val);
}
-
+
return val;
}
} /* first_field != 0 */
@@ -20347,7 +20415,7 @@ round_type_align (tree the_struct, unsigned computed, unsigned specified)
if (TARGET_ALIGN_MAC68K && ! TYPE_PACKED (the_struct))
{
- if (computed < 16)
+ if (computed < 16)
computed = 16;
}
} /* RECORD_TYPE, etc */
@@ -20686,7 +20754,7 @@ static bool
rs6000_binds_local_p (tree decl)
{
/* APPLE LOCAL begin kext treat vtables as overridable */
- return default_binds_local_p_1 (decl,
+ return default_binds_local_p_1 (decl,
flag_apple_kext && lang_hooks.vtable_p (decl));
}
/* APPLE LOCAL end kext treat vtables as overridable */
@@ -21410,7 +21478,7 @@ rs6000_dbx_register_number (unsigned int regno)
forms. */
const char *
-rs6000_cw_asm_register_name (const char *regname, char *buf)
+rs6000_iasm_register_name (const char *regname, char *buf)
{
/* SP is a valid reg name, but asm doesn't like it yet, so translate. */
if (strcmp (regname, "sp") == 0)
@@ -21441,11 +21509,11 @@ rs6000_cw_asm_register_name (const char *regname, char *buf)
return NULL;
}
-extern bool cw_memory_clobber (const char *);
+extern bool iasm_memory_clobber (const char *);
/* Return true iff the opcode wants memory to be stable. We arrange
for a memory clobber in these instances. */
bool
-cw_memory_clobber (const char *ARG_UNUSED (opcode))
+iasm_memory_clobber (const char *ARG_UNUSED (opcode))
{
return strncmp (opcode, "st", 2) == 0
|| (strncmp (opcode, "l", 1) == 0 && (strcmp (opcode, "la") != 0
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 327fdce693d..50980fc6360 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2559,7 +2559,7 @@ extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */
fprintf (FILE, "\t.align %d\n", (LOG))
/* APPLE LOCAL begin CW asm blocks */
-#define CW_ASM_REGISTER_NAME(STR, BUF) rs6000_cw_asm_register_name (STR, BUF)
+#define IASM_REGISTER_NAME(STR, BUF) rs6000_iasm_register_name (STR, BUF)
/* APPLE LOCAL end CW asm blocks */
/* Pick up the return address upon entry to a procedure. Used for
@@ -3567,8 +3567,8 @@ enum rs6000_builtins
/* APPLE LOCAL begin CW asm blocks */
/* Table of instructions that need extra constraints. */
-#undef TARGET_CW_OP_CONSTRAINT
-#define TARGET_CW_OP_CONSTRAINT \
+#undef TARGET_IASM_OP_CONSTRAINT
+#define TARGET_IASM_OP_CONSTRAINT \
{ "la", 2, "m" }, \
{ "lbz", 2, "m" }, \
{ "lbzu", 2, "m" }, \
@@ -3600,6 +3600,6 @@ enum rs6000_builtins
{ "stw", 2, "m" }, \
{ "stwu", 2, "m" },
-#define CW_FUNCTION_MODIFIER "z"
+#define IASM_FUNCTION_MODIFIER "z"
/* APPLE LOCAL end CW asm blocks */
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 4cf4e4f7b99..0f5d2f2cac0 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -10608,8 +10608,10 @@
;; which indicates how to set cr1
;; APPLE LOCAL begin separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_indirect_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "register_operand" "c,*l,c,*l"))
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_indirect_nonlocal_sysv<mode>"
+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l,c,*l"))
+;; APPLE LOCAL end 4505290
(match_operand 1 "" "g,g,g,g"))
(use (match_operand:SI 2 "immediate_operand" "O,O,n,n"))
(clobber (match_scratch:SI 3 "=l,l,l,l"))]
@@ -10628,8 +10630,10 @@
(set_attr "length" "4,4,8,8")])
;; APPLE LOCAL end separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_nonlocal_sysv<mode>"
+ [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 1 "" "g,g"))
(use (match_operand:SI 2 "immediate_operand" "O,n"))
(clobber (match_scratch:SI 3 "=l,l"))]
@@ -10668,9 +10672,11 @@
(set_attr "length" "4,8")])
;; APPLE LOCAL begin separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_value_indirect_nonlocal_sysv"
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_value_indirect_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "register_operand" "c,*l,c,*l"))
+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l,c,*l"))
+;; APPLE LOCAL end 4505290
(match_operand 2 "" "g,g,g,g")))
(use (match_operand:SI 3 "immediate_operand" "O,O,n,n"))
(clobber (match_scratch:SI 4 "=l,l,l,l"))]
@@ -10689,9 +10695,11 @@
(set_attr "length" "4,4,8,8")])
;; APPLE LOCAL end separate cl into c,*l; switch and attr's expanded to match
-(define_insn "*call_value_nonlocal_sysv"
+;; APPLE LOCAL begin 4505290
+(define_insn "*call_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
+ (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 2 "" "g,g")))
(use (match_operand:SI 3 "immediate_operand" "O,n"))
(clobber (match_scratch:SI 4 "=l,l"))]
@@ -11012,8 +11020,10 @@
[(set_attr "type" "branch")
(set_attr "length" "4")])
-(define_insn "*sibcall_nonlocal_sysv"
- [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL begin 4505290
+(define_insn "*sibcall_nonlocal_sysv<mode>"
+ [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 1 "" ""))
(use (match_operand 2 "immediate_operand" "O,n"))
(use (match_operand:SI 3 "register_operand" "l,l"))
@@ -11057,9 +11067,11 @@
}")
-(define_insn "*sibcall_value_nonlocal_sysv"
+;; APPLE LOCAL begin 4505290
+(define_insn "*sibcall_value_nonlocal_sysv<mode>"
[(set (match_operand 0 "" "")
- (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s,s"))
+ (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s,s"))
+;; APPLE LOCAL end 4505290
(match_operand 2 "" "")))
(use (match_operand:SI 3 "immediate_operand" "O,n"))
(use (match_operand:SI 4 "register_operand" "l,l"))
@@ -14145,7 +14157,7 @@
"direct_return ()"
"*
{
- if (cfun->cw_asm_noreturn)
+ if (cfun->iasm_noreturn)
return \";{br|blr}\";
else
return \"{br|blr}\";
@@ -14826,7 +14838,7 @@
"TARGET_32BIT"
"*
{
- if (cfun->cw_asm_noreturn)
+ if (cfun->iasm_noreturn)
return \"; b%T0\";
else
return \"b%T0\";
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
index 973bb321d05..eac3049e283 100644
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -31,6 +31,9 @@ darwin-fpsave.o: $(srcdir)/config/rs6000/darwin-asm.h
darwin-tramp.o: $(srcdir)/config/rs6000/darwin-asm.h
# APPLE LOCAL begin mainline 2006-03-15 3992198
+# APPLE LOCAL 4505290
+DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongcall
+
# Explain how to build crt2.o
$(T)crt2$(objext): $(srcdir)/config/darwin-crt2.c $(GCC_PASSES) \
$(TCONFIG_H) stmp-int-hdrs tsystem.h
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index bb5c31c84d6..bbb8ab58454 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -18,13 +18,16 @@ darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
gt-darwin.h : s-gtype ; @true
# APPLE LOCAL begin mainline 2006-03-15 3992198
+ # APPLE LOCAL begin 4505290
# How to build crt3.o
EXTRA_MULTILIB_PARTS=crt3.o
$(T)crt3$(objext): $(srcdir)/config/darwin-crt3.c $(GCC_PASSES) \
$(TCONFIG_H) stmp-int-hdrs tsystem.h
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \
+ $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) \
-c $(srcdir)/config/darwin-crt3.c -o $(T)crt3$(objext)
+ # APPLE LOCAL end 4505290
# APPLE LOCAL end mainline 2006-03-15 3992198
# Use unwind-dw2-fde-darwin
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-darwin.c \
diff --git a/gcc/cp/ChangeLog.apple-ppc b/gcc/cp/ChangeLog.apple-ppc
index eb5c0463a17..aa4148e8497 100644
--- a/gcc/cp/ChangeLog.apple-ppc
+++ b/gcc/cp/ChangeLog.apple-ppc
@@ -27,12 +27,6 @@
* parser.c (cp_parser_enumerator_list): Eat CPP_BINCL and CPP_EINCL
tokens.
-2006-04-14 Fariborz Jahanian <fjahanian@apple.com>
-
- Radar 4508851
- * parser.c (cp_parser_objc_interstitial_code): Recognize
- and parse RID_NAMESPACE keyword.
-
2006-04-13 Devang Patel <dpatel@apple.com>
Radar 4503682
@@ -178,6 +172,54 @@
* typeck.c (build_class_member_access_expr): Build the new ivar
reference tree.
+2006-04-26 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4508851
+ * parser.c (cp_parser_objc_interstitial_code): Recognize
+ and parse RID_NAMESPACE keyword.
+
+2006-04-26 Mike Stump <mrs@apple.com>
+
+ Radar 4505741
+ Rename cw_ to iasm_:
+ See ../ChangeLog.apple-ppc for additional changes.
+ * cp-tree.h: Rename ds_cw_asm to ds_iasm_asm.
+ * decl.c: Likewise.
+ Rename cw_asm_p to iasm_p.
+ * parser.c: Likewise.
+ Rename cp_lexer_cw_bol to cp_lexer_iasm_bol.
+ Rename cp_parser_cw_asm_compound_statement to cp_parser_iasm_compound_statement.
+ Rename cp_parser_cw_asm_top_statement to cp_parser_iasm_top_statement.
+ Rename cp_parser_cw_asm_declaration_seq_opt to cp_parser_iasm_declaration_seq_opt.
+ Rename cp_parser_cw_asm_line_seq_opt to cp_parser_iasm_line_seq_opt.
+ Rename cp_parser_cw_asm_line to cp_parser_iasm_line.
+ Rename cp_parser_cw_skip_to_eol to cp_parser_iasm_skip_to_eol.
+ Rename cp_parser_cw_maybe_skip_comments to cp_parser_iasm_maybe_skip_comments.
+ Rename cp_parser_cw_asm_statement_seq_opt to cp_parser_iasm_statement_seq_opt.
+ Rename cw_build_identifier_string to iasm_build_identifier_string.
+ Rename cp_parser_cw_identifier to cp_parser_iasm_identifier.
+ Rename cp_parser_cw_identifier_or_number to cp_parser_iasm_identifier_or_number.
+ Rename cp_parser_cw_asm_maybe_prefix to cp_parser_iasm_maybe_prefix.
+ Rename cp_parser_cw_asm_statement to cp_parser_iasm_statement.
+ Rename cp_parser_cw_skip_to_next_asm to cp_parser_iasm_skip_to_next_asm.
+ Rename cp_parser_cw_asm_operands to cp_parser_iasm_operands.
+ Rename cp_parser_cw_asm_operand to cp_parser_iasm_operand.
+ Rename cp_parser_cw_asm_relative_branch to cp_parser_iasm_relative_branch.
+ Rename cp_parser_cw_asm_postfix_expression to cp_parser_iasm_postfix_expression.
+ * semantics.c: Likewise.
+ Rename cw_asm_cp_build_component_ref to iasm_cp_build_component_ref.
+
+2006-04-17 Devang Patel <dpatel@apple.com>
+
+ Radar 4499790
+ * parser.c (cp_parser_string_literal): Enable pascal strings for
+ wchars.
+
+2006-04-12 Mike Stump <mrs@apple.com>
+
+ Radar 4477426 4466768
+ * parser.c (cw_build_identifier_string): Handle pseudo instructions bettter.
+
2006-03-13 Mike Stump <mrs@apple.com>
Radar 4230099
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index e5324c3b794..4e04aca5820 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3543,7 +3543,7 @@ typedef enum cp_decl_spec {
ds_complex,
ds_thread,
/* APPLE LOCAL CW asm blocks. */
- ds_cw_asm,
+ ds_iasm_asm,
ds_last
} cp_decl_spec;
@@ -4433,7 +4433,7 @@ extern int cp_gimplify_expr (tree *, tree *, tree *);
extern void cp_genericize (tree);
/* APPLE LOCAL begin CW asm blocks */
-extern tree cw_asm_cp_build_component_ref (tree, tree);
+extern tree iasm_cp_build_component_ref (tree, tree);
/* APPLE LOCAL end CW asm blocks */
/* -- end of C++ */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1a1eb72fc34..25176329861 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6648,7 +6648,7 @@ grokdeclarator (const cp_declarator *declarator,
cp_storage_class storage_class;
bool unsigned_p, signed_p, short_p, long_p, thread_p;
/* APPLE LOCAL CW asm blocks */
- bool cw_asm_p;
+ bool iasm_p;
bool type_was_error_mark_node = false;
signed_p = declspecs->specs[(int)ds_signed];
@@ -6657,7 +6657,7 @@ grokdeclarator (const cp_declarator *declarator,
long_p = declspecs->specs[(int)ds_long];
thread_p = declspecs->specs[(int)ds_thread];
/* APPLE LOCAL CW asm blocks */
- cw_asm_p = declspecs->specs[(int)ds_cw_asm];
+ iasm_p = declspecs->specs[(int)ds_iasm_asm];
if (decl_context == FUNCDEF)
funcdef_flag = 1, decl_context = NORMAL;
@@ -8382,14 +8382,14 @@ grokdeclarator (const cp_declarator *declarator,
DECL_THIS_STATIC (decl) = 1;
/* APPLE LOCAL begin CW asm blocks */
- if (cw_asm_p)
+ if (iasm_p)
{
/* Record that this is a decl of a CW-style asm function. */
- if (flag_cw_asm_blocks)
+ if (flag_iasm_blocks)
{
- DECL_CW_ASM_FUNCTION (decl) = 1;
- DECL_CW_ASM_NORETURN (decl) = 0;
- DECL_CW_ASM_FRAME_SIZE (decl) = -2;
+ DECL_IASM_ASM_FUNCTION (decl) = 1;
+ DECL_IASM_NORETURN (decl) = 0;
+ DECL_IASM_FRAME_SIZE (decl) = -2;
}
else
error ("asm functions not enabled, use `-fasm-blocks'");
@@ -10396,10 +10396,10 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
/* If this was a function declared as an assembly function, change
the state to expect to see C++ decls, possibly followed by assembly
code. */
- if (DECL_CW_ASM_FUNCTION (current_function_decl))
+ if (DECL_IASM_ASM_FUNCTION (current_function_decl))
{
- cw_asm_state = cw_asm_decls;
- cw_asm_in_decl = 0;
+ iasm_state = iasm_decls;
+ iasm_in_decl = 0;
current_function_returns_abnormally = 1;
TREE_NO_WARNING (current_function_decl) = 1;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ed28e13e661..fa3ace887ee 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -1935,37 +1935,37 @@ static tree cp_parser_make_typename_type
(cp_parser *, tree, tree);
/* APPLE LOCAL begin CW asm blocks */
-static tree cp_parser_cw_asm_compound_statement
+static tree cp_parser_iasm_compound_statement
(cp_parser *);
-static void cp_parser_cw_asm_declaration_seq_opt
+static void cp_parser_iasm_declaration_seq_opt
(cp_parser *);
-static void cp_parser_cw_asm_line_seq_opt
+static void cp_parser_iasm_line_seq_opt
(cp_parser *);
-static void cp_parser_cw_asm_line
+static void cp_parser_iasm_line
(cp_parser *);
-static void cp_parser_cw_asm_statement_seq_opt
+static void cp_parser_iasm_statement_seq_opt
(cp_parser *);
-static void cp_parser_cw_asm_statement
+static void cp_parser_iasm_statement
(cp_parser *);
-static tree cp_parser_cw_asm_operands
+static tree cp_parser_iasm_operands
(cp_parser *);
-static tree cp_parser_cw_asm_operand
+static tree cp_parser_iasm_operand
(cp_parser *);
-static tree cp_parser_cw_asm_postfix_expression
+static tree cp_parser_iasm_postfix_expression
(cp_parser *, bool);
-static tree cp_parser_cw_identifier_or_number
+static tree cp_parser_iasm_identifier_or_number
(cp_parser* parser);
-static tree cw_build_identifier_string
+static tree iasm_build_identifier_string
(cp_parser* parser, const char* str);
-static tree cp_parser_cw_asm_relative_branch
+static tree cp_parser_iasm_relative_branch
+ (cp_parser *parser);
+static tree cp_parser_iasm_top_statement
+ (cp_parser *parser);
+static void cp_parser_iasm_maybe_skip_comments
(cp_parser *parser);
-static tree
-cp_parser_cw_asm_top_statement (cp_parser *parser);
-static void
-cp_parser_cw_maybe_skip_comments (cp_parser *parser);
-#ifndef CW_SEE_OPCODE
-#define CW_SEE_OPCODE(YYCHAR, T) YYCHAR
+#ifndef IASM_SEE_OPCODE
+#define IASM_SEE_OPCODE(YYCHAR, T) YYCHAR
#endif
#define TYPESPEC 1
#define IDENTIFIER 2
@@ -2839,9 +2839,13 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
if (tok->type == CPP_WSTRING)
wide = true;
/* APPLE LOCAL begin pascal strings */
- else if (CPP_OPTION (parse_in, pascal_strings)
- && str.text[1] == '\\' && str.text[2] == 'p')
- pascal_p = true;
+ if (CPP_OPTION (parse_in, pascal_strings))
+ {
+ if (wide && str.text[0] == 'L' && str.text[2] == '\\' && str.text[3] == 'p')
+ pascal_p = true;
+ else if (str.text[1] == '\\' && str.text[2] == 'p')
+ pascal_p = true;
+ }
/* APPLE LOCAL end pascal strings */
strs = &str;
@@ -2860,9 +2864,13 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
if (tok->type == CPP_WSTRING)
wide = true;
/* APPLE LOCAL begin pascal strings */
- else if (count == 1 && CPP_OPTION (parse_in, pascal_strings)
- && str.text[1] == '\\' && str.text[2] == 'p')
- pascal_p = true;
+ if (CPP_OPTION (parse_in, pascal_strings) && count == 1)
+ {
+ if (wide && str.text[0] == 'L' && str.text[2] == '\\' && str.text[3] == 'p')
+ pascal_p = true;
+ else if (str.text[1] == '\\' && str.text[2] == 'p')
+ pascal_p = true;
+ }
/* APPLE LOCAL end pascal strings */
obstack_grow (&str_ob, &str, sizeof (cpp_string));
@@ -2880,11 +2888,6 @@ cp_parser_string_literal (cp_parser *parser, bool translate, bool wide_ok)
wide = false;
}
- /* APPLE LOCAL begin pascal strings */
- if (wide)
- pascal_p = false;
- /* APPLE LOCAL end pascal strings */
-
if ((translate ? cpp_interpret_string : cpp_interpret_string_notranslate)
/* APPLE LOCAL pascal strings */
(parse_in, strs, count, &istr, wide, pascal_p))
@@ -3359,15 +3362,15 @@ cp_parser_primary_expression (cp_parser *parser,
/* Anything else is an error. */
default:
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
if (token->type == CPP_OPEN_SQUARE)
{
tree expr;
cp_lexer_consume_token (parser->lexer);
- expr = cp_parser_cw_asm_operand (parser);
+ expr = cp_parser_iasm_operand (parser);
cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
- return cw_build_bracket (expr, NULL_TREE);
+ return iasm_build_bracket (expr, NULL_TREE);
}
}
/* APPLE LOCAL end CW asm blocks */
@@ -3739,7 +3742,7 @@ cp_parser_unqualified_id (cp_parser* parser,
/* APPLE LOCAL begin CW asm blocks C++ */
case CPP_NUMBER:
{
- if (flag_cw_asm_blocks && inside_cw_asm_block
+ if (flag_iasm_blocks && inside_iasm_block
&& TREE_CODE (token->value) == INTEGER_CST)
{
char buf[60];
@@ -5115,7 +5118,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p)
{
/* APPLE LOCAL begin CW asm blocks */
case RID_SIZEOF:
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
break;
case RID_ALIGNOF:
@@ -5206,7 +5209,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p)
relative branch syntax. This is to allow "b *+8" which
is disallwed by darwin's assembler but nevertheless is needed to
be compatible with CW tools. */
- if (inside_cw_asm_block && unary_operator == INDIRECT_REF)
+ if (inside_iasm_block && unary_operator == INDIRECT_REF)
{
cp_token *token = cp_lexer_peek_nth_token (parser->lexer, 2);
if (token->type == CPP_PLUS || token->type == CPP_MINUS)
@@ -5261,7 +5264,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p)
/* Fall through. */
case BIT_NOT_EXPR:
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block
+ if (inside_iasm_block
&& unary_operator == ADDR_EXPR
&& TREE_CODE (cast_expression) == LABEL_DECL)
{
@@ -5281,7 +5284,7 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p)
case NEGATE_EXPR:
case TRUTH_NOT_EXPR:
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block && TREE_TYPE (cast_expression) == 0)
+ if (inside_iasm_block && TREE_TYPE (cast_expression) == 0)
{
expression = build1 (unary_operator, NULL_TREE, cast_expression);
break;
@@ -5306,8 +5309,8 @@ cp_parser_unary_expression (cp_parser *parser, bool address_p, bool cast_p)
/* Postfix expressions in CW asm are more restricted and handled
quite differently, so diverge from the usual expression
precedence sequence here. */
- if (inside_cw_asm_block)
- return cp_parser_cw_asm_postfix_expression (parser, address_p);
+ if (inside_iasm_block)
+ return cp_parser_iasm_postfix_expression (parser, address_p);
/* APPLE LOCAL end CW asm blocks */
return cp_parser_postfix_expression (parser, address_p, cast_p);
@@ -5341,7 +5344,7 @@ cp_parser_unary_operator (cp_token* token)
/* APPLE LOCAL begin CW asm blocks */
case CPP_NAME:
- if (cw_asm_state >= cw_asm_decls
+ if (iasm_state >= iasm_decls
&& flag_ms_asms
&& strcasecmp (IDENTIFIER_POINTER (token->value), "offset") == 0)
return ADDR_EXPR;
@@ -5926,7 +5929,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p)
new_prec = TOKEN_PRECEDENCE (token);
/* APPLE LOCAL begin CW asm blocks */
- if (flag_cw_asm_blocks && inside_cw_asm_block)
+ if (flag_iasm_blocks && inside_iasm_block)
{
if ((token->flags & BOL) != 0)
new_prec = PREC_NOT_OPERATOR;
@@ -5965,7 +5968,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p)
lookahead_prec = TOKEN_PRECEDENCE (token);
/* APPLE LOCAL begin CW asm blocks */
- if (flag_cw_asm_blocks && inside_cw_asm_block)
+ if (flag_iasm_blocks && inside_iasm_block)
{
if ((token->flags & BOL) != 0)
lookahead_prec = PREC_NOT_OPERATOR;
@@ -6003,14 +6006,14 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p)
}
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block && TREE_CODE (rhs) == COMPOUND_EXPR)
+ if (inside_iasm_block && TREE_CODE (rhs) == COMPOUND_EXPR)
{
gcc_assert (TREE_CODE (TREE_OPERAND (rhs, 1)) == IDENTIFIER_NODE);
lhs = build_x_binary_op (tree_type, lhs, TREE_OPERAND (rhs, 0), &overloaded_p);
- lhs = cw_asm_build_register_offset (lhs, TREE_OPERAND (rhs, 1));
+ lhs = iasm_build_register_offset (lhs, TREE_OPERAND (rhs, 1));
return lhs;
}
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
if (TREE_CODE (rhs) == IDENTIFIER_NODE
|| TREE_CODE (lhs) == IDENTIFIER_NODE
@@ -6714,23 +6717,23 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
/* APPLE LOCAL begin CW asm blocks */
/* Maybe this is the body of an asm function, which has asm lines
following the decls. */
- if (cw_asm_state >= cw_asm_decls)
+ if (iasm_state >= iasm_decls)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
- cw_asm_in_decl = 1;
- if (token->value && CW_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER)
+ iasm_in_decl = 1;
+ if (token->value && IASM_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER)
{
token->keyword = RID_MAX;
token->type = CPP_NAME;
}
- cp_parser_cw_asm_declaration_seq_opt (parser);
- cw_asm_in_decl = 0;
- cw_asm_state = cw_asm_asm;
- inside_cw_asm_block = 1;
- clear_cw_asm_labels ();
- cp_parser_cw_asm_line_seq_opt (parser);
- cw_asm_state = cw_asm_none;
- inside_cw_asm_block = 0;
+ cp_parser_iasm_declaration_seq_opt (parser);
+ iasm_in_decl = 0;
+ iasm_state = iasm_asm;
+ inside_iasm_block = 1;
+ iasm_clear_labels ();
+ cp_parser_iasm_line_seq_opt (parser);
+ iasm_state = iasm_none;
+ inside_iasm_block = 0;
}
else
/* APPLE LOCAL end CW asm blocks */
@@ -6746,7 +6749,7 @@ cp_parser_compound_statement (cp_parser *parser, tree in_statement_expr,
/* APPLE LOCAL begin CW asm blocks */
static bool
-cp_lexer_cw_bol (cp_lexer* lexer)
+cp_lexer_iasm_bol (cp_lexer* lexer)
{
cp_token *token = cp_lexer_peek_token (lexer);
@@ -6783,9 +6786,9 @@ cp_parser_statement_seq_opt (cp_parser* parser, tree in_statement_expr)
cp_parser_statement (parser, in_statement_expr);
/* APPLE LOCAL begin CW asm blocks */
- if (flag_cw_asm_blocks
- && cw_asm_state >= cw_asm_decls
- && (cp_lexer_cw_bol (parser->lexer)
+ if (flag_iasm_blocks
+ && iasm_state >= iasm_decls
+ && (cp_lexer_iasm_bol (parser->lexer)
|| cp_lexer_next_token_is (parser->lexer, CPP_NAME)))
break;
/* APPLE LOCAL end CW asm blocks */
@@ -7630,7 +7633,7 @@ cp_parser_simple_declaration (cp_parser* parser,
/* APPLE LOCAL begin CW asm blocks */
/* We might have seen an asm opcode, and it's time to switch to
asm instruction handling. */
- if (flag_cw_asm_blocks && cw_asm_state >= cw_asm_decls)
+ if (flag_iasm_blocks && iasm_state >= iasm_decls)
return;
/* APPLE LOCAL end CW asm blocks */
@@ -7755,8 +7758,8 @@ cp_parser_simple_declaration (cp_parser* parser,
/* APPLE LOCAL end C* language */
/* APPLE LOCAL begin CW asm blocks */
- if (flag_cw_asm_blocks)
- cw_asm_in_decl = 0;
+ if (flag_iasm_blocks)
+ iasm_in_decl = 0;
/* APPLE LOCAL end CW asm blocks */
done:
@@ -7919,7 +7922,7 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
case RID_ASM:
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
- ++decl_specs->specs[(int) ds_cw_asm];
+ ++decl_specs->specs[(int) ds_iasm_asm];
break;
/* APPLE LOCAL end CW asm blocks */
@@ -11104,12 +11107,12 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED)
cp_token *nextup;
/* Detect when a leading `asm' is actually a spec of an asm function
rather than an asm statement or block. */
- if (flag_cw_asm_blocks)
+ if (flag_iasm_blocks)
{
nextup = cp_lexer_peek_nth_token (parser->lexer, 2);
if (statement_p
&& nextup->value
- && CW_SEE_OPCODE (TYPESPEC, nextup->value) == IDENTIFIER)
+ && IASM_SEE_OPCODE (TYPESPEC, nextup->value) == IDENTIFIER)
{
nextup->keyword = RID_MAX;
nextup->type = CPP_NAME;
@@ -11123,7 +11126,7 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED)
|| (nextup->type == CPP_DOT)
|| (nextup->type == CPP_SEMICOLON)
|| (nextup->type == CPP_NAME
- && !cw_asm_typename_or_reserved (nextup->value))))
+ && !iasm_typename_or_reserved (nextup->value))))
{
/* An asm function - we'll treat the `asm' as if it were a
storage class spec, which will eventually affect function
@@ -11149,8 +11152,8 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED)
/* A CW-style asm block is introduced by an open brace. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
{
- if (flag_cw_asm_blocks)
- cp_parser_cw_asm_compound_statement (parser);
+ if (flag_iasm_blocks)
+ cp_parser_iasm_compound_statement (parser);
else
error ("asm blocks not enabled, use `-fasm-blocks'");
return;
@@ -11161,8 +11164,8 @@ cp_parser_asm_definition (cp_parser* parser, bool statement_p ATTRIBUTE_UNUSED)
|| cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM)
|| cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
{
- if (flag_cw_asm_blocks)
- cp_parser_cw_asm_top_statement (parser);
+ if (flag_iasm_blocks)
+ cp_parser_iasm_top_statement (parser);
else
error ("asm blocks not enabled, use `-fasm-blocks'");
return;
@@ -16967,63 +16970,63 @@ cp_parser_allow_gnu_extensions_p (cp_parser* parser)
/* This is the section of CW-asm-specific parsing functions. */
static tree
-cp_parser_cw_asm_compound_statement (cp_parser *parser)
+cp_parser_iasm_compound_statement (cp_parser *parser)
{
tree compound_stmt;
- cw_asm_state = cw_asm_asm;
- inside_cw_asm_block = 1;
- cw_asm_at_bol = 1;
- clear_cw_asm_labels ();
+ iasm_state = iasm_asm;
+ inside_iasm_block = 1;
+ iasm_at_bol = 1;
+ iasm_clear_labels ();
if (!cp_parser_require (parser, CPP_OPEN_BRACE, "`{'"))
return error_mark_node;
/* Begin the compound-statement. */
compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
/* Parse an (optional) statement-seq. */
- cp_parser_cw_asm_line_seq_opt (parser);
+ cp_parser_iasm_line_seq_opt (parser);
/* Finish the compound-statement. */
finish_compound_stmt (compound_stmt);
/* Consume the `}'. */
cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'");
/* We're done with the block of asm. */
- cw_asm_at_bol = 0;
- inside_cw_asm_block = 0;
- cw_asm_state = cw_asm_none;
+ iasm_at_bol = 0;
+ inside_iasm_block = 0;
+ iasm_state = iasm_none;
return compound_stmt;
}
static tree
-cp_parser_cw_asm_top_statement (cp_parser *parser)
+cp_parser_iasm_top_statement (cp_parser *parser)
{
tree compound_stmt;
- cw_asm_state = cw_asm_asm;
- inside_cw_asm_block = 1;
- cw_asm_at_bol = 1;
- clear_cw_asm_labels ();
+ iasm_state = iasm_asm;
+ inside_iasm_block = 1;
+ iasm_at_bol = 1;
+ iasm_clear_labels ();
/* Begin the compound-statement. */
compound_stmt = begin_compound_stmt (/*has_no_scope=*/false);
- if (!cp_lexer_cw_bol (parser->lexer))
+ if (!cp_lexer_iasm_bol (parser->lexer))
{
/* Parse a line. */
- cp_parser_cw_asm_line (parser);
+ cp_parser_iasm_line (parser);
}
/* Finish the compound-statement. */
finish_compound_stmt (compound_stmt);
/* We're done with the block of asm. */
- cw_asm_at_bol = 0;
- inside_cw_asm_block = 0;
- cw_asm_state = cw_asm_none;
+ iasm_at_bol = 0;
+ inside_iasm_block = 0;
+ iasm_state = iasm_none;
return compound_stmt;
}
static void
-cp_parser_cw_asm_declaration_seq_opt (cp_parser* parser)
+cp_parser_iasm_declaration_seq_opt (cp_parser* parser)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
if (token->type == CPP_NAME
- && !cw_asm_typename_or_reserved (token->value))
+ && !iasm_typename_or_reserved (token->value))
return;
/* Scan declarations until there aren't any more. */
@@ -17044,8 +17047,8 @@ cp_parser_cw_asm_declaration_seq_opt (cp_parser* parser)
|| token->type == CPP_EINCL)
cp_lexer_handle_pragma_etc (parser->lexer);
- if (cw_asm_state >= cw_asm_decls
- && (cp_lexer_cw_bol (parser->lexer)
+ if (iasm_state >= iasm_decls
+ && (cp_lexer_iasm_bol (parser->lexer)
|| cp_lexer_next_token_is (parser->lexer, CPP_NAME)))
break;
}
@@ -17058,7 +17061,7 @@ cp_parser_cw_asm_declaration_seq_opt (cp_parser* parser)
line-seq [opt] line */
static void
-cp_parser_cw_asm_line_seq_opt (cp_parser* parser)
+cp_parser_iasm_line_seq_opt (cp_parser* parser)
{
/* Scan lines of asm until there aren't any more. */
while (true)
@@ -17069,20 +17072,20 @@ cp_parser_cw_asm_line_seq_opt (cp_parser* parser)
break;
/* Parse the line. */
- cp_parser_cw_asm_line (parser);
+ cp_parser_iasm_line (parser);
}
}
static void
-cp_parser_cw_asm_line (cp_parser* parser)
+cp_parser_iasm_line (cp_parser* parser)
{
- cp_parser_cw_asm_statement_seq_opt (parser);
+ cp_parser_iasm_statement_seq_opt (parser);
}
/* Skip tokens until the end of line is seen. */
static void
-cp_parser_cw_skip_to_eol (cp_parser *parser)
+cp_parser_iasm_skip_to_eol (cp_parser *parser)
{
while (true)
{
@@ -17094,7 +17097,7 @@ cp_parser_cw_skip_to_eol (cp_parser *parser)
if (token->type == CPP_EOF)
break;
/* If the next token starts a new line, stop. */
- if (cp_lexer_cw_bol (parser->lexer))
+ if (cp_lexer_iasm_bol (parser->lexer))
break;
/* Otherwise, consume the token. */
cp_lexer_consume_token (parser->lexer);
@@ -17102,14 +17105,14 @@ cp_parser_cw_skip_to_eol (cp_parser *parser)
}
static void
-cp_parser_cw_maybe_skip_comments (cp_parser *parser)
+cp_parser_iasm_maybe_skip_comments (cp_parser *parser)
{
if (flag_ms_asms
&& cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
{
/* Eat the ';', then skip rest of characters on this line. */
cp_lexer_consume_token (parser->lexer);
- cp_parser_cw_skip_to_eol (parser);
+ cp_parser_iasm_skip_to_eol (parser);
}
}
@@ -17117,7 +17120,7 @@ cp_parser_cw_maybe_skip_comments (cp_parser *parser)
the line. */
static void
-cp_parser_cw_asm_statement_seq_opt (cp_parser* parser)
+cp_parser_iasm_statement_seq_opt (cp_parser* parser)
{
int check;
/* Scan statements until there aren't any more. */
@@ -17130,7 +17133,7 @@ cp_parser_cw_asm_statement_seq_opt (cp_parser* parser)
/* ; denotes comments in MS-style asms. */
if (flag_ms_asms)
{
- cp_parser_cw_maybe_skip_comments (parser);
+ cp_parser_iasm_maybe_skip_comments (parser);
return;
}
cp_lexer_consume_token (parser->lexer);
@@ -17142,40 +17145,55 @@ cp_parser_cw_asm_statement_seq_opt (cp_parser* parser)
else
{
/* Parse a single statement. */
- cp_parser_cw_asm_statement (parser);
+ cp_parser_iasm_statement (parser);
check = 1;
}
if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE)
|| cp_lexer_next_token_is (parser->lexer, CPP_EOF)
/* We parse at most, one line. */
- || cp_lexer_cw_bol (parser->lexer))
+ || cp_lexer_iasm_bol (parser->lexer))
return;
if (check
&& !(cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE)
|| cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
|| cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM)
- || cp_lexer_cw_bol (parser->lexer)))
+ || cp_lexer_iasm_bol (parser->lexer)))
{
cp_parser_error (parser, "expected `;' or `}' `asm' or end-of-line");
}
}
- if (!cp_lexer_cw_bol (parser->lexer))
- cp_parser_cw_maybe_skip_comments (parser);
+ if (!cp_lexer_iasm_bol (parser->lexer))
+ cp_parser_iasm_maybe_skip_comments (parser);
}
/* Build an identifier comprising the string passed and the
next token. */
static tree
-cw_build_identifier_string (cp_parser* parser, const char* str)
+iasm_build_identifier_string (cp_parser* parser, const char* str)
{
char *buf;
int len;
tree id;
- id = cp_parser_cw_identifier_or_number (parser);
+ if (strcmp (str, ".") == 0
+ && (cp_lexer_peek_token (parser->lexer)->flags & PREV_WHITE) == 0)
+ {
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_SHORT))
+ {
+ cp_lexer_consume_token (parser->lexer);
+ return get_identifier (".short");
+ }
+ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_LONG))
+ {
+ cp_lexer_consume_token (parser->lexer);
+ return get_identifier (".long");
+ }
+ }
+
+ id = cp_parser_iasm_identifier_or_number (parser);
len = strlen (str);
buf = (char *) alloca (IDENTIFIER_LENGTH (id) + len + 1);
memcpy (buf, str, len);
@@ -17189,7 +17207,7 @@ cw_build_identifier_string (cp_parser* parser, const char* str)
the identifier. */
static tree
-cp_parser_cw_identifier (cp_parser* parser)
+cp_parser_iasm_identifier (cp_parser* parser)
{
cp_token *token;
tree t;
@@ -17226,10 +17244,10 @@ cp_parser_cw_identifier (cp_parser* parser)
{
/* .align */
cp_lexer_consume_token (parser->lexer);
- t = cw_build_identifier_string (parser, ".");
+ t = iasm_build_identifier_string (parser, ".");
}
else if (token->value
- && CW_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER)
+ && IASM_SEE_OPCODE (TYPESPEC, token->value) == IDENTIFIER)
{
cp_lexer_consume_token (parser->lexer);
t = token->value;
@@ -17271,11 +17289,11 @@ cp_parser_cw_identifier (cp_parser* parser)
cp_lexer_consume_token (parser->lexer);
- return cw_get_identifier (t, str);
+ return iasm_get_identifier (t, str);
}
static tree
-cp_parser_cw_identifier_or_number (cp_parser* parser)
+cp_parser_iasm_identifier_or_number (cp_parser* parser)
{
cp_token *token;
@@ -17294,16 +17312,16 @@ cp_parser_cw_identifier_or_number (cp_parser* parser)
}
static tree
-cp_parser_cw_asm_maybe_prefix (cp_parser *parser, tree id)
+cp_parser_iasm_maybe_prefix (cp_parser *parser, tree id)
{
tree prefix_list = NULL_TREE;
- while (cw_is_prefix (id))
+ while (iasm_is_prefix (id))
{
- if (cp_lexer_cw_bol (parser->lexer))
+ if (cp_lexer_iasm_bol (parser->lexer))
break;
prefix_list = tree_cons (NULL_TREE, id, prefix_list);
- id = cp_parser_cw_identifier (parser);
+ id = cp_parser_iasm_identifier (parser);
}
if (prefix_list)
@@ -17312,7 +17330,7 @@ cp_parser_cw_asm_maybe_prefix (cp_parser *parser, tree id)
}
static void
-cp_parser_cw_asm_statement (cp_parser* parser)
+cp_parser_iasm_statement (cp_parser* parser)
{
tree aname, scspec, anothername, operands;
@@ -17334,19 +17352,19 @@ cp_parser_cw_asm_statement (cp_parser* parser)
else if (cp_lexer_next_token_is (parser->lexer, CPP_ATSIGN))
{
cp_lexer_consume_token (parser->lexer);
- aname = cp_parser_cw_identifier_or_number (parser);
+ aname = cp_parser_iasm_identifier_or_number (parser);
/* Optional ':' after a label. */
if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
cp_lexer_consume_token (parser->lexer);
- cw_asm_label (aname, 1);
+ iasm_label (aname, 1);
}
else
{
- aname = cp_parser_cw_identifier (parser);
+ aname = cp_parser_iasm_identifier (parser);
if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
{
cp_lexer_consume_token (parser->lexer);
- cw_asm_label (aname, 0);
+ iasm_label (aname, 0);
}
else
{
@@ -17357,37 +17375,37 @@ cp_parser_cw_asm_statement (cp_parser* parser)
if (scspec)
{
- anothername = cp_parser_cw_asm_operand (parser);
- cw_asm_entry (aname, scspec, anothername);
+ anothername = cp_parser_iasm_operand (parser);
+ iasm_entry (aname, scspec, anothername);
}
else
{
- aname = cp_parser_cw_asm_maybe_prefix (parser, aname);
- cw_asm_in_operands = 1;
- operands = cp_parser_cw_asm_operands (parser);
- cw_asm_stmt (aname, operands, input_line);
+ aname = cp_parser_iasm_maybe_prefix (parser, aname);
+ iasm_in_operands = 1;
+ operands = cp_parser_iasm_operands (parser);
+ iasm_stmt (aname, operands, input_line);
}
- if (cp_lexer_cw_bol (parser->lexer))
+ if (cp_lexer_iasm_bol (parser->lexer))
return;
break;
}
}
- if (cp_lexer_cw_bol (parser->lexer))
+ if (cp_lexer_iasm_bol (parser->lexer))
return;
}
- cp_parser_cw_maybe_skip_comments (parser);
+ cp_parser_iasm_maybe_skip_comments (parser);
}
/* Eat tokens until we get back to something we recognize. */
static void
-cp_parser_cw_skip_to_next_asm (cp_parser *parser)
+cp_parser_iasm_skip_to_next_asm (cp_parser *parser)
{
cp_token *token = cp_lexer_peek_token (parser->lexer);
do
{
- if (cp_lexer_cw_bol (parser->lexer)
+ if (cp_lexer_iasm_bol (parser->lexer)
|| token->type == CPP_SEMICOLON
|| token->type == CPP_CLOSE_BRACE
|| token->type == CPP_EOF
@@ -17399,21 +17417,21 @@ cp_parser_cw_skip_to_next_asm (cp_parser *parser)
}
tree
-cp_parser_cw_asm_operands (cp_parser *parser)
+cp_parser_iasm_operands (cp_parser *parser)
{
tree operands = NULL_TREE, operand;
while (true)
{
/* If we're looking at the end of the line, then we've run out of operands. */
- if (cp_lexer_cw_bol (parser->lexer)
+ if (cp_lexer_iasm_bol (parser->lexer)
|| cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)
|| cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE)
|| cp_lexer_next_token_is (parser->lexer, CPP_EOF)
|| cp_lexer_next_token_is_keyword (parser->lexer, RID_ASM))
break;
- operand = cp_parser_cw_asm_operand (parser);
+ operand = cp_parser_iasm_operand (parser);
if (operand && operand != error_mark_node)
{
@@ -17423,7 +17441,7 @@ cp_parser_cw_asm_operands (cp_parser *parser)
}
else
{
- cp_parser_cw_skip_to_next_asm (parser);
+ cp_parser_iasm_skip_to_next_asm (parser);
return NULL_TREE;
}
}
@@ -17432,7 +17450,7 @@ cp_parser_cw_asm_operands (cp_parser *parser)
}
tree
-cp_parser_cw_asm_operand (cp_parser *parser)
+cp_parser_iasm_operand (cp_parser *parser)
{
tree operand;
@@ -17445,7 +17463,7 @@ cp_parser_cw_asm_operand (cp_parser *parser)
/* Need to handle case of relative branch using: .[+|-]number
syntax */
static tree
-cp_parser_cw_asm_relative_branch (cp_parser *parser)
+cp_parser_iasm_relative_branch (cp_parser *parser)
{
cp_token *token;
token = cp_lexer_peek_nth_token (parser->lexer, 2);
@@ -17456,7 +17474,7 @@ cp_parser_cw_asm_relative_branch (cp_parser *parser)
cp_lexer_consume_token (parser->lexer);
/* consume '-' or '+' */
cp_lexer_consume_token (parser->lexer);
- return cw_build_identifier_string (parser, str);
+ return iasm_build_identifier_string (parser, str);
}
return error_mark_node;
}
@@ -17490,7 +17508,7 @@ cp_parser_cw_asm_relative_branch (cp_parser *parser)
Returns a representation of the expression. */
static tree
-cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
+cp_parser_iasm_postfix_expression (cp_parser *parser, bool address_p)
{
bool for_offsetof = false;
cp_token *token;
@@ -17542,7 +17560,7 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
if (token->type == CPP_DOT || token->type == CPP_MULT)
{
- postfix_expression = cp_parser_cw_asm_relative_branch (parser);
+ postfix_expression = cp_parser_iasm_relative_branch (parser);
if (postfix_expression != error_mark_node)
break;
}
@@ -17656,13 +17674,13 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
/* Look for the closing `]'. */
cp_parser_require (parser, CPP_CLOSE_SQUARE, "`]'");
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
{
if (TREE_CODE (postfix_expression) == BRACKET_EXPR
|| TREE_CODE (index) == IDENTIFIER_NODE
|| TREE_TYPE (index) == NULL_TREE)
{
- postfix_expression = cw_build_bracket (postfix_expression, index);
+ postfix_expression = iasm_build_bracket (postfix_expression, index);
break;
}
}
@@ -17694,7 +17712,7 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
}
postfix_expression =
- cw_asm_build_register_offset (postfix_expression, expr);
+ iasm_build_register_offset (postfix_expression, expr);
cp_parser_require (parser, CPP_CLOSE_PAREN, "`)'");
@@ -17736,8 +17754,8 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
{
/* Consume the `.' or `->' operator. */
cp_lexer_consume_token (parser->lexer);
- postfix_expression = cw_build_bracket (postfix_expression,
- new_token->value);
+ postfix_expression = iasm_build_bracket (postfix_expression,
+ new_token->value);
cp_lexer_consume_token (parser->lexer);
break;
}
@@ -17832,7 +17850,7 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
adjust_result_of_qualified_name_lookup
(name, BINFO_TYPE (BASELINK_BINFO (name)), scope);
postfix_expression
- = cw_asm_cp_build_component_ref (postfix_expression, name);
+ = iasm_cp_build_component_ref (postfix_expression, name);
}
/* Otherwise, try the pseudo-destructor-name production. */
else
@@ -17868,8 +17886,8 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
/* Handle things like: inc dword ptr [eax] */
tree type = postfix_expression;
cp_lexer_consume_token (parser->lexer);
- postfix_expression = cp_parser_cw_asm_postfix_expression (parser, address_p);
- postfix_expression = cw_ptr_conv (type, postfix_expression);
+ postfix_expression = cp_parser_iasm_postfix_expression (parser, address_p);
+ postfix_expression = iasm_ptr_conv (type, postfix_expression);
}
default:
@@ -17883,11 +17901,11 @@ cp_parser_cw_asm_postfix_expression (cp_parser *parser, bool address_p)
}
int
-cw_asm_typename_or_reserved (tree value)
+iasm_typename_or_reserved (tree value)
{
tree type_decl;
- if (CW_SEE_OPCODE (TYPESPEC, value) == IDENTIFIER)
+ if (IASM_SEE_OPCODE (TYPESPEC, value) == IDENTIFIER)
return 0;
if (C_IS_RESERVED_WORD (value))
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index f4c63e6ca3d..9c0c7d17ebb 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2443,8 +2443,8 @@ finish_id_expression (tree id_expression,
{
/* Name lookup failed. */
/* APPLE LOCAL begin CW asm blocks */
- if (inside_cw_asm_block)
- return cw_do_id (id_expression);
+ if (inside_iasm_block)
+ return iasm_do_id (id_expression);
/* APPLE LOCAL end CW asm blocks */
if (scope
@@ -2494,7 +2494,7 @@ finish_id_expression (tree id_expression,
/* APPLE LOCAL begin CW asm blocks */
/* Accept raw type decls, which will be used in offset-getting
expressions like "type.field(r3)". */
- else if (TREE_CODE (decl) == TYPE_DECL && inside_cw_asm_block)
+ else if (TREE_CODE (decl) == TYPE_DECL && inside_iasm_block)
{
*idk = CP_ID_KIND_NONE;
return decl;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 8915c62d0d4..cd7c3665c45 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2768,7 +2768,7 @@ build_x_binary_op (enum tree_code code, tree arg1, tree arg2,
/* APPLE LOCAL begin CW asm blocks */
/* I think this is dead now. */
- if (inside_cw_asm_block)
+ if (inside_iasm_block)
if (TREE_CODE (arg1) == IDENTIFIER_NODE
|| TREE_CODE (arg2) == IDENTIFIER_NODE
|| TREE_TYPE (arg1) == NULL_TREE
@@ -6914,7 +6914,7 @@ non_reference (tree t)
/* APPLE LOCAL begin CW asm blocks */
tree
-cw_asm_cp_build_component_ref (tree datum, tree component)
+iasm_cp_build_component_ref (tree datum, tree component)
{
tree expr = finish_class_member_access_expr (datum, component);
/* If this is not a real component reference, extract the field
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index d74969156d7..576a23fd0c7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2298,8 +2298,8 @@ to be unlocked properly.
@item -fobjc-gc
@opindex fobjc-gc
Enable garbage collection (GC) for Objective-C objects. The resulting binary
-can only be used on Mac OS X 10.5 (Leopard) and later systems, due to additional
-functionality needed in the (NeXT) Objective-C runtime.
+requires additional runtime support which is not present in any released
+version of Mac OS X.
When the @option{-fobjc-gc} switch is specified, the compiler will replace
assignments to instance variables (ivars) and to certain kinds of pointers to
@@ -11822,6 +11822,12 @@ names in the assembly language output using symbolic forms.
@itemx -mno-longcall
@opindex mlongcall
@opindex mno-longcall
+@c APPLE LOCAL begin 4222119
+@item -mlong-branch
+@itemx -mno-long-branch
+@opindex mlong-branch
+@opindex mno-long-branch
+@c APPLE LOCAL end 4222119
Default to making all function calls indirectly, using a register, so
that functions which reside further than 32 megabytes (33,554,432
bytes) from the current location can be called. This setting can be
@@ -11844,9 +11850,12 @@ island''. The ``branch island'' is appended to the body of the
calling function; it computes the full 32-bit address of the callee
and jumps to it.
-On Mach-O (Darwin) systems, this option directs the compiler emit to
-the glue for every direct call, and the Darwin linker decides whether
-to use or discard it.
+@c APPLE LOCAL begin 4222119
+On Mach-O (Darwin) systems, @option{-mlongcall} directs the compiler
+emit to the glue for every direct call, and the Darwin linker decides
+whether to use or discard it. @option{-mlong-branch} is a synonym for
+@option{-mlongcall}.
+@c APPLE LOCAL end 4222119
In the future, we may cause GCC to ignore all longcall specifications
when the linker is known to generate glue.
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index e6f7c7830b6..2bd87e4a65f 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -69,13 +69,20 @@ dw2_asm_output_data (int size, unsigned HOST_WIDE_INT value,
const char *comment, ...)
{
va_list ap;
+ /* APPLE LOCAL mainline 4.2 2006-04-26 4498201 */
+ const char *op = integer_asm_op (size, FALSE);
va_start (ap, comment);
if (size * 8 < HOST_BITS_PER_WIDE_INT)
value &= ~(~(unsigned HOST_WIDE_INT) 0 << (size * 8));
- dw2_assemble_integer (size, GEN_INT (value));
+ /* APPLE LOCAL begin mainline 4.2 2006-04-26 4498201 */
+ if (op)
+ fprintf (asm_out_file, "%s" HOST_WIDE_INT_PRINT_HEX, op, value);
+ else
+ assemble_integer (GEN_INT (value), size, BITS_PER_UNIT, 1);
+ /* APPLE LOCAL end mainline 4.2 2006-04-26 4498201 */
if (flag_debug_asm && comment)
{
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 5193da79dff..6c5951cd6c9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1,3 +1,4 @@
+/* APPLE LOCAL file mainline 4.2 2006-04-26 4498201 */
/* Output Dwarf2 format symbol table information from GCC.
APPLE LOCAL begin mainline 2006-03-16 dwarf 4383509
Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -3216,12 +3217,24 @@ size_of_loc_descr (dw_loc_descr_ref loc)
static unsigned long
size_of_locs (dw_loc_descr_ref loc)
{
+ dw_loc_descr_ref l;
unsigned long size;
- for (size = 0; loc != NULL; loc = loc->dw_loc_next)
+ /* If there are no skip or bra opcodes, don't fill in the dw_loc_addr
+ field, to avoid writing to a PCH file. */
+ for (size = 0, l = loc; l != NULL; l = l->dw_loc_next)
{
- loc->dw_loc_addr = size;
- size += size_of_loc_descr (loc);
+ if (l->dw_loc_opc == DW_OP_skip || l->dw_loc_opc == DW_OP_bra)
+ break;
+ size += size_of_loc_descr (l);
+ }
+ if (! l)
+ return size;
+
+ for (size = 0, l = loc; l != NULL; l = l->dw_loc_next)
+ {
+ l->dw_loc_addr = size;
+ size += size_of_loc_descr (l);
}
return size;
@@ -3649,18 +3662,22 @@ dw_separate_line_info_entry;
typedef struct dw_attr_struct GTY(())
{
enum dwarf_attribute dw_attr;
- dw_attr_ref dw_attr_next;
+ /* remove field dw_attr_next */
dw_val_node dw_attr_val;
}
dw_attr_node;
-/* The Debugging Information Entry (DIE) structure */
+DEF_VEC_GC_O(dw_attr_node);
+
+/* The Debugging Information Entry (DIE) structure. DIEs form a tree.
+ The children of each node form a circular list linked by
+ die_sib. die_child points to the node *before* the "first" child node. */
typedef struct die_struct GTY(())
{
enum dwarf_tag die_tag;
char *die_symbol;
- dw_attr_ref die_attr;
+ VEC(dw_attr_node) * die_attr;
dw_die_ref die_parent;
dw_die_ref die_child;
dw_die_ref die_sib;
@@ -3672,6 +3689,15 @@ typedef struct die_struct GTY(())
}
die_node;
+/* Evaluate 'expr' while 'c' is set to each child of DIE in order. */
+#define FOR_EACH_CHILD(die, c, expr) do { \
+ c = die->die_child; \
+ if (c) do { \
+ c = c->die_sib; \
+ expr; \
+ } while (c != die->die_child); \
+} while (0)
+
/* The pubname structure */
typedef struct pubname_struct GTY(())
@@ -3994,8 +4020,7 @@ static bool is_fortran (void);
static bool is_ada (void);
static void remove_AT (dw_die_ref, enum dwarf_attribute);
static void remove_child_TAG (dw_die_ref, enum dwarf_tag);
-static inline void free_die (dw_die_ref);
-static void remove_children (dw_die_ref);
+/* free_die, remove_children removed */
static void add_child_die (dw_die_ref, dw_die_ref);
static dw_die_ref new_die (enum dwarf_tag, dw_die_ref, tree);
static dw_die_ref lookup_type_die (tree);
@@ -4011,8 +4036,6 @@ static void add_var_loc_to_decl (tree, struct var_loc_node *);
static void print_spaces (FILE *);
static void print_die (dw_die_ref, FILE *);
static void print_dwarf_line_table (FILE *);
-static void reverse_die_lists (dw_die_ref);
-static void reverse_all_dies (dw_die_ref);
static dw_die_ref push_new_compile_unit (dw_die_ref, dw_die_ref);
static dw_die_ref pop_compile_unit (dw_die_ref);
static void loc_checksum (dw_loc_descr_ref, struct md5_ctx *);
@@ -4826,17 +4849,18 @@ decl_class_context (tree decl)
return context;
}
-/* Add an attribute/value pair to a DIE. We build the lists up in reverse
- addition order, and correct that in reverse_all_dies. */
+/* Add an attribute/value pair to a DIE. */
static inline void
add_dwarf_attr (dw_die_ref die, dw_attr_ref attr)
{
- if (die != NULL && attr != NULL)
- {
- attr->dw_attr_next = die->die_attr;
- die->die_attr = attr;
- }
+ /* Maybe this should be an assert? */
+ if (die == NULL)
+ return;
+
+ if (die->die_attr == NULL)
+ die->die_attr = VEC_alloc (dw_attr_node, 1);
+ VEC_safe_push (dw_attr_node, die->die_attr, attr);
}
static inline enum dw_val_class
@@ -4850,13 +4874,12 @@ AT_class (dw_attr_ref a)
static inline void
add_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int flag)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_flag;
- attr->dw_attr_val.v.val_flag = flag;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_flag;
+ attr.dw_attr_val.v.val_flag = flag;
+ add_dwarf_attr (die, &attr);
}
static inline unsigned
@@ -4871,13 +4894,12 @@ AT_flag (dw_attr_ref a)
static inline void
add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, HOST_WIDE_INT int_val)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_const;
- attr->dw_attr_val.v.val_int = int_val;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_const;
+ attr.dw_attr_val.v.val_int = int_val;
+ add_dwarf_attr (die, &attr);
}
static inline HOST_WIDE_INT
@@ -4893,13 +4915,12 @@ static inline void
add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned HOST_WIDE_INT unsigned_val)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_unsigned_const;
- attr->dw_attr_val.v.val_unsigned = unsigned_val;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_unsigned_const;
+ attr.dw_attr_val.v.val_unsigned = unsigned_val;
+ add_dwarf_attr (die, &attr);
}
static inline unsigned HOST_WIDE_INT
@@ -4915,14 +4936,13 @@ static inline void
add_AT_long_long (dw_die_ref die, enum dwarf_attribute attr_kind,
long unsigned int val_hi, long unsigned int val_low)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_long_long;
- attr->dw_attr_val.v.val_long_long.hi = val_hi;
- attr->dw_attr_val.v.val_long_long.low = val_low;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_long_long;
+ attr.dw_attr_val.v.val_long_long.hi = val_hi;
+ attr.dw_attr_val.v.val_long_long.low = val_low;
+ add_dwarf_attr (die, &attr);
}
/* Add a floating point attribute value to a DIE and return it. */
@@ -4931,15 +4951,14 @@ static inline void
add_AT_vec (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned int length, unsigned int elt_size, unsigned char *array)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_vec;
- attr->dw_attr_val.v.val_vec.length = length;
- attr->dw_attr_val.v.val_vec.elt_size = elt_size;
- attr->dw_attr_val.v.val_vec.array = array;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_vec;
+ attr.dw_attr_val.v.val_vec.length = length;
+ attr.dw_attr_val.v.val_vec.elt_size = elt_size;
+ attr.dw_attr_val.v.val_vec.array = array;
+ add_dwarf_attr (die, &attr);
}
/* Hash and equality functions for debug_str_hash. */
@@ -4962,7 +4981,7 @@ debug_str_eq (const void *x1, const void *x2)
static inline void
add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
struct indirect_string_node *node;
void **slot;
@@ -4978,11 +4997,10 @@ add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
node->str = ggc_strdup (str);
node->refcount++;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_str;
- attr->dw_attr_val.v.val_str = node;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_str;
+ attr.dw_attr_val.v.val_str = node;
+ add_dwarf_attr (die, &attr);
}
static inline const char *
@@ -5034,14 +5052,13 @@ AT_string_form (dw_attr_ref a)
static inline void
add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_die)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_die_ref;
- attr->dw_attr_val.v.val_die_ref.die = targ_die;
- attr->dw_attr_val.v.val_die_ref.external = 0;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_die_ref;
+ attr.dw_attr_val.v.val_die_ref.die = targ_die;
+ attr.dw_attr_val.v.val_die_ref.external = 0;
+ add_dwarf_attr (die, &attr);
}
/* Add an AT_specification attribute to a DIE, and also make the back
@@ -5083,13 +5100,12 @@ set_AT_ref_external (dw_attr_ref a, int i)
static inline void
add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int targ_fde)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_fde_ref;
- attr->dw_attr_val.v.val_fde_index = targ_fde;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_fde_ref;
+ attr.dw_attr_val.v.val_fde_index = targ_fde;
+ add_dwarf_attr (die, &attr);
}
/* Add a location description attribute value to a DIE. */
@@ -5097,13 +5113,12 @@ add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int tar
static inline void
add_AT_loc (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_descr_ref loc)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_loc;
- attr->dw_attr_val.v.val_loc = loc;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_loc;
+ attr.dw_attr_val.v.val_loc = loc;
+ add_dwarf_attr (die, &attr);
}
static inline dw_loc_descr_ref
@@ -5116,13 +5131,12 @@ AT_loc (dw_attr_ref a)
static inline void
add_AT_loc_list (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_list_ref loc_list)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_loc_list;
- attr->dw_attr_val.v.val_loc_list = loc_list;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_loc_list;
+ attr.dw_attr_val.v.val_loc_list = loc_list;
+ add_dwarf_attr (die, &attr);
/* APPLE LOCAL mainline 4.2 2006-01-02 4386366 */
have_location_lists = true;
}
@@ -5139,13 +5153,12 @@ AT_loc_list (dw_attr_ref a)
static inline void
add_AT_addr (dw_die_ref die, enum dwarf_attribute attr_kind, rtx addr)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_addr;
- attr->dw_attr_val.v.val_addr = addr;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_addr;
+ attr.dw_attr_val.v.val_addr = addr;
+ add_dwarf_attr (die, &attr);
}
static inline rtx
@@ -5160,13 +5173,12 @@ AT_addr (dw_attr_ref a)
static inline void
add_AT_lbl_id (dw_die_ref die, enum dwarf_attribute attr_kind, const char *lbl_id)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_lbl_id;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_lbl_id;
+ attr.dw_attr_val.v.val_lbl_id = xstrdup (lbl_id);
+ add_dwarf_attr (die, &attr);
}
/* APPLE LOCAL begin mainline 2006-03-16 dwarf 4383509 */
@@ -5177,13 +5189,12 @@ static inline void
add_AT_lineptr (dw_die_ref die, enum dwarf_attribute attr_kind,
const char *label)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_lineptr;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (label);
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_lineptr;
+ attr.dw_attr_val.v.val_lbl_id = xstrdup (label);
+ add_dwarf_attr (die, &attr);
}
/* Add a section offset attribute value to a DIE, an offset into the
@@ -5193,13 +5204,12 @@ static inline void
add_AT_macptr (dw_die_ref die, enum dwarf_attribute attr_kind,
const char *label)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_macptr;
- attr->dw_attr_val.v.val_lbl_id = xstrdup (label);
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_macptr;
+ attr.dw_attr_val.v.val_lbl_id = xstrdup (label);
+ add_dwarf_attr (die, &attr);
}
/* APPLE LOCAL end mainline 2006-03-16 dwarf 4383509 */
@@ -5209,13 +5219,12 @@ static inline void
add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned HOST_WIDE_INT offset)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_offset;
- attr->dw_attr_val.v.val_offset = offset;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_offset;
+ attr.dw_attr_val.v.val_offset = offset;
+ add_dwarf_attr (die, &attr);
}
/* Add an range_list attribute value to a DIE. */
@@ -5224,13 +5233,12 @@ static void
add_AT_range_list (dw_die_ref die, enum dwarf_attribute attr_kind,
long unsigned int offset)
{
- dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_node attr;
- attr->dw_attr_next = NULL;
- attr->dw_attr = attr_kind;
- attr->dw_attr_val.val_class = dw_val_class_range_list;
- attr->dw_attr_val.v.val_offset = offset;
- add_dwarf_attr (die, attr);
+ attr.dw_attr = attr_kind;
+ attr.dw_attr_val.val_class = dw_val_class_range_list;
+ attr.dw_attr_val.v.val_offset = offset;
+ add_dwarf_attr (die, &attr);
}
static inline const char *
@@ -5250,20 +5258,21 @@ static dw_attr_ref
get_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_ref a;
+ unsigned ix;
dw_die_ref spec = NULL;
- if (die != NULL)
- {
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
- if (a->dw_attr == attr_kind)
- return a;
- else if (a->dw_attr == DW_AT_specification
- || a->dw_attr == DW_AT_abstract_origin)
- spec = AT_ref (a);
+ if (! die)
+ return NULL;
- if (spec)
- return get_AT (spec, attr_kind);
- }
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (a->dw_attr == attr_kind)
+ return a;
+ else if (a->dw_attr == DW_AT_specification
+ || a->dw_attr == DW_AT_abstract_origin)
+ spec = AT_ref (a);
+
+ if (spec)
+ return get_AT (spec, attr_kind);
return NULL;
}
@@ -5391,127 +5400,103 @@ is_ada (void)
return lang == DW_LANG_Ada95 || lang == DW_LANG_Ada83;
}
-/* Free up the memory used by A. */
-
-static inline void free_AT (dw_attr_ref);
-static inline void
-free_AT (dw_attr_ref a)
-{
- if (AT_class (a) == dw_val_class_str)
- if (a->dw_attr_val.v.val_str->refcount)
- a->dw_attr_val.v.val_str->refcount--;
-}
+/* Remove free_AT */
/* Remove the specified attribute if present. */
static void
remove_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
{
- dw_attr_ref *p;
- dw_attr_ref removed = NULL;
+ dw_attr_ref a;
+ unsigned ix;
- if (die != NULL)
- {
- for (p = &(die->die_attr); *p; p = &((*p)->dw_attr_next))
- if ((*p)->dw_attr == attr_kind)
- {
- removed = *p;
- *p = (*p)->dw_attr_next;
- break;
- }
+ if (! die)
+ return;
- if (removed != 0)
- free_AT (removed);
- }
-}
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (a->dw_attr == attr_kind)
+ {
+ if (AT_class (a) == dw_val_class_str)
+ if (a->dw_attr_val.v.val_str->refcount)
+ a->dw_attr_val.v.val_str->refcount--;
-/* Remove child die whose die_tag is specified tag. */
+ /* VEC_ordered_remove should help reduce the number of abbrevs
+ that are needed. */
+ VEC_ordered_remove (dw_attr_node, die->die_attr, ix);
+ return;
+ }
+}
+/* Remove CHILD from its parent. PREV must have the property that
+ PREV->DIE_SIB == CHILD. Does not alter CHILD. */
static void
-remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
+remove_child_with_prev (dw_die_ref child, dw_die_ref prev)
{
- dw_die_ref current, prev, next;
- current = die->die_child;
- prev = NULL;
- while (current != NULL)
+ gcc_assert (child->die_parent == prev->die_parent);
+ gcc_assert (prev->die_sib == child);
+ if (prev == child)
{
- if (current->die_tag == tag)
- {
- next = current->die_sib;
- if (prev == NULL)
- die->die_child = next;
- else
- prev->die_sib = next;
- free_die (current);
- current = next;
- }
- else
- {
- prev = current;
- current = current->die_sib;
- }
+ gcc_assert (child->die_parent->die_child == child);
+ prev = NULL;
}
+ else
+ prev->die_sib = child->die_sib;
+ if (child->die_parent->die_child == child)
+ child->die_parent->die_child = prev;
}
-/* Free up the memory used by DIE. */
-
-static inline void
-free_die (dw_die_ref die)
-{
- remove_children (die);
-}
-
-/* Discard the children of this DIE. */
+/* Remove child DIE whose die_tag is TAG. Do nothing if no child
+ matches TAG. */
static void
-remove_children (dw_die_ref die)
+remove_child_TAG (dw_die_ref die, enum dwarf_tag tag)
{
- dw_die_ref child_die = die->die_child;
-
- die->die_child = NULL;
-
- while (child_die != NULL)
- {
- dw_die_ref tmp_die = child_die;
- dw_attr_ref a;
-
- child_die = child_die->die_sib;
-
- for (a = tmp_die->die_attr; a != NULL;)
- {
- dw_attr_ref tmp_a = a;
-
- a = a->dw_attr_next;
- free_AT (tmp_a);
- }
-
- free_die (tmp_die);
- }
+ dw_die_ref c;
+
+ c = die->die_child;
+ if (c) do {
+ dw_die_ref prev = c;
+ c = c->die_sib;
+ while (c->die_tag == tag)
+ {
+ remove_child_with_prev (c, prev);
+ /* Might have removed every child. */
+ if (c == c->die_sib)
+ return;
+ c = c->die_sib;
+ }
+ } while (c != die->die_child);
}
-/* Add a child DIE below its parent. We build the lists up in reverse
- addition order, and correct that in reverse_all_dies. */
+/* Add a CHILD_DIE as the last child of DIE. */
-static inline void
+static void
add_child_die (dw_die_ref die, dw_die_ref child_die)
{
- if (die != NULL && child_die != NULL)
- {
- gcc_assert (die != child_die);
+ /* FIXME this should probably be an assert. */
+ if (! die || ! child_die)
+ return;
+ gcc_assert (die != child_die);
- child_die->die_parent = die;
- child_die->die_sib = die->die_child;
- die->die_child = child_die;
+ child_die->die_parent = die;
+ if (die->die_child)
+ {
+ child_die->die_sib = die->die_child->die_sib;
+ die->die_child->die_sib = child_die;
}
+ else
+ child_die->die_sib = child_die;
+ die->die_child = child_die;
}
/* Move CHILD, which must be a child of PARENT or the DIE for which PARENT
- is the specification, to the front of PARENT's list of children. */
+ is the specification, to the end of PARENT's list of children.
+ This is done by removing and re-adding it. */
static void
splice_child_die (dw_die_ref parent, dw_die_ref child)
{
- dw_die_ref *p;
+ dw_die_ref p;
/* We want the declaration DIE from inside the class, not the
specification DIE at toplevel. */
@@ -5526,17 +5511,15 @@ splice_child_die (dw_die_ref parent, dw_die_ref child)
gcc_assert (child->die_parent == parent
|| (child->die_parent
== get_AT_ref (parent, DW_AT_specification)));
-
- for (p = &(child->die_parent->die_child); *p; p = &((*p)->die_sib))
- if (*p == child)
+
+ for (p = child->die_parent->die_child; ; p = p->die_sib)
+ if (p->die_sib == child)
{
- *p = child->die_sib;
+ remove_child_with_prev (child, p);
break;
}
- child->die_parent = parent;
- child->die_sib = parent->die_child;
- parent->die_child = child;
+ add_child_die (parent, child);
}
/* Return a pointer to a newly created DIE node. */
@@ -5702,6 +5685,7 @@ print_die (dw_die_ref die, FILE *outfile)
{
dw_attr_ref a;
dw_die_ref c;
+ unsigned ix;
print_spaces (outfile);
fprintf (outfile, "DIE %4lu: %s\n",
@@ -5710,7 +5694,7 @@ print_die (dw_die_ref die, FILE *outfile)
fprintf (outfile, " abbrev id: %lu", die->die_abbrev);
fprintf (outfile, " offset: %lu\n", die->die_offset);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
{
print_spaces (outfile);
fprintf (outfile, " %s: ", dwarf_attr_name (a->dw_attr));
@@ -5784,9 +5768,7 @@ print_die (dw_die_ref die, FILE *outfile)
if (die->die_child != NULL)
{
print_indent += 4;
- for (c = die->die_child; c != NULL; c = c->die_sib)
- print_die (c, outfile);
-
+ FOR_EACH_CHILD (die, c, print_die (c, outfile));
print_indent -= 4;
}
if (print_indent == 0)
@@ -5836,52 +5818,6 @@ debug_dwarf (void)
print_dwarf_line_table (stderr);
}
-/* We build up the lists of children and attributes by pushing new ones
- onto the beginning of the list. Reverse the lists for DIE so that
- they are in order of addition. */
-
-static void
-reverse_die_lists (dw_die_ref die)
-{
- dw_die_ref c, cp, cn;
- dw_attr_ref a, ap, an;
-
- for (a = die->die_attr, ap = 0; a; a = an)
- {
- an = a->dw_attr_next;
- a->dw_attr_next = ap;
- ap = a;
- }
-
- die->die_attr = ap;
-
- for (c = die->die_child, cp = 0; c; c = cn)
- {
- cn = c->die_sib;
- c->die_sib = cp;
- cp = c;
- }
-
- die->die_child = cp;
-}
-
-/* reverse_die_lists only reverses the single die you pass it. Since we used to
- reverse all dies in add_sibling_attributes, which runs through all the dies,
- it would reverse all the dies. Now, however, since we don't call
- reverse_die_lists in add_sibling_attributes, we need a routine to
- recursively reverse all the dies. This is that routine. */
-
-static void
-reverse_all_dies (dw_die_ref die)
-{
- dw_die_ref c;
-
- reverse_die_lists (die);
-
- for (c = die->die_child; c; c = c->die_sib)
- reverse_all_dies (c);
-}
-
/* Start a new compilation unit DIE for an include file. OLD_UNIT is the CU
for the enclosing include file, if any. BINCL_DIE is the DW_TAG_GNU_BINCL
DIE that marks the start of the DIEs for this include file. */
@@ -5997,6 +5933,7 @@ die_checksum (dw_die_ref die, struct md5_ctx *ctx, int *mark)
{
dw_die_ref c;
dw_attr_ref a;
+ unsigned ix;
/* To avoid infinite recursion. */
if (die->die_mark)
@@ -6008,11 +5945,10 @@ die_checksum (dw_die_ref die, struct md5_ctx *ctx, int *mark)
CHECKSUM (die->die_tag);
- for (a = die->die_attr; a; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
attr_checksum (a, ctx, mark);
- for (c = die->die_child; c; c = c->die_sib)
- die_checksum (c, ctx, mark);
+ FOR_EACH_CHILD (die, c, die_checksum (c, ctx, mark));
}
#undef CHECKSUM
@@ -6118,7 +6054,8 @@ static int
same_die_p (dw_die_ref die1, dw_die_ref die2, int *mark)
{
dw_die_ref c1, c2;
- dw_attr_ref a1, a2;
+ dw_attr_ref a1;
+ unsigned ix;
/* To avoid infinite recursion. */
if (die1->die_mark)
@@ -6128,21 +6065,36 @@ same_die_p (dw_die_ref die1, dw_die_ref die2, int *mark)
if (die1->die_tag != die2->die_tag)
return 0;
- for (a1 = die1->die_attr, a2 = die2->die_attr;
- a1 && a2;
- a1 = a1->dw_attr_next, a2 = a2->dw_attr_next)
- if (!same_attr_p (a1, a2, mark))
- return 0;
- if (a1 || a2)
+ if (VEC_length (dw_attr_node, die1->die_attr)
+ != VEC_length (dw_attr_node, die2->die_attr))
return 0;
-
- for (c1 = die1->die_child, c2 = die2->die_child;
- c1 && c2;
- c1 = c1->die_sib, c2 = c2->die_sib)
- if (!same_die_p (c1, c2, mark))
+
+ for (ix = 0; VEC_iterate (dw_attr_node, die1->die_attr, ix, a1); ix++)
+ if (!same_attr_p (a1, VEC_index (dw_attr_node, die2->die_attr, ix), mark))
return 0;
- if (c1 || c2)
- return 0;
+
+ c1 = die1->die_child;
+ c2 = die2->die_child;
+ if (! c1)
+ {
+ if (c2)
+ return 0;
+ }
+ else
+ for (;;)
+ {
+ if (!same_die_p (c1, c2, mark))
+ return 0;
+ c1 = c1->die_sib;
+ c2 = c2->die_sib;
+ if (c1 == die1->die_child)
+ {
+ if (c2 == die2->die_child)
+ break;
+ else
+ return 0;
+ }
+ }
return 1;
}
@@ -6306,8 +6258,7 @@ assign_symbol_names (dw_die_ref die)
die->die_symbol = gen_internal_sym ("LDIE");
}
- for (c = die->die_child; c != NULL; c = c->die_sib)
- assign_symbol_names (c);
+ FOR_EACH_CHILD (die, c, assign_symbol_names (c));
}
struct cu_hash_table_entry
@@ -6405,41 +6356,34 @@ record_comdat_symbol_number (dw_die_ref cu, htab_t htable, unsigned int sym_num)
static void
break_out_includes (dw_die_ref die)
{
- dw_die_ref *ptr;
+ dw_die_ref c;
dw_die_ref unit = NULL;
limbo_die_node *node, **pnode;
htab_t cu_hash_table;
- for (ptr = &(die->die_child); *ptr;)
- {
- dw_die_ref c = *ptr;
-
- if (c->die_tag == DW_TAG_GNU_BINCL || c->die_tag == DW_TAG_GNU_EINCL
- || (unit && is_comdat_die (c)))
- {
- /* This DIE is for a secondary CU; remove it from the main one. */
- *ptr = c->die_sib;
-
- if (c->die_tag == DW_TAG_GNU_BINCL)
- {
- unit = push_new_compile_unit (unit, c);
- free_die (c);
- }
- else if (c->die_tag == DW_TAG_GNU_EINCL)
- {
- unit = pop_compile_unit (unit);
- free_die (c);
- }
- else
- add_child_die (unit, c);
- }
- else
- {
- /* Leave this DIE in the main CU. */
- ptr = &(c->die_sib);
- continue;
- }
- }
+ c = die->die_child;
+ if (c) do {
+ dw_die_ref prev = c;
+ c = c->die_sib;
+ while (c->die_tag == DW_TAG_GNU_BINCL || c->die_tag == DW_TAG_GNU_EINCL
+ || (unit && is_comdat_die (c)))
+ {
+ dw_die_ref next = c->die_sib;
+
+ /* This DIE is for a secondary CU; remove it from the main one. */
+ remove_child_with_prev (c, prev);
+
+ if (c->die_tag == DW_TAG_GNU_BINCL)
+ unit = push_new_compile_unit (unit, c);
+ else if (c->die_tag == DW_TAG_GNU_EINCL)
+ unit = pop_compile_unit (unit);
+ else
+ add_child_die (unit, c);
+ c = next;
+ if (c == die->die_child)
+ break;
+ }
+ } while (c != die->die_child);
#if 0
/* We can only use this in debugging, since the frontend doesn't check
@@ -6480,13 +6424,13 @@ add_sibling_attributes (dw_die_ref die)
{
dw_die_ref c;
- if (die->die_tag != DW_TAG_compile_unit
- && die->die_sib && die->die_child != NULL)
- /* Add the sibling link to the front of the attribute list. */
+ if (! die->die_child)
+ return;
+
+ if (die->die_parent && die != die->die_parent->die_child)
add_AT_die_ref (die, DW_AT_sibling, die->die_sib);
- for (c = die->die_child; c != NULL; c = c->die_sib)
- add_sibling_attributes (c);
+ FOR_EACH_CHILD (die, c, add_sibling_attributes (c));
}
/* Output all location lists for the DIE and its children. */
@@ -6495,15 +6439,14 @@ static void
output_location_lists (dw_die_ref die)
{
dw_die_ref c;
- dw_attr_ref d_attr;
-
- for (d_attr = die->die_attr; d_attr; d_attr = d_attr->dw_attr_next)
- if (AT_class (d_attr) == dw_val_class_loc_list)
- output_loc_list (AT_loc_list (d_attr));
+ dw_attr_ref a;
+ unsigned ix;
- for (c = die->die_child; c != NULL; c = c->die_sib)
- output_location_lists (c);
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (AT_class (a) == dw_val_class_loc_list)
+ output_loc_list (AT_loc_list (a));
+ FOR_EACH_CHILD (die, c, output_location_lists (c));
}
/* The format of each DIE (and its attribute value pairs) is encoded in an
@@ -6517,44 +6460,48 @@ build_abbrev_table (dw_die_ref die)
unsigned long abbrev_id;
unsigned int n_alloc;
dw_die_ref c;
- dw_attr_ref d_attr, a_attr;
+ dw_attr_ref a;
+ unsigned ix;
/* Scan the DIE references, and mark as external any that refer to
DIEs from other CUs (i.e. those which are not marked). */
- for (d_attr = die->die_attr; d_attr; d_attr = d_attr->dw_attr_next)
- if (AT_class (d_attr) == dw_val_class_die_ref
- && AT_ref (d_attr)->die_mark == 0)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (AT_class (a) == dw_val_class_die_ref
+ && AT_ref (a)->die_mark == 0)
{
- gcc_assert (AT_ref (d_attr)->die_symbol);
+ gcc_assert (AT_ref (a)->die_symbol);
- set_AT_ref_external (d_attr, 1);
+ set_AT_ref_external (a, 1);
}
for (abbrev_id = 1; abbrev_id < abbrev_die_table_in_use; ++abbrev_id)
{
dw_die_ref abbrev = abbrev_die_table[abbrev_id];
-
- if (abbrev->die_tag == die->die_tag)
+ dw_attr_ref die_a, abbrev_a;
+ unsigned ix;
+ bool ok = true;
+
+ if (abbrev->die_tag != die->die_tag)
+ continue;
+ if ((abbrev->die_child != NULL) != (die->die_child != NULL))
+ continue;
+
+ if (VEC_length (dw_attr_node, abbrev->die_attr)
+ != VEC_length (dw_attr_node, die->die_attr))
+ continue;
+
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, die_a); ix++)
{
- if ((abbrev->die_child != NULL) == (die->die_child != NULL))
+ abbrev_a = VEC_index (dw_attr_node, abbrev->die_attr, ix);
+ if ((abbrev_a->dw_attr != die_a->dw_attr)
+ || (value_format (abbrev_a) != value_format (die_a)))
{
- a_attr = abbrev->die_attr;
- d_attr = die->die_attr;
-
- while (a_attr != NULL && d_attr != NULL)
- {
- if ((a_attr->dw_attr != d_attr->dw_attr)
- || (value_format (a_attr) != value_format (d_attr)))
- break;
-
- a_attr = a_attr->dw_attr_next;
- d_attr = d_attr->dw_attr_next;
- }
-
- if (a_attr == NULL && d_attr == NULL)
- break;
+ ok = false;
+ break;
}
}
+ if (ok)
+ break;
}
if (abbrev_id >= abbrev_die_table_in_use)
@@ -6575,8 +6522,7 @@ build_abbrev_table (dw_die_ref die)
}
die->die_abbrev = abbrev_id;
- for (c = die->die_child; c != NULL; c = c->die_sib)
- build_abbrev_table (c);
+ FOR_EACH_CHILD (die, c, build_abbrev_table (c));
}
/* Return the power-of-two number of bytes necessary to represent VALUE. */
@@ -6605,9 +6551,10 @@ size_of_die (dw_die_ref die)
{
unsigned long size = 0;
dw_attr_ref a;
+ unsigned ix;
size += size_of_uleb128 (die->die_abbrev);
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
{
switch (AT_class (a))
{
@@ -6693,8 +6640,7 @@ calc_die_sizes (dw_die_ref die)
die->die_offset = next_die_offset;
next_die_offset += size_of_die (die);
- for (c = die->die_child; c != NULL; c = c->die_sib)
- calc_die_sizes (c);
+ FOR_EACH_CHILD (die, c, calc_die_sizes (c));
if (die->die_child != NULL)
/* Count the null byte used to terminate sibling lists. */
@@ -6714,8 +6660,7 @@ mark_dies (dw_die_ref die)
gcc_assert (!die->die_mark);
die->die_mark = 1;
- for (c = die->die_child; c; c = c->die_sib)
- mark_dies (c);
+ FOR_EACH_CHILD (die, c, mark_dies (c));
}
/* Clear the marks for a die and its children. */
@@ -6728,8 +6673,7 @@ unmark_dies (dw_die_ref die)
gcc_assert (die->die_mark);
die->die_mark = 0;
- for (c = die->die_child; c; c = c->die_sib)
- unmark_dies (c);
+ FOR_EACH_CHILD (die, c, unmark_dies (c));
}
/* Clear the marks for a die, its children and referred dies. */
@@ -6739,15 +6683,15 @@ unmark_all_dies (dw_die_ref die)
{
dw_die_ref c;
dw_attr_ref a;
+ unsigned ix;
if (!die->die_mark)
return;
die->die_mark = 0;
- for (c = die->die_child; c; c = c->die_sib)
- unmark_all_dies (c);
+ FOR_EACH_CHILD (die, c, unmark_all_dies (c));
- for (a = die->die_attr; a; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
if (AT_class (a) == dw_val_class_die_ref)
unmark_all_dies (AT_ref (a));
}
@@ -6886,11 +6830,11 @@ output_abbrev_section (void)
{
unsigned long abbrev_id;
- dw_attr_ref a_attr;
-
for (abbrev_id = 1; abbrev_id < abbrev_die_table_in_use; ++abbrev_id)
{
dw_die_ref abbrev = abbrev_die_table[abbrev_id];
+ unsigned ix;
+ dw_attr_ref a_attr;
dw2_asm_output_data_uleb128 (abbrev_id, "(abbrev code)");
dw2_asm_output_data_uleb128 (abbrev->die_tag, "(TAG: %s)",
@@ -6901,8 +6845,8 @@ output_abbrev_section (void)
else
dw2_asm_output_data (1, DW_children_no, "DW_children_no");
- for (a_attr = abbrev->die_attr; a_attr != NULL;
- a_attr = a_attr->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, abbrev->die_attr, ix, a_attr);
+ ix++)
{
dw2_asm_output_data_uleb128 (a_attr->dw_attr, "(%s)",
dwarf_attr_name (a_attr->dw_attr));
@@ -7031,6 +6975,7 @@ output_die (dw_die_ref die)
dw_attr_ref a;
dw_die_ref c;
unsigned long size;
+ unsigned ix;
/* If someone in another CU might refer to us, set up a symbol for
them to point to. */
@@ -7040,7 +6985,7 @@ output_die (dw_die_ref die)
dw2_asm_output_data_uleb128 (die->die_abbrev, "(DIE (0x%lx) %s)",
die->die_offset, dwarf_tag_name (die->die_tag));
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
{
const char *name = dwarf_attr_name (a->dw_attr);
@@ -7217,8 +7162,7 @@ output_die (dw_die_ref die)
}
}
- for (c = die->die_child; c != NULL; c = c->die_sib)
- output_die (c);
+ FOR_EACH_CHILD (die, c, output_die (c));
/* Add null byte to terminate sibling list. */
if (die->die_child != NULL)
@@ -10205,7 +10149,7 @@ containing_function_has_frame_base (tree decl)
{
tree declcontext = decl_function_context (decl);
dw_die_ref context;
- dw_attr_ref attr;
+ /* Delete 'attr' */
if (!declcontext)
return false;
@@ -10214,9 +10158,8 @@ containing_function_has_frame_base (tree decl)
if (!context)
return false;
- for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
- if (attr->dw_attr == DW_AT_frame_base)
- return true;
+ if (get_AT (context, DW_AT_frame_base))
+ return true;
return false;
}
@@ -13694,7 +13637,18 @@ output_indirect_string (void **h, void *v ATTRIBUTE_UNUSED)
return 1;
}
+#if ENABLE_ASSERT_CHECKING
+/* Verify that all marks are clear. */
+static void
+verify_marks_clear (dw_die_ref die)
+{
+ dw_die_ref c;
+
+ gcc_assert (! die->die_mark);
+ FOR_EACH_CHILD (die, c, verify_marks_clear (c));
+}
+#endif /* ENABLE_ASSERT_CHECKING */
/* Clear the marks for a die and its children.
Be cool if the mark isn't set. */
@@ -13703,12 +13657,11 @@ static void
prune_unmark_dies (dw_die_ref die)
{
dw_die_ref c;
- die->die_mark = 0;
- for (c = die->die_child; c; c = c->die_sib)
- prune_unmark_dies (c);
+ if (die->die_mark)
+ die->die_mark = 0;
+ FOR_EACH_CHILD (die, c, prune_unmark_dies (c));
}
-
/* Given DIE that we're marking as used, find any other dies
it references as attributes and mark them as used. */
@@ -13716,8 +13669,9 @@ static void
prune_unused_types_walk_attribs (dw_die_ref die)
{
dw_attr_ref a;
+ unsigned ix;
- for (a = die->die_attr; a != NULL; a = a->dw_attr_next)
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
{
if (a->dw_attr_val.val_class == dw_val_class_die_ref)
{
@@ -13731,6 +13685,10 @@ prune_unused_types_walk_attribs (dw_die_ref die)
a->dw_attr_val.v.val_unsigned =
maybe_emit_file (a->dw_attr_val.v.val_unsigned);
}
+ /* Set the string's refcount to 0 so that prune_unused_types_mark
+ accounts properly for it. */
+ if (AT_class (a) == dw_val_class_str)
+ a->dw_attr_val.v.val_str->refcount = 0;
}
}
@@ -13768,16 +13726,12 @@ prune_unused_types_mark (dw_die_ref die, int dokids)
Remember that we've walked the kids. */
die->die_mark = 2;
- /* Walk them. */
- for (c = die->die_child; c; c = c->die_sib)
- {
- /* If this is an array type, we need to make sure our
- kids get marked, even if they're types. */
- if (die->die_tag == DW_TAG_array_type)
- prune_unused_types_mark (c, 1);
- else
- prune_unused_types_walk (c);
- }
+ /* If this is an array type, we need to make sure our
+ kids get marked, even if they're types. */
+ if (die->die_tag == DW_TAG_array_type)
+ FOR_EACH_CHILD (die, c, prune_unused_types_mark (c, 1));
+ else
+ FOR_EACH_CHILD (die, c, prune_unused_types_walk (c));
}
}
@@ -13827,38 +13781,74 @@ prune_unused_types_walk (dw_die_ref die)
prune_unused_types_walk_attribs (die);
/* Mark children. */
- for (c = die->die_child; c; c = c->die_sib)
- prune_unused_types_walk (c);
+ FOR_EACH_CHILD (die, c, prune_unused_types_walk (c));
}
+/* Increment the string counts on strings referred to from DIE's
+ attributes. */
+
+static void
+prune_unused_types_update_strings (dw_die_ref die)
+{
+ dw_attr_ref a;
+ unsigned ix;
+
+ for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
+ if (AT_class (a) == dw_val_class_str)
+ {
+ struct indirect_string_node *s = a->dw_attr_val.v.val_str;
+ s->refcount++;
+ /* Avoid unnecessarily putting strings that are used less than
+ twice in the hash table. */
+ if (s->refcount == 2
+ || (s->refcount == 1
+ && (DEBUG_STR_SECTION_FLAGS & SECTION_MERGE) != 0))
+ {
+ void ** slot;
+ slot = htab_find_slot_with_hash (debug_str_hash, s->str,
+ htab_hash_string (s->str),
+ INSERT);
+ gcc_assert (*slot == NULL);
+ *slot = s;
+ }
+ }
+}
/* Remove from the tree DIE any dies that aren't marked. */
static void
prune_unused_types_prune (dw_die_ref die)
{
- dw_die_ref c, p, n;
+ dw_die_ref c;
gcc_assert (die->die_mark);
- p = NULL;
- for (c = die->die_child; c; c = n)
- {
- n = c->die_sib;
- if (c->die_mark)
- {
- prune_unused_types_prune (c);
- p = c;
- }
- else
+ if (! die->die_child)
+ return;
+
+ c = die->die_child;
+ do {
+ dw_die_ref prev = c;
+ for (c = c->die_sib; ! c->die_mark; c = c->die_sib)
+ if (c == die->die_child)
{
- if (p)
- p->die_sib = n;
+ /* No marked children between 'prev' and the end of the list. */
+ if (prev == c)
+ /* No marked children at all. */
+ die->die_child = NULL;
else
- die->die_child = n;
- free_die (c);
+ {
+ prev->die_sib = c->die_sib;
+ die->die_child = prev;
+ }
+ return;
}
- }
+
+ if (c != prev->die_sib)
+ prev->die_sib = c;
+ prune_unused_types_update_strings (c);
+ prune_unused_types_prune (c);
+ } while (c != die->die_child);
}
@@ -13870,10 +13860,12 @@ prune_unused_types (void)
unsigned int i;
limbo_die_node *node;
- /* Clear all the marks. */
- prune_unmark_dies (comp_unit_die);
+#if ENABLE_ASSERT_CHECKING
+ /* All the marks should already be clear. */
+ verify_marks_clear (comp_unit_die);
for (node = limbo_die_list; node; node = node->next)
- prune_unmark_dies (node->die);
+ verify_marks_clear (node->die);
+#endif /* ENABLE_ASSERT_CHECKING */
/* Set the mark on nodes that are actually used. */
prune_unused_types_walk (comp_unit_die);
@@ -13887,7 +13879,9 @@ prune_unused_types (void)
for (i = 0; i < arange_table_in_use; i++)
prune_unused_types_mark (arange_table[i], 1);
- /* Get rid of nodes that aren't marked. */
+ /* Get rid of nodes that aren't marked; and update the string counts. */
+ if (debug_str_hash)
+ htab_empty (debug_str_hash);
prune_unused_types_prune (comp_unit_die);
for (node = limbo_die_list; node; node = node->next)
prune_unused_types_prune (node->die);
@@ -13984,10 +13978,6 @@ dwarf2out_finish (const char *filename)
emit full debugging info for them. */
retry_incomplete_types ();
- /* We need to reverse all the dies before break_out_includes, or
- we'll see the end of an include file before the beginning. */
- reverse_all_dies (comp_unit_die);
-
if (flag_eliminate_unused_debug_types)
prune_unused_types ();
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 9a99d87a600..329f8a1db0b 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -156,9 +156,9 @@ int disable_typechecking_for_spec_flag = 0;
/* APPLE LOCAL begin CW asm blocks */
/* Dummies needed because we use them from cpplib, yuck. */
-int flag_cw_asm_blocks;
-int cw_asm_state;
-int cw_asm_in_operands;
+int flag_iasm_blocks;
+int iasm_state;
+int iasm_in_operands;
/* APPLE LOCAL end CW asm blocks */
/* APPLE LOCAL begin 4174833 */
diff --git a/gcc/function.c b/gcc/function.c
index 2e6be8086ac..5e4b158beec 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4034,11 +4034,11 @@ init_function_start (tree subr)
prepare_function_start (subr);
/* APPLE LOCAL begin CW asm blocks */
- if (DECL_CW_ASM_FUNCTION (subr))
+ if (DECL_IASM_ASM_FUNCTION (subr))
{
- cfun->cw_asm_function = 1;
- cfun->cw_asm_noreturn = DECL_CW_ASM_NORETURN (subr);
- cfun->cw_asm_frame_size = DECL_CW_ASM_FRAME_SIZE (subr);
+ cfun->iasm_asm_function = true;
+ cfun->iasm_noreturn = DECL_IASM_NORETURN (subr);
+ cfun->iasm_frame_size = DECL_IASM_FRAME_SIZE (subr);
}
/* APPLE LOCAL end CW asm blocks */
/* Prevent ever trying to delete the first instruction of a
@@ -4158,7 +4158,7 @@ expand_function_start (tree subr)
}
/* APPLE LOCAL begin CW asm blocks */
else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode
- || cfun->cw_asm_function)
+ || cfun->iasm_asm_function)
/* APPLE LOCAL end CW asm blocks */
/* If return mode is void, this decl rtl should not be used. */
SET_DECL_RTL (DECL_RESULT (subr), NULL_RTX);
@@ -4402,7 +4402,7 @@ expand_function_end (void)
do_pending_stack_adjust ();
/* APPLE LOCAL begin CW asm blocks */
- if (cfun->cw_asm_function)
+ if (cfun->iasm_asm_function)
expand_naked_return ();
/* APPLE LOCAL end CW asm blocks */
diff --git a/gcc/function.h b/gcc/function.h
index 89e3886406c..d73d9e573f9 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -251,11 +251,11 @@ struct function GTY(())
/* APPLE LOCAL begin CW asm blocks */
/* Nonzero if this is an all-assembly function. */
- unsigned int cw_asm_function : 1;
+ unsigned int iasm_asm_function : 1;
/* Nonzero if we don't want to emit any return instructions. */
- unsigned int cw_asm_noreturn : 1;
+ unsigned int iasm_noreturn : 1;
/* If nonzero, use this as the explicitly-defined frame size. */
- int cw_asm_frame_size;
+ int iasm_frame_size;
/* APPLE LOCAL end CW asm blocks */
/* Offset to end of allocated area of stack frame.
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index a4c17b161ac..2c9baedcd9c 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -92,7 +92,7 @@ lower_function_body (void)
if (block_may_fallthru (*body_p)
&& (data.return_statements == NULL
|| TREE_OPERAND (TREE_VALUE (data.return_statements), 0) != NULL)
- && ! (cfun->cw_asm_function))
+ && ! (cfun->iasm_asm_function))
/* APPLE LOCAL end CW asm blocks */
{
x = build (RETURN_EXPR, void_type_node, NULL);
diff --git a/gcc/global.c b/gcc/global.c
index 15d161fd455..ca9ec888e32 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -434,13 +434,13 @@ global_alloc (FILE *file)
SET_HARD_REG_BIT (no_global_alloc_regs, HARD_FRAME_POINTER_REGNUM);
}
else if (need_fp)
- /* APPLE LOCAL begin 4443946 */
+ /* APPLE LOCAL begin CW asm blocks 4443946 */
{
- if (!flag_cw_asm_blocks)
+ if (!flag_iasm_blocks)
error ("%s cannot be used in asm here",
reg_names[HARD_FRAME_POINTER_REGNUM]);
}
- /* APPLE LOCAL end 4443946 */
+ /* APPLE LOCAL end CW asm blocks 4443946 */
else
regs_ever_live[HARD_FRAME_POINTER_REGNUM] = 1;
#endif
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index fdb705ad804..b8375998fa6 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -796,9 +796,9 @@ int disable_typechecking_for_spec_flag = 0;
/* APPLE LOCAL begin CW asm blocks */
/* Dummies needed because we use them from cpplib, yuck. */
-int flag_cw_asm_blocks;
-int cw_asm_state;
-int cw_asm_in_operands;
+int flag_iasm_blocks;
+int iasm_state;
+int iasm_in_operands;
/* APPLE LOCAL end CW asm blocks */
/* APPLE LOCAL begin 4174833 */
diff --git a/gcc/loop.c b/gcc/loop.c
index d3b50b5aadd..7b3b8e1d4a7 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -7770,7 +7770,12 @@ general_induction_var (const struct loop *loop, rtx x, rtx *src_reg,
rtx orig_x = x;
/* If this is an invariant, forget it, it isn't a giv. */
- if (loop_invariant_p (loop, x) == 1)
+ /* APPLE LOCAL begin radar 4491613 */
+ /* If a loop jumps to the bottom of the loop first, then jumps back
+ to the top of the loop, and its induction variable may trap,
+ the induction variable shouldn't be a giv. */
+ if (loop_invariant_p (loop, x) == 1 || (loop->top && may_trap_p (x)))
+ /* APPLE LOCAL end radar 4491613 */
return 0;
*pbenefit = 0;
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 91b6331224e..5ee49b8b3a8 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -340,12 +340,12 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (DECL_NONLOCAL (node))
fputs (" nonlocal", file);
/* APPLE LOCAL begin CW asm blocks */
- if (DECL_CW_ASM_FUNCTION (node))
+ if (DECL_IASM_ASM_FUNCTION (node))
fputs (" asm-function", file);
- if (DECL_CW_ASM_NORETURN (node))
+ if (DECL_IASM_NORETURN (node))
fputs (" asm-noreturn", file);
- if (DECL_CW_ASM_FRAME_SIZE (node) != (unsigned int)-2)
- fprintf (file, " asm-frame-size %d", DECL_CW_ASM_FRAME_SIZE (node));
+ if (DECL_IASM_FRAME_SIZE (node) != (unsigned int)-2)
+ fprintf (file, " asm-frame-size %d", DECL_IASM_FRAME_SIZE (node));
/* APPLE LOCAL end CW asm blocks */
if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
fputs (" suppress-debug", file);
diff --git a/gcc/reload.c b/gcc/reload.c
index d929bfb535a..75e8e68731b 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -5855,7 +5855,10 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context,
if ((unsigned) CLASS_MAX_NREGS (class, GET_MODE (SUBREG_REG (x)))
> reg_class_size[class])
{
- x = find_reloads_subreg_address (x, 0, opnum, type,
+ /* APPLE LOCAL begin mainline 4506160 */
+ x = find_reloads_subreg_address (x, 0, opnum,
+ ADDR_TYPE (type),
+ /* APPLE LOCAL end mainline 4506160 */
ind_levels, insn);
push_reload (x, NULL_RTX, loc, (rtx*) 0, class,
GET_MODE (x), VOIDmode, 0, 0, opnum, type);
@@ -6015,7 +6018,8 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
}
find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
- &XEXP (tem, 0), opnum, ADDR_TYPE (type),
+ /* APPLE LOCAL mainline 4506160 */
+ &XEXP (tem, 0), opnum, type,
ind_levels, insn);
/* If this is not a toplevel operand, find_reloads doesn't see
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 9c7ade96b9f..8662381398c 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -3514,7 +3514,7 @@ init_elim_table (void)
/* Does this function require a frame pointer? */
/* APPLE LOCAL begin CW asm blocks */
- if (cfun->cw_asm_function)
+ if (cfun->iasm_asm_function)
frame_pointer_needed = 0;
else
frame_pointer_needed = (! flag_omit_frame_pointer
diff --git a/gcc/scan-decls.c b/gcc/scan-decls.c
index d7dd0a621d4..769c84c8ac2 100644
--- a/gcc/scan-decls.c
+++ b/gcc/scan-decls.c
@@ -41,9 +41,9 @@ char extern_C_braces[MAX_EXTERN_C_BRACES];
/* APPLE LOCAL begin CW asm blocks */
/* Dummies needed because we use them in cpplib, yuck. */
-int flag_cw_asm_blocks;
-int cw_asm_state;
-int cw_asm_in_operands;
+int flag_iasm_blocks;
+int iasm_state;
+bool iasm_in_operands;
/* APPLE LOCAL end CW asm blocks */
/* True if the function declaration currently being scanned is
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 8bdcbef48c0..bf7f19f6af6 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -917,7 +917,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
/* APPLE LOCAL begin CW asm blocks. */
/* Crude way of detecting an entry static label declaration
- (See cw_asm_entry). Make this a local symbol. */
+ (See iasm_entry). Make this a local symbol. */
if (i == 0 && !TREE_CHAIN (tail)
&& strcmp (TREE_STRING_POINTER (string), "%0:") == 0
&& GET_CODE (op) == SYMBOL_REF)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index aab8d098fdc..5ebe793bbc7 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -547,11 +547,6 @@ start_record_layout (tree t)
rli->prev_field = 0;
rli->pending_statics = 0;
rli->packed_maybe_necessary = 0;
- /* APPLE LOCAL begin bitfield reversal */
- rli->among_reversed_bitfields = 0;
- rli->reversed_bitfield_type_size = 0;
- rli->reversed_bitfield_bitpos = 0;
- /* APPLE LOCAL end bitfield reversal */
return rli;
}
@@ -625,6 +620,10 @@ debug_rli (record_layout_info rli)
fprintf (stderr, "\naligns: rec = %u, unpack = %u, off = %u\n",
rli->record_align, rli->unpacked_align,
rli->offset_align);
+ /* APPLE LOCAL begin ms_struct */
+ if (rli->remaining_in_alignment)
+ fprintf (stderr, "remaining_in_alignment = %u\n", rli->remaining_in_alignment);
+ /* APPLE LOCAL end ms_struct */
if (rli->packed_maybe_necessary)
fprintf (stderr, "packed may be necessary\n");
@@ -706,7 +705,8 @@ update_alignment_for_field (record_layout_info rli, tree field,
/* Record must have at least as much alignment as any field.
Otherwise, the alignment of the field within the record is
meaningless. */
- if (is_bitfield && targetm.ms_bitfield_layout_p (rli->t))
+ /* APPLE LOCAL begin ms_struct */
+ if (targetm.ms_bitfield_layout_p (rli->t))
{
/* Here, the alignment of the underlying type of a bitfield can
affect the alignment of a record; even a zero-sized field
@@ -714,11 +714,12 @@ update_alignment_for_field (record_layout_info rli, tree field,
the type, except that for zero-size bitfields this only
applies if there was an immediately prior, nonzero-size
bitfield. (That's the way it is, experimentally.) */
- if (! integer_zerop (DECL_SIZE (field))
+ if (!is_bitfield
+ || (!integer_zerop (DECL_SIZE (field))
? ! DECL_PACKED (field)
: (rli->prev_field
&& DECL_BIT_FIELD_TYPE (rli->prev_field)
- && ! integer_zerop (DECL_SIZE (rli->prev_field))))
+ && !integer_zerop (DECL_SIZE (rli->prev_field)))))
{
unsigned int type_align = TYPE_ALIGN (type);
type_align = MAX (type_align, desired_align);
@@ -728,6 +729,7 @@ update_alignment_for_field (record_layout_info rli, tree field,
rli->unpacked_align = MAX (rli->unpacked_align, TYPE_ALIGN (type));
}
}
+ /* APPLE LOCAL end ms_struct */
#ifdef PCC_BITFIELD_TYPE_MATTERS
else if (is_bitfield && PCC_BITFIELD_TYPE_MATTERS)
{
@@ -825,8 +827,6 @@ excess_unit_span (HOST_WIDE_INT byte_offset, HOST_WIDE_INT bit_offset,
}
#endif
-/* APPLE LOCAL begin bitfield reversal */
-/* 4401223 4401224 4420068 4317709 4431497 4433004 4430139 4436477 */
/* RLI contains information about the layout of a RECORD_TYPE. FIELD
is a FIELD_DECL to be added after those fields already present in
T. (FIELD is not actually added to the TYPE_FIELDS list here;
@@ -857,31 +857,7 @@ place_field (record_layout_info rli, tree field)
rli->pending_statics);
return;
}
- /* In C++ the list doesn't necessarily end with the last data member.
- There always seems to be a TYPE_DECL for the class type in this list
- which comes after all the data members, so use that to detect the end.
- In C this operation is done at list end (bottom of this function). */
- else if (targetm.reverse_bitfields_p (rli->t) && rli->among_reversed_bitfields
- && TREE_CODE (field) == TYPE_DECL && TREE_TYPE(field) == rli->t)
- {
- /* If we're at the end of the struct and there are dangling reversed bitfields,
- adjust rli->bitpos. Needed to get sizeof right. */
- /* Make sure we complete the current allocation unit (e.g. if we've used
- 16 of 32 bits these will be the ones at the right, we must move up to
- a 32 bit boundary). But, when pragma pack(1) is on, do not use the
- full allocation unit size (experiment indicates CW treats pack(1)
- different from other pack values, although the reason remains
- mysterious.) */
- unsigned int save_bitpos = rli->reversed_bitfield_bitpos;
- if (save_bitpos > 0 && rli->reversed_bitfield_type_size > save_bitpos
- && maximum_field_alignment != 8)
- save_bitpos = rli->reversed_bitfield_type_size;
-
- rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, bitsize_int (save_bitpos));
- normalize_rli (rli);
- rli->among_reversed_bitfields = 0;
- return;
- }
+
/* Enumerators and enum types which are local to this class need not
be laid out. Likewise for initialized constant fields. */
else if (TREE_CODE (field) != FIELD_DECL)
@@ -895,64 +871,19 @@ place_field (record_layout_info rli, tree field)
return;
}
- /* If we're at the non-bitfield terminating a run of reversed bitfields,
- or a bitfield that won't fit in the current unit of bitfield allocation,
- or a zero-sized field, adjust rli->bitpos by adding in the accumulated
- reversed sizes. Nonintuitively, it is correct to check DECL_BIT_FIELD here but
- DECL_BIT_FIELD_TYPE below; the information is moved by
- update_alignment_for_field. */
- if (targetm.reverse_bitfields_p (rli->t) && rli->among_reversed_bitfields
- && (!DECL_BIT_FIELD (field) || integer_zerop (DECL_SIZE (field))))
- {
- rli->among_reversed_bitfields = 0;
- rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos,
- bitsize_int (rli->reversed_bitfield_bitpos));
- normalize_rli (rli);
- }
- else if (targetm.reverse_bitfields_p (rli->t) && rli->among_reversed_bitfields
- && ((rli->reversed_bitfield_bitpos + TREE_INT_CST_LOW (DECL_SIZE (field))
- > TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (field))))))
- {
- /* In the case where the next bitfield won't fit in the allocation unit,
- make sure we complete the current allocation unit (e.g. if we've used
- 16 of 32 bits these will be the ones at the right, we must move up to
- a 32 bit boundary). Move to the correct boundary for the new allocation
- unit, if that's bigger (this boundary may be reduced by packing). */
- unsigned int save_bitpos = rli->reversed_bitfield_bitpos;
- unsigned int save_offset_align = rli->offset_align;
- unsigned int tsize = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (field)));
- if (save_bitpos > 0 && rli->reversed_bitfield_type_size > save_bitpos)
- save_bitpos = rli->reversed_bitfield_type_size;
- if (save_bitpos > 0 && tsize > save_bitpos
- && (maximum_field_alignment == 0 || maximum_field_alignment >= tsize))
- save_bitpos = tsize;
-
- rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, bitsize_int (save_bitpos));
-
- /* For pack(1) etc. normalize to byte boundary only. */
- rli->offset_align = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (field)));
- if (maximum_field_alignment != 0 && maximum_field_alignment < rli->offset_align)
- rli->offset_align = maximum_field_alignment;
- normalize_rli (rli);
- rli->offset_align = save_offset_align;
-
- rli->among_reversed_bitfields = 0;
- }
-
- /* If we're in the middle of a reversed bitfield run (this field is known to
- be another bitfield that will fit in the current allocation unit at this point)
- we don't want any alignment padding. */
- if (rli->among_reversed_bitfields)
- known_align = BIGGEST_ALIGNMENT;
/* Work out the known alignment so far. Note that A & (-A) is the
value of the least-significant bit in A that is one. */
- else if (! integer_zerop (rli->bitpos))
+ /* APPLE LOCAL begin ms_struct */
+ if (! integer_zerop (rli->bitpos))
{
int realoffset = tree_low_cst (rli->bitpos, 1);
+
if (targetm.reverse_bitfields_p (rli->t))
- realoffset += tree_low_cst (rli->offset, 1) * BITS_PER_UNIT;
+ realoffset += rli->remaining_in_alignment;
+
known_align = realoffset & -realoffset;
}
+ /* APPLE LOCAL end ms_struct */
else if (integer_zerop (rli->offset))
known_align = BIGGEST_ALIGNMENT;
else if (host_integerp (rli->offset, 1))
@@ -982,10 +913,14 @@ place_field (record_layout_info rli, tree field)
rli->packed_maybe_necessary = 1;
}
+ /* APPLE LOCAL begin ms_struct */
/* Does this field automatically have alignment it needs by virtue
- of the fields that precede it and the record's own alignment? */
- if (known_align < desired_align)
+ of the fields that precede it and the record's own alignment?
+ We already align ms_struct fields, so don't re-align them. */
+ if (known_align < desired_align
+ && !targetm.ms_bitfield_layout_p (rli->t))
{
+ /* APPLE LOCAL end ms_struct */
/* No, we need to skip space before this field.
Bump the cumulative size to multiple of field alignment. */
@@ -1122,10 +1057,8 @@ place_field (record_layout_info rli, tree field)
Note: for compatibility, we use the type size, not the type alignment
to determine alignment, since that matches the documentation */
-
- if (targetm.ms_bitfield_layout_p (rli->t)
- && ((DECL_BIT_FIELD_TYPE (field) && ! DECL_PACKED (field))
- || (rli->prev_field && ! DECL_PACKED (rli->prev_field))))
+ /* APPLE LOCAL begin ms_struct */
+ if (targetm.ms_bitfield_layout_p (rli->t))
{
/* At this point, either the prior or current are bitfields,
(possibly both), and we're dealing with MS packing. */
@@ -1133,7 +1066,7 @@ place_field (record_layout_info rli, tree field)
/* Is the prior field a bitfield? If so, handle "runs" of same
type size fields. */
- if (rli->prev_field /* necessarily a bitfield if it exists. */)
+ if (rli->prev_field)
{
/* If both are bitfields, nonzero, and the same size, this is
the middle of a run. Zero declared size fields are special
@@ -1152,18 +1085,69 @@ place_field (record_layout_info rli, tree field)
/* We're in the middle of a run of equal type size fields; make
sure we realign if we run out of bits. (Not decl size,
type size!) */
- HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 0);
+ HOST_WIDE_INT bitsize = tree_low_cst (DECL_SIZE (field), 1);
if (rli->remaining_in_alignment < bitsize)
{
+ if (!targetm.reverse_bitfields_p (rli->t))
+ {
/* out of bits; bump up to next 'word'. */
rli->offset = DECL_FIELD_OFFSET (rli->prev_field);
+
rli->bitpos
= size_binop (PLUS_EXPR, TYPE_SIZE (type),
DECL_FIELD_BIT_OFFSET (rli->prev_field));
rli->prev_field = field;
rli->remaining_in_alignment
- = tree_low_cst (TYPE_SIZE (type), 0);
+ = tree_low_cst (TYPE_SIZE (type), 1);
+ }
+ else
+ {
+ /* "Use up" the remaining bits. */
+ rli->bitpos
+ = size_binop (PLUS_EXPR,
+ rli->bitpos,
+ size_binop
+ (MINUS_EXPR,
+ TYPE_SIZE (type),
+ bitsize_int (rli->remaining_in_alignment)));
+ rli->prev_field = field;
+ rli->remaining_in_alignment
+ = tree_low_cst (TYPE_SIZE (type), 1);
+
+ /* Move to the top end of the range. We'll add the bitfield
+ below. */
+ rli->bitpos
+ = size_binop (PLUS_EXPR,
+ rli->bitpos,
+ TYPE_SIZE (type));
+ }
+ }
+
+ /* We handle this here instead of later at the end of
+ field placement. */
+ if (targetm.reverse_bitfields_p (rli->t))
+ {
+ /* If we normalized within rli->remaining_in_alignment we'll
+ possibly need to add some bits. */
+ while ((tree_low_cst (rli->bitpos, 0) - bitsize) < 0)
+ {
+ rli->offset
+ = size_binop (MINUS_EXPR,
+ rli->offset,
+ fold_convert (sizetype, bitsize_one_node));
+ rli->bitpos
+ = size_binop (PLUS_EXPR,
+ rli->bitpos,
+ bitsize_int (BITS_PER_UNIT));
+ }
+
+ rli->bitpos = size_binop (MINUS_EXPR,
+ rli->bitpos,
+ bitsize_int (bitsize));
+
+ /* Ensure we don't go negative. */
+ gcc_assert (tree_low_cst (rli->bitpos, 0) >= 0);
}
rli->remaining_in_alignment -= bitsize;
@@ -1179,18 +1163,38 @@ place_field (record_layout_info rli, tree field)
Note: since the beginning of the field was aligned then
of course the end will be too. No round needed. */
+ if (!targetm.reverse_bitfields_p (rli->t))
+ {
+ if (!integer_zerop (DECL_SIZE (rli->prev_field))
+ && rli->remaining_in_alignment)
+ {
+ rli->bitpos
+ = size_binop (PLUS_EXPR, rli->bitpos,
+ bitsize_int (rli->remaining_in_alignment));
+ }
+ else
+ prev_saved = NULL;
+ }
+ else
+ {
+ /* Difference from above - even if we don't have anything
+ left in the alignment we should move up to the top of
+ the word. */
if (!integer_zerop (DECL_SIZE (rli->prev_field)))
{
- tree type_size = TYPE_SIZE (TREE_TYPE (rli->prev_field));
-
rli->bitpos
- = size_binop (PLUS_EXPR, type_size,
- DECL_FIELD_BIT_OFFSET (rli->prev_field));
+ = size_binop
+ (PLUS_EXPR, rli->bitpos,
+ size_binop (MINUS_EXPR,
+ TYPE_SIZE (TREE_TYPE (rli->prev_field)),
+ bitsize_int (rli->remaining_in_alignment)));
+
+ /* We'll reset this when we have bits to add. */
+ rli->remaining_in_alignment = 0;
}
else
- /* We "use up" size zero fields; the code below should behave
- as if the prior field was not a bitfield. */
prev_saved = NULL;
+ }
/* Cause a new bitfield to be captured, either this time (if
currently a bitfield) or next time we see one. */
@@ -1231,97 +1235,44 @@ place_field (record_layout_info rli, tree field)
&& host_integerp (TYPE_SIZE (TREE_TYPE (field)), 0)
&& host_integerp (DECL_SIZE (field), 0))
rli->remaining_in_alignment
- = tree_low_cst (TYPE_SIZE (TREE_TYPE(field)), 0)
- - tree_low_cst (DECL_SIZE (field), 0);
+ = tree_low_cst (TYPE_SIZE (TREE_TYPE(field)), 1)
+ - tree_low_cst (DECL_SIZE (field), 1);
/* Now align (conventionally) for the new type. */
- if (!DECL_PACKED(field))
- type_align = MAX(TYPE_ALIGN (type), type_align);
-
- if (prev_saved
- && DECL_BIT_FIELD_TYPE (prev_saved)
- /* If the previous bit-field is zero-sized, we've already
- accounted for its alignment needs (or ignored it, if
- appropriate) while placing it. */
- && ! integer_zerop (DECL_SIZE (prev_saved)))
- type_align = MAX (type_align,
- TYPE_ALIGN (TREE_TYPE (prev_saved)));
+ type_align = TYPE_ALIGN (TREE_TYPE (field));
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
rli->bitpos = round_up (rli->bitpos, type_align);
+ /* If we're reversing add this to the field starting at the
+ "right" end of the alignment. */
+ if (targetm.reverse_bitfields_p (rli->t)
+ && DECL_BIT_FIELD_TYPE (field)
+ && !integer_zerop (DECL_SIZE (field)))
+ {
+ rli->bitpos = size_binop (MINUS_EXPR,
+ size_binop (PLUS_EXPR,
+ rli->bitpos,
+ TYPE_SIZE (type)),
+ DECL_SIZE (field));
+ }
+
/* If we really aligned, don't allow subsequent bitfields
to undo that. */
rli->prev_field = NULL;
}
+ /* Nothing we've done should let bitpos be negative. */
+ gcc_assert (tree_low_cst (rli->bitpos, 0) >= 0);
}
-
/* Offset so far becomes the position of this field after normalizing. */
normalize_rli (rli);
- if (targetm.reverse_bitfields_p (rli->t) && DECL_BIT_FIELD_TYPE (field))
- {
- tree fsize = DECL_SIZE (field);
- tree tsize = TYPE_SIZE (TREE_TYPE (field));
- unsigned int tsize_int = TREE_INT_CST_LOW (tsize);
- if (!rli->among_reversed_bitfields)
- {
- unsigned int save_offset_align = rli->offset_align;
- unsigned int bitpos_int;
- /* Make sure current bit accumulation isn't too big for this basic type. */
- rli->offset_align = tsize_int;
- normalize_rli (rli);
- rli->offset_align = save_offset_align;
-
- /* If this field won't fit in current allocation unit, finish off the
- current allocation unit. Handle :0 here as well. */
- bitpos_int = TREE_INT_CST_LOW (rli->bitpos);
- if (tsize_int < (TREE_INT_CST_LOW (fsize) + TREE_INT_CST_LOW (rli->bitpos)))
- {
- if (bitpos_int > 0 && tsize_int > bitpos_int
- && (maximum_field_alignment == 0 || maximum_field_alignment >= tsize_int))
- rli->bitpos = tsize;
- if (TREE_INT_CST_LOW (fsize) == 0)
- rli->bitpos = tsize;
- rli->offset_align = tsize_int;
- if (maximum_field_alignment != 0 && maximum_field_alignment < rli->offset_align)
- rli->offset_align = maximum_field_alignment;
- }
- else
- {
- rli->offset_align = tsize_int;
- if (maximum_field_alignment != 0
- && maximum_field_alignment < rli->offset_align
- && maximum_field_alignment > 8) /* not for pack(1) !! */
- rli->offset_align = maximum_field_alignment;
- }
- normalize_rli (rli);
- rli->offset_align = save_offset_align;
-
- rli->among_reversed_bitfields = 1;
- rli->reversed_bitfield_bitpos = TREE_INT_CST_LOW (rli->bitpos);
- /* We're going to add the reversed-bitpos back into bitpos before doing
- anything with bitpos; set to zero now to get this to come out right. */
- rli->bitpos = bitsize_zero_node;
- }
- DECL_FIELD_BIT_OFFSET (field) = size_binop (MINUS_EXPR,
- size_binop (MINUS_EXPR, tsize, fsize),
- bitsize_int (rli->reversed_bitfield_bitpos));
- rli->reversed_bitfield_bitpos += TREE_INT_CST_LOW (fsize);
- rli->reversed_bitfield_type_size = TREE_INT_CST_LOW (tsize);
- /* Do not advance rli->bitpos, as we don't want normalize_rli perturbing things.
- Its model is that bits are allocated monotonically from one end of the struct
- (possibly skipping over holes); things are not like that with reversal.
- Instead, keep a separate total of "bits within the current group of reversed
- bitfields", and add that into bitpos when we complete a group. */
- }
- else
DECL_FIELD_BIT_OFFSET (field) = rli->bitpos;
DECL_FIELD_OFFSET (field) = rli->offset;
SET_DECL_OFFSET_ALIGN (field, rli->offset_align);
-
+ /* APPLE LOCAL end ms_struct */
/* If this field ended up more aligned than we thought it would be (we
approximate this by seeing if its position changed), lay out the field
again; perhaps we can use an integral mode for it now. */
@@ -1366,37 +1317,62 @@ place_field (record_layout_info rli, tree field)
rli->bitpos = bitsize_zero_node;
rli->offset_align = MIN (rli->offset_align, desired_align);
}
- else if (targetm.reverse_bitfields_p (rli->t) && rli->among_reversed_bitfields)
+ /* APPLE LOCAL begin ms_struct */
+ else if (targetm.ms_bitfield_layout_p (rli->t))
{
- /* If we're at the end of the struct and there are dangling reversed bitfields,
- adjust rli->bitpos. Needed to get sizeof right.
- C++ doesn't terminate the field list with a null; there always seems to be
- a TYPE_DECL==rli->t after all data members, which was detected above. */
- if (TREE_CHAIN (field) == NULL_TREE)
+ if (!targetm.reverse_bitfields_p (rli->t))
+ {
+ rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, DECL_SIZE (field));
+
+ /* If this is the last element in the struct fill out the rest of
+ the struct - this is only used when we would have packed a bitfield
+ into less than the base type size of the field type. */
+ if ((TREE_CHAIN (field) == NULL
+ || TREE_CODE (TREE_CHAIN (field)) != FIELD_DECL)
+ && DECL_BIT_FIELD_TYPE (field)
+ && !integer_zerop (DECL_SIZE (field)))
+ rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos,
+ bitsize_int (rli->remaining_in_alignment));
+ }
+ else
{
- /* Make sure we complete the current allocation unit (e.g. if we've used
- 16 of 32 bits these will be the ones at the right, we must move up to
- a 32 bit boundary). But, when pragma pack(1) is on, do not use the
- full allocation unit size (experiment indicates CW treats pack(1)
- different from other pack values, although the reason remains
- mysterious.) */
- unsigned int save_bitpos = rli->reversed_bitfield_bitpos;
- if (save_bitpos > 0 && rli->reversed_bitfield_type_size > save_bitpos
- && maximum_field_alignment != 8)
- save_bitpos = rli->reversed_bitfield_type_size;
-
- rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, bitsize_int (save_bitpos));
- normalize_rli (rli);
- rli->among_reversed_bitfields = 0;
+ unsigned int extension = 0;
+
+ if (integer_zerop (DECL_SIZE (field))
+ && rli->remaining_in_alignment
+ && rli->prev_field
+ && DECL_BIT_FIELD_TYPE (rli->prev_field)
+ && !integer_zerop (DECL_SIZE (rli->prev_field)))
+ extension =
+ tree_low_cst (TYPE_SIZE (TREE_TYPE (rli->prev_field)), 1)
+ - rli->remaining_in_alignment;
+ else if (!integer_zerop (DECL_SIZE (field)))
+ extension =
+ tree_low_cst (TYPE_SIZE (TREE_TYPE (field)), 1)
+ - rli->remaining_in_alignment;
+
+ /* For bitfields we handled the adding of the type earlier. */
+ if (!DECL_BIT_FIELD_TYPE (field))
+ rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, DECL_SIZE (field));
+
+ /* For reverse bitfields we need to go back to the end of the type. */
+ if (extension
+ && (TREE_CHAIN (field) == NULL
+ || TREE_CODE (TREE_CHAIN (field)) != FIELD_DECL)
+ && DECL_BIT_FIELD_TYPE (field))
+ rli->bitpos = size_binop (PLUS_EXPR,
+ rli->bitpos,
+ bitsize_int (extension));
}
+ normalize_rli (rli);
}
+ /* APPLE LOCAL end ms_struct */
else
{
rli->bitpos = size_binop (PLUS_EXPR, rli->bitpos, DECL_SIZE (field));
normalize_rli (rli);
}
}
-/* APPLE LOCAL end bitfield reversal */
/* Assuming that all the fields have been laid out, this function uses
RLI to compute the final TYPE_SIZE, TYPE_ALIGN, etc. for the type
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 85fb012b986..3c8db3695d3 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -289,7 +289,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_VECTORIZE \
/* APPLE LOCAL begin 4375453 */ \
{TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD, \
- TARGET_VECTOR_ALIGNMENT_REACHABLE}
+ TARGET_VECTOR_ALIGNMENT_REACHABLE}
/* APPLE LOCAL end 4375453 */
/* In except.c */
@@ -360,7 +360,11 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity
#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false
#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1
+/* APPLE LOCAL begin mainline */
+#ifndef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
+#endif
+/* APPLE LOCAL end mainline */
#define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3024f0982a3..086613d4eb8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -4,6 +4,11 @@
PR c++/24302
* g++.dg/warn/Wunused-12.C: New test.
+2006-04-25 Eric Christopher <echristo@apple.com>
+
+ Radar 4529978
+ * gcc.dg/pragma-ms_struct.c: New.
+
2006-03-24 Geoffrey Keating <geoffk@apple.com>
Radar 4485597
@@ -17,7 +22,7 @@
* g++.dg/template/friend40.C: New test.
2006-03-15 Geoffrey Keating <geoffk@apple.com>
-
+
Radar 3992198
* g++.old-deja/g++.other/init18.C: New.
* g++.old-deja/g++.other/init5.C: Remove xfail.
diff --git a/gcc/testsuite/ChangeLog.apple-ppc b/gcc/testsuite/ChangeLog.apple-ppc
index 5908aa0c380..001506e387e 100644
--- a/gcc/testsuite/ChangeLog.apple-ppc
+++ b/gcc/testsuite/ChangeLog.apple-ppc
@@ -38,11 +38,6 @@
* g++.apple/R4517944.C: New.
* g++.apple/R4517944-2.C: New.
-2006-04-14 Fariborz Jahanian <fjahanian@apple.com>
-
- Radar 4508851
- * obj-c++.dg/method-namespace-1.mm: New.
-
2006-04-12 Fariborz Jahanian <fjahanian@apple.com>
Radar 4506893
@@ -346,6 +341,115 @@
Radar 4229905
* obj-c++.dg/warn5.mm: New
+2006-04-26 Fariborz Jahanian <fjahanian@apple.com>
+
+ Radar 4508851
+ * obj-c++.dg/method-namespace-1.mm: New.
+
+2006-04-28 Eric Christopher <echristo@apple.com>
+
+ Radar 4454599
+ * gcc.apple/bitreverse-13.c: Remove.
+ * gcc.apple/bitreverse-19.c: Ditto.
+ * gcc.apple/bitreverse-2.c: Ditto.
+ * gcc.apple/bitreverse-20.c: Ditto.
+ * gcc.apple/bitreverse-21.c: Ditto.
+ * gcc.apple/bitreverse-24.c: Ditto.
+ * gcc.apple/bitreverse-27.c: Ditto.
+ * gcc.apple/bitreverse-4.c: Ditto.
+ * gcc.apple/bitreverse-5.c: Ditto.
+ * gcc.apple/bitreverse-6.c: Ditto.
+ * gcc.apple/bitreverse-7.c: Ditto.
+ * gcc.apple/bitreverse-8.c: Ditto.
+ * gcc.apple/bitreverse-18.c: Add #pragma ms_struct
+ to locations where we turn on pragma reverse_bitfields.
+ * gcc.apple/bitreverse-3.c: Ditto.
+ * gcc.apple/bitreverse-11.c: Ditto.
+ * gcc.apple/bitreverse-15.c: Ditto.
+ * gcc.apple/bitreverse-12.c: Ditto.
+ * gcc.apple/bitreverse-16.c: Ditto.
+ * gcc.apple/bitreverse-25.c: Ditto.
+ * gcc.apple/bitreverse-1.c: Ditto.
+ * gcc.apple/bitreverse-9.c: Ditto.
+ * gcc.apple/bitreverse-17.c: Ditto.
+ * gcc.apple/bitreverse-22.c: Ditto.
+ * gcc.apple/bitreverse-26.c: Ditto.
+ * gcc.apple/bitreverse-10.c: Ditto.
+ * gcc.apple/bitreverse-14.c: Ditto.
+ * g++.dg/bitreverse-10.C: Ditto.
+ * g++.dg/bitreverse-23.C: Ditto.
+
+2006-04-27 Hui-May Chang <hm.chang@apple.com>
+
+ Radar 4314956
+ * g++.dg/sibcall-opt.C: Remove.
+
+2006-04-27 Mike Stump <mrs@apple.com>
+
+ Radar 4529992
+ * g++.apple/asm-block-50.C: Expect warning for [ptr][4].
+ * gcc.apple/asm-block-50.c: Likewise.
+
+2006-04-27 Devang Patel <dpatel@apple.com>
+
+ * gcc.target/i386/m64-1.c: Update line numbers in dg-warning.
+
+2006-04-26 Hui-May Chang <hm.chang@apple.com>
+
+ Radar 4314956
+ * g++.dg/sibcall-opt.C: New.
+
+2006-04-26 Mike Stump <mrs@apple.com>
+
+ Radar 4505697
+ * g++.apple/asm-block-51.C: Add.
+ * gcc.apple/asm-block-51.c: Add.
+
+2006-04-26 Mike Stump <mrs@apple.com>
+
+ Radar 4505741
+ * gcc.apple/asm-block-46.c: Fix warning line.
+ * g++.apple/asm-block-31.C: Add -mdynamic-no-pic to silence warning.
+ * gcc.apple/asm-block-31.c: Likwise.
+ * g++.apple/asm-block-35.C: Likwise.
+ * gcc.apple/asm-block-35.c: Likwise.
+ * g++.apple/asm-block-50.C: Add.
+ * gcc.apple/asm-block-50.c: Add.
+
+2006-04-25 Devang Patel <dpatel@apple.com>
+
+ Radar 4505813
+ * gcc.target/i386/m64-1.c: New.
+ * gcc.target/i386/m64-2.c: New.
+
+2006-04-18 Dale Johannesen <dalej@apple.com>
+
+ Radar 4516827
+ * gcc.apple/4516827.c: New.
+
+2006-04-18 Devang Patel <dpatel@apple.com>
+
+ Radar 4475058
+ * g++.dg/R4475058.C: New.
+
+2006-04-17 Devang Patel <dpatel@apple.com>
+
+ Radar 4499790
+ * gcc.apple/R4499790.c: New.
+ * gcc.apple/R4499790-2.c: New.
+ * gcc.apple/pascal-strings-2.c: Update.
+ * g++.dg/pascal-strings-2.C: Update.
+
+2006-04-12 Mike Stump <mrs@apple.com>
+
+ Radar 4477426 4466768
+ * g++.apple/asm-block-49.C: Add.
+ * gcc.apple/asm-block-49.c: Add.
+
+ Radar 4498501
+ * gcc.apple/asm-block-13.C: Update.
+ * g++.apple/asm-block-13.c: Update.
+
2006-04-06 Stuart Hastings <stuart@apple.com>
Radar 4499627
@@ -421,9 +525,9 @@
* testsuite/g++.dg/4448096-2.C: Remove.
2006-03-10 Fariborz Jahanian <fjahanian@apple.com>
-
- Radar 4407151
- * obj-c++.dg/template-7.mm: New.
+
+ Radar 4407151
+ * obj-c++.dg/template-7.mm: New.
2006-03-07 Stuart Hastings <stuart@apple.com>
@@ -445,7 +549,7 @@
Dorit Nuzman <dorit@apple.com>
Radar 4375453
- * gcc.dg/vect/vect-align-2.c: New.
+ * gcc.dg/vect/vect-align-2.c: New.
2006-02-27 Stuart Hastings <stuart@apple.com>
@@ -598,8 +702,8 @@
2006-01-23 Devang Patel <dpatel@apple.com>
- Radar 4334498
- * g++.dg/stab-4334498.C: New.
+ Radar 4334498
+ * g++.dg/stab-4334498.C: New.
2006-01-20 Eric Christopher <echristo@apple.com>
@@ -793,13 +897,13 @@
2005-11-16 Devang Patel <dpatel@apple.com>
- Radar 4345760
- * g++.dg/ss/ss.exp: Fix link test.
- * gcc.dg/ss/ss.exp: Fix link test.
+ Radar 4345760
+ * g++.dg/ss/ss.exp: Fix link test.
+ * gcc.dg/ss/ss.exp: Fix link test.
2005-11-15 Dale Johannesen <dalej@apple.com>
- * gcc.apple/pragma.c: New.
+ * gcc.apple/pragma.c: New.
2005-11-14 Dale Johannesen <dalej@apple.com>
@@ -831,9 +935,9 @@
2005-11-07 Dale Johannesen <dalej@apple.com>
- gcc.dg/darwin64-abi.c: Fix to test for
- correct location of rightmost bits of
- struct pararmeters.
+ gcc.dg/darwin64-abi.c: Fix to test for
+ correct location of rightmost bits of
+ struct pararmeters.
2005-10-31 Devang Patel <dpatel@apple.com>
@@ -882,12 +986,12 @@
2005-10-10 Fariborz Jahanian <fjahanian@apple.com>
- Radar 4291099
+ Radar 4291099
obj-c++.dg/objc-gc-9.mm: New.
2005-10-07 Fariborz Jahanian <fjahanian@apple.com>
- Radar 4204796
+ Radar 4204796
obj-c++.dg/try-catch-12.mm: New
obj-c++.dg/try-catch-13.mm: New
obj-c++.dg/try-catch-14.mm: New
@@ -912,7 +1016,7 @@
gcc.apple/i386-att-stub-1.c: New.
2005-10-21 Devang Patel <dpatel@apple.com>
-
+
* g++.dg/stab-types.C: New.
* g++.dg/stab-types.h: New.
@@ -920,8 +1024,8 @@
Radar 4300871
* g++.dg/bincl-2.C: New.
- * g++.dg/bincl-2.h: New.
- * g++.dg/bincl-22.h: New.
+ * g++.dg/bincl-2.h: New.
+ * g++.dg/bincl-22.h: New.
2005-10-13 Stuart Hastings <stuart@apple.com>
@@ -990,8 +1094,8 @@
2005-09-28 Devang Patel <dpatel@apple.com>
- * g++.dg/pch/pragma-1.C: New.
- * g++.dg/pch/pragma-1.Hs: New.
+ * g++.dg/pch/pragma-1.C: New.
+ * g++.dg/pch/pragma-1.Hs: New.
2005-09-28 Devang Patel <dpatel@apple.com>
@@ -1122,16 +1226,16 @@
2005-09-15 Devang Patel <dpatel@apple.com>
- dbxout_type rewrite.
- * gcc.dg/stabs-attrib-vect-darwin.c: Update.
- * gcc.dg/stabs-4209166.c: New.
- * gcc.dg/stabs-4223137.c: New.
- * gcc.dg/stabs-4232445.c: New.
+ dbxout_type rewrite.
+ * gcc.dg/stabs-attrib-vect-darwin.c: Update.
+ * gcc.dg/stabs-4209166.c: New.
+ * gcc.dg/stabs-4223137.c: New.
+ * gcc.dg/stabs-4232445.c: New.
* obj-c++.dg/stabs-2.mm: Update.
2005-09-15 Devang Patel <dpatel@apple.com>
- Radar 4241538
+ Radar 4241538
* gcc.dg/altivec-4241538.c: New.
2005-09-08 Dale Johannesen <dalej@apple.com>
@@ -1157,7 +1261,7 @@
2005-08-30 Fariborz Jahanian <fjahanian@apple.com>
- Radar 4235138
+ Radar 4235138
* g++.dg/asm-nested-struct-1.C: New.
* gcc.apple/asm-nested-struct-1.c: New.
@@ -1394,7 +1498,7 @@
2005-07-26 Dale Johannesen <dalej@apple.com>
- * gcc.apple/4182984.c: New.
+ * gcc.apple/4182984.c: New.
2005-07-22 Devang Patel <dpatel@apple.com>
@@ -1478,9 +1582,9 @@
2005-07-06 Dale Johannesen <dalej@apple.com>
- Radar 4158356
- * gcc.apple/4158356.c: New.
- * g++.dg/tree-ssa/ssa-sra-2.C: Modified to pass.
+ Radar 4158356
+ * gcc.apple/4158356.c: New.
+ * g++.dg/tree-ssa/ssa-sra-2.C: Modified to pass.
2005-07-04 Devang Patel <dpatel@apple.com>
@@ -1571,7 +1675,7 @@
2005-06-20 Dale Johannesen <dalej@apple.com>
Radar 4151537
- * objc.dg/nopicsetup.m: New.
+ * objc.dg/nopicsetup.m: New.
2005-06-15 Devang Patel <dpatel@apple.com>
@@ -1792,8 +1896,8 @@
2005-04-14 Devang Patel <dpatel@apple.com>
Radar 3972515
- * lib/target-supports.exp (check_effective_target_vect_shif): New.
- * gcc.dg/vect/vect-shift-1.c: New test.
+ * lib/target-supports.exp (check_effective_target_vect_shif): New.
+ * gcc.dg/vect/vect-shift-1.c: New test.
2005-04-12 Devang Patel <dpatel@apple.com>
@@ -1833,7 +1937,7 @@
2005-04-07 Devang Patel <dpatel@apple.com>
Radar 4069922
- * g++.dg/tree-sra/ssa-sra-3.C: New test.
+ * g++.dg/tree-sra/ssa-sra-3.C: New test.
2005-04-02 Ziemowit Laski <zlaski@apple.com>
@@ -1940,7 +2044,7 @@
2005-01-18 Michael Matz <matz@suse.de>
- * gcc.dg/Wno-pointer-sign.c: New test for -Wno-pointer-sign.
+ * gcc.dg/Wno-pointer-sign.c: New test for -Wno-pointer-sign.
2005-02-22 Dale Johannesen <dalej@apple.com>
@@ -2032,7 +2136,7 @@
2005-02-16 Fariborz Jahanian <fjahanian@apple.com>
- Radar 3970655
+ Radar 3970655
* g++.dg/asm-function-13.C: New.
* gcc.apple/asm-function-13.c: New.
@@ -2056,7 +2160,7 @@
2005-02-11 Devang Patel <dpatel@apple.com>
Radar 3996800
- * gcc.dg/pch/pch.exp: Test MACOSX_DEPLOYMENT_TARGET and -save-temps.
+ * gcc.dg/pch/pch.exp: Test MACOSX_DEPLOYMENT_TARGET and -save-temps.
2005-02-10 Ziemowit Laski <zlaski@apple.com>
@@ -2121,8 +2225,8 @@
2004-01-31 Devang Patel <dpatel@apple.com>
- Radar 3978580
- * gcc.apple/const-cfstring-4.c: New test.
+ Radar 3978580
+ * gcc.apple/const-cfstring-4.c: New test.
2005-01-31 Dale Johannesen <dalej@apple.com>
@@ -2150,7 +2254,7 @@
2005-01-27 Matt Austern <austern@apple.com>
- Radar 3971445
+ Radar 3971445
* obj-c++.dg/template-5.mm: New.
* obj-c++.dg/template-6.mm: New.
@@ -2162,7 +2266,7 @@
2005-01-26 Matt Austern <austern@apple.com>
Radar 3972840
- * g++.dg/kext9.C: New.
+ * g++.dg/kext9.C: New.
2005-01-26 Devang Patel <dpatel@apple.com>
@@ -2241,8 +2345,8 @@
2005-01-19 Matt Austern <austern@apple.com>
- Radar 3960754
- * obj-c++.dg/overload-1.mm: New.
+ Radar 3960754
+ * obj-c++.dg/overload-1.mm: New.
2005-01-17 Ziemowit Laski <zlaski@apple.com>
@@ -2304,10 +2408,10 @@
* gcc.apple/notailcall-1.c: Now tests PPC in addition to x86.
2005-01-06 Andrew Pinski <pinskia@physics.uc.edu>
- Stuart Hastings <stuart@apple.com>
+ Stuart Hastings <stuart@apple.com>
- Radar 3830232
- * gcc/testsuite/gcc.apple/notailcall-1.c: New testcase (also recorded in gcc/ChangeLog.apple-ppc).
+ Radar 3830232
+ * gcc/testsuite/gcc.apple/notailcall-1.c: New testcase (also recorded in gcc/ChangeLog.apple-ppc).
2005-01-06 Robert Bowdidge <bowdidge@apple.com>
@@ -2315,7 +2419,7 @@
2005-01-06 Ziemowit Laski <zlaski@apple.com>
- Radar 3925982
+ Radar 3925982
* obj-c++.dg/encode-1.mm: New.
* objc.dg/encode-6.m: New.
@@ -2333,7 +2437,7 @@
* obj-c++.dg/empty-private-1.mm: New test.
2005-01-05 Mark Mitchell <mark@codesourcery.com>
- Matt Austern <austern@apple.com>
+ Matt Austern <austern@apple.com>
Radar 3934803
PR c++/18369
@@ -2366,14 +2470,14 @@
2004-12-20 Matt Austern <austern@apple.com>
- Radar 3845716
- PR c++/19044
+ Radar 3845716
+ PR c++/19044
* g++.dg/ext/builtin6.C: New
2004-12-16 Ziemowit Laski <zlaski@apple.com>
Radar 3921172 (from mainline)
- * objc.dg/stabs-1.m: New.
+ * objc.dg/stabs-1.m: New.
2004-12-15 Dale Johannesen <dalej@apple.com>
@@ -2412,8 +2516,8 @@
2004-12-10 Devang Patel <dpatel@apple.com>
- Radar 3909961
- * gcc.apple/Wextra-tokens-2.c: New test.
+ Radar 3909961
+ * gcc.apple/Wextra-tokens-2.c: New test.
2004-12-07 Dale Johannesen <dalej@apple.com>
@@ -2499,7 +2603,7 @@
2004-11-08 Ziemowit Laski <zlaski@apple.com>
- Radar 3853429
+ Radar 3853429
* objc.dg/const-str-8.m, objc.dg/const-str-9.m,
objc.dg/const-cfstring-3.m, objc.dg/const-cfstring-4.m:
New tests.
@@ -2533,7 +2637,7 @@
2004-10-29 Devang Patel <dpatel@apple.com>
- FSF merge cleanup.
+ FSF merge cleanup.
* gcc.dg/tree-ssa-vect/ifc-03.c: Remove test.
* gcc.dg/tree-ssa-vect/ifc-03.c: Remove.test.
* gcc.dg/tree-ssa-vect/tree-vect.h (exit): Add extern decl.
@@ -2624,9 +2728,9 @@
2004-10-18 Robert Bowdidge <bowdidge@apple.com>
- Radar 3843618
- * Add g++.dg/lookup/koenig4.C: Bring the fix for PR/17829 over
- from mainline so that Finder_FE will build again.
+ Radar 3843618
+ * Add g++.dg/lookup/koenig4.C: Bring the fix for PR/17829 over
+ from mainline so that Finder_FE will build again.
2004-10-18 Ziemowit Laski <zlaski@apple.com>
@@ -2635,8 +2739,8 @@
2004-10-18 Devang Patel <dpatel@apple.com>
- Radar 3753408
- * gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c: Remove test.
+ Radar 3753408
+ * gcc.dg/tree-ssa-vect/tree-ssa-vect-21.c: Remove test.
2004-10-13 Geoffrey Keating <geoffk@apple.com>
@@ -2718,11 +2822,11 @@
Remove Symbol Separation.
Radar 3555440. Reviewed by Mike Stump.
- * gcc.dg/ss/README: Remove.
- * gcc.dg/ss/ss.exp: Remove.
- * gcc.dg/ss/one.c: Remove.
- * gcc.dg/ss/one.ssh: Remove.
- * gcc.dg/ss/ss-cmd1.c: Remove.
+ * gcc.dg/ss/README: Remove.
+ * gcc.dg/ss/ss.exp: Remove.
+ * gcc.dg/ss/one.c: Remove.
+ * gcc.dg/ss/one.ssh: Remove.
+ * gcc.dg/ss/ss-cmd1.c: Remove.
2004-08-03 Stan Shebs <shebs@apple.com>
@@ -2739,8 +2843,8 @@
2004-07-30 Devang Patel <dpatel@apple.com>
- Re-implement -fwritable-strings support.
- Radar : 3699482
+ Re-implement -fwritable-strings support.
+ Radar : 3699482
* gcc.apple/fwritable-strings.c: New test.
diff --git a/gcc/testsuite/g++.apple/asm-block-13.C b/gcc/testsuite/g++.apple/asm-block-13.C
index d9314468e8e..e6e26c397e8 100644
--- a/gcc/testsuite/g++.apple/asm-block-13.C
+++ b/gcc/testsuite/g++.apple/asm-block-13.C
@@ -123,6 +123,62 @@ asm void bar() { fool:
cmp eax, eax
cmp fool, eax
cmp eax, fool
+ cmpeqpd xmm0, xmm0
+ cmpeqpd xmm0, fool
+ cmpeqps xmm0, xmm0
+ cmpeqps xmm0, fool
+ cmpeqsd xmm0, xmm0
+ cmpeqsd xmm0, fool
+ cmpeqss xmm0, xmm0
+ cmpeqss xmm0, fool
+ cmplepd xmm0, xmm0
+ cmplepd xmm0, fool
+ cmpleps xmm0, xmm0
+ cmpleps xmm0, fool
+ cmplesd xmm0, xmm0
+ cmplesd xmm0, fool
+ cmpless xmm0, xmm0
+ cmpless xmm0, fool
+ cmpltpd xmm0, xmm0
+ cmpltpd xmm0, fool
+ cmpltps xmm0, xmm0
+ cmpltps xmm0, fool
+ cmpltsd xmm0, xmm0
+ cmpltsd xmm0, fool
+ cmpltss xmm0, xmm0
+ cmpltss xmm0, fool
+ cmpneqpd xmm0, xmm0
+ cmpneqpd xmm0, fool
+ cmpneqps xmm0, xmm0
+ cmpneqps xmm0, fool
+ cmpneqsd xmm0, xmm0
+ cmpneqsd xmm0, fool
+ cmpneqss xmm0, xmm0
+ cmpneqss xmm0, fool
+ cmpnlepd xmm0, xmm0
+ cmpnlepd xmm0, fool
+ cmpnleps xmm0, xmm0
+ cmpnleps xmm0, fool
+ cmpnlesd xmm0, xmm0
+ cmpnlesd xmm0, fool
+ cmpnless xmm0, xmm0
+ cmpnless xmm0, fool
+ cmpnltpd xmm0, xmm0
+ cmpnltpd xmm0, fool
+ cmpnltps xmm0, xmm0
+ cmpnltps xmm0, fool
+ cmpnltsd xmm0, xmm0
+ cmpnltsd xmm0, fool
+ cmpnltss xmm0, xmm0
+ cmpnltss xmm0, fool
+ cmpordpd xmm0, xmm0
+ cmpordpd xmm0, fool
+ cmpordps xmm0, xmm0
+ cmpordps xmm0, fool
+ cmpordsd xmm0, xmm0
+ cmpordsd xmm0, fool
+ cmpordss xmm0, xmm0
+ cmpordss xmm0, fool
cmppd xmm0, xmm0, 4
cmppd xmm0, fool, 4
cmpps xmm0, xmm0, 4
@@ -131,6 +187,14 @@ asm void bar() { fool:
cmpsd xmm0, fool, 4
cmpss xmm0, xmm0, 4
cmpss xmm0, fool, 4
+ cmpunordpd xmm0, xmm0
+ cmpunordpd xmm0, fool
+ cmpunordps xmm0, xmm0
+ cmpunordps xmm0, fool
+ cmpunordsd xmm0, xmm0
+ cmpunordsd xmm0, fool
+ cmpunordss xmm0, xmm0
+ cmpunordss xmm0, fool
cmpxchg fool, eax
cmpxchg eax, eax
comisd xmm0, xmm0
diff --git a/gcc/testsuite/g++.apple/asm-block-31.C b/gcc/testsuite/g++.apple/asm-block-31.C
index ea3f1e9b270..acb0c06b473 100644
--- a/gcc/testsuite/g++.apple/asm-block-31.C
+++ b/gcc/testsuite/g++.apple/asm-block-31.C
@@ -1,6 +1,6 @@
/* APPLE LOCAL file CW asm blocks */
/* { dg-do assemble { target i?86*-*-darwin* } } */
-/* { dg-options { -fasm-blocks -msse3 } } */
+/* { dg-options { -fasm-blocks -msse3 -mdynamic-no-pic } } */
/* Radar 4319881 */
void foo() {
diff --git a/gcc/testsuite/g++.apple/asm-block-35.C b/gcc/testsuite/g++.apple/asm-block-35.C
index 6d7b3bb1f6d..33bfede68d0 100644
--- a/gcc/testsuite/g++.apple/asm-block-35.C
+++ b/gcc/testsuite/g++.apple/asm-block-35.C
@@ -1,6 +1,6 @@
/* APPLE LOCAL file CW asm blocks */
/* { dg-do assemble { target i?86*-*-darwin* } } */
-/* { dg-options { -fasm-blocks -msse3 } } */
+/* { dg-options { -fasm-blocks -msse3 -mdynamic-no-pic } } */
/* Radar 4371551 */
unsigned long long __attribute__ ((aligned(8))) MaskMoveTable[8];
diff --git a/gcc/testsuite/g++.apple/asm-block-49.C b/gcc/testsuite/g++.apple/asm-block-49.C
new file mode 100644
index 00000000000..0a51893041b
--- /dev/null
+++ b/gcc/testsuite/g++.apple/asm-block-49.C
@@ -0,0 +1,17 @@
+/* APPLE LOCAL file CW asm blocks */
+/* { dg-do assemble { target *-*-darwin* } } */
+/* { dg-options { -fasm-blocks } } */
+/* Radar 4477426 4466768 */
+
+void foo() {
+ asm .machine all
+#ifdef __i386__
+ asm .word 1
+#endif
+ asm opword 1
+ asm .byte 1,2
+ asm .short 1,2
+ asm .long 1,2
+ asm .quad 3,4,5
+ asm _emit 5, 6
+}
diff --git a/gcc/testsuite/g++.apple/asm-block-50.C b/gcc/testsuite/g++.apple/asm-block-50.C
new file mode 100644
index 00000000000..bb5f064d8b0
--- /dev/null
+++ b/gcc/testsuite/g++.apple/asm-block-50.C
@@ -0,0 +1,38 @@
+/* APPLE LOCAL file CW asm blocks */
+/* { dg-do assemble { target i?86*-*-darwin* } } */
+/* { dg-options { -fasm-blocks -msse3 } } */
+/* Radar 4505741 */
+
+static int c[5];
+void foo(int pa[5], int j) {
+ unsigned int *ptr = (unsigned int *)0x12345678;
+ static int b[5];
+ int i;
+ int a[5];
+ _asm {
+ mov esi, [ptr][0]
+ mov esi, [ptr]
+ mov esi, [esi][eax]
+ mov esi, [esi+eax]
+ mov esi, [esi+eax+4]
+ mov esi, [esi][eax][4]
+ mov esi, [a][4]
+ mov esi, [pa]
+ mov esi, [j]
+ mov esi, [i]
+ mov esi, i
+ mov esi, [b][4] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [c][4] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [b] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [c] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [ptr][4] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr+4] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr][eax] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr+eax] /* { dg-warning "will consume extra register" } */
+ mov esi, [-4][pa+esi] /* { dg-warning "will consume extra register" } */
+ mov esi, [-4][j+esi] /* { dg-warning "will consume extra register" } */
+ mov esi, [pa-4+esi] /* { dg-warning "will consume extra register" } */
+ mov esi, [a][3] /* { dg-warning "will consume extra register" } */
+ jmp [a+4*ebx] /* { dg-warning "will consume extra register" } */
+ }
+}
diff --git a/gcc/testsuite/g++.apple/asm-block-51.C b/gcc/testsuite/g++.apple/asm-block-51.C
new file mode 100644
index 00000000000..91db1e8c0c0
--- /dev/null
+++ b/gcc/testsuite/g++.apple/asm-block-51.C
@@ -0,0 +1,8 @@
+/* APPLE LOCAL file CW asm blocks */
+/* { dg-do assemble { target i?86*-*-darwin* } } */
+/* { dg-options { -fasm-blocks } } */
+/* Radar 4505697 */
+
+void foo() {
+ asm movzx eax, [edi+8]
+}
diff --git a/gcc/testsuite/g++.dg/R4475058.C b/gcc/testsuite/g++.dg/R4475058.C
new file mode 100644
index 00000000000..5454b16edc1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/R4475058.C
@@ -0,0 +1,54 @@
+/* APPLE LOCAL file Radar 4475058 */
+/* { dg-compile } */
+/* { dg-options "-O" } */
+
+struct C1
+{
+};
+
+template <class T> class T1
+{
+private:
+ T * _p;
+public:
+ T * operator -> () { return _p; }
+};
+
+class C2 : public C1
+{
+};
+
+class C3
+{
+public:
+ C1 * _c3f1(C2 *k, C1 *v);
+ C2 * c3f1(C2 *k, C2 *v) { return (C2 *)_c3f1(k, v); }
+};
+
+typedef T1<C3> RC3;
+class C4
+{
+public:
+ void c4f1( C4 * p);
+protected:
+ RC3 _pN;
+};
+
+C2 *foo (C2 **p)
+{
+ return *p;
+}
+
+class C5 : public C2
+{
+};
+
+void C4::c4f1( C4 * p)
+{
+ C2 * k;
+ C5 * n;
+
+ while ( ( n = (static_cast<C5*>(foo (&k)))))
+ _pN->c3f1( k, n);
+}
+
diff --git a/gcc/testsuite/g++.dg/bitreverse-10.C b/gcc/testsuite/g++.dg/bitreverse-10.C
index 8e22c88b63e..28f9cb60d77 100644
--- a/gcc/testsuite/g++.dg/bitreverse-10.C
+++ b/gcc/testsuite/g++.dg/bitreverse-10.C
@@ -3,10 +3,10 @@
extern "C" void abort();
typedef struct TestStateNorm
{
- unsigned int fBlah : 7; //
+ unsigned int fBlah : 7; //
unsigned int fUnused : 2; // Currently Unused
unsigned int : 0;
- unsigned int fBlah2 : 7; //
+ unsigned int fBlah2 : 7; //
unsigned int fUnused2: 2; // Currently Unused
} TestStateNorm;
@@ -18,12 +18,13 @@ union u1 {
} unorm = { 5, 1, 6, 2 };
#pragma reverse_bitfields on
-typedef struct TestState
+#pragma ms_struct on
+typedef struct TestState
{
- unsigned int fBlah : 7; //
+ unsigned int fBlah : 7; //
unsigned int fUnused : 2; // Currently Unused
unsigned int : 0;
- unsigned int fBlah2 : 7; //
+ unsigned int fBlah2 : 7; //
unsigned int fUnused2 : 2; // Currently Unused
} TestState;
diff --git a/gcc/testsuite/g++.dg/bitreverse-23.C b/gcc/testsuite/g++.dg/bitreverse-23.C
index 50710b9dab8..b8df433702f 100644
--- a/gcc/testsuite/g++.dg/bitreverse-23.C
+++ b/gcc/testsuite/g++.dg/bitreverse-23.C
@@ -4,7 +4,8 @@ extern "C" void abort();
/* Check that layout works in presence of things other than
data members. */
#pragma reverse_bitfields on
-class X {
+#pragma ms_struct on
+class X {
public:
int x : 8;
static int y;
diff --git a/gcc/testsuite/g++.dg/pascal-strings-2.C b/gcc/testsuite/g++.dg/pascal-strings-2.C
index e74c67f89c7..5fa350e5329 100644
--- a/gcc/testsuite/g++.dg/pascal-strings-2.C
+++ b/gcc/testsuite/g++.dg/pascal-strings-2.C
@@ -4,7 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-fpascal-strings" } */
-const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-warning "unknown escape sequence" } */
+const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-bogus "unknown escape sequence" } */
const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-warning "unknown escape sequence" } */
const wchar_t *initErr0 = "\pHi"; /* { dg-error "cannot convert" } */
diff --git a/gcc/testsuite/gcc.apple/4516827.c b/gcc/testsuite/gcc.apple/4516827.c
new file mode 100644
index 00000000000..e439c40625a
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/4516827.c
@@ -0,0 +1,67 @@
+/* APPLE LOCAL file 4516827 PR 26643 */
+/* { dg-options "-std=c99 -O1" } */
+/* { dg-do run } */
+#include <string.h>
+extern void abort(void);
+
+typedef union
+{
+ long rgb;
+ struct
+ {
+ unsigned char unused;
+ unsigned char ciBlue;
+ unsigned char ciGreen;
+ unsigned char ciRed;
+ } cis;
+} CVTest;
+
+int validate (long) __attribute__((noinline));
+int validate (long a) {
+ if (a != 0)
+ abort();
+}
+
+int placeholder (unsigned char, unsigned char, unsigned char) __attribute((noinline));
+int placeholder (unsigned char a, unsigned char b, unsigned char c) {
+ a; b; c; }
+
+typedef unsigned char bool;
+int main (int argc, char * const argv[]) {
+
+ long index;
+ const long kNumCV = 3;
+ CVTest theCV[kNumCV];
+
+ memset(theCV, 0, sizeof(theCV));
+
+ theCV[0].cis.ciRed = 10;
+ theCV[0].cis.ciGreen = 10;
+ theCV[0].cis.ciBlue = 10;
+
+ theCV[1].cis.ciRed = 1;
+ theCV[1].cis.ciGreen = 1;
+ theCV[1].cis.ciBlue = 1;
+
+ theCV[2].cis.ciRed = 0;
+ theCV[2].cis.ciGreen = 0;
+ theCV[2].cis.ciBlue = 0;
+
+ CVTest *hpcvT = &theCV[0];
+ for (index = 0; index < kNumCV; ++index)
+ {
+ bool a, b, c;
+ placeholder(hpcvT->cis.ciRed, hpcvT->cis.ciGreen, hpcvT->cis.ciBlue);
+
+ a = (hpcvT->cis.ciRed != hpcvT->cis.ciGreen);
+ b = (hpcvT->cis.ciGreen != hpcvT->cis.ciBlue);
+ c = ((hpcvT->cis.ciRed != hpcvT->cis.ciGreen) || (hpcvT->cis.ciGreen != hpcvT->cis.ciBlue));
+ validate ((long)a);
+ validate ((long)b);
+ validate ((long)c);
+ hpcvT++;
+ }
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.apple/R4499790-2.c b/gcc/testsuite/gcc.apple/R4499790-2.c
new file mode 100644
index 00000000000..9c1d1b7db01
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/R4499790-2.c
@@ -0,0 +1,21 @@
+/* Test case for radar 4499790 */
+/* { dg-do run } */
+/* { dg-options "-fpascal-strings" } */
+
+typedef __WCHAR_TYPE__ wchar_t;
+extern void abort (void);
+int main(int argc, char* argv[])
+{
+
+ char st[] = "\pfoo"; // pascal string
+ wchar_t wt[] = L"\pbar"; // pascal Unicode string
+
+ if (st[0] != 3)
+ abort ();
+ if (wt[0] != 3)
+ abort ();
+
+ return 0;
+}
+
+
diff --git a/gcc/testsuite/gcc.apple/R4499790.c b/gcc/testsuite/gcc.apple/R4499790.c
new file mode 100644
index 00000000000..83bebf869e2
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/R4499790.c
@@ -0,0 +1,22 @@
+/* Test case for radar 4499790 */
+/* { dg-do run } */
+/* { dg-options "-fpascal-strings -fshort-wchar" } */
+
+extern void abort (void);
+typedef unsigned short UInt16;
+typedef UInt16 UniChar;
+int main(int argc, char* argv[])
+{
+
+ char st[] = "\pfoo"; // pascal string
+ UniChar wt[] = L"\pbar"; // pascal Unicode string
+
+ if (st[0] != 3)
+ abort ();
+ if (wt[0] != 3)
+ abort ();
+
+ return 0;
+}
+
+
diff --git a/gcc/testsuite/gcc.apple/asm-block-13.c b/gcc/testsuite/gcc.apple/asm-block-13.c
index d9314468e8e..e6e26c397e8 100644
--- a/gcc/testsuite/gcc.apple/asm-block-13.c
+++ b/gcc/testsuite/gcc.apple/asm-block-13.c
@@ -123,6 +123,62 @@ asm void bar() { fool:
cmp eax, eax
cmp fool, eax
cmp eax, fool
+ cmpeqpd xmm0, xmm0
+ cmpeqpd xmm0, fool
+ cmpeqps xmm0, xmm0
+ cmpeqps xmm0, fool
+ cmpeqsd xmm0, xmm0
+ cmpeqsd xmm0, fool
+ cmpeqss xmm0, xmm0
+ cmpeqss xmm0, fool
+ cmplepd xmm0, xmm0
+ cmplepd xmm0, fool
+ cmpleps xmm0, xmm0
+ cmpleps xmm0, fool
+ cmplesd xmm0, xmm0
+ cmplesd xmm0, fool
+ cmpless xmm0, xmm0
+ cmpless xmm0, fool
+ cmpltpd xmm0, xmm0
+ cmpltpd xmm0, fool
+ cmpltps xmm0, xmm0
+ cmpltps xmm0, fool
+ cmpltsd xmm0, xmm0
+ cmpltsd xmm0, fool
+ cmpltss xmm0, xmm0
+ cmpltss xmm0, fool
+ cmpneqpd xmm0, xmm0
+ cmpneqpd xmm0, fool
+ cmpneqps xmm0, xmm0
+ cmpneqps xmm0, fool
+ cmpneqsd xmm0, xmm0
+ cmpneqsd xmm0, fool
+ cmpneqss xmm0, xmm0
+ cmpneqss xmm0, fool
+ cmpnlepd xmm0, xmm0
+ cmpnlepd xmm0, fool
+ cmpnleps xmm0, xmm0
+ cmpnleps xmm0, fool
+ cmpnlesd xmm0, xmm0
+ cmpnlesd xmm0, fool
+ cmpnless xmm0, xmm0
+ cmpnless xmm0, fool
+ cmpnltpd xmm0, xmm0
+ cmpnltpd xmm0, fool
+ cmpnltps xmm0, xmm0
+ cmpnltps xmm0, fool
+ cmpnltsd xmm0, xmm0
+ cmpnltsd xmm0, fool
+ cmpnltss xmm0, xmm0
+ cmpnltss xmm0, fool
+ cmpordpd xmm0, xmm0
+ cmpordpd xmm0, fool
+ cmpordps xmm0, xmm0
+ cmpordps xmm0, fool
+ cmpordsd xmm0, xmm0
+ cmpordsd xmm0, fool
+ cmpordss xmm0, xmm0
+ cmpordss xmm0, fool
cmppd xmm0, xmm0, 4
cmppd xmm0, fool, 4
cmpps xmm0, xmm0, 4
@@ -131,6 +187,14 @@ asm void bar() { fool:
cmpsd xmm0, fool, 4
cmpss xmm0, xmm0, 4
cmpss xmm0, fool, 4
+ cmpunordpd xmm0, xmm0
+ cmpunordpd xmm0, fool
+ cmpunordps xmm0, xmm0
+ cmpunordps xmm0, fool
+ cmpunordsd xmm0, xmm0
+ cmpunordsd xmm0, fool
+ cmpunordss xmm0, xmm0
+ cmpunordss xmm0, fool
cmpxchg fool, eax
cmpxchg eax, eax
comisd xmm0, xmm0
diff --git a/gcc/testsuite/gcc.apple/asm-block-31.c b/gcc/testsuite/gcc.apple/asm-block-31.c
index ea3f1e9b270..acb0c06b473 100644
--- a/gcc/testsuite/gcc.apple/asm-block-31.c
+++ b/gcc/testsuite/gcc.apple/asm-block-31.c
@@ -1,6 +1,6 @@
/* APPLE LOCAL file CW asm blocks */
/* { dg-do assemble { target i?86*-*-darwin* } } */
-/* { dg-options { -fasm-blocks -msse3 } } */
+/* { dg-options { -fasm-blocks -msse3 -mdynamic-no-pic } } */
/* Radar 4319881 */
void foo() {
diff --git a/gcc/testsuite/gcc.apple/asm-block-35.c b/gcc/testsuite/gcc.apple/asm-block-35.c
index 6d7b3bb1f6d..33bfede68d0 100644
--- a/gcc/testsuite/gcc.apple/asm-block-35.c
+++ b/gcc/testsuite/gcc.apple/asm-block-35.c
@@ -1,6 +1,6 @@
/* APPLE LOCAL file CW asm blocks */
/* { dg-do assemble { target i?86*-*-darwin* } } */
-/* { dg-options { -fasm-blocks -msse3 } } */
+/* { dg-options { -fasm-blocks -msse3 -mdynamic-no-pic } } */
/* Radar 4371551 */
unsigned long long __attribute__ ((aligned(8))) MaskMoveTable[8];
diff --git a/gcc/testsuite/gcc.apple/asm-block-46.c b/gcc/testsuite/gcc.apple/asm-block-46.c
index 5e97beddf17..03149787194 100644
--- a/gcc/testsuite/gcc.apple/asm-block-46.c
+++ b/gcc/testsuite/gcc.apple/asm-block-46.c
@@ -4,5 +4,5 @@
/* Radar 4419735 */
void foo() {
- asm fisubr DWORD PTR[WORD PTR esi]
-} /* { dg-error "too many types in []" } */
+ asm fisubr DWORD PTR[WORD PTR esi] /* { dg-error "too many types in []" } */
+}
diff --git a/gcc/testsuite/gcc.apple/asm-block-49.c b/gcc/testsuite/gcc.apple/asm-block-49.c
new file mode 100644
index 00000000000..45f499216f8
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/asm-block-49.c
@@ -0,0 +1,17 @@
+/* APPLE LOCAL file CW asm blocks */
+/* { dg-do assemble { target *-*-darwin* } } */
+/* { dg-options { -fasm-blocks } } */
+/* Radar 4477426 4466768 */
+
+void foo() {
+ asm .machine all
+#ifdef __i386__
+ asm .word 1
+#endif
+ asm opword 1
+ asm .byte 1,2
+ /* asm .short 1,2 */
+ /* asm .long 1,2 */
+ asm .quad 3,4,5
+ asm _emit 5, 6
+}
diff --git a/gcc/testsuite/gcc.apple/asm-block-50.c b/gcc/testsuite/gcc.apple/asm-block-50.c
new file mode 100644
index 00000000000..bb5f064d8b0
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/asm-block-50.c
@@ -0,0 +1,38 @@
+/* APPLE LOCAL file CW asm blocks */
+/* { dg-do assemble { target i?86*-*-darwin* } } */
+/* { dg-options { -fasm-blocks -msse3 } } */
+/* Radar 4505741 */
+
+static int c[5];
+void foo(int pa[5], int j) {
+ unsigned int *ptr = (unsigned int *)0x12345678;
+ static int b[5];
+ int i;
+ int a[5];
+ _asm {
+ mov esi, [ptr][0]
+ mov esi, [ptr]
+ mov esi, [esi][eax]
+ mov esi, [esi+eax]
+ mov esi, [esi+eax+4]
+ mov esi, [esi][eax][4]
+ mov esi, [a][4]
+ mov esi, [pa]
+ mov esi, [j]
+ mov esi, [i]
+ mov esi, i
+ mov esi, [b][4] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [c][4] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [b] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [c] /* { dg-warning "non-pic addressing form not suitible for pic code" } */
+ mov esi, [ptr][4] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr+4] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr][eax] /* { dg-warning "will consume extra register" } */
+ mov esi, [ptr+eax] /* { dg-warning "will consume extra register" } */
+ mov esi, [-4][pa+esi] /* { dg-warning "will consume extra register" } */
+ mov esi, [-4][j+esi] /* { dg-warning "will consume extra register" } */
+ mov esi, [pa-4+esi] /* { dg-warning "will consume extra register" } */
+ mov esi, [a][3] /* { dg-warning "will consume extra register" } */
+ jmp [a+4*ebx] /* { dg-warning "will consume extra register" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.apple/asm-block-51.c b/gcc/testsuite/gcc.apple/asm-block-51.c
new file mode 100644
index 00000000000..91db1e8c0c0
--- /dev/null
+++ b/gcc/testsuite/gcc.apple/asm-block-51.c
@@ -0,0 +1,8 @@
+/* APPLE LOCAL file CW asm blocks */
+/* { dg-do assemble { target i?86*-*-darwin* } } */
+/* { dg-options { -fasm-blocks } } */
+/* Radar 4505697 */
+
+void foo() {
+ asm movzx eax, [edi+8]
+}
diff --git a/gcc/testsuite/gcc.apple/asm-function-10.c b/gcc/testsuite/gcc.apple/asm-function-10.c
index 46c5cb09591..8446c610f81 100644
--- a/gcc/testsuite/gcc.apple/asm-function-10.c
+++ b/gcc/testsuite/gcc.apple/asm-function-10.c
@@ -4,13 +4,12 @@
asm void foo()
{
- lis r1,(kUndefindedConstant<<10)|(3<<5)|(7)
- rlwinm r0,r2,16+kUndefindedConstant,31 /* { dg-error "block assembly operand not recognized" } */
- cmpwi cr7,r1,kUndefindedConstant-1 /* { dg-error "block assembly operand not recognized" } */
-} /* { dg-error "block assembly operand not recognized" } */
+ lis r1,(kUndefC<<10)|(3<<5)|(7) /* { dg-error "block assembly operand not recognized" } */
+ rlwinm r0,r2,16+kUndefC,31 /* { dg-error "block assembly operand not recognized" } */
+ cmpwi cr7,r1,kUndefC-1 /* { dg-error "block assembly operand not recognized" } */
+}
int main (int argc, char * const argv[])
{
- foo();
+ foo();
}
-
diff --git a/gcc/testsuite/gcc.apple/bitreverse-1.c b/gcc/testsuite/gcc.apple/bitreverse-1.c
index 4a38bca6bb6..371700a0059 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-1.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-1.c
@@ -7,16 +7,16 @@
/*
Fun with bitfields!
-
+
This needs to generate the same output when compiled with CodeWarrior and
with XCode. Following is the output I see.
-
+
CodeWarrior:
-
+
u1: 0x0000808b
u2: 0x51010001 0x00004045
-
-
+
+
XCode:
u1: 0xa2020002
@@ -25,6 +25,7 @@
#pragma reverse_bitfields on
+#pragma ms_struct on
typedef struct
{
@@ -88,7 +89,7 @@ int main()
bitfields.u2.bits.b8 = 1;
bitfields.u2.bits.b9 = 1;
- if (bitfields.u1.i1 != 0x0000808b ||
+ if (bitfields.u1.i1 != 0x0000808b ||
bitfields.u2.ints.i2 != 0x51010001 ||
bitfields.u2.ints.i3 != 0x00004045)
return 42;
diff --git a/gcc/testsuite/gcc.apple/bitreverse-10.c b/gcc/testsuite/gcc.apple/bitreverse-10.c
index 06fd4db922b..ebef4128dc5 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-10.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-10.c
@@ -4,10 +4,10 @@
extern void abort();
typedef struct TestStateNorm
{
- unsigned int fBlah : 7; //
+ unsigned int fBlah : 7; //
unsigned int fUnused : 2; // Currently Unused
unsigned int : 0;
- unsigned int fBlah2 : 7; //
+ unsigned int fBlah2 : 7; //
unsigned int fUnused2: 2; // Currently Unused
} TestStateNorm;
@@ -19,12 +19,13 @@ union {
} unorm = { 5, 1, 6, 2 };
#pragma reverse_bitfields on
-typedef struct TestState
+#pragma ms_struct on
+typedef struct TestState
{
- unsigned int fBlah : 7; //
+ unsigned int fBlah : 7; //
unsigned int fUnused : 2; // Currently Unused
unsigned int : 0;
- unsigned int fBlah2 : 7; //
+ unsigned int fBlah2 : 7; //
unsigned int fUnused2 : 2; // Currently Unused
} TestState;
diff --git a/gcc/testsuite/gcc.apple/bitreverse-11.c b/gcc/testsuite/gcc.apple/bitreverse-11.c
index 70e63c2d7ec..6af03f5275d 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-11.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-11.c
@@ -6,6 +6,7 @@
extern void abort(void);
#pragma reverse_bitfields on
+#pragma ms_struct on
typedef struct
{
diff --git a/gcc/testsuite/gcc.apple/bitreverse-12.c b/gcc/testsuite/gcc.apple/bitreverse-12.c
index 3e8d5d8c6a8..76816a3f332 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-12.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-12.c
@@ -4,6 +4,7 @@
/* { dg-options "-w" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
#pragma pack(1)
typedef struct _bee
@@ -24,7 +25,7 @@ int LaLaFunction()
{
case 200 :
{
- if (rgbee[bar].wVal == 2)
+ if (rgbee[bar].wVal == 2)
goto LNeverChange;
break;
}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-13.c b/gcc/testsuite/gcc.apple/bitreverse-13.c
deleted file mode 100644
index 5d3d153f682..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-13.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* APPLE LOCAL file 4350099 */
-/* { dg-do run { target powerpc*-*-darwin* } } */
-extern void abort ();
-extern int printf(const char *, ...);
-typedef struct _foo1 FOO1;
-
-struct _foo1
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-FOO1 vDelim1 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f1() {
- union {
- unsigned int x;
- FOO1 y;
- } u;
- u.y = vDelim1;
- if (u.x != 0x80000000U)
- abort ();
-}
-/***********************************************/
-#pragma reverse_bitfields on
-
-typedef struct _foo2 FOO2;
-
-struct _foo2
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-FOO2 vDelim2 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f2() {
- union {
- unsigned int x;
- FOO2 y;
- } u;
- u.y = vDelim2;
- if (u.x != 1)
- abort();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-#pragma reverse_bitfields on
-
-typedef struct _foo3 FOO3;
-
-#pragma reverse_bitfields off
-struct _foo3
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-FOO3 vDelim3 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f3() {
- union {
- unsigned int x;
- FOO3 y;
- } u;
- u.y = vDelim3;
- if (u.x != 0x80000000U)
- abort ();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-#pragma reverse_bitfields on
-
-struct _foo4
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-typedef struct _foo4 FOO4;
-
-FOO4 vDelim4 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f4() {
- union {
- unsigned int x;
- FOO4 y;
- } u;
- u.y = vDelim4;
- if (u.x != 1)
- abort();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-#pragma reverse_bitfields on
-
-struct _foo5
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-#pragma reverse_bitfields off
-typedef struct _foo5 FOO5;
-
-FOO5 vDelim5 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f5() {
- union {
- unsigned int x;
- FOO5 y;
- } u;
- u.y = vDelim5;
- if (u.x != 1)
- abort();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-#pragma reverse_bitfields off
-
-typedef struct _foo6 FOO6;
-
-#pragma reverse_bitfields on
-struct _foo6
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-FOO6 vDelim6 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f6() {
- union {
- unsigned int x;
- FOO6 y;
- } u;
- u.y = vDelim6;
- if (u.x != 1)
- abort();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-#pragma reverse_bitfields off
-
-struct _foo7
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-typedef struct _foo7 FOO7;
-
-FOO7 vDelim7 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f7() {
- union {
- unsigned int x;
- FOO7 y;
- } u;
- u.y = vDelim7;
- if (u.x != 0x80000000U)
- abort ();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-#pragma reverse_bitfields off
-
-struct _foo8
-{
- unsigned int fTab:1,
- fSpace:1,
- fComma:1,
- fSemiColon:1,
- fCustom:1,
- fConsecutive:1,
- iTextDelm:2,
- chCustom:16;
-};
-
-#pragma reverse_bitfields on
-typedef struct _foo8 FOO8;
-
-FOO8 vDelim8 = {1, 0, 0, 0, 0, 0, 0, 0};
-void f8() {
- union {
- unsigned int x;
- FOO8 y;
- } u;
- u.y = vDelim8;
- if (u.x != 0x80000000U)
- abort ();
-}
-#pragma reverse_bitfields off
-/****************************************************/
-main() {
- f1(); f2(); f3(); f4(); f5(); f6(); f7(); f8();
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-14.c b/gcc/testsuite/gcc.apple/bitreverse-14.c
index 4b7790cf824..ed73891c9b9 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-14.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-14.c
@@ -2,6 +2,7 @@
/* { dg-do compile { target powerpc*-*-darwin* } } */
/* { dg-options "-std=gnu99" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
#pragma pack(push, 1)
typedef struct _kyc
diff --git a/gcc/testsuite/gcc.apple/bitreverse-15.c b/gcc/testsuite/gcc.apple/bitreverse-15.c
index 80f544445e0..6303aa20dcd 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-15.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-15.c
@@ -3,6 +3,7 @@
/* { dg-options "-std=gnu99" } */
extern void abort();
#pragma reverse_bitfields on
+#pragma ms_struct on
#pragma pack(push,2)
typedef struct _S2
{
diff --git a/gcc/testsuite/gcc.apple/bitreverse-16.c b/gcc/testsuite/gcc.apple/bitreverse-16.c
index ee9876b02aa..d3ef99f02f9 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-16.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-16.c
@@ -3,6 +3,7 @@ extern void abort();
/* { dg-do run { target powerpc*-*-darwin* } } */
/* { dg-options "-std=gnu99" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
#pragma pack(push,2)
typedef struct _S5
diff --git a/gcc/testsuite/gcc.apple/bitreverse-17.c b/gcc/testsuite/gcc.apple/bitreverse-17.c
index bfc0c0f5a34..f77744e271e 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-17.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-17.c
@@ -5,6 +5,7 @@
/* { dg-options "-std=gnu99" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
struct empty {};
struct uc0 { unsigned char content[0]; };
@@ -50,9 +51,9 @@ struct advance3 {
};
int main() {
-
+
if (sizeof(struct empty) !=0 ||
- sizeof(struct uc0) !=0
+ sizeof(struct uc0) !=0
|| sizeof(struct uc0_uib2) != 4
|| sizeof(struct nest_nest_uc0_uib3) != 4
|| sizeof(struct nest_empty_uib3) != 4
@@ -69,4 +70,3 @@ int main() {
return 42;
return 0;
}
- \ No newline at end of file
diff --git a/gcc/testsuite/gcc.apple/bitreverse-18.c b/gcc/testsuite/gcc.apple/bitreverse-18.c
index 8103aa080f7..41b975d470c 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-18.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-18.c
@@ -9,11 +9,12 @@ typedef unsigned short WORD;
typedef unsigned int DWORD;
#pragma reverse_bitfields on
+#pragma ms_struct on
#define USE_STRUCT_WRAPPER 0
#pragma pack(push, 2)
-typedef struct
+typedef struct
{
DWORD a;
#if USE_STRUCT_WRAPPER
diff --git a/gcc/testsuite/gcc.apple/bitreverse-19.c b/gcc/testsuite/gcc.apple/bitreverse-19.c
deleted file mode 100644
index 596c6745375..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-19.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* APPLE LOCAL file 4430139 */
-
-/* CW layout of this one is truly bizarre:
- 0000000000aaaaaabbbbbbbbbb000000
- 0000000000cccccccccccccccccccccc
-*/
-
-extern void abort();
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-typedef unsigned short WORD;
-typedef unsigned int DWORD;
-
-#pragma reverse_bitfields on
-
-#define USE_STRUCT_WRAPPER 0
-
-#pragma pack(push, 2)
-typedef struct
-{
- short a : 6;
- int b : 10;
- int c : 22;
-} Foo;
-typedef union { Foo x; int y[6]; } u1;
-#pragma pack(pop)
-
-
-int main(int argc, char* argv[])
-{
- int i;
- u1 U;
- for (i=0; i<6; i++)
- U.y[i] = 0;
- U.x.a = 1;
- U.x.b = 3;
- U.x.c = 5;
-
- if (sizeof(Foo) != 8
- || U.y[0] != 0x000100c0
- || U.y[1] != 0x00000005)
- abort();
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-2.c b/gcc/testsuite/gcc.apple/bitreverse-2.c
deleted file mode 100644
index ef74d8eb3ea..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-2.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* APPLE LOCAL file */
-#include <stdio.h>
-#include <string.h>
-
-/* Tests interleaving of bitfields and non-bitfields. Note that they
- overlap, so the code cannot possibly work, but bug compability is
- the requirement. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-
-#pragma reverse_bitfields on
-
-typedef struct
-{
- union
- {
- unsigned int i1;
- struct
- {
- unsigned int b1: 1;
- unsigned int b2: 2;
- unsigned int b3: 4;
- unsigned int b4: 8;
- unsigned int b5: 16;
- } bits;
- } u1;
- char baz;
- union
- {
- struct
- {
- unsigned int i2;
- unsigned int i3;
- unsigned int i4;
- } ints;
-
- struct
- {
- unsigned int b1: 16;
- unsigned int b2: 8;
- unsigned int b3: 4;
- unsigned int b4: 2;
- unsigned int b5: 1;
- char baz;
- unsigned int b6: 2;
- unsigned int b7: 4;
- char baz2;
- unsigned int b8: 8;
- unsigned int b9: 16;
- } bits;
- } u2;
-} Bitfields;
-
-
-int main()
-{
- Bitfields bitfields;
-
-
- memset(&bitfields, 0, sizeof(bitfields));
-
- bitfields.u1.bits.b1 = 1;
- bitfields.u1.bits.b2 = 1;
- bitfields.u1.bits.b3 = 1;
- bitfields.u1.bits.b4 = 1;
- bitfields.u1.bits.b5 = 1;
- bitfields.baz = 0x55;
- bitfields.u2.bits.b1 = 1;
- bitfields.u2.bits.b2 = 1;
- bitfields.u2.bits.b3 = 1;
- bitfields.u2.bits.b4 = 1;
- bitfields.u2.bits.b5 = 1;
- bitfields.u2.bits.baz = 0xaa; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b6 = 1;
- bitfields.u2.bits.b7 = 1;
- bitfields.u2.bits.baz2 = 0x33;
- bitfields.u2.bits.b8 = 1;
- bitfields.u2.bits.b9 = 1;
-
- if (bitfields.u1.i1 != 0x0000808b
- || bitfields.baz != 0x55
- || bitfields.u2.ints.i2 != 0x51010001
- || bitfields.u2.ints.i3 != 0x01003300
- || bitfields.u2.ints.i4 != 0x00000001
- || sizeof(bitfields) != 20)
- return 42;
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-20.c b/gcc/testsuite/gcc.apple/bitreverse-20.c
deleted file mode 100644
index 5e7726d3416..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-20.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* APPLE LOCAL file 4430139 */
-/* Same as bitreverse-19 without #pragma pack; it makes
- no difference in this case. */
-
-extern void abort();
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-typedef unsigned short WORD;
-typedef unsigned int DWORD;
-
-#pragma reverse_bitfields on
-
-#define USE_STRUCT_WRAPPER 0
-
-typedef struct
-{
- short a : 6;
- int b : 10;
- int c : 22;
-} Foo;
-typedef union { Foo x; int y[6]; } u1;
-
-int main(int argc, char* argv[])
-{
- int i;
- u1 U;
- for (i=0; i<6; i++)
- U.y[i] = 0;
- U.x.a = 1;
- U.x.b = 3;
- U.x.c = 5;
-
- if (sizeof(Foo) != 8
- || U.y[0] != 0x000100c0
- || U.y[1] != 0x00000005)
- abort();
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-21.c b/gcc/testsuite/gcc.apple/bitreverse-21.c
deleted file mode 100644
index 7b109f74e99..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-21.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* APPLE LOCAL file from 4431497 */
-/* Some truly bizarre layouts by CW. */
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-extern void abort();
-#pragma reverse_bitfields on
-
-#pragma pack(push,1)
-typedef struct _S3
-{
- unsigned char c1 : 8;
- unsigned short s1 : 8;
- unsigned short s2 : 8;
-} S3;
-
-typedef struct _S3W
-{
- S3 s3;
- unsigned char c;
-}S3W;
-/* c1 and s1 overlap. c and s2 overlap.
- Size is 3 although 4 bytes are accessed. */
-#pragma pack(pop)
-
-typedef union u3 { S3W ss; unsigned int v[6]; } U3;
-
-int TestS3(void)
-{
- U3 u = {0};
- u.ss.s3.c1 = 0x56;
- u.ss.s3.s1 = 0x78;
- u.ss.c = 0x90;
- u.ss.s3.s2 = 0xab;
-
- if (sizeof(S3) != 3 || sizeof(S3W) != 4 ||
- u.ss.s3.s1 != 0x78 || u.ss.s3.s2 != 0xab ||
- u.ss.s3.c1 != 0x78 || u.ss.c != 0xab ||
- u.v[0] != 0x780000ab || u.v[1] != 0x00000000)
- abort();
- return 0;
-}
-
-#pragma pack(push, 2)
-typedef struct _S4
-{
- unsigned char c1 : 8;
- unsigned short s1 : 8;
- unsigned short s2 : 8;
-} S4;
-
-typedef struct _S4W
-{
- S4 s4;
- unsigned char c;
-}S4W;
-/* c1 and s1 overlap. */
-#pragma pack(pop)
-
-typedef union u4 { S4W ss; unsigned int v[6]; } U4;
-
-int TestS4(void)
-{
- U4 u = {0};
- u.ss.s4.c1 = 0x56;
- u.ss.s4.s1 = 0x78;
- u.ss.s4.s2 = 0xab;
- u.ss.c = 0x90;
-
- if (sizeof(S4) != 4 || sizeof(S4W) != 6 ||
- u.ss.s4.s1 != 0x78 || u.ss.s4.s2 != 0xab ||
- u.ss.s4.c1 != 0x78 || u.ss.c != 0x90 ||
- u.v[0] != 0x780000ab || u.v[1] != 0x90000000)
- abort();
- return 0;
-}
-
-#pragma pack(push,1)
-typedef struct _S5
-{
- unsigned short s : 16;
- unsigned int l1 : 16;
- unsigned int l2 : 16;
-} S5;
-
-typedef struct _S5W
-{
- S5 s5;
- unsigned short s;
-}S5W;
-/* l1 and s5.s overlap. l2 and s overlap. Size is 6
- although 8 bytes are referenced. */
-#pragma pack(pop)
-
-typedef union u5 { S5W ss; unsigned int v[6]; } U5;
-
-int TestS5(void)
-{
- U5 u = {0};
- u.ss.s5.s = 0x5678;
- u.ss.s5.l1 = 0x1289;
- u.ss.s = 0xabcd;
- u.ss.s5.l2 = 0xfe34;
- if (sizeof(S5) != 6 || sizeof(S5W) != 8 ||
- u.ss.s5.l1 != 0x1289 || u.ss.s5.l2 != 0xfe34 ||
- u.ss.s5.s != 0x1289 || u.ss.s != 0xfe34 ||
- u.v[0] != 0x12890000 || u.v[1] != 0x0000fe34 || u.v[2] != 0x00000000)
- abort();
- return 0;
-}
-
-#pragma pack(push,2)
-typedef struct _S6
-{
- unsigned short s : 16;
- unsigned int l1 : 16;
- unsigned int l2 : 16;
-} S6;
-
-typedef struct _S6W
-{
- S6 s6;
- unsigned short s;
-}S6W;
-#pragma pack(pop)
-
-typedef union u6 { S6W ss; unsigned int v[6]; } U6;
-
-int TestS6(void)
-{
- U6 u = {0};
- u.ss.s6.s = 0x5678;
- u.ss.s6.l1 = 0x9123;
- u.ss.s = 0xabcd;
- u.ss.s6.l2 = 0xef04;
- if (sizeof(S6) != 8 || sizeof(S6W) != 10 ||
- u.ss.s6.l1 != 0x9123 || u.ss.s6.l2 != 0xef04 ||
- u.ss.s6.s != 0x9123 || u.ss.s != 0xabcd ||
- u.v[0] != 0x91230000 || u.v[1] != 0x0000ef04 || u.v[2] != 0xabcd0000)
- abort();
- return 0;
-}
-int main()
-{
- return TestS3() + TestS4() + TestS5() + TestS6();
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-22.c b/gcc/testsuite/gcc.apple/bitreverse-22.c
index 949a1245745..5a47d0c44cd 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-22.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-22.c
@@ -5,6 +5,7 @@ extern void abort();
/* { dg-options "-std=gnu99" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
typedef struct _S5
{
@@ -20,11 +21,11 @@ typedef struct _S5
int TestS5(void)
{
S5 s5 = {0};
-
+
s5.s1 = 0x5678;
s5.s2 = 0xABCD;
- if (sizeof(S5) != 12
+ if (sizeof(S5) != 12
|| s5.s1 != 0x5678
|| s5.l3 != 0x5678
|| s5.s2 != 0xabcd
@@ -33,7 +34,7 @@ int TestS5(void)
return 0;
#if 0
- printf("size %d\n", sizeof(S5));
+ printf("size %d\n", sizeof(S5));
printf("s5.l3 = 0x%x, s5.l4 = 0x%x\n", s5.l3, s5.l4);
#endif
}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-24.c b/gcc/testsuite/gcc.apple/bitreverse-24.c
deleted file mode 100644
index 5a3f9e5f876..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-24.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* APPLE LOCAL file 4430139 */
-extern void abort();
-#include <string.h>
-/* This is bitreverse-18 with d and e switched.
- Note that this changes the layout and even the size. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-
-typedef unsigned short WORD;
-typedef unsigned int DWORD;
-
-#pragma reverse_bitfields on
-
-#define USE_STRUCT_WRAPPER 0
-
-#pragma pack(push, 2)
-typedef struct
-{
- DWORD a;
-#if USE_STRUCT_WRAPPER
- struct {
-#endif
- WORD b:2,
- c:14;
-#if USE_STRUCT_WRAPPER
- };
-#endif
- DWORD d:10,
- e:22;
- DWORD f;
- DWORD g:25,
- h:1,
- i:6;
-#if USE_STRUCT_WRAPPER
- struct {
-#endif
- WORD j:14,
- k:2;
-#if USE_STRUCT_WRAPPER
- };
-#endif
-} Foo;
-typedef union { Foo x; int y[6]; } u1;
-#pragma pack(pop)
-
-
-int main(int argc, char* argv[])
-{
- Foo foo;
- int i;
- u1 U;
- memset (&U, 0, sizeof(u1));
- U.x.a = 1;
- U.x.b = 1;
- U.x.c = 1;
- U.x.d = 1;
- U.x.e = 1;
- U.x.f = 1;
- U.x.g = 1;
- U.x.h = 1;
- U.x.i = 1;
- U.x.j = 1;
- U.x.k = 1;
-
- int s = sizeof(Foo);
-
- if (sizeof(Foo) != 22
- || U.y[0] != 0x00000001
- || U.y[1] != 0x00010000
- || U.y[2] != 0x00000001
- || U.y[3] != 0x00000001
- || U.y[4] != 0x06000001
- || U.y[5] != 0x40010000)
- abort();
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-25.c b/gcc/testsuite/gcc.apple/bitreverse-25.c
index a41515f9d98..a2a2b9d309c 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-25.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-25.c
@@ -3,6 +3,7 @@ extern void abort();
/* { dg-do run { target powerpc*-*-darwin* } } */
/* { dg-options "-std=gnu99" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
#pragma pack(push,1)
typedef struct _S2
@@ -22,7 +23,7 @@ int TestS2(void)
u.ss.c = 0x15;
u.ss.s1 = 0x15;
u.ss.s2 = 0x15;
-
+
if (sizeof(S2) != 3 || u.x[0] != 0x152a1500)
abort();
return 0;
@@ -46,7 +47,7 @@ int TestS3(void)
u.ss.c = 0x15;
u.ss.s1 = 0x15;
u.ss.s2 = 0x15;
-
+
if (sizeof(S3) != 4 || u.x[0] != 0x15002a15)
abort();
return 0;
@@ -68,7 +69,7 @@ int TestS4(void)
u.ss.c = 0x15;
u.ss.s1 = 0x15;
u.ss.s2 = 0x15;
-
+
if (sizeof(S4) != 4 || u.x[0] != 0x15002a15)
abort();
return 0;
diff --git a/gcc/testsuite/gcc.apple/bitreverse-26.c b/gcc/testsuite/gcc.apple/bitreverse-26.c
index 30791498329..42c0639b6d3 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-26.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-26.c
@@ -3,6 +3,7 @@ extern void abort();
/* { dg-do run { target powerpc*-*-darwin* } } */
/* { dg-options "-std=gnu99" } */
#pragma reverse_bitfields on
+#pragma ms_struct on
#pragma pack(push,1)
typedef struct _S2
@@ -22,7 +23,7 @@ int TestS2(void)
u.ss.c = 0x15;
u.ss.s1 = 0x15;
u.ss.s2 = 0x15;
-
+
if (sizeof(S2) != 3 || u.x[0] != 0x152a1500)
abort();
return 0;
@@ -46,7 +47,7 @@ int TestS3(void)
u.ss.c = 0x15;
u.ss.s1 = 0x15;
u.ss.s2 = 0x15;
-
+
if (sizeof(S3) != 4 || u.x[0] != 0x15002a15)
abort();
return 0;
@@ -68,7 +69,7 @@ int TestS4(void)
u.ss.c = 0x15;
u.ss.s1 = 0x15;
u.ss.s2 = 0x15;
-
+
if (sizeof(S4) != 4 || u.x[0] != 0x15002a15)
abort();
return 0;
diff --git a/gcc/testsuite/gcc.apple/bitreverse-27.c b/gcc/testsuite/gcc.apple/bitreverse-27.c
deleted file mode 100644
index d313bd6cccd..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-27.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* APPLE LOCAL file 4436477 */
-extern void abort();
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-
-#pragma reverse_bitfields on
-
-typedef struct _S5
-{
- unsigned long l1 : 16;
- unsigned long l2 : 16;
- unsigned char c1;
- unsigned short s1 : 8;
- unsigned short s2 : 8;
- unsigned char c2;
-} S5;
-
-union U { S5 ss; unsigned int x[4]; };
-
-int TestS5(void)
-{
- union U u = {0};
-
- u.ss.c1 = 0x56;
- u.ss.c2 = 0x78;
-
- if (sizeof(S5) != 8 ||
- u.ss.s1 != 0x56 || u.ss.s2 != 0x78 ||
- u.x[0] != 0x0000000 || u.x[1] != 0x56000078 || u.x[2] != 0x00000000)
- abort();
- return 0;
-}
-
-int main()
-{
- return TestS5();
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-3.c b/gcc/testsuite/gcc.apple/bitreverse-3.c
index 034d120f6ba..9b79f0edfe2 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-3.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-3.c
@@ -48,6 +48,7 @@ typedef struct
} u2;
} Bitfields;
+#pragma ms_struct on
#pragma reverse_bitfields on
int main()
{
diff --git a/gcc/testsuite/gcc.apple/bitreverse-4.c b/gcc/testsuite/gcc.apple/bitreverse-4.c
deleted file mode 100644
index 1ebf5f7eb07..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-4.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* APPLE LOCAL file */
-#include <stdio.h>
-#include <string.h>
-
-/* Tests interleaving of bitfields and non-bitfields. Note that they
- overlap, so the code cannot possibly work, but bug compability is
- the requirement. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-
-#pragma reverse_bitfields on
-typedef struct
-{
- union
- {
- unsigned int i1;
- struct
- {
- int b1: 1;
- unsigned int b2: 2;
- unsigned int b3: 4;
- unsigned int b4: 8;
- int b5: 16;
- } bits;
- } u1;
-
- short baz;
- union
- {
- struct
- {
- unsigned int i2;
- unsigned int i3;
- unsigned int i4;
- unsigned int i5;
- } ints;
-
- struct
- {
- unsigned int b1: 16;
- unsigned int b2: 8;
- unsigned int b3: 4;
- char quux;
- unsigned int b4: 2;
- unsigned int b5: 1;
- short baz;
- unsigned int b6: 2;
- unsigned int b7: 4;
- short baz2;
- unsigned int b8: 8;
- unsigned int b9: 16;
- } bits;
- } u2;
-} Bitfields;
-
-
-int main()
-{
- Bitfields bitfields;
-
-
- memset(&bitfields, 0, sizeof(bitfields));
-
- bitfields.u1.bits.b1 = 1; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u1.bits.b2 = 1;
- bitfields.u1.bits.b3 = 1;
- bitfields.u1.bits.b4 = 1;
- bitfields.u1.bits.b5 = 1;
- bitfields.baz = 0x5555;
- bitfields.u2.bits.b1 = 1;
- bitfields.u2.bits.b2 = 1;
- bitfields.u2.bits.b3 = 1;
- bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b4 = 1;
- bitfields.u2.bits.b5 = 1;
- bitfields.u2.bits.baz = 0xaaaa; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b6 = 1;
- bitfields.u2.bits.b7 = 1;
- bitfields.u2.bits.baz2 = 0x3333;
- bitfields.u2.bits.b8 = 1;
- bitfields.u2.bits.b9 = 1;
-
- if (bitfields.u1.i1 != 0x0000808b
- || bitfields.baz != 0x5555
- || bitfields.u2.ints.i2 != 0x01010001
- || bitfields.u2.ints.i3 != 0x5a00aaaa
- || bitfields.u2.ints.i4 != 0x00003333
- || bitfields.u2.ints.i5 != 0x00000101
- || sizeof(bitfields) != 24)
- return 42;
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-5.c b/gcc/testsuite/gcc.apple/bitreverse-5.c
deleted file mode 100644
index 50c4df3879e..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-5.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* APPLE LOCAL file */
-#include <stdio.h>
-#include <string.h>
-
-/* Tests interaction with pragma pack, and interleaving of bitfields
- and non-bitfields. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-
-#pragma reverse_bitfields on
-typedef struct
-{
- union
- {
- unsigned int i1;
- struct
- {
- int b1: 1;
- unsigned int b2: 2;
- unsigned int b3: 4;
- unsigned int b4: 8;
- int b5: 16;
- } bits;
- } u1;
-
- short baz;
- union
- {
- struct
- {
- unsigned int i2;
- unsigned int i3;
- unsigned int i4;
- unsigned int i5;
- } ints;
-
-#pragma pack(1)
- struct
- {
- unsigned int b1: 16;
- unsigned int b2: 8;
- unsigned int b3: 4;
- char quux;
- unsigned int b4: 2;
- unsigned int b5: 1;
- short baz;
- unsigned int b6: 2;
- unsigned int b7: 4;
- short baz2;
- unsigned int b8: 8;
- unsigned int b9: 16;
- } bits;
- } u2;
-} Bitfields;
-
-
-int main()
-{
- Bitfields bitfields;
-
-
- memset(&bitfields, 0, sizeof(bitfields));
-
- bitfields.u1.bits.b1 = 1; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u1.bits.b2 = 1;
- bitfields.u1.bits.b3 = 1;
- bitfields.u1.bits.b4 = 1;
- bitfields.u1.bits.b5 = 1;
- bitfields.baz = 0x5555;
- bitfields.u2.bits.b1 = 1;
- bitfields.u2.bits.b2 = 1;
- bitfields.u2.bits.b3 = 1;
- bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b4 = 1;
- bitfields.u2.bits.b5 = 1;
- bitfields.u2.bits.baz = 0xaaaa; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b6 = 1;
- bitfields.u2.bits.b7 = 1;
- bitfields.u2.bits.baz2 = 0x3333;
- bitfields.u2.bits.b8 = 1;
- bitfields.u2.bits.b9 = 1;
-
- if (bitfields.u1.i1 != 0x0000808b
- || bitfields.baz != 0x5555
- || bitfields.u2.ints.i2 != 0x01010001
- || bitfields.u2.ints.i3 != 0x5a00aaaa
- || bitfields.u2.ints.i4 != 0x01333305
- || bitfields.u2.ints.i5 != 0x00000001
- || sizeof(bitfields) != 22)
- return 42;
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-6.c b/gcc/testsuite/gcc.apple/bitreverse-6.c
deleted file mode 100644
index d24689f4412..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-6.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* APPLE LOCAL file */
-#include <stdio.h>
-#include <string.h>
-
-/* Tests interaction with pragma pack, and interleaving of bitfields
- and non-bitfields. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-
-#pragma reverse_bitfields on
-typedef struct
-{
- union
- {
- unsigned int i1;
-#pragma pack(2)
- struct
- {
- int b1: 1;
- unsigned int b2: 2;
- unsigned int b3: 4;
- unsigned int b4: 8;
- int b5: 16;
- } bits;
- } u1;
-
- short baz;
- union
- {
- struct
- {
- unsigned int i2;
- unsigned int i3;
- unsigned int i4;
- unsigned int i5;
- } ints;
-
-#pragma pack(1)
- struct
- {
- unsigned int b1: 16;
- unsigned int b2: 8;
- unsigned int b3: 4;
- char quux;
- unsigned int b4: 2;
- unsigned int b5: 1;
- short baz;
- unsigned int b6: 2;
- unsigned int b7: 4;
- short baz2;
- unsigned int b8: 8;
- unsigned int b9: 16;
- } bits;
- } u2;
-} Bitfields;
-
-
-int main()
-{
- Bitfields bitfields;
-
-
- memset(&bitfields, 0, sizeof(bitfields));
-
- bitfields.u1.bits.b1 = 1; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u1.bits.b2 = 1;
- bitfields.u1.bits.b3 = 1;
- bitfields.u1.bits.b4 = 1;
- bitfields.u1.bits.b5 = 1;
- bitfields.baz = 0x5555;
- bitfields.u2.bits.b1 = 1;
- bitfields.u2.bits.b2 = 1;
- bitfields.u2.bits.b3 = 1;
- bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b4 = 1;
- bitfields.u2.bits.b5 = 1;
- bitfields.u2.bits.baz = 0xaaaa; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b6 = 1;
- bitfields.u2.bits.b7 = 1;
- bitfields.u2.bits.baz2 = 0x3333;
- bitfields.u2.bits.b8 = 1;
- bitfields.u2.bits.b9 = 1;
-
- if (bitfields.u1.i1 != 0x0000808b
- || bitfields.baz != 0x5555
- || bitfields.u2.ints.i2 != 0x01010001
- || bitfields.u2.ints.i3 != 0x5a00aaaa
- || bitfields.u2.ints.i4 != 0x01333305
- || bitfields.u2.ints.i5 != 0x00000001
- || sizeof(bitfields) != 22)
- return 42;
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-7.c b/gcc/testsuite/gcc.apple/bitreverse-7.c
deleted file mode 100644
index f09076bd363..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-7.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* APPLE LOCAL file */
-#include <stdio.h>
-#include <string.h>
-
-/* Tests interaction with pragma pack, and interleaving of bitfields
- and non-bitfields. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-
-#pragma reverse_bitfields on
-typedef struct
-{
- union
- {
- unsigned int i1;
-#pragma pack(2)
- struct
- {
- short b1: 1;
- unsigned int b2: 2;
- char b3: 4;
- unsigned int b4: 8;
- unsigned int b5: 16;
- } bits;
- } u1;
-
- short baz;
- union
- {
- struct
- {
- unsigned int i2;
- unsigned int i3;
- unsigned int i4;
- unsigned int i5;
- } ints;
-
-#pragma pack(1)
- struct
- {
- unsigned int b1: 16;
- unsigned int b2: 8;
- unsigned int b3: 4;
- char quux;
- unsigned int b4: 2;
- unsigned int b5: 1;
- short baz;
- unsigned int b6: 2;
- unsigned int b7: 4;
- short baz2;
- unsigned int b8: 8;
- unsigned int b9: 16;
- } bits;
- } u2;
-} Bitfields;
-
-
-int main()
-{
- Bitfields bitfields;
-
-
- memset(&bitfields, 0, sizeof(bitfields));
-
- bitfields.u1.bits.b1 = 1;
- bitfields.u1.bits.b2 = 1;
- bitfields.u1.bits.b3 = 1;
- bitfields.u1.bits.b4 = 1;
- bitfields.u1.bits.b5 = 1;
- bitfields.baz = 0x5555;
- bitfields.u2.bits.b1 = 1;
- bitfields.u2.bits.b2 = 1;
- bitfields.u2.bits.b3 = 1;
- bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b4 = 1;
- bitfields.u2.bits.b5 = 1;
- bitfields.u2.bits.baz = 0xaaaa;
- bitfields.u2.bits.b6 = 1;
- bitfields.u2.bits.b7 = 1;
- bitfields.u2.bits.baz2 = 0x3333;
- bitfields.u2.bits.b8 = 1;
- bitfields.u2.bits.b9 = 1;
-
- if (bitfields.u1.i1 != 0x00008082
- || bitfields.baz != 0x5555
- || bitfields.u2.ints.i2 != 0x01010001
- || bitfields.u2.ints.i3 != 0x5a00aaaa
- || bitfields.u2.ints.i4 != 0x01333305
- || bitfields.u2.ints.i5 != 0x00000001
- || sizeof(bitfields) != 22)
- return 42;
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-8.c b/gcc/testsuite/gcc.apple/bitreverse-8.c
deleted file mode 100644
index 77f5d6c6e9d..00000000000
--- a/gcc/testsuite/gcc.apple/bitreverse-8.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* APPLE LOCAL file */
-#include <stdio.h>
-#include <string.h>
-
-/* Tests interleaving of bitfields and non-bitfields. */
-
-/* { dg-do run { target powerpc*-*-darwin* } } */
-/* { dg-options "-std=gnu99" } */
-
-#pragma reverse_bitfields on
-typedef struct
-{
- union
- {
- unsigned int i1;
- struct
- {
- short b1: 1;
- unsigned int b2: 2;
- char b3: 4;
- unsigned int b4: 8;
- unsigned int b5: 16;
- } bits;
- } u1;
-
- short baz;
- union
- {
- struct
- {
- unsigned int i2;
- unsigned int i3;
- unsigned int i4;
- unsigned int i5;
- } ints;
-
- struct
- {
- unsigned int b1: 16;
- unsigned int b2: 8;
- unsigned int b3: 4;
- char quux;
- unsigned int b4: 2;
- unsigned int b5: 1;
- short baz;
- unsigned int b6: 2;
- unsigned int b7: 4;
- short baz2;
- unsigned int b8: 8;
- unsigned int b9: 16;
- } bits;
- } u2;
-} Bitfields;
-
-
-int main()
-{
- Bitfields bitfields;
-
-
- memset(&bitfields, 0, sizeof(bitfields));
-
- bitfields.u1.bits.b1 = 1;
- bitfields.u1.bits.b2 = 1;
- bitfields.u1.bits.b3 = 1;
- bitfields.u1.bits.b4 = 1;
- bitfields.u1.bits.b5 = 1;
- bitfields.baz = 0x5555;
- bitfields.u2.bits.b1 = 1;
- bitfields.u2.bits.b2 = 1;
- bitfields.u2.bits.b3 = 1;
- bitfields.u2.bits.quux = 0xa55a; /* { dg-warning "overflow in implicit constant conversion" } */
- bitfields.u2.bits.b4 = 1;
- bitfields.u2.bits.b5 = 1;
- bitfields.u2.bits.baz = 0xaaaa;
- bitfields.u2.bits.b6 = 1;
- bitfields.u2.bits.b7 = 1;
- bitfields.u2.bits.baz2 = 0x3333;
- bitfields.u2.bits.b8 = 1;
- bitfields.u2.bits.b9 = 1;
- if (bitfields.u1.i1 != 0x00008082
- || bitfields.baz != 0x5555
- || bitfields.u2.ints.i2 != 0x01010001
- || bitfields.u2.ints.i3 != 0x5a00aaaa
- || bitfields.u2.ints.i4 != 0x00003333
- || bitfields.u2.ints.i5 != 0x00000101
- || sizeof(bitfields) != 24)
- return 42;
- return 0;
-}
diff --git a/gcc/testsuite/gcc.apple/bitreverse-9.c b/gcc/testsuite/gcc.apple/bitreverse-9.c
index f719335b17e..b9c926627a6 100644
--- a/gcc/testsuite/gcc.apple/bitreverse-9.c
+++ b/gcc/testsuite/gcc.apple/bitreverse-9.c
@@ -53,6 +53,7 @@ typedef struct
} u2;
} Bitfields;
+#pragma ms_struct on
#pragma reverse_bitfields on
int main()
{
diff --git a/gcc/testsuite/gcc.apple/pascal-strings-2.c b/gcc/testsuite/gcc.apple/pascal-strings-2.c
index b25c6cf8013..04b1b709672 100644
--- a/gcc/testsuite/gcc.apple/pascal-strings-2.c
+++ b/gcc/testsuite/gcc.apple/pascal-strings-2.c
@@ -6,7 +6,7 @@
typedef __WCHAR_TYPE__ wchar_t;
-const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-warning "unknown escape sequence" } */
+const wchar_t *pascalStr1 = L"\pHi!"; /* { dg-bogus "unknown escape sequence" } */
const wchar_t *pascalStr2 = L"Bye\p!"; /* { dg-warning "unknown escape sequence" } */
const wchar_t *initErr0 = "\pHi"; /* { dg-warning "incompatible pointer type" } */
diff --git a/gcc/testsuite/gcc.dg/pragma-ms_struct.c b/gcc/testsuite/gcc.dg/pragma-ms_struct.c
new file mode 100644
index 00000000000..ebdb73c65a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pragma-ms_struct.c
@@ -0,0 +1,22 @@
+/* APPLE LOCAL file mainline */
+/* Darwin pragma for __attribute__ ((ms_struct)). */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-Wall" } */
+
+#pragma ms_struct on
+
+#pragma ms_struct off
+
+#pragma ms_struct reset
+
+#pragma ms_struct /* { dg-warning "malformed" } */
+
+#pragma ms_struct on top of spaghetti /* { dg-warning "junk" } */
+
+struct foo
+{
+ int a;
+ int b;
+ char c;
+};
diff --git a/gcc/testsuite/gcc.target/i386/m64-1.c b/gcc/testsuite/gcc.target/i386/m64-1.c
new file mode 100644
index 00000000000..fe9aba8017c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/m64-1.c
@@ -0,0 +1,26 @@
+/* APPLE LOCAL file 4505813 */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-msse2" } */
+
+#include <xmmintrin.h>
+
+__m64 i1 = { 0x0123456789ABCDEFLL };
+__m64 i2 = { 0x01234567, 0x89ABCDEF }; /* { dg-warning "excess elements" } */
+__m64 i3 = { 0x89ABCDEF };
+__m64 i4 = { 0x89ABCDEFLL };
+__m64 i5 = { 0x01234567LL, 0x89ABCDEFLL }; /* { dg-warning "excess elements" } */
+__m64 i6 = { 1, 2, 3 }; /* { dg-warning "excess elements" } */
+__m64 i7 = { 1, 2, 3, 4 }; /* { dg-warning "excess elements" } */
+__m64 i8 = { 1, 2, 3, 4, 5, 6, 7 }; /* { dg-warning "excess elements" } */
+__m64 i9 = { 1, 2, 3, 4, 5, 6, 7, 8 }; /* { dg-warning "excess elements" } */
+__m64 i10 = 0x0123456789ABCDEFLL; /* { dg-error "incompatible types" } */
+__m64 i11 = 1; /* { dg-error "incompatible types" } */
+
+/* { dg-warning "near initialization" "initialization" { target *-*-* } 8 } */
+/* { dg-warning "near initialization" "initialization" { target *-*-* } 11 } */
+/* { dg-warning "near initialization" "initialization" { target *-*-* } 12 } */
+/* { dg-warning "near initialization" "initialization" { target *-*-* } 13 } */
+/* { dg-warning "near initialization" "initialization" { target *-*-* } 14 } */
+/* { dg-warning "near initialization" "initialization" { target *-*-* } 15 } */
+
+
diff --git a/gcc/testsuite/gcc.target/i386/m64-2.c b/gcc/testsuite/gcc.target/i386/m64-2.c
new file mode 100644
index 00000000000..14d527da1f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/m64-2.c
@@ -0,0 +1,8 @@
+/* APPLE LOCAL file 4505813 */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-msse2" } */
+
+#include <xmmintrin.h>
+
+const __m64 one __attribute__ ((aligned(16))) = { 0x0001000100010001LL };
+/* { dg-final { scan-assembler-times "long\t65537" 2 } } */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0d8ce0e1fb8..5787b57335c 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1113,7 +1113,7 @@ inline_forbidden_p (tree fndecl)
location_t saved_loc = input_location;
/* APPLE LOCAL begin CW asm blocks */
tree ret;
- if (DECL_CW_ASM_FUNCTION (fndecl)
+ if (DECL_IASM_ASM_FUNCTION (fndecl)
&& ! flag_ms_asms)
{
inline_forbidden_reason
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 2acb9715ee8..cad90a5a79b 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -574,6 +574,9 @@ all_uses_are_replacable (tree stmt, bool replace)
int j, num_uses;
bool replacable = true;
+ if (!cast_conversion_assignment_p (stmt))
+ return false;
+
/* Now compute the immediate uses of TEST_VAR. */
df = get_immediate_uses (stmt);
num_uses = num_immediate_uses (df);
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index f10b98cd986..50e4245ea00 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1514,9 +1514,12 @@ find_interesting_uses_address (struct ivopts_data *data, tree stmt, tree *op_p)
/* Ignore bitfields for now. Not really something terribly complicated
to handle. TODO. */
- if (TREE_CODE (base) == COMPONENT_REF
- && DECL_NONADDRESSABLE_P (TREE_OPERAND (base, 1)))
+ /* APPLE LOCAL begin mainline 4516827 pr 26643 */
+ if (TREE_CODE (base) == BIT_FIELD_REF
+ || (TREE_CODE (base) == COMPONENT_REF
+ && DECL_NONADDRESSABLE_P (TREE_OPERAND (base, 1))))
goto fail;
+ /* APPLE LOCAL end mainline 4516827 pr 26643 */
if (STRICT_ALIGNMENT
&& may_be_unaligned_p (base))
diff --git a/gcc/tree.h b/gcc/tree.h
index 8b8ffb856da..c963039267f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2261,9 +2261,9 @@ struct tree_binfo GTY (())
#define DECL_DUPLICATE_DECL(NODE) (DECL_CHECK (NODE)->decl.duplicate_decl)
/* APPLE LOCAL begin CW asm blocks */
-#define DECL_CW_ASM_FUNCTION(NODE) (DECL_CHECK (NODE)->decl.cw_asm_function_flag)
-#define DECL_CW_ASM_NORETURN(NODE) (DECL_CHECK (NODE)->decl.cw_asm_noreturn_flag)
-#define DECL_CW_ASM_FRAME_SIZE(NODE) (DECL_CHECK (NODE)->decl.cw_asm_frame_size)
+#define DECL_IASM_ASM_FUNCTION(NODE) (DECL_CHECK (NODE)->decl.iasm_asm_function_flag)
+#define DECL_IASM_NORETURN(NODE) (DECL_CHECK (NODE)->decl.iasm_noreturn_flag)
+#define DECL_IASM_FRAME_SIZE(NODE) (DECL_CHECK (NODE)->decl.iasm_frame_size)
/* APPLE LOCAL end CW asm blocks */
/* Used in TREE_PUBLIC decls to indicate that copies of this DECL in
@@ -2431,9 +2431,9 @@ struct tree_decl GTY(())
/* APPLE LOCAL unused bits */
/* 9 unused bits. */
/* APPLE LOCAL begin CW asm blocks */
- unsigned cw_asm_function_flag : 1;
- unsigned cw_asm_noreturn_flag : 1;
- unsigned int cw_asm_frame_size;
+ unsigned iasm_asm_function_flag : 1;
+ unsigned iasm_noreturn_flag : 1;
+ unsigned int iasm_frame_size;
/* APPLE LOCAL end CW asm blocks */
union tree_decl_u1 {
@@ -3167,11 +3167,6 @@ typedef struct record_layout_info_s
/* True if we've seen a packed field that didn't have normal
alignment anyway. */
int packed_maybe_necessary;
- /* APPLE LOCAL begin bitfield reversal */
- int among_reversed_bitfields;
- unsigned int reversed_bitfield_type_size;
- unsigned int reversed_bitfield_bitpos;
- /* APPLE LOCAL end bitfield reversal */
} *record_layout_info;
extern void set_lang_adjust_rli (void (*) (record_layout_info));
diff --git a/libcpp/ChangeLog.apple-ppc b/libcpp/ChangeLog.apple-ppc
index 60eee3a918e..d9a5d1eb429 100644
--- a/libcpp/ChangeLog.apple-ppc
+++ b/libcpp/ChangeLog.apple-ppc
@@ -20,6 +20,22 @@
token types, similar to CPP_PRAGMA.
(cpp_options): Define new defer_file_change_debug_hooks flag.
+2006-04-25 Mike Stump <mrs@apple.com>
+
+ Radar 4505741
+ * lex.c: Rename cw_asm_states to iasm_states.
+ Rename cw_asm_in_operands to iasm_in_operands.
+ Rename cw_asm_state to iasm_state.
+ Rename cw_asm_label_follows to iasm_label_follows.
+ Rename flag_cw_asm_blocks to flag_iasm_blocks.
+ * macro.c: Likewise.
+ * makedepend.c: Likewise.
+
+2006-04-17 Devang Patel <dpatel@apple.com>
+
+ Radar 4499790
+ * charset.c (cpp_interpret_string): Enable pascal strings for wchars.
+
2005-12-13 Mike Stump <mrs@apple.com>
* Revert 2005-12-07 Devang Patel <dpatel@apple.com> Radar 4137741
diff --git a/libcpp/charset.c b/libcpp/charset.c
index abb5c8d4da4..485e838c937 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -1318,13 +1318,19 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
struct _cpp_strbuf tbuf;
const uchar *p, *base, *limit;
size_t i;
+ /* APPLE LOCAL begin pascal strings */
+ size_t width = CPP_OPTION (pfile, wchar_precision);
+ size_t cwidth = CPP_OPTION (pfile, char_precision);
+ size_t pascal_string_max_length = width_to_mask (wide ? width : cwidth);
+ size_t pascal_string_length_byte_size = ((wide ? width : cwidth)/cwidth);
+ /* APPLE LOCAL end pascal strings */
struct cset_converter cvt
= wide ? pfile->wide_cset_desc : pfile->narrow_cset_desc;
tbuf.asize = MAX (OUTBUF_BLOCK_SIZE, from->len);
tbuf.text = xmalloc (tbuf.asize);
/* APPLE LOCAL pascal strings */
- tbuf.len = (pascal_p ? 1 : 0); /* Reserve space for Pascal length byte. */
+ tbuf.len = (pascal_p ? pascal_string_length_byte_size : 0); /* Reserve space for Pascal length byte. */
for (i = 0; i < count; i++)
{
@@ -1363,9 +1369,25 @@ cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count,
/* For Pascal strings, compute the length byte. */
if (pascal_p)
{
- *tbuf.text = (unsigned char) (tbuf.len - 1);
- if (tbuf.len > 256)
- cpp_error (pfile, CPP_DL_ERROR, "Pascal string is too long");
+ if (wide)
+ {
+ /* Conversion routine uses tbuf.len as the starting point in destination
+ buffer. However we are adding string lenght at the beginning. Save tbuf.len
+ and restore it later. */
+ size_t saved_tbuf_len = tbuf.len;
+ unsigned char uclen = (unsigned char) (saved_tbuf_len/pascal_string_length_byte_size - 1);
+ tbuf.len = 0;
+ APPLY_CONVERSION (cvt, &uclen, 1, &tbuf);
+ tbuf.len = saved_tbuf_len;
+ if (tbuf.len/pascal_string_length_byte_size > pascal_string_max_length)
+ cpp_error (pfile, CPP_DL_ERROR, "Pascal string is too long");
+ }
+ else
+ {
+ *tbuf.text = (unsigned char) (tbuf.len - 1);
+ if (tbuf.len > 256)
+ cpp_error (pfile, CPP_DL_ERROR, "Pascal string is too long");
+ }
}
/* APPLE LOCAL end pascal strings */
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 13e2241ccaf..dc8d641531b 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -26,8 +26,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* APPLE LOCAL begin CW asm blocks */
/* A hack that would be better done with a callback or some such. */
-extern enum cw_asm_states { cw_asm_none, cw_asm_decls, cw_asm_asm } cw_asm_state;
-extern int cw_asm_in_operands;
+extern enum iasm_states { iasm_none, iasm_decls, iasm_asm } iasm_state;
+extern int iasm_in_operands;
/* APPLE LOCAL end CW asm blocks */
enum spell_type
@@ -505,8 +505,8 @@ forms_identifier_p (cpp_reader *pfile, int first,
/* APPLE LOCAL begin CW asm blocks */
/* Allow [.+-] in CW asm opcodes (PowerPC specific). Do this here
so we don't have to figure out "bl- 45" vs "bl -45". */
- if (cw_asm_state >= cw_asm_decls
- && !cw_asm_in_operands
+ if (iasm_state >= iasm_decls
+ && !iasm_in_operands
&& (*buffer->cur == '.' || *buffer->cur == '+' || *buffer->cur == '-'))
{
buffer->cur++;
@@ -1004,7 +1004,7 @@ _cpp_get_fresh_line (cpp_reader *pfile)
while (0)
/* APPLE LOCAL begin CW asm blocks */
-static int cw_asm_label_follows;
+static bool iasm_label_follows;
/* APPLE LOCAL end CW asm blocks */
/* Lex a token into pfile->cur_token, which is also incremented, to
@@ -1086,7 +1086,7 @@ _cpp_lex_direct (cpp_reader *pfile)
/* APPLE LOCAL begin CW asm blocks */
/* An '@' in assembly code makes a following digit string into
an identifier. */
- if (cw_asm_label_follows)
+ if (iasm_label_follows)
goto start_ident;
/* APPLE LOCAL end CW asm blocks */
/* APPLE LOCAL begin mainline UCNs 2005-04-17 3892809 */
@@ -1139,7 +1139,7 @@ _cpp_lex_direct (cpp_reader *pfile)
}
/* APPLE LOCAL begin CW asm blocks */
/* Got an identifier, reset the CW asm label hack flag. */
- cw_asm_label_follows = 0;
+ iasm_label_follows = false;
/* APPLE LOCAL end CW asm blocks */
break;
@@ -1361,8 +1361,8 @@ _cpp_lex_direct (cpp_reader *pfile)
case ';':
/* ';' separates instructions in CW asm, so flag that we're no
longer seeing operands. */
- if (cw_asm_state >= cw_asm_decls)
- cw_asm_in_operands = 0;
+ if (iasm_state >= iasm_decls)
+ iasm_in_operands = false;
result->type = CPP_SEMICOLON;
break;
case '@':
@@ -1370,8 +1370,8 @@ _cpp_lex_direct (cpp_reader *pfile)
either letters or digits, so set a hack flag for this. (We
still want to return the @ as a separate token so that the
parser can distinguish labels from opcodes.) */
- if (cw_asm_state >= cw_asm_decls)
- cw_asm_label_follows = 1;
+ if (iasm_state >= iasm_decls)
+ iasm_label_follows = true;
result->type = CPP_ATSIGN;
break;
/* APPLE LOCAL end CW asm blocks */
diff --git a/libcpp/macro.c b/libcpp/macro.c
index 458eca1a31d..8d4dbebc5a3 100644
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -41,7 +41,7 @@ struct macro_arg
/* Macro expansion. */
/* APPLE LOCAL begin CW asm blocks */
-extern int flag_cw_asm_blocks;
+extern int flag_iasm_blocks;
static int enter_macro_context (cpp_reader *, cpp_hashnode *, int bol_p);
/* APPLE LOCAL end CW asm blocks */
static int builtin_macro (cpp_reader *, cpp_hashnode *);
@@ -1153,7 +1153,7 @@ cpp_get_token (cpp_reader *pfile)
&& (node = pfile->cb.macro_to_expand (pfile, result))))
/* APPLE LOCAL end AltiVec */
/* APPLE LOCAL CW asm blocks */
- && enter_macro_context (pfile, node, (flag_cw_asm_blocks && result->flags & BOL)))
+ && enter_macro_context (pfile, node, (flag_iasm_blocks && result->flags & BOL)))
{
if (pfile->state.in_directive)
continue;
diff --git a/libcpp/makedepend.c b/libcpp/makedepend.c
index 777427d2542..0dbeab2e05c 100644
--- a/libcpp/makedepend.c
+++ b/libcpp/makedepend.c
@@ -29,9 +29,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* APPLE LOCAL begin CW asm blocks -sshebs */
/* Dummies needed because we use them from cpplib, yuck. */
-int flag_cw_asm_blocks;
-int cw_asm_state;
-int cw_asm_in_operands;
+int flag_iasm_blocks;
+int iasm_state;
+int iasm_in_operands;
/* APPLE LOCAL end CW asm blocks -sshebs */
const char *progname;