diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2004-10-28 20:52:42 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2004-10-28 20:52:42 +0000 |
commit | 40aea05cfa9feadb1fb46bca2992b905ebdcba74 (patch) | |
tree | 34a3bffdf54aa9215852fd7c053771fd36167a5a /gcc/varasm.c | |
parent | 6571df13b4c1b52d50a7e297db59ec698c2220ee (diff) | |
download | gcc-40aea05cfa9feadb1fb46bca2992b905ebdcba74.zip gcc-40aea05cfa9feadb1fb46bca2992b905ebdcba74.tar.gz gcc-40aea05cfa9feadb1fb46bca2992b905ebdcba74.tar.bz2 |
varasm.c (function_section): If DECL is NULL_TREE, don't try to do anything else.
* varasm.c (function_section): If DECL is NULL_TREE, don't try
to do anything else. Do not call get_insns if cfun or
cfun->emit are NULL.
From-SVN: r89777
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index df97f9e..bff916b 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -563,26 +563,34 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED, /* Switch to the section for function DECL. - If DECL is NULL_TREE, switch to the text section. - ??? It's not clear that we will ever be passed NULL_TREE, but it's - safer to handle it. */ + If DECL is NULL_TREE, switch to the text section. We can be passed + NULL_TREE under some circumstances by dbxout.c at least. */ void function_section (tree decl) { + if (decl == NULL_TREE) + text_section (); + else + { + /* ??? Typical use of this function maybe shouldn't be looking + for unlikely blocks at all - in the event that an entire + function is going into the unlikely-execute section, that + should be reflected in its DECL_SECTION_NAME. */ + rtx insns = cfun && cfun->emit ? get_insns () : 0; + bool unlikely = insns && scan_ahead_for_unlikely_executed_note (insns); + #ifdef USE_SELECT_SECTION_FOR_FUNCTIONS - bool unlikely = scan_ahead_for_unlikely_executed_note (get_insns()); - - targetm.asm_out.select_section (decl, unlikely, DECL_ALIGN (decl)); + targetm.asm_out.select_section (decl, unlikely, DECL_ALIGN (decl)); #else - if (scan_ahead_for_unlikely_executed_note (get_insns())) - unlikely_text_section (); - else if (decl != NULL_TREE - && DECL_SECTION_NAME (decl) != NULL_TREE) - named_section (decl, (char *) 0, 0); - else - text_section (); + if (unlikely) + unlikely_text_section (); + else if (DECL_SECTION_NAME (decl)) + named_section (decl, 0, 0); + else + text_section (); #endif + } } /* Switch to read-only data section associated with function DECL. */ |