Commit 1ad435a5 by Caroline Tice Committed by Caroline Tice

bb-reorder.c (verify_hot_cold_block_grouping): Replace internal_error with gcc_assert.

2005-05-16  Caroline Tice  <ctice@apple.com>

        * bb-reorder.c (verify_hot_cold_block_grouping):  Replace
        internal_error with gcc_assert.
        * dwarf2out.c (dwarf2out_switch_text_section):  Likewise.
        * function.h (struct function): Remove space between "*" and
        struct field names.
        * varasm.c (initialize_cold_section_name):   Add gcc_assert;
        modify to use alloca.
        (unlikely_text_section): Add check for flag_function_sections.
        (assemble_start_function):  Move call to resolve_section, so it
        comes before first call to unlikely_text_section.
        (assemble_end_function):  Add test and call to function_section
        if appropriate.

From-SVN: r99796
parent 45535d4f
2005-05-16 Caroline Tice <ctice@apple.com>
* bb-reorder.c (verify_hot_cold_block_grouping): Replace
internal_error with gcc_assert.
* dwarf2out.c (dwarf2out_switch_text_section): Likewise.
* function.h (struct function): Remove space between "*" and
struct field names.
* varasm.c (initialize_cold_section_name): Add gcc_assert;
modify to use alloca.
(unlikely_text_section): Add check for flag_function_sections.
(assemble_start_function): Move call to resolve_section, so it
comes before first call to unlikely_text_section.
(assemble_end_function): Add test and call to function_section
if appropriate.
2005-05-16 Roger Sayle <roger@eyesopen.com> 2005-05-16 Roger Sayle <roger@eyesopen.com>
* c-common.c (c_common_truthvalue_conversion): Use fold_build2 * c-common.c (c_common_truthvalue_conversion): Use fold_build2
......
...@@ -1874,8 +1874,7 @@ verify_hot_cold_block_grouping (void) ...@@ -1874,8 +1874,7 @@ verify_hot_cold_block_grouping (void)
} }
} }
if (err) gcc_assert(!err);
internal_error ("verify_hot_cold_block_grouping failed");
} }
/* Reorder basic blocks. The main entry point to this file. FLAGS is /* Reorder basic blocks. The main entry point to this file. FLAGS is
......
...@@ -6814,8 +6814,7 @@ dwarf2out_switch_text_section (void) ...@@ -6814,8 +6814,7 @@ dwarf2out_switch_text_section (void)
{ {
dw_fde_ref fde; dw_fde_ref fde;
if (!cfun) gcc_assert (cfun);
internal_error ("Attempt to switch text sections without any code.");
fde = &fde_table[fde_table_in_use - 1]; fde = &fde_table[fde_table_in_use - 1];
fde->dw_fde_switched_sections = true; fde->dw_fde_switched_sections = true;
......
...@@ -357,10 +357,10 @@ struct function GTY(()) ...@@ -357,10 +357,10 @@ struct function GTY(())
be used by debugger functions for determining the size of text be used by debugger functions for determining the size of text
sections. */ sections. */
const char * hot_section_label; const char *hot_section_label;
const char * cold_section_label; const char *cold_section_label;
const char * hot_section_end_label; const char *hot_section_end_label;
const char * cold_section_end_label; const char *cold_section_end_label;
/* String to be used for name of cold text sections, via /* String to be used for name of cold text sections, via
targetm.asm_out.named_section. */ targetm.asm_out.named_section. */
......
...@@ -179,34 +179,23 @@ initialize_cold_section_name (void) ...@@ -179,34 +179,23 @@ initialize_cold_section_name (void)
const char *name; const char *name;
const char *stripped_name; const char *stripped_name;
char *buffer; char *buffer;
int len;
if (cfun gcc_assert (cfun && current_function_decl);
&& current_function_decl) if (cfun->unlikely_text_section_name)
return;
if (flag_function_sections && DECL_SECTION_NAME (current_function_decl))
{ {
if (!cfun->unlikely_text_section_name) name = alloca (TREE_STRING_LENGTH (DECL_SECTION_NAME
{ (current_function_decl)));
if (flag_function_sections strcpy ((char *) name, TREE_STRING_POINTER (DECL_SECTION_NAME
&& DECL_SECTION_NAME (current_function_decl)) (current_function_decl)));
{ stripped_name = targetm.strip_name_encoding (name);
name = xstrdup (TREE_STRING_POINTER (DECL_SECTION_NAME buffer = ACONCAT ((stripped_name, "_unlikely", NULL));
(current_function_decl))); cfun->unlikely_text_section_name = ggc_strdup (buffer);
stripped_name = targetm.strip_name_encoding (name);
len = strlen (stripped_name);
buffer = (char *) xmalloc (len + 10);
sprintf (buffer, "%s%s", stripped_name, "_unlikely");
cfun->unlikely_text_section_name = ggc_strdup (buffer);
free (buffer);
free ((char *) name);
}
else
cfun->unlikely_text_section_name =
UNLIKELY_EXECUTED_TEXT_SECTION_NAME;
}
} }
else else
internal_error cfun->unlikely_text_section_name = UNLIKELY_EXECUTED_TEXT_SECTION_NAME;
("initialize_cold_section_name called without valid current_function_decl.");
} }
/* Tell assembler to switch to text section. */ /* Tell assembler to switch to text section. */
...@@ -232,9 +221,11 @@ unlikely_text_section (void) ...@@ -232,9 +221,11 @@ unlikely_text_section (void)
if (!cfun->unlikely_text_section_name) if (!cfun->unlikely_text_section_name)
initialize_cold_section_name (); initialize_cold_section_name ();
if ((in_section != in_unlikely_executed_text) if (flag_function_sections
&& (in_section != in_named || ((in_section != in_unlikely_executed_text)
|| strcmp (in_named_name, cfun->unlikely_text_section_name) != 0)) && (in_section != in_named
|| (strcmp (in_named_name, cfun->unlikely_text_section_name)
!= 0))))
{ {
named_section (NULL_TREE, cfun->unlikely_text_section_name, 0); named_section (NULL_TREE, cfun->unlikely_text_section_name, 0);
in_section = in_unlikely_executed_text; in_section = in_unlikely_executed_text;
...@@ -1267,6 +1258,8 @@ assemble_start_function (tree decl, const char *fnname) ...@@ -1267,6 +1258,8 @@ assemble_start_function (tree decl, const char *fnname)
if (CONSTANT_POOL_BEFORE_FUNCTION) if (CONSTANT_POOL_BEFORE_FUNCTION)
output_constant_pool (fnname, decl); output_constant_pool (fnname, decl);
resolve_unique_section (decl, 0, flag_function_sections);
/* Make sure the not and cold text (code) sections are properly /* Make sure the not and cold text (code) sections are properly
aligned. This is necessary here in the case where the function aligned. This is necessary here in the case where the function
has both hot and cold sections, because we don't want to re-set has both hot and cold sections, because we don't want to re-set
...@@ -1320,7 +1313,6 @@ assemble_start_function (tree decl, const char *fnname) ...@@ -1320,7 +1313,6 @@ assemble_start_function (tree decl, const char *fnname)
} }
last_text_section = no_section; last_text_section = no_section;
resolve_unique_section (decl, 0, flag_function_sections);
/* Switch to the correct text section for the start of the function. */ /* Switch to the correct text section for the start of the function. */
...@@ -1406,7 +1398,10 @@ assemble_end_function (tree decl, const char *fnname) ...@@ -1406,7 +1398,10 @@ assemble_end_function (tree decl, const char *fnname)
save_text_section = in_section; save_text_section = in_section;
unlikely_text_section (); unlikely_text_section ();
ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_end_label); ASM_OUTPUT_LABEL (asm_out_file, cfun->cold_section_end_label);
text_section (); if (first_function_block_is_cold)
text_section ();
else
function_section (decl);
ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_end_label); ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_end_label);
if (save_text_section == in_unlikely_executed_text) if (save_text_section == in_unlikely_executed_text)
unlikely_text_section (); unlikely_text_section ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment