summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/c-common.h2
-rw-r--r--gcc/cfganal.c16
-rw-r--r--gcc/config/elfos.h34
-rw-r--r--gcc/cse.c4
-rw-r--r--gcc/doc/c-tree.texi13
-rw-r--r--gcc/doc/tm.texi4
-rw-r--r--gcc/tree-inline.c1
-rw-r--r--gcc/varasm.c2
9 files changed, 70 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 64f0a266abc..35e0364a3af 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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,
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 1d87cf45cbb..1ce21a1769f 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -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
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 679a6e67fda..6924fd39246 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -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. */
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index a5c7a710e31..503e141d778 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -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 \
diff --git a/gcc/cse.c b/gcc/cse.c
index 54afcdd9ef0..fba491abc58 100644
--- 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;
diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi
index b27c082979c..dd21ae6285b 100644
--- a/gcc/doc/c-tree.texi
+++ b/gcc/doc/c-tree.texi
@@ -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
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 40b954289ce..ad26c8ad08c 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -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.
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a4f483ae3e4..3adbf345d7f 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -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
diff --git a/gcc/varasm.c b/gcc/varasm.c
index b7bd9c320e0..b0d96f5b5e5 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -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));