2008-07-28 16:33:56 +02:00
|
|
|
/* Iterator routines for GIMPLE statements.
|
Make-lang.in, [...]: Update copyright years.
* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c,
basic-block.h, bb-reorder.c, calls.c, c-common.c, cgraph.h,
collect2.h, config/alpha/alpha.c, config/alpha/alpha.md,
config/alpha/predicates.md, config/arm/arm.md,
config/arm/lib1funcs.asm, config/arm/neon-schedgen.ml,
config/avr/avr.c, config/avr/avr.md, config/bfin/bfin.c,
config/darwin9.h, config/darwin.c, config/darwin.h,
config/h8300/h8300.c, config/i386/cpuid.h, config/i386/cygming.h,
config/i386/cygwin.h, config/i386/mingw32.h, config/i386/msformat-c.c,
config/i386/sol2-10.h, config/i386/xopintrin.h, config/ia64/ia64.c,
config/ia64/ia64.md, config/ia64/sync.md, config/mep/mep.c,
config/mips/mips.md, config/mn10300/mn10300.c,
config/mn10300/mn10300.h, config/pa/pa.c, config/pa/pa.md,
config/rs6000/aix.h, config/rs6000/dfp.md,
config/rs6000/rs6000-builtin.def, config/rs6000/rs6000-c.c,
config/rs6000/vector.md, config/rtems.h, config/rx/rx.md,
config/s390/s390.md, config/sol2-c.c, config/sparc/sol2-bi.h,
config/sparc/sol2-gas.h, config/sparc/sparc.h, config/sparc/sparc.md,
config/sparc/sparc-protos.h, config/spu/spu.c, config/spu/spu-c.c,
config/t-darwin, convert.c, c.opt, c-opts.c, cp/Make-lang.in,
c-pretty-print.c, c-typeck.c, df-core.c, df-scan.c, diagnostic.c,
diagnostic.h, doc/cppopts.texi, doc/cpp.texi, doc/extend.texi,
doc/gimple.texi, doc/languages.texi, doc/plugins.texi, doc/rtl.texi,
doc/standards.texi, doc/tree-ssa.texi, doc/trouble.texi, dominance.c,
fold-const.c, fortran/Make-lang.in, fwprop.c, gcc-plugin.h,
gensupport.c, gimple.h, gimple-iterator.c, graphite.c,
graphite-clast-to-gimple.c, graphite-clast-to-gimple.h,
graphite-dependences.c, graphite-poly.c, graphite-poly.h,
graphite-ppl.c, graphite-ppl.h, graphite-scop-detection.c,
graphite-sese-to-poly.c, graphite-sese-to-poly.h, ifcvt.c, intl.c,
intl.h, ipa.c, ipa-cp.c, ipa-inline.c, ipa-prop.c, ipa-prop.h,
ipa-pure-const.c, ipa-reference.c, ipa-type-escape.c, ira-color.c,
ira-conflicts.c, ira-lives.c, java/Make-lang.in, lambda-code.c,
loop-invariant.c, lto/Make-lang.in, lto-streamer.h, lto-streamer-in.c,
objc/Make-lang.in, objcp/Make-lang.in, omp-low.c, optc-gen.awk,
opt-functions.awk, opth-gen.awk, params.def, passes.c,
postreload-gcse.c, print-tree.c, recog.c, regrename.c, reload.h,
rtl.def, sched-int.h, sched-rgn.c, sel-sched-dump.c, sese.c, sese.h,
store-motion.c, stor-layout.c, tree-cfgcleanup.c, tree-chrec.c,
tree-complex.c, tree-data-ref.c, tree.def, tree-eh.c, tree-flow.h,
tree-flow-inline.h, tree.h, tree-loop-distribution.c, tree-outof-ssa.c,
tree-parloops.c, tree-pass.h, tree-predcom.c, tree-profile.c,
tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-alias.c,
tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c,
tree-ssa-loop-manip.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
tree-ssa-pre.c, tree-ssa-sccvn.c, tree-ssa-structalias.c,
tree-ssa-uncprop.c, tree-tailcall.c, tree-vect-data-refs.c,
tree-vect-loop.c, tree-vectorizer.h, tree-vect-slp.c, tree-vrp.c,
unwind-dw2-fde-darwin.c, varpool.c: Update copyright years.
From-SVN: r157950
2010-04-02 21:54:46 +02:00
|
|
|
Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc.
|
2008-07-28 16:33:56 +02:00
|
|
|
Contributed by Aldy Hernandez <aldy@quesejoda.com>
|
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tm.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "gimple.h"
|
|
|
|
#include "tree-flow.h"
|
|
|
|
#include "value-prof.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Mark the statement STMT as modified, and update it. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
update_modified_stmt (gimple stmt)
|
|
|
|
{
|
|
|
|
if (!ssa_operands_active ())
|
|
|
|
return;
|
|
|
|
update_stmt_if_modified (stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Mark the statements in SEQ as modified, and update them. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_modified_stmts (gimple_seq seq)
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator gsi;
|
2009-11-25 11:55:54 +01:00
|
|
|
|
2008-07-28 16:33:56 +02:00
|
|
|
if (!ssa_operands_active ())
|
2009-11-25 11:55:54 +01:00
|
|
|
return;
|
2008-07-28 16:33:56 +02:00
|
|
|
for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi))
|
|
|
|
update_stmt_if_modified (gsi_stmt (gsi));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Set BB to be the basic block for all the statements in the list
|
|
|
|
starting at FIRST and LAST. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_bb_for_stmts (gimple_seq_node first, basic_block bb)
|
|
|
|
{
|
|
|
|
gimple_seq_node n;
|
2009-11-25 11:55:54 +01:00
|
|
|
|
2008-07-28 16:33:56 +02:00
|
|
|
for (n = first; n; n = n->next)
|
|
|
|
gimple_set_bb (n->stmt, bb);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert the sequence delimited by nodes FIRST and LAST before
|
|
|
|
iterator I. M specifies how to update iterator I after insertion
|
|
|
|
(see enum gsi_iterator_update).
|
|
|
|
|
|
|
|
This routine assumes that there is a forward and backward path
|
|
|
|
between FIRST and LAST (i.e., they are linked in a doubly-linked
|
|
|
|
list). Additionally, if FIRST == LAST, this routine will properly
|
|
|
|
insert a single node. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gsi_insert_seq_nodes_before (gimple_stmt_iterator *i,
|
|
|
|
gimple_seq_node first,
|
|
|
|
gimple_seq_node last,
|
|
|
|
enum gsi_iterator_update mode)
|
|
|
|
{
|
|
|
|
basic_block bb;
|
|
|
|
gimple_seq_node cur = i->ptr;
|
|
|
|
|
|
|
|
if ((bb = gsi_bb (*i)) != NULL)
|
|
|
|
update_bb_for_stmts (first, bb);
|
|
|
|
|
|
|
|
/* Link SEQ before CUR in the sequence. */
|
|
|
|
if (cur)
|
|
|
|
{
|
|
|
|
first->prev = cur->prev;
|
|
|
|
if (first->prev)
|
|
|
|
first->prev->next = first;
|
|
|
|
else
|
|
|
|
gimple_seq_set_first (i->seq, first);
|
|
|
|
last->next = cur;
|
|
|
|
cur->prev = last;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimple_seq_node itlast = gimple_seq_last (i->seq);
|
|
|
|
|
|
|
|
/* If CUR is NULL, we link at the end of the sequence (this case happens
|
|
|
|
when gsi_after_labels is called for a basic block that contains only
|
|
|
|
labels, so it returns an iterator after the end of the block, and
|
|
|
|
we need to insert before it; it might be cleaner to add a flag to the
|
|
|
|
iterator saying whether we are at the start or end of the list). */
|
|
|
|
first->prev = itlast;
|
|
|
|
if (itlast)
|
|
|
|
itlast->next = first;
|
|
|
|
else
|
|
|
|
gimple_seq_set_first (i->seq, first);
|
|
|
|
gimple_seq_set_last (i->seq, last);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the iterator, if requested. */
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case GSI_NEW_STMT:
|
|
|
|
case GSI_CONTINUE_LINKING:
|
|
|
|
i->ptr = first;
|
|
|
|
break;
|
|
|
|
case GSI_SAME_STMT:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gcc_unreachable ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Inserts the sequence of statements SEQ before the statement pointed
|
|
|
|
by iterator I. MODE indicates what to do with the iterator after
|
|
|
|
insertion (see enum gsi_iterator_update).
|
|
|
|
|
|
|
|
This function does not scan for new operands. It is provided for
|
|
|
|
the use of the gimplifier, which manipulates statements for which
|
|
|
|
def/use information has not yet been constructed. Most callers
|
|
|
|
should use gsi_insert_seq_before. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_seq_before_without_update (gimple_stmt_iterator *i, gimple_seq seq,
|
|
|
|
enum gsi_iterator_update mode)
|
|
|
|
{
|
|
|
|
gimple_seq_node first, last;
|
|
|
|
|
|
|
|
if (seq == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Don't allow inserting a sequence into itself. */
|
|
|
|
gcc_assert (seq != i->seq);
|
|
|
|
|
|
|
|
first = gimple_seq_first (seq);
|
|
|
|
last = gimple_seq_last (seq);
|
|
|
|
|
|
|
|
gimple_seq_set_first (seq, NULL);
|
|
|
|
gimple_seq_set_last (seq, NULL);
|
|
|
|
gimple_seq_free (seq);
|
|
|
|
|
|
|
|
/* Empty sequences need no work. */
|
|
|
|
if (!first || !last)
|
|
|
|
{
|
|
|
|
gcc_assert (first == last);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gsi_insert_seq_nodes_before (i, first, last, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Inserts the sequence of statements SEQ before the statement pointed
|
|
|
|
by iterator I. MODE indicates what to do with the iterator after
|
|
|
|
insertion (see enum gsi_iterator_update). Scan the statements in SEQ
|
|
|
|
for new operands. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_seq_before (gimple_stmt_iterator *i, gimple_seq seq,
|
|
|
|
enum gsi_iterator_update mode)
|
|
|
|
{
|
|
|
|
update_modified_stmts (seq);
|
|
|
|
gsi_insert_seq_before_without_update (i, seq, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert the sequence delimited by nodes FIRST and LAST after
|
|
|
|
iterator I. M specifies how to update iterator I after insertion
|
|
|
|
(see enum gsi_iterator_update).
|
|
|
|
|
|
|
|
This routine assumes that there is a forward and backward path
|
|
|
|
between FIRST and LAST (i.e., they are linked in a doubly-linked
|
|
|
|
list). Additionally, if FIRST == LAST, this routine will properly
|
|
|
|
insert a single node. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gsi_insert_seq_nodes_after (gimple_stmt_iterator *i,
|
|
|
|
gimple_seq_node first,
|
|
|
|
gimple_seq_node last,
|
|
|
|
enum gsi_iterator_update m)
|
|
|
|
{
|
|
|
|
basic_block bb;
|
|
|
|
gimple_seq_node cur = i->ptr;
|
|
|
|
|
|
|
|
/* If the iterator is inside a basic block, we need to update the
|
|
|
|
basic block information for all the nodes between FIRST and LAST. */
|
|
|
|
if ((bb = gsi_bb (*i)) != NULL)
|
|
|
|
update_bb_for_stmts (first, bb);
|
|
|
|
|
|
|
|
/* Link SEQ after CUR. */
|
|
|
|
if (cur)
|
|
|
|
{
|
|
|
|
last->next = cur->next;
|
|
|
|
if (last->next)
|
|
|
|
last->next->prev = last;
|
|
|
|
else
|
|
|
|
gimple_seq_set_last (i->seq, last);
|
|
|
|
first->prev = cur;
|
|
|
|
cur->next = first;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gcc_assert (!gimple_seq_last (i->seq));
|
|
|
|
gimple_seq_set_first (i->seq, first);
|
|
|
|
gimple_seq_set_last (i->seq, last);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the iterator, if requested. */
|
|
|
|
switch (m)
|
|
|
|
{
|
|
|
|
case GSI_NEW_STMT:
|
|
|
|
i->ptr = first;
|
|
|
|
break;
|
|
|
|
case GSI_CONTINUE_LINKING:
|
|
|
|
i->ptr = last;
|
|
|
|
break;
|
|
|
|
case GSI_SAME_STMT:
|
|
|
|
gcc_assert (cur);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
gcc_unreachable ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Links sequence SEQ after the statement pointed-to by iterator I.
|
|
|
|
MODE is as in gsi_insert_after.
|
|
|
|
|
|
|
|
This function does not scan for new operands. It is provided for
|
|
|
|
the use of the gimplifier, which manipulates statements for which
|
|
|
|
def/use information has not yet been constructed. Most callers
|
|
|
|
should use gsi_insert_seq_after. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_seq_after_without_update (gimple_stmt_iterator *i, gimple_seq seq,
|
|
|
|
enum gsi_iterator_update mode)
|
|
|
|
{
|
|
|
|
gimple_seq_node first, last;
|
|
|
|
|
|
|
|
if (seq == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Don't allow inserting a sequence into itself. */
|
|
|
|
gcc_assert (seq != i->seq);
|
|
|
|
|
|
|
|
first = gimple_seq_first (seq);
|
|
|
|
last = gimple_seq_last (seq);
|
|
|
|
|
|
|
|
gimple_seq_set_first (seq, NULL);
|
|
|
|
gimple_seq_set_last (seq, NULL);
|
|
|
|
gimple_seq_free (seq);
|
|
|
|
|
|
|
|
/* Empty sequences need no work. */
|
|
|
|
if (!first || !last)
|
|
|
|
{
|
|
|
|
gcc_assert (first == last);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gsi_insert_seq_nodes_after (i, first, last, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Links sequence SEQ after the statement pointed-to by iterator I.
|
|
|
|
MODE is as in gsi_insert_after. Scan the statements in SEQ
|
|
|
|
for new operands. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_seq_after (gimple_stmt_iterator *i, gimple_seq seq,
|
|
|
|
enum gsi_iterator_update mode)
|
|
|
|
{
|
|
|
|
update_modified_stmts (seq);
|
|
|
|
gsi_insert_seq_after_without_update (i, seq, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Move all statements in the sequence after I to a new sequence.
|
|
|
|
Return this new sequence. */
|
|
|
|
|
|
|
|
gimple_seq
|
|
|
|
gsi_split_seq_after (gimple_stmt_iterator i)
|
|
|
|
{
|
|
|
|
gimple_seq_node cur, next;
|
|
|
|
gimple_seq old_seq, new_seq;
|
|
|
|
|
|
|
|
cur = i.ptr;
|
|
|
|
|
|
|
|
/* How can we possibly split after the end, or before the beginning? */
|
|
|
|
gcc_assert (cur && cur->next);
|
|
|
|
next = cur->next;
|
|
|
|
|
|
|
|
old_seq = i.seq;
|
|
|
|
new_seq = gimple_seq_alloc ();
|
|
|
|
|
|
|
|
gimple_seq_set_first (new_seq, next);
|
|
|
|
gimple_seq_set_last (new_seq, gimple_seq_last (old_seq));
|
|
|
|
gimple_seq_set_last (old_seq, cur);
|
|
|
|
cur->next = NULL;
|
|
|
|
next->prev = NULL;
|
|
|
|
|
|
|
|
return new_seq;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Move all statements in the sequence before I to a new sequence.
|
|
|
|
Return this new sequence. I is set to the head of the new list. */
|
|
|
|
|
|
|
|
gimple_seq
|
|
|
|
gsi_split_seq_before (gimple_stmt_iterator *i)
|
|
|
|
{
|
|
|
|
gimple_seq_node cur, prev;
|
|
|
|
gimple_seq old_seq, new_seq;
|
|
|
|
|
|
|
|
cur = i->ptr;
|
|
|
|
|
|
|
|
/* How can we possibly split after the end? */
|
|
|
|
gcc_assert (cur);
|
|
|
|
prev = cur->prev;
|
|
|
|
|
|
|
|
old_seq = i->seq;
|
|
|
|
new_seq = gimple_seq_alloc ();
|
|
|
|
i->seq = new_seq;
|
|
|
|
|
|
|
|
/* Set the limits on NEW_SEQ. */
|
|
|
|
gimple_seq_set_first (new_seq, cur);
|
|
|
|
gimple_seq_set_last (new_seq, gimple_seq_last (old_seq));
|
|
|
|
|
|
|
|
/* Cut OLD_SEQ before I. */
|
|
|
|
gimple_seq_set_last (old_seq, prev);
|
|
|
|
cur->prev = NULL;
|
|
|
|
if (prev)
|
|
|
|
prev->next = NULL;
|
|
|
|
else
|
|
|
|
gimple_seq_set_first (old_seq, NULL);
|
|
|
|
|
|
|
|
return new_seq;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Replace the statement pointed-to by GSI to STMT. If UPDATE_EH_INFO
|
|
|
|
is true, the exception handling information of the original
|
2009-10-12 20:58:38 +02:00
|
|
|
statement is moved to the new statement. Assignments must only be
|
|
|
|
replaced with assignments to the same LHS. */
|
2008-07-28 16:33:56 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
gsi_replace (gimple_stmt_iterator *gsi, gimple stmt, bool update_eh_info)
|
|
|
|
{
|
|
|
|
gimple orig_stmt = gsi_stmt (*gsi);
|
|
|
|
|
|
|
|
if (stmt == orig_stmt)
|
|
|
|
return;
|
|
|
|
|
2009-10-12 20:58:38 +02:00
|
|
|
gcc_assert (!gimple_has_lhs (orig_stmt)
|
|
|
|
|| gimple_get_lhs (orig_stmt) == gimple_get_lhs (stmt));
|
|
|
|
|
2008-07-28 16:33:56 +02:00
|
|
|
gimple_set_location (stmt, gimple_location (orig_stmt));
|
|
|
|
gimple_set_bb (stmt, gsi_bb (*gsi));
|
|
|
|
|
|
|
|
/* Preserve EH region information from the original statement, if
|
|
|
|
requested by the caller. */
|
|
|
|
if (update_eh_info)
|
2009-09-14 21:18:58 +02:00
|
|
|
maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);
|
2008-07-28 16:33:56 +02:00
|
|
|
|
|
|
|
gimple_duplicate_stmt_histograms (cfun, stmt, cfun, orig_stmt);
|
2010-06-22 20:21:25 +02:00
|
|
|
|
|
|
|
/* Free all the data flow information for ORIG_STMT. */
|
|
|
|
gimple_set_bb (orig_stmt, NULL);
|
2008-07-28 16:33:56 +02:00
|
|
|
gimple_remove_stmt_histograms (cfun, orig_stmt);
|
|
|
|
delink_stmt_imm_use (orig_stmt);
|
2010-06-22 20:21:25 +02:00
|
|
|
|
2008-07-28 16:33:56 +02:00
|
|
|
*gsi_stmt_ptr (gsi) = stmt;
|
|
|
|
gimple_set_modified (stmt, true);
|
|
|
|
update_modified_stmt (stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert statement STMT before the statement pointed-to by iterator I.
|
|
|
|
M specifies how to update iterator I after insertion (see enum
|
|
|
|
gsi_iterator_update).
|
|
|
|
|
|
|
|
This function does not scan for new operands. It is provided for
|
|
|
|
the use of the gimplifier, which manipulates statements for which
|
|
|
|
def/use information has not yet been constructed. Most callers
|
|
|
|
should use gsi_insert_before. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_before_without_update (gimple_stmt_iterator *i, gimple stmt,
|
|
|
|
enum gsi_iterator_update m)
|
|
|
|
{
|
|
|
|
gimple_seq_node n;
|
|
|
|
|
utils.c (init_gnat_to_gnu): Use typed GC allocation.
gcc/ada:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC
allocation.
(init_dummy_type): Likewise.
(gnat_pushlevel): Likewise.
* gcc-interface/trans.c (Attribute_to_gnu): Likewise.
(Subprogram_Body_to_gnu): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(start_stmt_group): Likewise.
(extract_encoding): Likewise.
(decode_name): Likewise.
* gcc-interface/misc.c (gnat_printable_name): Likewise.
* gcc-interface/decl.c (annotate_value): Likewise.
* gcc-interface/ada-tree.h (struct lang_type): Add variable_size
GTY option.
(struct lang_decl): Likewise.
(SET_TYPE_LANG_SPECIFIC): Use typed GC allocation.
(SET_DECL_LANG_SPECIFIC): Likewise.
gcc/c-family:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* c-pragma.c (push_alignment): Use typed GC allocation.
(handle_pragma_push_options): Likewise.
* c-common.c (parse_optimize_options): Likewise.
* c-common.h (struct sorted_fields_type): Add variable_size GTY
option.
gcc/cp:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* typeck2.c (abstract_virtuals_error): Likewise.
* pt.c (maybe_process_partial_specialization): Likewise.
(register_specialization): Likewise.
(add_pending_template): Likewise.
(lookup_template_class): Likewise.
(push_tinst_level): Likewise.
* parser.c (cp_lexer_new_main): Likewise.
(cp_lexer_new_from_tokens): Likewise.
(cp_token_cache_new): Likewise.
(cp_parser_context_new): Likewise.
(cp_parser_new): Likewise.
(cp_parser_nested_name_specifier_opt): Likewise.
(cp_parser_template_id): Likewise.
* name-lookup.c (binding_entry_make): Likewise.
(binding_table_construct): Likewise.
(binding_table_new): Likewise.
(cxx_binding_make): Likewise.
(pushdecl_maybe_friend): Likewise.
(begin_scope): Likewise.
(push_to_top_level): Likewise.
* lex.c (init_reswords): Likewise.
(retrofit_lang_decl): Likewise.
(cxx_dup_lang_specific_decl): Likewise.
(copy_lang_type): Likewise.
(cxx_make_type): Likewise.
* decl.c (make_label_decl): Likewise.
(check_goto): Likewise.
(start_preparsed_function): Likewise.
(save_function_data): Likewise.
* cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise.
* cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise.
* class.c (finish_struct_1): Likewise.
* cp-tree.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
* parser.c (cp_parser_new): Update comment to not reference
ggc_alloc.
gcc/fortran:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* trans-types.c (gfc_get_nodesc_array_type): Use typed GC
allocation.
(gfc_get_array_type_bounds): Likewise.
* trans-decl.c (gfc_allocate_lang_decl): Likewise.
(gfc_find_module): Likewise.
* f95-lang.c (pushlevel): Likewise.
* trans.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
gcc/java:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation.
* jcf-parse.c (java_parse_file): Likewise.
(process_zip_dir): Likewise.
* java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise.
(MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.
* expr.c (add_type_assertion): Likewise.
* decl.c (make_binding_level): Likewise.
(java_dup_lang_specific_decl): Likewise.
* constants.c (set_constant_entry): Likewise.
(cpool_for_class): Likewise.
* class.c (add_method_1): Likewise.
(java_treetreehash_new): Likewise.
* java-tree.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
* jch.h (struct cpool_entry): Likewise.
* java-tree.h (java_treetreehash_create): Remove parameter ggc.
* except.c (prepare_eh_table_type): Update
java_treetreehash_create call.
* class.c (add_method_1): Update java_treetreehash_create call.
(java_treetreehash_create): Remove parameter gc. Use
htab_create_ggc.
gcc/lto:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* lto.c (lto_read_in_decl_state): Use typed GC allocation.
(lto_file_read): Likewise.
(new_partition): Likewise.
(read_cgraph_and_symbols): Likewise.
gcc/objc:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
allocation.
* objc-act.c (objc_volatilize_decl): Likewise.
(objc_build_string_object): Likewise.
(hash_init): Likewise.
(hash_enter): Likewise.
(hash_add_attr): Likewise.
(add_class): Likewise.
(start_class): Likewise.
gcc/objcp:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
allocation.
gcc:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* doc/tm.texi (Per-Function Data): Do not reference ggc_alloc.
* doc/gty.texi (GTY Options): Document typed GC allocation and
variable_size GTY option.
* ggc-internal.h: New.
* ggc.h: Update copyright year.
(digit_string): Move to stringpool.c.
(ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots)
(gt_pch_save_stringpool, gt_pch_fixup_stringpool)
(gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object)
(init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size)
(ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write)
(ggc_pch_write_object, ggc_pch_finish, ggc_pch_read)
(ggc_force_collect, ggc_get_size, ggc_statistics)
(ggc_print_common_statistics): Move to ggc-internal.h.
(digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat)
(ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW)
(GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec)
(ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic)
(ggc_min_heapsize_heuristic, ggc_alloc_zone)
(ggc_alloc_zone_pass_stat): Remove.
(ggc_internal_alloc_stat, ggc_internal_alloc)
(ggc_internal_cleared_alloc_stat): New.
(GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine.
(ggc_internal_vec_alloc_stat)
(ggc_internal_cleared_vec_alloc_stat)
(ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc)
(ggc_alloc_atomic_stat, ggc_alloc_atomic)
(ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args)
(ggc_cleared_alloc_ptr_array_two_args): New.
(htab_create_ggc, splay_tree_new_ggc): Redefine.
(ggc_splay_alloc): Change the type of the first argument to
enum gt_types_enum.
(ggc_alloc_string): Make macro.
(ggc_alloc_string_stat): New.
(ggc_strdup): Redefine.
(rtl_zone, tree_zone, tree_id_zone): Declare unconditionally.
(ggc_alloc_rtvec_sized): New.
(ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat.
(ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat)
(ggc_internal_cleared_alloc_zone_stat)
(ggc_internal_zone_alloc_stat)
(ggc_internal_zone_cleared_alloc_stat)
(ggc_internal_zone_vec_alloc_stat)
(ggc_alloc_zone_rtx_def_stat)
(ggc_alloc_zone_tree_node_stat)
(ggc_alloc_zone_cleared_tree_node_stat)
(ggc_alloc_cleared_gimple_statement_d_stat): New.
* ggc-common.c: Include ggc-internal.h.
(ggc_internal_cleared_alloc_stat): Rename from
ggc_alloc_cleared_stat.
(ggc_realloc_stat): Use ggc_internal_alloc_stat.
(ggc_calloc): Remove.
(ggc_cleared_alloc_htab_ignore_args): New.
(ggc_cleared_alloc_ptr_array_two_args): New.
(ggc_splay_alloc): Add obj_type parameter.
(init_ggc_heuristics): Formatting fixes.
* ggc-none.c: Update copyright year.
(ggc_alloc_stat): Rename to ggc_alloc_stat.
(ggc_alloc_cleared_stat): Rename to
ggc_internal_cleared_alloc_stat.
(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
* ggc-page.c: Update copyright year. Include ggc-internal.h.
Remove references to ggc_alloc in comments.
(ggc_alloc_typed_stat): Call ggc_internal_alloc_stat.
(ggc_alloc_stat): Rename to ggc_internal_alloc_stat.
(new_ggc_zone, destroy_ggc_zone): Remove.
(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
* ggc-zone.c: Include ggc-internal.h. Remove references to
ggc_alloc in comments.
(ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat.
(ggc_internal_alloc_zone_pass_stat): New.
(ggc_internal_cleared_alloc_zone_stat): New.
(ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat.
(ggc_alloc_stat): Rename ggc_internal_alloc_stat.
(new_ggc_zone, destroy_ggc_zone): Remove.
* stringpool.c: Update copyright year. Include ggc-internal.h
(digit_vector): Make static.
(digit_string): Moved from ggc.h.
(stringpool_ggc_alloc): Use ggc_alloc_atomic.
(ggc_alloc_string): Rename to ggc_alloc_string_stat.
* Makefile.in (GGC_INTERNAL_H): New.
(ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add
$(GGC_INTERNAL_H) to dependencies.
* gentype.c: Update copyright year.
(walk_type): Accept variable_size GTY option.
(USED_BY_TYPED_GC_P): New macro.
(write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output
whitespace at the end of strings.
(get_type_specifier, variable_size_p): New functions.
(alloc_quantity, alloc_zone): New enums.
(write_typed_alloc_def): New function.
(write_typed_struct_alloc_def): Likewise.
(write_typed_typed_typedef_alloc_def): Likewise.
(write_typed_alloc_defns): Likewise.
(output_typename, write_splay_tree_allocator_def): Likewise.
(write_splay_tree_allocators): Likewise.
(main): Call write_typed_alloc_defns and
write_splay_tree_allocators.
* lto-streamer.h (lto_file_decl_data_ptr): New.
* passes.c (order): Define using cgraph_node_ptr.
* strinpool.c (struct string_pool_data): Declare nested_ptr using
ht_identifier_ptr.
* gimple.h (union gimple_statement_d): Likewise.
* rtl.h (struct rtx_def): Likewise.
(struct rtvec_def): Likewise.
* tree.h (union tree_node): Likewise.
* tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise.
* cfgloop.c (record_loop_exits): Use htab_create_ggc.
* tree-scalar-evolution.c (scev_initialize): Likewise.
* alias.c (record_alias_subset): Update splay_tree_new_ggc call.
* dwarf2asm.c (dw2_force_const_mem): Likewise.
* omp-low.c (lower_omp_critical): Likewise.
* bitmap.h (struct bitmap_head_def): Update comment to not
reference ggc_alloc.
* config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC.
* ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC.
* ipa-prop.c (duplicate_ggc_array): Rename to
duplicate_ipa_jump_func_array. Use typed GC allocation.
(ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array.
* gimple.c (gimple_alloc_stat): Use
ggc_alloc_cleared_gimple_statement_d_stat.
* varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def.
* tree.c (make_node_stat): Use
ggc_alloc_zone_cleared_tree_node_stat.
(make_tree_vec_stat): Likewise.
(build_vl_exp_stat): Likewise.
(copy_node_stat): Use ggc_alloc_zone_tree_node_stat.
(make_tree_binfo_stat): Likewise.
(tree_cons_stat): Likewise.
* rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat.
(shallow_copy_rtx_stat): Likewise.
(make_node_stat): Likewise.
* lto-symtab.c: Fix comment.
* tree-cfg.c (create_bb): Update comment to not reference
ggc_alloc_cleared.
* tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is
value.
* varpool.c (varpool_node): Use typed GC allocation.
(varpool_extra_name_alias): Likewise.
* varasm.c (emutls_decl): Likewise.
(get_unnamed_section): Likewise.
(get_noswitch_section): Likewise.
(get_section): Likewise.
(get_block_for_section): Likewise.
(build_constant_desc): Likewise.
(create_constant_pool): Likewise.
(force_const_mem): Likewise.
* tree.c (build_vl_exp_stat): Likewise.
(build_real): Likewise.
(build_string): Likewise.
(decl_debug_expr_insert): Likewise.
(decl_value_expr_insert): Likewise.
(type_hash_add): Likewise.
(build_omp_clause): Likewise.
* tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise.
* tree-ssa.c (init_tree_ssa): Likewise.
* tree-ssa-structalias.c (heapvar_insert): Likewise.
* tree-ssa-operands.c (ssa_operand_alloc): Likewise.
* tree-ssa-loop-niter.c (record_estimate): Likewise.
* tree-ssa-alias.c (get_ptr_info): Likewise.
* tree-scalar-evolution.c (new_scev_info_str): Likewise.
* tree-phinodes.c (allocate_phi_node): Likewise.
* tree-iterator.c (tsi_link_before): Likewise.
(tsi_link_after): Likewise.
* tree-eh.c (add_stmt_to_eh_lp_fn): Likewise.
* tree-dfa.c (create_var_ann): Likewise.
* tree-cfg.c (create_bb): Likewise.
* toplev.c (alloc_for_identifier_to_locale): Likewise.
(general_init): Likewise.
* stringpool.c (stringpool_ggc_alloc): Likewise.
(gt_pch_save_stringpool): Likewise.
* sese.c (if_region_set_false_region): Likewise.
* passes.c (do_per_function_toporder): Likewise.
* optabs.c (set_optab_libfunc): Likewise.
(set_conv_libfunc): Likewise.
* lto-symtab.c (lto_symtab_register_decl): Likewise.
* lto-streamer-in.c (lto_input_eh_catch_list): Likewise.
(input_eh_region): Likewise.
(input_eh_lp): Likewise.
(make_new_block): Likewise.
(unpack_ts_real_cst_value_fields): Likewise.
* lto-section-in.c (lto_new_in_decl_state): Likewise.
* lto-cgraph.c (input_node_opt_summary): Likewise.
* loop-init.c (loop_optimizer_init): Likewise.
* lambda.h (lambda_vector_new): Likewise.
* lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise.
* ira.c (update_equiv_regs): Likewise.
* ipa.c (cgraph_node_set_new): Likewise.
(cgraph_node_set_add): Likewise.
(varpool_node_set_new): Likewise.
(varpool_node_set_add): Likewise.
* ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
(duplicate_ipa_jump_func_array): Likewise.
(ipa_read_node_info): Likewise.
* ipa-cp.c (ipcp_create_replace_map): Likewise.
* integrate.c (get_hard_reg_initial_val): Likewise.
* gimple.c (gimple_alloc_stat): Likewise.
(gimple_build_omp_for): Likewise.
(gimple_seq_alloc): Likewise.
(gimple_copy): Likewise.
* gimple-iterator.c (gsi_insert_before_without_update): Likewise.
(gsi_insert_after_without_update): Likewise.
* function.c (add_frame_space): Likewise.
(insert_temp_slot_address): Likewise.
(assign_stack_temp_for_type): Likewise.
(allocate_struct_function): Likewise.
(types_used_by_var_decl_insert): Likewise.
* except.c (init_eh_for_function): Likewise.
(gen_eh_region): Likewise.
(gen_eh_region_catch): Likewise.
(gen_eh_landing_pad): Likewise.
(add_call_site): Likewise.
* emit-rtl.c (get_mem_attrs): Likewise.
(get_reg_attrs): Likewise.
(start_sequence): Likewise.
(init_emit): Likewise.
* dwarf2out.c (new_cfi): Likewise.
(queue_reg_save): Likewise.
(dwarf2out_frame_init): Likewise.
(new_loc_descr): Likewise.
(find_AT_string): Likewise.
(new_die): Likewise.
(add_var_loc_to_decl): Likewise.
(clone_die): Likewise.
(clone_as_declaration): Likewise.
(break_out_comdat_types): Likewise.
(new_loc_list): Likewise.
(loc_descriptor): Likewise.
(add_loc_descr_to_each): Likewise.
(add_const_value_attribute): Likewise.
(tree_add_const_value_attribute): Likewise.
(add_comp_dir_attribute): Likewise.
(add_name_and_src_coords_attributes): Likewise.
(lookup_filename): Likewise.
(store_vcall_insn): Likewise.
(dwarf2out_init): Likewise.
* dbxout.c (dbxout_init): Likewise.
* config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.
* config/sparc/sparc.c (sparc_init_machine_status): Likewise.
* config/score/score7.c (score7_output_external): Likewise.
* config/score/score3.c (score3_output_external): Likewise.
* config/s390/s390.c (s390_init_machine_status): Likewise.
* config/rs6000/rs6000.c (builtin_function_type): Likewise.
(rs6000_init_machine_status): Likewise.
(output_toc): Likewise.
* config/pa/pa.c (pa_init_machine_status): Likewise.
(get_deferred_plabel): Likewise.
* config/moxie/moxie.c (moxie_init_machine_status): Likewise.
* config/mmix/mmix.c (mmix_init_machine_status): Likewise.
* config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise.
* config/mep/mep.c (mep_init_machine_status): Likewise.
(mep_note_pragma_flag): Likewise.
* config/m32c/m32c.c (m32c_init_machine_status): Likewise.
* config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise.
* config/ia64/ia64.c (ia64_init_machine_status): Likewise.
* config/i386/winnt.c (i386_pe_record_external_function): Likewise.
(i386_pe_maybe_record_exported_symbol): Likewise.
* config/i386/i386.c (get_dllimport_decl): Likewise.
(ix86_init_machine_status): Likewise.
(assign_386_stack_local): Likewise.
* config/frv/frv.c (frv_init_machine_status): Likewise.
* config/darwin.c (machopic_indirection_name): Likewise.
* config/cris/cris.c (cris_init_machine_status): Likewise.
* config/bfin/bfin.c (bfin_init_machine_status): Likewise.
* config/avr/avr.c (avr_init_machine_status): Likewise.
* config/arm/arm.c (arm_init_machine_status): Likewise.
* config/alpha/alpha.c (alpha_init_machine_status): Likewise.
(alpha_need_linkage): Likewise.
(alpha_use_linkage): Likewise.
* cgraph.c (cgraph_allocate_node): Likewise.
(cgraph_create_edge_1): Likewise.
(cgraph_create_indirect_edge): Likewise.
(cgraph_add_asm_node): Likewise.
* cfgrtl.c (init_rtl_bb_info): Likewise.
* cfgloop.c (alloc_loop): Likewise.
(rescan_loop_exit): Likewise.
* cfg.c (init_flow): Likewise.
(alloc_block): Likewise.
(unchecked_make_edge): Likewise.
* c-parser.c (c_parse_init): Likewise.
(c_parse_file): Likewise.
* c-decl.c (bind): Likewise.
(record_inline_static): Likewise.
(push_scope): Likewise.
(make_label): Likewise.
(lookup_label_for_goto): Likewise.
(finish_struct): Likewise.
(finish_enum): Likewise.
(c_push_function_context): Likewise.
* bitmap.c (bitmap_element_allocate): Likewise.
(bitmap_gc_alloc_stat): Likewise.
* alias.c (record_alias_subset): Likewise.
(init_alias_analysis): Likewise.
include:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* splay-tree.h: Update copyright years.
(splay_tree_s): Document fields.
(splay_tree_new_typed_alloc): New.
* hashtab.h: Update copyright years.
(htab_create_typed_alloc): New.
libcpp:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* include/symtab.h (ht_identifier_ptr): New.
libiberty:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* splay-tree.c: Update copyright years.
(splay_tree_new_typed_alloc): New.
(splay_tree_new_with_allocator): Use it.
* hashtab.c: Update copyright years.
(htab_create_typed_alloc): New.
(htab_create_alloc): Use it.
* functions.texi: Regenerate.
From-SVN: r160425
2010-06-08 09:25:24 +02:00
|
|
|
n = ggc_alloc_gimple_seq_node_d ();
|
2008-07-28 16:33:56 +02:00
|
|
|
n->prev = n->next = NULL;
|
|
|
|
n->stmt = stmt;
|
|
|
|
gsi_insert_seq_nodes_before (i, n, n, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Insert statement STMT before the statement pointed-to by iterator I.
|
|
|
|
Update STMT's basic block and scan it for new operands. M
|
|
|
|
specifies how to update iterator I after insertion (see enum
|
|
|
|
gsi_iterator_update). */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_before (gimple_stmt_iterator *i, gimple stmt,
|
|
|
|
enum gsi_iterator_update m)
|
|
|
|
{
|
|
|
|
update_modified_stmt (stmt);
|
|
|
|
gsi_insert_before_without_update (i, stmt, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert statement STMT after the statement pointed-to by iterator I.
|
|
|
|
M specifies how to update iterator I after insertion (see enum
|
|
|
|
gsi_iterator_update).
|
|
|
|
|
|
|
|
This function does not scan for new operands. It is provided for
|
|
|
|
the use of the gimplifier, which manipulates statements for which
|
|
|
|
def/use information has not yet been constructed. Most callers
|
|
|
|
should use gsi_insert_after. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_after_without_update (gimple_stmt_iterator *i, gimple stmt,
|
|
|
|
enum gsi_iterator_update m)
|
|
|
|
{
|
|
|
|
gimple_seq_node n;
|
|
|
|
|
utils.c (init_gnat_to_gnu): Use typed GC allocation.
gcc/ada:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC
allocation.
(init_dummy_type): Likewise.
(gnat_pushlevel): Likewise.
* gcc-interface/trans.c (Attribute_to_gnu): Likewise.
(Subprogram_Body_to_gnu): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(start_stmt_group): Likewise.
(extract_encoding): Likewise.
(decode_name): Likewise.
* gcc-interface/misc.c (gnat_printable_name): Likewise.
* gcc-interface/decl.c (annotate_value): Likewise.
* gcc-interface/ada-tree.h (struct lang_type): Add variable_size
GTY option.
(struct lang_decl): Likewise.
(SET_TYPE_LANG_SPECIFIC): Use typed GC allocation.
(SET_DECL_LANG_SPECIFIC): Likewise.
gcc/c-family:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* c-pragma.c (push_alignment): Use typed GC allocation.
(handle_pragma_push_options): Likewise.
* c-common.c (parse_optimize_options): Likewise.
* c-common.h (struct sorted_fields_type): Add variable_size GTY
option.
gcc/cp:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* typeck2.c (abstract_virtuals_error): Likewise.
* pt.c (maybe_process_partial_specialization): Likewise.
(register_specialization): Likewise.
(add_pending_template): Likewise.
(lookup_template_class): Likewise.
(push_tinst_level): Likewise.
* parser.c (cp_lexer_new_main): Likewise.
(cp_lexer_new_from_tokens): Likewise.
(cp_token_cache_new): Likewise.
(cp_parser_context_new): Likewise.
(cp_parser_new): Likewise.
(cp_parser_nested_name_specifier_opt): Likewise.
(cp_parser_template_id): Likewise.
* name-lookup.c (binding_entry_make): Likewise.
(binding_table_construct): Likewise.
(binding_table_new): Likewise.
(cxx_binding_make): Likewise.
(pushdecl_maybe_friend): Likewise.
(begin_scope): Likewise.
(push_to_top_level): Likewise.
* lex.c (init_reswords): Likewise.
(retrofit_lang_decl): Likewise.
(cxx_dup_lang_specific_decl): Likewise.
(copy_lang_type): Likewise.
(cxx_make_type): Likewise.
* decl.c (make_label_decl): Likewise.
(check_goto): Likewise.
(start_preparsed_function): Likewise.
(save_function_data): Likewise.
* cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise.
* cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise.
* class.c (finish_struct_1): Likewise.
* cp-tree.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
* parser.c (cp_parser_new): Update comment to not reference
ggc_alloc.
gcc/fortran:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* trans-types.c (gfc_get_nodesc_array_type): Use typed GC
allocation.
(gfc_get_array_type_bounds): Likewise.
* trans-decl.c (gfc_allocate_lang_decl): Likewise.
(gfc_find_module): Likewise.
* f95-lang.c (pushlevel): Likewise.
* trans.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
gcc/java:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation.
* jcf-parse.c (java_parse_file): Likewise.
(process_zip_dir): Likewise.
* java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise.
(MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.
* expr.c (add_type_assertion): Likewise.
* decl.c (make_binding_level): Likewise.
(java_dup_lang_specific_decl): Likewise.
* constants.c (set_constant_entry): Likewise.
(cpool_for_class): Likewise.
* class.c (add_method_1): Likewise.
(java_treetreehash_new): Likewise.
* java-tree.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
* jch.h (struct cpool_entry): Likewise.
* java-tree.h (java_treetreehash_create): Remove parameter ggc.
* except.c (prepare_eh_table_type): Update
java_treetreehash_create call.
* class.c (add_method_1): Update java_treetreehash_create call.
(java_treetreehash_create): Remove parameter gc. Use
htab_create_ggc.
gcc/lto:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* lto.c (lto_read_in_decl_state): Use typed GC allocation.
(lto_file_read): Likewise.
(new_partition): Likewise.
(read_cgraph_and_symbols): Likewise.
gcc/objc:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
allocation.
* objc-act.c (objc_volatilize_decl): Likewise.
(objc_build_string_object): Likewise.
(hash_init): Likewise.
(hash_enter): Likewise.
(hash_add_attr): Likewise.
(add_class): Likewise.
(start_class): Likewise.
gcc/objcp:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
allocation.
gcc:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* doc/tm.texi (Per-Function Data): Do not reference ggc_alloc.
* doc/gty.texi (GTY Options): Document typed GC allocation and
variable_size GTY option.
* ggc-internal.h: New.
* ggc.h: Update copyright year.
(digit_string): Move to stringpool.c.
(ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots)
(gt_pch_save_stringpool, gt_pch_fixup_stringpool)
(gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object)
(init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size)
(ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write)
(ggc_pch_write_object, ggc_pch_finish, ggc_pch_read)
(ggc_force_collect, ggc_get_size, ggc_statistics)
(ggc_print_common_statistics): Move to ggc-internal.h.
(digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat)
(ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW)
(GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec)
(ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic)
(ggc_min_heapsize_heuristic, ggc_alloc_zone)
(ggc_alloc_zone_pass_stat): Remove.
(ggc_internal_alloc_stat, ggc_internal_alloc)
(ggc_internal_cleared_alloc_stat): New.
(GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine.
(ggc_internal_vec_alloc_stat)
(ggc_internal_cleared_vec_alloc_stat)
(ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc)
(ggc_alloc_atomic_stat, ggc_alloc_atomic)
(ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args)
(ggc_cleared_alloc_ptr_array_two_args): New.
(htab_create_ggc, splay_tree_new_ggc): Redefine.
(ggc_splay_alloc): Change the type of the first argument to
enum gt_types_enum.
(ggc_alloc_string): Make macro.
(ggc_alloc_string_stat): New.
(ggc_strdup): Redefine.
(rtl_zone, tree_zone, tree_id_zone): Declare unconditionally.
(ggc_alloc_rtvec_sized): New.
(ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat.
(ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat)
(ggc_internal_cleared_alloc_zone_stat)
(ggc_internal_zone_alloc_stat)
(ggc_internal_zone_cleared_alloc_stat)
(ggc_internal_zone_vec_alloc_stat)
(ggc_alloc_zone_rtx_def_stat)
(ggc_alloc_zone_tree_node_stat)
(ggc_alloc_zone_cleared_tree_node_stat)
(ggc_alloc_cleared_gimple_statement_d_stat): New.
* ggc-common.c: Include ggc-internal.h.
(ggc_internal_cleared_alloc_stat): Rename from
ggc_alloc_cleared_stat.
(ggc_realloc_stat): Use ggc_internal_alloc_stat.
(ggc_calloc): Remove.
(ggc_cleared_alloc_htab_ignore_args): New.
(ggc_cleared_alloc_ptr_array_two_args): New.
(ggc_splay_alloc): Add obj_type parameter.
(init_ggc_heuristics): Formatting fixes.
* ggc-none.c: Update copyright year.
(ggc_alloc_stat): Rename to ggc_alloc_stat.
(ggc_alloc_cleared_stat): Rename to
ggc_internal_cleared_alloc_stat.
(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
* ggc-page.c: Update copyright year. Include ggc-internal.h.
Remove references to ggc_alloc in comments.
(ggc_alloc_typed_stat): Call ggc_internal_alloc_stat.
(ggc_alloc_stat): Rename to ggc_internal_alloc_stat.
(new_ggc_zone, destroy_ggc_zone): Remove.
(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
* ggc-zone.c: Include ggc-internal.h. Remove references to
ggc_alloc in comments.
(ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat.
(ggc_internal_alloc_zone_pass_stat): New.
(ggc_internal_cleared_alloc_zone_stat): New.
(ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat.
(ggc_alloc_stat): Rename ggc_internal_alloc_stat.
(new_ggc_zone, destroy_ggc_zone): Remove.
* stringpool.c: Update copyright year. Include ggc-internal.h
(digit_vector): Make static.
(digit_string): Moved from ggc.h.
(stringpool_ggc_alloc): Use ggc_alloc_atomic.
(ggc_alloc_string): Rename to ggc_alloc_string_stat.
* Makefile.in (GGC_INTERNAL_H): New.
(ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add
$(GGC_INTERNAL_H) to dependencies.
* gentype.c: Update copyright year.
(walk_type): Accept variable_size GTY option.
(USED_BY_TYPED_GC_P): New macro.
(write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output
whitespace at the end of strings.
(get_type_specifier, variable_size_p): New functions.
(alloc_quantity, alloc_zone): New enums.
(write_typed_alloc_def): New function.
(write_typed_struct_alloc_def): Likewise.
(write_typed_typed_typedef_alloc_def): Likewise.
(write_typed_alloc_defns): Likewise.
(output_typename, write_splay_tree_allocator_def): Likewise.
(write_splay_tree_allocators): Likewise.
(main): Call write_typed_alloc_defns and
write_splay_tree_allocators.
* lto-streamer.h (lto_file_decl_data_ptr): New.
* passes.c (order): Define using cgraph_node_ptr.
* strinpool.c (struct string_pool_data): Declare nested_ptr using
ht_identifier_ptr.
* gimple.h (union gimple_statement_d): Likewise.
* rtl.h (struct rtx_def): Likewise.
(struct rtvec_def): Likewise.
* tree.h (union tree_node): Likewise.
* tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise.
* cfgloop.c (record_loop_exits): Use htab_create_ggc.
* tree-scalar-evolution.c (scev_initialize): Likewise.
* alias.c (record_alias_subset): Update splay_tree_new_ggc call.
* dwarf2asm.c (dw2_force_const_mem): Likewise.
* omp-low.c (lower_omp_critical): Likewise.
* bitmap.h (struct bitmap_head_def): Update comment to not
reference ggc_alloc.
* config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC.
* ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC.
* ipa-prop.c (duplicate_ggc_array): Rename to
duplicate_ipa_jump_func_array. Use typed GC allocation.
(ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array.
* gimple.c (gimple_alloc_stat): Use
ggc_alloc_cleared_gimple_statement_d_stat.
* varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def.
* tree.c (make_node_stat): Use
ggc_alloc_zone_cleared_tree_node_stat.
(make_tree_vec_stat): Likewise.
(build_vl_exp_stat): Likewise.
(copy_node_stat): Use ggc_alloc_zone_tree_node_stat.
(make_tree_binfo_stat): Likewise.
(tree_cons_stat): Likewise.
* rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat.
(shallow_copy_rtx_stat): Likewise.
(make_node_stat): Likewise.
* lto-symtab.c: Fix comment.
* tree-cfg.c (create_bb): Update comment to not reference
ggc_alloc_cleared.
* tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is
value.
* varpool.c (varpool_node): Use typed GC allocation.
(varpool_extra_name_alias): Likewise.
* varasm.c (emutls_decl): Likewise.
(get_unnamed_section): Likewise.
(get_noswitch_section): Likewise.
(get_section): Likewise.
(get_block_for_section): Likewise.
(build_constant_desc): Likewise.
(create_constant_pool): Likewise.
(force_const_mem): Likewise.
* tree.c (build_vl_exp_stat): Likewise.
(build_real): Likewise.
(build_string): Likewise.
(decl_debug_expr_insert): Likewise.
(decl_value_expr_insert): Likewise.
(type_hash_add): Likewise.
(build_omp_clause): Likewise.
* tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise.
* tree-ssa.c (init_tree_ssa): Likewise.
* tree-ssa-structalias.c (heapvar_insert): Likewise.
* tree-ssa-operands.c (ssa_operand_alloc): Likewise.
* tree-ssa-loop-niter.c (record_estimate): Likewise.
* tree-ssa-alias.c (get_ptr_info): Likewise.
* tree-scalar-evolution.c (new_scev_info_str): Likewise.
* tree-phinodes.c (allocate_phi_node): Likewise.
* tree-iterator.c (tsi_link_before): Likewise.
(tsi_link_after): Likewise.
* tree-eh.c (add_stmt_to_eh_lp_fn): Likewise.
* tree-dfa.c (create_var_ann): Likewise.
* tree-cfg.c (create_bb): Likewise.
* toplev.c (alloc_for_identifier_to_locale): Likewise.
(general_init): Likewise.
* stringpool.c (stringpool_ggc_alloc): Likewise.
(gt_pch_save_stringpool): Likewise.
* sese.c (if_region_set_false_region): Likewise.
* passes.c (do_per_function_toporder): Likewise.
* optabs.c (set_optab_libfunc): Likewise.
(set_conv_libfunc): Likewise.
* lto-symtab.c (lto_symtab_register_decl): Likewise.
* lto-streamer-in.c (lto_input_eh_catch_list): Likewise.
(input_eh_region): Likewise.
(input_eh_lp): Likewise.
(make_new_block): Likewise.
(unpack_ts_real_cst_value_fields): Likewise.
* lto-section-in.c (lto_new_in_decl_state): Likewise.
* lto-cgraph.c (input_node_opt_summary): Likewise.
* loop-init.c (loop_optimizer_init): Likewise.
* lambda.h (lambda_vector_new): Likewise.
* lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise.
* ira.c (update_equiv_regs): Likewise.
* ipa.c (cgraph_node_set_new): Likewise.
(cgraph_node_set_add): Likewise.
(varpool_node_set_new): Likewise.
(varpool_node_set_add): Likewise.
* ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
(duplicate_ipa_jump_func_array): Likewise.
(ipa_read_node_info): Likewise.
* ipa-cp.c (ipcp_create_replace_map): Likewise.
* integrate.c (get_hard_reg_initial_val): Likewise.
* gimple.c (gimple_alloc_stat): Likewise.
(gimple_build_omp_for): Likewise.
(gimple_seq_alloc): Likewise.
(gimple_copy): Likewise.
* gimple-iterator.c (gsi_insert_before_without_update): Likewise.
(gsi_insert_after_without_update): Likewise.
* function.c (add_frame_space): Likewise.
(insert_temp_slot_address): Likewise.
(assign_stack_temp_for_type): Likewise.
(allocate_struct_function): Likewise.
(types_used_by_var_decl_insert): Likewise.
* except.c (init_eh_for_function): Likewise.
(gen_eh_region): Likewise.
(gen_eh_region_catch): Likewise.
(gen_eh_landing_pad): Likewise.
(add_call_site): Likewise.
* emit-rtl.c (get_mem_attrs): Likewise.
(get_reg_attrs): Likewise.
(start_sequence): Likewise.
(init_emit): Likewise.
* dwarf2out.c (new_cfi): Likewise.
(queue_reg_save): Likewise.
(dwarf2out_frame_init): Likewise.
(new_loc_descr): Likewise.
(find_AT_string): Likewise.
(new_die): Likewise.
(add_var_loc_to_decl): Likewise.
(clone_die): Likewise.
(clone_as_declaration): Likewise.
(break_out_comdat_types): Likewise.
(new_loc_list): Likewise.
(loc_descriptor): Likewise.
(add_loc_descr_to_each): Likewise.
(add_const_value_attribute): Likewise.
(tree_add_const_value_attribute): Likewise.
(add_comp_dir_attribute): Likewise.
(add_name_and_src_coords_attributes): Likewise.
(lookup_filename): Likewise.
(store_vcall_insn): Likewise.
(dwarf2out_init): Likewise.
* dbxout.c (dbxout_init): Likewise.
* config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.
* config/sparc/sparc.c (sparc_init_machine_status): Likewise.
* config/score/score7.c (score7_output_external): Likewise.
* config/score/score3.c (score3_output_external): Likewise.
* config/s390/s390.c (s390_init_machine_status): Likewise.
* config/rs6000/rs6000.c (builtin_function_type): Likewise.
(rs6000_init_machine_status): Likewise.
(output_toc): Likewise.
* config/pa/pa.c (pa_init_machine_status): Likewise.
(get_deferred_plabel): Likewise.
* config/moxie/moxie.c (moxie_init_machine_status): Likewise.
* config/mmix/mmix.c (mmix_init_machine_status): Likewise.
* config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise.
* config/mep/mep.c (mep_init_machine_status): Likewise.
(mep_note_pragma_flag): Likewise.
* config/m32c/m32c.c (m32c_init_machine_status): Likewise.
* config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise.
* config/ia64/ia64.c (ia64_init_machine_status): Likewise.
* config/i386/winnt.c (i386_pe_record_external_function): Likewise.
(i386_pe_maybe_record_exported_symbol): Likewise.
* config/i386/i386.c (get_dllimport_decl): Likewise.
(ix86_init_machine_status): Likewise.
(assign_386_stack_local): Likewise.
* config/frv/frv.c (frv_init_machine_status): Likewise.
* config/darwin.c (machopic_indirection_name): Likewise.
* config/cris/cris.c (cris_init_machine_status): Likewise.
* config/bfin/bfin.c (bfin_init_machine_status): Likewise.
* config/avr/avr.c (avr_init_machine_status): Likewise.
* config/arm/arm.c (arm_init_machine_status): Likewise.
* config/alpha/alpha.c (alpha_init_machine_status): Likewise.
(alpha_need_linkage): Likewise.
(alpha_use_linkage): Likewise.
* cgraph.c (cgraph_allocate_node): Likewise.
(cgraph_create_edge_1): Likewise.
(cgraph_create_indirect_edge): Likewise.
(cgraph_add_asm_node): Likewise.
* cfgrtl.c (init_rtl_bb_info): Likewise.
* cfgloop.c (alloc_loop): Likewise.
(rescan_loop_exit): Likewise.
* cfg.c (init_flow): Likewise.
(alloc_block): Likewise.
(unchecked_make_edge): Likewise.
* c-parser.c (c_parse_init): Likewise.
(c_parse_file): Likewise.
* c-decl.c (bind): Likewise.
(record_inline_static): Likewise.
(push_scope): Likewise.
(make_label): Likewise.
(lookup_label_for_goto): Likewise.
(finish_struct): Likewise.
(finish_enum): Likewise.
(c_push_function_context): Likewise.
* bitmap.c (bitmap_element_allocate): Likewise.
(bitmap_gc_alloc_stat): Likewise.
* alias.c (record_alias_subset): Likewise.
(init_alias_analysis): Likewise.
include:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* splay-tree.h: Update copyright years.
(splay_tree_s): Document fields.
(splay_tree_new_typed_alloc): New.
* hashtab.h: Update copyright years.
(htab_create_typed_alloc): New.
libcpp:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* include/symtab.h (ht_identifier_ptr): New.
libiberty:
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* splay-tree.c: Update copyright years.
(splay_tree_new_typed_alloc): New.
(splay_tree_new_with_allocator): Use it.
* hashtab.c: Update copyright years.
(htab_create_typed_alloc): New.
(htab_create_alloc): Use it.
* functions.texi: Regenerate.
From-SVN: r160425
2010-06-08 09:25:24 +02:00
|
|
|
n = ggc_alloc_gimple_seq_node_d ();
|
2008-07-28 16:33:56 +02:00
|
|
|
n->prev = n->next = NULL;
|
|
|
|
n->stmt = stmt;
|
|
|
|
gsi_insert_seq_nodes_after (i, n, n, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert statement STMT after the statement pointed-to by iterator I.
|
|
|
|
Update STMT's basic block and scan it for new operands. M
|
|
|
|
specifies how to update iterator I after insertion (see enum
|
|
|
|
gsi_iterator_update). */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_after (gimple_stmt_iterator *i, gimple stmt,
|
|
|
|
enum gsi_iterator_update m)
|
|
|
|
{
|
|
|
|
update_modified_stmt (stmt);
|
|
|
|
gsi_insert_after_without_update (i, stmt, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Remove the current stmt from the sequence. The iterator is updated
|
|
|
|
to point to the next statement.
|
|
|
|
|
|
|
|
REMOVE_PERMANENTLY is true when the statement is going to be removed
|
|
|
|
from the IL and not reinserted elsewhere. In that case we remove the
|
|
|
|
statement pointed to by iterator I from the EH tables, and free its
|
|
|
|
operand caches. Otherwise we do not modify this information. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_remove (gimple_stmt_iterator *i, bool remove_permanently)
|
|
|
|
{
|
|
|
|
gimple_seq_node cur, next, prev;
|
|
|
|
gimple stmt = gsi_stmt (*i);
|
|
|
|
|
2010-03-06 21:30:10 +01:00
|
|
|
if (gimple_code (stmt) != GIMPLE_PHI)
|
|
|
|
insert_debug_temps_for_defs (i);
|
2009-10-12 20:58:38 +02:00
|
|
|
|
2008-07-28 16:33:56 +02:00
|
|
|
/* Free all the data flow information for STMT. */
|
|
|
|
gimple_set_bb (stmt, NULL);
|
|
|
|
delink_stmt_imm_use (stmt);
|
|
|
|
gimple_set_modified (stmt, true);
|
|
|
|
|
|
|
|
if (remove_permanently)
|
|
|
|
{
|
2009-09-14 21:18:58 +02:00
|
|
|
remove_stmt_from_eh_lp (stmt);
|
2008-07-28 16:33:56 +02:00
|
|
|
gimple_remove_stmt_histograms (cfun, stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the iterator and re-wire the links in I->SEQ. */
|
|
|
|
cur = i->ptr;
|
|
|
|
next = cur->next;
|
|
|
|
prev = cur->prev;
|
|
|
|
|
|
|
|
if (prev)
|
|
|
|
prev->next = next;
|
|
|
|
else
|
|
|
|
gimple_seq_set_first (i->seq, next);
|
|
|
|
|
|
|
|
if (next)
|
|
|
|
next->prev = prev;
|
|
|
|
else
|
|
|
|
gimple_seq_set_last (i->seq, prev);
|
|
|
|
|
|
|
|
i->ptr = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Finds iterator for STMT. */
|
|
|
|
|
|
|
|
gimple_stmt_iterator
|
|
|
|
gsi_for_stmt (gimple stmt)
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator i;
|
|
|
|
basic_block bb = gimple_bb (stmt);
|
|
|
|
|
|
|
|
if (gimple_code (stmt) == GIMPLE_PHI)
|
|
|
|
i = gsi_start_phis (bb);
|
|
|
|
else
|
|
|
|
i = gsi_start_bb (bb);
|
|
|
|
|
|
|
|
for (; !gsi_end_p (i); gsi_next (&i))
|
|
|
|
if (gsi_stmt (i) == stmt)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
gcc_unreachable ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Move the statement at FROM so it comes right after the statement at TO. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_move_after (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
|
|
|
|
{
|
|
|
|
gimple stmt = gsi_stmt (*from);
|
|
|
|
gsi_remove (from, false);
|
|
|
|
|
|
|
|
/* We must have GSI_NEW_STMT here, as gsi_move_after is sometimes used to
|
|
|
|
move statements to an empty block. */
|
|
|
|
gsi_insert_after (to, stmt, GSI_NEW_STMT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Move the statement at FROM so it comes right before the statement
|
|
|
|
at TO. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_move_before (gimple_stmt_iterator *from, gimple_stmt_iterator *to)
|
|
|
|
{
|
|
|
|
gimple stmt = gsi_stmt (*from);
|
|
|
|
gsi_remove (from, false);
|
|
|
|
|
|
|
|
/* For consistency with gsi_move_after, it might be better to have
|
|
|
|
GSI_NEW_STMT here; however, that breaks several places that expect
|
|
|
|
that TO does not change. */
|
|
|
|
gsi_insert_before (to, stmt, GSI_SAME_STMT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Move the statement at FROM to the end of basic block BB. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator last = gsi_last_bb (bb);
|
|
|
|
#ifdef ENABLE_CHECKING
|
|
|
|
gcc_assert (gsi_bb (last) == bb);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Have to check gsi_end_p because it could be an empty block. */
|
|
|
|
if (!gsi_end_p (last) && is_ctrl_stmt (gsi_stmt (last)))
|
|
|
|
gsi_move_before (from, &last);
|
|
|
|
else
|
|
|
|
gsi_move_after (from, &last);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add STMT to the pending list of edge E. No actual insertion is
|
|
|
|
made until a call to gsi_commit_edge_inserts () is made. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_on_edge (edge e, gimple stmt)
|
|
|
|
{
|
|
|
|
gimple_seq_add_stmt (&PENDING_STMT (e), stmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add the sequence of statements SEQ to the pending list of edge E.
|
|
|
|
No actual insertion is made until a call to gsi_commit_edge_inserts
|
|
|
|
is made. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_insert_seq_on_edge (edge e, gimple_seq seq)
|
|
|
|
{
|
|
|
|
gimple_seq_add_seq (&PENDING_STMT (e), seq);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Insert the statement pointed-to by GSI into edge E. Every attempt
|
|
|
|
is made to place the statement in an existing basic block, but
|
|
|
|
sometimes that isn't possible. When it isn't possible, the edge is
|
|
|
|
split and the statement is added to the new block.
|
|
|
|
|
|
|
|
In all cases, the returned *GSI points to the correct location. The
|
|
|
|
return value is true if insertion should be done after the location,
|
2009-06-07 21:29:43 +02:00
|
|
|
or false if it should be done before the location. If a new basic block
|
2008-07-28 16:33:56 +02:00
|
|
|
has to be created, it is stored in *NEW_BB. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
gimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi,
|
|
|
|
basic_block *new_bb)
|
|
|
|
{
|
|
|
|
basic_block dest, src;
|
|
|
|
gimple tmp;
|
|
|
|
|
|
|
|
dest = e->dest;
|
|
|
|
|
|
|
|
/* If the destination has one predecessor which has no PHI nodes,
|
|
|
|
insert there. Except for the exit block.
|
|
|
|
|
|
|
|
The requirement for no PHI nodes could be relaxed. Basically we
|
|
|
|
would have to examine the PHIs to prove that none of them used
|
|
|
|
the value set by the statement we want to insert on E. That
|
|
|
|
hardly seems worth the effort. */
|
2009-09-10 20:01:23 +02:00
|
|
|
restart:
|
2008-07-28 16:33:56 +02:00
|
|
|
if (single_pred_p (dest)
|
2009-09-10 20:01:23 +02:00
|
|
|
&& gimple_seq_empty_p (phi_nodes (dest))
|
2008-07-28 16:33:56 +02:00
|
|
|
&& dest != EXIT_BLOCK_PTR)
|
|
|
|
{
|
|
|
|
*gsi = gsi_start_bb (dest);
|
|
|
|
if (gsi_end_p (*gsi))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* Make sure we insert after any leading labels. */
|
|
|
|
tmp = gsi_stmt (*gsi);
|
|
|
|
while (gimple_code (tmp) == GIMPLE_LABEL)
|
|
|
|
{
|
|
|
|
gsi_next (gsi);
|
|
|
|
if (gsi_end_p (*gsi))
|
|
|
|
break;
|
|
|
|
tmp = gsi_stmt (*gsi);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gsi_end_p (*gsi))
|
|
|
|
{
|
|
|
|
*gsi = gsi_last_bb (dest);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the source has one successor, the edge is not abnormal and
|
|
|
|
the last statement does not end a basic block, insert there.
|
|
|
|
Except for the entry block. */
|
|
|
|
src = e->src;
|
|
|
|
if ((e->flags & EDGE_ABNORMAL) == 0
|
|
|
|
&& single_succ_p (src)
|
|
|
|
&& src != ENTRY_BLOCK_PTR)
|
|
|
|
{
|
|
|
|
*gsi = gsi_last_bb (src);
|
|
|
|
if (gsi_end_p (*gsi))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
tmp = gsi_stmt (*gsi);
|
|
|
|
if (!stmt_ends_bb_p (tmp))
|
|
|
|
return true;
|
|
|
|
|
2009-09-10 20:27:51 +02:00
|
|
|
switch (gimple_code (tmp))
|
|
|
|
{
|
|
|
|
case GIMPLE_RETURN:
|
|
|
|
case GIMPLE_RESX:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
break;
|
2008-07-28 16:33:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, create a new basic block, and split this edge. */
|
|
|
|
dest = split_edge (e);
|
|
|
|
if (new_bb)
|
|
|
|
*new_bb = dest;
|
|
|
|
e = single_pred_edge (dest);
|
|
|
|
goto restart;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Similar to gsi_insert_on_edge+gsi_commit_edge_inserts. If a new
|
|
|
|
block has to be created, it is returned. */
|
|
|
|
|
|
|
|
basic_block
|
|
|
|
gsi_insert_on_edge_immediate (edge e, gimple stmt)
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator gsi;
|
|
|
|
basic_block new_bb = NULL;
|
|
|
|
|
|
|
|
gcc_assert (!PENDING_STMT (e));
|
|
|
|
|
|
|
|
if (gimple_find_edge_insert_loc (e, &gsi, &new_bb))
|
|
|
|
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
|
|
|
|
else
|
|
|
|
gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
|
|
|
|
|
|
|
|
return new_bb;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Insert STMTS on edge E. If a new block has to be created, it
|
|
|
|
is returned. */
|
|
|
|
|
|
|
|
basic_block
|
|
|
|
gsi_insert_seq_on_edge_immediate (edge e, gimple_seq stmts)
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator gsi;
|
|
|
|
basic_block new_bb = NULL;
|
|
|
|
|
|
|
|
gcc_assert (!PENDING_STMT (e));
|
|
|
|
|
|
|
|
if (gimple_find_edge_insert_loc (e, &gsi, &new_bb))
|
|
|
|
gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
|
|
|
|
else
|
|
|
|
gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
|
|
|
|
|
|
|
|
return new_bb;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This routine will commit all pending edge insertions, creating any new
|
|
|
|
basic blocks which are necessary. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_commit_edge_inserts (void)
|
|
|
|
{
|
|
|
|
basic_block bb;
|
|
|
|
edge e;
|
|
|
|
edge_iterator ei;
|
|
|
|
|
|
|
|
gsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR), NULL);
|
|
|
|
|
|
|
|
FOR_EACH_BB (bb)
|
|
|
|
FOR_EACH_EDGE (e, ei, bb->succs)
|
|
|
|
gsi_commit_one_edge_insert (e, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Commit insertions pending at edge E. If a new block is created, set NEW_BB
|
|
|
|
to this block, otherwise set it to NULL. */
|
|
|
|
|
|
|
|
void
|
|
|
|
gsi_commit_one_edge_insert (edge e, basic_block *new_bb)
|
|
|
|
{
|
|
|
|
if (new_bb)
|
|
|
|
*new_bb = NULL;
|
|
|
|
|
|
|
|
if (PENDING_STMT (e))
|
|
|
|
{
|
|
|
|
gimple_stmt_iterator gsi;
|
|
|
|
gimple_seq seq = PENDING_STMT (e);
|
|
|
|
|
|
|
|
PENDING_STMT (e) = NULL;
|
|
|
|
|
|
|
|
if (gimple_find_edge_insert_loc (e, &gsi, new_bb))
|
|
|
|
gsi_insert_seq_after (&gsi, seq, GSI_NEW_STMT);
|
|
|
|
else
|
|
|
|
gsi_insert_seq_before (&gsi, seq, GSI_NEW_STMT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns iterator at the start of the list of phi nodes of BB. */
|
|
|
|
|
|
|
|
gimple_stmt_iterator
|
|
|
|
gsi_start_phis (basic_block bb)
|
|
|
|
{
|
|
|
|
return gsi_start (phi_nodes (bb));
|
|
|
|
}
|