+2012-05-03 Michael Matz <matz@suse.de>
+
+ * basic-block.h (struct rtl_bb_info, struct gimple_bb_info): Move
+ in front of basic_block_def.
+ (struct basic_block_def): Make il.gimple the full struct, not a
+ pointer.
+ (__assert_gimple_bb_smaller_rtl_bb): Asserting typedef.
+
+ * cfgexpand.c (expand_gimple_basic_block): Clear all il.gimple
+ members.
+ * gimple-iterator.c (gimple_stmt_iterator): Don't special case
+ NULL il.gimple, which can't happen anymore.
+ * gimple.h (bb_seq): il.gimple can't be NULL.
+ (bb_seq_add): Ditto.
+ (set_bb_seq): Adjust.
+ (gsi_start_bb, gsi_last_bb): Tidy.
+ * lto-streamer-in.c (make_new_block): Don't zero members that
+ are zeroed already, don't allocate a gimple_bb_info.
+ * tree-cfg.c (create_bb): Don't allocate a gimple_bb_info.
+ (remove_bb): Clear all il.gimple members.
+ (gimple_verify_flow_info): Adjust for flat il.gimple.
+ * tree-flow-inline.h (phi_nodes, phi_nodes_ptr, set_phi_nodes): Adjust.
+
+ * coretypes.h (const_gimple_seq): Remove typedef.
+ * gimple.h (gimple_seq_first): Take gimple_seq.
+ (gimple_seq_first_stmt): Ditto.
+ (gimple_seq_last): Ditto.
+ (gimple_seq_last_stmt): Ditto.
+ (gimple_seq_empty_p): Ditto.
+
2012-05-03 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (valid_in_sets): Remove checking of trapping
/* Declared in cfgloop.h. */
struct loop;
-/* Declared in tree-flow.h. */
-struct rtl_bb_info;
+struct GTY(()) rtl_bb_info {
+ /* The first and last insns of the block. */
+ rtx head_;
+ rtx end_;
+
+ /* In CFGlayout mode points to insn notes/jumptables to be placed just before
+ and after the block. */
+ rtx header;
+ rtx footer;
+
+ /* This field is used by the bb-reorder pass. */
+ int visited;
+};
+
+struct GTY(()) gimple_bb_info {
+ /* Sequence of statements in this block. */
+ gimple_seq seq;
+
+ /* PHI nodes for this block. */
+ gimple_seq phi_nodes;
+};
/* A basic block is a sequence of instructions with only entry and
only one exit. If any one of the instructions are executed, they
struct basic_block_def *next_bb;
union basic_block_il_dependent {
- struct gimple_bb_info * GTY ((tag ("0"))) gimple;
+ struct gimple_bb_info GTY ((tag ("0"))) gimple;
struct rtl_bb_info * GTY ((tag ("1"))) rtl;
} GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il;
int flags;
};
-struct GTY(()) rtl_bb_info {
- /* The first and last insns of the block. */
- rtx head_;
- rtx end_;
-
- /* In CFGlayout mode points to insn notes/jumptables to be placed just before
- and after the block. */
- rtx header;
- rtx footer;
-
- /* This field is used by the bb-reorder and tracer passes. */
- int visited;
-};
-
-struct GTY(()) gimple_bb_info {
- /* Sequence of statements in this block. */
- gimple_seq seq;
-
- /* PHI nodes for this block. */
- gimple_seq phi_nodes;
-};
+/* This ensures that struct gimple_bb_info is smaller than
+ struct rtl_bb_info, so that inlining the former into basic_block_def
+ is the better choice. */
+typedef int __assert_gimple_bb_smaller_rtl_bb
+ [(int)sizeof(struct rtl_bb_info)
+ - (int)sizeof (struct gimple_bb_info)];
DEF_VEC_P(basic_block);
DEF_VEC_ALLOC_P(basic_block,gc);
block to be in GIMPLE, instead of RTL. Therefore, we need to
access the BB sequence directly. */
stmts = bb_seq (bb);
- bb->il.gimple = NULL;
+ bb->il.gimple.seq = NULL;
+ bb->il.gimple.phi_nodes = NULL;
rtl_profile_for_bb (bb);
init_rtl_bb_info (bb);
bb->flags |= BB_RTL;
struct diagnostic_context;
typedef struct diagnostic_context diagnostic_context;
typedef gimple gimple_seq;
-typedef gimple const_gimple_seq;
/* Address space number for named address space support. */
typedef unsigned char addr_space_t;
gsi_start_phis (basic_block bb)
{
gimple_seq *pseq = phi_nodes_ptr (bb);
- /* XXX check only necessary because ENTRY/EXIT blocks don't have il.gimple */
- return pseq ? gsi_start_1 (pseq) : gsi_none ();
+ return gsi_start_1 (pseq);
}
/* Return the first node in GIMPLE sequence S. */
static inline gimple_seq_node
-gimple_seq_first (const_gimple_seq s)
+gimple_seq_first (gimple_seq s)
{
return s;
}
/* Return the first statement in GIMPLE sequence S. */
static inline gimple
-gimple_seq_first_stmt (const_gimple_seq s)
+gimple_seq_first_stmt (gimple_seq s)
{
gimple_seq_node n = gimple_seq_first (s);
return n;
/* Return the last node in GIMPLE sequence S. */
static inline gimple_seq_node
-gimple_seq_last (const_gimple_seq s)
+gimple_seq_last (gimple_seq s)
{
return s ? s->gsbase.prev : NULL;
}
/* Return the last statement in GIMPLE sequence S. */
static inline gimple
-gimple_seq_last_stmt (const_gimple_seq s)
+gimple_seq_last_stmt (gimple_seq s)
{
gimple_seq_node n = gimple_seq_last (s);
return n;
/* Return true if GIMPLE sequence S is empty. */
static inline bool
-gimple_seq_empty_p (const_gimple_seq s)
+gimple_seq_empty_p (gimple_seq s)
{
return s == NULL;
}
static inline gimple_seq
bb_seq (const_basic_block bb)
{
- return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
+ return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
}
static inline gimple_seq *
-bb_seq_addr (const_basic_block bb)
+bb_seq_addr (basic_block bb)
{
- return (!(bb->flags & BB_RTL) && bb->il.gimple) ? &bb->il.gimple->seq : NULL;
+ return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
}
/* Sets the sequence of statements in BB to SEQ. */
set_bb_seq (basic_block bb, gimple_seq seq)
{
gcc_checking_assert (!(bb->flags & BB_RTL));
- bb->il.gimple->seq = seq;
+ bb->il.gimple.seq = seq;
}
gimple_seq *seq;
seq = bb_seq_addr (bb);
- if (!seq)
- /* XXX Only necessary because of ENTRY/EXIT block which don't have
- il.gimple */
- {
- i.ptr = NULL;
- i.seq = NULL;
- i.bb = NULL;
- }
- else
- {
- i.ptr = gimple_seq_first (*seq);
- i.seq = seq;
- i.bb = bb;
- }
+ i.ptr = gimple_seq_first (*seq);
+ i.seq = seq;
+ i.bb = bb;
return i;
}
gimple_seq *seq;
seq = bb_seq_addr (bb);
- if (!seq)
- /* XXX Only necessary because of ENTRY/EXIT block which don't have
- il.gimple */
- {
- i.ptr = NULL;
- i.seq = NULL;
- i.bb = NULL;
- }
- else
- {
- i.ptr = gimple_seq_last (*seq);
- i.seq = seq;
- i.bb = bb;
- }
+ i.ptr = gimple_seq_last (*seq);
+ i.seq = seq;
+ i.bb = bb;
return i;
}
basic_block bb = alloc_block ();
bb->index = index;
SET_BASIC_BLOCK_FOR_FUNCTION (fn, index, bb);
- bb->il.gimple = ggc_alloc_cleared_gimple_bb_info ();
n_basic_blocks_for_function (fn)++;
- bb->flags = 0;
- set_bb_seq (bb, NULL);
return bb;
}
bb->index = last_basic_block;
bb->flags = BB_NEW;
- bb->il.gimple = ggc_alloc_cleared_gimple_bb_info ();
set_bb_seq (bb, h ? (gimple_seq) h : NULL);
/* Add the new block to the linked list of blocks. */
}
remove_phi_nodes_and_edges_for_unreachable_block (bb);
- bb->il.gimple = NULL;
+ bb->il.gimple.seq = NULL;
+ bb->il.gimple.phi_nodes = NULL;
}
edge e;
edge_iterator ei;
- if (ENTRY_BLOCK_PTR->il.gimple)
+ if (ENTRY_BLOCK_PTR->il.gimple.seq || ENTRY_BLOCK_PTR->il.gimple.phi_nodes)
{
error ("ENTRY_BLOCK has IL associated with it");
err = 1;
}
- if (EXIT_BLOCK_PTR->il.gimple)
+ if (EXIT_BLOCK_PTR->il.gimple.seq || EXIT_BLOCK_PTR->il.gimple.phi_nodes)
{
error ("EXIT_BLOCK has IL associated with it");
err = 1;
phi_nodes (const_basic_block bb)
{
gcc_checking_assert (!(bb->flags & BB_RTL));
- if (!bb->il.gimple)
- return NULL;
- return bb->il.gimple->phi_nodes;
+ return bb->il.gimple.phi_nodes;
}
static inline gimple_seq *
-phi_nodes_ptr (const_basic_block bb)
+phi_nodes_ptr (basic_block bb)
{
gcc_checking_assert (!(bb->flags & BB_RTL));
- if (!bb->il.gimple)
- return NULL;
- return &bb->il.gimple->phi_nodes;
+ return &bb->il.gimple.phi_nodes;
}
/* Set PHI nodes of a basic block BB to SEQ. */
gimple_stmt_iterator i;
gcc_checking_assert (!(bb->flags & BB_RTL));
- bb->il.gimple->phi_nodes = seq;
+ bb->il.gimple.phi_nodes = seq;
if (seq)
for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
gimple_set_bb (gsi_stmt (i), bb);