public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/casm-state-v3)] Use lto_debug_asm. Date: Tue, 14 Sep 2021 12:36:04 +0000 (GMT) [thread overview] Message-ID: <20210914123604.8C9283858031@sourceware.org> (raw) https://gcc.gnu.org/g:96c091ccb471d4faf61374b83046e4696de12a0e commit 96c091ccb471d4faf61374b83046e4696de12a0e Author: Martin Liska <mliska@suse.cz> 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> ()) asm_out_state (); + lto_debug_asm = new (ggc_alloc<asm_out_state> ()) 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<asm_out_state *> 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"
reply other threads:[~2021-09-14 12:36 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210914123604.8C9283858031@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).