* 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
+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,
/* 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
basic_block bb;
{
data->stack[data->sp++] = bb;
+ SET_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1));
return;
}
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. */
/* 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) \
} \
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 \
/* 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;
@findex FOR_BODY
@tindex GOTO_STMT
@findex GOTO_DESTINATION
+@findex GOTO_FAKE_P
@tindex HANDLER
@tindex IF_STMT
@findex IF_COND
@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
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.
/* 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
/* 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));