From bd1cd0d0e0fecc6ac8632c266591767392480746 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Fri, 23 Apr 2021 19:59:00 +0000 Subject: Remove CC0 This removes CC0 and all directly related infrastructure. CC_STATUS, CC_STATUS_MDEP, CC_STATUS_MDEP_INIT, and NOTICE_UPDATE_CC are deleted and poisoned. CC0 is only deleted (some targets use that name for something else). HAVE_cc0 is automatically generated, and we no longer will do that after this patch. CC_STATUS_INIT is suggested in final.c to also be useful for ports that are not CC0, and at least arm seems to use it for something. So I am leaving that alone, but most targets that have it could remove it. 2021-05-04 Segher Boessenkool * caller-save.c: Remove CC0. * cfgcleanup.c: Remove CC0. * cfgrtl.c: Remove CC0. * combine.c: Remove CC0. * compare-elim.c: Remove CC0. * conditions.h: Remove CC0. * config/h8300/h8300.h: Remove CC0. * config/h8300/h8300-protos.h: Remove CC0. * config/h8300/peepholes.md: Remove CC0. * config/i386/x86-tune-sched.c: Remove CC0. * config/m68k/m68k.c: Remove CC0. * config/rl78/rl78.c: Remove CC0. * config/sparc/sparc.c: Remove CC0. * config/xtensa/xtensa.c: Remove CC0. (gen_conditional_move): Use pc_rtx instead of cc0_rtx in a piece of RTL where that is used as a placeholder only. * cprop.c: Remove CC0. * cse.c: Remove CC0. * cselib.c: Remove CC0. * df-problems.c: Remove CC0. * df-scan.c: Remove CC0. * doc/md.texi: Remove CC0. Adjust an example. * doc/rtl.texi: Remove CC0. Adjust an example. * doc/tm.texi: Regenerate. * doc/tm.texi.in: Remove CC0. * emit-rtl.c: Remove CC0. * final.c: Remove CC0. * fwprop.c: Remove CC0. * gcse-common.c: Remove CC0. * gcse.c: Remove CC0. * genattrtab.c: Remove CC0. * genconfig.c: Remove CC0. * genemit.c: Remove CC0. * genextract.c: Remove CC0. * gengenrtl.c: Remove CC0. * genrecog.c: Remove CC0. * haifa-sched.c: Remove CC0. * ifcvt.c: Remove CC0. * ira-costs.c: Remove CC0. * ira.c: Remove CC0. * jump.c: Remove CC0. * loop-invariant.c: Remove CC0. * lra-constraints.c: Remove CC0. * lra-eliminations.c: Remove CC0. * optabs.c: Remove CC0. * postreload-gcse.c: Remove CC0. * postreload.c: Remove CC0. * print-rtl.c: Remove CC0. * read-rtl-function.c: Remove CC0. * reg-notes.def: Remove CC0. * reg-stack.c: Remove CC0. * reginfo.c: Remove CC0. * regrename.c: Remove CC0. * reload.c: Remove CC0. * reload1.c: Remove CC0. * reorg.c: Remove CC0. * resource.c: Remove CC0. * rtl.c: Remove CC0. * rtl.def: Remove CC0. * rtl.h: Remove CC0. * rtlanal.c: Remove CC0. * sched-deps.c: Remove CC0. * sched-rgn.c: Remove CC0. * shrink-wrap.c: Remove CC0. * simplify-rtx.c: Remove CC0. * system.h: Remove CC0. Poison NOTICE_UPDATE_CC, CC_STATUS_MDEP_INIT, CC_STATUS_MDEP, and CC_STATUS. * target.def: Remove CC0. * valtrack.c: Remove CC0. * var-tracking.c: Remove CC0. --- gcc/final.c | 399 +----------------------------------------------------------- 1 file changed, 1 insertion(+), 398 deletions(-) (limited to 'gcc/final.c') diff --git a/gcc/final.c b/gcc/final.c index daae115..ba4285d 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -93,7 +93,7 @@ along with GCC; see the file COPYING3. If not see #include "dbxout.h" #endif -/* Most ports that aren't using cc0 don't need to define CC_STATUS_INIT. +/* Most ports don't need to define CC_STATUS_INIT. So define a null default for it to save conditionalization later. */ #ifndef CC_STATUS_INIT #define CC_STATUS_INIT @@ -175,17 +175,6 @@ static rtx last_ignored_compare = 0; static int insn_counter = 0; -/* This variable contains machine-dependent flags (defined in tm.h) - set and examined by output routines - that describe how to interpret the condition codes properly. */ - -CC_STATUS cc_status; - -/* During output of an insn, this contains a copy of cc_status - from before the insn. */ - -CC_STATUS cc_prev_status; - /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen. */ static int block_depth; @@ -226,9 +215,6 @@ static void output_asm_operand_names (rtx *, int *, int); #ifdef LEAF_REGISTERS static void leaf_renumber_regs (rtx_insn *); #endif -#if HAVE_cc0 -static int alter_cond (rtx); -#endif static int align_fuzz (rtx, rtx, int, unsigned); static void collect_fn_hard_reg_usage (void); @@ -1962,21 +1948,6 @@ final_1 (rtx_insn *first, FILE *file, int seen, int optimize_p) last_ignored_compare = 0; - if (HAVE_cc0) - for (insn = first; insn; insn = NEXT_INSN (insn)) - { - /* If CC tracking across branches is enabled, record the insn which - jumps to each branch only reached from one place. */ - if (optimize_p && JUMP_P (insn)) - { - rtx lab = JUMP_LABEL (insn); - if (lab && LABEL_P (lab) && LABEL_NUSES (lab) == 1) - { - LABEL_REFS (lab) = insn; - } - } - } - init_recog (); CC_STATUS_INIT; @@ -2187,9 +2158,6 @@ static rtx_insn * final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, int nopeepholes ATTRIBUTE_UNUSED, int *seen) { -#if HAVE_cc0 - rtx set; -#endif rtx_insn *next; rtx_jump_table_data *table; @@ -2562,23 +2530,6 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, || GET_CODE (body) == CLOBBER) break; -#if HAVE_cc0 - { - /* If there is a REG_CC_SETTER note on this insn, it means that - the setting of the condition code was done in the delay slot - of the insn that branched here. So recover the cc status - from the insn that set it. */ - - rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX); - if (note) - { - rtx_insn *other = as_a (XEXP (note, 0)); - NOTICE_UPDATE_CC (PATTERN (other), other); - cc_prev_status = cc_status; - } - } -#endif - /* Detect insns that are really jump-tables and output them as such. */ @@ -2798,182 +2749,6 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, body = PATTERN (insn); -#if HAVE_cc0 - set = single_set (insn); - - /* Check for redundant test and compare instructions - (when the condition codes are already set up as desired). - This is done only when optimizing; if not optimizing, - it should be possible for the user to alter a variable - with the debugger in between statements - and the next statement should reexamine the variable - to compute the condition codes. */ - - if (optimize_p) - { - if (set - && GET_CODE (SET_DEST (set)) == CC0 - && insn != last_ignored_compare) - { - rtx src1, src2; - if (GET_CODE (SET_SRC (set)) == SUBREG) - SET_SRC (set) = alter_subreg (&SET_SRC (set), true); - - src1 = SET_SRC (set); - src2 = NULL_RTX; - if (GET_CODE (SET_SRC (set)) == COMPARE) - { - if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG) - XEXP (SET_SRC (set), 0) - = alter_subreg (&XEXP (SET_SRC (set), 0), true); - if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG) - XEXP (SET_SRC (set), 1) - = alter_subreg (&XEXP (SET_SRC (set), 1), true); - if (XEXP (SET_SRC (set), 1) - == CONST0_RTX (GET_MODE (XEXP (SET_SRC (set), 0)))) - src2 = XEXP (SET_SRC (set), 0); - } - if ((cc_status.value1 != 0 - && rtx_equal_p (src1, cc_status.value1)) - || (cc_status.value2 != 0 - && rtx_equal_p (src1, cc_status.value2)) - || (src2 != 0 && cc_status.value1 != 0 - && rtx_equal_p (src2, cc_status.value1)) - || (src2 != 0 && cc_status.value2 != 0 - && rtx_equal_p (src2, cc_status.value2))) - { - /* Don't delete insn if it has an addressing side-effect. */ - if (! FIND_REG_INC_NOTE (insn, NULL_RTX) - /* or if anything in it is volatile. */ - && ! volatile_refs_p (PATTERN (insn))) - { - /* We don't really delete the insn; just ignore it. */ - last_ignored_compare = insn; - break; - } - } - } - } - - /* If this is a conditional branch, maybe modify it - if the cc's are in a nonstandard state - so that it accomplishes the same thing that it would - do straightforwardly if the cc's were set up normally. */ - - if (cc_status.flags != 0 - && JUMP_P (insn) - && GET_CODE (body) == SET - && SET_DEST (body) == pc_rtx - && GET_CODE (SET_SRC (body)) == IF_THEN_ELSE - && COMPARISON_P (XEXP (SET_SRC (body), 0)) - && XEXP (XEXP (SET_SRC (body), 0), 0) == cc0_rtx) - { - /* This function may alter the contents of its argument - and clear some of the cc_status.flags bits. - It may also return 1 meaning condition now always true - or -1 meaning condition now always false - or 2 meaning condition nontrivial but altered. */ - int result = alter_cond (XEXP (SET_SRC (body), 0)); - /* If condition now has fixed value, replace the IF_THEN_ELSE - with its then-operand or its else-operand. */ - if (result == 1) - SET_SRC (body) = XEXP (SET_SRC (body), 1); - if (result == -1) - SET_SRC (body) = XEXP (SET_SRC (body), 2); - - /* The jump is now either unconditional or a no-op. - If it has become a no-op, don't try to output it. - (It would not be recognized.) */ - if (SET_SRC (body) == pc_rtx) - { - delete_insn (insn); - break; - } - else if (ANY_RETURN_P (SET_SRC (body))) - /* Replace (set (pc) (return)) with (return). */ - PATTERN (insn) = body = SET_SRC (body); - - /* Rerecognize the instruction if it has changed. */ - if (result != 0) - INSN_CODE (insn) = -1; - } - - /* If this is a conditional trap, maybe modify it if the cc's - are in a nonstandard state so that it accomplishes the same - thing that it would do straightforwardly if the cc's were - set up normally. */ - if (cc_status.flags != 0 - && NONJUMP_INSN_P (insn) - && GET_CODE (body) == TRAP_IF - && COMPARISON_P (TRAP_CONDITION (body)) - && XEXP (TRAP_CONDITION (body), 0) == cc0_rtx) - { - /* This function may alter the contents of its argument - and clear some of the cc_status.flags bits. - It may also return 1 meaning condition now always true - or -1 meaning condition now always false - or 2 meaning condition nontrivial but altered. */ - int result = alter_cond (TRAP_CONDITION (body)); - - /* If TRAP_CONDITION has become always false, delete the - instruction. */ - if (result == -1) - { - delete_insn (insn); - break; - } - - /* If TRAP_CONDITION has become always true, replace - TRAP_CONDITION with const_true_rtx. */ - if (result == 1) - TRAP_CONDITION (body) = const_true_rtx; - - /* Rerecognize the instruction if it has changed. */ - if (result != 0) - INSN_CODE (insn) = -1; - } - - /* Make same adjustments to instructions that examine the - condition codes without jumping and instructions that - handle conditional moves (if this machine has either one). */ - - if (cc_status.flags != 0 - && set != 0) - { - rtx cond_rtx, then_rtx, else_rtx; - - if (!JUMP_P (insn) - && GET_CODE (SET_SRC (set)) == IF_THEN_ELSE) - { - cond_rtx = XEXP (SET_SRC (set), 0); - then_rtx = XEXP (SET_SRC (set), 1); - else_rtx = XEXP (SET_SRC (set), 2); - } - else - { - cond_rtx = SET_SRC (set); - then_rtx = const_true_rtx; - else_rtx = const0_rtx; - } - - if (COMPARISON_P (cond_rtx) - && XEXP (cond_rtx, 0) == cc0_rtx) - { - int result; - result = alter_cond (cond_rtx); - if (result == 1) - validate_change (insn, &SET_SRC (set), then_rtx, 0); - else if (result == -1) - validate_change (insn, &SET_SRC (set), else_rtx, 0); - else if (result == 2) - INSN_CODE (insn) = -1; - if (SET_DEST (set) == SET_SRC (set)) - delete_insn (insn); - } - } - -#endif - /* Do machine-specific peephole optimizations if desired. */ if (HAVE_peephole && optimize_p && !flag_no_peephole && !nopeepholes) @@ -3041,17 +2816,6 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, && GET_CODE (PATTERN (insn)) == COND_EXEC) current_insn_predicate = COND_EXEC_TEST (PATTERN (insn)); -#if HAVE_cc0 - cc_prev_status = cc_status; - - /* Update `cc_status' for this instruction. - The instruction's output routine may change it further. - If the output routine for a jump insn needs to depend - on the cc status, it should look at cc_prev_status. */ - - NOTICE_UPDATE_CC (body, insn); -#endif - current_output_insn = debug_insn = insn; /* Find the proper template for this insn. */ @@ -3443,167 +3207,6 @@ walk_alter_subreg (rtx *xp, bool *changed) return *xp; } -#if HAVE_cc0 - -/* Given BODY, the body of a jump instruction, alter the jump condition - as required by the bits that are set in cc_status.flags. - Not all of the bits there can be handled at this level in all cases. - - The value is normally 0. - 1 means that the condition has become always true. - -1 means that the condition has become always false. - 2 means that COND has been altered. */ - -static int -alter_cond (rtx cond) -{ - int value = 0; - - if (cc_status.flags & CC_REVERSED) - { - value = 2; - PUT_CODE (cond, swap_condition (GET_CODE (cond))); - } - - if (cc_status.flags & CC_INVERTED) - { - value = 2; - PUT_CODE (cond, reverse_condition (GET_CODE (cond))); - } - - if (cc_status.flags & CC_NOT_POSITIVE) - switch (GET_CODE (cond)) - { - case LE: - case LEU: - case GEU: - /* Jump becomes unconditional. */ - return 1; - - case GT: - case GTU: - case LTU: - /* Jump becomes no-op. */ - return -1; - - case GE: - PUT_CODE (cond, EQ); - value = 2; - break; - - case LT: - PUT_CODE (cond, NE); - value = 2; - break; - - default: - break; - } - - if (cc_status.flags & CC_NOT_NEGATIVE) - switch (GET_CODE (cond)) - { - case GE: - case GEU: - /* Jump becomes unconditional. */ - return 1; - - case LT: - case LTU: - /* Jump becomes no-op. */ - return -1; - - case LE: - case LEU: - PUT_CODE (cond, EQ); - value = 2; - break; - - case GT: - case GTU: - PUT_CODE (cond, NE); - value = 2; - break; - - default: - break; - } - - if (cc_status.flags & CC_NO_OVERFLOW) - switch (GET_CODE (cond)) - { - case GEU: - /* Jump becomes unconditional. */ - return 1; - - case LEU: - PUT_CODE (cond, EQ); - value = 2; - break; - - case GTU: - PUT_CODE (cond, NE); - value = 2; - break; - - case LTU: - /* Jump becomes no-op. */ - return -1; - - default: - break; - } - - if (cc_status.flags & (CC_Z_IN_NOT_N | CC_Z_IN_N)) - switch (GET_CODE (cond)) - { - default: - gcc_unreachable (); - - case NE: - PUT_CODE (cond, cc_status.flags & CC_Z_IN_N ? GE : LT); - value = 2; - break; - - case EQ: - PUT_CODE (cond, cc_status.flags & CC_Z_IN_N ? LT : GE); - value = 2; - break; - } - - if (cc_status.flags & CC_NOT_SIGNED) - /* The flags are valid if signed condition operators are converted - to unsigned. */ - switch (GET_CODE (cond)) - { - case LE: - PUT_CODE (cond, LEU); - value = 2; - break; - - case LT: - PUT_CODE (cond, LTU); - value = 2; - break; - - case GT: - PUT_CODE (cond, GTU); - value = 2; - break; - - case GE: - PUT_CODE (cond, GEU); - value = 2; - break; - - default: - break; - } - - return value; -} -#endif - /* Report inconsistency between the assembler template and the operands. In an `asm', it's the user's fault; otherwise, the compiler's fault. */ -- cgit v1.1 From e69ac0203725fb8da83a1cc88d32191b7a0b2c0c Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Tue, 12 Jan 2021 16:27:53 +0100 Subject: Add line debug info for virtual thunks There is no debug info when the DECL_IGNORED_P flag is set. But sometimes we have the line info of the function decl, as in the case of on virtual thunks. So instead of no line info at all, we emit at least the location of the function decl. On the other side, there are DECL_IGNORED_P functions which do not have any source line info at all. Remove those from the debug_range info, to make it clear for the debugger that the line info for these functions is invalid. This has the effect that the debugger will not step into the function without debug info. 2021-05-06 Bernd Edlinger PR ipa/97937 * debug.h (gcc_debug_hooks): Add set_ignored_loc function pointer. * dwarf2out.h (dw_fde_node::ignored_debug): New data item. * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Add dummy set_ignored_loc callbacks. * debug.c (do_nothing_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * dwarf2out.c (text_section_used, cold_text_section_used): Remove. (in_text_section_p, last_text_label, last_cold_label, switch_text_ranges, switch_cold_ranges): New data items. (dwarf2out_note_section_used): Remove. (dwarf2out_begin_prologue): Set fde->ignored_debug and in_text_section_p. (mark_ignored_debug_section): New helper function. (dwarf2out_end_epilogue, dwarf2out_switch_text_section): Call mark_ignored_debug_section. (dwarf2_debug_hooks): Use dwarf2out_set_ignored_loc. (dwarf2_lineno_debug_hooks): Use dummy for set_ignored_loc. (size_of_aranges): Adjust formula for multi-part text ranges size. (output_aranges): Output multi-part text ranges. (dwarf2out_set_ignored_loc): New callback function. (dwarf2out_finish): Output multi-part text ranges. (dwarf2out_c_finalize): Clear new data items. * final.c (final_start_function_1): Call set_ignored_loc callback. (final_scan_insn_1): Likewise. * ggc-page.c (gt_ggc_mx): New helper function. * stringpool.c (gt_pch_nx): Likewise. --- gcc/final.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/final.c') diff --git a/gcc/final.c b/gcc/final.c index ba4285d..e0a70fc 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1724,6 +1724,9 @@ final_start_function_1 (rtx_insn **firstp, FILE *file, int *seen, if (!dwarf2_debug_info_emitted_p (current_function_decl)) dwarf2out_begin_prologue (0, 0, NULL); + if (DECL_IGNORED_P (current_function_decl) && last_linenum && last_filename) + debug_hooks->set_ignored_loc (last_linenum, last_columnnum, last_filename); + #ifdef LEAF_REG_REMAP if (crtl->uses_only_leaf_regs) leaf_renumber_regs (first); @@ -2187,6 +2190,7 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, in_cold_section_p = !in_cold_section_p; + gcc_checking_assert (in_cold_section_p); if (in_cold_section_p) cold_function_name = clone_function_name (current_function_decl, "cold"); @@ -2200,6 +2204,10 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, } else if (!DECL_IGNORED_P (current_function_decl)) debug_hooks->switch_text_section (); + if (DECL_IGNORED_P (current_function_decl) && last_linenum + && last_filename) + debug_hooks->set_ignored_loc (last_linenum, last_columnnum, + last_filename); switch_to_section (current_function_section ()); targetm.asm_out.function_switched_text_sections (asm_out_file, -- cgit v1.1 From 66168f96f07b12bbe0beb6e0e988818f624d56bd Mon Sep 17 00:00:00 2001 From: Indu Bhagat Date: Fri, 30 Apr 2021 08:03:52 -0700 Subject: dwarf: new dwarf_debuginfo_p predicate This patch introduces a dwarf_debuginfo_p predicate that abstracts and replaces complex checks on write_symbols. gcc/c-family/ChangeLog: * c-lex.c (init_c_lex): Use dwarf_debuginfo_p. gcc/ChangeLog: * config/c6x/c6x.c (c6x_output_file_unwind): Use dwarf_debuginfo_p. * config/darwin.c (darwin_override_options): Likewise. * config/i386/cygming.h (DBX_REGISTER_NUMBER): Likewise. * config/i386/darwin.h (DBX_REGISTER_NUMBER): Likewise. (DWARF2_FRAME_REG_OUT): Likewise. * config/mips/mips.c (mips_output_filename): Likewise. * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): Likewise. (rs6000_dbx_register_number): Likewise. * dbxout.c: Include flags.h. * dwarf2cfi.c (cfi_label_required_p): Likewise. (dwarf2out_do_frame): Likewise. * except.c: Include flags.h. * final.c (dwarf2_debug_info_emitted_p): Likewise. (final_scan_insn_1): Likewise. * flags.h (dwarf_debuginfo_p): New function declaration. * opts.c (dwarf_debuginfo_p): New function definition. * targhooks.c (default_debug_unwind_info): Use dwarf_debuginfo_p. * toplev.c (process_options): Likewise. --- gcc/final.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'gcc/final.c') diff --git a/gcc/final.c b/gcc/final.c index e0a70fc..38c3d70 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1428,7 +1428,8 @@ asm_str_count (const char *templ) static bool dwarf2_debug_info_emitted_p (tree decl) { - if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG) + /* When DWARF2 debug info is not generated internally. */ + if (!dwarf_debuginfo_p ()) return false; if (DECL_IGNORED_P (decl)) @@ -2306,10 +2307,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, break; case NOTE_INSN_BLOCK_BEG: - if (debug_info_level == DINFO_LEVEL_NORMAL - || debug_info_level == DINFO_LEVEL_VERBOSE - || write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG + if (debug_info_level >= DINFO_LEVEL_NORMAL + || dwarf_debuginfo_p () || write_symbols == VMS_DEBUG) { int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); @@ -2344,10 +2343,8 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, case NOTE_INSN_BLOCK_END: maybe_output_next_view (seen); - if (debug_info_level == DINFO_LEVEL_NORMAL - || debug_info_level == DINFO_LEVEL_VERBOSE - || write_symbols == DWARF2_DEBUG - || write_symbols == VMS_AND_DWARF2_DEBUG + if (debug_info_level >= DINFO_LEVEL_NORMAL + || dwarf_debuginfo_p () || write_symbols == VMS_DEBUG) { int n = BLOCK_NUMBER (NOTE_BLOCK (insn)); -- cgit v1.1 From 16465ceb06cc1f65cfca3c0eb2c1ee27ab03bdfd Mon Sep 17 00:00:00 2001 From: liuhongt Date: Tue, 1 Jun 2021 09:00:57 +0800 Subject: CALL_INSN may not be a real function call. Use "used" flag for CALL_INSN to indicate it's a fake call. If it's a fake call, it won't have its own function stack. gcc/ChangeLog PR target/82735 * df-scan.c (df_get_call_refs): When call_insn is a fake call, it won't use stack pointer reg. * final.c (leaf_function_p): When call_insn is a fake call, it won't affect caller as a leaf function. * reg-stack.c (callee_clobbers_any_stack_reg): New. (subst_stack_regs): When call_insn doesn't clobber any stack reg, don't clear the arguments. * rtl.c (shallow_copy_rtx): Don't clear flag used when orig is a insn. * shrink-wrap.c (requires_stack_frame_p): No need for stack frame for a fake call. * rtl.h (FAKE_CALL_P): New macro. --- gcc/final.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/final.c') diff --git a/gcc/final.c b/gcc/final.c index 38c3d70..dba0b0a 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4106,7 +4106,8 @@ leaf_function_p (void) for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) { if (CALL_P (insn) - && ! SIBLING_CALL_P (insn)) + && ! SIBLING_CALL_P (insn) + && ! FAKE_CALL_P (insn)) return 0; if (NONJUMP_INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE -- cgit v1.1 From b7e215a8ee81d44281d9e0a2a25eceb47b6911dd Mon Sep 17 00:00:00 2001 From: Indu Bhagat Date: Thu, 20 May 2021 11:15:52 -0700 Subject: CTF/BTF debug formats This commit introduces support for generating CTF debugging information and BTF debugging information from GCC. 2021-06-28 Indu Bhagat David Faust Jose E. Marchesi Weimin Pan gcc/ * Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to GTFILES. Add new object files. * common.opt: Add CTF and BTF debug info options. * btfout.c: New file. * ctfc.c: Likewise. * ctfc.h: Likewise. * ctfout.c: Likewise. * dwarf2ctf.c: Likewise. * dwarf2ctf.h: Likewise. * dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and BTF_DEBUG. * dwarf2out.c (dwarf2out_source_line): Likewise. (dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to be generated. (debug_format_do_cu): New function. (dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for them if requested. Include dwarf2ctf.c. * final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug formats. * flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG. (CTF_DEBUG): New bitmask. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): New enum. * gengtype.c (open_base_files): Handle ctfc.h. (main): Handle uint32_t type. * flags.h (btf_debuginfo_p): New definition. (dwarf_based_debuginfo_p): Likewise. * opts.c (debug_type_names): Add entries for CTF and BTF. (btf_debuginfo_p): New function. (dwarf_based_debuginfo_p): Likewise. (common_handle_option): Handle -gctfN and -gbtf options. (set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate. * toplev.c (process_options): Inform the user and ignore -gctfLEVEL if frontend is not C. include/ * ctf.h: New file. * btf.h: Likewise. libiberty/ * simple-object.c (handle_lto_debug_sections): Copy over .ctf sections. --- gcc/final.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/final.c') diff --git a/gcc/final.c b/gcc/final.c index dba0b0a..ac6892d 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1429,7 +1429,7 @@ static bool dwarf2_debug_info_emitted_p (tree decl) { /* When DWARF2 debug info is not generated internally. */ - if (!dwarf_debuginfo_p ()) + if (!dwarf_debuginfo_p () && !dwarf_based_debuginfo_p ()) return false; if (DECL_IGNORED_P (decl)) -- cgit v1.1