]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cse.c (true_dependence_in_rtx): New function.
authorJan Hubicka <jh@suse.cz>
Wed, 28 Nov 2001 09:47:25 +0000 (10:47 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 28 Nov 2001 09:47:25 +0000 (09:47 +0000)
* cse.c (true_dependence_in_rtx): New function.
(invalidate): Use it.

* c-common.h (GOTO_FAKE_P): New macro.
* tree-inline.c (GOTO_FAKE_P): Set.
* c-tree.texi (GOTO_FAKE_P): Document.

* varasm.c (assemble_variable): Set reloc to 3 for error_mark
containing pointers.
(output_addressed_constants): Check for local/external relocations.
* elfos.h (SELECT_SECTION): Classify data section.
* tm.texi (SELECT_SECTION): Update documentation.

* cfganal.c (flow_dfs_compute_reverse_add_bb): set visited bit.
(flow_dfs_compute_reverse_execute): Add only unvisited blocks.

From-SVN: r47405

gcc/ChangeLog
gcc/c-common.h
gcc/cfganal.c
gcc/config/elfos.h
gcc/cse.c
gcc/doc/c-tree.texi
gcc/doc/tm.texi
gcc/tree-inline.c
gcc/varasm.c

index 64f0a266abc7bef1061d85a6c7ad3090e2cccca5..35e0364a3afe05ea57a0a14712fe704e233f2156 100644 (file)
@@ -1,3 +1,21 @@
+Wed Nov 28 10:42:19 CET 2001  Jan Hubicka  <jh@suse.cz>
+
+       * cse.c (true_dependence_in_rtx): New function.
+       (invalidate): Use it.
+
+       * c-common.h (GOTO_FAKE_P): New macro.
+       * tree-inline.c (GOTO_FAKE_P): Set.
+       * c-tree.texi (GOTO_FAKE_P): Document.
+
+       * varasm.c (assemble_variable): Set reloc to 3 for error_mark
+       containing pointers.
+       (output_addressed_constants): Check for local/external relocations.
+       * elfos.h (SELECT_SECTION): Classify data section.
+       * tm.texi (SELECT_SECTION): Update documentation.
+
+       * cfganal.c (flow_dfs_compute_reverse_add_bb): set visited bit.
+       (flow_dfs_compute_reverse_execute): Add only unvisited blocks.
+
 2001-11-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * defaults.h (UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP,
index 1d87cf45cbb7494177f2163f3ecad96812ae4ad2..1ce21a1769f57f43fe6ad5a40d17606e935d4649 100644 (file)
@@ -600,6 +600,8 @@ extern tree strip_array_types                   PARAMS ((tree));
 /* GOTO_STMT accessor. This gives access to the label associated with
    a goto statement.  */
 #define GOTO_DESTINATION(NODE)  TREE_OPERAND (GOTO_STMT_CHECK (NODE), 0)
+/* True for goto created artifically by the compiler.  */
+#define GOTO_FAKE_P(NODE)      (TREE_LANG_FLAG_0 (GOTO_STMT_CHECK (NODE)))
 
 /* COMPOUND_STMT accessor. This gives access to the TREE_LIST of
    statements associated with a compound statement. The result is the
index 679a6e67fda4099960a936c79ce5bdbad78ca72a..6924fd39246d43050ce5ebd32130983b6de23bde 100644 (file)
@@ -980,6 +980,7 @@ flow_dfs_compute_reverse_add_bb (data, bb)
      basic_block bb;
 {
   data->stack[data->sp++] = bb;
+  SET_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1));
   return;
 }
 
@@ -999,16 +1000,11 @@ flow_dfs_compute_reverse_execute (data)
   while (data->sp > 0)
     {
       bb = data->stack[--data->sp];
-
-      /* Mark that we have visited this node.  */
-      if (!TEST_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1)))
-       {
-         SET_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1));
-
-         /* Perform depth-first search on adjacent vertices.  */
-         for (e = bb->pred; e; e = e->pred_next)
-           flow_dfs_compute_reverse_add_bb (data, e->src);
-       }
+      /* Perform depth-first search on adjacent vertices.  */
+      for (e = bb->pred; e; e = e->pred_next)
+       if (!TEST_BIT (data->visited_blocks,
+                      e->src->index - (INVALID_BLOCK + 1)))
+         flow_dfs_compute_reverse_add_bb (data, e->src);
     }
 
   /* Determine if there are unvisited basic blocks.  */
index a5c7a710e318765498141b7c7c3cf9249fc4c68d..503e141d778cd97438cbd355eeda4862da56070e 100644 (file)
@@ -352,7 +352,23 @@ const_section ()                                           \
 /* A C statement or statements to switch to the appropriate
    section for output of DECL.  DECL is either a `VAR_DECL' node
    or a constant of some sort.  RELOC indicates whether forming
-   the initial value of DECL requires link-time relocations.  */
+   the initial value of DECL requires link-time relocations.  
+   To optimize loading of shared programs, define following subsections
+   of data section by attaching:
+
+   .rel
+     Section with this string in name contains data that do have
+     relocations, so they get grouped together and dynamic linker
+     will visit fewer pages in memory.
+   .ro
+     Marks data read only otherwise.  This is usefull with prelinking
+     as most of relocations won't be dynamically linked and thus
+     stay read only.
+   .local
+     Marks data containing relocations only to local objects.  These
+     relocation will get fully resolved by prelinking.
+ */
 
 #undef SELECT_SECTION
 #define SELECT_SECTION(DECL, RELOC, ALIGN)                     \
@@ -366,12 +382,22 @@ const_section ()                                          \
     }                                                          \
   else if (TREE_CODE (DECL) == VAR_DECL)                       \
     {                                                          \
-      if ((flag_pic && RELOC)                                  \
-         || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)  \
+      if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)    \
          || !DECL_INITIAL (DECL)                               \
          || (DECL_INITIAL (DECL) != error_mark_node            \
              && !TREE_CONSTANT (DECL_INITIAL (DECL))))         \
-       data_section ();                                        \
+       {                                                       \
+         if (flag_pic && ((RELOC) & 2))                        \
+           named_section (NULL_TREE, ".data.rel", RELOC);      \
+         else if (flag_pic && (RELOC))                         \
+           named_section (NULL_TREE, ".data.rel.local", RELOC);\
+         else                                                  \
+           data_section ();                                    \
+       }                                                       \
+      else if (flag_pic && ((RELOC) & 2))                      \
+       named_section (NULL_TREE, ".data.rel.ro", RELOC);       \
+      else if (flag_pic && (RELOC))                            \
+       named_section (NULL_TREE, ".data.rel.ro.local", RELOC); \
       else if (flag_merge_constants < 2)                       \
        /* C and C++ don't allow different variables to share   \
           the same location.  -fmerge-all-constants allows     \
index 54afcdd9ef0e4176b190f631adb7886cb0a14312..fba491abc58a3d12aaed6f1b93a7d5d0f405baa7 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5912,9 +5912,7 @@ cse_insn (insn, libcall_insn)
                /* Don't put a hard register source into the table if this is
                   the last insn of a libcall.  In this case, we only need
                   to put src_eqv_elt in src_elt.  */
-               if (GET_CODE (src) != REG
-                   || REGNO (src) >= FIRST_PSEUDO_REGISTER
-                   || ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
+               if (! find_reg_note (insn, REG_RETVAL, NULL_RTX))
                  {
                    struct table_elt *elt;
 
index b27c082979caa90c132b24d166d81c535a7dd571..dd21ae6285bbada30fde378a5da56a9df5986ef5 100644 (file)
@@ -1278,6 +1278,7 @@ This predicate holds if the function an overloaded
 @findex FOR_BODY
 @tindex GOTO_STMT
 @findex GOTO_DESTINATION
+@findex GOTO_FAKE_P
 @tindex HANDLER
 @tindex IF_STMT
 @findex IF_COND
@@ -1511,11 +1512,13 @@ expressions.
 
 @item GOTO_STMT
 
-Used to represent a @code{goto} statement.  The @code{GOTO_DESTINATION}
-will usually be a @code{LABEL_DECL}.  However, if the ``computed
-goto'' extension has been used, the @code{GOTO_DESTINATION} will be an
-arbitrary expression indicating the destination.  This expression will
-always have pointer type.
+Used to represent a @code{goto} statement.  The @code{GOTO_DESTINATION} will
+usually be a @code{LABEL_DECL}.  However, if the ``computed goto'' extension
+has been used, the @code{GOTO_DESTINATION} will be an arbitrary expression
+indicating the destination.  This expression will always have pointer type.
+Additionally the @code{GOTO_FAKE_P} flag is set whenever the goto statement
+does not come from source code, but it is generated implicitly by the compiler.
+This is used for branch prediction.
 
 @item HANDLER
 
index 40b954289ce7f2667bd5af1531ecedb9500faff1..ad26c8ad08ccd245eed4bacfa9cd97c5aeccc3aa 100644 (file)
@@ -5661,7 +5661,9 @@ A C statement or statements to switch to the appropriate section for
 output of @var{exp}.  You can assume that @var{exp} is either a
 @code{VAR_DECL} node or a constant of some sort.  @var{reloc}
 indicates whether the initial value of @var{exp} requires link-time
-relocations.  Select the section by calling @code{text_section} or one
+relocations.  Bit 1 is set when variable contains local relocations
+only, while bit 2 is set for global relocations.
+Select the section by calling @code{text_section} or one
 of the alternatives for other sections.  @var{align} is the constant
 alignment in bits.
 
index a4f483ae3e46842f22141dc2634b06c4ec54245b..3adbf345d7fc90b147b5e5f8c89432638a8c0685 100644 (file)
@@ -350,6 +350,7 @@ copy_body_r (tp, walk_subtrees, data)
       /* Build the GOTO_STMT.  */
       goto_stmt = build_stmt (GOTO_STMT, id->ret_label);
       TREE_CHAIN (goto_stmt) = TREE_CHAIN (return_stmt);
+      GOTO_FAKE_P (goto_stmt) = 1;
 
       /* If we're returning something, just turn that into an
         assignment into the equivalent of the original
index b7bd9c320e024d6db2de064a4d6249d9cc7f5ffc..b0d96f5b5e513e26971eb7951797664b3db86574 100644 (file)
@@ -1679,7 +1679,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
 
   /* Output any data that we will need to use the address of.  */
   if (DECL_INITIAL (decl) == error_mark_node)
-    reloc = contains_pointers_p (TREE_TYPE (decl));
+    reloc = contains_pointers_p (TREE_TYPE (decl)) ? 3 : 0;
   else if (DECL_INITIAL (decl))
     reloc = output_addressed_constants (DECL_INITIAL (decl));