aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-07-29 12:14:03 +0000
committerJakub Jelinek <jakub@redhat.com>2009-07-29 12:14:03 +0000
commitd75718c48991b54dbbbd5c159e8c00c1663dce84 (patch)
tree3b9c80c8ab449b115ffcd4b62c5ae1d976e8df48
parentaa267a453af67fed68cdcbc1a893ea1ddd071657 (diff)
svn merge -r148856:148855 svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_4-branchredhat/fc11-4_4-branch
svn merge -r148501:148500 svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_4-branch svn merge -r148424:148423 svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_4-branch svn merge -r148422:148420 svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_4-branch git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/fc11-4_4-branch@150210 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog193
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/misc.c4
-rw-r--r--gcc/cfgcleanup.c3
-rw-r--r--gcc/cfglayout.c14
-rw-r--r--gcc/cfgrtl.c12
-rw-r--r--gcc/common.opt8
-rw-r--r--gcc/config/bfin/bfin.md11
-rw-r--r--gcc/config/i386/i386.c404
-rw-r--r--gcc/config/i386/i386.h12
-rw-r--r--gcc/config/i386/i386.md14
-rw-r--r--gcc/config/rs6000/crtresfpr.asm2
-rw-r--r--gcc/config/rs6000/crtresgpr.asm2
-rw-r--r--gcc/config/rs6000/crtresxfpr.asm42
-rw-r--r--gcc/config/rs6000/crtresxgpr.asm42
-rw-r--r--gcc/config/rs6000/crtsavfpr.asm2
-rw-r--r--gcc/config/rs6000/crtsavgpr.asm2
-rw-r--r--gcc/config/rs6000/ppc-asm.h19
-rw-r--r--gcc/config/rs6000/rs6000.c225
-rw-r--r--gcc/config/s390/s390.c81
-rw-r--r--gcc/doc/invoke.texi19
-rw-r--r--gcc/dwarf2.h1
-rw-r--r--gcc/dwarf2out.c558
-rw-r--r--gcc/dwarf2out.h2
-rw-r--r--gcc/emit-rtl.c7
-rw-r--r--gcc/final.c10
-rw-r--r--gcc/function.c248
-rw-r--r--gcc/insn-notes.def4
-rw-r--r--gcc/jump.c40
-rw-r--r--gcc/opth-gen.awk4
-rw-r--r--gcc/opts.c8
-rw-r--r--gcc/recog.c32
-rw-r--r--gcc/reg-notes.def35
-rw-r--r--gcc/rtl.def4
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/testsuite/ChangeLog25
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin-object-size1.C435
-rw-r--r--gcc/testsuite/g++.dg/ext/builtin-object-size2.C438
-rw-r--r--gcc/testsuite/gcc.dg/builtin-object-size-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/builtin-object-size-4.c10
-rw-r--r--gcc/testsuite/gcc.dg/builtin-object-size-6.c435
-rw-r--r--gcc/testsuite/gcc.dg/builtin-object-size-7.c71
-rw-r--r--gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f1
-rw-r--r--gcc/testsuite/gfortran.dg/debug/pr37738.f1
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp21
-rw-r--r--gcc/testsuite/lib/gfortran-dg.exp16
-rw-r--r--gcc/tree-object-size.c220
47 files changed, 495 insertions, 3259 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4ee67009472..484ae2507ca 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -220,17 +220,6 @@
* emutls.c (__emutls_get_address): Change arr->size to mean number
of allocated arr->data entries instead of # of slots + 1.
-2009-06-23 Jakub Jelinek <jakub@redhat.com>
-
- * tree-object-size.c (addr_object_size): Instead of checking
- for non-NULL TREE_CHAIN of the FIELD_DECL check that there
- are no FIELD_DECLs following it.
-
-2009-06-15 Jakub Jelinek <jakub@redhat.com>
-
- * tree-object-size.c (addr_object_size): Fix a pasto in the last
- change.
-
2009-06-22 Steven Bosscher <steven@gcc.gnu.org>
Matthias Klose <doko@ubuntu.com>
@@ -296,32 +285,6 @@
* doc/invoke.texi: Document -mcrc32.
-2009-06-11 Richard Henderson <rth@redhat.com>
-
- * common.opt (gdwarf-): Accept a version number.
- * doc/invoke.texi (gdwarf-): Update docs.
- * opth-gen.awk: Special case -gdwarf+ to OPT_gdwarfplus.
- * opts.c (common_handle_option) [OPT_gdwarf_]: Verify dwarf
- version level, and record it.
-
- * dwarf2.h (DW_CIE_VERSION): Remove.
- * dwarf2out.c (DWARF_VERSION): Remove.
- (add_fde_cfi): Skip DW_CFA_set_loc addition for dwarf3.
- (output_call_frame_info): Use CIE version 3 for dwarf3,
- or if the return register column is out of range for version 1.
- (dwarf_stack_op_name): Add all dwarf3 values.
- (DEBUG_PUBTYPES_SECTION): New.
- (size_of_die) [dw_val_class_die_ref]: Handle DW_FORM_ref_addr
- encoding change for dwarf3.
- (output_die) [dw_val_class_die_ref]: Likewise.
- (output_compilation_unit_header): Emit correct version for dwarf3.
- (output_line_info): Likewise.
- (output_pubnames): Update for DWARF_VERSION removal.
- (output_aranges): Likewise.
- (gen_subprogram_die): Emit DW_OP_call_frame_cfa if emitting dwarf3.
- (dwarf2out_init): Don't ifdef DEBUG_PUBTYPES_SECTION.
- (dwarf2out_finish): Likewise.
-
2009-06-11 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (min_insn_size): Use get_attr_length
@@ -331,162 +294,6 @@
* config/i386/i386.c (ix86_pad_returns): Use emit_jump_insn_before
instead of emit_insn_before.
-2009-06-08 Jakub Jelinek <jakub@redhat.com>
-
- * tree-object-size.c (addr_object_size): Add OSI argument.
- Handle also INDIRECT_REF with SSA_NAME inside of it as base address.
- (compute_builtin_object_size, expr_object_size): Adjust callers.
- (plus_stmt_object_size): Call addr_object_size instead of
- compute_builtin_object_size.
-
- * dwarf2out.c (emit_cfa_remember): New variable.
- (add_fde_cfi): If emit_cfa_remember, recurse to add
- DW_CFA_remember_state first.
- (dwarf2out_begin_epilogue): Don't add_fde_cfi DW_CFA_remember_state,
- instead just set emit_cfa_remember.
-
-2009-06-08 Adam Nemet <anemet@caviumnetworks.com>
-
- * jump.c (returnjump_p): Handle delayed branches. Add missing
- function comment.
-
-2009-06-05 Nathan Froyd <froydnj@codesourcery.com>
-
- * config/rs6000/ppc-asm.h: Protect auto-host.h inclusion and
- CFI_* definitions with IN_GCC.
-
-2009-06-04 Jakub Jelinek <jakub@redhat.com>
-
- * config/s390/s390.c (global_not_special_regno_p): New static inline.
- (save_gprs): Don't tell unwinder when a global register is saved.
- (s390_emit_epilogue): Emit needed epilogue unwind info.
-
-2009-06-03 Jakub Jelinek <jakub@redhat.com>
-
- * config/rs6000/rs6000.c (rs6000_emit_stack_reset): Return generated
- insn if it is changing sp. Use gen_add3_insn instead of
- conditionally gen_addsi3 and gen_adddi3.
- (offset_below_red_zone_p): New static inline function.
- (rs6000_emit_epilogue): Emit needed epilogue unwind info.
- Use gen_add3_insn instead of conditionally gen_addsi3 and gen_adddi3.
- * config/rs6000/ppc-asm.h: Include auto-host.h.
- (CFI_STARTPROC, CFI_ENDPROC, CFI_DEF_CFA_REGISTER, CFI_OFFSET,
- CFI_RESTORE): Define.
- * config/rs6000/crtresxgpr.asm: Add unwind info.
- * config/rs6000/crtresxfpr.asm: Likewise.
- * config/rs6000/crtresgpr.asm: Likewise.
- * config/rs6000/crtresfpr.asm: Likewise.
- * config/rs6000/crtsavgpr.asm: Likewise.
- * config/rs6000/crtsavfpr.asm: Likewise.
-
-2009-06-01 Jakub Jelinek <jakub@redhat.com>
-
- * config/i386/i386.c (queued_cfa_restores): New static variable.
- (ix86_add_cfa_restore_note, ix86_add_queued_cfa_restore_notes): New
- functions.
- (pro_epilogue_adjust_stack): Call ix86_add_queued_cfa_restore_notes.
- (ix86_emit_restore_reg_using_pop): Add RED_OFFSET argument.
- Set RTX_FRAME_RELATED_P immediately after adding a REG_CFA_* note.
- Call ix86_add_cfa_restore_note instead of adding REG_CFA_OFFSET
- note unconditionally.
- (ix86_emit_restore_regs_using_mov): Likewise.
- (ix86_emit_restore_sse_regs_using_mov): Likewise.
- (ix86_emit_restore_regs_using_pop): Add RED_OFFSET argument, pass
- it through to ix86_emit_restore_reg_using_pop.
- (ix86_emit_leave): Add RED_OFFSET argument. Call
- ix86_add_queued_cfa_restore_notes. Call ix86_add_cfa_restore_note
- instead of adding REG_CFA_OFFSET note unconditionally.
- (ix86_expand_epilogue): Compute RED_OFFSET, pass it down to
- the above functions. Call ix86_add_queued_cfa_restore_notes when
- needed.
-
- * config/i386/i386.h (struct machine_cfa_state,
- struct machine_function): Guard with ifndef USED_FOR_TARGET
- instead of not IN_LIBGCC2 and not in IN_TARGET_LIBS.
-
- PR middle-end/40316
- * recog.c (peep2_reinit_state): New function.
- (peephole2_init_state): Use it at the end of a basic block and also
- when seeing a RTX_FRAME_RELATED_P insn.
-
-2009-05-31 Jakub Jelinek <jakub@redhat.com>
-
- PR middle-end/40304
- * config/i386/i386.c (pro_epilogue_adjust_stack): Mark insns
- frame related even if !set_cfa && style < 0.
-
-2009-05-29 Richard Henderson <rth@redhat.com>
-
- * cfgcleanup.c (try_crossjump_to_edge): Only skip past
- NOTE_INSN_BASIC_BLOCK.
- * cfglayout.c (duplicate_insn_chain): Copy epilogue insn marks.
- Duplicate NOTE_INSN_EPILOGUE_BEG notes.
- * cfgrtl.c (can_delete_note_p): Allow NOTE_INSN_EPILOGUE_BEG
- to be deleted.
- * dwarf2out.c (struct cfa_loc): Change indirect field to bitfield,
- add in_use field.
- (add_cfi): Disable check redefining cfa away from drap.
- (lookup_cfa_1): Add remember argument; handle remember/restore.
- (lookup_cfa): Pass remember argument.
- (cfa_remember): New.
- (compute_barrier_args_size_1): Remove sibcall check.
- (dwarf2out_frame_debug_def_cfa): New.
- (dwarf2out_frame_debug_adjust_cfa): New.
- (dwarf2out_frame_debug_cfa_offset): New.
- (dwarf2out_frame_debug_cfa_register): New.
- (dwarf2out_frame_debug_cfa_restore): New.
- (dwarf2out_frame_debug): Handle REG_CFA_* notes.
- (dwarf2out_begin_epilogue): New.
- (dwarf2out_frame_debug_restore_state): New.
- (dw_cfi_oprnd1_desc): Handle DW_CFA_remember_state,
- DW_CFA_restore_state.
- (output_cfi_directive): Likewise.
- (convert_cfa_to_fb_loc_list): Likewise.
- (dw_cfi_oprnd1_desc): Handle DW_CFA_restore.
- * dwarf2out.h: Update.
- * emit-rtl.c (try_split): Don't split RTX_FRAME_RELATED_P.
- (copy_insn_1): Early out for null.
- * final.c (final_scan_insn): Call dwarf2out_begin_epilogue
- and dwarf2out_frame_debug_restore_state.
- * function.c (prologue, epilogue, sibcall_epilogue): Remove.
- (prologue_insn_hash, epilogue_insn_hash): New.
- (free_after_compilation): Adjust freeing accordingly.
- (record_insns): Create hash table if needed; push insns into
- hash instead of array.
- (maybe_copy_epilogue_insn): New.
- (contains): Search hash table instead of array.
- (sibcall_epilogue_contains): Remove.
- (thread_prologue_and_epilogue_insns): Split eh_return insns
- and mark them as epilogues.
- (reposition_prologue_and_epilogue_notes): Rewrite epilogue
- scanning in terms of basic blocks.
- * insn-notes.def (CFA_RESTORE_STATE): New.
- * jump.c (returnjump_p_1): Accept EH_RETURN.
- (eh_returnjump_p_1, eh_returnjump_p): New.
- * reg-notes.def (CFA_DEF_CFA, CFA_ADJUST_CFA, CFA_OFFSET,
- CFA_REGISTER, CFA_RESTORE): New.
- * rtl.def (EH_RETURN): New.
- * rtl.h (eh_returnjump_p, maybe_copy_epilogue_insn): Declare.
-
- * config/bfin/bfin.md (UNSPEC_VOLATILE_EH_RETURN): Remove.
- (eh_return_internal): Use eh_return rtx; split w/ epilogue.
-
- * config/i386/i386.c (gen_push): Update cfa state.
- (pro_epilogue_adjust_stack): Add set_cfa argument. When true,
- add a CFA_ADJUST_CFA note.
- (ix86_dwarf_handle_frame_unspec): Remove.
- (ix86_expand_prologue): Update cfa state.
- (ix86_emit_restore_reg_using_pop): New.
- (ix86_emit_restore_regs_using_pop): New.
- (ix86_emit_leave): New.
- (ix86_emit_restore_regs_using_mov): Add CFA_RESTORE notes.
- (ix86_expand_epilogue): Add notes for unwinding the epilogue.
- * config/i386/i386.h (struct machine_cfa_state): New.
- (ix86_cfa_state): New.
- * config/i386/i386.md (UNSPEC_EH_RETURN): Remove.
- (eh_return_internal): Merge from eh_return_<mode>,
- use eh_return rtx, split w/ epilogue.
-
2009-05-29 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (ix86_decompose_address): Avoid useless
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a88488db3a1..526779ef14e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -14,11 +14,6 @@
* gcc-interface/Makefile.in (aix LIBGNAT_TARGET_PAIRS): Use the
64bit system.ads for ppc64 multilib variants.
-2009-06-11 Richard Henderson <rth@redhat.com>
-
- * gcc-interface/misc.c (gnat_handle_option): Rename
- OPT_gdwarf_ to OPT_gdwarfplus.
-
2009-04-22 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils2.c (build_binary_op) <PLUS_EXPR>: If operation's
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 15927a46107..2c9ea9a1514 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -295,8 +295,8 @@ gnat_handle_option (size_t scode, const char *arg, int value)
gnat_argc++;
break;
- case OPT_gdwarfplus:
- gnat_dwarf_extensions = 1;
+ case OPT_gdwarf_:
+ gnat_dwarf_extensions ++;
break;
default:
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index dee9198ab36..190bde66848 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1672,7 +1672,8 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
/* Skip possible basic block header. */
if (LABEL_P (newpos1))
newpos1 = NEXT_INSN (newpos1);
- if (NOTE_INSN_BASIC_BLOCK_P (newpos1))
+
+ if (NOTE_P (newpos1))
newpos1 = NEXT_INSN (newpos1);
redirect_from = split_block (src1, PREV_INSN (newpos1))->src;
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index d0429963903..27eb029d076 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -1112,7 +1112,7 @@ cfg_layout_can_duplicate_bb_p (const_basic_block bb)
rtx
duplicate_insn_chain (rtx from, rtx to)
{
- rtx insn, last, copy;
+ rtx insn, last;
/* Avoid updating of boundaries of previous basic block. The
note will get removed from insn stream in fixup. */
@@ -1133,8 +1133,7 @@ duplicate_insn_chain (rtx from, rtx to)
if (GET_CODE (PATTERN (insn)) == ADDR_VEC
|| GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
break;
- copy = emit_copy_of_insn_after (insn, get_last_insn ());
- maybe_copy_epilogue_insn (insn, copy);
+ emit_copy_of_insn_after (insn, get_last_insn ());
break;
case CODE_LABEL:
@@ -1154,18 +1153,23 @@ duplicate_insn_chain (rtx from, rtx to)
case NOTE_INSN_DELETED:
case NOTE_INSN_DELETED_LABEL:
/* No problem to strip these. */
+ case NOTE_INSN_EPILOGUE_BEG:
+ /* Debug code expect these notes to exist just once.
+ Keep them in the master copy.
+ ??? It probably makes more sense to duplicate them for each
+ epilogue copy. */
case NOTE_INSN_FUNCTION_BEG:
/* There is always just single entry to function. */
case NOTE_INSN_BASIC_BLOCK:
break;
- case NOTE_INSN_EPILOGUE_BEG:
case NOTE_INSN_SWITCH_TEXT_SECTIONS:
emit_note_copy (insn);
break;
default:
- /* All other notes should have already been eliminated. */
+ /* All other notes should have already been eliminated.
+ */
gcc_unreachable ();
}
break;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index c8b7619d867..7af4215a845 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -87,16 +87,8 @@ static void rtl_make_forwarder_block (edge);
static int
can_delete_note_p (const_rtx note)
{
- switch (NOTE_KIND (note))
- {
- case NOTE_INSN_DELETED:
- case NOTE_INSN_BASIC_BLOCK:
- case NOTE_INSN_EPILOGUE_BEG:
- return true;
-
- default:
- return false;
- }
+ return (NOTE_KIND (note) == NOTE_INSN_DELETED
+ || NOTE_KIND (note) == NOTE_INSN_BASIC_BLOCK);
}
/* True if a given label can be deleted. */
diff --git a/gcc/common.opt b/gcc/common.opt
index a5e8e6a6dbe..023d773586a 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1371,12 +1371,12 @@ Common JoinedOrMissing
Generate debug information in default format
gcoff
-Common JoinedOrMissing Negative(gdwarf-)
+Common JoinedOrMissing Negative(gdwarf-2)
Generate debug information in COFF format
-gdwarf-
-Common Joined UInteger Var(dwarf_version) Init(2) Negative(gstabs)
-Generate debug information in DWARF v2 (or later) format
+gdwarf-2
+Common JoinedOrMissing Negative(gstabs)
+Generate debug information in DWARF v2 format
ggdb
Common JoinedOrMissing
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index 86bf3cdfcd3..516a2052f78 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -141,7 +141,8 @@
(UNSPEC_ONES 12)])
(define_constants
- [(UNSPEC_VOLATILE_CSYNC 1)
+ [(UNSPEC_VOLATILE_EH_RETURN 0)
+ (UNSPEC_VOLATILE_CSYNC 1)
(UNSPEC_VOLATILE_SSYNC 2)
(UNSPEC_VOLATILE_LOAD_FUNCDESC 3)
(UNSPEC_VOLATILE_STORE_EH_HANDLER 4)
@@ -2739,7 +2740,8 @@
"bfin_expand_epilogue (0, 0, 1); DONE;")
(define_expand "eh_return"
- [(use (match_operand:SI 0 "register_operand" ""))]
+ [(unspec_volatile [(match_operand:SI 0 "register_operand" "")]
+ UNSPEC_VOLATILE_EH_RETURN)]
""
{
emit_insn (gen_eh_store_handler (EH_RETURN_HANDLER_RTX, operands[0]));
@@ -2757,10 +2759,11 @@
[(set_attr "type" "mcst")])
(define_insn_and_split "eh_return_internal"
- [(eh_return)]
+ [(set (pc)
+ (unspec_volatile [(reg:SI REG_P2)] UNSPEC_VOLATILE_EH_RETURN))]
""
"#"
- "epilogue_completed"
+ "reload_completed"
[(const_int 1)]
"bfin_expand_epilogue (1, 1, 0); DONE;")
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index dbaccb308f9..2d2cc87e13c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7686,9 +7686,6 @@ output_set_got (rtx dest, rtx label ATTRIBUTE_UNUSED)
static rtx
gen_push (rtx arg)
{
- if (ix86_cfa_state->reg == stack_pointer_rtx)
- ix86_cfa_state->offset += UNITS_PER_WORD;
-
return gen_rtx_SET (VOIDmode,
gen_rtx_MEM (Pmode,
gen_rtx_PRE_DEC (Pmode,
@@ -7748,7 +7745,8 @@ ix86_save_reg (unsigned int regno, int maybe_eh_return)
}
}
- if (crtl->drap_reg && regno == REGNO (crtl->drap_reg))
+ if (crtl->drap_reg
+ && regno == REGNO (crtl->drap_reg))
return 1;
return (df_regs_ever_live_p (regno)
@@ -8078,49 +8076,6 @@ ix86_emit_save_sse_regs_using_mov (rtx pointer, HOST_WIDE_INT offset)
}
}
-static GTY(()) rtx queued_cfa_restores;
-
-/* Add a REG_CFA_RESTORE REG note to INSN or queue them until next stack
- manipulation insn. Don't add it if the previously
- saved value will be left untouched within stack red-zone till return,
- as unwinders can find the same value in the register and
- on the stack. */
-
-static void
-ix86_add_cfa_restore_note (rtx insn, rtx reg, HOST_WIDE_INT red_offset)
-{
- if (TARGET_RED_ZONE
- && !TARGET_64BIT_MS_ABI
- && red_offset + RED_ZONE_SIZE >= 0
- && crtl->args.pops_args < 65536)
- return;
-
- if (insn)
- {
- add_reg_note (insn, REG_CFA_RESTORE, reg);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- queued_cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE, reg, queued_cfa_restores);
-}
-
-/* Add queued REG_CFA_RESTORE notes if any to INSN. */
-
-static void
-ix86_add_queued_cfa_restore_notes (rtx insn)
-{
- rtx last;
- if (!queued_cfa_restores)
- return;
- for (last = queued_cfa_restores; XEXP (last, 1); last = XEXP (last, 1))
- ;
- XEXP (last, 1) = REG_NOTES (insn);
- REG_NOTES (insn) = queued_cfa_restores;
- queued_cfa_restores = NULL_RTX;
- RTX_FRAME_RELATED_P (insn) = 1;
-}
-
/* Expand prologue or epilogue stack adjustment.
The pattern exist to put a dependency on all ebp-based memory accesses.
STYLE should be negative if instructions should be marked as frame related,
@@ -8128,8 +8083,7 @@ ix86_add_queued_cfa_restore_notes (rtx insn)
otherwise. */
static void
-pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset,
- int style, bool set_cfa)
+pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset, int style)
{
rtx insn;
@@ -8152,24 +8106,7 @@ pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset,
insn = emit_insn (gen_pro_epilogue_adjust_stack_rex64_2 (dest, src, r11,
offset));
}
-
- if (style >= 0)
- ix86_add_queued_cfa_restore_notes (insn);
-
- if (set_cfa)
- {
- rtx r;
-
- gcc_assert (ix86_cfa_state->reg == src);
- ix86_cfa_state->offset += INTVAL (offset);
- ix86_cfa_state->reg = dest;
-
- r = gen_rtx_PLUS (Pmode, src, offset);
- r = gen_rtx_SET (VOIDmode, dest, r);
- add_reg_note (insn, REG_CFA_ADJUST_CFA, r);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else if (style < 0)
+ if (style < 0)
RTX_FRAME_RELATED_P (insn) = 1;
}
@@ -8305,6 +8242,30 @@ ix86_internal_arg_pointer (void)
return virtual_incoming_args_rtx;
}
+/* Handle the TARGET_DWARF_HANDLE_FRAME_UNSPEC hook.
+ This is called from dwarf2out.c to emit call frame instructions
+ for frame-related insns containing UNSPECs and UNSPEC_VOLATILEs. */
+static void
+ix86_dwarf_handle_frame_unspec (const char *label, rtx pattern, int index)
+{
+ rtx unspec = SET_SRC (pattern);
+ gcc_assert (GET_CODE (unspec) == UNSPEC);
+
+ switch (index)
+ {
+ case UNSPEC_REG_SAVE:
+ dwarf2out_reg_save_reg (label, XVECEXP (unspec, 0, 0),
+ SET_DEST (pattern));
+ break;
+ case UNSPEC_DEF_CFA:
+ dwarf2out_def_cfa (label, REGNO (SET_DEST (pattern)),
+ INTVAL (XVECEXP (unspec, 0, 0)));
+ break;
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Finalize stack_realign_needed flag, which will guide prologue/epilogue
to be generated in correct form. */
static void
@@ -8348,10 +8309,6 @@ ix86_expand_prologue (void)
/* DRAP should not coexist with stack_realign_fp */
gcc_assert (!(crtl->drap_reg && stack_realign_fp));
- /* Initialize CFA state for before the prologue. */
- ix86_cfa_state->reg = stack_pointer_rtx;
- ix86_cfa_state->offset = INCOMING_FRAME_SP_OFFSET;
-
ix86_compute_frame_layout (&frame);
/* Emit prologue code to adjust stack alignment and setup DRAP, in case
@@ -8381,7 +8338,6 @@ ix86_expand_prologue (void)
insn = emit_insn (gen_rtx_SET (VOIDmode, y, x));
RTX_FRAME_RELATED_P (insn) = 1;
- ix86_cfa_state->reg = crtl->drap_reg;
/* Align the stack. */
insn = emit_insn ((*ix86_gen_andsp) (stack_pointer_rtx,
@@ -8410,9 +8366,6 @@ ix86_expand_prologue (void)
insn = emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
-
- if (ix86_cfa_state->reg == stack_pointer_rtx)
- ix86_cfa_state->reg = hard_frame_pointer_rtx;
}
if (stack_realign_fp)
@@ -8451,8 +8404,7 @@ ix86_expand_prologue (void)
;
else if (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (-allocate), -1,
- ix86_cfa_state->reg == stack_pointer_rtx);
+ GEN_INT (-allocate), -1);
else
{
/* Only valid for Win32. */
@@ -8480,15 +8432,11 @@ ix86_expand_prologue (void)
else
insn = gen_allocate_stack_worker_32 (eax, eax);
insn = emit_insn (insn);
-
- if (ix86_cfa_state->reg == stack_pointer_rtx)
- {
- ix86_cfa_state->offset += allocate;
- t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-allocate));
- t = gen_rtx_SET (VOIDmode, stack_pointer_rtx, t);
- add_reg_note (insn, REG_CFA_ADJUST_CFA, t);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
+ RTX_FRAME_RELATED_P (insn) = 1;
+ t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-allocate));
+ t = gen_rtx_SET (VOIDmode, stack_pointer_rtx, t);
+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ t, REG_NOTES (insn));
if (eax_live)
{
@@ -8595,104 +8543,18 @@ ix86_expand_prologue (void)
emit_insn (gen_cld ());
}
-/* Emit code to restore REG using a POP insn. */
-
-static void
-ix86_emit_restore_reg_using_pop (rtx reg, HOST_WIDE_INT red_offset)
-{
- rtx insn = emit_insn (ix86_gen_pop1 (reg));
-
- if (ix86_cfa_state->reg == crtl->drap_reg
- && REGNO (reg) == REGNO (crtl->drap_reg))
- {
- /* Previously we'd represented the CFA as an expression
- like *(%ebp - 8). We've just popped that value from
- the stack, which means we need to reset the CFA to
- the drap register. This will remain until we restore
- the stack pointer. */
- add_reg_note (insn, REG_CFA_DEF_CFA, reg);
- RTX_FRAME_RELATED_P (insn) = 1;
- return;
- }
-
- if (ix86_cfa_state->reg == stack_pointer_rtx)
- {
- ix86_cfa_state->offset -= UNITS_PER_WORD;
- add_reg_note (insn, REG_CFA_ADJUST_CFA,
- copy_rtx (XVECEXP (PATTERN (insn), 0, 1)));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- /* When the frame pointer is the CFA, and we pop it, we are
- swapping back to the stack pointer as the CFA. This happens
- for stack frames that don't allocate other data, so we assume
- the stack pointer is now pointing at the return address, i.e.
- the function entry state, which makes the offset be 1 word. */
- else if (ix86_cfa_state->reg == hard_frame_pointer_rtx
- && reg == hard_frame_pointer_rtx)
- {
- ix86_cfa_state->reg = stack_pointer_rtx;
- ix86_cfa_state->offset = UNITS_PER_WORD;
-
- add_reg_note (insn, REG_CFA_DEF_CFA,
- gen_rtx_PLUS (Pmode, stack_pointer_rtx,
- GEN_INT (UNITS_PER_WORD)));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- ix86_add_cfa_restore_note (insn, reg, red_offset);
-}
-
-/* Emit code to restore saved registers using POP insns. */
-
-static void
-ix86_emit_restore_regs_using_pop (HOST_WIDE_INT red_offset)
-{
- int regno;
-
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, false))
- {
- ix86_emit_restore_reg_using_pop (gen_rtx_REG (Pmode, regno),
- red_offset);
- red_offset += UNITS_PER_WORD;
- }
-}
-
-/* Emit code and notes for the LEAVE instruction. */
-
-static void
-ix86_emit_leave (HOST_WIDE_INT red_offset)
-{
- rtx insn = emit_insn (ix86_gen_leave ());
-
- ix86_add_queued_cfa_restore_notes (insn);
-
- if (ix86_cfa_state->reg == hard_frame_pointer_rtx)
- {
- add_reg_note (insn, REG_CFA_ADJUST_CFA,
- copy_rtx (XVECEXP (PATTERN (insn), 0, 0)));
- RTX_FRAME_RELATED_P (insn) = 1;
- ix86_add_cfa_restore_note (insn, hard_frame_pointer_rtx, red_offset);
- }
-}
-
/* Emit code to restore saved registers using MOV insns. First register
is restored from POINTER + OFFSET. */
static void
ix86_emit_restore_regs_using_mov (rtx pointer, HOST_WIDE_INT offset,
- HOST_WIDE_INT red_offset,
int maybe_eh_return)
{
- unsigned int regno;
+ int regno;
rtx base_address = gen_rtx_MEM (Pmode, pointer);
- rtx insn;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, maybe_eh_return))
{
- rtx reg = gen_rtx_REG (Pmode, regno);
-
/* Ensure that adjust_address won't be forced to produce pointer
out of range allowed by x86-64 instruction set. */
if (TARGET_64BIT && offset != trunc_int_for_mode (offset, SImode))
@@ -8705,25 +8567,9 @@ ix86_emit_restore_regs_using_mov (rtx pointer, HOST_WIDE_INT offset,
base_address = gen_rtx_MEM (Pmode, r11);
offset = 0;
}
- insn = emit_move_insn (reg,
- adjust_address (base_address, Pmode, offset));
+ emit_move_insn (gen_rtx_REG (Pmode, regno),
+ adjust_address (base_address, Pmode, offset));
offset += UNITS_PER_WORD;
-
- if (ix86_cfa_state->reg == crtl->drap_reg
- && regno == REGNO (crtl->drap_reg))
- {
- /* Previously we'd represented the CFA as an expression
- like *(%ebp - 8). We've just popped that value from
- the stack, which means we need to reset the CFA to
- the drap register. This will remain until we restore
- the stack pointer. */
- add_reg_note (insn, REG_CFA_DEF_CFA, reg);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
- else
- ix86_add_cfa_restore_note (NULL_RTX, reg, red_offset);
-
- red_offset += UNITS_PER_WORD;
}
}
@@ -8731,18 +8577,15 @@ ix86_emit_restore_regs_using_mov (rtx pointer, HOST_WIDE_INT offset,
is restored from POINTER + OFFSET. */
static void
ix86_emit_restore_sse_regs_using_mov (rtx pointer, HOST_WIDE_INT offset,
- HOST_WIDE_INT red_offset,
int maybe_eh_return)
{
int regno;
rtx base_address = gen_rtx_MEM (TImode, pointer);
- rtx mem, insn;
+ rtx mem;
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (SSE_REGNO_P (regno) && ix86_save_reg (regno, maybe_eh_return))
{
- rtx reg = gen_rtx_REG (TImode, regno);
-
/* Ensure that adjust_address won't be forced to produce pointer
out of range allowed by x86-64 instruction set. */
if (TARGET_64BIT && offset != trunc_int_for_mode (offset, SImode))
@@ -8757,12 +8600,8 @@ ix86_emit_restore_sse_regs_using_mov (rtx pointer, HOST_WIDE_INT offset,
}
mem = adjust_address (base_address, TImode, offset);
set_mem_align (mem, 128);
- insn = emit_move_insn (reg, mem);
+ emit_move_insn (gen_rtx_REG (TImode, regno), mem);
offset += 16;
-
- ix86_add_cfa_restore_note (NULL_RTX, reg, red_offset);
-
- red_offset += 16;
}
}
@@ -8771,11 +8610,10 @@ ix86_emit_restore_sse_regs_using_mov (rtx pointer, HOST_WIDE_INT offset,
void
ix86_expand_epilogue (int style)
{
+ int regno;
int sp_valid;
struct ix86_frame frame;
- HOST_WIDE_INT offset, red_offset;
- struct machine_cfa_state cfa_state_save = *ix86_cfa_state;
- bool using_drap;
+ HOST_WIDE_INT offset;
ix86_finalize_stack_realign_flags ();
@@ -8791,9 +8629,6 @@ ix86_expand_epilogue (int style)
if (frame_pointer_needed && frame.red_zone_size)
emit_insn (gen_memory_blockage ());
- using_drap = crtl->drap_reg && crtl->stack_realign_needed;
- gcc_assert (!using_drap || ix86_cfa_state->reg == crtl->drap_reg);
-
/* Calculate start of saved registers relative to ebp. Special care
must be taken for the normal return case of a function using
eh_return: the eax and edx registers are marked as saved, but not
@@ -8804,19 +8639,6 @@ ix86_expand_epilogue (int style)
offset *= -UNITS_PER_WORD;
offset -= frame.nsseregs * 16 + frame.padding0;
- /* Calculate start of saved registers relative to esp on entry of the
- function. When realigning stack, this needs to be the most negative
- value possible at runtime. */
- red_offset = offset;
- if (using_drap)
- red_offset -= crtl->stack_alignment_needed / BITS_PER_UNIT
- + UNITS_PER_WORD;
- else if (stack_realign_fp)
- red_offset -= crtl->stack_alignment_needed / BITS_PER_UNIT
- - UNITS_PER_WORD;
- if (frame_pointer_needed)
- red_offset -= UNITS_PER_WORD;
-
/* If we're only restoring one register and sp is not valid then
using a move instruction to restore the register since it's
less work than reloading sp and popping the register.
@@ -8831,8 +8653,7 @@ ix86_expand_epilogue (int style)
|| (TARGET_EPILOGUE_USING_MOVE
&& cfun->machine->use_fast_prologue_epilogue
&& ((frame.nregs + frame.nsseregs) > 1 || frame.to_allocate))
- || (frame_pointer_needed && !(frame.nregs + frame.nsseregs)
- && frame.to_allocate)
+ || (frame_pointer_needed && !(frame.nregs + frame.nsseregs) && frame.to_allocate)
|| (frame_pointer_needed && TARGET_USE_LEAVE
&& cfun->machine->use_fast_prologue_epilogue
&& (frame.nregs + frame.nsseregs) == 1)
@@ -8852,32 +8673,22 @@ ix86_expand_epilogue (int style)
|| stack_realign_fp)
{
ix86_emit_restore_sse_regs_using_mov (stack_pointer_rtx,
- frame.to_allocate, red_offset,
- style == 2);
+ frame.to_allocate, style == 2);
ix86_emit_restore_regs_using_mov (stack_pointer_rtx,
frame.to_allocate
+ frame.nsseregs * 16
- + frame.padding0,
- red_offset
- + frame.nsseregs * 16
+ frame.padding0, style == 2);
}
else
{
ix86_emit_restore_sse_regs_using_mov (hard_frame_pointer_rtx,
- offset, red_offset,
- style == 2);
+ offset, style == 2);
ix86_emit_restore_regs_using_mov (hard_frame_pointer_rtx,
offset
+ frame.nsseregs * 16
- + frame.padding0,
- red_offset
- + frame.nsseregs * 16
+ frame.padding0, style == 2);
}
- red_offset -= offset;
-
/* eh_return epilogues need %ecx added to the stack pointer. */
if (style == 2)
{
@@ -8890,29 +8701,13 @@ ix86_expand_epilogue (int style)
{
tmp = gen_rtx_PLUS (Pmode, hard_frame_pointer_rtx, sa);
tmp = plus_constant (tmp, UNITS_PER_WORD);
- tmp = emit_insn (gen_rtx_SET (VOIDmode, sa, tmp));
+ emit_insn (gen_rtx_SET (VOIDmode, sa, tmp));
tmp = gen_rtx_MEM (Pmode, hard_frame_pointer_rtx);
- tmp = emit_move_insn (hard_frame_pointer_rtx, tmp);
-
- /* Note that we use SA as a temporary CFA, as the return
- address is at the proper place relative to it. We
- pretend this happens at the FP restore insn because
- prior to this insn the FP would be stored at the wrong
- offset relative to SA, and after this insn we have no
- other reasonable register to use for the CFA. We don't
- bother resetting the CFA to the SP for the duration of
- the return insn. */
- add_reg_note (tmp, REG_CFA_DEF_CFA,
- plus_constant (sa, UNITS_PER_WORD));
- ix86_add_queued_cfa_restore_notes (tmp);
- add_reg_note (tmp, REG_CFA_RESTORE, hard_frame_pointer_rtx);
- RTX_FRAME_RELATED_P (tmp) = 1;
- ix86_cfa_state->reg = sa;
- ix86_cfa_state->offset = UNITS_PER_WORD;
+ emit_move_insn (hard_frame_pointer_rtx, tmp);
pro_epilogue_adjust_stack (stack_pointer_rtx, sa,
- const0_rtx, style, false);
+ const0_rtx, style);
}
else
{
@@ -8921,18 +8716,7 @@ ix86_expand_epilogue (int style)
+ frame.nregs * UNITS_PER_WORD
+ frame.nsseregs * 16
+ frame.padding0));
- tmp = emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx, tmp));
- ix86_add_queued_cfa_restore_notes (tmp);
-
- gcc_assert (ix86_cfa_state->reg == stack_pointer_rtx);
- if (ix86_cfa_state->offset != UNITS_PER_WORD)
- {
- ix86_cfa_state->offset = UNITS_PER_WORD;
- add_reg_note (tmp, REG_CFA_DEF_CFA,
- plus_constant (stack_pointer_rtx,
- UNITS_PER_WORD));
- RTX_FRAME_RELATED_P (tmp) = 1;
- }
+ emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx, tmp));
}
}
else if (!frame_pointer_needed)
@@ -8941,18 +8725,18 @@ ix86_expand_epilogue (int style)
+ frame.nregs * UNITS_PER_WORD
+ frame.nsseregs * 16
+ frame.padding0),
- style, !using_drap);
+ style);
/* If not an i386, mov & pop is faster than "leave". */
else if (TARGET_USE_LEAVE || optimize_function_for_size_p (cfun)
|| !cfun->machine->use_fast_prologue_epilogue)
- ix86_emit_leave (red_offset);
+ emit_insn ((*ix86_gen_leave) ());
else
{
pro_epilogue_adjust_stack (stack_pointer_rtx,
hard_frame_pointer_rtx,
- const0_rtx, style, !using_drap);
+ const0_rtx, style);
- ix86_emit_restore_reg_using_pop (hard_frame_pointer_rtx, red_offset);
+ emit_insn ((*ix86_gen_pop1) (hard_frame_pointer_rtx));
}
}
else
@@ -8970,36 +8754,32 @@ ix86_expand_epilogue (int style)
gcc_assert (!stack_realign_fp);
pro_epilogue_adjust_stack (stack_pointer_rtx,
hard_frame_pointer_rtx,
- GEN_INT (offset), style, false);
+ GEN_INT (offset), style);
ix86_emit_restore_sse_regs_using_mov (stack_pointer_rtx,
- frame.to_allocate, red_offset,
- style == 2);
+ frame.to_allocate, style == 2);
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
- GEN_INT (frame.nsseregs * 16),
- style, false);
+ GEN_INT (frame.nsseregs * 16), style);
}
else if (frame.to_allocate || frame.nsseregs)
{
ix86_emit_restore_sse_regs_using_mov (stack_pointer_rtx,
- frame.to_allocate, red_offset,
+ frame.to_allocate,
style == 2);
pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (frame.to_allocate
+ frame.nsseregs * 16
- + frame.padding0), style,
- !using_drap && !frame_pointer_needed);
+ + frame.padding0), style);
}
- ix86_emit_restore_regs_using_pop (red_offset + frame.nsseregs * 16
- + frame.padding0);
- red_offset -= offset;
-
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (!SSE_REGNO_P (regno) && ix86_save_reg (regno, false))
+ emit_insn ((*ix86_gen_pop1) (gen_rtx_REG (Pmode, regno)));
if (frame_pointer_needed)
{
/* Leave results in shorter dependency chains on CPUs that are
able to grok it fast. */
if (TARGET_USE_LEAVE)
- ix86_emit_leave (red_offset);
+ emit_insn ((*ix86_gen_leave) ());
else
{
/* For stack realigned really happens, recover stack
@@ -9008,71 +8788,47 @@ ix86_expand_epilogue (int style)
if (stack_realign_fp)
pro_epilogue_adjust_stack (stack_pointer_rtx,
hard_frame_pointer_rtx,
- const0_rtx, style, !using_drap);
- ix86_emit_restore_reg_using_pop (hard_frame_pointer_rtx,
- red_offset);
+ const0_rtx, style);
+ emit_insn ((*ix86_gen_pop1) (hard_frame_pointer_rtx));
}
}
}
- if (using_drap)
+ if (crtl->drap_reg && crtl->stack_realign_needed)
{
int param_ptr_offset = (call_used_regs[REGNO (crtl->drap_reg)]
? 0 : UNITS_PER_WORD);
- rtx insn;
-
gcc_assert (stack_realign_drap);
-
- insn = emit_insn ((*ix86_gen_add3) (stack_pointer_rtx,
- crtl->drap_reg,
- GEN_INT (-(UNITS_PER_WORD
- + param_ptr_offset))));
-
- ix86_cfa_state->reg = stack_pointer_rtx;
- ix86_cfa_state->offset = UNITS_PER_WORD + param_ptr_offset;
-
- add_reg_note (insn, REG_CFA_DEF_CFA,
- gen_rtx_PLUS (Pmode, ix86_cfa_state->reg,
- GEN_INT (ix86_cfa_state->offset)));
- RTX_FRAME_RELATED_P (insn) = 1;
-
- if (param_ptr_offset)
- ix86_emit_restore_reg_using_pop (crtl->drap_reg, -UNITS_PER_WORD);
+ emit_insn ((*ix86_gen_add3) (stack_pointer_rtx,
+ crtl->drap_reg,
+ GEN_INT (-(UNITS_PER_WORD
+ + param_ptr_offset))));
+ if (!call_used_regs[REGNO (crtl->drap_reg)])
+ emit_insn ((*ix86_gen_pop1) (crtl->drap_reg));
+
}
/* Sibcall epilogues don't want a return instruction. */
if (style == 0)
- {
- *ix86_cfa_state = cfa_state_save;
- return;
- }
+ return;
if (crtl->args.pops_args && crtl->args.size)
{
rtx popc = GEN_INT (crtl->args.pops_args);
- /* i386 can only pop 64K bytes. If asked to pop more, pop return
- address, do explicit add, and jump indirectly to the caller. */
+ /* i386 can only pop 64K bytes. If asked to pop more, pop
+ return address, do explicit add, and jump indirectly to the
+ caller. */
if (crtl->args.pops_args >= 65536)
{
rtx ecx = gen_rtx_REG (SImode, CX_REG);
- rtx insn;
/* There is no "pascal" calling convention in any 64bit ABI. */
gcc_assert (!TARGET_64BIT);
- insn = emit_insn (gen_popsi1 (ecx));
- ix86_cfa_state->offset -= UNITS_PER_WORD;
-
- add_reg_note (insn, REG_CFA_ADJUST_CFA,
- copy_rtx (XVECEXP (PATTERN (insn), 0, 1)));
- add_reg_note (insn, REG_CFA_REGISTER,
- gen_rtx_SET (VOIDmode, ecx, pc_rtx));
- RTX_FRAME_RELATED_P (insn) = 1;
-
- pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
- popc, -1, true);
+ emit_insn (gen_popsi1 (ecx));
+ emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, popc));
emit_jump_insn (gen_return_indirect_internal (ecx));
}
else
@@ -9080,10 +8836,6 @@ ix86_expand_epilogue (int style)
}
else
emit_jump_insn (gen_return_internal ());
-
- /* Restore the state back to the state from the prologue,
- so that it's correct for the next epilogue. */
- *ix86_cfa_state = cfa_state_save;
}
/* Reset from the function's potential modifications. */
@@ -30658,6 +30410,8 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#define TARGET_UPDATE_STACK_BOUNDARY ix86_update_stack_boundary
#undef TARGET_GET_DRAP_RTX
#define TARGET_GET_DRAP_RTX ix86_get_drap_rtx
+#undef TARGET_DWARF_HANDLE_FRAME_UNSPEC
+#define TARGET_DWARF_HANDLE_FRAME_UNSPEC ix86_dwarf_handle_frame_unspec
#undef TARGET_STRICT_ARGUMENT_NAMING
#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 7279dc6cd46..b29de5f1b40 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2399,15 +2399,6 @@ enum ix86_stack_slot
#define FASTCALL_PREFIX '@'
-/* Machine specific CFA tracking during prologue/epilogue generation. */
-
-#ifndef USED_FOR_TARGET
-struct machine_cfa_state GTY(())
-{
- rtx reg;
- HOST_WIDE_INT offset;
-};
-
struct machine_function GTY(())
{
struct stack_local_entry *stack_locals;
@@ -2436,9 +2427,7 @@ struct machine_function GTY(())
/* This value is used for amd64 targets and specifies the current abi
to be used. MS_ABI means ms abi. Otherwise SYSV_ABI means sysv abi. */
int call_abi;
- struct machine_cfa_state cfa;
};
-#endif
#define ix86_stack_locals (cfun->machine->stack_locals)
#define ix86_varargs_gpr_size (cfun->machine->varargs_gpr_size)
@@ -2454,7 +2443,6 @@ struct machine_function GTY(())
REG_SP is live. */
#define ix86_current_function_calls_tls_descriptor \
(ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG))
-#define ix86_cfa_state (&cfun->machine->cfa)
/* Control behavior of x86_file_start. */
#define X86_FILE_START_VERSION_DIRECTIVE false
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f4ffd4f8c98..d89c28fdb9f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -84,6 +84,7 @@
(UNSPEC_ADD_CARRY 34)
(UNSPEC_FLDCW 35)
(UNSPEC_REP 36)
+ (UNSPEC_EH_RETURN 37)
(UNSPEC_LD_MPIC 38) ; load_macho_picbase
(UNSPEC_TRUNC_NOOP 39)
@@ -15770,16 +15771,21 @@
tmp = gen_rtx_MEM (Pmode, tmp);
emit_move_insn (tmp, ra);
- emit_jump_insn (gen_eh_return_internal ());
+ if (Pmode == SImode)
+ emit_jump_insn (gen_eh_return_si (sa));
+ else
+ emit_jump_insn (gen_eh_return_di (sa));
emit_barrier ();
DONE;
})
-(define_insn_and_split "eh_return_internal"
- [(eh_return)]
+(define_insn_and_split "eh_return_<mode>"
+ [(set (pc)
+ (unspec [(match_operand:P 0 "register_operand" "c")]
+ UNSPEC_EH_RETURN))]
""
"#"
- "epilogue_completed"
+ "reload_completed"
[(const_int 0)]
"ix86_expand_epilogue (2); DONE;")
diff --git a/gcc/config/rs6000/crtresfpr.asm b/gcc/config/rs6000/crtresfpr.asm
index 9fb228cf458..7adc9c1e757 100644
--- a/gcc/config/rs6000/crtresfpr.asm
+++ b/gcc/config/rs6000/crtresfpr.asm
@@ -38,7 +38,6 @@
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the floating point save area. */
-CFI_STARTPROC
HIDDEN_FUNC(_restfpr_14) lfd 14,-144(11) /* restore fp registers */
HIDDEN_FUNC(_restfpr_15) lfd 15,-136(11)
HIDDEN_FUNC(_restfpr_16) lfd 16,-128(11)
@@ -76,6 +75,5 @@ FUNC_END(_restfpr_17)
FUNC_END(_restfpr_16)
FUNC_END(_restfpr_15)
FUNC_END(_restfpr_14)
-CFI_ENDPROC
#endif
diff --git a/gcc/config/rs6000/crtresgpr.asm b/gcc/config/rs6000/crtresgpr.asm
index 9f9cec9f9ca..4ed3d8e21c5 100644
--- a/gcc/config/rs6000/crtresgpr.asm
+++ b/gcc/config/rs6000/crtresgpr.asm
@@ -38,7 +38,6 @@
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the integer restore area. */
-CFI_STARTPROC
HIDDEN_FUNC(_restgpr_14) lwz 14,-72(11) /* restore gp registers */
HIDDEN_FUNC(_restgpr_15) lwz 15,-68(11)
HIDDEN_FUNC(_restgpr_16) lwz 16,-64(11)
@@ -76,6 +75,5 @@ FUNC_END(_restgpr_17)
FUNC_END(_restgpr_16)
FUNC_END(_restgpr_15)
FUNC_END(_restgpr_14)
-CFI_ENDPROC
#endif
diff --git a/gcc/config/rs6000/crtresxfpr.asm b/gcc/config/rs6000/crtresxfpr.asm
index 633f2db61f0..5a87a98052f 100644
--- a/gcc/config/rs6000/crtresxfpr.asm
+++ b/gcc/config/rs6000/crtresxfpr.asm
@@ -40,68 +40,27 @@
/* In addition to restoring the fp registers, it will return to the caller's */
/* caller */
-CFI_STARTPROC
-CFI_DEF_CFA_REGISTER (11)
-CFI_OFFSET (65, 4)
-CFI_OFFSET (46, -144)
-CFI_OFFSET (47, -136)
-CFI_OFFSET (48, -128)
-CFI_OFFSET (49, -120)
-CFI_OFFSET (50, -112)
-CFI_OFFSET (51, -104)
-CFI_OFFSET (52, -96)
-CFI_OFFSET (53, -88)
-CFI_OFFSET (54, -80)
-CFI_OFFSET (55, -72)
-CFI_OFFSET (56, -64)
-CFI_OFFSET (57, -56)
-CFI_OFFSET (58, -48)
-CFI_OFFSET (59, -40)
-CFI_OFFSET (60, -32)
-CFI_OFFSET (61, -24)
-CFI_OFFSET (62, -16)
-CFI_OFFSET (63, -8)
HIDDEN_FUNC(_restfpr_14_x) lfd 14,-144(11) /* restore fp registers */
-CFI_RESTORE (46)
HIDDEN_FUNC(_restfpr_15_x) lfd 15,-136(11)
-CFI_RESTORE (47)
HIDDEN_FUNC(_restfpr_16_x) lfd 16,-128(11)
-CFI_RESTORE (48)
HIDDEN_FUNC(_restfpr_17_x) lfd 17,-120(11)
-CFI_RESTORE (49)
HIDDEN_FUNC(_restfpr_18_x) lfd 18,-112(11)
-CFI_RESTORE (50)
HIDDEN_FUNC(_restfpr_19_x) lfd 19,-104(11)
-CFI_RESTORE (51)
HIDDEN_FUNC(_restfpr_20_x) lfd 20,-96(11)
-CFI_RESTORE (52)
HIDDEN_FUNC(_restfpr_21_x) lfd 21,-88(11)
-CFI_RESTORE (53)
HIDDEN_FUNC(_restfpr_22_x) lfd 22,-80(11)
-CFI_RESTORE (54)
HIDDEN_FUNC(_restfpr_23_x) lfd 23,-72(11)
-CFI_RESTORE (55)
HIDDEN_FUNC(_restfpr_24_x) lfd 24,-64(11)
-CFI_RESTORE (56)
HIDDEN_FUNC(_restfpr_25_x) lfd 25,-56(11)
-CFI_RESTORE (57)
HIDDEN_FUNC(_restfpr_26_x) lfd 26,-48(11)
-CFI_RESTORE (58)
HIDDEN_FUNC(_restfpr_27_x) lfd 27,-40(11)
-CFI_RESTORE (59)
HIDDEN_FUNC(_restfpr_28_x) lfd 28,-32(11)
-CFI_RESTORE (60)
HIDDEN_FUNC(_restfpr_29_x) lfd 29,-24(11)
-CFI_RESTORE (61)
HIDDEN_FUNC(_restfpr_30_x) lfd 30,-16(11)
-CFI_RESTORE (62)
HIDDEN_FUNC(_restfpr_31_x) lwz 0,4(11)
lfd 31,-8(11)
-CFI_RESTORE (63)
mtlr 0
-CFI_RESTORE (65)
mr 1,11
-CFI_DEF_CFA_REGISTER (1)
blr
FUNC_END(_restfpr_31_x)
FUNC_END(_restfpr_30_x)
@@ -121,6 +80,5 @@ FUNC_END(_restfpr_17_x)
FUNC_END(_restfpr_16_x)
FUNC_END(_restfpr_15_x)
FUNC_END(_restfpr_14_x)
-CFI_ENDPROC
#endif
diff --git a/gcc/config/rs6000/crtresxgpr.asm b/gcc/config/rs6000/crtresxgpr.asm
index 451b2b69d1e..9317131c8ce 100644
--- a/gcc/config/rs6000/crtresxgpr.asm
+++ b/gcc/config/rs6000/crtresxgpr.asm
@@ -38,68 +38,27 @@
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the integer restore area. */
-CFI_STARTPROC
-CFI_DEF_CFA_REGISTER (11)
-CFI_OFFSET (65, 4)
-CFI_OFFSET (14, -72)
-CFI_OFFSET (15, -68)
-CFI_OFFSET (16, -64)
-CFI_OFFSET (17, -60)
-CFI_OFFSET (18, -56)
-CFI_OFFSET (19, -52)
-CFI_OFFSET (20, -48)
-CFI_OFFSET (21, -44)
-CFI_OFFSET (22, -40)
-CFI_OFFSET (23, -36)
-CFI_OFFSET (24, -32)
-CFI_OFFSET (25, -28)
-CFI_OFFSET (26, -24)
-CFI_OFFSET (27, -20)
-CFI_OFFSET (28, -16)
-CFI_OFFSET (29, -12)
-CFI_OFFSET (30, -8)
-CFI_OFFSET (31, -4)
HIDDEN_FUNC(_restgpr_14_x) lwz 14,-72(11) /* restore gp registers */
-CFI_RESTORE (14)
HIDDEN_FUNC(_restgpr_15_x) lwz 15,-68(11)
-CFI_RESTORE (15)
HIDDEN_FUNC(_restgpr_16_x) lwz 16,-64(11)
-CFI_RESTORE (16)
HIDDEN_FUNC(_restgpr_17_x) lwz 17,-60(11)
-CFI_RESTORE (17)
HIDDEN_FUNC(_restgpr_18_x) lwz 18,-56(11)
-CFI_RESTORE (18)
HIDDEN_FUNC(_restgpr_19_x) lwz 19,-52(11)
-CFI_RESTORE (19)
HIDDEN_FUNC(_restgpr_20_x) lwz 20,-48(11)
-CFI_RESTORE (20)
HIDDEN_FUNC(_restgpr_21_x) lwz 21,-44(11)
-CFI_RESTORE (21)
HIDDEN_FUNC(_restgpr_22_x) lwz 22,-40(11)
-CFI_RESTORE (22)
HIDDEN_FUNC(_restgpr_23_x) lwz 23,-36(11)
-CFI_RESTORE (23)
HIDDEN_FUNC(_restgpr_24_x) lwz 24,-32(11)
-CFI_RESTORE (24)
HIDDEN_FUNC(_restgpr_25_x) lwz 25,-28(11)
-CFI_RESTORE (25)
HIDDEN_FUNC(_restgpr_26_x) lwz 26,-24(11)
-CFI_RESTORE (26)
HIDDEN_FUNC(_restgpr_27_x) lwz 27,-20(11)
-CFI_RESTORE (27)
HIDDEN_FUNC(_restgpr_28_x) lwz 28,-16(11)
-CFI_RESTORE (28)
HIDDEN_FUNC(_restgpr_29_x) lwz 29,-12(11)
-CFI_RESTORE (29)
HIDDEN_FUNC(_restgpr_30_x) lwz 30,-8(11)
-CFI_RESTORE (30)
HIDDEN_FUNC(_restgpr_31_x) lwz 0,4(11)
lwz 31,-4(11)
-CFI_RESTORE (31)
mtlr 0
-CFI_RESTORE (65)
mr 1,11
-CFI_DEF_CFA_REGISTER (1)
blr
FUNC_END(_restgpr_31_x)
FUNC_END(_restgpr_30_x)
@@ -119,6 +78,5 @@ FUNC_END(_restgpr_17_x)
FUNC_END(_restgpr_16_x)
FUNC_END(_restgpr_15_x)
FUNC_END(_restgpr_14_x)
-CFI_ENDPROC
#endif
diff --git a/gcc/config/rs6000/crtsavfpr.asm b/gcc/config/rs6000/crtsavfpr.asm
index 3cdb25033ca..fe40a9e13d0 100644
--- a/gcc/config/rs6000/crtsavfpr.asm
+++ b/gcc/config/rs6000/crtsavfpr.asm
@@ -38,7 +38,6 @@
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the floating point save area. */
-CFI_STARTPROC
HIDDEN_FUNC(_savefpr_14) stfd 14,-144(11) /* save fp registers */
HIDDEN_FUNC(_savefpr_15) stfd 15,-136(11)
HIDDEN_FUNC(_savefpr_16) stfd 16,-128(11)
@@ -76,6 +75,5 @@ FUNC_END(_savefpr_17)
FUNC_END(_savefpr_16)
FUNC_END(_savefpr_15)
FUNC_END(_savefpr_14)
-CFI_ENDPROC
#endif
diff --git a/gcc/config/rs6000/crtsavgpr.asm b/gcc/config/rs6000/crtsavgpr.asm
index 6d473963bad..6c5f6720934 100644
--- a/gcc/config/rs6000/crtsavgpr.asm
+++ b/gcc/config/rs6000/crtsavgpr.asm
@@ -38,7 +38,6 @@
/* Called with r11 pointing to the stack header word of the caller of the */
/* function, just beyond the end of the integer save area. */
-CFI_STARTPROC
HIDDEN_FUNC(_savegpr_14) stw 14,-72(11) /* save gp registers */
HIDDEN_FUNC(_savegpr_15) stw 15,-68(11)
HIDDEN_FUNC(_savegpr_16) stw 16,-64(11)
@@ -76,6 +75,5 @@ FUNC_END(_savegpr_17)
FUNC_END(_savegpr_16)
FUNC_END(_savegpr_15)
FUNC_END(_savegpr_14)
-CFI_ENDPROC
#endif
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 0f3f272b958..af7869c703b 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -172,25 +172,6 @@ GLUE(.L,name): \
.size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
#endif
-#ifdef IN_GCC
-/* For HAVE_GAS_CFI_DIRECTIVE. */
-#include "auto-host.h"
-
-#ifdef HAVE_GAS_CFI_DIRECTIVE
-# define CFI_STARTPROC .cfi_startproc
-# define CFI_ENDPROC .cfi_endproc
-# define CFI_OFFSET(reg, off) .cfi_offset reg, off
-# define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg
-# define CFI_RESTORE(reg) .cfi_restore reg
-#else
-# define CFI_STARTPROC
-# define CFI_ENDPROC
-# define CFI_OFFSET(reg, off)
-# define CFI_DEF_CFA_REGISTER(reg)
-# define CFI_RESTORE(reg)
-#endif
-#endif
-
#if defined __linux__
.section .note.GNU-stack
.previous
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 496fc62ce33..80e4a2f2954 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -782,7 +782,7 @@ static const char *rs6000_mangle_type (const_tree);
extern const struct attribute_spec rs6000_attribute_table[];
static void rs6000_set_default_type_attributes (tree);
static rtx rs6000_savres_routine_sym (rs6000_stack_t *, bool, bool, bool);
-static rtx rs6000_emit_stack_reset (rs6000_stack_t *, rtx, rtx, int, bool);
+static void rs6000_emit_stack_reset (rs6000_stack_t *, rtx, rtx, int, bool);
static rtx rs6000_make_savres_rtx (rs6000_stack_t *, rtx, int,
enum machine_mode, bool, bool, bool);
static bool rs6000_reg_live_or_pic_offset_p (int);
@@ -15918,7 +15918,7 @@ rs6000_savres_routine_sym (rs6000_stack_t *info, bool savep, bool gpr, bool exit
stack pointer, but move the base of the frame into r11 for use by
out-of-line register restore routines. */
-static rtx
+static void
rs6000_emit_stack_reset (rs6000_stack_t *info,
rtx sp_reg_rtx, rtx frame_reg_rtx,
int sp_offset, bool savres)
@@ -15935,10 +15935,10 @@ rs6000_emit_stack_reset (rs6000_stack_t *info,
{
rs6000_emit_stack_tie ();
if (sp_offset != 0)
- return emit_insn (gen_addsi3 (sp_reg_rtx, frame_reg_rtx,
- GEN_INT (sp_offset)));
+ emit_insn (gen_addsi3 (sp_reg_rtx, frame_reg_rtx,
+ GEN_INT (sp_offset)));
else if (!savres)
- return emit_move_insn (sp_reg_rtx, frame_reg_rtx);
+ emit_move_insn (sp_reg_rtx, frame_reg_rtx);
}
else if (sp_offset != 0)
{
@@ -15950,12 +15950,12 @@ rs6000_emit_stack_reset (rs6000_stack_t *info,
? gen_rtx_REG (Pmode, 11)
: sp_reg_rtx);
- rtx insn = emit_insn (gen_add3_insn (dest_reg, sp_reg_rtx,
- GEN_INT (sp_offset)));
- if (!savres)
- return insn;
+ emit_insn (TARGET_32BIT
+ ? gen_addsi3 (dest_reg, sp_reg_rtx,
+ GEN_INT (sp_offset))
+ : gen_adddi3 (dest_reg, sp_reg_rtx,
+ GEN_INT (sp_offset)));
}
- return NULL_RTX;
}
/* Construct a parallel rtx describing the effect of a call to an
@@ -16870,19 +16870,12 @@ rs6000_restore_saved_cr (rtx reg, int using_mfcr_multiple)
}
}
-/* Return true if OFFSET from stack pointer can be clobbered by signals.
- V.4 doesn't have any stack cushion, AIX ABIs have 220 or 288 bytes
- below stack pointer not cloberred by signals. */
-
-static inline bool
-offset_below_red_zone_p (HOST_WIDE_INT offset)
-{
- return offset < (DEFAULT_ABI == ABI_V4
- ? 0
- : TARGET_32BIT ? -220 : -288);
-}
+/* Emit function epilogue as insns.
-/* Emit function epilogue as insns. */
+ At present, dwarf2out_frame_debug_expr doesn't understand
+ register restores, so we don't bother setting RTX_FRAME_RELATED_P
+ anywhere in the epilogue. Most of the insns below would in any case
+ need special notes to explain where r11 is in relation to the stack. */
void
rs6000_emit_epilogue (int sibcall)
@@ -16898,8 +16891,6 @@ rs6000_emit_epilogue (int sibcall)
int sp_offset = 0;
rtx sp_reg_rtx = gen_rtx_REG (Pmode, 1);
rtx frame_reg_rtx = sp_reg_rtx;
- rtx cfa_restores = NULL_RTX;
- rtx insn;
enum machine_mode reg_mode = Pmode;
int reg_size = TARGET_32BIT ? 4 : 8;
int i;
@@ -17040,7 +17031,7 @@ rs6000_emit_epilogue (int sibcall)
&& info->altivec_size != 0
&& (ALWAYS_RESTORE_ALTIVEC_BEFORE_POP
|| (DEFAULT_ABI != ABI_V4
- && offset_below_red_zone_p (info->altivec_save_offset))))
+ && info->altivec_save_offset < (TARGET_32BIT ? -220 : -288))))
{
int i;
@@ -17057,7 +17048,7 @@ rs6000_emit_epilogue (int sibcall)
for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
{
- rtx addr, areg, mem, reg;
+ rtx addr, areg, mem;
areg = gen_rtx_REG (Pmode, 0);
emit_move_insn
@@ -17069,13 +17060,7 @@ rs6000_emit_epilogue (int sibcall)
addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, areg);
mem = gen_frame_mem (V4SImode, addr);
- reg = gen_rtx_REG (V4SImode, i);
- emit_move_insn (reg, mem);
- if (offset_below_red_zone_p (info->altivec_save_offset
- + (i - info->first_altivec_reg_save)
- * 16))
- cfa_restores = alloc_EXPR_LIST (REG_CFA_RESTORE, reg,
- cfa_restores);
+ emit_move_insn (gen_rtx_REG (V4SImode, i), mem);
}
}
@@ -17085,7 +17070,7 @@ rs6000_emit_epilogue (int sibcall)
&& info->vrsave_mask != 0
&& (ALWAYS_RESTORE_ALTIVEC_BEFORE_POP
|| (DEFAULT_ABI != ABI_V4
- && offset_below_red_zone_p (info->vrsave_save_offset))))
+ && info->vrsave_save_offset < (TARGET_32BIT ? -220 : -288))))
{
rtx addr, mem, reg;
@@ -17111,7 +17096,6 @@ rs6000_emit_epilogue (int sibcall)
emit_insn (generate_set_vrsave (reg, info, 1));
}
- insn = NULL_RTX;
/* If we have a large stack frame, restore the old stack pointer
using the backchain. */
if (use_backchain_to_restore_sp)
@@ -17123,8 +17107,8 @@ rs6000_emit_epilogue (int sibcall)
if (DEFAULT_ABI == ABI_V4)
frame_reg_rtx = gen_rtx_REG (Pmode, 11);
- insn = emit_move_insn (frame_reg_rtx,
- gen_rtx_MEM (Pmode, sp_reg_rtx));
+ emit_move_insn (frame_reg_rtx,
+ gen_rtx_MEM (Pmode, sp_reg_rtx));
sp_offset = 0;
}
else if (ALWAYS_RESTORE_ALTIVEC_BEFORE_POP
@@ -17133,7 +17117,7 @@ rs6000_emit_epilogue (int sibcall)
;
else
{
- insn = emit_move_insn (sp_reg_rtx, frame_reg_rtx);
+ emit_move_insn (sp_reg_rtx, frame_reg_rtx);
frame_reg_rtx = sp_reg_rtx;
}
}
@@ -17145,42 +17129,38 @@ rs6000_emit_epilogue (int sibcall)
if (DEFAULT_ABI == ABI_V4)
frame_reg_rtx = gen_rtx_REG (Pmode, 11);
- insn = emit_insn (gen_add3_insn (frame_reg_rtx, hard_frame_pointer_rtx,
- GEN_INT (info->total_size)));
+ emit_insn (TARGET_32BIT
+ ? gen_addsi3 (frame_reg_rtx, hard_frame_pointer_rtx,
+ GEN_INT (info->total_size))
+ : gen_adddi3 (frame_reg_rtx, hard_frame_pointer_rtx,
+ GEN_INT (info->total_size)));
sp_offset = 0;
}
else if (info->push_p
&& DEFAULT_ABI != ABI_V4
&& !crtl->calls_eh_return)
{
- insn = emit_insn (gen_add3_insn (sp_reg_rtx, sp_reg_rtx,
- GEN_INT (info->total_size)));
+ emit_insn (TARGET_32BIT
+ ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
+ GEN_INT (info->total_size))
+ : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
+ GEN_INT (info->total_size)));
sp_offset = 0;
}
- if (insn && frame_reg_rtx == sp_reg_rtx)
- {
- if (cfa_restores)
- {
- REG_NOTES (insn) = cfa_restores;
- cfa_restores = NULL_RTX;
- }
- add_reg_note (insn, REG_CFA_DEF_CFA, sp_reg_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
/* Restore AltiVec registers if we have not done so already. */
if (!ALWAYS_RESTORE_ALTIVEC_BEFORE_POP
&& TARGET_ALTIVEC_ABI
&& info->altivec_size != 0
&& (DEFAULT_ABI == ABI_V4
- || !offset_below_red_zone_p (info->altivec_save_offset)))
+ || info->altivec_save_offset >= (TARGET_32BIT ? -220 : -288)))
{
int i;
for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
{
- rtx addr, areg, mem, reg;
+ rtx addr, areg, mem;
areg = gen_rtx_REG (Pmode, 0);
emit_move_insn
@@ -17192,11 +17172,7 @@ rs6000_emit_epilogue (int sibcall)
addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, areg);
mem = gen_frame_mem (V4SImode, addr);
- reg = gen_rtx_REG (V4SImode, i);
- emit_move_insn (reg, mem);
- if (DEFAULT_ABI == ABI_V4)
- cfa_restores = alloc_EXPR_LIST (REG_CFA_RESTORE, reg,
- cfa_restores);
+ emit_move_insn (gen_rtx_REG (V4SImode, i), mem);
}
}
@@ -17206,7 +17182,7 @@ rs6000_emit_epilogue (int sibcall)
&& TARGET_ALTIVEC_VRSAVE
&& info->vrsave_mask != 0
&& (DEFAULT_ABI == ABI_V4
- || !offset_below_red_zone_p (info->vrsave_save_offset)))
+ || info->vrsave_save_offset >= (TARGET_32BIT ? -220 : -288)))
{
rtx addr, mem, reg;
@@ -17239,8 +17215,7 @@ rs6000_emit_epilogue (int sibcall)
emit_move_insn (gen_rtx_REG (SImode, 12), mem);
}
- /* Set LR here to try to overlap restores below. LR is always saved
- above incoming stack, so it never needs REG_CFA_RESTORE. */
+ /* Set LR here to try to overlap restores below. */
if (restore_lr)
emit_move_insn (gen_rtx_REG (Pmode, LR_REGNO),
gen_rtx_REG (Pmode, 0));
@@ -17322,7 +17297,7 @@ rs6000_emit_epilogue (int sibcall)
for (i = 0; i < 32 - info->first_gp_reg_save; i++)
if (rs6000_reg_live_or_pic_offset_p (info->first_gp_reg_save + i))
{
- rtx offset, addr, mem, reg;
+ rtx offset, addr, mem;
/* We're doing all this to ensure that the immediate offset
fits into the immediate field of 'evldd'. */
@@ -17331,24 +17306,9 @@ rs6000_emit_epilogue (int sibcall)
offset = GEN_INT (spe_offset + reg_size * i);
addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, offset);
mem = gen_rtx_MEM (V2SImode, addr);
- reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i);
- insn = emit_move_insn (reg, mem);
- if (DEFAULT_ABI == ABI_V4)
- {
- if (frame_pointer_needed
- && info->first_gp_reg_save + i
- == HARD_FRAME_POINTER_REGNUM)
- {
- add_reg_note (insn, REG_CFA_DEF_CFA,
- plus_constant (frame_reg_rtx,
- sp_offset));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- cfa_restores = alloc_EXPR_LIST (REG_CFA_RESTORE, reg,
- cfa_restores);
- }
+ emit_move_insn (gen_rtx_REG (reg_mode, info->first_gp_reg_save + i),
+ mem);
}
}
else
@@ -17360,6 +17320,7 @@ rs6000_emit_epilogue (int sibcall)
/*savep=*/false, /*gpr=*/true,
/*exitp=*/true);
emit_jump_insn (par);
+
/* We don't want anybody else emitting things after we jumped
back. */
return;
@@ -17388,15 +17349,8 @@ rs6000_emit_epilogue (int sibcall)
if (can_use_exit)
{
if (info->cr_save_p)
- {
- rs6000_restore_saved_cr (gen_rtx_REG (SImode, 12),
- using_mtcr_multiple);
- if (DEFAULT_ABI == ABI_V4)
- cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE,
- gen_rtx_REG (SImode, CR2_REGNO),
- cfa_restores);
- }
+ rs6000_restore_saved_cr (gen_rtx_REG (SImode, 12),
+ using_mtcr_multiple);
emit_jump_insn (par);
@@ -17404,22 +17358,8 @@ rs6000_emit_epilogue (int sibcall)
back. */
return;
}
-
- insn = emit_insn (par);
- if (DEFAULT_ABI == ABI_V4)
- {
- if (frame_pointer_needed)
- {
- add_reg_note (insn, REG_CFA_DEF_CFA,
- plus_constant (frame_reg_rtx, sp_offset));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- for (i = info->first_gp_reg_save; i < 32; i++)
- cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE,
- gen_rtx_REG (reg_mode, i), cfa_restores);
- }
+ else
+ emit_insn (par);
}
else if (using_load_multiple)
{
@@ -17432,20 +17372,13 @@ rs6000_emit_epilogue (int sibcall)
+ sp_offset
+ reg_size * i));
rtx mem = gen_frame_mem (reg_mode, addr);
- rtx reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i);
- RTVEC_ELT (p, i) = gen_rtx_SET (VOIDmode, reg, mem);
- if (DEFAULT_ABI == ABI_V4)
- cfa_restores = alloc_EXPR_LIST (REG_CFA_RESTORE, reg,
- cfa_restores);
- }
- insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
- if (DEFAULT_ABI == ABI_V4 && frame_pointer_needed)
- {
- add_reg_note (insn, REG_CFA_DEF_CFA,
- plus_constant (frame_reg_rtx, sp_offset));
- RTX_FRAME_RELATED_P (insn) = 1;
+ RTVEC_ELT (p, i) =
+ gen_rtx_SET (VOIDmode,
+ gen_rtx_REG (reg_mode, info->first_gp_reg_save + i),
+ mem);
}
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
}
else
{
@@ -17457,23 +17390,9 @@ rs6000_emit_epilogue (int sibcall)
+ sp_offset
+ reg_size * i));
rtx mem = gen_frame_mem (reg_mode, addr);
- rtx reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i);
- insn = emit_move_insn (reg, mem);
- if (DEFAULT_ABI == ABI_V4)
- {
- if (frame_pointer_needed
- && info->first_gp_reg_save + i
- == HARD_FRAME_POINTER_REGNUM)
- {
- add_reg_note (insn, REG_CFA_DEF_CFA,
- plus_constant (frame_reg_rtx, sp_offset));
- RTX_FRAME_RELATED_P (insn) = 1;
- }
-
- cfa_restores = alloc_EXPR_LIST (REG_CFA_RESTORE, reg,
- cfa_restores);
- }
+ emit_move_insn (gen_rtx_REG (reg_mode,
+ info->first_gp_reg_save + i), mem);
}
}
@@ -17483,52 +17402,36 @@ rs6000_emit_epilogue (int sibcall)
if ((df_regs_ever_live_p (info->first_fp_reg_save+i)
&& ! call_used_regs[info->first_fp_reg_save+i]))
{
- rtx addr, mem, reg;
+ rtx addr, mem;
addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
GEN_INT (info->fp_save_offset
+ sp_offset
+ 8 * i));
mem = gen_frame_mem (((TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)
? DFmode : SFmode), addr);
- reg = gen_rtx_REG (((TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)
- ? DFmode : SFmode),
- info->first_fp_reg_save + i);
- emit_move_insn (reg, mem);
- if (DEFAULT_ABI == ABI_V4)
- cfa_restores = alloc_EXPR_LIST (REG_CFA_RESTORE, reg,
- cfa_restores);
+ emit_move_insn (gen_rtx_REG (((TARGET_HARD_FLOAT
+ && TARGET_DOUBLE_FLOAT)
+ ? DFmode : SFmode),
+ info->first_fp_reg_save + i),
+ mem);
}
/* If we saved cr, restore it here. Just those that were used. */
if (info->cr_save_p)
- {
- rs6000_restore_saved_cr (gen_rtx_REG (SImode, 12), using_mtcr_multiple);
- if (DEFAULT_ABI == ABI_V4)
- cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE, gen_rtx_REG (SImode, CR2_REGNO),
- cfa_restores);
- }
+ rs6000_restore_saved_cr (gen_rtx_REG (SImode, 12), using_mtcr_multiple);
/* If this is V.4, unwind the stack pointer after all of the loads
have been done. */
- insn = rs6000_emit_stack_reset (info, sp_reg_rtx, frame_reg_rtx,
- sp_offset, !restoring_FPRs_inline);
- if (insn)
- {
- if (cfa_restores)
- {
- REG_NOTES (insn) = cfa_restores;
- cfa_restores = NULL_RTX;
- }
- add_reg_note (insn, REG_CFA_DEF_CFA, sp_reg_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
- }
+ rs6000_emit_stack_reset (info, sp_reg_rtx, frame_reg_rtx,
+ sp_offset, !restoring_FPRs_inline);
if (crtl->calls_eh_return)
{
rtx sa = EH_RETURN_STACKADJ_RTX;
- emit_insn (gen_add3_insn (sp_reg_rtx, sp_reg_rtx, sa));
+ emit_insn (TARGET_32BIT
+ ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx, sa)
+ : gen_adddi3 (sp_reg_rtx, sp_reg_rtx, sa));
}
if (!sibcall)
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 4f541659f4e..eb08828c29b 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7428,21 +7428,6 @@ restore_fpr (rtx base, int offset, int regnum)
return emit_move_insn (gen_rtx_REG (DFmode, regnum), addr);
}
-/* Return true if REGNO is a global register, but not one
- of the special ones that need to be saved/restored in anyway. */
-
-static inline bool
-global_not_special_regno_p (int regno)
-{
- return (global_regs[regno]
- /* These registers are special and need to be
- restored in any case. */
- && !(regno == STACK_POINTER_REGNUM
- || regno == RETURN_REGNUM
- || regno == BASE_REGNUM
- || (flag_pic && regno == (int)PIC_OFFSET_TABLE_REGNUM)));
-}
-
/* Generate insn to save registers FIRST to LAST into
the register save area located at offset OFFSET
relative to register BASE. */
@@ -7466,8 +7451,7 @@ save_gprs (rtx base, int offset, int first, int last)
else
insn = gen_movsi (addr, gen_rtx_REG (Pmode, first));
- if (!global_not_special_regno_p (first))
- RTX_FRAME_RELATED_P (insn) = 1;
+ RTX_FRAME_RELATED_P (insn) = 1;
return insn;
}
@@ -7497,41 +7481,30 @@ save_gprs (rtx base, int offset, int first, int last)
set, even if it does not. Therefore we emit a new pattern
without those registers as REG_FRAME_RELATED_EXPR note. */
- if (first >= 6 && !global_not_special_regno_p (first))
+ if (first >= 6)
{
rtx pat = PATTERN (insn);
for (i = 0; i < XVECLEN (pat, 0); i++)
- if (GET_CODE (XVECEXP (pat, 0, i)) == SET
- && !global_not_special_regno_p (REGNO (SET_SRC (XVECEXP (pat,
- 0, i)))))
+ if (GET_CODE (XVECEXP (pat, 0, i)) == SET)
RTX_FRAME_RELATED_P (XVECEXP (pat, 0, i)) = 1;
RTX_FRAME_RELATED_P (insn) = 1;
}
else if (last >= 6)
{
- int start;
-
- for (start = first >= 6 ? first : 6; start <= last; start++)
- if (!global_not_special_regno_p (start))
- break;
-
- if (start > last)
- return insn;
-
- addr = plus_constant (base, offset + (start - first) * UNITS_PER_WORD);
+ addr = plus_constant (base, offset + (6 - first) * UNITS_PER_WORD);
note = gen_store_multiple (gen_rtx_MEM (Pmode, addr),
- gen_rtx_REG (Pmode, start),
- GEN_INT (last - start + 1));
+ gen_rtx_REG (Pmode, 6),
+ GEN_INT (last - 6 + 1));
note = PATTERN (note);
- add_reg_note (insn, REG_FRAME_RELATED_EXPR, note);
+ REG_NOTES (insn) =
+ gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+ note, REG_NOTES (insn));
for (i = 0; i < XVECLEN (note, 0); i++)
- if (GET_CODE (XVECEXP (note, 0, i)) == SET
- && !global_not_special_regno_p (REGNO (SET_SRC (XVECEXP (note,
- 0, i)))))
+ if (GET_CODE (XVECEXP (note, 0, i)) == SET)
RTX_FRAME_RELATED_P (XVECEXP (note, 0, i)) = 1;
RTX_FRAME_RELATED_P (insn) = 1;
@@ -7921,7 +7894,7 @@ s390_emit_prologue (void)
void
s390_emit_epilogue (bool sibcall)
{
- rtx frame_pointer, return_reg, cfa_restores = NULL_RTX;
+ rtx frame_pointer, return_reg;
int area_bottom, area_top, offset = 0;
int next_offset;
rtvec p;
@@ -7963,13 +7936,11 @@ s390_emit_epilogue (bool sibcall)
}
else
{
- rtx insn, frame_off, cfa;
+ rtx insn, frame_off;
offset = area_bottom < 0 ? -area_bottom : 0;
frame_off = GEN_INT (cfun_frame_layout.frame_size - offset);
- cfa = gen_rtx_SET (VOIDmode, frame_pointer,
- gen_rtx_PLUS (Pmode, frame_pointer, frame_off));
if (DISP_IN_RANGE (INTVAL (frame_off)))
{
insn = gen_rtx_SET (VOIDmode, frame_pointer,
@@ -7984,8 +7955,6 @@ s390_emit_epilogue (bool sibcall)
insn = emit_insn (gen_add2_insn (frame_pointer, frame_off));
annotate_constant_pool_refs (&PATTERN (insn));
}
- add_reg_note (insn, REG_CFA_ADJUST_CFA, cfa);
- RTX_FRAME_RELATED_P (insn) = 1;
}
/* Restore call saved fprs. */
@@ -8001,9 +7970,6 @@ s390_emit_epilogue (bool sibcall)
{
restore_fpr (frame_pointer,
offset + next_offset, i);
- cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE,
- gen_rtx_REG (DFmode, i), cfa_restores);
next_offset += 8;
}
}
@@ -8019,9 +7985,6 @@ s390_emit_epilogue (bool sibcall)
{
restore_fpr (frame_pointer,
offset + next_offset, i);
- cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE,
- gen_rtx_REG (DFmode, i), cfa_restores);
next_offset += 8;
}
else if (!TARGET_PACKED_STACK)
@@ -8048,7 +8011,15 @@ s390_emit_epilogue (bool sibcall)
i <= cfun_frame_layout.last_restore_gpr;
i++)
{
- if (global_not_special_regno_p (i))
+ /* These registers are special and need to be
+ restored in any case. */
+ if (i == STACK_POINTER_REGNUM
+ || i == RETURN_REGNUM
+ || i == BASE_REGNUM
+ || (flag_pic && i == (int)PIC_OFFSET_TABLE_REGNUM))
+ continue;
+
+ if (global_regs[i])
{
addr = plus_constant (frame_pointer,
offset + cfun_frame_layout.gprs_offset
@@ -8058,10 +8029,6 @@ s390_emit_epilogue (bool sibcall)
set_mem_alias_set (addr, get_frame_alias_set ());
emit_move_insn (addr, gen_rtx_REG (Pmode, i));
}
- else
- cfa_restores
- = alloc_EXPR_LIST (REG_CFA_RESTORE,
- gen_rtx_REG (Pmode, i), cfa_restores);
}
if (! sibcall)
@@ -8096,11 +8063,7 @@ s390_emit_epilogue (bool sibcall)
* UNITS_PER_WORD,
cfun_frame_layout.first_restore_gpr,
cfun_frame_layout.last_restore_gpr);
- insn = emit_insn (insn);
- REG_NOTES (insn) = cfa_restores;
- add_reg_note (insn, REG_CFA_DEF_CFA,
- plus_constant (stack_pointer_rtx, STACK_POINTER_OFFSET));
- RTX_FRAME_RELATED_P (insn) = 1;
+ emit_insn (insn);
}
if (! sibcall)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 59c1e881fd2..f1d90ec7ad1 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -306,7 +306,7 @@ Objective-C and Objective-C++ Dialects}.
-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
-ftest-coverage -ftime-report -fvar-tracking @gol
--g -g@var{level} -gcoff -gdwarf-@var{version} @gol
+-g -g@var{level} -gcoff -gdwarf-2 @gol
-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
-fdebug-prefix-map=@var{old}=@var{new} @gol
@@ -4281,14 +4281,13 @@ use of these extensions is likely to make other debuggers crash or
refuse to read the program, and may cause assemblers other than the GNU
assembler (GAS) to fail with an error.
-@item -gdwarf-@var{version}
-@opindex gdwarf-@var{version}
-Produce debugging information in DWARF format (if that is
-supported). This is the format used by DBX on IRIX 6. The value
-of @var{version} may be either 2 or 3; the default version is 2.
-
-Note that with DWARF version 2 some ports require, and will always
-use, some non-conflicting DWARF 3 extensions in the unwind tables.
+@item -gdwarf-2
+@opindex gdwarf-2
+Produce debugging information in DWARF version 2 format (if that is
+supported). This is the format used by DBX on IRIX 6. With this
+option, GCC uses features of DWARF version 3 when they are useful;
+version 3 is upward compatible with version 2, but may still cause
+problems for older debuggers.
@item -gvms
@opindex gvms
@@ -4322,7 +4321,7 @@ debug information in version 1 of the DWARF format (which is very
different from version 2), and it would have been too confusing. That
debug format is long obsolete, but the option cannot be changed now.
Instead use an additional @option{-g@var{level}} option to change the
-debug level for DWARF.
+debug level for DWARF2.
@item -feliminate-dwarf2-dups
@opindex feliminate-dwarf2-dups
diff --git a/gcc/dwarf2.h b/gcc/dwarf2.h
index dc8186f84d5..a0a97eee3bb 100644
--- a/gcc/dwarf2.h
+++ b/gcc/dwarf2.h
@@ -767,6 +767,7 @@ enum dwarf_call_frame_info
#define DW_CIE_ID 0xffffffff
#define DW64_CIE_ID 0xffffffffffffffffULL
+#define DW_CIE_VERSION 1
#define DW_CFA_extended 0
#define DW_CFA_lo_user 0x1c
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ceeae210a10..4bc3e776774 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -252,8 +252,7 @@ typedef struct cfa_loc GTY(())
HOST_WIDE_INT offset;
HOST_WIDE_INT base_offset;
unsigned int reg;
- BOOL_BITFIELD indirect : 1; /* 1 if CFA is accessed via a dereference. */
- BOOL_BITFIELD in_use : 1; /* 1 if a saved cfa is stored here. */
+ int indirect; /* 1 if CFA is accessed via a dereference. */
} dw_cfa_location;
/* All call frame descriptions (FDE's) in the GCC generated DWARF
@@ -328,6 +327,8 @@ dw_fde_node;
#define DWARF_INITIAL_LENGTH_SIZE (DWARF_OFFSET_SIZE == 4 ? 4 : 12)
#endif
+#define DWARF_VERSION 2
+
/* Round SIZE up to the nearest BOUNDARY. */
#define DWARF_ROUND(SIZE,BOUNDARY) \
((((SIZE) + (BOUNDARY) - 1) / (BOUNDARY)) * (BOUNDARY))
@@ -415,7 +416,7 @@ static const char *dwarf_cfi_name (unsigned);
static dw_cfi_ref new_cfi (void);
static void add_cfi (dw_cfi_ref *, dw_cfi_ref);
static void add_fde_cfi (const char *, dw_cfi_ref);
-static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *, dw_cfa_location *);
+static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *);
static void lookup_cfa (dw_cfa_location *);
static void reg_save (const char *, unsigned, unsigned, HOST_WIDE_INT);
#ifdef DWARF2_UNWIND_INFO
@@ -679,10 +680,7 @@ add_cfi (dw_cfi_ref *list_head, dw_cfi_ref cfi)
/* When DRAP is used, CFA is defined with an expression. Redefine
CFA may lead to a different CFA value. */
- /* ??? Of course, this heuristic fails when we're annotating epilogues,
- because of course we'll always want to redefine the CFA back to the
- stack pointer on the way out. Where should we move this check? */
- if (0 && fde && fde->drap_reg != INVALID_REGNUM)
+ if (fde && fde->drap_reg != INVALID_REGNUM)
switch (cfi->dw_cfi_opc)
{
case DW_CFA_def_cfa_register:
@@ -727,29 +725,13 @@ dwarf2out_cfi_label (bool force)
return label;
}
-/* True if remember_state should be emitted before following CFI directive. */
-static bool emit_cfa_remember;
-
/* Add CFI to the current fde at the PC value indicated by LABEL if specified,
or to the CIE if LABEL is NULL. */
static void
add_fde_cfi (const char *label, dw_cfi_ref cfi)
{
- dw_cfi_ref *list_head;
-
- if (emit_cfa_remember)
- {
- dw_cfi_ref cfi_remember;
-
- /* Emit the state save. */
- emit_cfa_remember = false;
- cfi_remember = new_cfi ();
- cfi_remember->dw_cfi_opc = DW_CFA_remember_state;
- add_fde_cfi (label, cfi_remember);
- }
-
- list_head = &cie_cfi_head;
+ dw_cfi_ref *list_head = &cie_cfi_head;
if (dwarf2out_do_cfi_asm ())
{
@@ -759,51 +741,50 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
gcc_assert (fde != NULL);
- /* We still have to add the cfi to the list so that lookup_cfa
- works later on. When -g2 and above we even need to force
- emitting of CFI labels and add to list a DW_CFA_set_loc for
- convert_cfa_to_fb_loc_list purposes. If we're generating
- DWARF3 output we use DW_OP_call_frame_cfa and so don't use
- convert_cfa_to_fb_loc_list. */
- if (dwarf_version == 2
- && debug_info_level > DINFO_LEVEL_TERSE
- && (write_symbols == DWARF2_DEBUG
- || write_symbols == VMS_AND_DWARF2_DEBUG))
+ /* We still have to add the cfi to the list so that
+ lookup_cfa works later on. When -g2 and above we
+ even need to force emitting of CFI labels and
+ add to list a DW_CFA_set_loc for convert_cfa_to_fb_loc_list
+ purposes. */
+ switch (cfi->dw_cfi_opc)
{
- switch (cfi->dw_cfi_opc)
+ case DW_CFA_def_cfa_offset:
+ case DW_CFA_def_cfa_offset_sf:
+ case DW_CFA_def_cfa_register:
+ case DW_CFA_def_cfa:
+ case DW_CFA_def_cfa_sf:
+ case DW_CFA_def_cfa_expression:
+ case DW_CFA_restore_state:
+ if (write_symbols != DWARF2_DEBUG
+ && write_symbols != VMS_AND_DWARF2_DEBUG)
+ break;
+ if (debug_info_level <= DINFO_LEVEL_TERSE)
+ break;
+
+ if (*label == 0 || strcmp (label, "<do not output>") == 0)
+ label = dwarf2out_cfi_label (true);
+
+ if (fde->dw_fde_current_label == NULL
+ || strcmp (label, fde->dw_fde_current_label) != 0)
{
- case DW_CFA_def_cfa_offset:
- case DW_CFA_def_cfa_offset_sf:
- case DW_CFA_def_cfa_register:
- case DW_CFA_def_cfa:
- case DW_CFA_def_cfa_sf:
- case DW_CFA_def_cfa_expression:
- case DW_CFA_restore_state:
- if (*label == 0 || strcmp (label, "<do not output>") == 0)
- label = dwarf2out_cfi_label (true);
-
- if (fde->dw_fde_current_label == NULL
- || strcmp (label, fde->dw_fde_current_label) != 0)
- {
- dw_cfi_ref xcfi;
-
- label = xstrdup (label);
-
- /* Set the location counter to the new label. */
- xcfi = new_cfi ();
- /* It doesn't metter whether DW_CFA_set_loc
- or DW_CFA_advance_loc4 is added here, those aren't
- emitted into assembly, only looked up by
- convert_cfa_to_fb_loc_list. */
- xcfi->dw_cfi_opc = DW_CFA_set_loc;
- xcfi->dw_cfi_oprnd1.dw_cfi_addr = label;
- add_cfi (&fde->dw_fde_cfi, xcfi);
- fde->dw_fde_current_label = label;
- }
- break;
- default:
- break;
- }
+ dw_cfi_ref xcfi;
+
+ label = xstrdup (label);
+
+ /* Set the location counter to the new label. */
+ xcfi = new_cfi ();
+ /* It doesn't metter whether DW_CFA_set_loc
+ or DW_CFA_advance_loc4 is added here, those aren't
+ emitted into assembly, only looked up by
+ convert_cfa_to_fb_loc_list. */
+ xcfi->dw_cfi_opc = DW_CFA_set_loc;
+ xcfi->dw_cfi_oprnd1.dw_cfi_addr = label;
+ add_cfi (&fde->dw_fde_cfi, xcfi);
+ fde->dw_fde_current_label = label;
+ }
+ break;
+ default:
+ break;
}
output_cfi_directive (cfi);
@@ -854,7 +835,7 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
/* Subroutine of lookup_cfa. */
static void
-lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember)
+lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc)
{
switch (cfi->dw_cfi_opc)
{
@@ -873,18 +854,6 @@ lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember)
case DW_CFA_def_cfa_expression:
get_cfa_from_loc_descr (loc, cfi->dw_cfi_oprnd1.dw_cfi_loc);
break;
-
- case DW_CFA_remember_state:
- gcc_assert (!remember->in_use);
- *remember = *loc;
- remember->in_use = 1;
- break;
- case DW_CFA_restore_state:
- gcc_assert (remember->in_use);
- *loc = *remember;
- remember->in_use = 0;
- break;
-
default:
break;
}
@@ -897,19 +866,19 @@ lookup_cfa (dw_cfa_location *loc)
{
dw_cfi_ref cfi;
dw_fde_ref fde;
- dw_cfa_location remember;
- memset (loc, 0, sizeof (*loc));
loc->reg = INVALID_REGNUM;
- remember = *loc;
+ loc->offset = 0;
+ loc->indirect = 0;
+ loc->base_offset = 0;
for (cfi = cie_cfi_head; cfi; cfi = cfi->dw_cfi_next)
- lookup_cfa_1 (cfi, loc, &remember);
+ lookup_cfa_1 (cfi, loc);
fde = current_fde ();
if (fde)
for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next)
- lookup_cfa_1 (cfi, loc, &remember);
+ lookup_cfa_1 (cfi, loc);
}
/* The current rule for calculating the DWARF2 canonical frame address. */
@@ -919,9 +888,6 @@ static dw_cfa_location cfa;
from the CFA. */
static dw_cfa_location cfa_store;
-/* The current save location around an epilogue. */
-static dw_cfa_location cfa_remember;
-
/* The running total of the size of arguments pushed onto the stack. */
static HOST_WIDE_INT args_size;
@@ -1307,7 +1273,8 @@ compute_barrier_args_size_1 (rtx insn, HOST_WIDE_INT cur_args_size,
if (! RTX_FRAME_RELATED_P (insn))
{
- if (prologue_epilogue_contains (insn))
+ if (prologue_epilogue_contains (insn)
+ || sibcall_epilogue_contains (insn))
/* Nothing */;
else if (GET_CODE (PATTERN (insn)) == SET)
offset = stack_adjust_offset (PATTERN (insn), cur_args_size, 0);
@@ -1480,7 +1447,7 @@ dwarf2out_stack_adjust (rtx insn, bool after_p)
with this function. Proper support would require all frame-related
insns to be marked, and to be able to handle saving state around
epilogues textually in the middle of the function. */
- if (prologue_epilogue_contains (insn))
+ if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn))
return;
/* If INSN is an instruction from target of an annulled branch, the
@@ -1755,156 +1722,6 @@ reg_saved_in (rtx reg)
value, not an offset. */
static dw_cfa_location cfa_temp;
-/* A subroutine of dwarf2out_frame_debug, process a REG_DEF_CFA note. */
-
-static void
-dwarf2out_frame_debug_def_cfa (rtx pat, const char *label)
-{
- memset (&cfa, 0, sizeof (cfa));
-
- switch (GET_CODE (pat))
- {
- case PLUS:
- cfa.reg = REGNO (XEXP (pat, 0));
- cfa.offset = INTVAL (XEXP (pat, 1));
- break;
-
- case REG:
- cfa.reg = REGNO (pat);
- break;
-
- default:
- /* Recurse and define an expression. */
- gcc_unreachable ();
- }
-
- def_cfa_1 (label, &cfa);
-}
-
-/* A subroutine of dwarf2out_frame_debug, process a REG_ADJUST_CFA note. */
-
-static void
-dwarf2out_frame_debug_adjust_cfa (rtx pat, const char *label)
-{
- rtx src, dest;
-
- gcc_assert (GET_CODE (pat) == SET);
- dest = XEXP (pat, 0);
- src = XEXP (pat, 1);
-
- switch (GET_CODE (src))
- {
- case PLUS:
- gcc_assert (REGNO (XEXP (src, 0)) == cfa.reg);
- cfa.offset -= INTVAL (XEXP (src, 1));
- break;
-
- case REG:
- break;
-
- default:
- gcc_unreachable ();
- }
-
- cfa.reg = REGNO (dest);
- gcc_assert (cfa.indirect == 0);
-
- def_cfa_1 (label, &cfa);
-}
-
-/* A subroutine of dwarf2out_frame_debug, process a REG_CFA_OFFSET note. */
-
-static void
-dwarf2out_frame_debug_cfa_offset (rtx set, const char *label)
-{
- HOST_WIDE_INT offset;
- rtx src, addr, span;
-
- src = XEXP (set, 1);
- addr = XEXP (set, 0);
- gcc_assert (MEM_P (addr));
- addr = XEXP (addr, 0);
-
- /* As documented, only consider extremely simple addresses. */
- switch (GET_CODE (addr))
- {
- case REG:
- gcc_assert (REGNO (addr) == cfa.reg);
- offset = -cfa.offset;
- break;
- case PLUS:
- gcc_assert (REGNO (XEXP (addr, 0)) == cfa.reg);
- offset = INTVAL (XEXP (addr, 1)) - cfa.offset;
- break;
- default:
- gcc_unreachable ();
- }
-
- span = targetm.dwarf_register_span (src);
-
- /* ??? We'd like to use queue_reg_save, but we need to come up with
- a different flushing heuristic for epilogues. */
- if (!span)
- reg_save (label, DWARF_FRAME_REGNUM (REGNO (src)), INVALID_REGNUM, offset);
- else
- {
- /* We have a PARALLEL describing where the contents of SRC live.
- Queue register saves for each piece of the PARALLEL. */
- int par_index;
- int limit;
- HOST_WIDE_INT span_offset = offset;
-
- gcc_assert (GET_CODE (span) == PARALLEL);
-
- limit = XVECLEN (span, 0);
- for (par_index = 0; par_index < limit; par_index++)
- {
- rtx elem = XVECEXP (span, 0, par_index);
-
- reg_save (label, DWARF_FRAME_REGNUM (REGNO (elem)),
- INVALID_REGNUM, span_offset);
- span_offset += GET_MODE_SIZE (GET_MODE (elem));
- }
- }
-}
-
-/* A subroutine of dwarf2out_frame_debug, process a REG_CFA_REGISTER note. */
-
-static void
-dwarf2out_frame_debug_cfa_register (rtx set, const char *label)
-{
- rtx src, dest;
- unsigned sregno, dregno;
-
- src = XEXP (set, 1);
- dest = XEXP (set, 0);
-
- if (src == pc_rtx)
- sregno = DWARF_FRAME_RETURN_COLUMN;
- else
- sregno = DWARF_FRAME_REGNUM (REGNO (src));
-
- dregno = DWARF_FRAME_REGNUM (REGNO (dest));
-
- /* ??? We'd like to use queue_reg_save, but we need to come up with
- a different flushing heuristic for epilogues. */
- reg_save (label, sregno, dregno, 0);
-}
-
-/* A subroutine of dwarf2out_frame_debug, process a REG_CFA_RESTORE note. */
-
-static void
-dwarf2out_frame_debug_cfa_restore (rtx reg, const char *label)
-{
- dw_cfi_ref cfi = new_cfi ();
- unsigned int regno = DWARF_FRAME_REGNUM (REGNO (reg));
-
- cfi->dw_cfi_opc = (regno & ~0x3f ? DW_CFA_restore_extended : DW_CFA_restore);
- cfi->dw_cfi_oprnd1.dw_cfi_reg_num = regno;
-
- add_fde_cfi (label, cfi);
-}
-
/* Record call frame debugging information for an expression EXPR,
which either sets SP or FP (adjusting how we calculate the frame
address) or saves a register to the stack or another register.
@@ -2612,8 +2429,7 @@ void
dwarf2out_frame_debug (rtx insn, bool after_p)
{
const char *label;
- rtx note, n;
- bool handled_one = false;
+ rtx src;
if (insn == NULL_RTX)
{
@@ -2658,154 +2474,15 @@ dwarf2out_frame_debug (rtx insn, bool after_p)
}
label = dwarf2out_cfi_label (false);
+ src = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
+ if (src)
+ insn = XEXP (src, 0);
+ else
+ insn = PATTERN (insn);
- for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- switch (REG_NOTE_KIND (note))
- {
- case REG_FRAME_RELATED_EXPR:
- insn = XEXP (note, 0);
- goto found;
-
- case REG_CFA_DEF_CFA:
- dwarf2out_frame_debug_def_cfa (XEXP (note, 0), label);
- handled_one = true;
- break;
-
- case REG_CFA_ADJUST_CFA:
- n = XEXP (note, 0);
- if (n == NULL)
- {
- n = PATTERN (insn);
- if (GET_CODE (n) == PARALLEL)
- n = XVECEXP (n, 0, 0);
- }
- dwarf2out_frame_debug_adjust_cfa (n, label);
- handled_one = true;
- break;
-
- case REG_CFA_OFFSET:
- n = XEXP (note, 0);
- if (n == NULL)
- n = single_set (insn);
- dwarf2out_frame_debug_cfa_offset (n, label);
- handled_one = true;
- break;
-
- case REG_CFA_REGISTER:
- n = XEXP (note, 0);
- if (n == NULL)
- {
- n = PATTERN (insn);
- if (GET_CODE (n) == PARALLEL)
- n = XVECEXP (n, 0, 0);
- }
- dwarf2out_frame_debug_cfa_register (n, label);
- handled_one = true;
- break;
-
- case REG_CFA_RESTORE:
- n = XEXP (note, 0);
- if (n == NULL)
- {
- n = PATTERN (insn);
- if (GET_CODE (n) == PARALLEL)
- n = XVECEXP (n, 0, 0);
- n = XEXP (n, 0);
- }
- dwarf2out_frame_debug_cfa_restore (n, label);
- handled_one = true;
- break;
-
- default:
- break;
- }
- if (handled_one)
- return;
-
- insn = PATTERN (insn);
- found:
dwarf2out_frame_debug_expr (insn, label);
}
-/* Determine if we need to save and restore CFI information around this
- epilogue. If SIBCALL is true, then this is a sibcall epilogue. If
- we do need to save/restore, then emit the save now, and insert a
- NOTE_INSN_CFA_RESTORE_STATE at the appropriate place in the stream. */
-
-void
-dwarf2out_begin_epilogue (rtx insn)
-{
- bool saw_frp = false;
- rtx i;
-
- /* Scan forward to the return insn, noticing if there are possible
- frame related insns. */
- for (i = NEXT_INSN (insn); i ; i = NEXT_INSN (i))
- {
- if (!INSN_P (i))
- continue;
-
- /* Look for both regular and sibcalls to end the block. */
- if (returnjump_p (i))
- break;
- if (CALL_P (i) && SIBLING_CALL_P (i))
- break;
-
- if (RTX_FRAME_RELATED_P (i))
- saw_frp = true;
- }
-
- /* If the port doesn't emit epilogue unwind info, we don't need a
- save/restore pair. */
- if (!saw_frp)
- return;
-
- /* Otherwise, search forward to see if the return insn was the last
- basic block of the function. If so, we don't need save/restore. */
- gcc_assert (i != NULL);
- i = next_real_insn (i);
- if (i == NULL)
- return;
-
- /* Insert the restore before that next real insn in the stream, and before
- a potential NOTE_INSN_EPILOGUE_BEG -- we do need these notes to be
- properly nested. This should be after any label or alignment. This
- will be pushed into the CFI stream by the function below. */
- while (1)
- {
- rtx p = PREV_INSN (i);
- if (!NOTE_P (p))
- break;
- if (NOTE_KIND (p) == NOTE_INSN_BASIC_BLOCK)
- break;
- i = p;
- }
- emit_note_before (NOTE_INSN_CFA_RESTORE_STATE, i);
-
- emit_cfa_remember = true;
-
- /* And emulate the state save. */
- gcc_assert (!cfa_remember.in_use);
- cfa_remember = cfa;
- cfa_remember.in_use = 1;
-}
-
-/* A "subroutine" of dwarf2out_begin_epilogue. Emit the restore required. */
-
-void
-dwarf2out_frame_debug_restore_state (void)
-{
- dw_cfi_ref cfi = new_cfi ();
- const char *label = dwarf2out_cfi_label (false);
-
- cfi->dw_cfi_opc = DW_CFA_restore_state;
- add_fde_cfi (label, cfi);
-
- gcc_assert (cfa_remember.in_use);
- cfa = cfa_remember;
- cfa_remember.in_use = 0;
-}
-
#endif
/* Describe for the GTY machinery what parts of dw_cfi_oprnd1 are used. */
@@ -2819,8 +2496,6 @@ dw_cfi_oprnd1_desc (enum dwarf_call_frame_info cfi)
{
case DW_CFA_nop:
case DW_CFA_GNU_window_save:
- case DW_CFA_remember_state:
- case DW_CFA_restore_state:
return dw_cfi_oprnd_unused;
case DW_CFA_set_loc:
@@ -2835,7 +2510,6 @@ dw_cfi_oprnd1_desc (enum dwarf_call_frame_info cfi)
case DW_CFA_def_cfa:
case DW_CFA_offset_extended_sf:
case DW_CFA_def_cfa_sf:
- case DW_CFA_restore:
case DW_CFA_restore_extended:
case DW_CFA_undefined:
case DW_CFA_same_value:
@@ -3159,13 +2833,6 @@ output_cfi_directive (dw_cfi_ref cfi)
cfi->dw_cfi_oprnd1.dw_cfi_offset);
break;
- case DW_CFA_remember_state:
- fprintf (asm_out_file, "\t.cfi_remember_state\n");
- break;
- case DW_CFA_restore_state:
- fprintf (asm_out_file, "\t.cfi_restore_state\n");
- break;
-
case DW_CFA_GNU_args_size:
fprintf (asm_out_file, "\t.cfi_escape 0x%x,", DW_CFA_GNU_args_size);
dw2_asm_output_data_uleb128_raw (cfi->dw_cfi_oprnd1.dw_cfi_offset);
@@ -3209,7 +2876,6 @@ output_call_frame_info (int for_eh)
int per_encoding = DW_EH_PE_absptr;
int lsda_encoding = DW_EH_PE_absptr;
int return_reg;
- int dw_cie_version;
/* Don't emit a CIE if there won't be any FDEs. */
if (fde_table_in_use == 0)
@@ -3290,14 +2956,7 @@ output_call_frame_info (int for_eh)
(for_eh ? 0 : DWARF_CIE_ID),
"CIE Identifier Tag");
- /* Use the CIE version 3 for DWARF3; allow DWARF2 to continue to
- use CIE version 1, unless that would produce incorrect results
- due to overflowing the return register column. */
- return_reg = DWARF2_FRAME_REG_OUT (DWARF_FRAME_RETURN_COLUMN, for_eh);
- dw_cie_version = 1;
- if (return_reg >= 256 || dwarf_version > 2)
- dw_cie_version = 3;
- dw2_asm_output_data (1, dw_cie_version, "CIE Version");
+ dw2_asm_output_data (1, DW_CIE_VERSION, "CIE Version");
augmentation[0] = 0;
augmentation_size = 0;
@@ -3369,7 +3028,8 @@ output_call_frame_info (int for_eh)
dw2_asm_output_data_sleb128 (DWARF_CIE_DATA_ALIGNMENT,
"CIE Data Alignment Factor");
- if (dw_cie_version == 1)
+ return_reg = DWARF2_FRAME_REG_OUT (DWARF_FRAME_RETURN_COLUMN, for_eh);
+ if (DW_CIE_VERSION == 1)
dw2_asm_output_data (1, return_reg, "CIE RA Column");
else
dw2_asm_output_data_uleb128 (return_reg, "CIE RA Column");
@@ -4244,7 +3904,6 @@ dwarf_stack_op_name (unsigned int op)
return "DW_OP_xderef_size";
case DW_OP_nop:
return "DW_OP_nop";
-
case DW_OP_push_object_address:
return "DW_OP_push_object_address";
case DW_OP_call2:
@@ -4253,20 +3912,10 @@ dwarf_stack_op_name (unsigned int op)
return "DW_OP_call4";
case DW_OP_call_ref:
return "DW_OP_call_ref";
- case DW_OP_form_tls_address:
- return "DW_OP_form_tls_address";
- case DW_OP_call_frame_cfa:
- return "DW_OP_call_frame_cfa";
- case DW_OP_bit_piece:
- return "DW_OP_bit_piece";
-
case DW_OP_GNU_push_tls_address:
return "DW_OP_GNU_push_tls_address";
case DW_OP_GNU_uninit:
return "DW_OP_GNU_uninit";
- case DW_OP_GNU_encoded_addr:
- return "DW_OP_GNU_encoded_addr";
-
default:
return "OP_<unknown>";
}
@@ -5690,9 +5339,6 @@ static int maybe_emit_file (struct dwarf_file_data *fd);
#ifndef DEBUG_PUBNAMES_SECTION
#define DEBUG_PUBNAMES_SECTION ".debug_pubnames"
#endif
-#ifndef DEBUG_PUBTYPES_SECTION
-#define DEBUG_PUBTYPES_SECTION ".debug_pubtypes"
-#endif
#ifndef DEBUG_STR_SECTION
#define DEBUG_STR_SECTION ".debug_str"
#endif
@@ -7945,6 +7591,7 @@ build_abbrev_table (dw_die_ref die)
&& AT_ref (a)->die_mark == 0)
{
gcc_assert (AT_ref (a)->die_symbol);
+
set_AT_ref_external (a, 1);
}
@@ -8072,9 +7719,7 @@ size_of_die (dw_die_ref die)
size += 1;
break;
case dw_val_class_die_ref:
- /* In DWARF2, DW_FORM_ref_addr is sized by target address length,
- whereas in DWARF3 it's always sized as an offset. */
- if (AT_ref_external (a) && dwarf_version == 2)
+ if (AT_ref_external (a))
size += DWARF2_ADDR_SIZE;
else
size += DWARF_OFFSET_SIZE;
@@ -8603,17 +8248,10 @@ output_die (dw_die_ref die)
if (AT_ref_external (a))
{
char *sym = AT_ref (a)->die_symbol;
- int size;
gcc_assert (sym);
-
- /* In DWARF2, DW_FORM_ref_addr is sized by target address
- length, whereas in DWARF3 it's always sized as an offset. */
- if (dwarf_version == 2)
- size = DWARF2_ADDR_SIZE;
- else
- size = DWARF_OFFSET_SIZE;
- dw2_asm_output_offset (size, sym, debug_info_section, "%s", name);
+ dw2_asm_output_offset (DWARF2_ADDR_SIZE, sym, debug_info_section,
+ "%s", name);
}
else
{
@@ -8692,7 +8330,7 @@ output_compilation_unit_header (void)
dw2_asm_output_data (DWARF_OFFSET_SIZE,
next_die_offset - DWARF_INITIAL_LENGTH_SIZE,
"Length of Compilation Unit Info");
- dw2_asm_output_data (2, dwarf_version, "DWARF version number");
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF version number");
dw2_asm_output_offset (DWARF_OFFSET_SIZE, abbrev_section_label,
debug_abbrev_section,
"Offset Into Abbrev. Section");
@@ -8773,6 +8411,7 @@ add_pubname_string (const char *str, dw_die_ref die)
static void
add_pubname (tree decl, dw_die_ref die)
{
+
if (TREE_PUBLIC (decl))
add_pubname_string (dwarf2_name (decl, 1), die);
}
@@ -8832,8 +8471,7 @@ output_pubnames (VEC (pubname_entry, gc) * names)
else
dw2_asm_output_data (DWARF_OFFSET_SIZE, pubnames_length,
"Length of Public Type Names Info");
- /* Version number for pubnames/pubtypes is still 2, even in DWARF3. */
- dw2_asm_output_data (2, 2, "DWARF Version");
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version");
dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
debug_info_section,
"Offset of Compilation Unit Info");
@@ -8895,8 +8533,7 @@ output_aranges (void)
"Initial length escape value indicating 64-bit DWARF extension");
dw2_asm_output_data (DWARF_OFFSET_SIZE, aranges_length,
"Length of Address Ranges Info");
- /* Version number for aranges is still 2, even in DWARF3. */
- dw2_asm_output_data (2, 2, "DWARF Version");
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version");
dw2_asm_output_offset (DWARF_OFFSET_SIZE, debug_info_section_label,
debug_info_section,
"Offset of Compilation Unit Info");
@@ -9441,7 +9078,7 @@ output_line_info (void)
"Length of Source Line Info");
ASM_OUTPUT_LABEL (asm_out_file, l1);
- dw2_asm_output_data (2, dwarf_version, "DWARF Version");
+ dw2_asm_output_data (2, DWARF_VERSION, "DWARF Version");
dw2_asm_output_delta (DWARF_OFFSET_SIZE, p2, p1, "Prolog Length");
ASM_OUTPUT_LABEL (asm_out_file, p1);
@@ -12570,7 +12207,6 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
dw_cfi_ref cfi;
dw_cfa_location last_cfa, next_cfa;
const char *start_label, *last_label, *section;
- dw_cfa_location remember;
fde = current_fde ();
gcc_assert (fde != NULL);
@@ -12579,16 +12215,17 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
list_tail = &list;
list = NULL;
- memset (&next_cfa, 0, sizeof (next_cfa));
next_cfa.reg = INVALID_REGNUM;
- remember = next_cfa;
+ next_cfa.offset = 0;
+ next_cfa.indirect = 0;
+ next_cfa.base_offset = 0;
start_label = fde->dw_fde_begin;
/* ??? Bald assumption that the CIE opcode list does not contain
advance opcodes. */
for (cfi = cie_cfi_head; cfi; cfi = cfi->dw_cfi_next)
- lookup_cfa_1 (cfi, &next_cfa, &remember);
+ lookup_cfa_1 (cfi, &next_cfa);
last_cfa = next_cfa;
last_label = start_label;
@@ -12615,10 +12252,14 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
case DW_CFA_advance_loc:
/* The encoding is complex enough that we should never emit this. */
+ case DW_CFA_remember_state:
+ case DW_CFA_restore_state:
+ /* We don't handle these two in this function. It would be possible
+ if it were to be required. */
gcc_unreachable ();
default:
- lookup_cfa_1 (cfi, &next_cfa, &remember);
+ lookup_cfa_1 (cfi, &next_cfa);
break;
}
@@ -14195,19 +13836,17 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
(3) We can at least reuse the code inspection and interpretation
code that determines the CFA position at various points in the
function. */
- if (dwarf_version >= 3)
- {
- dw_loc_descr_ref op = new_loc_descr (DW_OP_call_frame_cfa, 0, 0);
- add_AT_loc (subr_die, DW_AT_frame_base, op);
- }
- else
- {
- dw_loc_list_ref list = convert_cfa_to_fb_loc_list (cfa_fb_offset);
- if (list->dw_loc_next)
- add_AT_loc_list (subr_die, DW_AT_frame_base, list);
- else
- add_AT_loc (subr_die, DW_AT_frame_base, list->expr);
- }
+ /* ??? Use some command-line or configury switch to enable the use
+ of dwarf3 DW_OP_call_frame_cfa. At present there are no dwarf
+ consumers that understand it; fall back to "pure" dwarf2 and
+ convert the CFA data into a location list. */
+ {
+ dw_loc_list_ref list = convert_cfa_to_fb_loc_list (cfa_fb_offset);
+ if (list->dw_loc_next)
+ add_AT_loc_list (subr_die, DW_AT_frame_base, list);
+ else
+ add_AT_loc (subr_die, DW_AT_frame_base, list->expr);
+ }
/* Compute a displacement from the "steady-state frame pointer" to
the CFA. The former is what all stack slots and argument slots
@@ -16572,8 +16211,10 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
SECTION_DEBUG, NULL);
debug_pubnames_section = get_section (DEBUG_PUBNAMES_SECTION,
SECTION_DEBUG, NULL);
+#ifdef DEBUG_PUBTYPES_SECTION
debug_pubtypes_section = get_section (DEBUG_PUBTYPES_SECTION,
SECTION_DEBUG, NULL);
+#endif
debug_str_section = get_section (DEBUG_STR_SECTION,
DEBUG_STR_SECTION_FLAGS, NULL);
debug_ranges_section = get_section (DEBUG_RANGES_SECTION,
@@ -17164,15 +16805,14 @@ dwarf2out_finish (const char *filename)
output_pubnames (pubname_table);
}
+#ifdef DEBUG_PUBTYPES_SECTION
/* Output public types table if necessary. */
- /* ??? Only defined by DWARF3, but emitted by Darwin for DWARF2.
- It shouldn't hurt to emit it always, since pure DWARF2 consumers
- simply won't look for the section. */
if (!VEC_empty (pubname_entry, pubtype_table))
{
switch_to_section (debug_pubtypes_section);
output_pubnames (pubtype_table);
}
+#endif
/* Output the address range information. We only put functions in the arange
table, so don't write it out if we don't have any. */
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 85c320dfbd5..154bb143dbb 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -20,8 +20,6 @@ along with GCC; see the file COPYING3. If not see
extern void dwarf2out_decl (tree);
extern void dwarf2out_frame_debug (rtx, bool);
-extern void dwarf2out_begin_epilogue (rtx);
-extern void dwarf2out_frame_debug_restore_state (void);
extern void debug_dwarf (void);
struct die_struct;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index a9c8ab2fe3c..a91e7fd0c9b 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3347,10 +3347,6 @@ try_split (rtx pat, rtx trial, int last)
rtx insn_last, insn;
int njumps = 0;
- /* We're not good at redistributing frame information. */
- if (RTX_FRAME_RELATED_P (trial))
- return trial;
-
if (any_condjump_p (trial)
&& (note = find_reg_note (trial, REG_BR_PROB, 0)))
split_branch_probability = INTVAL (XEXP (note, 0));
@@ -5066,9 +5062,6 @@ copy_insn_1 (rtx orig)
RTX_CODE code;
const char *format_ptr;
- if (orig == NULL)
- return NULL;
-
code = GET_CODE (orig);
switch (code)
diff --git a/gcc/final.c b/gcc/final.c
index 9e942c94c1d..36a357b66c4 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1879,19 +1879,9 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
break;
case NOTE_INSN_EPILOGUE_BEG:
-#if defined (DWARF2_UNWIND_INFO) && defined (HAVE_epilogue)
- if (dwarf2out_do_frame ())
- dwarf2out_begin_epilogue (insn);
-#endif
targetm.asm_out.function_begin_epilogue (file);
break;
- case NOTE_INSN_CFA_RESTORE_STATE:
-#if defined (DWARF2_UNWIND_INFO)
- dwarf2out_frame_debug_restore_state ();
-#endif
- break;
-
case NOTE_INSN_FUNCTION_BEG:
app_disable ();
(*debug_hooks->end_prologue) (last_linenum, last_filename);
diff --git a/gcc/function.c b/gcc/function.c
index c4d0585a285..b6daf24e5ff 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -124,11 +124,13 @@ struct machine_function * (*init_machine_status) (void);
/* The currently compiled function. */
struct function *cfun = 0;
-/* These hashes record the prologue and epilogue insns. */
-static GTY((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
- htab_t prologue_insn_hash;
-static GTY((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
- htab_t epilogue_insn_hash;
+/* These arrays record the INSN_UIDs of the prologue and epilogue insns. */
+static VEC(int,heap) *prologue;
+static VEC(int,heap) *epilogue;
+
+/* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
+ in this function. */
+static VEC(int,heap) *sibcall_epilogue;
/* Forward declarations. */
@@ -141,8 +143,8 @@ static tree *get_block_vector (tree, int *);
extern tree debug_find_var_in_block_tree (tree, tree);
/* We always define `record_insns' even if it's not used so that we
can always export `prologue_epilogue_contains'. */
-static void record_insns (rtx, rtx, htab_t *) ATTRIBUTE_UNUSED;
-static bool contains (const_rtx, htab_t);
+static void record_insns (rtx, VEC(int,heap) **) ATTRIBUTE_UNUSED;
+static int contains (const_rtx, VEC(int,heap) **);
#ifdef HAVE_return
static void emit_return_into_block (basic_block);
#endif
@@ -205,9 +207,9 @@ free_after_parsing (struct function *f)
void
free_after_compilation (struct function *f)
{
- prologue_insn_hash = NULL;
- epilogue_insn_hash = NULL;
-
+ VEC_free (int, heap, prologue);
+ VEC_free (int, heap, epilogue);
+ VEC_free (int, heap, sibcall_epilogue);
if (crtl->emit.regno_pointer_align)
free (crtl->emit.regno_pointer_align);
@@ -4208,11 +4210,18 @@ init_function_start (tree subr)
warning (OPT_Waggregate_return, "function returns an aggregate");
}
-/* Make sure all values used by the optimization passes have sane defaults. */
+/* Make sure all values used by the optimization passes have sane
+ defaults. */
unsigned int
init_function_for_compilation (void)
{
reg_renumber = 0;
+
+ /* No prologue/epilogue insns yet. Make sure that these vectors are
+ empty. */
+ gcc_assert (VEC_length (int, prologue) == 0);
+ gcc_assert (VEC_length (int, epilogue) == 0);
+ gcc_assert (VEC_length (int, sibcall_epilogue) == 0);
return 0;
}
@@ -4878,42 +4887,16 @@ get_arg_pointer_save_area (void)
return ret;
}
-/* Add a list of INSNS to the hash HASHP, possibly allocating HASHP
- for the first time. */
+/* Extend a vector that records the INSN_UIDs of INSNS
+ (a list of one or more insns). */
static void
-record_insns (rtx insns, rtx end, htab_t *hashp)
+record_insns (rtx insns, VEC(int,heap) **vecp)
{
rtx tmp;
- htab_t hash = *hashp;
-
- if (hash == NULL)
- *hashp = hash
- = htab_create_ggc (17, htab_hash_pointer, htab_eq_pointer, NULL);
-
- for (tmp = insns; tmp != end; tmp = NEXT_INSN (tmp))
- {
- void **slot = htab_find_slot (hash, tmp, INSERT);
- gcc_assert (*slot == NULL);
- *slot = tmp;
- }
-}
-
-/* INSN has been duplicated as COPY, as part of duping a basic block.
- If INSN is an epilogue insn, then record COPY as epilogue as well. */
-void
-maybe_copy_epilogue_insn (rtx insn, rtx copy)
-{
- void **slot;
-
- if (epilogue_insn_hash == NULL
- || htab_find (epilogue_insn_hash, insn) == NULL)
- return;
-
- slot = htab_find_slot (epilogue_insn_hash, copy, INSERT);
- gcc_assert (*slot == NULL);
- *slot = copy;
+ for (tmp = insns; tmp != NULL_RTX; tmp = NEXT_INSN (tmp))
+ VEC_safe_push (int, heap, *vecp, INSN_UID (tmp));
}
/* Set the locator of the insn chain starting at INSN to LOC. */
@@ -4928,37 +4911,52 @@ set_insn_locators (rtx insn, int loc)
}
}
-/* Determine if any INSNs in HASH are, or are part of, INSN. Because
- we can be running after reorg, SEQUENCE rtl is possible. */
+/* Determine how many INSN_UIDs in VEC are part of INSN. Because we can
+ be running after reorg, SEQUENCE rtl is possible. */
-static bool
-contains (const_rtx insn, htab_t hash)
+static int
+contains (const_rtx insn, VEC(int,heap) **vec)
{
- if (hash == NULL)
- return false;
+ int i, j;
- if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE)
+ if (NONJUMP_INSN_P (insn)
+ && GET_CODE (PATTERN (insn)) == SEQUENCE)
{
- int i;
+ int count = 0;
for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
- if (htab_find (hash, XVECEXP (PATTERN (insn), 0, i)))
- return true;
- return false;
+ for (j = VEC_length (int, *vec) - 1; j >= 0; --j)
+ if (INSN_UID (XVECEXP (PATTERN (insn), 0, i))
+ == VEC_index (int, *vec, j))
+ count++;
+ return count;
}
-
- return htab_find (hash, insn) != NULL;
+ else
+ {
+ for (j = VEC_length (int, *vec) - 1; j >= 0; --j)
+ if (INSN_UID (insn) == VEC_index (int, *vec, j))
+ return 1;
+ }
+ return 0;
}
int
prologue_epilogue_contains (const_rtx insn)
{
- if (contains (insn, prologue_insn_hash))
+ if (contains (insn, &prologue))
return 1;
- if (contains (insn, epilogue_insn_hash))
+ if (contains (insn, &epilogue))
return 1;
return 0;
}
+int
+sibcall_epilogue_contains (const_rtx insn)
+{
+ if (sibcall_epilogue)
+ return contains (insn, &sibcall_epilogue);
+ return 0;
+}
+
#ifdef HAVE_return
/* Insert gen_return at the end of block BB. This also means updating
block_for_insn appropriately. */
@@ -5001,7 +4999,7 @@ thread_prologue_and_epilogue_insns (void)
emit_use (hard_frame_pointer_rtx);
/* Retain a map of the prologue insns. */
- record_insns (seq, NULL, &prologue_insn_hash);
+ record_insns (seq, &prologue);
emit_note (NOTE_INSN_PROLOGUE_END);
#ifndef PROFILE_BEFORE_PROLOGUE
@@ -5133,38 +5131,6 @@ thread_prologue_and_epilogue_insns (void)
}
}
#endif
-
- /* A small fib -- epilogue is not yet completed, but we wish to re-use
- this marker for the splits of EH_RETURN patterns, and nothing else
- uses the flag in the meantime. */
- epilogue_completed = 1;
-
-#ifdef HAVE_eh_return
- /* Find non-fallthru edges that end with EH_RETURN instructions. On
- some targets, these get split to a special version of the epilogue
- code. In order to be able to properly annotate these with unwind
- info, try to split them now. If we get a valid split, drop an
- EPILOGUE_BEG note and mark the insns as epilogue insns. */
- FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
- {
- rtx prev, last, trial;
-
- if (e->flags & EDGE_FALLTHRU)
- continue;
- last = BB_END (e->src);
- if (!eh_returnjump_p (last))
- continue;
-
- prev = PREV_INSN (last);
- trial = try_split (PATTERN (last), last, 1);
- if (trial == last)
- continue;
-
- record_insns (NEXT_INSN (prev), NEXT_INSN (trial), &epilogue_insn_hash);
- emit_note_after (NOTE_INSN_EPILOGUE_BEG, prev);
- }
-#endif
-
/* Find the edge that falls through to EXIT. Other edges may exist
due to RETURN instructions, but those don't need epilogues.
There really shouldn't be a mixture -- either all should have
@@ -5185,7 +5151,7 @@ thread_prologue_and_epilogue_insns (void)
emit_jump_insn (seq);
/* Retain a map of the epilogue insns. */
- record_insns (seq, NULL, &epilogue_insn_hash);
+ record_insns (seq, &epilogue);
set_insn_locators (seq, epilogue_locator);
seq = get_insns ();
@@ -5247,7 +5213,6 @@ epilogue_done:
}
start_sequence ();
- emit_note (NOTE_INSN_EPILOGUE_BEG);
emit_insn (gen_sibcall_epilogue ());
seq = get_insns ();
end_sequence ();
@@ -5255,7 +5220,7 @@ epilogue_done:
/* Retain a map of the epilogue insns. Used in life analysis to
avoid getting rid of sibcall epilogue insns. Do this before we
actually emit the sequence. */
- record_insns (seq, NULL, &epilogue_insn_hash);
+ record_insns (seq, &sibcall_epilogue);
set_insn_locators (seq, epilogue_locator);
emit_insn_before (seq, insn);
@@ -5289,29 +5254,23 @@ epilogue_done:
df_update_entry_exit_and_calls ();
}
-/* Reposition the prologue-end and epilogue-begin notes after
- instruction scheduling. */
+/* Reposition the prologue-end and epilogue-begin notes after instruction
+ scheduling and delayed branch scheduling. */
void
reposition_prologue_and_epilogue_notes (void)
{
-#if defined (HAVE_prologue) || defined (HAVE_epilogue) \
- || defined (HAVE_sibcall_epilogue)
+#if defined (HAVE_prologue) || defined (HAVE_epilogue)
rtx insn, last, note;
- basic_block bb;
+ int len;
- /* Since the hash table is created on demand, the fact that it is
- non-null is a signal that it is non-empty. */
- if (prologue_insn_hash != NULL)
+ if ((len = VEC_length (int, prologue)) > 0)
{
- size_t len = htab_elements (prologue_insn_hash);
last = 0, note = 0;
- /* Scan from the beginning until we reach the last prologue insn. */
- /* ??? While we do have the CFG intact, there are two problems:
- (1) The prologue can contain loops (typically probing the stack),
- which means that the end of the prologue isn't in the first bb.
- (2) Sometimes the PROLOGUE_END note gets pushed into the next bb. */
+ /* Scan from the beginning until we reach the last prologue insn.
+ We apparently can't depend on basic_block_{head,end} after
+ reorg has run. */
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{
if (NOTE_P (insn))
@@ -5319,7 +5278,7 @@ reposition_prologue_and_epilogue_notes (void)
if (NOTE_KIND (insn) == NOTE_INSN_PROLOGUE_END)
note = insn;
}
- else if (contains (insn, prologue_insn_hash))
+ else if (contains (insn, &prologue))
{
last = insn;
if (--len == 0)
@@ -5329,17 +5288,14 @@ reposition_prologue_and_epilogue_notes (void)
if (last)
{
- if (note == NULL)
+ /* Find the prologue-end note if we haven't already, and
+ move it to just after the last prologue insn. */
+ if (note == 0)
{
- /* Scan forward looking for the PROLOGUE_END note. It should
- be right at the beginning of the block, possibly with other
- insn notes that got moved there. */
- for (note = NEXT_INSN (last); ; note = NEXT_INSN (note))
- {
- if (NOTE_P (note)
- && NOTE_KIND (note) == NOTE_INSN_PROLOGUE_END)
- break;
- }
+ for (note = last; (note = NEXT_INSN (note));)
+ if (NOTE_P (note)
+ && NOTE_KIND (note) == NOTE_INSN_PROLOGUE_END)
+ break;
}
/* Avoid placing note between CODE_LABEL and BASIC_BLOCK note. */
@@ -5349,39 +5305,41 @@ reposition_prologue_and_epilogue_notes (void)
}
}
- if (epilogue_insn_hash != NULL)
+ if ((len = VEC_length (int, epilogue)) > 0)
{
- edge_iterator ei;
- edge e;
+ last = 0, note = 0;
- FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR->preds)
+ /* Scan from the end until we reach the first epilogue insn.
+ We apparently can't depend on basic_block_{head,end} after
+ reorg has run. */
+ for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
{
- last = 0, note = 0;
- bb = e->src;
+ if (NOTE_P (insn))
+ {
+ if (NOTE_KIND (insn) == NOTE_INSN_EPILOGUE_BEG)
+ note = insn;
+ }
+ else if (contains (insn, &epilogue))
+ {
+ last = insn;
+ if (--len == 0)
+ break;
+ }
+ }
- /* Scan from the beginning until we reach the first epilogue insn.
- Take the cue for whether this is a plain or sibcall epilogue
- from the kind of note we find first. */
- FOR_BB_INSNS (bb, insn)
+ if (last)
+ {
+ /* Find the epilogue-begin note if we haven't already, and
+ move it to just before the first epilogue insn. */
+ if (note == 0)
{
- if (NOTE_P (insn))
- {
- if (NOTE_KIND (insn) == NOTE_INSN_EPILOGUE_BEG)
- {
- note = insn;
- if (last)
- break;
- }
- }
- else if (contains (insn, epilogue_insn_hash))
- {
- last = insn;
- if (note != NULL)
- break;
- }
+ for (note = insn; (note = PREV_INSN (note));)
+ if (NOTE_P (note)
+ && NOTE_KIND (note) == NOTE_INSN_EPILOGUE_BEG)
+ break;
}
-
- if (last && note && PREV_INSN (last) != note)
+
+ if (PREV_INSN (last) != note)
reorder_insns (note, note, PREV_INSN (last));
}
}
diff --git a/gcc/insn-notes.def b/gcc/insn-notes.def
index 83161ec14b6..16b4a275477 100644
--- a/gcc/insn-notes.def
+++ b/gcc/insn-notes.def
@@ -70,8 +70,4 @@ INSN_NOTE (BASIC_BLOCK)
between hot and cold text sections. */
INSN_NOTE (SWITCH_TEXT_SECTIONS)
-/* Mark the restore point after an epilogue changed CFI data. Used only
- when an epilogue appears in the middle of a function. */
-INSN_NOTE (CFA_RESTORE_STATE)
-
#undef INSN_NOTE
diff --git a/gcc/jump.c b/gcc/jump.c
index b38a2dd92f9..2b9a9545223 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -869,54 +869,18 @@ returnjump_p_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
{
rtx x = *loc;
- if (x == NULL)
- return false;
-
- switch (GET_CODE (x))
- {
- case RETURN:
- case EH_RETURN:
- return true;
-
- case SET:
- return SET_IS_RETURN_P (x);
-
- default:
- return false;
- }
+ return x && (GET_CODE (x) == RETURN
+ || (GET_CODE (x) == SET && SET_IS_RETURN_P (x)));
}
-/* Return TRUE if INSN is a return jump. */
-
int
returnjump_p (rtx insn)
{
- /* Handle delayed branches. */
- if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
-
if (!JUMP_P (insn))
return 0;
-
return for_each_rtx (&PATTERN (insn), returnjump_p_1, NULL);
}
-/* Return true if INSN is a (possibly conditional) return insn. */
-
-static int
-eh_returnjump_p_1 (rtx *loc, void *data ATTRIBUTE_UNUSED)
-{
- return *loc && GET_CODE (*loc) == EH_RETURN;
-}
-
-int
-eh_returnjump_p (rtx insn)
-{
- if (!JUMP_P (insn))
- return 0;
- return for_each_rtx (&PATTERN (insn), eh_returnjump_p_1, NULL);
-}
-
/* Return true if INSN is a jump that only transfers control and
nothing more. */
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 448fda31f1a..b84d1f2c520 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -333,8 +333,6 @@ for (i = 0; i < n_opts; i++) {
enum = "OPT_" opts[i]
if (opts[i] == "finline-limit=" || opts[i] == "Wlarger-than=")
enum = enum "eq"
- if (opts[i] == "gdwarf+")
- enum = "OPT_gdwarfplus"
gsub ("[^A-Za-z0-9]", "_", enum)
# If this switch takes joined arguments, back-chain all
@@ -350,7 +348,7 @@ for (i = 0; i < n_opts; i++) {
}
}
- s = substr(" ", length (enum))
+ s = substr(" ", length (opts[i]))
if (i + 1 == n_opts)
comma = ""
diff --git a/gcc/opts.c b/gcc/opts.c
index c95e62d5036..90f34df1dec 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2020,12 +2020,8 @@ common_handle_option (size_t scode, const char *arg, int value,
set_debug_level (SDB_DEBUG, false, arg);
break;
- case OPT_gdwarf_:
- if (value < 2 || value > 3)
- error ("dwarf version %d is not supported", value);
- else
- dwarf_version = value;
- set_debug_level (DWARF2_DEBUG, false, "");
+ case OPT_gdwarf_2:
+ set_debug_level (DWARF2_DEBUG, false, arg);
break;
case OPT_ggdb:
diff --git a/gcc/recog.c b/gcc/recog.c
index ea0d305f650..70370e3ad81 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3026,26 +3026,6 @@ peep2_find_free_register (int from, int to, const char *class_str,
return NULL_RTX;
}
-/* Forget all currently tracked instructions, only remember current
- LIVE regset. */
-
-static void
-peep2_reinit_state (regset live)
-{
- int i;
-
- /* Indicate that all slots except the last holds invalid data. */
- for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
- peep2_insn_data[i].insn = NULL_RTX;
- peep2_current_count = 0;
-
- /* Indicate that the last slot contains live_after data. */
- peep2_insn_data[MAX_INSNS_PER_PEEP2].insn = PEEP2_EOB;
- peep2_current = MAX_INSNS_PER_PEEP2;
-
- COPY_REG_SET (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live);
-}
-
/* Perform the peephole2 optimization pass. */
static void
@@ -3069,11 +3049,19 @@ peephole2_optimize (void)
FOR_EACH_BB_REVERSE (bb)
{
rtl_profile_for_bb (bb);
+ /* Indicate that all slots except the last holds invalid data. */
+ for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i)
+ peep2_insn_data[i].insn = NULL_RTX;
+ peep2_current_count = 0;
+
+ /* Indicate that the last slot contains live_after data. */
+ peep2_insn_data[MAX_INSNS_PER_PEEP2].insn = PEEP2_EOB;
+ peep2_current = MAX_INSNS_PER_PEEP2;
/* Start up propagation. */
bitmap_copy (live, DF_LR_OUT (bb));
df_simulate_initialize_backwards (bb, live);
- peep2_reinit_state (live);
+ bitmap_copy (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live);
for (insn = BB_END (bb); ; insn = prev)
{
@@ -3100,7 +3088,7 @@ peephole2_optimize (void)
/* If an insn has RTX_FRAME_RELATED_P set, peephole
substitution would lose the
REG_FRAME_RELATED_EXPR that is attached. */
- peep2_reinit_state (live);
+ peep2_current_count = 0;
attempt = NULL;
}
else
diff --git a/gcc/reg-notes.def b/gcc/reg-notes.def
index 90b5fde3feb..60e41bb9803 100644
--- a/gcc/reg-notes.def
+++ b/gcc/reg-notes.def
@@ -118,41 +118,6 @@ REG_NOTE (BR_PRED)
instead of intuition. */
REG_NOTE (FRAME_RELATED_EXPR)
-/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex
- for FRAME_RELATED_EXPR intuition. The insn's first pattern must be
- a SET, and the destination must be the CFA register. The attached
- rtx is an expression that defines the CFA. In the simplest case, the
- rtx could be just the stack_pointer_rtx; more common would be a PLUS
- with a base register and a constant offset. In the most complicated
- cases, this will result in a DW_CFA_def_cfa_expression with the rtx
- expression rendered in a dwarf location expression. */
-REG_NOTE (CFA_DEF_CFA)
-
-/* Attached to insns that are RTX_FRAME_RELATED_P, but are too complex
- for FRAME_RELATED_EXPR intuition. This note adjusts the expression
- from which the CFA is computed. The attached rtx defines a new CFA
- expression, relative to the old CFA expression. This rtx must be of
- the form (SET new-cfa-reg (PLUS old-cfa-reg const_int)). If the note
- rtx is NULL, we use the first SET of the insn. */
-REG_NOTE (CFA_ADJUST_CFA)
-
-/* Similar to FRAME_RELATED_EXPR, with the additional information that
- this is a save to memory, i.e. will result in DW_CFA_offset or the
- like. The pattern or the insn should be a simple store relative to
- the CFA. */
-REG_NOTE (CFA_OFFSET)
-
-/* Similar to FRAME_RELATED_EXPR, with the additional information that this
- is a save to a register, i.e. will result in DW_CFA_register. The insn
- or the pattern should be simple reg-reg move. */
-REG_NOTE (CFA_REGISTER)
-
-/* Attached to insns that are RTX_FRAME_RELATED_P, with the information
- that this is a restore operation, i.e. will result in DW_CFA_restore
- or the like. Either the attached rtx, or the destination of the insn's
- first pattern is the register to be restored. */
-REG_NOTE (CFA_RESTORE)
-
/* Indicates that REG holds the exception context for the function.
This context is shared by inline functions, so the code to acquire
the real exception context is delayed until after inlining. */
diff --git a/gcc/rtl.def b/gcc/rtl.def
index 090546b3ebe..662a9f0c8b7 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -281,10 +281,6 @@ DEF_RTL_EXPR(CALL, "call", "ee", RTX_EXTRA)
DEF_RTL_EXPR(RETURN, "return", "", RTX_EXTRA)
-/* Special for EH return from subroutine. */
-
-DEF_RTL_EXPR(EH_RETURN, "eh_return", "", RTX_EXTRA)
-
/* Conditional trap.
Operand 1 is the condition.
Operand 2 is the trap code.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 3ac86720238..65d7929426f 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2074,7 +2074,6 @@ extern rtx pc_set (const_rtx);
extern rtx condjump_label (const_rtx);
extern int simplejump_p (const_rtx);
extern int returnjump_p (rtx);
-extern int eh_returnjump_p (rtx);
extern int onlyjump_p (const_rtx);
extern int only_sets_cc0_p (const_rtx);
extern int sets_cc0_p (const_rtx);
@@ -2188,7 +2187,6 @@ extern int prologue_epilogue_contains (const_rtx);
extern int sibcall_epilogue_contains (const_rtx);
extern void mark_temp_addr_taken (rtx);
extern void update_temp_slot_address (rtx, rtx);
-extern void maybe_copy_epilogue_insn (rtx, rtx);
/* In stmt.c */
extern void expand_null_return (void);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0fe75b0d657..3fe738f4f8c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -328,15 +328,6 @@
PR c++/40342
* g++.dg/template/overload10.C: New.
-2009-06-23 Jakub Jelinek <jakub@redhat.com>
-
- * g++.dg/ext/builtin-object-size1.C: New test.
- * g++.dg/ext/builtin-object-size2.C: New test.
-
-2009-06-15 Jakub Jelinek <jakub@redhat.com>
-
- * gcc.dg/builtin-object-size-7.c: New test.
-
2009-06-22 Matthias Klose <doko@ubuntu.com>
PR objc/28050
@@ -392,16 +383,6 @@
PR middle-end/40446
* g++.dg/other/pr40446.C: New test.
-2009-06-15 Jakub Jelinek <jakub@redhat.com>
-
- PR testsuite/40426
- * lib/gcc-dg.exp (gcc-dg-debug-runtest): For type -gdwarf-2 and
- level != "" use separate -gdwarf-2 -g${level} options instead of
- -gdwarf-2${level}.
- * lib/gfortran-dg.exp (gfortran-dg-debug-runtest): Likewise.
- * gfortran.dg/debug/pr37738.f: Also skip if -gdwarf-2 -g1.
- * gfortran.dg/debug/pr35154-dwarf2.f: Likewise.
-
2009-06-14 Richard Guenther <rguenther@suse.de>
Backport from mainline
@@ -415,12 +396,6 @@
* gcc.target/i386/crc32-1.c: New.
* gcc.target/i386/crc32-2.c: Likewise.
-2009-06-08 Jakub Jelinek <jakub@redhat.com>
-
- * gcc.dg/builtin-object-size-2.c (test1): Adjust expected results.
- * gcc.dg/builtin-object-size-4.c (test1): Adjust expected results.
- * gcc.dg/builtin-object-size-6.c: New test.
-
2009-05-21 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/movbe-1.c: New.
diff --git a/gcc/testsuite/g++.dg/ext/builtin-object-size1.C b/gcc/testsuite/g++.dg/ext/builtin-object-size1.C
deleted file mode 100644
index 8baed692541..00000000000
--- a/gcc/testsuite/g++.dg/ext/builtin-object-size1.C
+++ /dev/null
@@ -1,435 +0,0 @@
-// { dg-do run }
-// { dg-options "-O2" }
-
-typedef __SIZE_TYPE__ size_t;
-extern "C" void abort ();
-extern "C" void exit (int);
-extern "C" void *malloc (size_t);
-extern "C" void free (void *);
-
-struct A
-{
- char a[10];
- int b;
- char c[10];
-};
-
-void
-__attribute__ ((noinline))
-test1 (A *p)
-{
- char *c;
- if (__builtin_object_size (&p->a, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->b, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->c, 0) != (size_t) -1)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != (size_t) -1)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 1) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 1) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 1) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a[0], 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&p->b, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 2) != 0)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a, 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 3) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 3) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 3) != 0)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 3) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 3) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 3) != 0)
- abort ();
-}
-
-void
-__attribute__ ((noinline))
-test2 (void)
-{
- char *c;
- size_t s = 2 * sizeof (A);
- A *p = (A *) malloc (2 * sizeof (A));
- if (__builtin_object_size (&p->a, 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 0) != s - __builtin_offsetof (A, b))
- abort ();
- if (__builtin_object_size (&p->c, 0) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 0) != s)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 0) != s)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 0) != s - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 0) != s - __builtin_offsetof (A, b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 0) != s - __builtin_offsetof (A, c))
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 1) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 1) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 1) != s - __builtin_offsetof (A, c))
- abort ();
- if (__builtin_object_size (&p->a, 2) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 2) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 2) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 2) != s - __builtin_offsetof (A, b))
- abort ();
- if (__builtin_object_size (&p->c, 2) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 2) != s)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 2) != s)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 2) != s - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 2) != s - __builtin_offsetof (A, b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 2) != s - __builtin_offsetof (A, c))
- abort ();
- if (__builtin_object_size (&p->a, 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 3) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 3) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 3) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 3) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 3) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 3) != s - __builtin_offsetof (A, c))
- abort ();
- free (p);
-}
-
-void
-__attribute__ ((noinline))
-test3 (void)
-{
- char *c;
- size_t s;
- A *p = (A *) malloc (4);
- if (__builtin_object_size (&p->a, 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != 1)
- abort ();
- if (__builtin_object_size (&p->b, 0) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 0) != 0)
- abort ();
- if (__builtin_object_size (&p->a, 1) != 4)
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != 4)
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != 1)
- abort ();
- if (__builtin_object_size (&p->b, 1) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 1) != 0)
- abort ();
- free (p);
- s = __builtin_offsetof (A, c) + 4;
- p = (A *) malloc (s);
- if (__builtin_object_size (&p->a, 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 0) != s - __builtin_offsetof (A, b))
- abort ();
- if (__builtin_object_size (&p->c, 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != 4)
- abort ();
- free (p);
-}
-
-struct B
-{
- A a[4];
-};
-
-void
-__attribute__ ((noinline))
-test4 (struct B *q, int i)
-{
- if (__builtin_object_size (&q->a[2].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[2].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
- if (__builtin_object_size (&q->a[3].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[3].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
- if (__builtin_object_size (&q->a[i].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[i].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
-}
-
-struct C
-{
- char a[10];
- char b;
-};
-
-void
-__attribute__ ((noinline))
-test5 (struct C *c)
-{
- if (__builtin_object_size (&c->b, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&c->b, 1) != 1)
- abort ();
- if (__builtin_object_size (&c->b, 2) != 0)
- abort ();
- if (__builtin_object_size (&c->b, 3) != 1)
- abort ();
-}
-
-struct D
-{
- int i;
- struct D1
- {
- char b;
- char a[10];
- } j;
-};
-
-void
-__attribute__ ((noinline))
-test6 (struct D *d)
-{
- if (__builtin_object_size (&d->j.a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 1) != sizeof (d->j.a) - 3)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 3) != sizeof (d->j.a) - 3)
- abort ();
-}
-
-struct E
-{
- int i;
- struct E1
- {
- char b;
- char a[10];
- } j[1];
-};
-
-void
-__attribute__ ((noinline))
-test7 (struct E *e)
-{
- if (__builtin_object_size (&e->j[0].a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 1) != sizeof (e->j[0].a) - 3)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 3) != sizeof (e->j[0].a) - 3)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 1) != (size_t) -1)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 2) != 0)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 3) != 0)
- abort ();
-}
-
-union F
-{
- char a[1];
- struct F1
- {
- char b;
- char c[10];
- } d;
-};
-
-void
-__attribute__ ((noinline))
-test8 (union F *f)
-{
- if (__builtin_object_size (&f->d.c[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 1) != sizeof (f->d.c) - 3)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 3) != sizeof (f->d.c) - 3)
- abort ();
-}
-
-int
-main (void)
-{
- A a, *p = &a;
- int i = 1;
- __asm ("" : "+r" (p));
- test1 (p);
- test2 ();
- test3 ();
- struct B b, *q = &b;
- __asm ("" : "+r" (q), "+r" (i));
- test4 (q, i);
- struct C c, *cp = &c;
- __asm ("" : "+r" (cp));
- test5 (cp);
- struct D d, *dp = &d;
- __asm ("" : "+r" (dp));
- test6 (dp);
- struct E e, *ep = &e;
- __asm ("" : "+r" (ep));
- test7 (ep);
- union F f, *fp = &f;
- __asm ("" : "+r" (fp));
- test8 (fp);
- exit (0);
-}
diff --git a/gcc/testsuite/g++.dg/ext/builtin-object-size2.C b/gcc/testsuite/g++.dg/ext/builtin-object-size2.C
deleted file mode 100644
index e1fe6de0330..00000000000
--- a/gcc/testsuite/g++.dg/ext/builtin-object-size2.C
+++ /dev/null
@@ -1,438 +0,0 @@
-// { dg-do run }
-// { dg-options "-O2" }
-
-typedef __SIZE_TYPE__ size_t;
-extern "C" void abort ();
-extern "C" void exit (int);
-extern "C" void *malloc (size_t);
-extern "C" void free (void *);
-
-typedef struct A
-{
- char a[10];
- int b;
- char c[10];
- static int d;
-} AT;
-
-int A::d = 6;
-
-void
-__attribute__ ((noinline))
-test1 (A *p)
-{
- char *c;
- if (__builtin_object_size (&p->a, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->b, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->c, 0) != (size_t) -1)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != (size_t) -1)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 1) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 1) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 1) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a[0], 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&p->b, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 2) != 0)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a, 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 3) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 3) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 3) != 0)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 3) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 3) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 3) != 0)
- abort ();
-}
-
-void
-__attribute__ ((noinline))
-test2 (void)
-{
- char *c;
- size_t s = 2 * sizeof (A);
- A *p = (A *) malloc (2 * sizeof (A));
- if (__builtin_object_size (&p->a, 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 0) != s - __builtin_offsetof (A, b))
- abort ();
- if (__builtin_object_size (&p->c, 0) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 0) != s)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 0) != s)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 0) != s - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 0) != s - __builtin_offsetof (A, b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 0) != s - __builtin_offsetof (A, c))
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 1) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 1) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 1) != s - __builtin_offsetof (A, c))
- abort ();
- if (__builtin_object_size (&p->a, 2) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 2) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 2) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 2) != s - __builtin_offsetof (A, b))
- abort ();
- if (__builtin_object_size (&p->c, 2) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 2) != s)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 2) != s)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 2) != s - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 2) != s - __builtin_offsetof (A, b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 2) != s - __builtin_offsetof (A, c))
- abort ();
- if (__builtin_object_size (&p->a, 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 3) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 3) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 3) != s - __builtin_offsetof (A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 3) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 3) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 3) != s - __builtin_offsetof (A, c))
- abort ();
- free (p);
-}
-
-void
-__attribute__ ((noinline))
-test3 (void)
-{
- char *c;
- size_t s;
- A *p = (A *) malloc (4);
- if (__builtin_object_size (&p->a, 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != 1)
- abort ();
- if (__builtin_object_size (&p->b, 0) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 0) != 0)
- abort ();
- if (__builtin_object_size (&p->a, 1) != 4)
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != 4)
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != 1)
- abort ();
- if (__builtin_object_size (&p->b, 1) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 1) != 0)
- abort ();
- free (p);
- s = __builtin_offsetof (A, c) + 4;
- p = (A *) malloc (s);
- if (__builtin_object_size (&p->a, 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 0) != s - __builtin_offsetof (A, b))
- abort ();
- if (__builtin_object_size (&p->c, 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != 4)
- abort ();
- free (p);
-}
-
-struct B
-{
- A a[4];
-};
-
-void
-__attribute__ ((noinline))
-test4 (struct B *q, int i)
-{
- if (__builtin_object_size (&q->a[2].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[2].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
- if (__builtin_object_size (&q->a[3].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[3].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
- if (__builtin_object_size (&q->a[i].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[i].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
-}
-
-struct C
-{
- char a[10];
- char b;
-};
-
-void
-__attribute__ ((noinline))
-test5 (struct C *c)
-{
- if (__builtin_object_size (&c->b, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&c->b, 1) != 1)
- abort ();
- if (__builtin_object_size (&c->b, 2) != 0)
- abort ();
- if (__builtin_object_size (&c->b, 3) != 1)
- abort ();
-}
-
-struct D
-{
- int i;
- struct D1
- {
- char b;
- char a[10];
- } j;
-};
-
-void
-__attribute__ ((noinline))
-test6 (struct D *d)
-{
- if (__builtin_object_size (&d->j.a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 1) != sizeof (d->j.a) - 3)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 3) != sizeof (d->j.a) - 3)
- abort ();
-}
-
-struct E
-{
- int i;
- struct E1
- {
- char b;
- char a[10];
- } j[1];
-};
-
-void
-__attribute__ ((noinline))
-test7 (struct E *e)
-{
- if (__builtin_object_size (&e->j[0].a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 1) != sizeof (e->j[0].a) - 3)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 3) != sizeof (e->j[0].a) - 3)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 1) != (size_t) -1)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 2) != 0)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 3) != 0)
- abort ();
-}
-
-union F
-{
- char a[1];
- struct F1
- {
- char b;
- char c[10];
- } d;
-};
-
-void
-__attribute__ ((noinline))
-test8 (union F *f)
-{
- if (__builtin_object_size (&f->d.c[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 1) != sizeof (f->d.c) - 3)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 3) != sizeof (f->d.c) - 3)
- abort ();
-}
-
-int
-main (void)
-{
- A a, *p = &a;
- int i = 1;
- __asm ("" : "+r" (p));
- test1 (p);
- test2 ();
- test3 ();
- struct B b, *q = &b;
- __asm ("" : "+r" (q), "+r" (i));
- test4 (q, i);
- struct C c, *cp = &c;
- __asm ("" : "+r" (cp));
- test5 (cp);
- struct D d, *dp = &d;
- __asm ("" : "+r" (dp));
- test6 (dp);
- struct E e, *ep = &e;
- __asm ("" : "+r" (ep));
- test7 (ep);
- union F f, *fp = &f;
- __asm ("" : "+r" (fp));
- test8 (fp);
- exit (0);
-}
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-2.c b/gcc/testsuite/gcc.dg/builtin-object-size-2.c
index 34f16759d68..4071c2516ee 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-2.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-2.c
@@ -130,15 +130,15 @@ test1 (void *q, int x)
abort ();
if (__builtin_object_size (&vara[5], 1) != (size_t) -1)
abort ();
- if (__builtin_object_size (&vara[0].a, 1) != sizeof (vara[0].a))
+ if (__builtin_object_size (&vara[0].a, 1) != (size_t) -1)
abort ();
- if (__builtin_object_size (&vara[10].a[0], 1) != sizeof (vara[0].a))
+ if (__builtin_object_size (&vara[10].a[0], 1) != (size_t) -1)
abort ();
- if (__builtin_object_size (&vara[5].a[4], 1) != sizeof (vara[0].a) - 4)
+ if (__builtin_object_size (&vara[5].a[4], 1) != (size_t) -1)
abort ();
- if (__builtin_object_size (&vara[5].b, 1) != sizeof (vara[0].b))
+ if (__builtin_object_size (&vara[5].b, 1) != (size_t) -1)
abort ();
- if (__builtin_object_size (&vara[7].c[7], 1) != sizeof (vara[0].c) - 7)
+ if (__builtin_object_size (&vara[7].c[7], 1) != (size_t) -1)
abort ();
if (__builtin_object_size (zerol, 1) != 0)
abort ();
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-4.c b/gcc/testsuite/gcc.dg/builtin-object-size-4.c
index 1eb30d1ba53..453c2d01921 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-4.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-4.c
@@ -130,15 +130,15 @@ test1 (void *q, int x)
abort ();
if (__builtin_object_size (&vara[5], 3) != 0)
abort ();
- if (__builtin_object_size (&vara[0].a, 3) != sizeof (vara[0].a))
+ if (__builtin_object_size (&vara[0].a, 3) != 0)
abort ();
- if (__builtin_object_size (&vara[10].a[0], 3) != sizeof (vara[0].a))
+ if (__builtin_object_size (&vara[10].a[0], 3) != 0)
abort ();
- if (__builtin_object_size (&vara[5].a[4], 3) != sizeof (vara[0].a) - 4)
+ if (__builtin_object_size (&vara[5].a[4], 3) != 0)
abort ();
- if (__builtin_object_size (&vara[5].b, 3) != sizeof (vara[0].b))
+ if (__builtin_object_size (&vara[5].b, 3) != 0)
abort ();
- if (__builtin_object_size (&vara[7].c[7], 3) != sizeof (vara[0].c) - 7)
+ if (__builtin_object_size (&vara[7].c[7], 3) != 0)
abort ();
if (__builtin_object_size (zerol, 3) != 0)
abort ();
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-6.c b/gcc/testsuite/gcc.dg/builtin-object-size-6.c
deleted file mode 100644
index 9a285dfb883..00000000000
--- a/gcc/testsuite/gcc.dg/builtin-object-size-6.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/* { dg-do run } */
-/* { dg-options "-O2" } */
-
-typedef __SIZE_TYPE__ size_t;
-extern void abort (void);
-extern void exit (int);
-extern void *malloc (size_t);
-extern void free (void *);
-
-struct A
-{
- char a[10];
- int b;
- char c[10];
-};
-
-void
-__attribute__ ((noinline))
-test1 (struct A *p)
-{
- char *c;
- if (__builtin_object_size (&p->a, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->b, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->c, 0) != (size_t) -1)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != (size_t) -1)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 1) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 1) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 1) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&p->a, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a[0], 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&p->b, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 2) != 0)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 2) != 0)
- abort ();
- if (__builtin_object_size (&p->a, 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 3) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 3) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 3) != 0)
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 3) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 3) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 3) != 0)
- abort ();
-}
-
-void
-__attribute__ ((noinline))
-test2 (void)
-{
- char *c;
- size_t s = 2 * sizeof (struct A);
- struct A *p = malloc (2 * sizeof (struct A));
- if (__builtin_object_size (&p->a, 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 0) != s - __builtin_offsetof (struct A, b))
- abort ();
- if (__builtin_object_size (&p->c, 0) != s - __builtin_offsetof (struct A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 0) != s)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 0) != s)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 0) != s - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 0) != s - __builtin_offsetof (struct A, b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 0) != s - __builtin_offsetof (struct A, c))
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != s - __builtin_offsetof (struct A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 1) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 1) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 1) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 1) != s - __builtin_offsetof (struct A, c))
- abort ();
- if (__builtin_object_size (&p->a, 2) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 2) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 2) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 2) != s - __builtin_offsetof (struct A, b))
- abort ();
- if (__builtin_object_size (&p->c, 2) != s - __builtin_offsetof (struct A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 2) != s)
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 2) != s)
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 2) != s - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 2) != s - __builtin_offsetof (struct A, b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 2) != s - __builtin_offsetof (struct A, c))
- abort ();
- if (__builtin_object_size (&p->a, 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 3) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 3) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 3) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 3) != s - __builtin_offsetof (struct A, c))
- abort ();
- c = p->a;
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[0];
- if (__builtin_object_size (c, 3) != sizeof (p->a))
- abort ();
- c = &p->a[3];
- if (__builtin_object_size (c, 3) != sizeof (p->a) - 3)
- abort ();
- c = (char *) &p->b;
- if (__builtin_object_size (c, 3) != sizeof (p->b))
- abort ();
- c = (char *) &p->c;
- if (__builtin_object_size (c, 3) != s - __builtin_offsetof (struct A, c))
- abort ();
- free (p);
-}
-
-void
-__attribute__ ((noinline))
-test3 (void)
-{
- char *c;
- size_t s;
- struct A *p = malloc (4);
- if (__builtin_object_size (&p->a, 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != 1)
- abort ();
- if (__builtin_object_size (&p->b, 0) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 0) != 0)
- abort ();
- if (__builtin_object_size (&p->a, 1) != 4)
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != 4)
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != 1)
- abort ();
- if (__builtin_object_size (&p->b, 1) != 0)
- abort ();
- if (__builtin_object_size (&p->c, 1) != 0)
- abort ();
- free (p);
- s = __builtin_offsetof (struct A, c) + 4;
- p = malloc (s);
- if (__builtin_object_size (&p->a, 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[0], 0) != s)
- abort ();
- if (__builtin_object_size (&p->a[3], 0) != s - 3)
- abort ();
- if (__builtin_object_size (&p->b, 0) != s - __builtin_offsetof (struct A, b))
- abort ();
- if (__builtin_object_size (&p->c, 0) != 4)
- abort ();
- if (__builtin_object_size (&p->a, 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[0], 1) != sizeof (p->a))
- abort ();
- if (__builtin_object_size (&p->a[3], 1) != sizeof (p->a) - 3)
- abort ();
- if (__builtin_object_size (&p->b, 1) != sizeof (p->b))
- abort ();
- if (__builtin_object_size (&p->c, 1) != 4)
- abort ();
- free (p);
-}
-
-struct B
-{
- struct A a[4];
-};
-
-void
-__attribute__ ((noinline))
-test4 (struct B *q, int i)
-{
- if (__builtin_object_size (&q->a[2].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[2].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
- if (__builtin_object_size (&q->a[3].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[3].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
- if (__builtin_object_size (&q->a[i].a[2], 1) != sizeof (q->a[0].a) - 2)
- abort ();
- if (__builtin_object_size (&q->a[i].c[2], 1) != sizeof (q->a[0].c) - 2)
- abort ();
-}
-
-struct C
-{
- char a[10];
- char b;
-};
-
-void
-__attribute__ ((noinline))
-test5 (struct C *c)
-{
- if (__builtin_object_size (&c->b, 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&c->b, 1) != 1)
- abort ();
- if (__builtin_object_size (&c->b, 2) != 0)
- abort ();
- if (__builtin_object_size (&c->b, 3) != 1)
- abort ();
-}
-
-struct D
-{
- int i;
- struct D1
- {
- char b;
- char a[10];
- } j;
-};
-
-void
-__attribute__ ((noinline))
-test6 (struct D *d)
-{
- if (__builtin_object_size (&d->j.a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 1) != sizeof (d->j.a) - 3)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&d->j.a[3], 3) != sizeof (d->j.a) - 3)
- abort ();
-}
-
-struct E
-{
- int i;
- struct E1
- {
- char b;
- char a[10];
- } j[1];
-};
-
-void
-__attribute__ ((noinline))
-test7 (struct E *e)
-{
- if (__builtin_object_size (&e->j[0].a[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 1) != sizeof (e->j[0].a) - 3)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&e->j[0].a[3], 3) != sizeof (e->j[0].a) - 3)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 1) != (size_t) -1)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 2) != 0)
- abort ();
- if (__builtin_object_size ((char *) &e->j[0], 3) != 0)
- abort ();
-}
-
-union F
-{
- char a[1];
- struct F1
- {
- char b;
- char c[10];
- } d;
-};
-
-void
-__attribute__ ((noinline))
-test8 (union F *f)
-{
- if (__builtin_object_size (&f->d.c[3], 0) != (size_t) -1)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 1) != sizeof (f->d.c) - 3)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 2) != 0)
- abort ();
- if (__builtin_object_size (&f->d.c[3], 3) != sizeof (f->d.c) - 3)
- abort ();
-}
-
-int
-main (void)
-{
- struct A a, *p = &a;
- int i = 1;
- __asm ("" : "+r" (p));
- test1 (p);
- test2 ();
- test3 ();
- struct B b, *q = &b;
- __asm ("" : "+r" (q), "+r" (i));
- test4 (q, i);
- struct C c, *cp = &c;
- __asm ("" : "+r" (cp));
- test5 (cp);
- struct D d, *dp = &d;
- __asm ("" : "+r" (dp));
- test6 (dp);
- struct E e, *ep = &e;
- __asm ("" : "+r" (ep));
- test7 (ep);
- union F f, *fp = &f;
- __asm ("" : "+r" (fp));
- test8 (fp);
- exit (0);
-}
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-7.c b/gcc/testsuite/gcc.dg/builtin-object-size-7.c
deleted file mode 100644
index 41742b974ef..00000000000
--- a/gcc/testsuite/gcc.dg/builtin-object-size-7.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* { dg-do run } */
-/* { dg-options "-O2" } */
-
-typedef __SIZE_TYPE__ size_t;
-extern void *malloc (size_t);
-extern void abort (void);
-
-struct A
-{
- int i, j, k;
- char buf[255];
- int l, m, n, o;
-};
-
-int
-main (void)
-{
- const size_t s = sizeof (struct A);
- const size_t o = __builtin_offsetof (struct A, buf);
- struct A *a = malloc (s);
- struct A *b = malloc (o + 212);
- if (__builtin_object_size (a->buf, 0) != s - o)
- abort ();
- if (__builtin_object_size (a->buf, 1) != sizeof (a->buf))
- abort ();
- if (__builtin_object_size (a->buf, 2) != s - o)
- abort ();
- if (__builtin_object_size (a->buf, 3) != sizeof (a->buf))
- abort ();
- if (__builtin_object_size (&a->buf[0], 0) != s - o)
- abort ();
- if (__builtin_object_size (&a->buf[0], 1) != sizeof (a->buf))
- abort ();
- if (__builtin_object_size (&a->buf[0], 2) != s - o)
- abort ();
- if (__builtin_object_size (&a->buf[0], 3) != sizeof (a->buf))
- abort ();
- if (__builtin_object_size (&a->buf[6], 0) != s - o - 6)
- abort ();
- if (__builtin_object_size (&a->buf[6], 1) != sizeof (a->buf) - 6)
- abort ();
- if (__builtin_object_size (&a->buf[6], 2) != s - o - 6)
- abort ();
- if (__builtin_object_size (&a->buf[6], 3) != sizeof (a->buf) - 6)
- abort ();
- if (__builtin_object_size (b->buf, 0) != 212)
- abort ();
- if (__builtin_object_size (b->buf, 1) != 212)
- abort ();
- if (__builtin_object_size (b->buf, 2) != 212)
- abort ();
- if (__builtin_object_size (b->buf, 3) != 212)
- abort ();
- if (__builtin_object_size (&b->buf[0], 0) != 212)
- abort ();
- if (__builtin_object_size (&b->buf[0], 1) != 212)
- abort ();
- if (__builtin_object_size (&b->buf[0], 2) != 212)
- abort ();
- if (__builtin_object_size (&b->buf[0], 3) != 212)
- abort ();
- if (__builtin_object_size (&b->buf[28], 0) != 212 - 28)
- abort ();
- if (__builtin_object_size (&b->buf[28], 1) != 212 - 28)
- abort ();
- if (__builtin_object_size (&b->buf[28], 2) != 212 - 28)
- abort ();
- if (__builtin_object_size (&b->buf[28], 3) != 212 - 28)
- abort ();
- return 0;
-}
diff --git a/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f b/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f
index bfd215d9736..b7586ea6e18 100644
--- a/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f
+++ b/gcc/testsuite/gfortran.dg/debug/pr35154-dwarf2.f
@@ -1,7 +1,6 @@
C Test program for common block debugging. G. Helffrich 11 July 2004.
C { dg-do compile }
C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "*" } { "-gdwarf-2" } }
-C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "-g1" } { "" } }
C { dg-options "-dA" }
common i,j
common /label/l,m
diff --git a/gcc/testsuite/gfortran.dg/debug/pr37738.f b/gcc/testsuite/gfortran.dg/debug/pr37738.f
index 48e18841ac2..b0a787b2e52 100644
--- a/gcc/testsuite/gfortran.dg/debug/pr37738.f
+++ b/gcc/testsuite/gfortran.dg/debug/pr37738.f
@@ -1,7 +1,6 @@
C PR debug/37738
C { dg-do compile }
C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "*" } { "-gdwarf-2" } }
-C { dg-skip-if "DWARF-2 only" { "*-*-*" } { "-g1" } { "" } }
C { dg-options "-dA" }
subroutine a
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index e2b737cdcd6..7d00acf6d1a 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+# Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -289,18 +289,10 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
$comp_output] } {
remove-build-file "trivial.S"
foreach level {1 "" 3} {
- if { ($type == "-gdwarf-2") && ($level != "") } {
- lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"]
- foreach opt $opt_opts {
- lappend DEBUG_TORTURE_OPTIONS \
- [list "${type}" "-g${level}" "$opt" ]
- }
- } else {
- lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
- foreach opt $opt_opts {
- lappend DEBUG_TORTURE_OPTIONS \
- [list "${type}${level}" "$opt" ]
- }
+ lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
+ foreach opt $opt_opts {
+ lappend DEBUG_TORTURE_OPTIONS \
+ [list "${type}${level}" "$opt" ]
}
}
}
@@ -328,8 +320,7 @@ proc gcc-dg-debug-runtest { target_compile trivial opt_opts testcases } {
if { ([string match {*/debug-[126].c} "$nshort"] \
|| [string match {*/enum-1.c} "$nshort"] \
|| [string match {*/enum-[12].C} "$nshort"]) \
- && ([string match "*1" [lindex "$flags" 0] ]
- || [lindex "$flags" 1] == "-g1") } {
+ && [string match "*1" [lindex "$flags" 0] ] } {
set doit 0
}
diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index 70a0888a0a4..55d6d400c40 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -135,18 +135,10 @@ proc gfortran-dg-debug-runtest { target_compile trivial opt_opts testcases } {
}
remove-build-file "trivial.S"
foreach level {1 "" 3} {
- if { ($type == "-gdwarf-2") && ($level != "") } {
- lappend DEBUG_TORTURE_OPTIONS [list "${type}" "-g${level}"]
- foreach opt $opt_opts {
- lappend DEBUG_TORTURE_OPTIONS \
- [list "${type}" "-g${level}" "$opt" ]
- }
- } else {
- lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
- foreach opt $opt_opts {
- lappend DEBUG_TORTURE_OPTIONS \
- [list "${type}${level}" "$opt" ]
- }
+ lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
+ foreach opt $opt_opts {
+ lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}" \
+ "$opt" ]
}
}
}
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 981236dc6da..7e346a9f55d 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -42,8 +42,7 @@ struct object_size_info
static unsigned HOST_WIDE_INT unknown[4] = { -1, -1, 0, 0 };
static tree compute_object_offset (const_tree, const_tree);
-static unsigned HOST_WIDE_INT addr_object_size (struct object_size_info *,
- const_tree, int);
+static unsigned HOST_WIDE_INT addr_object_size (const_tree, int);
static unsigned HOST_WIDE_INT alloc_object_size (const_gimple, int);
static tree pass_through_call (const_gimple);
static void collect_object_sizes_for (struct object_size_info *, tree);
@@ -152,10 +151,9 @@ compute_object_offset (const_tree expr, const_tree var)
If unknown, return unknown[object_size_type]. */
static unsigned HOST_WIDE_INT
-addr_object_size (struct object_size_info *osi, const_tree ptr,
- int object_size_type)
+addr_object_size (const_tree ptr, int object_size_type)
{
- tree pt_var, pt_var_size = NULL_TREE, var_size, bytes;
+ tree pt_var;
gcc_assert (TREE_CODE (ptr) == ADDR_EXPR);
@@ -164,182 +162,58 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
pt_var = get_base_address (pt_var);
if (pt_var
- && TREE_CODE (pt_var) == INDIRECT_REF
- && TREE_CODE (TREE_OPERAND (pt_var, 0)) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (pt_var, 0))))
+ && (SSA_VAR_P (pt_var) || TREE_CODE (pt_var) == STRING_CST)
+ && TYPE_SIZE_UNIT (TREE_TYPE (pt_var))
+ && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1)
+ && (unsigned HOST_WIDE_INT)
+ tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1) < offset_limit)
{
- unsigned HOST_WIDE_INT sz;
+ tree bytes;
- if (!osi)
- sz = compute_builtin_object_size (TREE_OPERAND (pt_var, 0),
- object_size_type);
- else
+ if (pt_var != TREE_OPERAND (ptr, 0))
{
- tree var = TREE_OPERAND (pt_var, 0);
- if (osi->pass == 0)
- collect_object_sizes_for (osi, var);
- if (bitmap_bit_p (computed[object_size_type],
- SSA_NAME_VERSION (var)))
- sz = object_sizes[object_size_type][SSA_NAME_VERSION (var)];
- else
- sz = unknown[object_size_type];
- }
-
- if (sz != unknown[object_size_type] && sz < offset_limit)
- pt_var_size = size_int (sz);
- }
- else if (pt_var
- && (SSA_VAR_P (pt_var) || TREE_CODE (pt_var) == STRING_CST)
- && TYPE_SIZE_UNIT (TREE_TYPE (pt_var))
- && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1)
- && (unsigned HOST_WIDE_INT)
- tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1)
- < offset_limit)
- pt_var_size = TYPE_SIZE_UNIT (TREE_TYPE (pt_var));
- else
- return unknown[object_size_type];
+ tree var;
- if (pt_var != TREE_OPERAND (ptr, 0))
- {
- tree var;
-
- if (object_size_type & 1)
- {
- var = TREE_OPERAND (ptr, 0);
-
- while (var != pt_var
- && TREE_CODE (var) != BIT_FIELD_REF
- && TREE_CODE (var) != COMPONENT_REF
- && TREE_CODE (var) != ARRAY_REF
- && TREE_CODE (var) != ARRAY_RANGE_REF
- && TREE_CODE (var) != REALPART_EXPR
- && TREE_CODE (var) != IMAGPART_EXPR)
- var = TREE_OPERAND (var, 0);
- if (var != pt_var && TREE_CODE (var) == ARRAY_REF)
- var = TREE_OPERAND (var, 0);
- if (! TYPE_SIZE_UNIT (TREE_TYPE (var))
- || ! host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (var)), 1)
- || (pt_var_size
- && tree_int_cst_lt (pt_var_size,
- TYPE_SIZE_UNIT (TREE_TYPE (var)))))
- var = pt_var;
- else if (var != pt_var && TREE_CODE (pt_var) == INDIRECT_REF)
+ if (object_size_type & 1)
{
- tree v = var;
- /* For &X->fld, compute object size only if fld isn't the last
- field, as struct { int i; char c[1]; } is often used instead
- of flexible array member. */
- while (v && v != pt_var)
- switch (TREE_CODE (v))
- {
- case ARRAY_REF:
- if (TYPE_SIZE_UNIT (TREE_TYPE (TREE_OPERAND (v, 0)))
- && TREE_CODE (TREE_OPERAND (v, 1)) == INTEGER_CST)
- {
- tree domain
- = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (v, 0)));
- if (domain
- && TYPE_MAX_VALUE (domain)
- && TREE_CODE (TYPE_MAX_VALUE (domain))
- == INTEGER_CST
- && tree_int_cst_lt (TREE_OPERAND (v, 1),
- TYPE_MAX_VALUE (domain)))
- {
- v = NULL_TREE;
- break;
- }
- }
- v = TREE_OPERAND (v, 0);
- break;
- case REALPART_EXPR:
- case IMAGPART_EXPR:
- v = NULL_TREE;
- break;
- case COMPONENT_REF:
- if (TREE_CODE (TREE_TYPE (v)) != ARRAY_TYPE)
- {
- v = NULL_TREE;
- break;
- }
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
- == RECORD_TYPE)
- {
- tree fld_chain = TREE_CHAIN (TREE_OPERAND (v, 1));
- for (; fld_chain; fld_chain = TREE_CHAIN (fld_chain))
- if (TREE_CODE (fld_chain) == FIELD_DECL)
- break;
-
- if (fld_chain)
- {
- v = NULL_TREE;
- break;
- }
- }
-
- if (TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
- == RECORD_TYPE)
- v = TREE_OPERAND (v, 0);
- while (v && v != pt_var && TREE_CODE (v) == COMPONENT_REF)
- if (TREE_CODE (TREE_TYPE (v)) != UNION_TYPE
- && TREE_CODE (TREE_TYPE (v)) != QUAL_UNION_TYPE)
- break;
- else
- v = TREE_OPERAND (v, 0);
- if (v && v != pt_var)
- v = NULL_TREE;
- else
- v = pt_var;
- break;
- default:
- v = pt_var;
- break;
- }
- if (v == pt_var)
+ var = TREE_OPERAND (ptr, 0);
+
+ while (var != pt_var
+ && TREE_CODE (var) != BIT_FIELD_REF
+ && TREE_CODE (var) != COMPONENT_REF
+ && TREE_CODE (var) != ARRAY_REF
+ && TREE_CODE (var) != ARRAY_RANGE_REF
+ && TREE_CODE (var) != REALPART_EXPR
+ && TREE_CODE (var) != IMAGPART_EXPR)
+ var = TREE_OPERAND (var, 0);
+ if (var != pt_var && TREE_CODE (var) == ARRAY_REF)
+ var = TREE_OPERAND (var, 0);
+ if (! TYPE_SIZE_UNIT (TREE_TYPE (var))
+ || ! host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (var)), 1)
+ || tree_int_cst_lt (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)),
+ TYPE_SIZE_UNIT (TREE_TYPE (var))))
var = pt_var;
}
- }
- else
- var = pt_var;
-
- if (var != pt_var)
- var_size = TYPE_SIZE_UNIT (TREE_TYPE (var));
- else if (!pt_var_size)
- return unknown[object_size_type];
- else
- var_size = pt_var_size;
- bytes = compute_object_offset (TREE_OPERAND (ptr, 0), var);
- if (bytes != error_mark_node)
- {
- if (TREE_CODE (bytes) == INTEGER_CST
- && tree_int_cst_lt (var_size, bytes))
- bytes = size_zero_node;
else
- bytes = size_binop (MINUS_EXPR, var_size, bytes);
- }
- if (var != pt_var
- && pt_var_size
- && TREE_CODE (pt_var) == INDIRECT_REF
- && bytes != error_mark_node)
- {
- tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0), pt_var);
- if (bytes2 != error_mark_node)
+ var = pt_var;
+
+ bytes = compute_object_offset (TREE_OPERAND (ptr, 0), var);
+ if (bytes != error_mark_node)
{
- if (TREE_CODE (bytes2) == INTEGER_CST
- && tree_int_cst_lt (pt_var_size, bytes2))
- bytes2 = size_zero_node;
+ if (TREE_CODE (bytes) == INTEGER_CST
+ && tree_int_cst_lt (TYPE_SIZE_UNIT (TREE_TYPE (var)), bytes))
+ bytes = size_zero_node;
else
- bytes2 = size_binop (MINUS_EXPR, pt_var_size, bytes2);
- bytes = size_binop (MIN_EXPR, bytes, bytes2);
+ bytes = size_binop (MINUS_EXPR,
+ TYPE_SIZE_UNIT (TREE_TYPE (var)), bytes);
}
}
- }
- else if (!pt_var_size)
- return unknown[object_size_type];
- else
- bytes = pt_var_size;
+ else
+ bytes = TYPE_SIZE_UNIT (TREE_TYPE (pt_var));
- if (host_integerp (bytes, 1))
- return tree_low_cst (bytes, 1);
+ if (host_integerp (bytes, 1))
+ return tree_low_cst (bytes, 1);
+ }
return unknown[object_size_type];
}
@@ -457,11 +331,11 @@ compute_builtin_object_size (tree ptr, int object_size_type)
init_offset_limit ();
if (TREE_CODE (ptr) == ADDR_EXPR)
- return addr_object_size (NULL, ptr, object_size_type);
+ return addr_object_size (ptr, object_size_type);
if (TREE_CODE (ptr) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (ptr))
- && object_sizes[object_size_type] != NULL)
+ && POINTER_TYPE_P (TREE_TYPE (ptr))
+ && object_sizes[object_size_type] != NULL)
{
if (!bitmap_bit_p (computed[object_size_type], SSA_NAME_VERSION (ptr)))
{
@@ -602,7 +476,7 @@ expr_object_size (struct object_size_info *osi, tree ptr, tree value)
|| !POINTER_TYPE_P (TREE_TYPE (value)));
if (TREE_CODE (value) == ADDR_EXPR)
- bytes = addr_object_size (osi, value, object_size_type);
+ bytes = addr_object_size (value, object_size_type);
else
bytes = unknown[object_size_type];
@@ -758,7 +632,7 @@ plus_stmt_object_size (struct object_size_info *osi, tree var, gimple stmt)
unsigned HOST_WIDE_INT off = tree_low_cst (op1, 1);
/* op0 will be ADDR_EXPR here. */
- bytes = addr_object_size (osi, op0, object_size_type);
+ bytes = compute_builtin_object_size (op0, object_size_type);
if (bytes == unknown[object_size_type])
;
else if (off > offset_limit)