summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard@codesourcery.com>2005-12-15 12:40:33 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2005-12-15 12:40:33 +0000
commitc543ca49c257b3e7fcb123014395cfc7d298d28c (patch)
treef594f73f80f290828e87bb828d14e3f19d1ad80e /gcc/final.c
parent8d46ce6095853cebc4ea306fe0d00a4aa9758610 (diff)
downloadgcc-c543ca49c257b3e7fcb123014395cfc7d298d28c.tar.gz
final.c (final_scan_insn): Flip in_cold_section_p when changing between the hot and cold sections.
* final.c (final_scan_insn): Flip in_cold_section_p when changing between the hot and cold sections. Use current_function_section to get the new section. * dwarf2out.c (output_line_info): Use in_cold_section_p to determine whether we are assembling hot or cold code. (secname_for_decl, dwarf2out_var_location): Likewise. (dwarf2out_init, dwarf2out_finish): Use switch_to_section. * varasm.c (last_text_section): Delete. (in_cold_section_p): New variable. (hot_function_section): New function. (current_function_section): Pass in_cold_section_p as the reloc argument to select_section. Use it to decide between unlikely_function_section and hot_function_section. (assemble_start_function): Use switch_to_section. Set in_cold_section_p instead of last_text_section. (assemble_end_function): Use switch_to_section. (switch_to_section): Don't set last_text_section. * config/darwin/darwin.c (machopic_select_section): Trust the reloc argument to make the right choice between hot and cold sections. From-SVN: r108572
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 7ccc8f5debe..2b13fb907b9 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1708,22 +1708,9 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
break;
case NOTE_INSN_SWITCH_TEXT_SECTIONS:
-
- /* The presence of this note indicates that this basic block
- belongs in the "cold" section of the .o file. If we are
- not already writing to the cold section we need to change
- to it. */
-
- if (last_text_section == text_section)
- {
- (*debug_hooks->switch_text_section) ();
- switch_to_section (unlikely_text_section ());
- }
- else
- {
- (*debug_hooks->switch_text_section) ();
- switch_to_section (text_section);
- }
+ in_cold_section_p = !in_cold_section_p;
+ (*debug_hooks->switch_text_section) ();
+ switch_to_section (current_function_section ());
break;
case NOTE_INSN_BASIC_BLOCK: