From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 8C9283858031; Tue, 14 Sep 2021 12:36:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C9283858031 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/casm-state-v3)] Use lto_debug_asm. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/casm-state-v3 X-Git-Oldrev: 29088d7d13828d3a9a3c52bd8c43a9757bf613a3 X-Git-Newrev: 96c091ccb471d4faf61374b83046e4696de12a0e Message-Id: <20210914123604.8C9283858031@sourceware.org> Date: Tue, 14 Sep 2021 12:36:04 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 12:36:04 -0000 https://gcc.gnu.org/g:96c091ccb471d4faf61374b83046e4696de12a0e commit 96c091ccb471d4faf61374b83046e4696de12a0e Author: Martin Liska Date: Thu Sep 9 14:52:11 2021 +0200 Use lto_debug_asm. Diff: --- gcc/dwarf2out.c | 6 ++++++ gcc/output.h | 5 +++++ gcc/toplev.c | 5 ++++- gcc/varasm.c | 20 ++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index cdfdee3cd9a..1d0b09bdaa5 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -32872,6 +32872,10 @@ dwarf2out_early_finish (const char *filename) || TARGET_PECOFF || TARGET_COFF) return; + /* Initialize an early LTO debug output file. */ + lto_debug_asm->out_file = fopen ("/tmp/lto-debug.s", "w"); + push_asm (lto_debug_asm); + /* Now as we are going to output for LTO initialize sections and labels to the LTO variants. We don't need a random-seed postfix as other LTO sections as linking the LTO debug sections into one in a partial @@ -32995,6 +32999,8 @@ dwarf2out_early_finish (const char *filename) output_indirect_string> (form); } + pop_asm (); + /* Switch back to the text section. */ switch_to_section (casm->sections.text); } diff --git a/gcc/output.h b/gcc/output.h index 3fdc559fec5..d2b7ffb8db5 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -383,6 +383,11 @@ struct GTY(()) asm_out_state extern GTY(()) asm_out_state *casm; +extern GTY(()) asm_out_state *lto_debug_asm; + +extern void push_asm (asm_out_state *asm_state); +extern void pop_asm (void); + /* Helper macro for commonly used accesses. */ #define asm_out_file casm->out_file diff --git a/gcc/toplev.c b/gcc/toplev.c index fcc7b39f624..c0b5b86c42a 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -171,9 +171,11 @@ const char *user_label_prefix; /* Output files for assembler code (real compiler output) and debugging dumps. */ - asm_out_state *casm; +/* Early LTO debug info output. */ +asm_out_state *lto_debug_asm; + FILE *aux_info_file; FILE *callgraph_info_file = NULL; static bitmap callgraph_info_external_printed; @@ -1115,6 +1117,7 @@ general_init (const char *argv0, bool init_signals) /* Initialize ASM out state. */ casm = new (ggc_alloc ()) asm_out_state (); + lto_debug_asm = new (ggc_alloc ()) asm_out_state (); statistics_early_init (); debuginfo_early_init (); diff --git a/gcc/varasm.c b/gcc/varasm.c index 61064df9dc8..a79b4edd8ca 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -8450,4 +8450,24 @@ handle_vtv_comdat_section (section *sect, const_tree decl ATTRIBUTE_UNUSED) #endif } +/* Stack of assembly output states. */ +static vec casm_stack; + +/* Push ASM_STATE as a current casm. */ + +void +push_asm (asm_out_state *asm_state) +{ + casm_stack.safe_push (casm); + casm = asm_state; +} + +/* Return to previous casm state. */ + +void +pop_asm () +{ + casm = casm_stack.pop (); +} + #include "gt-varasm.h"