This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Change function_section to allow partitioning w/o insn stream scanning
- From: Caroline Tice <ctice at apple dot com>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: Caroline Tice <ctice at apple dot com>
- Date: Tue, 31 Aug 2004 16:33:59 -0700
- Subject: [PATCH]: Change function_section to allow partitioning w/o insn stream scanning
As part of my work fixing the hot/cold partitioning optimization, I
need to change the function
"function_section" in varasm.c. The problem I'm trying to solve is
that "function_section" is really used
for two different pieces of functionality: 1. Change to the same text
section as should be used for the first basic block/code in the current
function; and 2. Change to the most recent text section. As long as
we're not doing hot/cold partitioning those two are the same, so it's
not a problem. When we do hot/cold partitioning sometimes the first
case should be the hot text section and the second case should be the
cold text section.
This patch addresses that problem by splitting function_section into
two functions: "function_section" will change to the same text section
as should be used for the first basic block/code in the current
function; and "current_function_section" will change to the most
recent text section (within the current function). I have
also examined all the original calls to function_section to identify
which ones should really call
current_function_section, and have changed them to do so (except for
the calls in dwarf2out.c; I will fix those when I fix the dwarf
debugging stuff to work with hot/cold partitioning).
This patch is a necessary step towards removing the instruction stream
searching that hot/cold
partitioning does.
I have tested this patch by doing a profiled bootstrap on both a G4
running apple powerpc darwin, and an x86 box running Linux. I have
also run DejaGnu tests on both platforms (with no regressions).
Is this okay to commit to FSF mainline?
-- Caroline Tice
ctice@apple.com
2004-08-31 Caroline Tice <ctice@apple.com>
* cfgrtl.c (rtl_verify_flow_info_1): Add EDGE_CROSSING flag to
test case.
* dbxout.c (FORCE_TEXT): Change call to function_section into
call to
current_function_section.
* except.c (output_function_exception_table): Likewise.
* final.c (profile_function): Likewise.
(final_scan_insn): Likewise (multiple times).
* output.h (current_function_section): Add new function
declaration.
* varasm.c (last_text_section): New global variable.
(last_text_section_name): New global variable.
(text_section): Add code to set last_text_section.
(initialize_cold_section_name): New function.
(unlikely_text_section): Change to call
initialize_cold_section_name;
add code to set last_text_section.
(named_section): Set last_text_section and
last_text_section_name, if
appropriate.
(function_section): Remove code that scanned ahead to determine
which
section to use; revert to using section from function decl.
(current_function_section): New function.
(assemble_start_function): Add call to
initialize_cold_section_name;
set function decl section to cold section if appropriate.
* config/s390/s390.c (s390_select_rtx_section): Change call to
function_section into call to current_function_section.
* config/sparc/sparc.c (sparc_output_deferred_case_vectors):
Likewise.
* config/stormy16/stormy16.c (xstormy16_output_addr_vec):
Likewise.
* config/xtensa/xtensa.c (override_options): Turn off hot/cold
partitioning for this architecture.
Attachment:
gcc5-hot-cold2.txt
Description: Text document