public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/casm-state-v3)] Step #3.
@ 2021-09-14 12:35 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-09-14 12:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:861451ad297b47a9ef40dd78f8f9bacaf43029a7
commit 861451ad297b47a9ef40dd78f8f9bacaf43029a7
Author: Martin Liska <mliska@suse.cz>
Date: Tue Sep 7 14:04:33 2021 +0200
Step #3.
Diff:
---
gcc/cgraphunit.c | 2 +-
gcc/config/i386/i386.c | 4 ++--
gcc/dbxout.c | 6 +++---
gcc/dwarf2out.c | 18 +++++++++---------
gcc/except.c | 2 +-
gcc/final.c | 10 +++++-----
gcc/langhooks.c | 2 +-
gcc/output.h | 10 +++++++---
gcc/run-rtl-passes.c | 2 +-
gcc/varasm.c | 24 +++++++++++-------------
10 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 55cb0347149..5bac9beb934 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2309,7 +2309,7 @@ symbol_table::compile (void)
timevar_pop (TV_CGRAPHOPT);
/* Output everything. */
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
(*debug_hooks->assembly_start) ();
if (!quiet_flag)
fprintf (stderr, "Assembling functions:\n");
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3b2dcb47b05..2fbc43e9e48 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5954,7 +5954,7 @@ output_indirect_thunk_function (enum indirect_thunk_prefix need_prefix,
}
else
{
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
ASM_OUTPUT_LABEL (asm_out_file, name);
}
@@ -6074,7 +6074,7 @@ ix86_code_end (void)
}
else
{
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
ASM_OUTPUT_LABEL (asm_out_file, name);
}
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index d41ce0a968f..2a77c0bcee9 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -1042,7 +1042,7 @@ dbxout_init (const char *input_file_name)
if (used_ltext_label_name)
{
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
targetm.asm_out.internal_label (asm_out_file, "Ltext", 0);
}
@@ -1244,7 +1244,7 @@ dbxout_source_file (const char *filename)
{
/* Don't change section amid function. */
if (current_function_decl == NULL_TREE)
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
dbxout_begin_simple_stabs (remap_debug_filename (filename), N_SOL);
dbxout_stab_value_internal_label ("Ltext", &source_label_number);
@@ -1432,7 +1432,7 @@ dbxout_finish (const char *filename ATTRIBUTE_UNUSED)
DBX_OUTPUT_MAIN_SOURCE_FILE_END (asm_out_file, filename);
#elif defined DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
{
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
dbxout_begin_empty_stabs (N_SO);
dbxout_stab_value_internal_label ("Letext", 0);
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 44d53e11ffd..b975658c0e8 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1113,10 +1113,10 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
/* Initialize the bits of CURRENT_FDE that were not available earlier. */
fde->dw_fde_begin = dup_label;
fde->dw_fde_current_label = dup_label;
- fde->in_std_section = (fnsec == text_section
+ fde->in_std_section = (fnsec == casm->sections.text
|| (cold_text_section && fnsec == cold_text_section));
fde->ignored_debug = DECL_IGNORED_P (current_function_decl);
- in_text_section_p = fnsec == text_section;
+ in_text_section_p = fnsec == casm->sections.text;
/* We only want to output line number information for the genuine dwarf2
prologue case, not the eh frame case. */
@@ -1317,9 +1317,9 @@ dwarf2out_switch_text_section (void)
switch_to_section (sect);
fde->second_in_std_section
- = (sect == text_section
+ = (sect == casm->sections.text
|| (cold_text_section && sect == cold_text_section));
- in_text_section_p = sect == text_section;
+ in_text_section_p = sect == casm->sections.text;
if (dwarf2out_do_cfi_asm ())
dwarf2out_do_cfi_startproc (true);
@@ -28190,7 +28190,7 @@ set_cur_line_info_table (section *sec)
{
dw_line_info_table *table;
- if (sec == text_section)
+ if (sec == casm->sections.text)
table = text_section_line_info;
else if (sec == cold_text_section)
{
@@ -28244,7 +28244,7 @@ dwarf2out_begin_function (tree fun)
{
section *sec = function_section (fun);
- if (sec != text_section)
+ if (sec != casm->sections.text)
have_multiple_function_sections = true;
if (crtl->has_bb_partition && !cold_text_section)
@@ -29373,7 +29373,7 @@ dwarf2out_assembly_start (void)
COLD_TEXT_SECTION_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (cold_end_label, COLD_END_LABEL, 0);
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
#endif
@@ -32080,7 +32080,7 @@ dwarf2out_finish (const char *filename)
main_comp_unit_die = comp_unit_die ();
/* Output a terminator label for the .text section. */
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
targetm.asm_out.internal_label (asm_out_file, TEXT_END_LABEL, 0);
if (cold_text_section)
{
@@ -32996,7 +32996,7 @@ dwarf2out_early_finish (const char *filename)
}
/* Switch back to the text section. */
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
}
/* Reset all state within dwarf2out.c so that we can rerun the compiler
diff --git a/gcc/except.c b/gcc/except.c
index 8e905a30939..cd228845cc4 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2948,7 +2948,7 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname))
}
else
exception_section
- = s = flags == SECTION_WRITE ? data_section : readonly_data_section;
+ = s = flags == SECTION_WRITE ? casm->sections.data: readonly_data_section;
}
switch_to_section (s);
diff --git a/gcc/final.c b/gcc/final.c
index 481e1ef6835..797b1a0ec86 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -885,7 +885,7 @@ shorten_branches (rtx_insn *first)
/* ADDR_VECs only take room if read-only data goes into the text
section. */
if ((JUMP_TABLES_IN_TEXT_SECTION
- || readonly_data_section == text_section)
+ || readonly_data_section == casm->sections.text)
&& table)
{
align_flags alignment = align_flags (ADDR_VEC_ALIGN (table));
@@ -1051,7 +1051,7 @@ shorten_branches (rtx_insn *first)
/* This only takes room if read-only data goes into the text
section. */
if (JUMP_TABLES_IN_TEXT_SECTION
- || readonly_data_section == text_section)
+ || readonly_data_section == casm->sections.text)
insn_lengths[uid] = (XVECLEN (body,
GET_CODE (body) == ADDR_DIFF_VEC)
* GET_MODE_SIZE (table->get_data_mode ()));
@@ -1143,7 +1143,7 @@ shorten_branches (rtx_insn *first)
may need to update the alignment of this label. */
if (JUMP_TABLES_IN_TEXT_SECTION
- || readonly_data_section == text_section)
+ || readonly_data_section == casm->sections.text)
{
rtx_jump_table_data *table = jump_table_for_label (label);
if (table)
@@ -1284,7 +1284,7 @@ shorten_branches (rtx_insn *first)
>= GET_MODE_SIZE (table->get_data_mode ())))
PUT_MODE (body, vec_mode);
if (JUMP_TABLES_IN_TEXT_SECTION
- || readonly_data_section == text_section)
+ || readonly_data_section == casm->sections.text)
{
insn_lengths[uid]
= (XVECLEN (body, 1)
@@ -1836,7 +1836,7 @@ profile_function (FILE *file ATTRIBUTE_UNUSED)
if (! NO_PROFILE_COUNTERS)
{
int align = MIN (BIGGEST_ALIGNMENT, LONG_TYPE_SIZE);
- switch_to_section (data_section);
+ switch_to_section (casm->sections.data);
ASM_OUTPUT_ALIGN (file, floor_log2 (align / BITS_PER_UNIT));
targetm.asm_out.internal_label (file, "LP", current_function_funcdef_no);
assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 9a19652a953..a25a4f84eba 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -805,7 +805,7 @@ lhd_begin_section (const char *name)
gcc_assert (!saved_section);
saved_section = casm->in_section;
if (!saved_section)
- saved_section = text_section;
+ saved_section = casm->sections.text;
/* Create a new section and switch to it. */
section = get_section (name, SECTION_DEBUG | SECTION_EXCLUDE, NULL, true);
diff --git a/gcc/output.h b/gcc/output.h
index e8e2a823a0d..3c7cb4c904c 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -324,7 +324,7 @@ struct section_hasher : ggc_ptr_hash<section>
struct GTY(()) asm_out_state
{
asm_out_state (): out_file (NULL), in_section (NULL),
- in_cold_section_p (false)
+ sections ({}), in_cold_section_p (false)
{
section_htab = hash_table<section_hasher>::create_ggc (31);
}
@@ -339,6 +339,12 @@ struct GTY(()) asm_out_state
been selected or if we lose track of what the current section is. */
section *in_section;
+ struct
+ {
+ section *text;
+ section *data;
+ } sections;
+
/* True if code for the current function is currently being directed
at the cold section. */
bool in_cold_section_p;
@@ -543,8 +549,6 @@ union GTY ((desc ("SECTION_STYLE (&(%h))"), for_user)) section {
struct object_block;
/* Special well-known sections. */
-extern GTY(()) section *text_section;
-extern GTY(()) section *data_section;
extern GTY(()) section *readonly_data_section;
extern GTY(()) section *sdata_section;
extern GTY(()) section *ctors_section;
diff --git a/gcc/run-rtl-passes.c b/gcc/run-rtl-passes.c
index 37a02813f22..e49b75bf7f9 100644
--- a/gcc/run-rtl-passes.c
+++ b/gcc/run-rtl-passes.c
@@ -46,7 +46,7 @@ run_rtl_passes (char *initial_pass_name)
max_regno = max_reg_num ();
/* cgraphunit.c normally handles this. */
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
(*debug_hooks->assembly_start) ();
if (initial_pass_name)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index a5e550d81ea..ad9578f3638 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -131,8 +131,6 @@ static void output_constant_pool (const char *, tree);
static void handle_vtv_comdat_section (section *, const_tree);
\f
/* Well-known sections, each one associated with some sort of *_ASM_OP. */
-section *text_section;
-section *data_section;
section *readonly_data_section;
section *sdata_section;
section *ctors_section;
@@ -508,7 +506,7 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
#endif /* BSS_SECTION_ASM_OP */
#ifndef USE_SELECT_SECTION_FOR_FUNCTIONS
-/* Return the hot section for function DECL. Return text_section for
+/* Return the hot section for function DECL. Return casm->sections.text for
null DECLs. */
static section *
@@ -519,7 +517,7 @@ hot_function_section (tree decl)
&& targetm_common.have_named_sections)
return get_named_section (decl, NULL, 0);
else
- return text_section;
+ return casm->sections.text;
}
#endif
@@ -1881,7 +1879,7 @@ assemble_start_function (tree decl, const char *fnname)
if (!cfun->is_thunk
&& BB_PARTITION (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) == BB_COLD_PARTITION)
{
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
assemble_align (align);
ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.hot_section_label);
hot_label_written = true;
@@ -2011,7 +2009,7 @@ assemble_end_function (tree decl, const char *fnname ATTRIBUTE_UNUSED)
#endif
ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.cold_section_end_label);
if (first_function_block_is_cold)
- switch_to_section (text_section);
+ switch_to_section (casm->sections.text);
else
switch_to_section (function_section (decl));
ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.hot_section_end_label);
@@ -6583,13 +6581,13 @@ init_varasm_once (void)
shared_constant_pool = create_constant_pool ();
#ifdef TEXT_SECTION_ASM_OP
- text_section = get_unnamed_section (SECTION_CODE, output_section_asm_op,
+ casm->sections.text = get_unnamed_section (SECTION_CODE, output_section_asm_op,
TEXT_SECTION_ASM_OP);
#endif
#ifdef DATA_SECTION_ASM_OP
- data_section = get_unnamed_section (SECTION_WRITE, output_section_asm_op,
- DATA_SECTION_ASM_OP);
+ casm->sections.data = get_unnamed_section (SECTION_WRITE, output_section_asm_op,
+ DATA_SECTION_ASM_OP);
#endif
#ifdef SDATA_SECTION_ASM_OP
@@ -6639,7 +6637,7 @@ init_varasm_once (void)
targetm.asm_out.init_sections ();
if (readonly_data_section == NULL)
- readonly_data_section = text_section;
+ readonly_data_section = casm->sections.text;
#ifdef ASM_OUTPUT_EXTERNAL
pending_assemble_externals_set = new hash_set<tree>;
@@ -6947,7 +6945,7 @@ default_select_section (tree decl, int reloc,
else if (! (flag_pic && reloc))
return readonly_data_section;
- return data_section;
+ return casm->sections.data;
}
enum section_category
@@ -7102,7 +7100,7 @@ default_elf_select_section (tree decl, int reloc,
sname = ".persistent";
break;
}
- return data_section;
+ return casm->sections.data;
case SECCAT_DATA_REL:
sname = ".data.rel";
break;
@@ -7278,7 +7276,7 @@ default_select_rtx_section (machine_mode mode ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
{
if (compute_reloc_for_rtx (x) & targetm.asm_out.reloc_rw_mask ())
- return data_section;
+ return casm->sections.data;
else
return readonly_data_section;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-14 12:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 12:35 [gcc(refs/users/marxin/heads/casm-state-v3)] Step #3 Martin Liska
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).