]> gcc.gnu.org Git - gcc.git/commitdiff
varasm.c (function_section): If DECL is NULL_TREE, don't try to do anything else.
authorZack Weinberg <zack@gcc.gnu.org>
Thu, 28 Oct 2004 20:52:42 +0000 (20:52 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Thu, 28 Oct 2004 20:52:42 +0000 (20:52 +0000)
* 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

gcc/ChangeLog
gcc/varasm.c

index 0aa6c693104b38a7af13584a26a4bbdb1fca56cb..a0900041385f1549ae119f7af010a560efb994b6 100644 (file)
@@ -1,6 +1,12 @@
+2004-10-28  Zack Weinberg  <zack@codesourcery.com>
+
+       * 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.
+
 2004-10-28  Adam Nemet  <anemet@lnxw.com>
 
-       PR middle-end/18160  
+       PR middle-end/18160
        * c-typeck.c (c_mark_addressable): Issue error if address of a
        register variable is taken.  Use "%qD" to print DECL_NAME.
 
        <GOTO_EXPR>: Don't let an explicit GOTO_EXPR slip through.
 
 2004-10-27  Daniel Berlin <dberlin@dberlin.org>
-       
+
        Fix PR tree-optimization/17133
-       
+
        * tree-cfg.c (rewrite_to_new_ssa_names_bb): Also rewrite must
        def kill operand.
 
 
        * tree-pass.h (TODO_fix_def_def_chains): New todo flag.
 
-       * tree-optimize.c (execute_todo): Handle TODO_fix_def_def_chains.       
+       * tree-optimize.c (execute_todo): Handle TODO_fix_def_def_chains.
 
        * tree-pretty-print.c (dump_vops): Print out MUST_DEF's so that
        they include the rhs now.
 
        * tree-ssa-ccp.c (visit_assignment): V_MUST_DEF_OP became
-       V_MUST_DEF_RESULT. 
+       V_MUST_DEF_RESULT.
 
        * tree-ssa-dce.c (mark_operand_necessary): Add phionly argument.
        Update callers.
        as setting the use portion as well.
        (copy_virtual_operands): Copy the kill operand as well.
        (create_ssa_artficial_load_stmt): V_MUST_DEF_OP became
-       V_MUST_DEF_RESULT. 
+       V_MUST_DEF_RESULT.
 
        * tree-ssa-operands.h (v_may_def_operand_type): Renamed to
-       v_def_use_operand_type. 
+       v_def_use_operand_type.
        (v_must_def_optype_d): Use v_def_use_operand_type.
        (V_MUST_DEF_OP_*): Renamed to V_MUST_DEF_RESULT_*
        (V_MUST_DEF_KILL_*): New macros.
        (struct ssa_operand_iterator_d): Add num_v_mustu and v_mustu_i
        members.
        Rename existing must_i and num_v_must members to mustd_i and
-       num_v_mustd. 
+       num_v_mustd.
        (SSA_OP_VMUSTDEFKILL): New flag.
        (SSA_OP_VIRTUAL_KILLS): New flag.
        (SSA_OP_ALL_OPERANDS): Add in SSA_OP_ALL_KILLS.
index df97f9e0f0862e11b4e3d75e9d7521978814818d..bff916b55450c2eff840ec2308c0c766de57f61b 100644 (file)
@@ -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.  */
This page took 0.106347 seconds and 5 git commands to generate.