aboutsummaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c83
1 files changed, 16 insertions, 67 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 7f5c664..7633724 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1426,7 +1426,7 @@ profile_function (FILE *file ATTRIBUTE_UNUSED)
assemble_integer (const0_rtx, LONG_TYPE_SIZE / BITS_PER_UNIT, align, 1);
}
- function_section (current_function_decl);
+ current_function_section (current_function_decl);
#if defined(ASM_OUTPUT_REG_PUSH)
if (sval && svrtx != NULL_RTX && REG_P (svrtx))
@@ -1619,35 +1619,6 @@ output_alternate_entry_point (FILE *file, rtx insn)
}
}
-/* Return boolean indicating if there is a NOTE_INSN_UNLIKELY_EXECUTED_CODE
- note in the instruction chain (going forward) between the current
- instruction, and the next 'executable' instruction. */
-
-bool
-scan_ahead_for_unlikely_executed_note (rtx insn)
-{
- rtx temp;
- int bb_note_count = 0;
-
- for (temp = insn; temp; temp = NEXT_INSN (temp))
- {
- if (NOTE_P (temp)
- && NOTE_LINE_NUMBER (temp) == NOTE_INSN_UNLIKELY_EXECUTED_CODE)
- return true;
- if (NOTE_P (temp)
- && NOTE_LINE_NUMBER (temp) == NOTE_INSN_BASIC_BLOCK)
- {
- bb_note_count++;
- if (bb_note_count > 1)
- return false;
- }
- if (INSN_P (temp))
- return false;
- }
-
- return false;
-}
-
/* The final scan for one insn, INSN.
Args are same as in `final', except that INSN
is the insn being scanned.
@@ -1691,30 +1662,27 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case NOTE_INSN_EXPECTED_VALUE:
break;
- case NOTE_INSN_UNLIKELY_EXECUTED_CODE:
+ 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. */
-
- unlikely_text_section ();
+
+ if (last_text_section == in_text)
+ {
+ (*debug_hooks->switch_text_section) ();
+ unlikely_text_section ();
+ }
+ else
+ {
+ (*debug_hooks->switch_text_section) ();
+ text_section ();
+ }
break;
case NOTE_INSN_BASIC_BLOCK:
- /* If we are performing the optimization that partitions
- basic blocks into hot & cold sections of the .o file,
- then at the start of each new basic block, before
- beginning to write code for the basic block, we need to
- check to see whether the basic block belongs in the hot
- or cold section of the .o file, and change the section we
- are writing to appropriately. */
-
- if (flag_reorder_blocks_and_partition
- && !scan_ahead_for_unlikely_executed_note (insn))
- function_section (current_function_decl);
-
#ifdef TARGET_UNWIND_INFO
targetm.asm_out.unwind_emit (asm_out_file, insn);
#endif
@@ -1896,25 +1864,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
if (LABEL_NAME (insn))
(*debug_hooks->label) (insn);
- /* If we are doing the optimization that partitions hot & cold
- basic blocks into separate sections of the .o file, we need
- to ensure the jump table ends up in the correct section... */
-
- if (flag_reorder_blocks_and_partition
- && targetm.have_named_sections)
- {
- rtx tmp_table, tmp_label;
- if (LABEL_P (insn)
- && tablejump_p (NEXT_INSN (insn), &tmp_label, &tmp_table))
- {
- /* Do nothing; Do NOT change the current section. */
- }
- else if (scan_ahead_for_unlikely_executed_note (insn))
- unlikely_text_section ();
- else if (in_unlikely_text_section ())
- function_section (current_function_decl);
- }
-
if (app_on)
{
fputs (ASM_APP_OFF, file);
@@ -1952,7 +1901,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
ASM_OUTPUT_ALIGN (file, log_align);
}
else
- function_section (current_function_decl);
+ current_function_section (current_function_decl);
#ifdef ASM_OUTPUT_CASE_LABEL
ASM_OUTPUT_CASE_LABEL (file, "L", CODE_LABEL_NUMBER (insn),
@@ -2011,7 +1960,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
if (! JUMP_TABLES_IN_TEXT_SECTION)
targetm.asm_out.function_rodata_section (current_function_decl);
else
- function_section (current_function_decl);
+ current_function_section (current_function_decl);
if (app_on)
{
@@ -2069,7 +2018,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
#endif
#endif
- function_section (current_function_decl);
+ current_function_section (current_function_decl);
break;
}