Discussion:
[PATCH 00/13] Remove remaining cfun-using macros from basic-block.h
David Malcolm
2013-12-06 14:51:26 UTC
Permalink
I have a series of 13 follow-up patches which remove the remaining
"cfun"-using macros from basic-block.h

Successfully bootstrapped&regtested on x86_64-unknown-linux-gnu.

These were pre-approved in stage1, and are mechanical in nature [1]

I'd like to apply these to trunk now, but given that we're now in
stage3, do I need to wait until the next stage1?

The first 4 patches rename various "_for_function|_FOR_FUNCTION"
macros to "_for_fn|_FOR_FN" for consistency with the earlier
patches in this thread.

The remaining patches eliminate cfun-using macros in favor of
the "_for_fn|_FOR_FN" variant, making uses of cfun explicit.
There are still some macros in function.h that implicitly use
cfun, but it's less clear what to replace them with.

Note to self: here's a grep invocation for ensuring that no new
uses sneak into the sources:
for m in \
basic_block_info_for_function BASIC_BLOCK_FOR_FUNCTION \
SET_BASIC_BLOCK_FOR_FUNCTION last_basic_block_for_function \
label_to_block_map_for_function profile_status_for_function \
SET_BASIC_BLOCK BASIC_BLOCK basic_block_info label_to_block_map \
profile_status last_basic_block FOR_EACH_BB FOR_EACH_BB_REVERSE \
FOR_ALL_BB ;
do
grep -nH -E -w $m \
gcc/*.[ch] gcc/config/*.[ch] gcc/config/*/*.{c,h,md} ;
done

(this currently has 11 false-positives)

[1] with one exception, in patch 10 in gcc/ira-emit.c (ira_emit) where
I introduced a new local to avoid overlong lines.

David Malcolm (13):
Rename macros (basic_block_info_for_function,
BASIC_BLOCK_FOR_FUNCTION, SET_BASIC_BLOCK_FOR_FUNCTION)
Rename last_basic_block_for_function to last_basic_block_for_fn.
Rename label_to_block_map_for_function to label_to_block_map_for_fn.
Rename profile_status_for_function to profile_status_for_fn.
Eliminate SET_BASIC_BLOCK macro.
Eliminate BASIC_BLOCK macro.
Eliminate basic_block_info macro.
Eliminate label_to_block_map macro.
Eliminate profile_status macro.
Eliminate last_basic_block macro.
Eliminate FOR_EACH_BB macro.
Eliminate FOR_EACH_BB_REVERSE macro.
Eliminate FOR_ALL_BB macro.

gcc/alias.c | 2 +-
gcc/asan.c | 6 +-
gcc/auto-inc-dec.c | 2 +-
gcc/basic-block.h | 32 +++------
gcc/bb-reorder.c | 29 ++++----
gcc/bt-load.c | 45 ++++++------
gcc/caller-save.c | 8 +--
gcc/cfg.c | 32 ++++-----
gcc/cfganal.c | 35 +++++-----
gcc/cfgbuild.c | 12 ++--
gcc/cfgcleanup.c | 6 +-
gcc/cfgexpand.c | 14 ++--
gcc/cfghooks.c | 16 ++---
gcc/cfgloop.c | 20 +++---
gcc/cfgloopanal.c | 8 +--
gcc/cfgloopmanip.c | 6 +-
gcc/cfgrtl.c | 61 ++++++++--------
gcc/cgraphbuild.c | 8 +--
gcc/combine-stack-adj.c | 2 +-
gcc/combine.c | 8 +--
gcc/config/arm/arm.c | 4 +-
gcc/config/bfin/bfin.c | 4 +-
gcc/config/c6x/c6x.c | 6 +-
gcc/config/epiphany/resolve-sw-modes.c | 6 +-
gcc/config/frv/frv.c | 8 +--
gcc/config/i386/i386.c | 2 +-
gcc/config/ia64/ia64.c | 6 +-
gcc/config/mips/mips.c | 8 +--
gcc/config/picochip/picochip.c | 2 +-
gcc/config/rs6000/rs6000.c | 2 +-
gcc/config/s390/s390.c | 4 +-
gcc/config/sh/sh.c | 2 +-
gcc/config/spu/spu.c | 6 +-
gcc/config/tilegx/tilegx.c | 4 +-
gcc/config/tilepro/tilepro.c | 4 +-
gcc/coverage.c | 2 +-
gcc/cprop.c | 23 ++++---
gcc/cse.c | 8 +--
gcc/dce.c | 10 +--
gcc/df-core.c | 68 +++++++++---------
gcc/df-problems.c | 54 +++++++--------
gcc/df-scan.c | 42 ++++++-----
gcc/df.h | 2 +-
gcc/dominance.c | 37 +++++-----
gcc/domwalk.c | 2 +-
gcc/dse.c | 14 ++--
gcc/except.c | 2 +-
gcc/final.c | 6 +-
gcc/function.c | 16 ++---
gcc/gcse.c | 54 ++++++++-------
gcc/gimple-iterator.c | 2 +-
gcc/gimple-ssa-isolate-paths.c | 4 +-
gcc/gimple-streamer-in.c | 4 +-
gcc/gimple.c | 8 ++-
gcc/graph.c | 6 +-
gcc/graphite-scop-detection.c | 6 +-
gcc/graphite-sese-to-poly.c | 6 +-
gcc/graphite.c | 6 +-
gcc/haifa-sched.c | 4 +-
gcc/hw-doloop.c | 6 +-
gcc/ifcvt.c | 2 +-
gcc/init-regs.c | 2 +-
gcc/internal-fn.c | 6 +-
gcc/ipa-inline-analysis.c | 4 +-
gcc/ipa-prop.c | 2 +-
gcc/ipa-pure-const.c | 2 +-
gcc/ipa-split.c | 13 ++--
gcc/ipa-utils.c | 8 +--
gcc/ira-build.c | 15 ++--
gcc/ira-costs.c | 2 +-
gcc/ira-emit.c | 24 ++++---
gcc/ira.c | 42 ++++++-----
gcc/jump.c | 2 +-
gcc/lcm.c | 115 ++++++++++++++++++-------------
gcc/loop-init.c | 6 +-
gcc/loop-invariant.c | 2 +-
gcc/loop-unroll.c | 16 +++--
gcc/lower-subreg.c | 8 +--
gcc/lra-assigns.c | 2 +-
gcc/lra-coalesce.c | 4 +-
gcc/lra-constraints.c | 4 +-
gcc/lra-eliminations.c | 2 +-
gcc/lra-lives.c | 4 +-
gcc/lra-spills.c | 6 +-
gcc/lra.c | 10 +--
gcc/lto-streamer-in.c | 28 ++++----
gcc/lto-streamer-out.c | 8 +--
gcc/mcf.c | 4 +-
gcc/mode-switching.c | 27 ++++----
gcc/modulo-sched.c | 2 +-
gcc/omp-low.c | 6 +-
gcc/optabs.c | 2 +-
gcc/postreload-gcse.c | 4 +-
gcc/postreload.c | 4 +-
gcc/predict.c | 54 +++++++--------
gcc/profile.c | 12 ++--
gcc/recog.c | 6 +-
gcc/ree.c | 2 +-
gcc/reg-stack.c | 6 +-
gcc/regcprop.c | 8 +--
gcc/reginfo.c | 2 +-
gcc/regrename.c | 12 ++--
gcc/regstat.c | 8 +--
gcc/reload1.c | 10 +--
gcc/resource.c | 13 ++--
gcc/sched-ebb.c | 4 +-
gcc/sched-int.h | 5 +-
gcc/sched-rgn.c | 103 +++++++++++++++------------
gcc/sched-vis.c | 2 +-
gcc/sel-sched-dump.c | 2 +-
gcc/sel-sched-ir.c | 35 +++++-----
gcc/sel-sched.c | 22 +++---
gcc/sese.c | 6 +-
gcc/stack-ptr-mod.c | 2 +-
gcc/store-motion.c | 38 +++++-----
gcc/testsuite/g++.dg/plugin/selfassign.c | 2 +-
gcc/testsuite/gcc.dg/plugin/selfassign.c | 2 +-
gcc/tracer.c | 8 +--
gcc/trans-mem.c | 15 ++--
gcc/tree-call-cdce.c | 2 +-
gcc/tree-cfg.c | 108 +++++++++++++++--------------
gcc/tree-cfgcleanup.c | 16 ++---
gcc/tree-complex.c | 6 +-
gcc/tree-dfa.c | 6 +-
gcc/tree-eh.c | 6 +-
gcc/tree-emutls.c | 2 +-
gcc/tree-if-conv.c | 2 +-
gcc/tree-inline.c | 32 +++++----
gcc/tree-into-ssa.c | 45 ++++++------
gcc/tree-loop-distribution.c | 2 +-
gcc/tree-nrv.c | 6 +-
gcc/tree-object-size.c | 2 +-
gcc/tree-outof-ssa.c | 6 +-
gcc/tree-profile.c | 2 +-
gcc/tree-scalar-evolution.c | 2 +-
gcc/tree-sra.c | 14 ++--
gcc/tree-ssa-ccp.c | 6 +-
gcc/tree-ssa-coalesce.c | 6 +-
gcc/tree-ssa-copy.c | 2 +-
gcc/tree-ssa-copyrename.c | 4 +-
gcc/tree-ssa-dce.c | 13 ++--
gcc/tree-ssa-dom.c | 8 +--
gcc/tree-ssa-forwprop.c | 2 +-
gcc/tree-ssa-live.c | 32 ++++-----
gcc/tree-ssa-loop-im.c | 8 +--
gcc/tree-ssa-loop-manip.c | 24 +++----
gcc/tree-ssa-math-opts.c | 10 +--
gcc/tree-ssa-pre.c | 16 ++---
gcc/tree-ssa-propagate.c | 8 +--
gcc/tree-ssa-reassoc.c | 8 ++-
gcc/tree-ssa-sccvn.c | 2 +-
gcc/tree-ssa-sink.c | 4 +-
gcc/tree-ssa-structalias.c | 4 +-
gcc/tree-ssa-tail-merge.c | 32 ++++-----
gcc/tree-ssa-ter.c | 2 +-
gcc/tree-ssa-threadupdate.c | 10 +--
gcc/tree-ssa-uncprop.c | 9 +--
gcc/tree-ssa-uninit.c | 4 +-
gcc/tree-ssa.c | 6 +-
gcc/tree-stdarg.c | 8 +--
gcc/tree-switch-conversion.c | 2 +-
gcc/tree-vect-generic.c | 2 +-
gcc/tree-vectorizer.c | 6 +-
gcc/tree-vrp.c | 20 +++---
gcc/tsan.c | 2 +-
gcc/ubsan.c | 2 +-
gcc/value-prof.c | 6 +-
gcc/var-tracking.c | 28 ++++----
gcc/vtable-verify.c | 2 +-
gcc/web.c | 6 +-
170 files changed, 1112 insertions(+), 1030 deletions(-)
--
1.7.11.7
David Malcolm
2013-12-06 14:51:27 UTC
Permalink
gcc/
* basic-block.h (basic_block_info_for_function): Rename to...
(basic_block_info_for_fn): ...this.
(BASIC_BLOCK_FOR_FUNCTION): Rename to...
(BASIC_BLOCK_FOR_FN): ...this.
(SET_BASIC_BLOCK_FOR_FUNCTION): Rename to...
(SET_BASIC_BLOCK_FOR_FN): ...this.

* gimple-streamer-in.c (input_phi, input_bb): Update for renaming
of BASIC_BLOCK_FOR_FUNCTION to BASIC_BLOCK_FOR_FN.
* ipa-utils.c (ipa_merge_profiles): Likewise.
* lto-streamer-in.c (make_new_block): Update for renaming of
SET_BASIC_BLOCK_FOR_FUNCTION to SET_BASIC_BLOCK_FOR_FN.
(input_cfg): Update for renamings.
* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
(dump_function_to_file): Update for renaming of
basic_block_info_for_function to basic_block_info_for_fn.
---
gcc/basic-block.h | 10 +++++-----
gcc/gimple-streamer-in.c | 4 ++--
gcc/ipa-utils.c | 4 ++--
gcc/lto-streamer-in.c | 14 +++++++-------
gcc/tree-cfg.c | 12 +++++-------
5 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 58bacc3..234f6e9 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -314,17 +314,17 @@ struct GTY(()) control_flow_graph {
/* Defines for accessing the fields of the CFG structure for function FN. */
#define ENTRY_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_entry_block_ptr)
#define EXIT_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_exit_block_ptr)
-#define basic_block_info_for_function(FN) ((FN)->cfg->x_basic_block_info)
+#define basic_block_info_for_fn(FN) ((FN)->cfg->x_basic_block_info)
#define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks)
#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
#define last_basic_block_for_function(FN) ((FN)->cfg->x_last_basic_block)
#define label_to_block_map_for_function(FN) ((FN)->cfg->x_label_to_block_map)
#define profile_status_for_function(FN) ((FN)->cfg->x_profile_status)

-#define BASIC_BLOCK_FOR_FUNCTION(FN,N) \
- ((*basic_block_info_for_function (FN))[(N)])
-#define SET_BASIC_BLOCK_FOR_FUNCTION(FN,N,BB) \
- ((*basic_block_info_for_function (FN))[(N)] = (BB))
+#define BASIC_BLOCK_FOR_FN(FN,N) \
+ ((*basic_block_info_for_fn (FN))[(N)])
+#define SET_BASIC_BLOCK_FOR_FN(FN,N,BB) \
+ ((*basic_block_info_for_fn (FN))[(N)] = (BB))

/* Defines for textual backward source compatibility. */
#define basic_block_info (cfun->cfg->x_basic_block_info)
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 57b0d87..bc85ae9 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -67,7 +67,7 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
int src_index = streamer_read_uhwi (ib);
bitpack_d bp = streamer_read_bitpack (ib);
location_t arg_loc = stream_input_location (&bp, data_in);
- basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
+ basic_block sbb = BASIC_BLOCK_FOR_FN (fn, src_index);

edge e = NULL;
int j;
@@ -258,7 +258,7 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
gcc_assert (cfun == fn);

index = streamer_read_uhwi (ib);
- bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
+ bb = BASIC_BLOCK_FOR_FN (fn, index);

bb->count = apply_scale (streamer_read_gcov_count (ib),
count_materialization_scale);
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 312d75d..0253bb0 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -727,7 +727,7 @@ ipa_merge_profiles (struct cgraph_node *dst,
{
unsigned int i;

- dstbb = BASIC_BLOCK_FOR_FUNCTION (dstcfun, srcbb->index);
+ dstbb = BASIC_BLOCK_FOR_FN (dstcfun, srcbb->index);
if (dstbb == NULL)
{
if (cgraph_dump_file)
@@ -772,7 +772,7 @@ ipa_merge_profiles (struct cgraph_node *dst,
{
unsigned int i;

- dstbb = BASIC_BLOCK_FOR_FUNCTION (dstcfun, srcbb->index);
+ dstbb = BASIC_BLOCK_FOR_FN (dstcfun, srcbb->index);
dstbb->count += srcbb->count;
for (i = 0; i < EDGE_COUNT (srcbb->succs); i++)
{
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 862e49d..5a604d3 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -611,7 +611,7 @@ make_new_block (struct function *fn, unsigned int index)
{
basic_block bb = alloc_block ();
bb->index = index;
- SET_BASIC_BLOCK_FOR_FUNCTION (fn, index, bb);
+ SET_BASIC_BLOCK_FOR_FN (fn, index, bb);
n_basic_blocks_for_fn (fn)++;
return bb;
}
@@ -638,8 +638,8 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
bb_count = streamer_read_uhwi (ib);

last_basic_block_for_function (fn) = bb_count;
- if (bb_count > basic_block_info_for_function (fn)->length ())
- vec_safe_grow_cleared (basic_block_info_for_function (fn), bb_count);
+ if (bb_count > basic_block_info_for_fn (fn)->length ())
+ vec_safe_grow_cleared (basic_block_info_for_fn (fn), bb_count);

if (bb_count > label_to_block_map_for_function (fn)->length ())
vec_safe_grow_cleared (label_to_block_map_for_function (fn), bb_count);
@@ -647,7 +647,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
index = streamer_read_hwi (ib);
while (index != -1)
{
- basic_block bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (fn, index);
unsigned int edge_count;

if (bb == NULL)
@@ -671,7 +671,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
count_materialization_scale);
edge_flags = streamer_read_uhwi (ib);

- dest = BASIC_BLOCK_FOR_FUNCTION (fn, dest_index);
+ dest = BASIC_BLOCK_FOR_FN (fn, dest_index);

if (dest == NULL)
dest = make_new_block (fn, dest_index);
@@ -688,7 +688,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
index = streamer_read_hwi (ib);
while (index != -1)
{
- basic_block bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (fn, index);
bb->prev_bb = p_bb;
p_bb->next_bb = bb;
p_bb = bb;
@@ -719,7 +719,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
}

struct loop *loop = alloc_loop ();
- loop->header = BASIC_BLOCK_FOR_FUNCTION (fn, header_index);
+ loop->header = BASIC_BLOCK_FOR_FN (fn, header_index);
loop->header->loop_father = loop;

/* Read everything copy_loop_info copies. */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 6d1ebe6..e4a1371 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -185,8 +185,8 @@ init_empty_tree_cfg_for_function (struct function *fn)
profile_status_for_function (fn) = PROFILE_ABSENT;
n_basic_blocks_for_fn (fn) = NUM_FIXED_BLOCKS;
last_basic_block_for_function (fn) = NUM_FIXED_BLOCKS;
- vec_alloc (basic_block_info_for_function (fn), initial_cfg_capacity);
- vec_safe_grow_cleared (basic_block_info_for_function (fn),
+ vec_alloc (basic_block_info_for_fn (fn), initial_cfg_capacity);
+ vec_safe_grow_cleared (basic_block_info_for_fn (fn),
initial_cfg_capacity);

/* Build a mapping of labels to their associated blocks. */
@@ -194,10 +194,8 @@ init_empty_tree_cfg_for_function (struct function *fn)
vec_safe_grow_cleared (label_to_block_map_for_function (fn),
initial_cfg_capacity);

- SET_BASIC_BLOCK_FOR_FUNCTION (fn, ENTRY_BLOCK,
- ENTRY_BLOCK_PTR_FOR_FN (fn));
- SET_BASIC_BLOCK_FOR_FUNCTION (fn, EXIT_BLOCK,
- EXIT_BLOCK_PTR_FOR_FN (fn));
+ SET_BASIC_BLOCK_FOR_FN (fn, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN (fn));
+ SET_BASIC_BLOCK_FOR_FN (fn, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN (fn));

ENTRY_BLOCK_PTR_FOR_FN (fn)->next_bb
= EXIT_BLOCK_PTR_FOR_FN (fn);
@@ -7046,7 +7044,7 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)

if (fun && fun->decl == fndecl
&& fun->cfg
- && basic_block_info_for_function (fun))
+ && basic_block_info_for_fn (fun))
{
/* If the CFG has been built, emit a CFG-based dump. */
if (!ignore_topmost_bind)
--
1.7.11.7
David Malcolm
2013-12-06 14:51:28 UTC
Permalink
gcc/
* basic-block.h (last_basic_block_for_function): Rename to...
(last_basic_block_for_fn): ...this.
* ipa-utils.c (ipa_merge_profiles): Update for renaming of
last_basic_block_for_function to last_basic_block_for_fn.
* lto-streamer-in.c (input_cfg): Likewise.
* lto-streamer-out.c (output_cfg): Likewise.
* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
* tree-sra.c (propagate_dereference_distances, ipa_early_sra):
Likewise.
---
gcc/basic-block.h | 2 +-
gcc/ipa-utils.c | 4 ++--
gcc/lto-streamer-in.c | 2 +-
gcc/lto-streamer-out.c | 2 +-
gcc/tree-cfg.c | 2 +-
gcc/tree-sra.c | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 234f6e9..88b0e48 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -317,7 +317,7 @@ struct GTY(()) control_flow_graph {
#define basic_block_info_for_fn(FN) ((FN)->cfg->x_basic_block_info)
#define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks)
#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
-#define last_basic_block_for_function(FN) ((FN)->cfg->x_last_basic_block)
+#define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block)
#define label_to_block_map_for_function(FN) ((FN)->cfg->x_label_to_block_map)
#define profile_status_for_function(FN) ((FN)->cfg->x_profile_status)

diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 0253bb0..569626d 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -711,8 +711,8 @@ ipa_merge_profiles (struct cgraph_node *dst,
"Giving up; number of basic block mismatch.\n");
match = false;
}
- else if (last_basic_block_for_function (srccfun)
- != last_basic_block_for_function (dstcfun))
+ else if (last_basic_block_for_fn (srccfun)
+ != last_basic_block_for_fn (dstcfun))
{
if (cgraph_dump_file)
fprintf (cgraph_dump_file,
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 5a604d3..9ad4f5f 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -637,7 +637,7 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,

bb_count = streamer_read_uhwi (ib);

- last_basic_block_for_function (fn) = bb_count;
+ last_basic_block_for_fn (fn) = bb_count;
if (bb_count > basic_block_info_for_fn (fn)->length ())
vec_safe_grow_cleared (basic_block_info_for_fn (fn), bb_count);

diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index e99424e..858d49e 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1633,7 +1633,7 @@ output_cfg (struct output_block *ob, struct function *fn)
profile_status_for_function (fn));

/* Output the number of the highest basic block. */
- streamer_write_uhwi (ob, last_basic_block_for_function (fn));
+ streamer_write_uhwi (ob, last_basic_block_for_fn (fn));

FOR_ALL_BB_FN (bb, fn)
{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index e4a1371..3df4cbe 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -184,7 +184,7 @@ init_empty_tree_cfg_for_function (struct function *fn)
init_flow (fn);
profile_status_for_function (fn) = PROFILE_ABSENT;
n_basic_blocks_for_fn (fn) = NUM_FIXED_BLOCKS;
- last_basic_block_for_function (fn) = NUM_FIXED_BLOCKS;
+ last_basic_block_for_fn (fn) = NUM_FIXED_BLOCKS;
vec_alloc (basic_block_info_for_fn (fn), initial_cfg_capacity);
vec_safe_grow_cleared (basic_block_info_for_fn (fn),
initial_cfg_capacity);
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 0890613..9aa526f 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3793,7 +3793,7 @@ propagate_dereference_distances (void)
{
basic_block bb;

- auto_vec<basic_block> queue (last_basic_block_for_function (cfun));
+ auto_vec<basic_block> queue (last_basic_block_for_fn (cfun));
queue.quick_push (ENTRY_BLOCK_PTR_FOR_FN (cfun));
FOR_EACH_BB (bb)
{
@@ -4970,7 +4970,7 @@ ipa_early_sra (void)

bb_dereferences = XCNEWVEC (HOST_WIDE_INT,
func_param_count
- * last_basic_block_for_function (cfun));
+ * last_basic_block_for_fn (cfun));
final_bbs = BITMAP_ALLOC (NULL);

scan_function ();
--
1.7.11.7
David Malcolm
2013-12-06 14:51:29 UTC
Permalink
gcc/
* basic-block.h (label_to_block_map_for_function): Rename to...
(label_to_block_map_for_fn): ...this.
* lto-streamer-in.c (input_cfg): Update for renaming.
* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
---
gcc/basic-block.h | 2 +-
gcc/lto-streamer-in.c | 4 ++--
gcc/tree-cfg.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 88b0e48..1471972 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -318,7 +318,7 @@ struct GTY(()) control_flow_graph {
#define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks)
#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
#define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block)
-#define label_to_block_map_for_function(FN) ((FN)->cfg->x_label_to_block_map)
+#define label_to_block_map_for_fn(FN) ((FN)->cfg->x_label_to_block_map)
#define profile_status_for_function(FN) ((FN)->cfg->x_profile_status)

#define BASIC_BLOCK_FOR_FN(FN,N) \
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 9ad4f5f..91fb12d 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -641,8 +641,8 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
if (bb_count > basic_block_info_for_fn (fn)->length ())
vec_safe_grow_cleared (basic_block_info_for_fn (fn), bb_count);

- if (bb_count > label_to_block_map_for_function (fn)->length ())
- vec_safe_grow_cleared (label_to_block_map_for_function (fn), bb_count);
+ if (bb_count > label_to_block_map_for_fn (fn)->length ())
+ vec_safe_grow_cleared (label_to_block_map_for_fn (fn), bb_count);

index = streamer_read_hwi (ib);
while (index != -1)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 3df4cbe..998ee26 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -190,8 +190,8 @@ init_empty_tree_cfg_for_function (struct function *fn)
initial_cfg_capacity);

/* Build a mapping of labels to their associated blocks. */
- vec_alloc (label_to_block_map_for_function (fn), initial_cfg_capacity);
- vec_safe_grow_cleared (label_to_block_map_for_function (fn),
+ vec_alloc (label_to_block_map_for_fn (fn), initial_cfg_capacity);
+ vec_safe_grow_cleared (label_to_block_map_for_fn (fn),
initial_cfg_capacity);

SET_BASIC_BLOCK_FOR_FN (fn, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN (fn));
--
1.7.11.7
David Malcolm
2013-12-06 14:51:38 UTC
Permalink
gcc/
* basic-block.h (FOR_EACH_BB_REVERSE): Eliminate macro.

* cfghooks.c (verify_flow_info): Replace uses of FOR_EACH_BB_REVERSE
with FOR_EACH_BB_REVERSE_FN, making uses of cfun explicit.
* cfgrtl.c (print_rtl_with_bb, rtl_verify_edges,
rtl_verify_bb_insns, rtl_verify_bb_pointers,
rtl_verify_bb_insn_chain, rtl_verify_fallthru): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info): Likewise.
* config/sh/sh.c (sh_md_init_global): Likewise.
* dce.c (reset_unmarked_insns_debug_uses, delete_unmarked_insns):
Likewise.
* dominance.c (calc_dfs_tree): Likewise.
* final.c (final): Likewise.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (compute_code_hoist_vbeinout): Likewise.
* ira.c (update_equiv_regs, build_insn_chain): Likewise.
* lcm.c (compute_antinout_edge): Likewise.
* mode-switching.c (optimize_mode_switching): Likewise.
* postreload.c (reload_combine): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* tree-ssa-live.c (live_worklist): Likewise.
---
gcc/basic-block.h | 2 --
gcc/cfghooks.c | 2 +-
gcc/cfgrtl.c | 12 ++++++------
gcc/config/ia64/ia64.c | 4 ++--
gcc/config/sh/sh.c | 2 +-
gcc/dce.c | 4 ++--
gcc/dominance.c | 4 ++--
gcc/final.c | 2 +-
gcc/function.c | 2 +-
gcc/gcse.c | 2 +-
gcc/ira.c | 4 ++--
gcc/lcm.c | 2 +-
gcc/mode-switching.c | 4 ++--
gcc/postreload.c | 2 +-
gcc/recog.c | 4 ++--
gcc/tree-ssa-live.c | 2 +-
16 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index b378a5b..75f16ac 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -336,8 +336,6 @@ struct GTY(()) control_flow_graph {
#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)

-#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN (BB, cfun)
-
/* For iterating over insns in basic block. */
#define FOR_BB_INSNS(BB, INSN) \
for ((INSN) = BB_HEAD (BB); \
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 2400965..78218b5 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -123,7 +123,7 @@ verify_flow_info (void)
}

/* Now check the basic blocks (boundaries etc.) */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
int n_fallthru = 0;
edge e;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index daadd9b..7734ac1 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2153,7 +2153,7 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)

if (flags & TDF_BLOCKS)
{
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx x;

@@ -2408,7 +2408,7 @@ rtl_verify_edges (void)
int err = 0;
basic_block bb;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
int n_fallthru = 0, n_branch = 0, n_abnormal_call = 0, n_sibcall = 0;
int n_eh = 0, n_abnormal = 0;
@@ -2586,7 +2586,7 @@ rtl_verify_bb_insns (void)
int err = 0;
basic_block bb;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
/* Now check the header of basic
block. It ought to contain optional CODE_LABEL followed
@@ -2649,7 +2649,7 @@ rtl_verify_bb_pointers (void)
basic_block bb;

/* Check the general integrity of the basic blocks. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx insn;

@@ -2739,7 +2739,7 @@ rtl_verify_bb_insn_chain (void)

bb_info = XCNEWVEC (basic_block, max_uid);

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx head = BB_HEAD (bb);
rtx end = BB_END (bb);
@@ -2821,7 +2821,7 @@ rtl_verify_fallthru (void)
basic_block bb;
int err = 0;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
edge e;

diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index a837974..99bc094 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -9613,7 +9613,7 @@ emit_predicate_relation_info (void)
{
basic_block bb;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
int r;
rtx head = BB_HEAD (bb);
@@ -9641,7 +9641,7 @@ emit_predicate_relation_info (void)
relations around them. Otherwise the assembler will assume the call
returns, and complain about uses of call-clobbered predicates after
the call. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx insn = BB_HEAD (bb);

diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 3e907b2..26c8957 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -11110,7 +11110,7 @@ sh_md_init_global (FILE *dump ATTRIBUTE_UNUSED,
regmode_weight[1] = (short *) xcalloc (old_max_uid, sizeof (short));
r0_life_regions = 0;

- FOR_EACH_BB_REVERSE (b)
+ FOR_EACH_BB_REVERSE_FN (b, cfun)
{
find_regmode_weight (b, SImode);
find_regmode_weight (b, SFmode);
diff --git a/gcc/dce.c b/gcc/dce.c
index 3101102..843dfc6 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -511,7 +511,7 @@ reset_unmarked_insns_debug_uses (void)
basic_block bb;
rtx insn, next;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
if (DEBUG_INSN_P (insn))
{
@@ -550,7 +550,7 @@ delete_unmarked_insns (void)
rtx insn, next;
bool must_clean = false;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
if (NONDEBUG_INSN_P (insn))
{
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 521b224..69816c1 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -357,7 +357,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
basic_block b;
bool saw_unconnected = false;

- FOR_EACH_BB_REVERSE (b)
+ FOR_EACH_BB_REVERSE_FN (b, cfun)
{
if (EDGE_COUNT (b->succs) > 0)
{
@@ -376,7 +376,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)

if (saw_unconnected)
{
- FOR_EACH_BB_REVERSE (b)
+ FOR_EACH_BB_REVERSE_FN (b, cfun)
{
basic_block b2;
if (di->dfs_order[b->index])
diff --git a/gcc/final.c b/gcc/final.c
index f475d27..5526974 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1996,7 +1996,7 @@ final (rtx first, FILE *file, int optimize_p)

/* There is no cfg for a thunk. */
if (!cfun->is_thunk)
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
end_to_bb[INSN_UID (BB_END (bb))] = bb;
diff --git a/gcc/function.c b/gcc/function.c
index e00f583..e2d0e23 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6236,7 +6236,7 @@ thread_prologue_and_epilogue_insns (void)
}
/* Now duplicate the tails. */
if (!bitmap_empty_p (&bb_tail))
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
basic_block copy_bb, tbb;
rtx insert_point;
diff --git a/gcc/gcse.c b/gcc/gcse.c
index a6874ab..fdf0a57 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2829,7 +2829,7 @@ compute_code_hoist_vbeinout (void)

/* We scan the blocks in the reverse order to speed up
the convergence. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
diff --git a/gcc/ira.c b/gcc/ira.c
index b4ae0ca..7403870 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3772,7 +3772,7 @@ update_equiv_regs (void)
within the same loop (or in an inner loop), then move the register
initialization just before the use, so that they are in the same
basic block. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
loop_depth = bb_loop_depth (bb);
for (insn = BB_END (bb);
@@ -4127,7 +4127,7 @@ build_insn_chain (void)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (eliminable_regset, i))
bitmap_set_bit (elim_regset, i);
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
bitmap_iterator bi;
rtx insn;
diff --git a/gcc/lcm.c b/gcc/lcm.c
index 0b528d9..b5d56e0 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -109,7 +109,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin,

/* Put every block on the worklist; this is necessary because of the
optimistic initialization of ANTIN above. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
*qin++ = bb;
bb->aux = bb;
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 4e31d68..4f68536 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -692,7 +692,7 @@ optimize_mode_switching (void)
insert_insn_on_edge (mode_set, eg);
}

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
if (bitmap_bit_p (del[bb->index], j))
{
make_preds_opaque (bb, j);
@@ -712,7 +712,7 @@ optimize_mode_switching (void)
{
int no_mode = num_modes[entity_map[j]];

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
struct seginfo *ptr, *next;
for (ptr = bb_info[j][bb->index].seginfo; ptr; ptr = next)
diff --git a/gcc/postreload.c b/gcc/postreload.c
index bfa5a38..37bd9ff 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1281,7 +1281,7 @@ reload_combine (void)
label_live = XNEWVEC (HARD_REG_SET, n_labels);
CLEAR_HARD_REG_SET (ever_live_at_start);

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
insn = BB_HEAD (bb);
if (LABEL_P (insn))
diff --git a/gcc/recog.c b/gcc/recog.c
index c59aa0e..dbd9a8a 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -2902,7 +2902,7 @@ split_all_insns (void)
bitmap_clear (blocks);
changed = false;

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx insn, next;
bool finish = false;
@@ -3556,7 +3556,7 @@ peephole2_optimize (void)
search_ofs = 0;
live = BITMAP_ALLOC (&reg_obstack);

- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
bool past_end = false;
int pos;
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index da7198b..a37ef85 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1050,7 +1050,7 @@ live_worklist (tree_live_info_p live)

/* Visit all the blocks in reverse order and propagate live on entry values
into the predecessors blocks. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
loe_visit_block (live, bb, visited, tmp);

/* Process any blocks which require further iteration. */
--
1.7.11.7
Oleg Endo
2013-12-07 07:14:28 UTC
Permalink
David,

Could you please also update the use of FOR_EACH_BB_REVERSE in
config/sh/sh_optimize_sett_clrt.cc ?

Thanks,
Oleg
Post by David Malcolm
gcc/
* basic-block.h (FOR_EACH_BB_REVERSE): Eliminate macro.
* cfghooks.c (verify_flow_info): Replace uses of FOR_EACH_BB_REVERSE
with FOR_EACH_BB_REVERSE_FN, making uses of cfun explicit.
* cfgrtl.c (print_rtl_with_bb, rtl_verify_edges,
rtl_verify_bb_insns, rtl_verify_bb_pointers,
rtl_verify_bb_insn_chain, rtl_verify_fallthru): Likewise.
* config/ia64/ia64.c (emit_predicate_relation_info): Likewise.
* config/sh/sh.c (sh_md_init_global): Likewise.
Likewise.
* dominance.c (calc_dfs_tree): Likewise.
* final.c (final): Likewise.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (compute_code_hoist_vbeinout): Likewise.
* ira.c (update_equiv_regs, build_insn_chain): Likewise.
* lcm.c (compute_antinout_edge): Likewise.
* mode-switching.c (optimize_mode_switching): Likewise.
* postreload.c (reload_combine): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* tree-ssa-live.c (live_worklist): Likewise.
---
gcc/basic-block.h | 2 --
gcc/cfghooks.c | 2 +-
gcc/cfgrtl.c | 12 ++++++------
gcc/config/ia64/ia64.c | 4 ++--
gcc/config/sh/sh.c | 2 +-
gcc/dce.c | 4 ++--
gcc/dominance.c | 4 ++--
gcc/final.c | 2 +-
gcc/function.c | 2 +-
gcc/gcse.c | 2 +-
gcc/ira.c | 4 ++--
gcc/lcm.c | 2 +-
gcc/mode-switching.c | 4 ++--
gcc/postreload.c | 2 +-
gcc/recog.c | 4 ++--
gcc/tree-ssa-live.c | 2 +-
16 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index b378a5b..75f16ac 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -336,8 +336,6 @@ struct GTY(()) control_flow_graph {
#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
-#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN (BB, cfun)
-
/* For iterating over insns in basic block. */
#define FOR_BB_INSNS(BB, INSN) \
for ((INSN) = BB_HEAD (BB); \
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 2400965..78218b5 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -123,7 +123,7 @@ verify_flow_info (void)
}
/* Now check the basic blocks (boundaries etc.) */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
int n_fallthru = 0;
edge e;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index daadd9b..7734ac1 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2153,7 +2153,7 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)
if (flags & TDF_BLOCKS)
{
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx x;
@@ -2408,7 +2408,7 @@ rtl_verify_edges (void)
int err = 0;
basic_block bb;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
int n_fallthru = 0, n_branch = 0, n_abnormal_call = 0, n_sibcall = 0;
int n_eh = 0, n_abnormal = 0;
@@ -2586,7 +2586,7 @@ rtl_verify_bb_insns (void)
int err = 0;
basic_block bb;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
/* Now check the header of basic
block. It ought to contain optional CODE_LABEL followed
@@ -2649,7 +2649,7 @@ rtl_verify_bb_pointers (void)
basic_block bb;
/* Check the general integrity of the basic blocks. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx insn;
@@ -2739,7 +2739,7 @@ rtl_verify_bb_insn_chain (void)
bb_info = XCNEWVEC (basic_block, max_uid);
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx head = BB_HEAD (bb);
rtx end = BB_END (bb);
@@ -2821,7 +2821,7 @@ rtl_verify_fallthru (void)
basic_block bb;
int err = 0;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
edge e;
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index a837974..99bc094 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -9613,7 +9613,7 @@ emit_predicate_relation_info (void)
{
basic_block bb;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
int r;
rtx head = BB_HEAD (bb);
@@ -9641,7 +9641,7 @@ emit_predicate_relation_info (void)
relations around them. Otherwise the assembler will assume the call
returns, and complain about uses of call-clobbered predicates after
the call. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx insn = BB_HEAD (bb);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 3e907b2..26c8957 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -11110,7 +11110,7 @@ sh_md_init_global (FILE *dump ATTRIBUTE_UNUSED,
regmode_weight[1] = (short *) xcalloc (old_max_uid, sizeof (short));
r0_life_regions = 0;
- FOR_EACH_BB_REVERSE (b)
+ FOR_EACH_BB_REVERSE_FN (b, cfun)
{
find_regmode_weight (b, SImode);
find_regmode_weight (b, SFmode);
diff --git a/gcc/dce.c b/gcc/dce.c
index 3101102..843dfc6 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -511,7 +511,7 @@ reset_unmarked_insns_debug_uses (void)
basic_block bb;
rtx insn, next;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
if (DEBUG_INSN_P (insn))
{
@@ -550,7 +550,7 @@ delete_unmarked_insns (void)
rtx insn, next;
bool must_clean = false;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next)
if (NONDEBUG_INSN_P (insn))
{
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 521b224..69816c1 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -357,7 +357,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
basic_block b;
bool saw_unconnected = false;
- FOR_EACH_BB_REVERSE (b)
+ FOR_EACH_BB_REVERSE_FN (b, cfun)
{
if (EDGE_COUNT (b->succs) > 0)
{
@@ -376,7 +376,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
if (saw_unconnected)
{
- FOR_EACH_BB_REVERSE (b)
+ FOR_EACH_BB_REVERSE_FN (b, cfun)
{
basic_block b2;
if (di->dfs_order[b->index])
diff --git a/gcc/final.c b/gcc/final.c
index f475d27..5526974 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1996,7 +1996,7 @@ final (rtx first, FILE *file, int optimize_p)
/* There is no cfg for a thunk. */
if (!cfun->is_thunk)
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
start_to_bb[INSN_UID (BB_HEAD (bb))] = bb;
end_to_bb[INSN_UID (BB_END (bb))] = bb;
diff --git a/gcc/function.c b/gcc/function.c
index e00f583..e2d0e23 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6236,7 +6236,7 @@ thread_prologue_and_epilogue_insns (void)
}
/* Now duplicate the tails. */
if (!bitmap_empty_p (&bb_tail))
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
basic_block copy_bb, tbb;
rtx insert_point;
diff --git a/gcc/gcse.c b/gcc/gcse.c
index a6874ab..fdf0a57 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2829,7 +2829,7 @@ compute_code_hoist_vbeinout (void)
/* We scan the blocks in the reverse order to speed up
the convergence. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
diff --git a/gcc/ira.c b/gcc/ira.c
index b4ae0ca..7403870 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3772,7 +3772,7 @@ update_equiv_regs (void)
within the same loop (or in an inner loop), then move the register
initialization just before the use, so that they are in the same
basic block. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
loop_depth = bb_loop_depth (bb);
for (insn = BB_END (bb);
@@ -4127,7 +4127,7 @@ build_insn_chain (void)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (eliminable_regset, i))
bitmap_set_bit (elim_regset, i);
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
bitmap_iterator bi;
rtx insn;
diff --git a/gcc/lcm.c b/gcc/lcm.c
index 0b528d9..b5d56e0 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -109,7 +109,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin,
/* Put every block on the worklist; this is necessary because of the
optimistic initialization of ANTIN above. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
*qin++ = bb;
bb->aux = bb;
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 4e31d68..4f68536 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -692,7 +692,7 @@ optimize_mode_switching (void)
insert_insn_on_edge (mode_set, eg);
}
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
if (bitmap_bit_p (del[bb->index], j))
{
make_preds_opaque (bb, j);
@@ -712,7 +712,7 @@ optimize_mode_switching (void)
{
int no_mode = num_modes[entity_map[j]];
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
struct seginfo *ptr, *next;
for (ptr = bb_info[j][bb->index].seginfo; ptr; ptr = next)
diff --git a/gcc/postreload.c b/gcc/postreload.c
index bfa5a38..37bd9ff 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1281,7 +1281,7 @@ reload_combine (void)
label_live = XNEWVEC (HARD_REG_SET, n_labels);
CLEAR_HARD_REG_SET (ever_live_at_start);
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
insn = BB_HEAD (bb);
if (LABEL_P (insn))
diff --git a/gcc/recog.c b/gcc/recog.c
index c59aa0e..dbd9a8a 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -2902,7 +2902,7 @@ split_all_insns (void)
bitmap_clear (blocks);
changed = false;
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
rtx insn, next;
bool finish = false;
@@ -3556,7 +3556,7 @@ peephole2_optimize (void)
search_ofs = 0;
live = BITMAP_ALLOC (&reg_obstack);
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
bool past_end = false;
int pos;
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index da7198b..a37ef85 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1050,7 +1050,7 @@ live_worklist (tree_live_info_p live)
/* Visit all the blocks in reverse order and propagate live on entry values
into the predecessors blocks. */
- FOR_EACH_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE_FN (bb, cfun)
loe_visit_block (live, bb, visited, tmp);
/* Process any blocks which require further iteration. */
David Malcolm
2013-12-06 14:51:31 UTC
Permalink
gcc/
* basic-block.h (SET_BASIC_BLOCK): Eliminate macro.

* cfg.c (compact_blocks): Replace uses of SET_BASIC_BLOCK
with SET_BASIC_BLOCK_FOR_FN, making use of cfun explicit.
(expunge_block): Likewise.
* cfgrtl.c (create_basic_block_structure): Likewise.
* df-core.c (df_compact_blocks, df_bb_replace): Likewise.
* sel-sched.c (create_block_for_bookkeeping): Likewise.
* tree-cfg.c (create_bb): Likewise.
---
gcc/basic-block.h | 1 -
gcc/cfg.c | 10 +++++-----
gcc/cfgrtl.c | 2 +-
gcc/df-core.c | 8 ++++----
gcc/sel-sched.c | 4 ++--
gcc/tree-cfg.c | 2 +-
6 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index da93c6f..f759e27 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -333,7 +333,6 @@ struct GTY(()) control_flow_graph {
#define profile_status (cfun->cfg->x_profile_status)

#define BASIC_BLOCK(N) ((*basic_block_info)[(N)])
-#define SET_BASIC_BLOCK(N,BB) ((*basic_block_info)[(N)] = (BB))

/* For iterating over basic blocks. */
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 786fe48..f386168 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -153,8 +153,8 @@ compact_blocks (void)
{
int i;

- SET_BASIC_BLOCK (ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN (cfun));
- SET_BASIC_BLOCK (EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN (cfun));
+ SET_BASIC_BLOCK_FOR_FN (cfun, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN (cfun));
+ SET_BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN (cfun));

if (df)
df_compact_blocks ();
@@ -165,14 +165,14 @@ compact_blocks (void)
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- SET_BASIC_BLOCK (i, bb);
+ SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
bb->index = i;
i++;
}
gcc_assert (i == n_basic_blocks_for_fn (cfun));

for (; i < last_basic_block; i++)
- SET_BASIC_BLOCK (i, NULL);
+ SET_BASIC_BLOCK_FOR_FN (cfun, i, NULL);
}
last_basic_block = n_basic_blocks_for_fn (cfun);
}
@@ -183,7 +183,7 @@ void
expunge_block (basic_block b)
{
unlink_block (b);
- SET_BASIC_BLOCK (b->index, NULL);
+ SET_BASIC_BLOCK_FOR_FN (cfun, b->index, NULL);
n_basic_blocks_for_fn (cfun)--;
/* We should be able to ggc_free here, but we are not.
The dead SSA_NAMES are left pointing to dead statements that are pointing
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 63f44af..045d78b 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -331,7 +331,7 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)
bb->index = last_basic_block++;
bb->flags = BB_NEW | BB_RTL;
link_block (bb, after);
- SET_BASIC_BLOCK (bb->index, bb);
+ SET_BASIC_BLOCK_FOR_FN (cfun, bb->index, bb);
df_bb_refs_record (bb->index, false);
update_bb_for_insn (bb);
BB_SET_PARTITION (bb, BB_UNPARTITIONED);
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 37876af..4fb92a9 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1601,7 +1601,7 @@ df_compact_blocks (void)
i = NUM_FIXED_BLOCKS;
FOR_EACH_BB (bb)
{
- SET_BASIC_BLOCK (i, bb);
+ SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
bb->index = i;
i++;
}
@@ -1609,7 +1609,7 @@ df_compact_blocks (void)
gcc_assert (i == n_basic_blocks_for_fn (cfun));

for (; i < last_basic_block; i++)
- SET_BASIC_BLOCK (i, NULL);
+ SET_BASIC_BLOCK_FOR_FN (cfun, i, NULL);

#ifdef DF_DEBUG_CFG
if (!df_lr->solutions_dirty)
@@ -1645,10 +1645,10 @@ df_bb_replace (int old_index, basic_block new_block)
}

df_clear_bb_dirty (new_block);
- SET_BASIC_BLOCK (old_index, new_block);
+ SET_BASIC_BLOCK_FOR_FN (cfun, old_index, new_block);
new_block->index = old_index;
df_set_bb_dirty (BASIC_BLOCK (old_index));
- SET_BASIC_BLOCK (new_block_index, NULL);
+ SET_BASIC_BLOCK_FOR_FN (cfun, new_block_index, NULL);
}


diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 1e3fcf0..1195f7e 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4663,8 +4663,8 @@ create_block_for_bookkeeping (edge e1, edge e2)
new_bb->index = succ->index;
succ->index = i;

- SET_BASIC_BLOCK (new_bb->index, new_bb);
- SET_BASIC_BLOCK (succ->index, succ);
+ SET_BASIC_BLOCK_FOR_FN (cfun, new_bb->index, new_bb);
+ SET_BASIC_BLOCK_FOR_FN (cfun, succ->index, succ);

memcpy (&gbi, SEL_GLOBAL_BB_INFO (new_bb), sizeof (gbi));
memcpy (SEL_GLOBAL_BB_INFO (new_bb), SEL_GLOBAL_BB_INFO (succ),
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 6c2cc16..2d7916b 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -610,7 +610,7 @@ create_bb (void *h, void *e, basic_block after)
}

/* Add the newly created block to the array. */
- SET_BASIC_BLOCK (last_basic_block, bb);
+ SET_BASIC_BLOCK_FOR_FN (cfun, last_basic_block, bb);

n_basic_blocks_for_fn (cfun)++;
last_basic_block++;
--
1.7.11.7
David Malcolm
2013-12-06 14:51:30 UTC
Permalink
gcc/
* basic-block.h (profile_status_for_function): Rename to...
(profile_status_for_fn): ...this.

* cfg.c (check_bb_profile): Update for renaming.
* cgraphbuild.c (compute_call_stmt_bb_frequency): Likewise.
* lto-streamer-in.c (input_cfg): Likewise.
* lto-streamer-out.c (output_cfg): Likewise.
* predict.c (maybe_hot_frequency_p, maybe_hot_count_p,
maybe_hot_bb_p, probably_never_executed)
(handle_missing_profiles): Likewise.
* tree-cfg.c (init_empty_tree_cfg_for_function): Likewise.
* tree-inline.c (copy_bb, initialize_cfun): Likewise.
---
gcc/basic-block.h | 2 +-
gcc/cfg.c | 2 +-
gcc/cgraphbuild.c | 2 +-
gcc/lto-streamer-in.c | 4 ++--
gcc/lto-streamer-out.c | 2 +-
gcc/predict.c | 12 ++++++------
gcc/tree-cfg.c | 2 +-
gcc/tree-inline.c | 4 ++--
8 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 1471972..da93c6f 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -319,7 +319,7 @@ struct GTY(()) control_flow_graph {
#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
#define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block)
#define label_to_block_map_for_fn(FN) ((FN)->cfg->x_label_to_block_map)
-#define profile_status_for_function(FN) ((FN)->cfg->x_profile_status)
+#define profile_status_for_fn(FN) ((FN)->cfg->x_profile_status)

#define BASIC_BLOCK_FOR_FN(FN,N) \
((*basic_block_info_for_fn (FN))[(N)])
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 6bceca5..786fe48 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -408,7 +408,7 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags)
memset ((void *) s_indent, ' ', (size_t) indent);
s_indent[indent] = '\0';

- if (profile_status_for_function (fun) == PROFILE_ABSENT)
+ if (profile_status_for_fn (fun) == PROFILE_ABSENT)
return;

if (bb != EXIT_BLOCK_PTR_FOR_FN (fun))
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 9a63982..6c6698b 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -208,7 +208,7 @@ compute_call_stmt_bb_frequency (tree decl, basic_block bb)
(DECL_STRUCT_FUNCTION (decl))->frequency;
int freq = bb->frequency;

- if (profile_status_for_function (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT)
+ if (profile_status_for_fn (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT)
return CGRAPH_FREQ_BASE;

if (!entry_freq)
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 91fb12d..8dc94bd 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -632,8 +632,8 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
init_empty_tree_cfg_for_function (fn);
init_ssa_operands (fn);

- profile_status_for_function (fn) = streamer_read_enum (ib, profile_status_d,
- PROFILE_LAST);
+ profile_status_for_fn (fn) = streamer_read_enum (ib, profile_status_d,
+ PROFILE_LAST);

bb_count = streamer_read_uhwi (ib);

diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 858d49e..615cc84 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1630,7 +1630,7 @@ output_cfg (struct output_block *ob, struct function *fn)
ob->main_stream = ob->cfg_stream;

streamer_write_enum (ob->main_stream, profile_status_d, PROFILE_LAST,
- profile_status_for_function (fn));
+ profile_status_for_fn (fn));

/* Output the number of the highest basic block. */
streamer_write_uhwi (ob, last_basic_block_for_fn (fn));
diff --git a/gcc/predict.c b/gcc/predict.c
index 1cd3fa6..e959a3b 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -121,7 +121,7 @@ maybe_hot_frequency_p (struct function *fun, int freq)
if (node->frequency == NODE_FREQUENCY_HOT)
return true;
}
- if (profile_status_for_function (fun) == PROFILE_ABSENT)
+ if (profile_status_for_fn (fun) == PROFILE_ABSENT)
return true;
if (node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
&& freq < (ENTRY_BLOCK_PTR_FOR_FN (fun)->frequency * 2 / 3))
@@ -164,7 +164,7 @@ set_hot_bb_threshold (gcov_type min)
static inline bool
maybe_hot_count_p (struct function *fun, gcov_type count)
{
- if (fun && profile_status_for_function (fun) != PROFILE_READ)
+ if (fun && profile_status_for_fn (fun) != PROFILE_READ)
return true;
/* Code executed at most once is not hot. */
if (profile_info->runs >= count)
@@ -179,7 +179,7 @@ bool
maybe_hot_bb_p (struct function *fun, const_basic_block bb)
{
gcc_checking_assert (fun);
- if (profile_status_for_function (fun) == PROFILE_READ)
+ if (profile_status_for_fn (fun) == PROFILE_READ)
return maybe_hot_count_p (fun, bb->count);
return maybe_hot_frequency_p (fun, bb->frequency);
}
@@ -239,7 +239,7 @@ probably_never_executed (struct function *fun,
gcov_type count, int frequency)
{
gcc_checking_assert (fun);
- if (profile_status_for_function (fun) == PROFILE_READ)
+ if (profile_status_for_fn (fun) == PROFILE_READ)
{
int unlikely_count_fraction = PARAM_VALUE (UNLIKELY_BB_COUNT_FRACTION);
if (count * unlikely_count_fraction >= profile_info->runs)
@@ -2806,7 +2806,7 @@ drop_profile (struct cgraph_node *node, gcov_type call_count)
node->name (), node->order);
}

- profile_status_for_function (fn)
+ profile_status_for_fn (fn)
= (flag_guess_branch_prob ? PROFILE_GUESSED : PROFILE_ABSENT);
node->frequency
= hot ? NODE_FREQUENCY_HOT : NODE_FREQUENCY_NORMAL;
@@ -2869,7 +2869,7 @@ handle_missing_profiles (void)
if (callee->count > 0)
continue;
if (DECL_COMDAT (callee->decl) && fn && fn->cfg
- && profile_status_for_function (fn) == PROFILE_READ)
+ && profile_status_for_fn (fn) == PROFILE_READ)
{
drop_profile (node, 0);
worklist.safe_push (callee);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 998ee26..6c2cc16 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -182,7 +182,7 @@ init_empty_tree_cfg_for_function (struct function *fn)
{
/* Initialize the basic block array. */
init_flow (fn);
- profile_status_for_function (fn) = PROFILE_ABSENT;
+ profile_status_for_fn (fn) = PROFILE_ABSENT;
n_basic_blocks_for_fn (fn) = NUM_FIXED_BLOCKS;
last_basic_block_for_fn (fn) = NUM_FIXED_BLOCKS;
vec_alloc (basic_block_info_for_fn (fn), initial_cfg_capacity);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index f42ade02..abc216d 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1792,7 +1792,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
{
edge->frequency = new_freq;
if (dump_file
- && profile_status_for_function (cfun) != PROFILE_ABSENT
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT
&& (edge_freq > edge->frequency + 10
|| edge_freq < edge->frequency - 10))
{
@@ -2208,7 +2208,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count)

init_empty_tree_cfg ();

- profile_status_for_function (cfun) = profile_status_for_function (src_cfun);
+ profile_status_for_fn (cfun) = profile_status_for_fn (src_cfun);
ENTRY_BLOCK_PTR_FOR_FN (cfun)->count =
(ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count * count_scale /
REG_BR_PROB_BASE);
--
1.7.11.7
David Malcolm
2013-12-06 14:51:33 UTC
Permalink
gcc/
* basic-block.h (basic_block_info): Eliminate macro.

* cfgrtl.c (rtl_create_basic_block): Replace uses of
basic_block_info with basic_block_info_for_fn, making uses
of cfun be explicit.
* tree-cfg.c (build_gimple_cfg, create_bb): Likewise.
---
gcc/basic-block.h | 1 -
gcc/cfgrtl.c | 4 ++--
gcc/tree-cfg.c | 10 ++++++----
3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 3bd011e..69689f3 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -327,7 +327,6 @@ struct GTY(()) control_flow_graph {
((*basic_block_info_for_fn (FN))[(N)] = (BB))

/* Defines for textual backward source compatibility. */
-#define basic_block_info (cfun->cfg->x_basic_block_info)
#define last_basic_block (cfun->cfg->x_last_basic_block)
#define label_to_block_map (cfun->cfg->x_label_to_block_map)
#define profile_status (cfun->cfg->x_profile_status)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index de110f4..772d939 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -355,10 +355,10 @@ rtl_create_basic_block (void *headp, void *endp, basic_block after)
basic_block bb;

/* Grow the basic block array if needed. */
- if ((size_t) last_basic_block >= basic_block_info->length ())
+ if ((size_t) last_basic_block >= basic_block_info_for_fn (cfun)->length ())
{
size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
- vec_safe_grow_cleared (basic_block_info, new_size);
+ vec_safe_grow_cleared (basic_block_info_for_fn (cfun), new_size);
}

n_basic_blocks_for_fn (cfun)++;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index a706730..9558546 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -242,8 +242,10 @@ build_gimple_cfg (gimple_seq seq)
create_empty_bb (ENTRY_BLOCK_PTR_FOR_FN (cfun));

/* Adjust the size of the array. */
- if (basic_block_info->length () < (size_t) n_basic_blocks_for_fn (cfun))
- vec_safe_grow_cleared (basic_block_info, n_basic_blocks_for_fn (cfun));
+ if (basic_block_info_for_fn (cfun)->length ()
+ < (size_t) n_basic_blocks_for_fn (cfun))
+ vec_safe_grow_cleared (basic_block_info_for_fn (cfun),
+ n_basic_blocks_for_fn (cfun));

/* To speed up statement iterator walks, we first purge dead labels. */
cleanup_dead_labels ();
@@ -603,10 +605,10 @@ create_bb (void *h, void *e, basic_block after)
link_block (bb, after);

/* Grow the basic block array if needed. */
- if ((size_t) last_basic_block == basic_block_info->length ())
+ if ((size_t) last_basic_block == basic_block_info_for_fn (cfun)->length ())
{
size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
- vec_safe_grow_cleared (basic_block_info, new_size);
+ vec_safe_grow_cleared (basic_block_info_for_fn (cfun), new_size);
}

/* Add the newly created block to the array. */
--
1.7.11.7
David Malcolm
2013-12-06 14:51:35 UTC
Permalink
gcc/
* basic-block.h (profile_status): Eliminate macro.

* cfgbuild.c (find_many_sub_basic_blocks): Eliminate use of
profile_status macro in favor of profile_status_for_fn, making
use of cfun explicit.
* cfghooks.c (account_profile_record): Likewise.
* cfgloopanal.c (single_likely_exit):
* cfgrtl.c (rtl_verify_edges, rtl_account_profile_record): Likewise.
* graphite.c (graphite_finalize):
* internal-fn.c (ubsan_expand_si_overflow_addsub_check,
ubsan_expand_si_overflow_neg_check,
ubsan_expand_si_overflow_mul_check): Likewise.
* ipa-split.c (consider_split, execute_split_functions):
* loop-unroll.c (decide_peel_simple):
* optabs.c (emit_cmp_and_jump_insn_1):
* predict.c (maybe_hot_edge_p, probably_never_executed,
predictable_edge_p, probability_reliable_p, gimple_predict_edge,
tree_estimate_probability_driver, estimate_bb_frequencies,
compute_function_frequency, rebuild_frequencies): Likewise.
* profile.c (compute_branch_probabilities): Likewise.
* tree-cfg.c (gimple_account_profile_record): Likewise.
* tree-inline.c (optimize_inline_calls): Likewise.
---
gcc/basic-block.h | 1 -
gcc/cfgbuild.c | 2 +-
gcc/cfghooks.c | 4 ++--
gcc/cfgloopanal.c | 2 +-
gcc/cfgrtl.c | 6 +++---
gcc/graphite.c | 2 +-
gcc/internal-fn.c | 6 +++---
gcc/ipa-split.c | 4 ++--
gcc/loop-unroll.c | 2 +-
gcc/optabs.c | 2 +-
gcc/predict.c | 26 +++++++++++++-------------
gcc/profile.c | 4 ++--
gcc/tree-cfg.c | 4 ++--
gcc/tree-inline.c | 3 ++-
14 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 4ab8289..d000a43 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -328,7 +328,6 @@ struct GTY(()) control_flow_graph {

/* Defines for textual backward source compatibility. */
#define last_basic_block (cfun->cfg->x_last_basic_block)
-#define profile_status (cfun->cfg->x_profile_status)

/* For iterating over basic blocks. */
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 08534d4..a0c2c66 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -618,7 +618,7 @@ find_many_sub_basic_blocks (sbitmap blocks)

/* Update branch probabilities. Expect only (un)conditional jumps
to be created with only the forward edges. */
- if (profile_status != PROFILE_ABSENT)
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT)
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
{
edge e;
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 0cd6af0..ab1c15f 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -1411,7 +1411,7 @@ account_profile_record (struct profile_record *record, int after_pass)
FOR_ALL_BB (bb)
{
if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
- && profile_status != PROFILE_ABSENT)
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT)
{
sum = 0;
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -1426,7 +1426,7 @@ account_profile_record (struct profile_record *record, int after_pass)
record->num_mismatched_count_out[after_pass]++;
}
if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun)
- && profile_status != PROFILE_ABSENT)
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT)
{
sum = 0;
FOR_EACH_EDGE (e, ei, bb->preds)
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 0cee6c6..2260f4b 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -470,7 +470,7 @@ single_likely_exit (struct loop *loop)
ruled out by this test. The static branch prediction algorithm
will not assign such a low probability to conditionals for usual
reasons. */
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& ex->probability < 5 && !ex->count)
continue;
if (!found)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 772d939..34fe4f3 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2420,7 +2420,7 @@ rtl_verify_edges (void)
&& any_condjump_p (BB_END (bb)))
{
if (XINT (note, 0) != BRANCH_EDGE (bb)->probability
- && profile_status != PROFILE_ABSENT)
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT)
{
error ("verify_flow_info: REG_BR_PROB does not match cfg %i %i",
XINT (note, 0), BRANCH_EDGE (bb)->probability);
@@ -5011,10 +5011,10 @@ rtl_account_profile_record (basic_block bb, int after_pass,
{
record->size[after_pass]
+= insn_rtx_cost (PATTERN (insn), false);
- if (profile_status == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
record->time[after_pass]
+= insn_rtx_cost (PATTERN (insn), true) * bb->count;
- else if (profile_status == PROFILE_GUESSED)
+ else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
record->time[after_pass]
+= insn_rtx_cost (PATTERN (insn), true) * bb->frequency;
}
diff --git a/gcc/graphite.c b/gcc/graphite.c
index e46710c..a573ea7 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -245,7 +245,7 @@ graphite_finalize (bool need_cfg_cleanup_p)
{
scev_reset ();
cleanup_tree_cfg ();
- profile_status = PROFILE_ABSENT;
+ profile_status_for_fn (cfun) = PROFILE_ABSENT;
release_recorded_exits ();
tree_estimate_probability ();
}
diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c
index fb1e578..8c54d98 100644
--- a/gcc/internal-fn.c
+++ b/gcc/internal-fn.c
@@ -194,7 +194,7 @@ ubsan_expand_si_overflow_addsub_check (tree_code code, gimple stmt)
if (maybe_expand_insn (icode, 4, ops))
{
last = get_last_insn ();
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& JUMP_P (last)
&& any_condjump_p (last)
&& !find_reg_note (last, REG_BR_PROB, 0))
@@ -285,7 +285,7 @@ ubsan_expand_si_overflow_neg_check (gimple stmt)
if (maybe_expand_insn (icode, 3, ops))
{
last = get_last_insn ();
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& JUMP_P (last)
&& any_condjump_p (last)
&& !find_reg_note (last, REG_BR_PROB, 0))
@@ -364,7 +364,7 @@ ubsan_expand_si_overflow_mul_check (gimple stmt)
if (maybe_expand_insn (icode, 4, ops))
{
last = get_last_insn ();
- if (profile_status != PROFILE_ABSENT
+ if (profile_status_for_fn (cfun) != PROFILE_ABSENT
&& JUMP_P (last)
&& any_condjump_p (last)
&& !find_reg_note (last, REG_BR_PROB, 0))
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index eca86da..f8fa0ee 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -411,7 +411,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
a loop, enable splitting since inlining code skipping the loop
is likely noticeable win. */
if (back_edge
- && profile_status != PROFILE_READ
+ && profile_status_for_fn (cfun) != PROFILE_READ
&& incoming_freq < ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1585,7 +1585,7 @@ execute_split_functions (void)

/* We enforce splitting after loop headers when profile info is not
available. */
- if (profile_status != PROFILE_READ)
+ if (profile_status_for_fn (cfun) != PROFILE_READ)
mark_dfs_back_edges ();

/* Initialize bitmap to track forbidden calls. */
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 9910b4e..d1c7b9c 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1371,7 +1371,7 @@ decide_peel_simple (struct loop *loop, int flags)
also branch from branch prediction POV (and probably better reason
to not unroll/peel). */
if (num_loop_branches (loop) > 1
- && profile_status != PROFILE_READ)
+ && profile_status_for_fn (cfun) != PROFILE_READ)
{
if (dump_file)
fprintf (dump_file, ";; Not peeling, contains branches\n");
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e035af1..5172bd4 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4286,7 +4286,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob)
insn = emit_jump_insn (GEN_FCN (icode) (test, XEXP (test, 0),
XEXP (test, 1), label));
if (prob != -1
- && profile_status != PROFILE_ABSENT
+ && profile_status_for_fn (cfun) != PROFILE_ABSENT
&& insn
&& JUMP_P (insn)
&& any_condjump_p (insn)
diff --git a/gcc/predict.c b/gcc/predict.c
index 1dec4dc..6bb1b2c 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -224,7 +224,7 @@ cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
bool
maybe_hot_edge_p (edge e)
{
- if (profile_status == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
return maybe_hot_count_p (cfun, e->count);
return maybe_hot_frequency_p (cfun, EDGE_FREQUENCY (e));
}
@@ -239,7 +239,7 @@ probably_never_executed (struct function *fun,
gcov_type count, int frequency)
{
gcc_checking_assert (fun);
- if (profile_status_for_fn (fun) == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
{
int unlikely_count_fraction = PARAM_VALUE (UNLIKELY_BB_COUNT_FRACTION);
if (count * unlikely_count_fraction >= profile_info->runs)
@@ -438,7 +438,7 @@ optimize_loop_nest_for_size_p (struct loop *loop)
bool
predictable_edge_p (edge e)
{
- if (profile_status == PROFILE_ABSENT)
+ if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
return false;
if ((e->probability
<= PARAM_VALUE (PARAM_PREDICTABLE_BRANCH_OUTCOME) * REG_BR_PROB_BASE / 100)
@@ -539,8 +539,8 @@ gimple_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
static bool
probability_reliable_p (int prob)
{
- return (profile_status == PROFILE_READ
- || (profile_status == PROFILE_GUESSED
+ return (profile_status_for_fn (cfun) == PROFILE_READ
+ || (profile_status_for_fn (cfun) == PROFILE_GUESSED
&& (prob <= HITRATE (1) || prob >= HITRATE (99))));
}

@@ -610,7 +610,7 @@ rtl_predict_edge (edge e, enum br_predictor predictor, int probability)
void
gimple_predict_edge (edge e, enum br_predictor predictor, int probability)
{
- gcc_assert (profile_status != PROFILE_GUESSED);
+ gcc_assert (profile_status_for_fn (cfun) != PROFILE_GUESSED);
if ((e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun) && EDGE_COUNT (e->src->succs) >
1)
&& flag_guess_branch_prob && optimize)
@@ -2443,8 +2443,8 @@ tree_estimate_probability_driver (void)
loop_optimizer_finalize ();
if (dump_file && (dump_flags & TDF_DETAILS))
gimple_dump_cfg (dump_file, dump_flags);
- if (profile_status == PROFILE_ABSENT)
- profile_status = PROFILE_GUESSED;
+ if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
+ profile_status_for_fn (cfun) = PROFILE_GUESSED;
return 0;
}

@@ -2954,7 +2954,7 @@ estimate_bb_frequencies (bool force)
basic_block bb;
sreal freq_max;

- if (force || profile_status != PROFILE_READ || !counts_to_freqs ())
+ if (force || profile_status_for_fn (cfun) != PROFILE_READ || !counts_to_freqs ())
{
static int real_values_initialized = 0;

@@ -3030,7 +3030,7 @@ compute_function_frequency (void)
if (DECL_STATIC_DESTRUCTOR (current_function_decl))
node->only_called_at_exit = true;

- if (profile_status != PROFILE_READ)
+ if (profile_status_for_fn (cfun) != PROFILE_READ)
{
int flags = flags_from_decl_or_type (current_function_decl);
if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
@@ -3189,8 +3189,8 @@ rebuild_frequencies (void)
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun), NULL, next_bb)
count_max = MAX (bb->count, count_max);

- if (profile_status == PROFILE_GUESSED
- || (profile_status == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
+ if (profile_status_for_fn (cfun) == PROFILE_GUESSED
+ || (profile_status_for_fn (cfun) == PROFILE_READ && count_max < REG_BR_PROB_BASE/10))
{
loop_optimizer_init (0);
add_noreturn_fake_exit_edges ();
@@ -3200,7 +3200,7 @@ rebuild_frequencies (void)
remove_fake_exit_edges ();
loop_optimizer_finalize ();
}
- else if (profile_status == PROFILE_READ)
+ else if (profile_status_for_fn (cfun) == PROFILE_READ)
counts_to_freqs ();
else
gcc_unreachable ();
diff --git a/gcc/profile.c b/gcc/profile.c
index 9aec3cb..24c16aa 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -797,7 +797,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
give all abnormals frequency of 0, otherwise distribute the
frequency over abnormals (this is the case of noreturn
calls). */
- else if (profile_status == PROFILE_ABSENT)
+ else if (profile_status_for_fn (cfun) == PROFILE_ABSENT)
{
int total = 0;

@@ -825,7 +825,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
}
}
counts_to_freqs ();
- profile_status = PROFILE_READ;
+ profile_status_for_fn (cfun) = PROFILE_READ;
compute_function_frequency ();

if (dump_file)
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f384b04..57d6487 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7875,11 +7875,11 @@ gimple_account_profile_record (basic_block bb, int after_pass,
{
record->size[after_pass]
+= estimate_num_insns (gsi_stmt (i), &eni_size_weights);
- if (profile_status == PROFILE_READ)
+ if (profile_status_for_fn (cfun) == PROFILE_READ)
record->time[after_pass]
+= estimate_num_insns (gsi_stmt (i),
&eni_time_weights) * bb->count;
- else if (profile_status == PROFILE_GUESSED)
+ else if (profile_status_for_fn (cfun) == PROFILE_GUESSED)
record->time[after_pass]
+= estimate_num_insns (gsi_stmt (i),
&eni_time_weights) * bb->frequency;
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 1d1bc1e..fd7eedb 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4612,7 +4612,8 @@ optimize_inline_calls (tree fn)
| TODO_cleanup_cfg
| (gimple_in_ssa_p (cfun) ? TODO_remove_unused_locals : 0)
| (gimple_in_ssa_p (cfun) ? TODO_update_address_taken : 0)
- | (profile_status != PROFILE_ABSENT ? TODO_rebuild_frequencies : 0));
+ | (profile_status_for_fn (cfun) != PROFILE_ABSENT
+ ? TODO_rebuild_frequencies : 0));
}

/* Passed to walk_tree. Copies the node pointed to, if appropriate. */
--
1.7.11.7
David Malcolm
2013-12-06 14:51:34 UTC
Permalink
gcc/
* basic-block.h (label_to_block_map): Eliminate macro.

* gimple.c (gimple_set_bb): Replace uses of label_to_block_map
with uses of label_to_block_map_for_fn, making uses of cfun be
explicit.
* tree-cfg.c (delete_tree_cfg_annotations): Likewise.
(verify_gimple_label): Likewise.
---
gcc/basic-block.h | 1 -
gcc/gimple.c | 8 +++++---
gcc/tree-cfg.c | 5 +++--
3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 69689f3..4ab8289 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -328,7 +328,6 @@ struct GTY(()) control_flow_graph {

/* Defines for textual backward source compatibility. */
#define last_basic_block (cfun->cfg->x_last_basic_block)
-#define label_to_block_map (cfun->cfg->x_label_to_block_map)
#define profile_status (cfun->cfg->x_profile_status)

/* For iterating over basic blocks. */
diff --git a/gcc/gimple.c b/gcc/gimple.c
index f11362a..077dca5 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1475,17 +1475,19 @@ gimple_set_bb (gimple stmt, basic_block bb)
uid = LABEL_DECL_UID (t);
if (uid == -1)
{
- unsigned old_len = vec_safe_length (label_to_block_map);
+ unsigned old_len =
+ vec_safe_length (label_to_block_map_for_fn (cfun));
LABEL_DECL_UID (t) = uid = cfun->cfg->last_label_uid++;
if (old_len <= (unsigned) uid)
{
unsigned new_len = 3 * uid / 2 + 1;

- vec_safe_grow_cleared (label_to_block_map, new_len);
+ vec_safe_grow_cleared (label_to_block_map_for_fn (cfun),
+ new_len);
}
}

- (*label_to_block_map)[uid] = bb;
+ (*label_to_block_map_for_fn (cfun))[uid] = bb;
}
}

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9558546..f384b04 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2379,7 +2379,7 @@ stmt_ends_bb_p (gimple t)
void
delete_tree_cfg_annotations (void)
{
- vec_free (label_to_block_map);
+ vec_free (label_to_block_map_for_fn (cfun));
}


@@ -4281,7 +4281,8 @@ verify_gimple_label (gimple stmt)

uid = LABEL_DECL_UID (decl);
if (cfun->cfg
- && (uid == -1 || (*label_to_block_map)[uid] != gimple_bb (stmt)))
+ && (uid == -1
+ || (*label_to_block_map_for_fn (cfun))[uid] != gimple_bb (stmt)))
{
error ("incorrect entry in label_to_block_map");
err |= true;
--
1.7.11.7
David Malcolm
2013-12-06 14:51:37 UTC
Permalink
gcc/
* basic-block.h (FOR_EACH_BB): Eliminate macro.

* asan.c (transform_statements, execute_sanopt): Eliminate
use of FOR_EACH_BB in favor of FOR_EACH_BB_FN, to make use of cfun
explicit.
* auto-inc-dec.c (rest_of_handle_auto_inc_dec): Likewise.
* bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges,
set_edge_can_fallthru_flag, fix_up_fall_thru_edges,
fix_crossing_unconditional_branches, add_reg_crossing_jump_notes,
insert_section_boundary_note, rest_of_handle_reorder_blocks,
duplicate_computed_gotos): Likewise.
* cfg.c (clear_edges, compact_blocks, brief_dump_cfg): Likewise.
* cfganal.c (find_unreachable_blocks, add_noreturn_fake_exit_edges,
compute_dominance_frontiers_1, single_pred_before_succ_order): Likewise.
* cfgbuild.c (find_many_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_dead_jumptables): Likewise.
* cfgexpand.c (add_scope_conflicts, discover_nonconstant_array_refs):
Likewise.
* cfgloop.c (flow_loops_cfg_dump, get_loop_body, record_loop_exits,
verify_loop_structure): Likewise.
* cfgloopanal.c (mark_loop_exit_edges): Likewise.
* cfgrtl.c (compute_bb_for_insn, find_partition_fixes,
verify_hot_cold_block_grouping, purge_all_dead_edges,
fixup_abnormal_edges, record_effective_endpoints,
outof_cfg_layout_mode, fixup_reorder_chain, force_one_exit_fallthru,
break_superblocks): Likewise.
* cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges,
cgraph_rebuild_references): Likewise.
* combine-stack-adj.c (combine_stack_adjustments): Likewise.
* combine.c (delete_noop_moves, create_log_links,
combine_instructions): Likewise.
* config/arm/arm.c (thumb1_reorg, thumb2_reorg): Likewise.
* config/bfin/bfin.c (bfin_gen_bundles, reorder_var_tracking_notes):
Likewise.
* config/c6x/c6x.c (c6x_gen_bundles, conditionalize_after_sched,
c6x_reorg): Likewise.
* config/epiphany/resolve-sw-modes.c (resolve_sw_modes): Likewise.
* config/frv/frv.c (frv_optimize_membar): Likewise.
* config/i386/i386.c (ix86_finalize_stack_realign_flags): Likewise.
* config/ia64/ia64.c (ia64_reorg): Likewise.
* config/mips/mips.c (mips_annotate_pic_calls): Likewise.
* config/picochip/picochip.c (reorder_var_tracking_notes): Likewise.
* config/rs6000/rs6000.c (rs6000_alloc_sdmode_stack_slot): Likewise.
* config/s390/s390.c (s390_regs_ever_clobbered): Likewise.
* config/spu/spu.c (spu_machine_dependent_reorg): Likewise.
* config/tilegx/tilegx.c (tilegx_gen_bundles,
reorder_var_tracking_notes): Likewise.
* config/tilepro/tilepro.c (tilepro_gen_bundles,
reorder_var_tracking_notes): Likewise.
* coverage.c (coverage_compute_cfg_checksum): Likewise.
* cprop.c (compute_hash_table_work, compute_cprop_data,
local_cprop_pass, find_implicit_sets): Likewise.
* cse.c (cse_condition_code_reg): Likewise.
* dce.c (prescan_insns_for_dce): Likewise.
* df-core.c (df_compact_blocks): Likewise.
* df-problems.c (df_word_lr_alloc): Likewise.
* df-scan.c (df_scan_start_dump, df_scan_blocks, df_insn_rescan_all,
df_update_entry_exit_and_calls): Likewise.
* dominance.c (calculate_dominance_info, verify_dominators,
debug_dominance_info): Likewise.
* dse.c (dse_step5_nospill): Likewise.
* except.c (finish_eh_generation): Likewise.
* final.c (compute_alignments): Likewise.
* function.c (thread_prologue_and_epilogue_insns,
rest_of_match_asm_constraints): Likewise.
* gcse.c (compute_hash_table_work, prune_expressions,
compute_pre_data, compute_code_hoist_vbeinout, hoist_code,
calculate_bb_reg_pressure, compute_ld_motion_mems): Likewise.
* gimple-iterator.c (gsi_commit_edge_inserts): Likewise.
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour,
find_explicit_erroneous_behaviour): Likewise.
* graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa,
rewrite_cross_bb_scalar_deps_out_of_ssa): Likewise.
* haifa-sched.c (haifa_sched_init): Likewise.
* hw-doloop.c (discover_loops, set_bb_indices, reorder_loops):
Likewise.
* ifcvt.c (if_convert): Likewise.
* init-regs.c (initialize_uninitialized_regs): Likewise.
* ipa-prop.c (ipcp_transform_function): Likewise.
* ipa-pure-const.c (analyze_function): Likewise.
* ipa-split.c (find_split_points, execute_split_functions): Likewise.
* ira-build.c (form_loop_tree): Likewise.
* ira-costs.c (find_costs_and_classes): Likewise.
* ira-emit.c (emit_moves, add_ranges_and_copies, ira_emit): Likewise.
* ira.c (decrease_live_ranges_number, compute_regs_asm_clobbered,
mark_elimination, update_equiv_regs, find_moveable_pseudos,
split_live_ranges_for_shrink_wrap, allocate_initial_values): Likewise.
* jump.c (mark_all_labels): Likewise.
* lcm.c (compute_laterin, compute_insert_delete, compute_available,
compute_nearerout, compute_rev_insert_delete): Likewise.
* loop-init.c (fix_loop_structure): Likewise.
* loop-invariant.c (calculate_loop_reg_pressure): Likewise.
* lower-subreg.c (decompose_multiword_subregs,
decompose_multiword_subregs): Likewise.
* lra-assigns.c (assign_by_spills): Likewise.
* lra-coalesce.c (lra_coalesce): Likewise.
* lra-constraints.c (lra_inheritance, remove_inheritance_pseudos):
Likewise.
* lra-eliminations.c (lra_init_elimination): Likewise.
* lra-spills.c (assign_spill_hard_regs, spill_pseudos,
lra_final_code_change): Likewise.
* lra.c (remove_scratches, check_rtl, has_nonexceptional_receiver,
update_inc_notes): Likewise.
* mcf.c (adjust_cfg_counts): Likewise.
* mode-switching.c (optimize_mode_switching): Likewise.
* modulo-sched.c (rest_of_handle_sms): Likewise.
* omp-low.c (optimize_omp_library_calls, expand_omp_taskreg,
expand_omp_target): Likewise.
* postreload-gcse.c (alloc_mem, compute_hash_table): Likewise.
* postreload.c (reload_cse_regs_1): Likewise.
* predict.c (strip_predict_hints, tree_bb_level_predictions,
tree_estimate_probability, expensive_function_p,
estimate_bb_frequencies, compute_function_frequency): Likewise.
* profile.c (is_inconsistent, compute_branch_probabilities,
branch_prob): Likewise.
* ree.c (find_removable_extensions): Likewise.
* reg-stack.c (compensate_edges, convert_regs, reg_to_stack): Likewise.
* regcprop.c (copyprop_hardreg_forward): Likewise.
* reginfo.c (init_subregs_of_mode): Likewise.
* regrename.c (regrename_analyze): Likewise.
* regstat.c (regstat_compute_ri, regstat_compute_calls_crossed):
Likewise.
* reload1.c (has_nonexceptional_receiver, reload,
calculate_elim_costs_all_insns): Likewise.
* resource.c (init_resource_info, free_resource_info): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, find_single_block_region,
haifa_find_rgns, sched_rgn_local_init): Likewise.
* sel-sched-dump.c (sel_dump_cfg_2): Likewise.
* sel-sched-ir.c (init_lv_sets, free_lv_sets,
make_regions_from_the_rest): Likewise.
* sese.c (build_sese_loop_nests, sese_build_liveouts): Likewise.
* stack-ptr-mod.c (notice_stack_pointer_modification): Likewise.
* store-motion.c (compute_store_table, build_store_vectors,
one_store_motion_pass): Likewise.
* tracer.c (tail_duplicate): Likewise.
* trans-mem.c (compute_transaction_bits): Likewise.
* tree-call-cdce.c (tree_call_cdce): Likewise.
* tree-cfg.c (replace_loop_annotate, factor_computed_gotos,
fold_cond_expr_cond, make_edges, assign_discriminators,
make_abnormal_goto_edges, cleanup_dead_labels, group_case_labels,
dump_cfg_stats, gimple_verify_flow_info, print_loop,
execute_fixup_cfg): Likewise.
* tree-cfgcleanup.c (cleanup_tree_cfg_1, merge_phi_nodes): Likewise.
* tree-complex.c (init_dont_simulate_again, tree_lower_complex):
Likewise.
* tree-dfa.c (collect_dfa_stats, dump_enumerated_decls): Likewise.
* tree-eh.c (execute_lower_resx, execute_lower_eh_dispatch,
mark_reachable_handlers): Likewise.
* tree-emutls.c (lower_emutls_function_body): Likewise.
* tree-if-conv.c (main_tree_if_conversion): Likewise.
* tree-inline.c (optimize_inline_calls): Likewise.
* tree-into-ssa.c (rewrite_into_ssa, update_ssa): Likewise.
* tree-nrv.c (tree_nrv, execute_return_slot_opt): Likewise.
* tree-object-size.c (compute_object_sizes): Likewise.
* tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees,
insert_backedge_copies, tree_profiling): Likewise.
* tree-scalar-evolution.c (scev_const_prop): Likewise.
* tree-sra.c (scan_function, sra_modify_function_body,
propagate_dereference_distances, ipa_sra_modify_function_body,
convert_callers): Likewise.
* tree-ssa-ccp.c (ccp_initialize, execute_fold_all_builtins): Likewise.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
create_outofssa_var_map, coalesce_partitions): Likewise.
* tree-ssa-copy.c (init_copy_prop): Likewise.
* tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
* tree-ssa-dce.c (find_obviously_necessary_stmts,
eliminate_unnecessary_stmts): Likewise.
* tree-ssa-dom.c (free_all_edge_infos, tree_ssa_dominator_optimize):
Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-live.c (clear_unused_block_pointer, remove_unused_locals,
new_tree_live_info, calculate_live_on_exit, dump_live_info,
analyze_memory_references, fill_always_executed_in,
tree_ssa_lim_finalize): Likewise.
* tree-ssa-loop-manip.c (find_uses_to_rename, verify_loop_closed_ssa):
Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals, execute_cse_sincos,
execute_optimize_bswap, execute_optimize_widening_mul): Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Likewise.
* tree-ssa-structalias.c (compute_points_to_sets): Likewise.
* tree-ssa-tail-merge.c (find_same_succ, reset_cluster_vectors):
Likewise.
* tree-ssa-ter.c (find_replaceable_exprs): Likewise.
* tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges,
tree_ssa_uncprop): Likewise.
* tree-ssa-uninit.c (warn_uninitialized_vars,
execute_late_warn_uninitialized): Likewise.
* tree-ssa.c (verify_ssa, execute_update_addresses_taken): Likewise.
* tree-stdarg.c (check_all_va_list_escapes, execute_optimize_stdarg):
Likewise.
* tree-switch-conversion.c (do_switchconv): Likewise.
* tree-vect-generic.c (expand_vector_operations): Likewise.
* tree-vectorizer.c (adjust_simduid_builtins, note_simd_array_uses,
execute_vect_slp): Likewise.
* tree-vrp.c (check_all_array_refs, remove_range_assertions,
vrp_initialize, identify_jump_threads, instrument_memory_accesses):
Likewise.
* ubsan.c (ubsan_pass): Likewise.
* value-prof.c (verify_histograms, gimple_value_profile_transformations,
gimple_find_values_to_profile): Likewise.
* var-tracking.c (vt_find_locations, dump_dataflow_sets, vt_emit_notes,
vt_initialize, delete_debug_insns, vt_finalize): Likewise.

gcc/testsuite/
* g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate
use of FOR_EACH_BB in favor of FOR_EACH_BB_FN, to make use of cfun
explicit.
* gcc.dg/plugin/selfassign.c (execute_warn_self_assign): Likewise.
---
gcc/asan.c | 4 ++--
gcc/auto-inc-dec.c | 2 +-
gcc/basic-block.h | 2 --
gcc/bb-reorder.c | 22 +++++++++++-----------
gcc/cfg.c | 6 +++---
gcc/cfganal.c | 8 ++++----
gcc/cfgbuild.c | 8 ++++----
gcc/cfgcleanup.c | 4 ++--
gcc/cfgexpand.c | 4 ++--
gcc/cfgloop.c | 14 +++++++-------
gcc/cfgloopanal.c | 2 +-
gcc/cfgrtl.c | 22 +++++++++++-----------
gcc/cgraphbuild.c | 6 +++---
gcc/combine-stack-adj.c | 2 +-
gcc/combine.c | 8 ++++----
gcc/config/arm/arm.c | 4 ++--
gcc/config/bfin/bfin.c | 4 ++--
gcc/config/c6x/c6x.c | 6 +++---
gcc/config/epiphany/resolve-sw-modes.c | 2 +-
gcc/config/frv/frv.c | 4 ++--
gcc/config/i386/i386.c | 2 +-
gcc/config/ia64/ia64.c | 2 +-
gcc/config/mips/mips.c | 2 +-
gcc/config/picochip/picochip.c | 2 +-
gcc/config/rs6000/rs6000.c | 2 +-
gcc/config/s390/s390.c | 2 +-
gcc/config/spu/spu.c | 2 +-
gcc/config/tilegx/tilegx.c | 4 ++--
gcc/config/tilepro/tilepro.c | 4 ++--
gcc/coverage.c | 2 +-
gcc/cprop.c | 8 ++++----
gcc/cse.c | 2 +-
gcc/dce.c | 2 +-
gcc/df-core.c | 8 ++++----
gcc/df-problems.c | 2 +-
gcc/df-scan.c | 8 ++++----
gcc/dominance.c | 6 +++---
gcc/dse.c | 2 +-
gcc/except.c | 2 +-
gcc/final.c | 4 ++--
gcc/function.c | 12 ++++++------
gcc/gcse.c | 16 ++++++++--------
gcc/gimple-iterator.c | 2 +-
gcc/gimple-ssa-isolate-paths.c | 4 ++--
gcc/graphite-sese-to-poly.c | 4 ++--
gcc/haifa-sched.c | 2 +-
gcc/hw-doloop.c | 6 +++---
gcc/ifcvt.c | 2 +-
gcc/init-regs.c | 2 +-
gcc/ipa-prop.c | 2 +-
gcc/ipa-pure-const.c | 2 +-
gcc/ipa-split.c | 4 ++--
gcc/ira-build.c | 2 +-
gcc/ira-costs.c | 2 +-
gcc/ira-emit.c | 14 +++++++-------
gcc/ira.c | 22 +++++++++++-----------
gcc/jump.c | 2 +-
gcc/lcm.c | 10 +++++-----
gcc/loop-init.c | 4 ++--
gcc/loop-invariant.c | 2 +-
gcc/lower-subreg.c | 4 ++--
gcc/lra-assigns.c | 2 +-
gcc/lra-coalesce.c | 4 ++--
gcc/lra-constraints.c | 4 ++--
gcc/lra-eliminations.c | 2 +-
gcc/lra-spills.c | 6 +++---
gcc/lra.c | 8 ++++----
gcc/mcf.c | 2 +-
gcc/mode-switching.c | 6 +++---
gcc/modulo-sched.c | 2 +-
gcc/omp-low.c | 6 +++---
gcc/postreload-gcse.c | 4 ++--
gcc/postreload.c | 2 +-
gcc/predict.c | 14 +++++++-------
gcc/profile.c | 8 ++++----
gcc/ree.c | 2 +-
gcc/reg-stack.c | 6 +++---
gcc/regcprop.c | 4 ++--
gcc/reginfo.c | 2 +-
gcc/regrename.c | 8 ++++----
gcc/regstat.c | 4 ++--
gcc/reload1.c | 8 ++++----
gcc/resource.c | 4 ++--
gcc/sched-ebb.c | 2 +-
gcc/sched-rgn.c | 26 +++++++++++++-------------
gcc/sel-sched-dump.c | 2 +-
gcc/sel-sched-ir.c | 10 +++++-----
gcc/sese.c | 6 +++---
gcc/stack-ptr-mod.c | 2 +-
gcc/store-motion.c | 6 +++---
gcc/testsuite/g++.dg/plugin/selfassign.c | 2 +-
gcc/testsuite/gcc.dg/plugin/selfassign.c | 2 +-
gcc/tracer.c | 2 +-
gcc/trans-mem.c | 2 +-
gcc/tree-call-cdce.c | 2 +-
gcc/tree-cfg.c | 28 ++++++++++++++--------------
gcc/tree-cfgcleanup.c | 4 ++--
gcc/tree-complex.c | 4 ++--
gcc/tree-dfa.c | 4 ++--
gcc/tree-eh.c | 6 +++---
gcc/tree-emutls.c | 2 +-
gcc/tree-if-conv.c | 2 +-
gcc/tree-inline.c | 2 +-
gcc/tree-into-ssa.c | 8 ++++----
gcc/tree-nrv.c | 6 +++---
gcc/tree-object-size.c | 2 +-
gcc/tree-outof-ssa.c | 6 +++---
gcc/tree-profile.c | 2 +-
gcc/tree-scalar-evolution.c | 2 +-
gcc/tree-sra.c | 10 +++++-----
gcc/tree-ssa-ccp.c | 6 +++---
gcc/tree-ssa-coalesce.c | 6 +++---
gcc/tree-ssa-copy.c | 2 +-
gcc/tree-ssa-copyrename.c | 4 ++--
gcc/tree-ssa-dce.c | 6 +++---
gcc/tree-ssa-dom.c | 4 ++--
gcc/tree-ssa-forwprop.c | 2 +-
gcc/tree-ssa-live.c | 18 +++++++++---------
gcc/tree-ssa-loop-im.c | 6 +++---
gcc/tree-ssa-loop-manip.c | 4 ++--
gcc/tree-ssa-math-opts.c | 10 +++++-----
gcc/tree-ssa-propagate.c | 2 +-
gcc/tree-ssa-structalias.c | 4 ++--
gcc/tree-ssa-tail-merge.c | 4 ++--
gcc/tree-ssa-ter.c | 2 +-
gcc/tree-ssa-threadupdate.c | 2 +-
gcc/tree-ssa-uncprop.c | 4 ++--
gcc/tree-ssa-uninit.c | 4 ++--
gcc/tree-ssa.c | 6 +++---
gcc/tree-stdarg.c | 6 +++---
gcc/tree-switch-conversion.c | 2 +-
gcc/tree-vect-generic.c | 2 +-
gcc/tree-vectorizer.c | 6 +++---
gcc/tree-vrp.c | 8 ++++----
gcc/tsan.c | 2 +-
gcc/ubsan.c | 2 +-
gcc/value-prof.c | 6 +++---
gcc/var-tracking.c | 16 ++++++++--------
138 files changed, 363 insertions(+), 365 deletions(-)

diff --git a/gcc/asan.c b/gcc/asan.c
index 09c0667..a50186c 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2043,7 +2043,7 @@ transform_statements (void)
gimple_stmt_iterator i;
int saved_last_basic_block = last_basic_block_for_fn (cfun);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
basic_block prev_bb = bb;

@@ -2557,7 +2557,7 @@ execute_sanopt (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 6006b70..be7fdf8 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1480,7 +1480,7 @@ rest_of_handle_auto_inc_dec (void)
reg_next_use = XCNEWVEC (rtx, max_reg);
reg_next_inc_use = XCNEWVEC (rtx, max_reg);
reg_next_def = XCNEWVEC (rtx, max_reg);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
merge_in_block (max_reg, bb);

free (reg_next_use);
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 174b650..b378a5b 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -333,8 +333,6 @@ struct GTY(()) control_flow_graph {
#define FOR_EACH_BB_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb)

-#define FOR_EACH_BB(BB) FOR_EACH_BB_FN (BB, cfun)
-
#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)

diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 363af2d..7f8ea07 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1566,7 +1566,7 @@ find_rarely_executed_basic_blocks_and_crossing_edges (void)
vec<basic_block> bbs_in_hot_partition = vNULL;

/* Mark which partition (hot/cold) each basic block belongs in. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool cold_bb = false;

@@ -1658,7 +1658,7 @@ find_rarely_executed_basic_blocks_and_crossing_edges (void)

/* Mark every edge that crosses between sections. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_EACH_EDGE (e, ei, bb->succs)
{
unsigned int flags = e->flags;
@@ -1691,7 +1691,7 @@ set_edge_can_fallthru_flag (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -1792,7 +1792,7 @@ fix_up_fall_thru_edges (void)
rtx old_jump;
rtx fall_thru_label;

- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
fall_thru = NULL;
if (EDGE_COUNT (cur_bb->succs) > 0)
@@ -1992,7 +1992,7 @@ fix_crossing_conditional_branches (void)
rtx old_label = NULL_RTX;
rtx new_label;

- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
crossing_edge = NULL;
if (EDGE_COUNT (cur_bb->succs) > 0)
@@ -2123,7 +2123,7 @@ fix_crossing_unconditional_branches (void)
rtx cur_insn;
edge succ;

- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
last_insn = BB_END (cur_bb);

@@ -2201,7 +2201,7 @@ add_reg_crossing_jump_notes (void)
edge e;
edge_iterator ei;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_EACH_EDGE (e, ei, bb->succs)
if ((e->flags & EDGE_CROSSING)
&& JUMP_P (BB_END (e->src))
@@ -2286,7 +2286,7 @@ insert_section_boundary_note (void)
if (!crtl->has_bb_partition)
return;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (!current_partition)
current_partition = BB_PARTITION (bb);
@@ -2321,7 +2321,7 @@ rest_of_handle_reorder_blocks (void)
reorder_basic_blocks ();
cleanup_cfg (CLEANUP_EXPENSIVE);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
cfg_layout_finalize ();
@@ -2410,7 +2410,7 @@ duplicate_computed_gotos (void)
/* Look for blocks that end in a computed jump, and see if such blocks
are suitable for unfactoring. If a block is a candidate for unfactoring,
mark it in the candidates. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
edge e;
@@ -2457,7 +2457,7 @@ duplicate_computed_gotos (void)
goto done;

/* Duplicate computed gotos. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->flags & BB_VISITED)
continue;
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 6c3181d..4f9d769 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -101,7 +101,7 @@ clear_edges (void)
edge e;
edge_iterator ei;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
free_edge (e);
@@ -163,7 +163,7 @@ compact_blocks (void)
basic_block bb;

i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
bb->index = i;
@@ -828,7 +828,7 @@ brief_dump_cfg (FILE *file, int flags)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
dump_bb_info (file, bb, 0,
flags & (TDF_COMMENT | TDF_DETAILS),
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 9900d82..3371b4a 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -159,7 +159,7 @@ find_unreachable_blocks (void)

/* Clear all the reachability flags. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_REACHABLE;

/* Add our starting points to the worklist. Almost always there will
@@ -554,7 +554,7 @@ add_noreturn_fake_exit_edges (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (EDGE_COUNT (bb->succs) == 0)
make_single_succ_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FAKE);
}
@@ -1236,7 +1236,7 @@ compute_dominance_frontiers_1 (bitmap_head *frontiers)
edge p;
edge_iterator ei;
basic_block b;
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
if (EDGE_COUNT (b->preds) >= 2)
{
@@ -1517,7 +1517,7 @@ single_pred_before_succ_order (void)
bitmap_clear (visited);

MARK_VISITED (ENTRY_BLOCK_PTR_FOR_FN (cfun));
- FOR_EACH_BB (x)
+ FOR_EACH_BB_FN (x, cfun)
{
if (VISITED_P (x))
continue;
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index f73bbc5..acfc73b 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -595,15 +595,15 @@ find_many_sub_basic_blocks (sbitmap blocks)
{
basic_block bb, min, max;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
SET_STATE (bb,
bitmap_bit_p (blocks, bb->index) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (STATE (bb) == BLOCK_TO_SPLIT)
find_bb_boundaries (bb);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (STATE (bb) != BLOCK_ORIGINAL)
break;

@@ -640,6 +640,6 @@ find_many_sub_basic_blocks (sbitmap blocks)
compute_outgoing_frequencies (bb);
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
SET_STATE (bb, 0);
}
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 234e5b6..cf72c03 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2613,7 +2613,7 @@ try_optimize_cfg (int mode)

crossjumps_occured = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
update_forwarder_flag (bb);

if (! targetm.cannot_modify_jumps_p ())
@@ -2955,7 +2955,7 @@ delete_dead_jumptables (void)

/* A dead jump table does not belong to any basic block. Scan insns
between two adjacent basic blocks. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 014f78b..56bcd80 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -520,7 +520,7 @@ add_scope_conflicts (void)
}
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
add_scope_conflicts_1 (bb, work, true);

free (rpo);
@@ -5378,7 +5378,7 @@ discover_nonconstant_array_refs (void)
basic_block bb;
gimple_stmt_iterator gsi;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 9d28950..5639e7a 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -50,7 +50,7 @@ flow_loops_cfg_dump (FILE *file)
if (!file)
return;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge succ;
edge_iterator ei;
@@ -834,7 +834,7 @@ get_loop_body (const struct loop *loop)
gcc_assert (loop->num_nodes == (unsigned) n_basic_blocks_for_fn (cfun));
body[tv++] = loop->header;
body[tv++] = EXIT_BLOCK_PTR_FOR_FN (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
body[tv++] = bb;
}
else
@@ -1082,7 +1082,7 @@ record_loop_exits (void)
loop_exit_hash, loop_exit_eq,
loop_exit_free);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
{
@@ -1343,7 +1343,7 @@ verify_loop_structure (void)
verify_dominators (CDI_DOMINATORS);

/* Check the headers. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_loop_header_p (bb))
{
if (bb->loop_father->header == NULL)
@@ -1479,7 +1479,7 @@ verify_loop_structure (void)
{
/* Record old info. */
irreds = sbitmap_alloc (last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
if (bb->flags & BB_IRREDUCIBLE_LOOP)
@@ -1495,7 +1495,7 @@ verify_loop_structure (void)
mark_irreducible_loops ();

/* Compare. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;

@@ -1578,7 +1578,7 @@ verify_loop_structure (void)

sizes = XCNEWVEC (unsigned, num);
memset (sizes, 0, sizeof (unsigned) * num);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
if (bb->loop_father == current_loops->tree_root)
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 84b61c1..5e89cb1c 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -432,7 +432,7 @@ mark_loop_exit_edges (void)
if (number_of_loops (cfun) <= 1)
return;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 5dc52a6..daadd9b 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -416,7 +416,7 @@ compute_bb_for_insn (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx end = BB_END (bb);
rtx insn;
@@ -2275,7 +2275,7 @@ find_partition_fixes (bool flag_only)
/* Callers check this. */
gcc_checking_assert (crtl->has_bb_partition);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if ((BB_PARTITION (bb) == BB_COLD_PARTITION))
bbs_in_cold_partition.safe_push (bb);

@@ -2372,7 +2372,7 @@ verify_hot_cold_block_grouping (void)
|| current_ir_type () != IR_RTL_CFGRTL)
return err;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (current_partition != BB_UNPARTITIONED
&& BB_PARTITION (bb) != current_partition)
@@ -3201,7 +3201,7 @@ purge_all_dead_edges (void)
int purged = false;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool purged_here = purge_dead_edges (bb);

@@ -3226,7 +3226,7 @@ fixup_abnormal_edges (void)
bool inserted = false;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -3449,7 +3449,7 @@ record_effective_endpoints (void)
cfg_layout_function_header = NULL_RTX;

next_insn = get_insns ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx end;

@@ -3479,7 +3479,7 @@ outof_cfg_layout_mode (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;

@@ -3857,7 +3857,7 @@ fixup_reorder_chain (void)
relink_block_chain (/*stay_in_cfglayout_mode=*/false);

/* Annoying special case - jump around dead jumptables left in the code. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e = find_fallthru_edge (bb->succs);

@@ -3868,7 +3868,7 @@ fixup_reorder_chain (void)
/* Ensure goto_locus from edges has some instructions with that locus
in RTL. */
if (!optimize)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -4047,7 +4047,7 @@ force_one_exit_fallthru (void)

/* Fix up the chain of blocks -- make FORWARDER immediately precede the
exit block. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->aux == NULL && bb != forwarder)
{
@@ -4258,7 +4258,7 @@ break_superblocks (void)
superblocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (superblocks);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->flags & BB_SUPERBLOCK)
{
bb->flags &= ~BB_SUPERBLOCK;
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 6c6698b..429dc8e 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -317,7 +317,7 @@ build_cgraph_edges (void)

/* Create the callgraph edges and record the nodes referenced by the function.
body. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -451,7 +451,7 @@ rebuild_cgraph_edges (void)

node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -505,7 +505,7 @@ cgraph_rebuild_references (void)

node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
ipa_record_stmt_references (node, gsi_stmt (gsi));
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 5ca131f..5c897cf 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -95,7 +95,7 @@ combine_stack_adjustments (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
combine_stack_adjustments_for_block (bb);
}

diff --git a/gcc/combine.c b/gcc/combine.c
index c7eb5e5..dea6c28 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -960,7 +960,7 @@ delete_noop_moves (void)
rtx insn, next;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
{
@@ -997,7 +997,7 @@ create_log_links (void)
usage -- these are taken from original flow.c did. Don't ask me why it is
done this way; I don't know and if it works, I don't want to know. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_REVERSE (bb, insn)
{
@@ -1160,7 +1160,7 @@ combine_instructions (rtx f, unsigned int nregs)
last_bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);

create_log_links ();
- FOR_EACH_BB (this_basic_block)
+ FOR_EACH_BB_FN (this_basic_block, cfun)
{
optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
last_call_luid = 0;
@@ -1211,7 +1211,7 @@ combine_instructions (rtx f, unsigned int nregs)
setup_incoming_promotions (first);
last_bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);

- FOR_EACH_BB (this_basic_block)
+ FOR_EACH_BB_FN (this_basic_block, cfun)
{
rtx last_combined_insn = NULL_RTX;
optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index b3a81b0..268e560 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -16548,7 +16548,7 @@ thumb1_reorg (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx dest, src;
rtx pat, op0, set = NULL;
@@ -16626,7 +16626,7 @@ thumb2_reorg (void)
compute_bb_for_insn ();
df_analyze ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;

diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a1adf80..c15451c 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3957,7 +3957,7 @@ static void
bfin_gen_bundles (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx slot[3];
@@ -4036,7 +4036,7 @@ static void
reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx queue = NULL_RTX;
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index af310ba..6f80bc8 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -4629,7 +4629,7 @@ c6x_gen_bundles (void)
basic_block bb;
rtx insn, next, last_call;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
/* The machine is eight insns wide. We can have up to six shadow
@@ -5383,7 +5383,7 @@ conditionalize_after_sched (void)
{
basic_block bb;
rtx insn;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned uid = INSN_UID (insn);
@@ -5959,7 +5959,7 @@ c6x_reorg (void)

if (c6x_flag_schedule_insns2)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if ((bb->flags & BB_DISABLE_SCHEDULE) == 0)
assign_reservations (BB_HEAD (bb), BB_END (bb));
}
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index a780254..30f6920 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -69,7 +69,7 @@ resolve_sw_modes (void)
df_note_add_problem ();
df_analyze ();
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
enum attr_fp_mode selected_mode;
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index a5aeb75..3755e62 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -8070,11 +8070,11 @@ frv_optimize_membar (void)
first_io = XCNEWVEC (struct frv_io, last_basic_block_for_fn (cfun));
last_membar = XCNEWVEC (rtx, last_basic_block_for_fn (cfun));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
frv_optimize_membar_local (bb, &first_io[bb->index],
&last_membar[bb->index]);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (last_membar[bb->index] != 0)
frv_optimize_membar_global (bb, first_io, last_membar[bb->index]);

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 0f6612d..aa9694f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10481,7 +10481,7 @@ ix86_finalize_stack_realign_flags (void)
add_to_hard_reg_set (&set_up_by_prologue, Pmode, ARG_POINTER_REGNUM);
add_to_hard_reg_set (&set_up_by_prologue, Pmode,
HARD_FRAME_POINTER_REGNUM);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 8f305c1..a837974 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -9688,7 +9688,7 @@ ia64_reorg (void)

/* We can't let modulo-sched prevent us from scheduling any bbs,
since we need the final schedule to produce bundle information. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_DISABLE_SCHEDULE;

initiate_bundle_states ();
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index f19478c..e65dc6b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15332,7 +15332,7 @@ mips_annotate_pic_calls (void)
basic_block bb;
rtx insn;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
rtx call, reg, symbol, second_call;
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index 4756cb7..8861ffc 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -3174,7 +3174,7 @@ reorder_var_tracking_notes (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next, last_insn = NULL_RTX;
rtx queue = NULL_RTX;
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 599cf49..1db97fa 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16395,7 +16395,7 @@ rs6000_alloc_sdmode_stack_slot (void)
if (TARGET_NO_SDMODE_STACK)
return;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree ret = walk_gimple_op (gsi_stmt (gsi), rs6000_check_sdmode, NULL);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index fcd7532..f9b7cd0 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7458,7 +7458,7 @@ s390_regs_ever_clobbered (char regs_ever_clobbered[])
if (!call_really_used_regs[i])
regs_ever_clobbered[i] = 1;

- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
FOR_BB_INSNS (cur_bb, cur_insn)
{
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 1a9895e..66209b6 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2645,7 +2645,7 @@ spu_machine_dependent_reorg (void)
find_many_sub_basic_blocks (blocks);

/* We have to schedule to make sure alignment is ok. */
- FOR_EACH_BB (bb) bb->flags &= ~BB_DISABLE_SCHEDULE;
+ FOR_EACH_BB_FN (bb, cfun) bb->flags &= ~BB_DISABLE_SCHEDULE;

/* The hints need to be scheduled, so call it again. */
schedule_insns ();
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index c2f9e07..eecc9a9 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -4383,7 +4383,7 @@ static void
tilegx_gen_bundles (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx end = NEXT_INSN (BB_END (bb));
@@ -4709,7 +4709,7 @@ static void
reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx queue = NULL_RTX;
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 31bc490..b2bafb4 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -3988,7 +3988,7 @@ static void
tilepro_gen_bundles (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx end = NEXT_INSN (BB_END (bb));
@@ -4259,7 +4259,7 @@ static void
reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx queue = NULL_RTX;
diff --git a/gcc/coverage.c b/gcc/coverage.c
index f2ac5fc..f7a2924 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -588,7 +588,7 @@ coverage_compute_cfg_checksum (void)
basic_block bb;
unsigned chksum = n_basic_blocks_for_fn (cfun);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 600c617..7d07246 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -400,7 +400,7 @@ compute_hash_table_work (struct hash_table_d *table)
/* Allocate vars to track sets of regs. */
reg_set_bitmap = ALLOC_REG_SET (NULL);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;

@@ -649,7 +649,7 @@ compute_cprop_data (void)
aren't recorded for the local pass so they cannot be propagated within
their basic block by this pass and 2) the global pass would otherwise
propagate them only in the successors of their basic block. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int index = implicit_set_indexes[bb->index];
if (index != -1)
@@ -1234,7 +1234,7 @@ local_cprop_pass (void)
unsigned i;

cselib_init (0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
{
@@ -1359,7 +1359,7 @@ find_implicit_sets (void)

implicit_sets = XCNEWVEC (rtx, implicit_sets_size);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Check for more than one successor. */
if (EDGE_COUNT (bb->succs) <= 1)
diff --git a/gcc/cse.c b/gcc/cse.c
index 74ae8ba..0e28f48 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7335,7 +7335,7 @@ cse_condition_code_reg (void)
else
cc_reg_2 = NULL_RTX;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx last_insn;
rtx cc_reg;
diff --git a/gcc/dce.c b/gcc/dce.c
index 07d31f7..3101102 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -623,7 +623,7 @@ prescan_insns_for_dce (bool fast)
if (!df_in_progress && ACCUMULATE_OUTGOING_ARGS)
arg_stores = BITMAP_ALLOC (NULL);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, prev)
if (NONDEBUG_INSN_P (insn))
diff --git a/gcc/df-core.c b/gcc/df-core.c
index d41fb72..ba57d39 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1543,7 +1543,7 @@ df_compact_blocks (void)
bitmap_set_bit (dflow->out_of_date_transfer_functions, EXIT_BLOCK);

i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (dflow->out_of_date_transfer_functions, i);
@@ -1564,7 +1564,7 @@ df_compact_blocks (void)
place in the block_info vector. Null out the copied
item. The entry and exit blocks never move. */
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
df_set_bb_info (dflow, i,
(char *)problem_temps
@@ -1590,7 +1590,7 @@ df_compact_blocks (void)
bitmap_copy (&tmp, df->blocks_to_analyze);
bitmap_clear (df->blocks_to_analyze);
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (df->blocks_to_analyze, i);
@@ -1601,7 +1601,7 @@ df_compact_blocks (void)
bitmap_clear (&tmp);

i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
bb->index = i;
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index ab19372..70f7254 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -2427,7 +2427,7 @@ df_word_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)

bitmap_obstack_initialize (&problem_data->word_lr_bitmaps);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, bb->index);

bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, ENTRY_BLOCK);
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 5f0ba4a..9f6f67a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -449,7 +449,7 @@ df_scan_start_dump (FILE *file ATTRIBUTE_UNUSED)
fprintf (file, "} ");
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (INSN_P (insn))
{
@@ -673,7 +673,7 @@ df_scan_blocks (void)
df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK));

/* Regular blocks */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
unsigned int bb_index = bb->index;
df_bb_refs_record (bb_index, true);
@@ -1415,7 +1415,7 @@ df_insn_rescan_all (void)
bitmap_clear (&df->insns_to_rescan);
bitmap_clear (&df->insns_to_notes_rescan);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
@@ -4154,7 +4154,7 @@ df_update_entry_exit_and_calls (void)

/* The call insns need to be rescanned because there may be changes
in the set of registers clobbered across the call. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
diff --git a/gcc/dominance.c b/gcc/dominance.c
index af73078..521b224 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -662,7 +662,7 @@ calculate_dominance_info (enum cdi_direction dir)
calc_dfs_tree (&di, reverse);
calc_idoms (&di, reverse);

- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
TBB d = di.dom[di.dfs_order[b->index]];

@@ -1025,7 +1025,7 @@ verify_dominators (enum cdi_direction dir)
calc_dfs_tree (&di, reverse);
calc_idoms (&di, reverse);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
imm_bb = get_immediate_dominator (dir, bb);
if (!imm_bb)
@@ -1492,7 +1492,7 @@ DEBUG_FUNCTION void
debug_dominance_info (enum cdi_direction dir)
{
basic_block bb, bb2;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if ((bb2 = get_immediate_dominator (dir, bb)))
fprintf (stderr, "%i %i\n", bb->index, bb2->index);
}
diff --git a/gcc/dse.c b/gcc/dse.c
index a926cb8..e5b0850 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -3507,7 +3507,7 @@ static void
dse_step5_nospill (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
insn_info_t insn_info = bb_info->last_insn;
diff --git a/gcc/except.c b/gcc/except.c
index e4b8cad..cf4fd14 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1511,7 +1511,7 @@ finish_eh_generation (void)
commit_edge_insertions ();

/* Redirect all EH edges from the post_landing_pad to the landing pad. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
eh_landing_pad lp;
edge_iterator ei;
diff --git a/gcc/final.c b/gcc/final.c
index 2ab6a4d..f475d27 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -700,14 +700,14 @@ compute_alignments (void)
flow_loops_dump (dump_file, NULL, 1);
}
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->frequency > freq_max)
freq_max = bb->frequency;
freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD);

if (dump_file)
fprintf (dump_file, "freq_max: %i\n",freq_max);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx label = BB_HEAD (bb);
int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
diff --git a/gcc/function.c b/gcc/function.c
index d257af4..e00f583 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6043,7 +6043,7 @@ thread_prologue_and_epilogue_insns (void)
max_grow_size = get_uncond_jump_length ();
max_grow_size *= PARAM_VALUE (PARAM_MAX_GROW_COPY_BB_INSNS);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
unsigned size = 0;
@@ -6120,7 +6120,7 @@ thread_prologue_and_epilogue_insns (void)
needing a prologue. */
bitmap_clear (&bb_on_list);
bitmap_and_compl (&bb_antic_flags, &bb_flags, &bb_tail);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (!bitmap_bit_p (&bb_antic_flags, bb->index))
continue;
@@ -6154,7 +6154,7 @@ thread_prologue_and_epilogue_insns (void)
/* Find exactly one edge that leads to a block in ANTIC from
a block that isn't. */
if (!bitmap_bit_p (&bb_antic_flags, entry_edge->dest->index))
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (!bitmap_bit_p (&bb_antic_flags, bb->index))
continue;
@@ -6202,7 +6202,7 @@ thread_prologue_and_epilogue_insns (void)
/* Find tail blocks reachable from both blocks needing a
prologue and blocks not needing a prologue. */
if (!bitmap_empty_p (&bb_tail))
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool some_pro, some_no_pro;
if (!bitmap_bit_p (&bb_tail, bb->index))
@@ -6480,7 +6480,7 @@ thread_prologue_and_epilogue_insns (void)
we take advantage of cfg_layout_finalize using
fixup_fallthru_exit_predecessor. */
cfg_layout_initialize (0);
- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
if (cur_bb->index >= NUM_FIXED_BLOCKS
&& cur_bb->next_bb->index >= NUM_FIXED_BLOCKS)
cur_bb->aux = cur_bb->next_bb;
@@ -7192,7 +7192,7 @@ rest_of_match_asm_constraints (void)
return 0;

df_set_flags (DF_DEFER_INSN_RESCAN);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
{
diff --git a/gcc/gcse.c b/gcc/gcse.c
index fa25a46..a6874ab 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -1559,7 +1559,7 @@ compute_hash_table_work (struct hash_table_d *table)
for (i = 0; i < max_reg_num (); ++i)
reg_avail_info[i].last_bb = NULL;

- FOR_EACH_BB (current_bb)
+ FOR_EACH_BB_FN (current_bb, cfun)
{
rtx insn;
unsigned int regno;
@@ -1899,7 +1899,7 @@ prune_expressions (bool pre_p)
}
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -2020,7 +2020,7 @@ compute_pre_data (void)
~(TRANSP | COMP)
*/

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_ior (ae_kill[bb->index], transp[bb->index], comp[bb->index]);
bitmap_not (ae_kill[bb->index], ae_kill[bb->index]);
@@ -2855,7 +2855,7 @@ compute_code_hoist_vbeinout (void)
{
fprintf (dump_file, "hoisting vbeinout computation: %d passes\n", passes);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (dump_file, "vbein (%d): ", bb->index);
dump_bitmap_file (dump_file, hoist_vbein[bb->index]);
@@ -3169,7 +3169,7 @@ hoist_code (void)
to_bb_head = XCNEWVEC (int, get_max_uid ());
bb_size = XCNEWVEC (int, last_basic_block_for_fn (cfun));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
int to_head;
@@ -3512,7 +3512,7 @@ calculate_bb_reg_pressure (void)

ira_setup_eliminable_regset ();
curr_regs_live = BITMAP_ALLOC (&reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
curr_bb = bb;
BB_DATA (bb)->live_in = BITMAP_ALLOC (NULL);
@@ -3562,7 +3562,7 @@ calculate_bb_reg_pressure (void)
return;

fprintf (dump_file, "\nRegister Pressure: \n");
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (dump_file, " Basic block %d: \n", bb->index);
for (i = 0; (int) i < ira_pressure_classes_num; i++)
@@ -3888,7 +3888,7 @@ compute_ld_motion_mems (void)
pre_ldst_mems = NULL;
pre_ldst_table.create (13);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
{
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index 9f51e6c..2460c61 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -839,7 +839,7 @@ gsi_commit_edge_inserts (void)
gsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)),
NULL);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_EACH_EDGE (e, ei, bb->succs)
gsi_commit_one_edge_insert (e, NULL);
}
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 052bf3f..aaa7537 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -216,7 +216,7 @@ find_implicit_erroneous_behaviour (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;

@@ -304,7 +304,7 @@ find_explicit_erroneous_behaviour (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;

diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 975db63..66c1b6e 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2295,7 +2295,7 @@ rewrite_reductions_out_of_ssa (scop_p scop)
gimple_stmt_iterator psi;
sese region = SCOP_REGION (scop);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
for (psi = gsi_start_phis (bb); !gsi_end_p (psi);)
{
@@ -2489,7 +2489,7 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop)
/* Create an extra empty BB after the scop. */
split_edge (SESE_EXIT (region));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
changed |= rewrite_cross_bb_scalar_deps (scop, &psi);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index d5e3309..4f3b054 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -6709,7 +6709,7 @@ haifa_sched_init (void)

sched_init_bbs ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bbs.quick_push (bb);
sched_init_luids (bbs);
sched_deps_init (true);
diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c
index 77c8149..b6184a2 100644
--- a/gcc/hw-doloop.c
+++ b/gcc/hw-doloop.c
@@ -357,7 +357,7 @@ discover_loops (bitmap_obstack *loop_stack, struct hw_doloop_hooks *hooks)
/* Find all the possible loop tails. This means searching for every
loop_end instruction. For each one found, create a hwloop_info
structure and add the head block to the work list. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx tail = BB_END (bb);
rtx insn, reg;
@@ -480,7 +480,7 @@ set_bb_indices (void)
intptr_t index;

index = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = (void *) index++;
}

@@ -537,7 +537,7 @@ reorder_loops (hwloop_info loops)
loops = loops->next;
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index ac0276c..543a70d 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -4408,7 +4408,7 @@ if_convert (bool after_combine)
fprintf (dump_file, "\n\n========== Pass %d ==========\n", pass);
#endif

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
basic_block new_bb;
while (!df_get_bb_dirty (bb)
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index 2a15b3e..d26ee9b 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -59,7 +59,7 @@ initialize_uninitialized_regs (void)

df_analyze ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
bitmap lr = DF_LR_IN (bb);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 83dc53e..7b16b7e 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4726,7 +4726,7 @@ ipcp_transform_function (struct cgraph_node *node)
descriptors.safe_grow_cleared (param_count);
ipa_populate_param_decls (node, descriptors);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
struct ipa_agg_replacement_value *v;
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index d84b35f..a60e078 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -754,7 +754,7 @@ analyze_function (struct cgraph_node *fn, bool ipa)

push_cfun (DECL_STRUCT_FUNCTION (decl));

- FOR_EACH_BB (this_block)
+ FOR_EACH_BB_FN (this_block, cfun)
{
gimple_stmt_iterator gsi;
struct walk_stmt_info wi;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index d5dfb8d..390adf1 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1070,7 +1070,7 @@ find_split_points (int overall_time, int overall_size)
stack.pop ();
}
ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux = NULL;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = NULL;
stack.release ();
BITMAP_FREE (current.ssa_names_to_pass);
@@ -1595,7 +1595,7 @@ execute_split_functions (void)
/* Compute local info about basic blocks and determine function size/time. */
bb_info_vec.safe_grow_cleared (last_basic_block_for_fn (cfun) + 1);
memset (&best_split_point, 0, sizeof (best_split_point));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int time = 0;
int size = 0;
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index f9258ee..660fb0d 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -341,7 +341,7 @@ form_loop_tree (void)
/* We can not use loop/bb node access macros because of potential
checking and because the nodes are not initialized enough
yet. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bb_node = &ira_bb_nodes[bb->index];
bb_node->bb = bb;
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index d7299e6..c8d64d5 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1585,7 +1585,7 @@ find_costs_and_classes (FILE *dump_file)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
process_bb_for_costs (bb);
}

diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index d59461b..196efa0 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -986,7 +986,7 @@ emit_moves (void)
edge e;
rtx insns, tmp;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (at_bb_start[bb->index] != NULL)
{
@@ -1203,7 +1203,7 @@ add_ranges_and_copies (void)
bitmap live_through;

live_through = ira_allocate_bitmap ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* It does not matter what loop_tree_node (of source or
destination block) to use for searching allocnos by their
@@ -1260,7 +1260,7 @@ ira_emit (bool loops_p)
ira_free_bitmap (renamed_regno_bitmap);
ira_free_bitmap (local_allocno_bitmap);
setup_entered_from_non_parent_p ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
at_bb_start[bb->index] = NULL;
at_bb_end[bb->index] = NULL;
@@ -1275,15 +1275,15 @@ ira_emit (bool loops_p)
memset (allocno_last_set_check, 0, sizeof (int) * max_reg_num ());
memset (hard_regno_last_set_check, 0, sizeof (hard_regno_last_set_check));
curr_tick = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
unify_moves (bb, true);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
unify_moves (bb, false);
move_vec.create (ira_allocnos_num);
emit_moves ();
add_ranges_and_copies ();
/* Clean up: */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
free_move_list (at_bb_start[bb->index]);
free_move_list (at_bb_end[bb->index]);
@@ -1301,7 +1301,7 @@ ira_emit (bool loops_p)
reload assumes initial insn codes defined. The insn codes can be
invalidated by CFG infrastructure for example in jump
redirection. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS_REVERSE (bb, insn)
if (INSN_P (insn))
recog_memoized (insn);
diff --git a/gcc/ira.c b/gcc/ira.c
index ae35035..b4ae0ca 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2135,7 +2135,7 @@ decrease_live_ranges_number (void)
if (ira_dump_file)
fprintf (ira_dump_file, "Starting decreasing number of live ranges...\n");

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
set = single_set (insn);
@@ -2358,7 +2358,7 @@ compute_regs_asm_clobbered (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS_REVERSE (bb, insn)
@@ -2951,7 +2951,7 @@ mark_elimination (int from, int to)
basic_block bb;
bitmap r;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
r = DF_LR_IN (bb);
if (bitmap_bit_p (r, from))
@@ -3473,7 +3473,7 @@ update_equiv_regs (void)
paradoxical subreg. Don't set such reg sequivalent to a mem,
because lra will not substitute such equiv memory in order to
prevent access beyond allocated memory for paradoxical memory subreg. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
for_each_rtx (&insn, set_paradoxical_subreg, (void *) pdx_subregs);
@@ -3481,7 +3481,7 @@ update_equiv_regs (void)
/* Scan the insns and find which registers have equivalences. Do this
in a separate scan of the insns because (due to -fcse-follow-jumps)
a register can be set below its use. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
loop_depth = bb_loop_depth (bb);

@@ -3905,7 +3905,7 @@ update_equiv_regs (void)

if (!bitmap_empty_p (cleared_regs))
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_and_compl_into (DF_LR_IN (bb), cleared_regs);
bitmap_and_compl_into (DF_LR_OUT (bb), cleared_regs);
@@ -4532,7 +4532,7 @@ find_moveable_pseudos (void)
bitmap_initialize (&used, 0);
bitmap_initialize (&set, 0);
bitmap_initialize (&unusable_as_input, 0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
bitmap transp = bb_transp_live + bb->index;
@@ -4595,7 +4595,7 @@ find_moveable_pseudos (void)
bitmap_clear (&used);
bitmap_clear (&set);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap local = bb_local + bb->index;
rtx insn;
@@ -4824,7 +4824,7 @@ find_moveable_pseudos (void)
}
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_clear (bb_local + bb->index);
bitmap_clear (bb_transp_live + bb->index);
@@ -4921,7 +4921,7 @@ split_live_ranges_for_shrink_wrap (void)
bitmap_initialize (&reachable, 0);
queue.create (n_basic_blocks_for_fn (cfun));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (CALL_P (insn) && !SIBLING_CALL_P (insn))
{
@@ -5145,7 +5145,7 @@ allocate_initial_values (void)
fixed regs are accepted. */
SET_REGNO (preg, new_regno);
/* Update global register liveness information. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (REGNO_REG_SET_P (df_get_live_in (bb), regno))
SET_REGNO_REG_SET (df_get_live_in (bb), new_regno);
diff --git a/gcc/jump.c b/gcc/jump.c
index a27aaa9..5eefeef 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -275,7 +275,7 @@ mark_all_labels (rtx f)
if (current_ir_type () == IR_RTL_CFGLAYOUT)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* In cfglayout mode, we don't bother with trivial next-insn
propagation of LABEL_REFs into JUMP_LABEL. This will be
diff --git a/gcc/lcm.c b/gcc/lcm.c
index 1129d6c..0b528d9 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -281,7 +281,7 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest,

/* Add all the blocks to the worklist. This prevents an early exit from
the loop given our optimistic initialization of LATER above. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
*qin++ = bb;
bb->aux = bb;
@@ -350,7 +350,7 @@ compute_insert_delete (struct edge_list *edge_list, sbitmap *antloc,
int x;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_and_compl (del[bb->index], antloc[bb->index],
laterin[bb->index]);

@@ -497,7 +497,7 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout,

/* Put every block on the worklist; this is necessary because of the
optimistic initialization of AVOUT above. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
*qin++ = bb;
bb->aux = bb;
@@ -638,7 +638,7 @@ compute_nearerout (struct edge_list *edge_list, sbitmap *farthest,

/* Add all the blocks to the worklist. This prevents an early exit
from the loop given our optimistic initialization of NEARER. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
*tos++ = bb;
bb->aux = bb;
@@ -695,7 +695,7 @@ compute_rev_insert_delete (struct edge_list *edge_list, sbitmap *st_avloc,
int x;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_and_compl (del[bb->index], st_avloc[bb->index],
nearerout[bb->index]);

diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 664b1ac..3dc6953 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -213,7 +213,7 @@ fix_loop_structure (bitmap changed_bbs)
/* Remember the depth of the blocks in the loop hierarchy, so that we can
recognize blocks whose loop nesting relationship has changed. */
if (changed_bbs)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = (void *) (size_t) loop_depth (bb->loop_father);

/* Remove the dead loops from structures. We start from the innermost
@@ -256,7 +256,7 @@ fix_loop_structure (bitmap changed_bbs)
/* Mark the blocks whose loop has changed. */
if (changed_bbs)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if ((void *) (size_t) loop_depth (bb->loop_father) != bb->aux)
bitmap_set_bit (changed_bbs, bb->index);
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 9f1fc07..f47bd50 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -1825,7 +1825,7 @@ calculate_loop_reg_pressure (void)
}
ira_setup_eliminable_regset ();
bitmap_initialize (&curr_regs_live, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
curr_loop = bb->loop_father;
if (curr_loop == current_loops->tree_root)
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 60c47b9..0b0e397 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1463,7 +1463,7 @@ decompose_multiword_subregs (bool decompose_copies)
memset (reg_copy_graph.address (), 0, sizeof (bitmap) * max);

speed_p = optimize_function_for_speed_p (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;

@@ -1543,7 +1543,7 @@ decompose_multiword_subregs (bool decompose_copies)
EXECUTE_IF_SET_IN_BITMAP (decomposable_context, 0, regno, iter)
decompose_register (regno);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;

diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index 88fc693..41ee286 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -1302,7 +1302,7 @@ assign_by_spills (void)

/* FIXME: Look up the changed insns in the cached LRA insn data using
an EXECUTE_IF_SET_IN_BITMAP over changed_insns. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (bitmap_bit_p (&changed_insns, INSN_UID (insn)))
{
diff --git a/gcc/lra-coalesce.c b/gcc/lra-coalesce.c
index 859e02f..94a21f0 100644
--- a/gcc/lra-coalesce.c
+++ b/gcc/lra-coalesce.c
@@ -239,7 +239,7 @@ lra_coalesce (void)
mv_num = 0;
/* Collect moves. */
coalesced_moves = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_SAFE (bb, insn, next)
if (INSN_P (insn)
@@ -297,7 +297,7 @@ lra_coalesce (void)
}
}
bitmap_initialize (&used_pseudos_bitmap, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
update_live_info (df_get_live_in (bb));
update_live_info (df_get_live_out (bb));
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bb5242a..f04166c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -5300,7 +5300,7 @@ lra_inheritance (void)
bitmap_initialize (&live_regs, &reg_obstack);
bitmap_initialize (&temp_bitmap, &reg_obstack);
bitmap_initialize (&ebb_global_regs, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
start_bb = bb;
if (lra_dump_file != NULL)
@@ -5401,7 +5401,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
because we need to marks insns affected by previous
inheritance/split pass for processing by the subsequent
constraint pass. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fix_bb_live_info (df_get_live_in (bb), remove_pseudos);
fix_bb_live_info (df_get_live_out (bb), remove_pseudos);
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index 915e3a0..6c52bb3 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -1284,7 +1284,7 @@ init_elimination (void)
struct elim_table *ep;

init_elim_table ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
curr_sp_change = 0;
stop_to_sp_elimination_p = false;
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 6bebb92..1e5f52b 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -280,7 +280,7 @@ assign_spill_hard_regs (int *pseudo_regnos, int n)
add_to_hard_reg_set (&reserved_hard_regs[p],
lra_reg_info[i].biggest_mode, hard_regno);
bitmap_initialize (&ok_insn_bitmap, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (DEBUG_INSN_P (insn)
|| ((set = single_set (insn)) != NULL_RTX
@@ -478,7 +478,7 @@ spill_pseudos (void)
bitmap_ior_into (&changed_insns, &lra_reg_info[i].insn_bitmap);
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
if (bitmap_bit_p (&changed_insns, INSN_UID (insn)))
@@ -686,7 +686,7 @@ lra_final_code_change (void)
if (lra_reg_info[i].nrefs != 0
&& (hard_regno = lra_get_regno_hard_regno (i)) >= 0)
SET_REGNO (regno_reg_rtx[i], hard_regno);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS_SAFE (bb, insn, curr)
if (INSN_P (insn))
{
diff --git a/gcc/lra.c b/gcc/lra.c
index 50a0786..21b8af1 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -1960,7 +1960,7 @@ remove_scratches (void)
scratches.create (get_max_uid ());
bitmap_initialize (&scratch_bitmap, &reg_obstack);
bitmap_initialize (&scratch_operand_bitmap, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (INSN_P (insn))
{
@@ -2049,7 +2049,7 @@ check_rtl (bool final_p)
rtx insn;

lra_assert (! final_p || reload_completed);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) != USE
@@ -2090,7 +2090,7 @@ has_nonexceptional_receiver (void)
/* First determine which blocks can reach exit via normal paths. */
tos = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) + 1);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_REACHABLE;

/* Place the exit block on our worklist. */
@@ -2165,7 +2165,7 @@ update_inc_notes (void)
basic_block bb;
rtx insn;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
{
diff --git a/gcc/mcf.c b/gcc/mcf.c
index e709f2a..f9b5505 100644
--- a/gcc/mcf.c
+++ b/gcc/mcf.c
@@ -1281,7 +1281,7 @@ adjust_cfg_counts (fixup_graph_type *fixup_graph)
{
fprintf (dump_file, "\nCheck %s() CFG flow conservation:\n",
current_function_name ());
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if ((bb->count != sum_edge_counts (bb->preds))
|| (bb->count != sum_edge_counts (bb->succs)))
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index a9e5069..4e31d68 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -516,7 +516,7 @@ optimize_mode_switching (void)
/* Determine what the first use (if any) need for a mode of entity E is.
This will be the mode that is anticipatable for this block.
Also compute the initial transparency settings. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct seginfo *ptr;
int last_mode = no_mode;
@@ -624,7 +624,7 @@ optimize_mode_switching (void)
int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
struct bb_info *info = bb_info[j];

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (info[bb->index].seginfo->mode == m)
bitmap_set_bit (antic[bb->index], j);
@@ -637,7 +637,7 @@ optimize_mode_switching (void)
/* Calculate the optimal locations for the
placement mode switches to modes with priority I. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_not (kill[bb->index], transp[bb->index]);
edge_list = pre_edge_lcm (n_entities, transp, comp, antic,
kill, &insert, &del);
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index f313044..ba8d020 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -3343,7 +3343,7 @@ rest_of_handle_sms (void)
max_regno = max_reg_num ();

/* Finalize layout changes. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
free_dominance_info (CDI_DOMINATORS);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index c929157..05fca40 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4545,7 +4545,7 @@ optimize_omp_library_calls (gimple entry_stmt)
&& find_omp_clause (gimple_omp_task_clauses (entry_stmt),
OMP_CLAUSE_UNTIED) != NULL);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple call = gsi_stmt (gsi);
@@ -4849,7 +4849,7 @@ expand_omp_taskreg (struct omp_region *region)
basic_block bb;
bool changed = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
changed |= gimple_purge_dead_eh_edges (bb);
if (changed)
cleanup_tree_cfg ();
@@ -7939,7 +7939,7 @@ expand_omp_target (struct omp_region *region)
basic_block bb;
bool changed = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
changed |= gimple_purge_dead_eh_edges (bb);
if (changed)
cleanup_tree_cfg ();
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 9ce17e5..a1204f9 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -266,7 +266,7 @@ alloc_mem (void)
/* Find the largest UID and create a mapping from UIDs to CUIDs. */
uid_cuid = XCNEWVEC (int, get_max_uid () + 1);
i = 1;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
@@ -828,7 +828,7 @@ compute_hash_table (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;

diff --git a/gcc/postreload.c b/gcc/postreload.c
index b0c6342..bfa5a38 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -213,7 +213,7 @@ reload_cse_regs_1 (void)
cselib_init (CSELIB_RECORD_MEMORY);
init_alias_analysis ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
diff --git a/gcc/predict.c b/gcc/predict.c
index 6bb1b2c..78efb72 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1955,7 +1955,7 @@ strip_predict_hints (void)
gimple ass_stmt;
tree var;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator bi;
for (bi = gsi_start_bb (bb); !gsi_end_p (bi);)
@@ -2226,7 +2226,7 @@ tree_bb_level_predictions (void)

apply_return_prediction ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

@@ -2400,10 +2400,10 @@ tree_estimate_probability (void)
if (number_of_loops (cfun) > 1)
predict_loops ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
tree_estimate_probability_bb (bb);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
combine_predictions_for_bb (bb);

#ifdef ENABLE_CHECKING
@@ -2928,7 +2928,7 @@ expensive_function_p (int threshold)

/* Maximally BB_FREQ_MAX^2 so overflow won't happen. */
limit = ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency * threshold;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;

@@ -2997,7 +2997,7 @@ estimate_bb_frequencies (bool force)
estimate_loops ();

memcpy (&freq_max, &real_zero, sizeof (real_zero));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (sreal_compare (&freq_max, &BLOCK_INFO (bb)->frequency) < 0)
memcpy (&freq_max, &BLOCK_INFO (bb)->frequency, sizeof (freq_max));

@@ -3055,7 +3055,7 @@ compute_function_frequency (void)
functions to unlikely and that is most of what we care about. */
if (!cfun->after_inlining)
node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (maybe_hot_bb_p (cfun, bb))
{
diff --git a/gcc/profile.c b/gcc/profile.c
index 24c16aa..62b126c 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -354,7 +354,7 @@ is_inconsistent (void)
{
basic_block bb;
bool inconsistent = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
inconsistent |= is_edge_inconsistent (bb->preds);
if (!dump_file && inconsistent)
@@ -692,7 +692,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)

/* If the graph has been correctly solved, every block will have a
succ and pred count of zero. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gcc_assert (!BB_INFO (bb)->succ_count && !BB_INFO (bb)->pred_count);
}
@@ -1021,7 +1021,7 @@ branch_prob (void)
We also add fake exit edges for each call and asm statement in the
basic, since it may not return. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int need_exit_edge = 0, need_entry_edge = 0;
int have_exit_edge = 0, have_entry_edge = 0;
@@ -1260,7 +1260,7 @@ branch_prob (void)
/* Initialize the output. */
output_location (NULL, 0, NULL, NULL);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
gcov_position_t offset = 0;
diff --git a/gcc/ree.c b/gcc/ree.c
index 87427fd..9938e98 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -835,7 +835,7 @@ find_removable_extensions (void)
rtx insn, set;
unsigned *def_map = XCNEWVEC (unsigned, max_insn_uid);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (!NONDEBUG_INSN_P (insn))
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 6aad466..87b9821 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2846,7 +2846,7 @@ compensate_edges (void)

starting_stack_p = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun))
{
edge e;
@@ -3153,7 +3153,7 @@ convert_regs (void)

/* ??? Process all unreachable blocks. Though there's no excuse
for keeping these even when not optimizing. */
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
block_info bi = BLOCK_INFO (b);

@@ -3212,7 +3212,7 @@ reg_to_stack (void)

/* Set up block info for each basic block. */
alloc_aux_for_blocks (sizeof (struct block_info_def));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
block_info bi = BLOCK_INFO (bb);
edge_iterator ei;
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 0438875..3c9ef3d 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1076,7 +1076,7 @@ copyprop_hardreg_forward (void)
= create_alloc_pool ("debug insn changes pool",
sizeof (struct queued_debug_insn_change), 256);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_set_bit (visited, bb->index);

@@ -1112,7 +1112,7 @@ copyprop_hardreg_forward (void)

if (MAY_HAVE_DEBUG_INSNS)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bitmap_bit_p (visited, bb->index)
&& all_vd[bb->index].n_debug_insn_changes)
{
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index db66a09..46288eb 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1266,7 +1266,7 @@ init_subregs_of_mode (void)
bitmap_obstack_initialize (&srom_obstack);
subregs_of_mode = BITMAP_ALLOC (&srom_obstack);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
find_subregs_of_mode (PATTERN (insn), subregs_of_mode);
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 3c242fb..9ff94d0 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -674,7 +674,7 @@ regrename_analyze (bitmap bb_mask)
/* Gather some information about the blocks in this function. */
rename_info = XCNEWVEC (struct bb_rename_info, n_basic_blocks_for_fn (cfun));
i = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct bb_rename_info *ri = rename_info + i;
ri->bb = bb;
@@ -778,7 +778,7 @@ regrename_analyze (bitmap bb_mask)
We perform the analysis for both incoming and outgoing edges, but we
only need to merge once (in the second part, after verifying outgoing
edges). */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct bb_rename_info *bb_ri = (struct bb_rename_info *) bb->aux;
unsigned j;
@@ -843,7 +843,7 @@ regrename_analyze (bitmap bb_mask)
}
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct bb_rename_info *bb_ri = (struct bb_rename_info *) bb->aux;
unsigned j;
@@ -920,7 +920,7 @@ regrename_analyze (bitmap bb_mask)

free (rename_info);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = NULL;
}

diff --git a/gcc/regstat.c b/gcc/regstat.c
index 48d27c3..6a191d8 100644
--- a/gcc/regstat.c
+++ b/gcc/regstat.c
@@ -375,7 +375,7 @@ regstat_compute_ri (void)
reg_info_p = XCNEWVEC (struct reg_info_t, max_regno);
local_live_last_luid = XNEWVEC (int, max_regno);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
regstat_bb_compute_ri (bb->index, live, artificial_uses,
local_live, local_processed,
@@ -522,7 +522,7 @@ regstat_compute_calls_crossed (void)
reg_info_p_size = max_regno;
reg_info_p = XCNEWVEC (struct reg_info_t, max_regno);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
regstat_bb_compute_calls_crossed (bb->index, live);
}
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 15c6db5..47439ce 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -613,7 +613,7 @@ has_nonexceptional_receiver (void)
/* First determine which blocks can reach exit via normal paths. */
tos = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) + 1);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_REACHABLE;

/* Place the exit block on our worklist. */
@@ -641,7 +641,7 @@ has_nonexceptional_receiver (void)

/* Now see if there's a reachable block with an exceptional incoming
edge. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->flags & BB_REACHABLE && bb_has_abnormal_pred (bb))
return true;

@@ -1048,7 +1048,7 @@ reload (rtx first, int global)
pseudo. */

if (! frame_pointer_needed)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear_bit (df_get_live_in (bb), HARD_FRAME_POINTER_REGNUM);

/* Come here (with failure set nonzero) if we can't get enough spill
@@ -1592,7 +1592,7 @@ calculate_elim_costs_all_insns (void)
set_initial_elim_offsets ();
set_initial_label_offsets ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
elim_bb = bb;
diff --git a/gcc/resource.c b/gcc/resource.c
index 861d969..442c852 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1219,7 +1219,7 @@ init_resource_info (rtx epilogue_insn)
bb_ticks = XCNEWVEC (int, last_basic_block_for_fn (cfun));

/* Set the BLOCK_FOR_INSN of each label that starts a basic block. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (LABEL_P (BB_HEAD (bb)))
BLOCK_FOR_INSN (BB_HEAD (bb)) = bb;
}
@@ -1258,7 +1258,7 @@ free_resource_info (void)
bb_ticks = NULL;
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (LABEL_P (BB_HEAD (bb)))
BLOCK_FOR_INSN (BB_HEAD (bb)) = NULL;
}
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 73af0a7..d4baec5 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -637,7 +637,7 @@ schedule_ebbs (void)
schedule_ebbs_init ();

/* Schedule every region in the subroutine. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx head = BB_HEAD (bb);

diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index a85ee5b..7fa9759 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -272,7 +272,7 @@ is_cfg_nonregular (void)

/* If we have insns which refer to labels as non-jumped-to operands,
then we consider the cfg not well structured. */
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
FOR_BB_INSNS (b, insn)
{
rtx note, next, set, dest;
@@ -317,7 +317,7 @@ is_cfg_nonregular (void)
Unreachable loops with a single block are detected here. This
test is redundant with the one in find_rgns, but it's much
cheaper to go ahead and catch the trivial case here. */
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
if (EDGE_COUNT (b->preds) == 0
|| (single_pred_p (b)
@@ -479,7 +479,7 @@ find_single_block_region (bool ebbs_p)
probability_cutoff = PARAM_VALUE (TRACER_MIN_BRANCH_PROBABILITY);
probability_cutoff = REG_BR_PROB_BASE / 100 * probability_cutoff;

- FOR_EACH_BB (ebb_start)
+ FOR_EACH_BB_FN (ebb_start, cfun)
{
RGN_NR_BLOCKS (nr_regions) = 0;
RGN_BLOCKS (nr_regions) = i;
@@ -512,7 +512,7 @@ find_single_block_region (bool ebbs_p)
}
}
else
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rgn_bb_table[nr_regions] = bb->index;
RGN_NR_BLOCKS (nr_regions) = 1;
@@ -762,7 +762,7 @@ haifa_find_rgns (void)
the entry node by placing a nonzero value in dfs_nr. Thus if
dfs_nr is zero for any block, then it must be unreachable. */
unreachable = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (dfs_nr[bb->index] == 0)
{
unreachable = 1;
@@ -773,7 +773,7 @@ haifa_find_rgns (void)
to hold degree counts. */
degree = dfs_nr;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
degree[bb->index] = EDGE_COUNT (bb->preds);

/* Do not perform region scheduling if there are any unreachable
@@ -807,7 +807,7 @@ haifa_find_rgns (void)

/* Find blocks which are inner loop headers. We still have non-reducible
loops to consider at this point. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bitmap_bit_p (header, bb->index) && bitmap_bit_p (inner, bb->index))
{
@@ -826,7 +826,7 @@ haifa_find_rgns (void)
If there exists a block that is not dominated by the loop
header, then the block is reachable from outside the loop
and thus the loop is not a natural loop. */
- FOR_EACH_BB (jbb)
+ FOR_EACH_BB_FN (jbb, cfun)
{
/* First identify blocks in the loop, except for the loop
entry block. */
@@ -874,7 +874,7 @@ haifa_find_rgns (void)
Place those blocks into the queue. */
if (no_loops)
{
- FOR_EACH_BB (jbb)
+ FOR_EACH_BB_FN (jbb, cfun)
/* Leaf nodes have only a single successor which must
be EXIT_BLOCK. */
if (single_succ_p (jbb)
@@ -1052,7 +1052,7 @@ haifa_find_rgns (void)

/* Any block that did not end up in a region is placed into a region
by itself. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (degree[bb->index] >= 0)
{
rgn_bb_table[idx] = bb->index;
@@ -3281,7 +3281,7 @@ sched_rgn_local_init (int rgn)

/* Use ->aux to implement EDGE_TO_BIT mapping. */
rgn_nr_edges = 0;
- FOR_EACH_BB (block)
+ FOR_EACH_BB_FN (block, cfun)
{
if (CONTAINING_RGN (block->index) != rgn)
continue;
@@ -3291,7 +3291,7 @@ sched_rgn_local_init (int rgn)

rgn_edges = XNEWVEC (edge, rgn_nr_edges);
rgn_nr_edges = 0;
- FOR_EACH_BB (block)
+ FOR_EACH_BB_FN (block, cfun)
{
if (CONTAINING_RGN (block->index) != rgn)
continue;
@@ -3312,7 +3312,7 @@ sched_rgn_local_init (int rgn)
/* Cleanup ->aux used for EDGE_TO_BIT mapping. */
/* We don't need them anymore. But we want to avoid duplication of
aux fields in the newly created edges. */
- FOR_EACH_BB (block)
+ FOR_EACH_BB_FN (block, cfun)
{
if (CONTAINING_RGN (block->index) != rgn)
continue;
diff --git a/gcc/sel-sched-dump.c b/gcc/sel-sched-dump.c
index 347b5eb..2e46770 100644
--- a/gcc/sel-sched-dump.c
+++ b/gcc/sel-sched-dump.c
@@ -750,7 +750,7 @@ sel_dump_cfg_2 (FILE *f, int flags)
if (flags & SEL_DUMP_CFG_FUNCTION_NAME)
fprintf (f, "function [label = \"%s\"];\n", current_function_name ());

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
insn_t insn = BB_HEAD (bb);
insn_t next_tail = NEXT_INSN (BB_END (bb));
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index f7cc9ec..942d909 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4321,7 +4321,7 @@ init_lv_sets (void)
basic_block bb;

/* Initialize of LV sets. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
init_lv_set (bb);

/* Don't forget EXIT_BLOCK. */
@@ -4349,7 +4349,7 @@ free_lv_sets (void)
free_lv_set (EXIT_BLOCK_PTR_FOR_FN (cfun));

/* Free LV sets. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (BB_LV_SET (bb))
free_lv_set (bb);
}
@@ -6155,7 +6155,7 @@ make_regions_from_the_rest (void)
for (i = 0; i < last_basic_block_for_fn (cfun); i++)
loop_hdr[i] = -1;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->loop_father && !bb->loop_father->num == 0
&& !(bb->flags & BB_IRREDUCIBLE_LOOP))
@@ -6165,7 +6165,7 @@ make_regions_from_the_rest (void)
/* For each basic block degree is calculated as the number of incoming
edges, that are going out of bbs that are not yet scheduled.
The basic blocks that are scheduled have degree value of zero. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
degree[bb->index] = 0;

@@ -6183,7 +6183,7 @@ make_regions_from_the_rest (void)

/* Any block that did not end up in a region is placed into a region
by itself. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (degree[bb->index] >= 0)
{
rgn_bb_table[cur_rgn_blocks] = bb->index;
diff --git a/gcc/sese.c b/gcc/sese.c
index 7e59ac8..5e47ef7 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -156,7 +156,7 @@ build_sese_loop_nests (sese region)
basic_block bb;
struct loop *loop0, *loop1;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
{
struct loop *loop = bb->loop_father;
@@ -303,10 +303,10 @@ sese_build_liveouts (sese region, bitmap liveouts)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
sese_build_liveouts_bb (region, liveouts, bb);
if (MAY_HAVE_DEBUG_STMTS)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
sese_reset_debug_liveouts_bb (region, liveouts, bb);
}

diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index 68ccd16..acca801 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -58,7 +58,7 @@ notice_stack_pointer_modification (void)
been used. */
crtl->sp_is_unchanging = !cfun->calls_alloca;
if (crtl->sp_is_unchanging)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index 808b0a7..57c991a 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -656,7 +656,7 @@ compute_store_table (void)
already_set = XNEWVEC (int, max_gcse_regno);

/* Find all the stores we care about. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* First compute the registers set in this block. */
FOR_BB_INSNS (bb, insn)
@@ -1061,7 +1061,7 @@ build_store_vectors (void)
bitmap_vector_clear (st_transp, last_basic_block_for_fn (cfun));
regs_set_in_block = XNEWVEC (int, max_gcse_regno);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
memset (regs_set_in_block, 0, sizeof (int) * max_gcse_regno);

@@ -1188,7 +1188,7 @@ one_store_motion_pass (void)

/* Now we want to insert the new stores which are going to be needed. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bitmap_bit_p (st_delete_map[bb->index], ptr->index))
{
delete_store (ptr, bb);
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index be5a204..041f25d 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -261,7 +261,7 @@ execute_warn_self_assign (void)
gimple_stmt_iterator gsi;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
warn_self_assign (gsi_stmt (gsi));
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index be5a204..041f25d 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -261,7 +261,7 @@ execute_warn_self_assign (void)
gimple_stmt_iterator gsi;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
warn_self_assign (gsi_stmt (gsi));
diff --git a/gcc/tracer.c b/gcc/tracer.c
index de6877a..a40cbeb 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -256,7 +256,7 @@ tail_duplicate (void)
branch_ratio_cutoff =
(REG_BR_PROB_BASE / 100 * PARAM_VALUE (TRACER_MIN_BRANCH_RATIO));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int n = count_insns (bb);
if (!ignore_bb_p (bb))
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 2a6597d..c9af680 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2656,7 +2656,7 @@ compute_transaction_bits (void)
certainly don't need it to calculate CDI_DOMINATOR info. */
gate_tm_init ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_IN_TRANSACTION;

for (region = all_tm_regions; region; region = region->next)
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 19402e3..32d0d5a 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -876,7 +876,7 @@ tree_call_cdce (void)
gimple_stmt_iterator i;
bool something_changed = false;
auto_vec<gimple> cond_dead_built_in_calls;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Collect dead call candidates. */
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ec365b5..98434ac 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -302,7 +302,7 @@ replace_loop_annotate ()
}

/* Remove IFN_ANNOTATE. Safeguard for the case loop->latch == NULL. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gsi = gsi_last_bb (bb);
stmt = gsi_stmt (gsi);
@@ -456,7 +456,7 @@ factor_computed_gotos (void)
Examine the last statement in each basic block to see if the block
ends with a computed goto. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_last_bb (bb);
gimple last;
@@ -635,7 +635,7 @@ fold_cond_expr_cond (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple stmt = last_stmt (bb);

@@ -682,7 +682,7 @@ make_edges (void)
EDGE_FALLTHRU);

/* Traverse the basic block array placing edges. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last = last_stmt (bb);
bool fallthru;
@@ -836,7 +836,7 @@ assign_discriminators (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -1055,7 +1055,7 @@ make_abnormal_goto_edges (basic_block bb, bool for_call)
basic_block target_bb;
gimple_stmt_iterator gsi;

- FOR_EACH_BB (target_bb)
+ FOR_EACH_BB_FN (target_bb, cfun)
{
for (gsi = gsi_start_bb (target_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1235,7 +1235,7 @@ cleanup_dead_labels (void)

/* Find a suitable label for each block. We use the first user-defined
label if there is one, or otherwise just the first label we see. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

@@ -1271,7 +1271,7 @@ cleanup_dead_labels (void)

/* Now redirect all jumps/branches to the selected label.
First do so for each block ending in a control statement. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple stmt = last_stmt (bb);
tree label, new_label;
@@ -1363,7 +1363,7 @@ cleanup_dead_labels (void)
/* Finally, purge dead labels. All user-defined labels and labels that
can be the target of non-local gotos and labels which have their
address taken are preserved. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
tree label_for_this_bb = label_for_bb[bb->index].label;
@@ -1487,7 +1487,7 @@ group_case_labels (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple stmt = last_stmt (bb);
if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
@@ -2160,7 +2160,7 @@ dump_cfg_stats (FILE *file)
SCALE (size), LABEL (size));

num_edges = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
num_edges += EDGE_COUNT (bb->succs);
size = num_edges * sizeof (struct edge_def);
total += size;
@@ -4894,7 +4894,7 @@ gimple_verify_flow_info (void)
err = 1;
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool found_ctrl_stmt = false;

@@ -7241,7 +7241,7 @@ print_loop (FILE *file, struct loop *loop, int indent, int verbosity)
if (verbosity >= 1)
{
fprintf (file, "%s{\n", s_indent);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->loop_father == loop)
print_loops_bb (file, bb, indent, verbosity);

@@ -8331,7 +8331,7 @@ execute_fixup_cfg (void)
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
e->count = apply_scale (e->count, count_scale);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bb->count = apply_scale (bb->count, count_scale);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 50b4a68..949b21d 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -640,7 +640,7 @@ cleanup_tree_cfg_1 (void)
recording of edge to CASE_LABEL_EXPR. */
start_recording_case_labels ();

- /* Start by iterating over all basic blocks. We cannot use FOR_EACH_BB,
+ /* Start by iterating over all basic blocks. We cannot use FOR_EACH_BB_FN,
since the basic blocks may get removed. */
n = last_basic_block_for_fn (cfun);
for (i = NUM_FIXED_BLOCKS; i < n; i++)
@@ -918,7 +918,7 @@ merge_phi_nodes (void)
calculate_dominance_info (CDI_DOMINATORS);

/* Find all PHI nodes that we may be able to merge. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
basic_block dest;

diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index ff5ccab..8c9a3aa 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -207,7 +207,7 @@ init_dont_simulate_again (void)
gimple phi;
bool saw_a_complex_op = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1637,7 +1637,7 @@ tree_lower_complex (void)

/* ??? Ideally we'd traverse the blocks in breadth-first order. */
old_last_basic_block = last_basic_block_for_fn (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->index >= old_last_basic_block)
continue;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 27d6a71..2d964d5 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -279,7 +279,7 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d));

/* Walk all the statements in the function counting references. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;

@@ -741,7 +741,7 @@ dump_enumerated_decls (FILE *file, int flags)

memset (&wi, '\0', sizeof (wi));
wi.info = (void *) &decl_list;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 85dc79f..467eb20 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3304,7 +3304,7 @@ execute_lower_resx (void)

mnt_map = pointer_map_create ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last = last_stmt (bb);
if (last && is_gimple_resx (last))
@@ -3710,7 +3710,7 @@ execute_lower_eh_dispatch (void)

assign_filter_values ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last = last_stmt (bb);
if (last == NULL)
@@ -3810,7 +3810,7 @@ mark_reachable_handlers (sbitmap *r_reachablep, sbitmap *lp_reachablep)
else
lp_reachable = NULL;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 9ba25fc..32599eb 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -638,7 +638,7 @@ lower_emutls_function_body (struct cgraph_node *node)
create a node for it. */
d.builtin_node = cgraph_get_create_node (d.builtin_decl);

- FOR_EACH_BB (d.bb)
+ FOR_EACH_BB_FN (d.bb, cfun)
{
gimple_stmt_iterator gsi;
unsigned int i, nedge;
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 7f6a150..71a25f1 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1815,7 +1815,7 @@ main_tree_if_conversion (void)
#ifdef ENABLE_CHECKING
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
gcc_assert (!bb->aux);
}
#endif
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index ed06cb9..ab8e40b 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4569,7 +4569,7 @@ optimize_inline_calls (tree fn)
will split id->current_basic_block, and the new blocks will
follow it; we'll trudge through them, processing their CALL_EXPRs
along the way. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
inlined_p |= gimple_expand_calls_inline (bb, &id);

pop_gimplify_context (NULL);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index b6d3dd7..8e539f2 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2320,7 +2320,7 @@ rewrite_into_ssa (void)

/* Initialize dominance frontier. */
dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);

/* 1- Compute dominance frontiers. */
@@ -2337,7 +2337,7 @@ rewrite_into_ssa (void)
rewrite_blocks (ENTRY_BLOCK_PTR_FOR_FN (cfun), REWRITE_ALL);

/* Free allocated memory. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear (&dfs[bb->index]);
free (dfs);

@@ -3270,7 +3270,7 @@ update_ssa (unsigned update_flags)
/* If the caller requested PHI nodes to be added, compute
dominance frontiers. */
dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
compute_dominance_frontiers (dfs);

@@ -3296,7 +3296,7 @@ update_ssa (unsigned update_flags)
insert_updated_phi_nodes_for (sym, dfs, blocks_to_update,
update_flags);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear (&dfs[bb->index]);
free (dfs);

diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index b42993d..e00463d 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -144,7 +144,7 @@ tree_nrv (void)
return 0;

/* Look through each block for assignments to the RESULT_DECL. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -238,7 +238,7 @@ tree_nrv (void)
RESULT. */
data.var = found;
data.result = result;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
@@ -358,7 +358,7 @@ execute_return_slot_opt (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 6a587e1..c83345f 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -1211,7 +1211,7 @@ static unsigned int
compute_object_sizes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 8df3026..c5bba789 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -835,7 +835,7 @@ eliminate_useless_phis (void)
gimple_stmt_iterator gsi;
tree result;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
{
@@ -893,7 +893,7 @@ rewrite_trees (var_map map ATTRIBUTE_UNUSED)
/* Search for PHIs where the destination has no partition, but one
or more arguments has a partition. This should not happen and can
create incorrect code. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1101,7 +1101,7 @@ insert_backedge_copies (void)

mark_dfs_back_edges ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Mark block as possibly needing calculation of UIDs. */
bb->aux = &bb->aux;
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 537c246..51e997c 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -637,7 +637,7 @@ tree_profiling (void)

push_cfun (DECL_STRUCT_FUNCTION (node->decl));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index ada942d..59e44cb 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -3276,7 +3276,7 @@ scev_const_prop (void)
if (number_of_loops (cfun) <= 1)
return 0;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
loop = bb->loop_father;

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 9aa526f..ebd4218 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1252,7 +1252,7 @@ scan_function (void)
basic_block bb;
bool ret = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -3311,7 +3311,7 @@ sra_modify_function_body (void)
bool cfg_changed = false;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_start_bb (bb);
while (!gsi_end_p (gsi))
@@ -3795,7 +3795,7 @@ propagate_dereference_distances (void)

auto_vec<basic_block> queue (last_basic_block_for_fn (cfun));
queue.quick_push (ENTRY_BLOCK_PTR_FOR_FN (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
queue.quick_push (bb);
bb->aux = bb;
@@ -4572,7 +4572,7 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments)
bool cfg_changed = false;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

@@ -4811,7 +4811,7 @@ convert_callers (struct cgraph_node *node, tree old_decl,
if (!encountered_recursive_call)
return;

- FOR_EACH_BB (this_block)
+ FOR_EACH_BB_FN (this_block, cfun)
{
gimple_stmt_iterator gsi;

diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 3d05258..7e07771 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -774,7 +774,7 @@ ccp_initialize (void)
const_val = XCNEWVEC (prop_value_t, n_const_val);

/* Initialize simulation flags for PHI nodes and statements. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

@@ -808,7 +808,7 @@ ccp_initialize (void)
/* Now process PHI nodes. We never clear the simulate_again flag on
phi nodes, since we do not know which edges are executable yet,
except for phi nodes for virtual operands when we do not do store ccp. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

@@ -2508,7 +2508,7 @@ execute_fold_all_builtins (void)
basic_block bb;
unsigned int todoflags = 0;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
for (i = gsi_start_bb (bb); !gsi_end_p (i); )
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 70158d5..38a4078 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -821,7 +821,7 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)

live = new_live_track (map);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

@@ -929,7 +929,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)

map = init_var_map (num_ssa_names);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
tree arg;

@@ -1183,7 +1183,7 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl,
in the coalesce list because they do not need to be sorted, and simply
consume extra memory/compilation time in large programs. */

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_ABNORMAL)
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 0dd5e14..3da262b 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -469,7 +469,7 @@ init_copy_prop (void)
n_copy_of = num_ssa_names;
copy_of = XCNEWVEC (prop_value_t, n_copy_of);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
int depth = bb_loop_depth (bb);
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 90e070f..c7d514f 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -325,7 +325,7 @@ rename_ssa_copies (void)

map = init_var_map (num_ssa_names);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Scan for real copies. */
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -341,7 +341,7 @@ rename_ssa_copies (void)
}
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Treat PHI nodes as copies between the result and each argument. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 701dd44..5abef5c 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -374,7 +374,7 @@ find_obviously_necessary_stmts (bool aggressive)
gimple phi, stmt;
int flags;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* PHI nodes are never inherently necessary. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -404,7 +404,7 @@ find_obviously_necessary_stmts (bool aggressive)
struct loop *loop;
scev_initialize ();
if (mark_irreducible_loops ())
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -1325,7 +1325,7 @@ eliminate_unnecessary_stmts (void)
}
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Remove dead PHI nodes. */
something_changed |= remove_dead_phis (bb);
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 6cf60be..2bd2a86 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -795,7 +795,7 @@ free_all_edge_infos (void)
edge_iterator ei;
edge e;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->preds)
{
@@ -866,7 +866,7 @@ tree_ssa_dominator_optimize (void)
{
gimple_stmt_iterator gsi;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
update_stmt_if_modified (gsi_stmt (gsi));
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 6e6d115..a77a639 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -3386,7 +3386,7 @@ ssa_forward_propagate_and_combine (void)

cfg_changed = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 6ccf2fb..da7198b 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -673,7 +673,7 @@ clear_unused_block_pointer (void)
basic_block bb;
gimple_stmt_iterator gsi;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
unsigned i;
@@ -791,7 +791,7 @@ remove_unused_locals (void)
usedvars = BITMAP_ALLOC (NULL);

/* Walk the CFG marking all referenced symbols. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
size_t i;
@@ -856,7 +856,7 @@ remove_unused_locals (void)
ignores them, and the second pass (if there were any) tries to remove
them. */
if (have_local_clobbers)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

@@ -963,11 +963,11 @@ new_tree_live_info (var_map map)
live->num_blocks = last_basic_block_for_fn (cfun);

live->livein = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&live->livein[bb->index], &liveness_bitmap_obstack);

live->liveout = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&live->liveout[bb->index], &liveness_bitmap_obstack);

live->work_stack = XNEWVEC (int, last_basic_block_for_fn (cfun));
@@ -1149,11 +1149,11 @@ calculate_live_on_exit (tree_live_info_p liveinfo)
edge_iterator ei;

/* live on entry calculations used liveout vectors for defs, clear them. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear (&liveinfo->liveout[bb->index]);

/* Set all the live-on-exit bits for uses in PHIs. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
size_t i;
@@ -1294,7 +1294,7 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag)

if ((flag & LIVEDUMP_ENTRY) && live->livein)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (f, "\nLive on entry to BB%d : ", bb->index);
EXECUTE_IF_SET_IN_BITMAP (&live->livein[bb->index], 0, i, bi)
@@ -1308,7 +1308,7 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag)

if ((flag & LIVEDUMP_EXIT) && live->liveout)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (f, "\nLive on exit from BB%d : ", bb->index);
EXECUTE_IF_SET_IN_BITMAP (&live->liveout[bb->index], 0, i, bi)
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 3aaf2b2..cbcdc37 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1601,7 +1601,7 @@ analyze_memory_references (void)
loops postorder. */
i = 0;
bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->loop_father != current_loops->tree_root)
bbs[i++] = bb;
n = i;
@@ -2406,7 +2406,7 @@ fill_always_executed_in (void)
struct loop *loop;

bitmap_clear (contains_call);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2478,7 +2478,7 @@ tree_ssa_lim_finalize (void)

free_aux_for_edges ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
SET_ALWAYS_EXECUTED_IN (bb, NULL);

bitmap_obstack_release (&lim_bitmap_obstack);
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 76d5958..ed30c7b0 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -463,7 +463,7 @@ find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks, bitmap need_phis)
EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi)
find_uses_to_rename_bb (BASIC_BLOCK_FOR_FN (cfun, index), use_blocks, need_phis);
else
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
find_uses_to_rename_bb (bb, use_blocks, need_phis);
}

@@ -602,7 +602,7 @@ verify_loop_closed_ssa (bool verify_ssa_p)

timevar_push (TV_VERIFY_LOOP_CLOSED);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index f77c016..1c89f45 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -527,7 +527,7 @@ execute_cse_reciprocals (void)
calculate_dominance_info (CDI_POST_DOMINATORS);

#ifdef ENABLE_CHECKING
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
gcc_assert (!bb->aux);
#endif

@@ -540,7 +540,7 @@ execute_cse_reciprocals (void)
execute_cse_reciprocals_1 (NULL, name);
}

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
gimple phi;
@@ -1419,7 +1419,7 @@ execute_cse_sincos (void)
calculate_dominance_info (CDI_DOMINATORS);
memset (&sincos_stats, 0, sizeof (sincos_stats));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
bool cleanup_eh = false;
@@ -1939,7 +1939,7 @@ execute_optimize_bswap (void)

memset (&bswap_stats, 0, sizeof (bswap_stats));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

@@ -2785,7 +2785,7 @@ execute_optimize_widening_mul (void)

memset (&widen_mul_stats, 0, sizeof (widen_mul_stats));

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 55ae68b..f9f084b 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1097,7 +1097,7 @@ substitute_and_fold (ssa_prop_get_value_fn get_value_fn,
}

/* Propagate into all uses and fold. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 16679f4..9ec1512 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -6778,7 +6778,7 @@ compute_points_to_sets (void)
intra_create_variable_infos ();

/* Now walk all statements and build the constraint set. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

@@ -6825,7 +6825,7 @@ compute_points_to_sets (void)
}

/* Compute the call-used/clobbered sets. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;

diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index a0eac67..4e05246 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -754,7 +754,7 @@ find_same_succ (void)
same_succ same = same_succ_alloc ();
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
find_same_succ_bb (bb, &same);
if (same == NULL)
@@ -1015,7 +1015,7 @@ reset_cluster_vectors (void)
for (i = 0; i < all_clusters.length (); ++i)
delete_cluster (all_clusters[i]);
all_clusters.truncate (0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
BB_CLUSTER (bb) = NULL;
}

diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index fa6a248..22ae47b 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -683,7 +683,7 @@ find_replaceable_exprs (var_map map)

bitmap_obstack_initialize (&ter_bitmap_obstack);
table = new_temp_expr_table (map);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
find_replaceable_in_bb (table, bb);
gcc_checking_assert (bitmap_empty_p (table->partition_in_use));
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 9289c11..6f978e2 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -1631,7 +1631,7 @@ thread_through_all_blocks (bool may_peel_loop_headers)
ahead and thread it, else ignore it. */
basic_block bb;
edge e;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* If we do end up threading here, we can remove elements from
BB->preds. Thus we can not use the FOR_EACH_EDGE iterator. */
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index d38e0dd..63a2e10 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -65,7 +65,7 @@ associate_equivalences_with_edges (void)

/* Walk over each block. If the block ends with a control statement,
then it might create a useful equivalence. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_last_bb (bb);
gimple stmt;
@@ -406,7 +406,7 @@ tree_ssa_uncprop (void)
/* we just need to empty elements out of the hash table, and cleanup the
AUX field on the edges. */
val_ssa_equiv.dispose ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 4fd5fb8..c6b0a90 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -176,7 +176,7 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
gimple_stmt_iterator gsi;
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
@@ -2130,7 +2130,7 @@ execute_late_warn_uninitialized (void)
added_to_worklist = pointer_set_create ();

/* Initialize worklist */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index f1025b2..8c1aaf2 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -999,7 +999,7 @@ verify_ssa (bool check_modified_stmt)

/* Now verify all the uses and make sure they agree with the definitions
found in the previous pass. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
gimple phi;
@@ -1456,7 +1456,7 @@ execute_update_addresses_taken (void)

/* Collect into ADDRESSES_TAKEN all variables whose address is taken within
the function body. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1558,7 +1558,7 @@ execute_update_addresses_taken (void)
variables and operands need to be rewritten to expose bare symbols. */
if (!bitmap_empty_p (suitable_for_renaming))
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 8b168e0..dc82340 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -536,7 +536,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

@@ -703,7 +703,7 @@ execute_optimize_stdarg (void)
|| TREE_TYPE (cfun_va_list) == char_type_node);
gcc_assert (is_gimple_reg_type (cfun_va_list) == va_list_simple_ptr);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

@@ -813,7 +813,7 @@ execute_optimize_stdarg (void)
memset (&wi, 0, sizeof (wi));
wi.info = si.va_list_vars;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index f6b17b8..efcc94d 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1420,7 +1420,7 @@ do_switchconv (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
const char *failure_reason;
gimple stmt = last_stmt (bb);
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index d55485d..098012c 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1541,7 +1541,7 @@ expand_vector_operations (void)
basic_block bb;
bool cfg_changed = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index c11f8a8..e5d201f 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -157,7 +157,7 @@ adjust_simduid_builtins (hash_table <simduid_to_vf> &htab)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;

@@ -265,7 +265,7 @@ note_simd_array_uses (hash_table <simd_array_to_simduid> *htab)
wi.info = &ns;
ns.htab = htab;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -475,7 +475,7 @@ execute_vect_slp (void)

init_stmt_vec_info_vec ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
vect_location = find_bb_location (bb);

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 06b6259..8ab6d76 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6431,7 +6431,7 @@ check_all_array_refs (void)
basic_block bb;
gimple_stmt_iterator si;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
edge e;
@@ -6593,7 +6593,7 @@ remove_range_assertions (void)
/* Note that the BSI iterator bump happens at the bottom of the
loop and no bump is necessary if we're removing the statement
referenced by the current BSI. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (si = gsi_after_labels (bb), is_unreachable = -1; !gsi_end_p (si);)
{
gimple stmt = gsi_stmt (si);
@@ -6708,7 +6708,7 @@ vrp_initialize (void)
vr_value = XCNEWVEC (value_range_t *, num_vr_values);
vr_phi_edge_counts = XCNEWVEC (int, num_ssa_names);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;

@@ -9543,7 +9543,7 @@ identify_jump_threads (void)
I doubt it's worth the effort for the classes of jump
threading opportunities we are trying to identify at this
point in compilation. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last;

diff --git a/gcc/tsan.c b/gcc/tsan.c
index 4efcfe5..d12459f 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -640,7 +640,7 @@ instrument_memory_accesses (void)
gimple_stmt_iterator gsi;
bool fentry_exit_instrument = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
fentry_exit_instrument |= instrument_gimple (&gsi);
return fentry_exit_instrument;
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 846e884..51b4f8d 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -741,7 +741,7 @@ ubsan_pass (void)
basic_block bb;
gimple_stmt_iterator gsi;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index d509354..c684835 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -542,7 +542,7 @@ verify_histograms (void)

error_found = false;
visited_hists = pointer_set_create ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -648,7 +648,7 @@ gimple_value_profile_transformations (void)
gimple_stmt_iterator gsi;
bool changed = false;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1944,7 +1944,7 @@ gimple_find_values_to_profile (histogram_values *values)
histogram_value hist = NULL;
values->create (0);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
gimple_values_to_profile (gsi_stmt (gsi), values);

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 5bd0799..175ec01 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -6941,7 +6941,7 @@ vt_find_locations (void)
in_pending = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (in_worklist);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
fibheap_insert (pending, bb_order[bb->index], bb);
bitmap_ones (in_pending);

@@ -7101,7 +7101,7 @@ vt_find_locations (void)
}

if (success && MAY_HAVE_DEBUG_INSNS)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
gcc_assert (VTI (bb)->flooded);

free (bb_order);
@@ -7229,7 +7229,7 @@ dump_dataflow_sets (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (dump_file, "\nBasic block %d:\n", bb->index);
fprintf (dump_file, "IN:\n");
@@ -9402,7 +9402,7 @@ vt_emit_notes (void)

/* Free memory occupied by the out hash tables, as they aren't used
anymore. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
dataflow_set_clear (&VTI (bb)->out);

/* Enable emitting notes by functions (mainly by set_variable_part and
@@ -9418,7 +9418,7 @@ vt_emit_notes (void)

dataflow_set_init (&cur);

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Emit the notes for changes of variable locations between two
subsequent basic blocks. */
@@ -9995,7 +9995,7 @@ vt_initialize (void)

vt_add_function_parameters ();

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
HOST_WIDE_INT pre, post = 0;
@@ -10138,7 +10138,7 @@ delete_debug_insns (void)
if (!MAY_HAVE_DEBUG_INSNS)
return;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_SAFE (bb, insn, next)
if (DEBUG_INSN_P (insn))
@@ -10181,7 +10181,7 @@ vt_finalize (void)
{
basic_block bb;

- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
VTI (bb)->mos.release ();
}
--
1.7.11.7
Oleg Endo
2013-12-07 07:12:51 UTC
Permalink
David,

Could you please also update the use of FOR_EACH_BB in
config/sh/sh_treg_combine.cc ?

Thanks,
Oleg
Post by David Malcolm
gcc/
* basic-block.h (FOR_EACH_BB): Eliminate macro.
* asan.c (transform_statements, execute_sanopt): Eliminate
use of FOR_EACH_BB in favor of FOR_EACH_BB_FN, to make use of cfun
explicit.
* auto-inc-dec.c (rest_of_handle_auto_inc_dec): Likewise.
* bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges,
set_edge_can_fallthru_flag, fix_up_fall_thru_edges,
fix_crossing_unconditional_branches, add_reg_crossing_jump_notes,
insert_section_boundary_note, rest_of_handle_reorder_blocks,
duplicate_computed_gotos): Likewise.
* cfg.c (clear_edges, compact_blocks, brief_dump_cfg): Likewise.
* cfganal.c (find_unreachable_blocks, add_noreturn_fake_exit_edges,
compute_dominance_frontiers_1, single_pred_before_succ_order): Likewise.
* cfgbuild.c (find_many_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_optimize_cfg, delete_dead_jumptables): Likewise.
Likewise.
* cfgloop.c (flow_loops_cfg_dump, get_loop_body, record_loop_exits,
verify_loop_structure): Likewise.
* cfgloopanal.c (mark_loop_exit_edges): Likewise.
* cfgrtl.c (compute_bb_for_insn, find_partition_fixes,
verify_hot_cold_block_grouping, purge_all_dead_edges,
fixup_abnormal_edges, record_effective_endpoints,
outof_cfg_layout_mode, fixup_reorder_chain, force_one_exit_fallthru,
break_superblocks): Likewise.
* cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges,
cgraph_rebuild_references): Likewise.
* combine-stack-adj.c (combine_stack_adjustments): Likewise.
* combine.c (delete_noop_moves, create_log_links,
combine_instructions): Likewise.
* config/arm/arm.c (thumb1_reorg, thumb2_reorg): Likewise.
Likewise.
* config/c6x/c6x.c (c6x_gen_bundles, conditionalize_after_sched,
c6x_reorg): Likewise.
* config/epiphany/resolve-sw-modes.c (resolve_sw_modes): Likewise.
* config/frv/frv.c (frv_optimize_membar): Likewise.
* config/i386/i386.c (ix86_finalize_stack_realign_flags): Likewise.
* config/ia64/ia64.c (ia64_reorg): Likewise.
* config/mips/mips.c (mips_annotate_pic_calls): Likewise.
* config/picochip/picochip.c (reorder_var_tracking_notes): Likewise.
* config/rs6000/rs6000.c (rs6000_alloc_sdmode_stack_slot): Likewise.
* config/s390/s390.c (s390_regs_ever_clobbered): Likewise.
* config/spu/spu.c (spu_machine_dependent_reorg): Likewise.
* config/tilegx/tilegx.c (tilegx_gen_bundles,
reorder_var_tracking_notes): Likewise.
* config/tilepro/tilepro.c (tilepro_gen_bundles,
reorder_var_tracking_notes): Likewise.
* coverage.c (coverage_compute_cfg_checksum): Likewise.
* cprop.c (compute_hash_table_work, compute_cprop_data,
local_cprop_pass, find_implicit_sets): Likewise.
* cse.c (cse_condition_code_reg): Likewise.
* dce.c (prescan_insns_for_dce): Likewise.
* df-core.c (df_compact_blocks): Likewise.
* df-problems.c (df_word_lr_alloc): Likewise.
* df-scan.c (df_scan_start_dump, df_scan_blocks, df_insn_rescan_all,
df_update_entry_exit_and_calls): Likewise.
* dominance.c (calculate_dominance_info, verify_dominators,
debug_dominance_info): Likewise.
* dse.c (dse_step5_nospill): Likewise.
* except.c (finish_eh_generation): Likewise.
* final.c (compute_alignments): Likewise.
* function.c (thread_prologue_and_epilogue_insns,
rest_of_match_asm_constraints): Likewise.
* gcse.c (compute_hash_table_work, prune_expressions,
compute_pre_data, compute_code_hoist_vbeinout, hoist_code,
calculate_bb_reg_pressure, compute_ld_motion_mems): Likewise.
* gimple-iterator.c (gsi_commit_edge_inserts): Likewise.
* gimple-ssa-isolate-paths.c (find_implicit_erroneous_behaviour,
find_explicit_erroneous_behaviour): Likewise.
* graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa,
rewrite_cross_bb_scalar_deps_out_of_ssa): Likewise.
* haifa-sched.c (haifa_sched_init): Likewise.
Likewise.
* ifcvt.c (if_convert): Likewise.
* init-regs.c (initialize_uninitialized_regs): Likewise.
* ipa-prop.c (ipcp_transform_function): Likewise.
* ipa-pure-const.c (analyze_function): Likewise.
* ipa-split.c (find_split_points, execute_split_functions): Likewise.
* ira-build.c (form_loop_tree): Likewise.
* ira-costs.c (find_costs_and_classes): Likewise.
* ira-emit.c (emit_moves, add_ranges_and_copies, ira_emit): Likewise.
* ira.c (decrease_live_ranges_number, compute_regs_asm_clobbered,
mark_elimination, update_equiv_regs, find_moveable_pseudos,
split_live_ranges_for_shrink_wrap, allocate_initial_values): Likewise.
* jump.c (mark_all_labels): Likewise.
* lcm.c (compute_laterin, compute_insert_delete, compute_available,
compute_nearerout, compute_rev_insert_delete): Likewise.
* loop-init.c (fix_loop_structure): Likewise.
* loop-invariant.c (calculate_loop_reg_pressure): Likewise.
* lower-subreg.c (decompose_multiword_subregs,
decompose_multiword_subregs): Likewise.
* lra-assigns.c (assign_by_spills): Likewise.
* lra-coalesce.c (lra_coalesce): Likewise.
Likewise.
* lra-eliminations.c (lra_init_elimination): Likewise.
* lra-spills.c (assign_spill_hard_regs, spill_pseudos,
lra_final_code_change): Likewise.
* lra.c (remove_scratches, check_rtl, has_nonexceptional_receiver,
update_inc_notes): Likewise.
* mcf.c (adjust_cfg_counts): Likewise.
* mode-switching.c (optimize_mode_switching): Likewise.
* modulo-sched.c (rest_of_handle_sms): Likewise.
* omp-low.c (optimize_omp_library_calls, expand_omp_taskreg,
expand_omp_target): Likewise.
* postreload-gcse.c (alloc_mem, compute_hash_table): Likewise.
* postreload.c (reload_cse_regs_1): Likewise.
* predict.c (strip_predict_hints, tree_bb_level_predictions,
tree_estimate_probability, expensive_function_p,
estimate_bb_frequencies, compute_function_frequency): Likewise.
* profile.c (is_inconsistent, compute_branch_probabilities,
branch_prob): Likewise.
* ree.c (find_removable_extensions): Likewise.
* reg-stack.c (compensate_edges, convert_regs, reg_to_stack): Likewise.
* regcprop.c (copyprop_hardreg_forward): Likewise.
* reginfo.c (init_subregs_of_mode): Likewise.
* regrename.c (regrename_analyze): Likewise.
Likewise.
* reload1.c (has_nonexceptional_receiver, reload,
calculate_elim_costs_all_insns): Likewise.
* resource.c (init_resource_info, free_resource_info): Likewise.
* sched-ebb.c (schedule_ebbs): Likewise.
* sched-rgn.c (is_cfg_nonregular, find_single_block_region,
haifa_find_rgns, sched_rgn_local_init): Likewise.
* sel-sched-dump.c (sel_dump_cfg_2): Likewise.
* sel-sched-ir.c (init_lv_sets, free_lv_sets,
make_regions_from_the_rest): Likewise.
* sese.c (build_sese_loop_nests, sese_build_liveouts): Likewise.
* stack-ptr-mod.c (notice_stack_pointer_modification): Likewise.
* store-motion.c (compute_store_table, build_store_vectors,
one_store_motion_pass): Likewise.
* tracer.c (tail_duplicate): Likewise.
* trans-mem.c (compute_transaction_bits): Likewise.
* tree-call-cdce.c (tree_call_cdce): Likewise.
* tree-cfg.c (replace_loop_annotate, factor_computed_gotos,
fold_cond_expr_cond, make_edges, assign_discriminators,
make_abnormal_goto_edges, cleanup_dead_labels, group_case_labels,
dump_cfg_stats, gimple_verify_flow_info, print_loop,
execute_fixup_cfg): Likewise.
* tree-cfgcleanup.c (cleanup_tree_cfg_1, merge_phi_nodes): Likewise.
Likewise.
* tree-dfa.c (collect_dfa_stats, dump_enumerated_decls): Likewise.
* tree-eh.c (execute_lower_resx, execute_lower_eh_dispatch,
mark_reachable_handlers): Likewise.
* tree-emutls.c (lower_emutls_function_body): Likewise.
* tree-if-conv.c (main_tree_if_conversion): Likewise.
* tree-inline.c (optimize_inline_calls): Likewise.
* tree-into-ssa.c (rewrite_into_ssa, update_ssa): Likewise.
* tree-nrv.c (tree_nrv, execute_return_slot_opt): Likewise.
* tree-object-size.c (compute_object_sizes): Likewise.
* tree-outof-ssa.c (eliminate_useless_phis, rewrite_trees,
insert_backedge_copies, tree_profiling): Likewise.
* tree-scalar-evolution.c (scev_const_prop): Likewise.
* tree-sra.c (scan_function, sra_modify_function_body,
propagate_dereference_distances, ipa_sra_modify_function_body,
convert_callers): Likewise.
* tree-ssa-ccp.c (ccp_initialize, execute_fold_all_builtins): Likewise.
* tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise.
create_outofssa_var_map, coalesce_partitions): Likewise.
* tree-ssa-copy.c (init_copy_prop): Likewise.
* tree-ssa-copyrename.c (rename_ssa_copies): Likewise.
* tree-ssa-dce.c (find_obviously_necessary_stmts,
eliminate_unnecessary_stmts): Likewise.
Likewise.
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Likewise.
* tree-ssa-live.c (clear_unused_block_pointer, remove_unused_locals,
new_tree_live_info, calculate_live_on_exit, dump_live_info,
analyze_memory_references, fill_always_executed_in,
tree_ssa_lim_finalize): Likewise.
Likewise.
* tree-ssa-math-opts.c (execute_cse_reciprocals, execute_cse_sincos,
execute_optimize_bswap, execute_optimize_widening_mul): Likewise.
* tree-ssa-propagate.c (substitute_and_fold): Likewise.
* tree-ssa-structalias.c (compute_points_to_sets): Likewise.
Likewise.
* tree-ssa-ter.c (find_replaceable_exprs): Likewise.
* tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges,
tree_ssa_uncprop): Likewise.
* tree-ssa-uninit.c (warn_uninitialized_vars,
execute_late_warn_uninitialized): Likewise.
* tree-ssa.c (verify_ssa, execute_update_addresses_taken): Likewise.
Likewise.
* tree-switch-conversion.c (do_switchconv): Likewise.
* tree-vect-generic.c (expand_vector_operations): Likewise.
* tree-vectorizer.c (adjust_simduid_builtins, note_simd_array_uses,
execute_vect_slp): Likewise.
* tree-vrp.c (check_all_array_refs, remove_range_assertions,
Likewise.
* ubsan.c (ubsan_pass): Likewise.
* value-prof.c (verify_histograms, gimple_value_profile_transformations,
gimple_find_values_to_profile): Likewise.
* var-tracking.c (vt_find_locations, dump_dataflow_sets, vt_emit_notes,
vt_initialize, delete_debug_insns, vt_finalize): Likewise.
gcc/testsuite/
* g++.dg/plugin/selfassign.c (execute_warn_self_assign): Eliminate
use of FOR_EACH_BB in favor of FOR_EACH_BB_FN, to make use of cfun
explicit.
* gcc.dg/plugin/selfassign.c (execute_warn_self_assign): Likewise.
---
gcc/asan.c | 4 ++--
gcc/auto-inc-dec.c | 2 +-
gcc/basic-block.h | 2 --
gcc/bb-reorder.c | 22 +++++++++++-----------
gcc/cfg.c | 6 +++---
gcc/cfganal.c | 8 ++++----
gcc/cfgbuild.c | 8 ++++----
gcc/cfgcleanup.c | 4 ++--
gcc/cfgexpand.c | 4 ++--
gcc/cfgloop.c | 14 +++++++-------
gcc/cfgloopanal.c | 2 +-
gcc/cfgrtl.c | 22 +++++++++++-----------
gcc/cgraphbuild.c | 6 +++---
gcc/combine-stack-adj.c | 2 +-
gcc/combine.c | 8 ++++----
gcc/config/arm/arm.c | 4 ++--
gcc/config/bfin/bfin.c | 4 ++--
gcc/config/c6x/c6x.c | 6 +++---
gcc/config/epiphany/resolve-sw-modes.c | 2 +-
gcc/config/frv/frv.c | 4 ++--
gcc/config/i386/i386.c | 2 +-
gcc/config/ia64/ia64.c | 2 +-
gcc/config/mips/mips.c | 2 +-
gcc/config/picochip/picochip.c | 2 +-
gcc/config/rs6000/rs6000.c | 2 +-
gcc/config/s390/s390.c | 2 +-
gcc/config/spu/spu.c | 2 +-
gcc/config/tilegx/tilegx.c | 4 ++--
gcc/config/tilepro/tilepro.c | 4 ++--
gcc/coverage.c | 2 +-
gcc/cprop.c | 8 ++++----
gcc/cse.c | 2 +-
gcc/dce.c | 2 +-
gcc/df-core.c | 8 ++++----
gcc/df-problems.c | 2 +-
gcc/df-scan.c | 8 ++++----
gcc/dominance.c | 6 +++---
gcc/dse.c | 2 +-
gcc/except.c | 2 +-
gcc/final.c | 4 ++--
gcc/function.c | 12 ++++++------
gcc/gcse.c | 16 ++++++++--------
gcc/gimple-iterator.c | 2 +-
gcc/gimple-ssa-isolate-paths.c | 4 ++--
gcc/graphite-sese-to-poly.c | 4 ++--
gcc/haifa-sched.c | 2 +-
gcc/hw-doloop.c | 6 +++---
gcc/ifcvt.c | 2 +-
gcc/init-regs.c | 2 +-
gcc/ipa-prop.c | 2 +-
gcc/ipa-pure-const.c | 2 +-
gcc/ipa-split.c | 4 ++--
gcc/ira-build.c | 2 +-
gcc/ira-costs.c | 2 +-
gcc/ira-emit.c | 14 +++++++-------
gcc/ira.c | 22 +++++++++++-----------
gcc/jump.c | 2 +-
gcc/lcm.c | 10 +++++-----
gcc/loop-init.c | 4 ++--
gcc/loop-invariant.c | 2 +-
gcc/lower-subreg.c | 4 ++--
gcc/lra-assigns.c | 2 +-
gcc/lra-coalesce.c | 4 ++--
gcc/lra-constraints.c | 4 ++--
gcc/lra-eliminations.c | 2 +-
gcc/lra-spills.c | 6 +++---
gcc/lra.c | 8 ++++----
gcc/mcf.c | 2 +-
gcc/mode-switching.c | 6 +++---
gcc/modulo-sched.c | 2 +-
gcc/omp-low.c | 6 +++---
gcc/postreload-gcse.c | 4 ++--
gcc/postreload.c | 2 +-
gcc/predict.c | 14 +++++++-------
gcc/profile.c | 8 ++++----
gcc/ree.c | 2 +-
gcc/reg-stack.c | 6 +++---
gcc/regcprop.c | 4 ++--
gcc/reginfo.c | 2 +-
gcc/regrename.c | 8 ++++----
gcc/regstat.c | 4 ++--
gcc/reload1.c | 8 ++++----
gcc/resource.c | 4 ++--
gcc/sched-ebb.c | 2 +-
gcc/sched-rgn.c | 26 +++++++++++++-------------
gcc/sel-sched-dump.c | 2 +-
gcc/sel-sched-ir.c | 10 +++++-----
gcc/sese.c | 6 +++---
gcc/stack-ptr-mod.c | 2 +-
gcc/store-motion.c | 6 +++---
gcc/testsuite/g++.dg/plugin/selfassign.c | 2 +-
gcc/testsuite/gcc.dg/plugin/selfassign.c | 2 +-
gcc/tracer.c | 2 +-
gcc/trans-mem.c | 2 +-
gcc/tree-call-cdce.c | 2 +-
gcc/tree-cfg.c | 28 ++++++++++++++--------------
gcc/tree-cfgcleanup.c | 4 ++--
gcc/tree-complex.c | 4 ++--
gcc/tree-dfa.c | 4 ++--
gcc/tree-eh.c | 6 +++---
gcc/tree-emutls.c | 2 +-
gcc/tree-if-conv.c | 2 +-
gcc/tree-inline.c | 2 +-
gcc/tree-into-ssa.c | 8 ++++----
gcc/tree-nrv.c | 6 +++---
gcc/tree-object-size.c | 2 +-
gcc/tree-outof-ssa.c | 6 +++---
gcc/tree-profile.c | 2 +-
gcc/tree-scalar-evolution.c | 2 +-
gcc/tree-sra.c | 10 +++++-----
gcc/tree-ssa-ccp.c | 6 +++---
gcc/tree-ssa-coalesce.c | 6 +++---
gcc/tree-ssa-copy.c | 2 +-
gcc/tree-ssa-copyrename.c | 4 ++--
gcc/tree-ssa-dce.c | 6 +++---
gcc/tree-ssa-dom.c | 4 ++--
gcc/tree-ssa-forwprop.c | 2 +-
gcc/tree-ssa-live.c | 18 +++++++++---------
gcc/tree-ssa-loop-im.c | 6 +++---
gcc/tree-ssa-loop-manip.c | 4 ++--
gcc/tree-ssa-math-opts.c | 10 +++++-----
gcc/tree-ssa-propagate.c | 2 +-
gcc/tree-ssa-structalias.c | 4 ++--
gcc/tree-ssa-tail-merge.c | 4 ++--
gcc/tree-ssa-ter.c | 2 +-
gcc/tree-ssa-threadupdate.c | 2 +-
gcc/tree-ssa-uncprop.c | 4 ++--
gcc/tree-ssa-uninit.c | 4 ++--
gcc/tree-ssa.c | 6 +++---
gcc/tree-stdarg.c | 6 +++---
gcc/tree-switch-conversion.c | 2 +-
gcc/tree-vect-generic.c | 2 +-
gcc/tree-vectorizer.c | 6 +++---
gcc/tree-vrp.c | 8 ++++----
gcc/tsan.c | 2 +-
gcc/ubsan.c | 2 +-
gcc/value-prof.c | 6 +++---
gcc/var-tracking.c | 16 ++++++++--------
138 files changed, 363 insertions(+), 365 deletions(-)
diff --git a/gcc/asan.c b/gcc/asan.c
index 09c0667..a50186c 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2043,7 +2043,7 @@ transform_statements (void)
gimple_stmt_iterator i;
int saved_last_basic_block = last_basic_block_for_fn (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
basic_block prev_bb = bb;
@@ -2557,7 +2557,7 @@ execute_sanopt (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 6006b70..be7fdf8 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1480,7 +1480,7 @@ rest_of_handle_auto_inc_dec (void)
reg_next_use = XCNEWVEC (rtx, max_reg);
reg_next_inc_use = XCNEWVEC (rtx, max_reg);
reg_next_def = XCNEWVEC (rtx, max_reg);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
merge_in_block (max_reg, bb);
free (reg_next_use);
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 174b650..b378a5b 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -333,8 +333,6 @@ struct GTY(()) control_flow_graph {
#define FOR_EACH_BB_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb)
-#define FOR_EACH_BB(BB) FOR_EACH_BB_FN (BB, cfun)
-
#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 363af2d..7f8ea07 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1566,7 +1566,7 @@ find_rarely_executed_basic_blocks_and_crossing_edges (void)
vec<basic_block> bbs_in_hot_partition = vNULL;
/* Mark which partition (hot/cold) each basic block belongs in. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool cold_bb = false;
@@ -1658,7 +1658,7 @@ find_rarely_executed_basic_blocks_and_crossing_edges (void)
/* Mark every edge that crosses between sections. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_EACH_EDGE (e, ei, bb->succs)
{
unsigned int flags = e->flags;
@@ -1691,7 +1691,7 @@ set_edge_can_fallthru_flag (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -1792,7 +1792,7 @@ fix_up_fall_thru_edges (void)
rtx old_jump;
rtx fall_thru_label;
- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
fall_thru = NULL;
if (EDGE_COUNT (cur_bb->succs) > 0)
@@ -1992,7 +1992,7 @@ fix_crossing_conditional_branches (void)
rtx old_label = NULL_RTX;
rtx new_label;
- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
crossing_edge = NULL;
if (EDGE_COUNT (cur_bb->succs) > 0)
@@ -2123,7 +2123,7 @@ fix_crossing_unconditional_branches (void)
rtx cur_insn;
edge succ;
- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
last_insn = BB_END (cur_bb);
@@ -2201,7 +2201,7 @@ add_reg_crossing_jump_notes (void)
edge e;
edge_iterator ei;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_EACH_EDGE (e, ei, bb->succs)
if ((e->flags & EDGE_CROSSING)
&& JUMP_P (BB_END (e->src))
@@ -2286,7 +2286,7 @@ insert_section_boundary_note (void)
if (!crtl->has_bb_partition)
return;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (!current_partition)
current_partition = BB_PARTITION (bb);
@@ -2321,7 +2321,7 @@ rest_of_handle_reorder_blocks (void)
reorder_basic_blocks ();
cleanup_cfg (CLEANUP_EXPENSIVE);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
cfg_layout_finalize ();
@@ -2410,7 +2410,7 @@ duplicate_computed_gotos (void)
/* Look for blocks that end in a computed jump, and see if such blocks
are suitable for unfactoring. If a block is a candidate for unfactoring,
mark it in the candidates. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
edge e;
@@ -2457,7 +2457,7 @@ duplicate_computed_gotos (void)
goto done;
/* Duplicate computed gotos. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->flags & BB_VISITED)
continue;
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 6c3181d..4f9d769 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -101,7 +101,7 @@ clear_edges (void)
edge e;
edge_iterator ei;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
free_edge (e);
@@ -163,7 +163,7 @@ compact_blocks (void)
basic_block bb;
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
bb->index = i;
@@ -828,7 +828,7 @@ brief_dump_cfg (FILE *file, int flags)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
dump_bb_info (file, bb, 0,
flags & (TDF_COMMENT | TDF_DETAILS),
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 9900d82..3371b4a 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -159,7 +159,7 @@ find_unreachable_blocks (void)
/* Clear all the reachability flags. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_REACHABLE;
/* Add our starting points to the worklist. Almost always there will
@@ -554,7 +554,7 @@ add_noreturn_fake_exit_edges (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (EDGE_COUNT (bb->succs) == 0)
make_single_succ_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FAKE);
}
@@ -1236,7 +1236,7 @@ compute_dominance_frontiers_1 (bitmap_head *frontiers)
edge p;
edge_iterator ei;
basic_block b;
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
if (EDGE_COUNT (b->preds) >= 2)
{
@@ -1517,7 +1517,7 @@ single_pred_before_succ_order (void)
bitmap_clear (visited);
MARK_VISITED (ENTRY_BLOCK_PTR_FOR_FN (cfun));
- FOR_EACH_BB (x)
+ FOR_EACH_BB_FN (x, cfun)
{
if (VISITED_P (x))
continue;
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index f73bbc5..acfc73b 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -595,15 +595,15 @@ find_many_sub_basic_blocks (sbitmap blocks)
{
basic_block bb, min, max;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
SET_STATE (bb,
bitmap_bit_p (blocks, bb->index) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (STATE (bb) == BLOCK_TO_SPLIT)
find_bb_boundaries (bb);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (STATE (bb) != BLOCK_ORIGINAL)
break;
@@ -640,6 +640,6 @@ find_many_sub_basic_blocks (sbitmap blocks)
compute_outgoing_frequencies (bb);
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
SET_STATE (bb, 0);
}
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 234e5b6..cf72c03 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2613,7 +2613,7 @@ try_optimize_cfg (int mode)
crossjumps_occured = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
update_forwarder_flag (bb);
if (! targetm.cannot_modify_jumps_p ())
@@ -2955,7 +2955,7 @@ delete_dead_jumptables (void)
/* A dead jump table does not belong to any basic block. Scan insns
between two adjacent basic blocks. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 014f78b..56bcd80 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -520,7 +520,7 @@ add_scope_conflicts (void)
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
add_scope_conflicts_1 (bb, work, true);
free (rpo);
@@ -5378,7 +5378,7 @@ discover_nonconstant_array_refs (void)
basic_block bb;
gimple_stmt_iterator gsi;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 9d28950..5639e7a 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -50,7 +50,7 @@ flow_loops_cfg_dump (FILE *file)
if (!file)
return;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge succ;
edge_iterator ei;
@@ -834,7 +834,7 @@ get_loop_body (const struct loop *loop)
gcc_assert (loop->num_nodes == (unsigned) n_basic_blocks_for_fn (cfun));
body[tv++] = loop->header;
body[tv++] = EXIT_BLOCK_PTR_FOR_FN (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
body[tv++] = bb;
}
else
@@ -1082,7 +1082,7 @@ record_loop_exits (void)
loop_exit_hash, loop_exit_eq,
loop_exit_free);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
{
@@ -1343,7 +1343,7 @@ verify_loop_structure (void)
verify_dominators (CDI_DOMINATORS);
/* Check the headers. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_loop_header_p (bb))
{
if (bb->loop_father->header == NULL)
@@ -1479,7 +1479,7 @@ verify_loop_structure (void)
{
/* Record old info. */
irreds = sbitmap_alloc (last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
if (bb->flags & BB_IRREDUCIBLE_LOOP)
@@ -1495,7 +1495,7 @@ verify_loop_structure (void)
mark_irreducible_loops ();
/* Compare. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
@@ -1578,7 +1578,7 @@ verify_loop_structure (void)
sizes = XCNEWVEC (unsigned, num);
memset (sizes, 0, sizeof (unsigned) * num);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
if (bb->loop_father == current_loops->tree_root)
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 84b61c1..5e89cb1c 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -432,7 +432,7 @@ mark_loop_exit_edges (void)
if (number_of_loops (cfun) <= 1)
return;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 5dc52a6..daadd9b 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -416,7 +416,7 @@ compute_bb_for_insn (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx end = BB_END (bb);
rtx insn;
@@ -2275,7 +2275,7 @@ find_partition_fixes (bool flag_only)
/* Callers check this. */
gcc_checking_assert (crtl->has_bb_partition);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if ((BB_PARTITION (bb) == BB_COLD_PARTITION))
bbs_in_cold_partition.safe_push (bb);
@@ -2372,7 +2372,7 @@ verify_hot_cold_block_grouping (void)
|| current_ir_type () != IR_RTL_CFGRTL)
return err;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (current_partition != BB_UNPARTITIONED
&& BB_PARTITION (bb) != current_partition)
@@ -3201,7 +3201,7 @@ purge_all_dead_edges (void)
int purged = false;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool purged_here = purge_dead_edges (bb);
@@ -3226,7 +3226,7 @@ fixup_abnormal_edges (void)
bool inserted = false;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -3449,7 +3449,7 @@ record_effective_endpoints (void)
cfg_layout_function_header = NULL_RTX;
next_insn = get_insns ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx end;
@@ -3479,7 +3479,7 @@ outof_cfg_layout_mode (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
@@ -3857,7 +3857,7 @@ fixup_reorder_chain (void)
relink_block_chain (/*stay_in_cfglayout_mode=*/false);
/* Annoying special case - jump around dead jumptables left in the code. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e = find_fallthru_edge (bb->succs);
@@ -3868,7 +3868,7 @@ fixup_reorder_chain (void)
/* Ensure goto_locus from edges has some instructions with that locus
in RTL. */
if (!optimize)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -4047,7 +4047,7 @@ force_one_exit_fallthru (void)
/* Fix up the chain of blocks -- make FORWARDER immediately precede the
exit block. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->aux == NULL && bb != forwarder)
{
@@ -4258,7 +4258,7 @@ break_superblocks (void)
superblocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (superblocks);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->flags & BB_SUPERBLOCK)
{
bb->flags &= ~BB_SUPERBLOCK;
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 6c6698b..429dc8e 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -317,7 +317,7 @@ build_cgraph_edges (void)
/* Create the callgraph edges and record the nodes referenced by the function.
body. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -451,7 +451,7 @@ rebuild_cgraph_edges (void)
node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -505,7 +505,7 @@ cgraph_rebuild_references (void)
node->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
ipa_record_stmt_references (node, gsi_stmt (gsi));
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index 5ca131f..5c897cf 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -95,7 +95,7 @@ combine_stack_adjustments (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
combine_stack_adjustments_for_block (bb);
}
diff --git a/gcc/combine.c b/gcc/combine.c
index c7eb5e5..dea6c28 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -960,7 +960,7 @@ delete_noop_moves (void)
rtx insn, next;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
{
@@ -997,7 +997,7 @@ create_log_links (void)
usage -- these are taken from original flow.c did. Don't ask me why it is
done this way; I don't know and if it works, I don't want to know. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_REVERSE (bb, insn)
{
@@ -1160,7 +1160,7 @@ combine_instructions (rtx f, unsigned int nregs)
last_bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);
create_log_links ();
- FOR_EACH_BB (this_basic_block)
+ FOR_EACH_BB_FN (this_basic_block, cfun)
{
optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
last_call_luid = 0;
@@ -1211,7 +1211,7 @@ combine_instructions (rtx f, unsigned int nregs)
setup_incoming_promotions (first);
last_bb = ENTRY_BLOCK_PTR_FOR_FN (cfun);
- FOR_EACH_BB (this_basic_block)
+ FOR_EACH_BB_FN (this_basic_block, cfun)
{
rtx last_combined_insn = NULL_RTX;
optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index b3a81b0..268e560 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -16548,7 +16548,7 @@ thumb1_reorg (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx dest, src;
rtx pat, op0, set = NULL;
@@ -16626,7 +16626,7 @@ thumb2_reorg (void)
compute_bb_for_insn ();
df_analyze ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a1adf80..c15451c 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3957,7 +3957,7 @@ static void
bfin_gen_bundles (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx slot[3];
@@ -4036,7 +4036,7 @@ static void
reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx queue = NULL_RTX;
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index af310ba..6f80bc8 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -4629,7 +4629,7 @@ c6x_gen_bundles (void)
basic_block bb;
rtx insn, next, last_call;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
/* The machine is eight insns wide. We can have up to six shadow
@@ -5383,7 +5383,7 @@ conditionalize_after_sched (void)
{
basic_block bb;
rtx insn;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned uid = INSN_UID (insn);
@@ -5959,7 +5959,7 @@ c6x_reorg (void)
if (c6x_flag_schedule_insns2)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if ((bb->flags & BB_DISABLE_SCHEDULE) == 0)
assign_reservations (BB_HEAD (bb), BB_END (bb));
}
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index a780254..30f6920 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -69,7 +69,7 @@ resolve_sw_modes (void)
df_note_add_problem ();
df_analyze ();
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
enum attr_fp_mode selected_mode;
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index a5aeb75..3755e62 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -8070,11 +8070,11 @@ frv_optimize_membar (void)
first_io = XCNEWVEC (struct frv_io, last_basic_block_for_fn (cfun));
last_membar = XCNEWVEC (rtx, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
frv_optimize_membar_local (bb, &first_io[bb->index],
&last_membar[bb->index]);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (last_membar[bb->index] != 0)
frv_optimize_membar_global (bb, first_io, last_membar[bb->index]);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 0f6612d..aa9694f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -10481,7 +10481,7 @@ ix86_finalize_stack_realign_flags (void)
add_to_hard_reg_set (&set_up_by_prologue, Pmode, ARG_POINTER_REGNUM);
add_to_hard_reg_set (&set_up_by_prologue, Pmode,
HARD_FRAME_POINTER_REGNUM);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 8f305c1..a837974 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -9688,7 +9688,7 @@ ia64_reorg (void)
/* We can't let modulo-sched prevent us from scheduling any bbs,
since we need the final schedule to produce bundle information. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_DISABLE_SCHEDULE;
initiate_bundle_states ();
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index f19478c..e65dc6b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15332,7 +15332,7 @@ mips_annotate_pic_calls (void)
basic_block bb;
rtx insn;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
rtx call, reg, symbol, second_call;
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index 4756cb7..8861ffc 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -3174,7 +3174,7 @@ reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next, last_insn = NULL_RTX;
rtx queue = NULL_RTX;
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 599cf49..1db97fa 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16395,7 +16395,7 @@ rs6000_alloc_sdmode_stack_slot (void)
if (TARGET_NO_SDMODE_STACK)
return;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree ret = walk_gimple_op (gsi_stmt (gsi), rs6000_check_sdmode, NULL);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index fcd7532..f9b7cd0 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7458,7 +7458,7 @@ s390_regs_ever_clobbered (char regs_ever_clobbered[])
if (!call_really_used_regs[i])
regs_ever_clobbered[i] = 1;
- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
{
FOR_BB_INSNS (cur_bb, cur_insn)
{
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 1a9895e..66209b6 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2645,7 +2645,7 @@ spu_machine_dependent_reorg (void)
find_many_sub_basic_blocks (blocks);
/* We have to schedule to make sure alignment is ok. */
- FOR_EACH_BB (bb) bb->flags &= ~BB_DISABLE_SCHEDULE;
+ FOR_EACH_BB_FN (bb, cfun) bb->flags &= ~BB_DISABLE_SCHEDULE;
/* The hints need to be scheduled, so call it again. */
schedule_insns ();
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index c2f9e07..eecc9a9 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -4383,7 +4383,7 @@ static void
tilegx_gen_bundles (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx end = NEXT_INSN (BB_END (bb));
@@ -4709,7 +4709,7 @@ static void
reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx queue = NULL_RTX;
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 31bc490..b2bafb4 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -3988,7 +3988,7 @@ static void
tilepro_gen_bundles (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx end = NEXT_INSN (BB_END (bb));
@@ -4259,7 +4259,7 @@ static void
reorder_var_tracking_notes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn, next;
rtx queue = NULL_RTX;
diff --git a/gcc/coverage.c b/gcc/coverage.c
index f2ac5fc..f7a2924 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -588,7 +588,7 @@ coverage_compute_cfg_checksum (void)
basic_block bb;
unsigned chksum = n_basic_blocks_for_fn (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 600c617..7d07246 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -400,7 +400,7 @@ compute_hash_table_work (struct hash_table_d *table)
/* Allocate vars to track sets of regs. */
reg_set_bitmap = ALLOC_REG_SET (NULL);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
@@ -649,7 +649,7 @@ compute_cprop_data (void)
aren't recorded for the local pass so they cannot be propagated within
their basic block by this pass and 2) the global pass would otherwise
propagate them only in the successors of their basic block. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int index = implicit_set_indexes[bb->index];
if (index != -1)
@@ -1234,7 +1234,7 @@ local_cprop_pass (void)
unsigned i;
cselib_init (0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
{
@@ -1359,7 +1359,7 @@ find_implicit_sets (void)
implicit_sets = XCNEWVEC (rtx, implicit_sets_size);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Check for more than one successor. */
if (EDGE_COUNT (bb->succs) <= 1)
diff --git a/gcc/cse.c b/gcc/cse.c
index 74ae8ba..0e28f48 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -7335,7 +7335,7 @@ cse_condition_code_reg (void)
else
cc_reg_2 = NULL_RTX;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx last_insn;
rtx cc_reg;
diff --git a/gcc/dce.c b/gcc/dce.c
index 07d31f7..3101102 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -623,7 +623,7 @@ prescan_insns_for_dce (bool fast)
if (!df_in_progress && ACCUMULATE_OUTGOING_ARGS)
arg_stores = BITMAP_ALLOC (NULL);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_REVERSE_SAFE (bb, insn, prev)
if (NONDEBUG_INSN_P (insn))
diff --git a/gcc/df-core.c b/gcc/df-core.c
index d41fb72..ba57d39 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1543,7 +1543,7 @@ df_compact_blocks (void)
bitmap_set_bit (dflow->out_of_date_transfer_functions, EXIT_BLOCK);
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (dflow->out_of_date_transfer_functions, i);
@@ -1564,7 +1564,7 @@ df_compact_blocks (void)
place in the block_info vector. Null out the copied
item. The entry and exit blocks never move. */
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
df_set_bb_info (dflow, i,
(char *)problem_temps
@@ -1590,7 +1590,7 @@ df_compact_blocks (void)
bitmap_copy (&tmp, df->blocks_to_analyze);
bitmap_clear (df->blocks_to_analyze);
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bitmap_bit_p (&tmp, bb->index))
bitmap_set_bit (df->blocks_to_analyze, i);
@@ -1601,7 +1601,7 @@ df_compact_blocks (void)
bitmap_clear (&tmp);
i = NUM_FIXED_BLOCKS;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
SET_BASIC_BLOCK_FOR_FN (cfun, i, bb);
bb->index = i;
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index ab19372..70f7254 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -2427,7 +2427,7 @@ df_word_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
bitmap_obstack_initialize (&problem_data->word_lr_bitmaps);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, bb->index);
bitmap_set_bit (df_word_lr->out_of_date_transfer_functions, ENTRY_BLOCK);
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 5f0ba4a..9f6f67a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -449,7 +449,7 @@ df_scan_start_dump (FILE *file ATTRIBUTE_UNUSED)
fprintf (file, "} ");
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (INSN_P (insn))
{
@@ -673,7 +673,7 @@ df_scan_blocks (void)
df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK));
/* Regular blocks */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
unsigned int bb_index = bb->index;
df_bb_refs_record (bb_index, true);
@@ -1415,7 +1415,7 @@ df_insn_rescan_all (void)
bitmap_clear (&df->insns_to_rescan);
bitmap_clear (&df->insns_to_notes_rescan);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
@@ -4154,7 +4154,7 @@ df_update_entry_exit_and_calls (void)
/* The call insns need to be rescanned because there may be changes
in the set of registers clobbered across the call. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS (bb, insn)
diff --git a/gcc/dominance.c b/gcc/dominance.c
index af73078..521b224 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -662,7 +662,7 @@ calculate_dominance_info (enum cdi_direction dir)
calc_dfs_tree (&di, reverse);
calc_idoms (&di, reverse);
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
TBB d = di.dom[di.dfs_order[b->index]];
@@ -1025,7 +1025,7 @@ verify_dominators (enum cdi_direction dir)
calc_dfs_tree (&di, reverse);
calc_idoms (&di, reverse);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
imm_bb = get_immediate_dominator (dir, bb);
if (!imm_bb)
@@ -1492,7 +1492,7 @@ DEBUG_FUNCTION void
debug_dominance_info (enum cdi_direction dir)
{
basic_block bb, bb2;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if ((bb2 = get_immediate_dominator (dir, bb)))
fprintf (stderr, "%i %i\n", bb->index, bb2->index);
}
diff --git a/gcc/dse.c b/gcc/dse.c
index a926cb8..e5b0850 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -3507,7 +3507,7 @@ static void
dse_step5_nospill (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
insn_info_t insn_info = bb_info->last_insn;
diff --git a/gcc/except.c b/gcc/except.c
index e4b8cad..cf4fd14 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1511,7 +1511,7 @@ finish_eh_generation (void)
commit_edge_insertions ();
/* Redirect all EH edges from the post_landing_pad to the landing pad. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
eh_landing_pad lp;
edge_iterator ei;
diff --git a/gcc/final.c b/gcc/final.c
index 2ab6a4d..f475d27 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -700,14 +700,14 @@ compute_alignments (void)
flow_loops_dump (dump_file, NULL, 1);
}
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->frequency > freq_max)
freq_max = bb->frequency;
freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD);
if (dump_file)
fprintf (dump_file, "freq_max: %i\n",freq_max);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx label = BB_HEAD (bb);
int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
diff --git a/gcc/function.c b/gcc/function.c
index d257af4..e00f583 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6043,7 +6043,7 @@ thread_prologue_and_epilogue_insns (void)
max_grow_size = get_uncond_jump_length ();
max_grow_size *= PARAM_VALUE (PARAM_MAX_GROW_COPY_BB_INSNS);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
unsigned size = 0;
@@ -6120,7 +6120,7 @@ thread_prologue_and_epilogue_insns (void)
needing a prologue. */
bitmap_clear (&bb_on_list);
bitmap_and_compl (&bb_antic_flags, &bb_flags, &bb_tail);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (!bitmap_bit_p (&bb_antic_flags, bb->index))
continue;
@@ -6154,7 +6154,7 @@ thread_prologue_and_epilogue_insns (void)
/* Find exactly one edge that leads to a block in ANTIC from
a block that isn't. */
if (!bitmap_bit_p (&bb_antic_flags, entry_edge->dest->index))
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (!bitmap_bit_p (&bb_antic_flags, bb->index))
continue;
@@ -6202,7 +6202,7 @@ thread_prologue_and_epilogue_insns (void)
/* Find tail blocks reachable from both blocks needing a
prologue and blocks not needing a prologue. */
if (!bitmap_empty_p (&bb_tail))
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool some_pro, some_no_pro;
if (!bitmap_bit_p (&bb_tail, bb->index))
@@ -6480,7 +6480,7 @@ thread_prologue_and_epilogue_insns (void)
we take advantage of cfg_layout_finalize using
fixup_fallthru_exit_predecessor. */
cfg_layout_initialize (0);
- FOR_EACH_BB (cur_bb)
+ FOR_EACH_BB_FN (cur_bb, cfun)
if (cur_bb->index >= NUM_FIXED_BLOCKS
&& cur_bb->next_bb->index >= NUM_FIXED_BLOCKS)
cur_bb->aux = cur_bb->next_bb;
@@ -7192,7 +7192,7 @@ rest_of_match_asm_constraints (void)
return 0;
df_set_flags (DF_DEFER_INSN_RESCAN);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
{
diff --git a/gcc/gcse.c b/gcc/gcse.c
index fa25a46..a6874ab 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -1559,7 +1559,7 @@ compute_hash_table_work (struct hash_table_d *table)
for (i = 0; i < max_reg_num (); ++i)
reg_avail_info[i].last_bb = NULL;
- FOR_EACH_BB (current_bb)
+ FOR_EACH_BB_FN (current_bb, cfun)
{
rtx insn;
unsigned int regno;
@@ -1899,7 +1899,7 @@ prune_expressions (bool pre_p)
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -2020,7 +2020,7 @@ compute_pre_data (void)
~(TRANSP | COMP)
*/
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_ior (ae_kill[bb->index], transp[bb->index], comp[bb->index]);
bitmap_not (ae_kill[bb->index], ae_kill[bb->index]);
@@ -2855,7 +2855,7 @@ compute_code_hoist_vbeinout (void)
{
fprintf (dump_file, "hoisting vbeinout computation: %d passes\n", passes);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (dump_file, "vbein (%d): ", bb->index);
dump_bitmap_file (dump_file, hoist_vbein[bb->index]);
@@ -3169,7 +3169,7 @@ hoist_code (void)
to_bb_head = XCNEWVEC (int, get_max_uid ());
bb_size = XCNEWVEC (int, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
int to_head;
@@ -3512,7 +3512,7 @@ calculate_bb_reg_pressure (void)
ira_setup_eliminable_regset ();
curr_regs_live = BITMAP_ALLOC (&reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
curr_bb = bb;
BB_DATA (bb)->live_in = BITMAP_ALLOC (NULL);
@@ -3562,7 +3562,7 @@ calculate_bb_reg_pressure (void)
return;
fprintf (dump_file, "\nRegister Pressure: \n");
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (dump_file, " Basic block %d: \n", bb->index);
for (i = 0; (int) i < ira_pressure_classes_num; i++)
@@ -3888,7 +3888,7 @@ compute_ld_motion_mems (void)
pre_ldst_mems = NULL;
pre_ldst_table.create (13);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
{
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index 9f51e6c..2460c61 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -839,7 +839,7 @@ gsi_commit_edge_inserts (void)
gsi_commit_one_edge_insert (single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)),
NULL);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_EACH_EDGE (e, ei, bb->succs)
gsi_commit_one_edge_insert (e, NULL);
}
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 052bf3f..aaa7537 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -216,7 +216,7 @@ find_implicit_erroneous_behaviour (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
@@ -304,7 +304,7 @@ find_explicit_erroneous_behaviour (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 975db63..66c1b6e 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2295,7 +2295,7 @@ rewrite_reductions_out_of_ssa (scop_p scop)
gimple_stmt_iterator psi;
sese region = SCOP_REGION (scop);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
for (psi = gsi_start_phis (bb); !gsi_end_p (psi);)
{
@@ -2489,7 +2489,7 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop)
/* Create an extra empty BB after the scop. */
split_edge (SESE_EXIT (region));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
changed |= rewrite_cross_bb_scalar_deps (scop, &psi);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index d5e3309..4f3b054 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -6709,7 +6709,7 @@ haifa_sched_init (void)
sched_init_bbs ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bbs.quick_push (bb);
sched_init_luids (bbs);
sched_deps_init (true);
diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c
index 77c8149..b6184a2 100644
--- a/gcc/hw-doloop.c
+++ b/gcc/hw-doloop.c
@@ -357,7 +357,7 @@ discover_loops (bitmap_obstack *loop_stack, struct hw_doloop_hooks *hooks)
/* Find all the possible loop tails. This means searching for every
loop_end instruction. For each one found, create a hwloop_info
structure and add the head block to the work list. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx tail = BB_END (bb);
rtx insn, reg;
@@ -480,7 +480,7 @@ set_bb_indices (void)
intptr_t index;
index = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = (void *) index++;
}
@@ -537,7 +537,7 @@ reorder_loops (hwloop_info loops)
loops = loops->next;
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index ac0276c..543a70d 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -4408,7 +4408,7 @@ if_convert (bool after_combine)
fprintf (dump_file, "\n\n========== Pass %d ==========\n", pass);
#endif
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
basic_block new_bb;
while (!df_get_bb_dirty (bb)
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index 2a15b3e..d26ee9b 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -59,7 +59,7 @@ initialize_uninitialized_regs (void)
df_analyze ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
bitmap lr = DF_LR_IN (bb);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 83dc53e..7b16b7e 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4726,7 +4726,7 @@ ipcp_transform_function (struct cgraph_node *node)
descriptors.safe_grow_cleared (param_count);
ipa_populate_param_decls (node, descriptors);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
struct ipa_agg_replacement_value *v;
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index d84b35f..a60e078 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -754,7 +754,7 @@ analyze_function (struct cgraph_node *fn, bool ipa)
push_cfun (DECL_STRUCT_FUNCTION (decl));
- FOR_EACH_BB (this_block)
+ FOR_EACH_BB_FN (this_block, cfun)
{
gimple_stmt_iterator gsi;
struct walk_stmt_info wi;
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index d5dfb8d..390adf1 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1070,7 +1070,7 @@ find_split_points (int overall_time, int overall_size)
stack.pop ();
}
ENTRY_BLOCK_PTR_FOR_FN (cfun)->aux = NULL;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = NULL;
stack.release ();
BITMAP_FREE (current.ssa_names_to_pass);
@@ -1595,7 +1595,7 @@ execute_split_functions (void)
/* Compute local info about basic blocks and determine function size/time. */
bb_info_vec.safe_grow_cleared (last_basic_block_for_fn (cfun) + 1);
memset (&best_split_point, 0, sizeof (best_split_point));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int time = 0;
int size = 0;
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index f9258ee..660fb0d 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -341,7 +341,7 @@ form_loop_tree (void)
/* We can not use loop/bb node access macros because of potential
checking and because the nodes are not initialized enough
yet. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bb_node = &ira_bb_nodes[bb->index];
bb_node->bb = bb;
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index d7299e6..c8d64d5 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1585,7 +1585,7 @@ find_costs_and_classes (FILE *dump_file)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
process_bb_for_costs (bb);
}
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index d59461b..196efa0 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -986,7 +986,7 @@ emit_moves (void)
edge e;
rtx insns, tmp;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (at_bb_start[bb->index] != NULL)
{
@@ -1203,7 +1203,7 @@ add_ranges_and_copies (void)
bitmap live_through;
live_through = ira_allocate_bitmap ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* It does not matter what loop_tree_node (of source or
destination block) to use for searching allocnos by their
@@ -1260,7 +1260,7 @@ ira_emit (bool loops_p)
ira_free_bitmap (renamed_regno_bitmap);
ira_free_bitmap (local_allocno_bitmap);
setup_entered_from_non_parent_p ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
at_bb_start[bb->index] = NULL;
at_bb_end[bb->index] = NULL;
@@ -1275,15 +1275,15 @@ ira_emit (bool loops_p)
memset (allocno_last_set_check, 0, sizeof (int) * max_reg_num ());
memset (hard_regno_last_set_check, 0, sizeof (hard_regno_last_set_check));
curr_tick = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
unify_moves (bb, true);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
unify_moves (bb, false);
move_vec.create (ira_allocnos_num);
emit_moves ();
add_ranges_and_copies ();
/* Clean up: */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
free_move_list (at_bb_start[bb->index]);
free_move_list (at_bb_end[bb->index]);
@@ -1301,7 +1301,7 @@ ira_emit (bool loops_p)
reload assumes initial insn codes defined. The insn codes can be
invalidated by CFG infrastructure for example in jump
redirection. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS_REVERSE (bb, insn)
if (INSN_P (insn))
recog_memoized (insn);
diff --git a/gcc/ira.c b/gcc/ira.c
index ae35035..b4ae0ca 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2135,7 +2135,7 @@ decrease_live_ranges_number (void)
if (ira_dump_file)
fprintf (ira_dump_file, "Starting decreasing number of live ranges...\n");
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
set = single_set (insn);
@@ -2358,7 +2358,7 @@ compute_regs_asm_clobbered (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
FOR_BB_INSNS_REVERSE (bb, insn)
@@ -2951,7 +2951,7 @@ mark_elimination (int from, int to)
basic_block bb;
bitmap r;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
r = DF_LR_IN (bb);
if (bitmap_bit_p (r, from))
@@ -3473,7 +3473,7 @@ update_equiv_regs (void)
paradoxical subreg. Don't set such reg sequivalent to a mem,
because lra will not substitute such equiv memory in order to
prevent access beyond allocated memory for paradoxical memory subreg. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
for_each_rtx (&insn, set_paradoxical_subreg, (void *) pdx_subregs);
@@ -3481,7 +3481,7 @@ update_equiv_regs (void)
/* Scan the insns and find which registers have equivalences. Do this
in a separate scan of the insns because (due to -fcse-follow-jumps)
a register can be set below its use. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
loop_depth = bb_loop_depth (bb);
@@ -3905,7 +3905,7 @@ update_equiv_regs (void)
if (!bitmap_empty_p (cleared_regs))
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_and_compl_into (DF_LR_IN (bb), cleared_regs);
bitmap_and_compl_into (DF_LR_OUT (bb), cleared_regs);
@@ -4532,7 +4532,7 @@ find_moveable_pseudos (void)
bitmap_initialize (&used, 0);
bitmap_initialize (&set, 0);
bitmap_initialize (&unusable_as_input, 0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
bitmap transp = bb_transp_live + bb->index;
@@ -4595,7 +4595,7 @@ find_moveable_pseudos (void)
bitmap_clear (&used);
bitmap_clear (&set);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap local = bb_local + bb->index;
rtx insn;
@@ -4824,7 +4824,7 @@ find_moveable_pseudos (void)
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_clear (bb_local + bb->index);
bitmap_clear (bb_transp_live + bb->index);
@@ -4921,7 +4921,7 @@ split_live_ranges_for_shrink_wrap (void)
bitmap_initialize (&reachable, 0);
queue.create (n_basic_blocks_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (CALL_P (insn) && !SIBLING_CALL_P (insn))
{
@@ -5145,7 +5145,7 @@ allocate_initial_values (void)
fixed regs are accepted. */
SET_REGNO (preg, new_regno);
/* Update global register liveness information. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (REGNO_REG_SET_P (df_get_live_in (bb), regno))
SET_REGNO_REG_SET (df_get_live_in (bb), new_regno);
diff --git a/gcc/jump.c b/gcc/jump.c
index a27aaa9..5eefeef 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -275,7 +275,7 @@ mark_all_labels (rtx f)
if (current_ir_type () == IR_RTL_CFGLAYOUT)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* In cfglayout mode, we don't bother with trivial next-insn
propagation of LABEL_REFs into JUMP_LABEL. This will be
diff --git a/gcc/lcm.c b/gcc/lcm.c
index 1129d6c..0b528d9 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -281,7 +281,7 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest,
/* Add all the blocks to the worklist. This prevents an early exit from
the loop given our optimistic initialization of LATER above. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
*qin++ = bb;
bb->aux = bb;
@@ -350,7 +350,7 @@ compute_insert_delete (struct edge_list *edge_list, sbitmap *antloc,
int x;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_and_compl (del[bb->index], antloc[bb->index],
laterin[bb->index]);
@@ -497,7 +497,7 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout,
/* Put every block on the worklist; this is necessary because of the
optimistic initialization of AVOUT above. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
*qin++ = bb;
bb->aux = bb;
@@ -638,7 +638,7 @@ compute_nearerout (struct edge_list *edge_list, sbitmap *farthest,
/* Add all the blocks to the worklist. This prevents an early exit
from the loop given our optimistic initialization of NEARER. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
*tos++ = bb;
bb->aux = bb;
@@ -695,7 +695,7 @@ compute_rev_insert_delete (struct edge_list *edge_list, sbitmap *st_avloc,
int x;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_and_compl (del[bb->index], st_avloc[bb->index],
nearerout[bb->index]);
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 664b1ac..3dc6953 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -213,7 +213,7 @@ fix_loop_structure (bitmap changed_bbs)
/* Remember the depth of the blocks in the loop hierarchy, so that we can
recognize blocks whose loop nesting relationship has changed. */
if (changed_bbs)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = (void *) (size_t) loop_depth (bb->loop_father);
/* Remove the dead loops from structures. We start from the innermost
@@ -256,7 +256,7 @@ fix_loop_structure (bitmap changed_bbs)
/* Mark the blocks whose loop has changed. */
if (changed_bbs)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if ((void *) (size_t) loop_depth (bb->loop_father) != bb->aux)
bitmap_set_bit (changed_bbs, bb->index);
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 9f1fc07..f47bd50 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -1825,7 +1825,7 @@ calculate_loop_reg_pressure (void)
}
ira_setup_eliminable_regset ();
bitmap_initialize (&curr_regs_live, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
curr_loop = bb->loop_father;
if (curr_loop == current_loops->tree_root)
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 60c47b9..0b0e397 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1463,7 +1463,7 @@ decompose_multiword_subregs (bool decompose_copies)
memset (reg_copy_graph.address (), 0, sizeof (bitmap) * max);
speed_p = optimize_function_for_speed_p (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
@@ -1543,7 +1543,7 @@ decompose_multiword_subregs (bool decompose_copies)
EXECUTE_IF_SET_IN_BITMAP (decomposable_context, 0, regno, iter)
decompose_register (regno);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
index 88fc693..41ee286 100644
--- a/gcc/lra-assigns.c
+++ b/gcc/lra-assigns.c
@@ -1302,7 +1302,7 @@ assign_by_spills (void)
/* FIXME: Look up the changed insns in the cached LRA insn data using
an EXECUTE_IF_SET_IN_BITMAP over changed_insns. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (bitmap_bit_p (&changed_insns, INSN_UID (insn)))
{
diff --git a/gcc/lra-coalesce.c b/gcc/lra-coalesce.c
index 859e02f..94a21f0 100644
--- a/gcc/lra-coalesce.c
+++ b/gcc/lra-coalesce.c
@@ -239,7 +239,7 @@ lra_coalesce (void)
mv_num = 0;
/* Collect moves. */
coalesced_moves = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_SAFE (bb, insn, next)
if (INSN_P (insn)
@@ -297,7 +297,7 @@ lra_coalesce (void)
}
}
bitmap_initialize (&used_pseudos_bitmap, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
update_live_info (df_get_live_in (bb));
update_live_info (df_get_live_out (bb));
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bb5242a..f04166c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -5300,7 +5300,7 @@ lra_inheritance (void)
bitmap_initialize (&live_regs, &reg_obstack);
bitmap_initialize (&temp_bitmap, &reg_obstack);
bitmap_initialize (&ebb_global_regs, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
start_bb = bb;
if (lra_dump_file != NULL)
@@ -5401,7 +5401,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
because we need to marks insns affected by previous
inheritance/split pass for processing by the subsequent
constraint pass. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fix_bb_live_info (df_get_live_in (bb), remove_pseudos);
fix_bb_live_info (df_get_live_out (bb), remove_pseudos);
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index 915e3a0..6c52bb3 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -1284,7 +1284,7 @@ init_elimination (void)
struct elim_table *ep;
init_elim_table ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
curr_sp_change = 0;
stop_to_sp_elimination_p = false;
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 6bebb92..1e5f52b 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -280,7 +280,7 @@ assign_spill_hard_regs (int *pseudo_regnos, int n)
add_to_hard_reg_set (&reserved_hard_regs[p],
lra_reg_info[i].biggest_mode, hard_regno);
bitmap_initialize (&ok_insn_bitmap, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (DEBUG_INSN_P (insn)
|| ((set = single_set (insn)) != NULL_RTX
@@ -478,7 +478,7 @@ spill_pseudos (void)
bitmap_ior_into (&changed_insns, &lra_reg_info[i].insn_bitmap);
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS (bb, insn)
if (bitmap_bit_p (&changed_insns, INSN_UID (insn)))
@@ -686,7 +686,7 @@ lra_final_code_change (void)
if (lra_reg_info[i].nrefs != 0
&& (hard_regno = lra_get_regno_hard_regno (i)) >= 0)
SET_REGNO (regno_reg_rtx[i], hard_regno);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS_SAFE (bb, insn, curr)
if (INSN_P (insn))
{
diff --git a/gcc/lra.c b/gcc/lra.c
index 50a0786..21b8af1 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -1960,7 +1960,7 @@ remove_scratches (void)
scratches.create (get_max_uid ());
bitmap_initialize (&scratch_bitmap, &reg_obstack);
bitmap_initialize (&scratch_operand_bitmap, &reg_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (INSN_P (insn))
{
@@ -2049,7 +2049,7 @@ check_rtl (bool final_p)
rtx insn;
lra_assert (! final_p || reload_completed);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) != USE
@@ -2090,7 +2090,7 @@ has_nonexceptional_receiver (void)
/* First determine which blocks can reach exit via normal paths. */
tos = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) + 1);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_REACHABLE;
/* Place the exit block on our worklist. */
@@ -2165,7 +2165,7 @@ update_inc_notes (void)
basic_block bb;
rtx insn;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
{
diff --git a/gcc/mcf.c b/gcc/mcf.c
index e709f2a..f9b5505 100644
--- a/gcc/mcf.c
+++ b/gcc/mcf.c
@@ -1281,7 +1281,7 @@ adjust_cfg_counts (fixup_graph_type *fixup_graph)
{
fprintf (dump_file, "\nCheck %s() CFG flow conservation:\n",
current_function_name ());
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if ((bb->count != sum_edge_counts (bb->preds))
|| (bb->count != sum_edge_counts (bb->succs)))
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index a9e5069..4e31d68 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -516,7 +516,7 @@ optimize_mode_switching (void)
/* Determine what the first use (if any) need for a mode of entity E is.
This will be the mode that is anticipatable for this block.
Also compute the initial transparency settings. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct seginfo *ptr;
int last_mode = no_mode;
@@ -624,7 +624,7 @@ optimize_mode_switching (void)
int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
struct bb_info *info = bb_info[j];
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (info[bb->index].seginfo->mode == m)
bitmap_set_bit (antic[bb->index], j);
@@ -637,7 +637,7 @@ optimize_mode_switching (void)
/* Calculate the optimal locations for the
placement mode switches to modes with priority I. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_not (kill[bb->index], transp[bb->index]);
edge_list = pre_edge_lcm (n_entities, transp, comp, antic,
kill, &insert, &del);
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index f313044..ba8d020 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -3343,7 +3343,7 @@ rest_of_handle_sms (void)
max_regno = max_reg_num ();
/* Finalize layout changes. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
bb->aux = bb->next_bb;
free_dominance_info (CDI_DOMINATORS);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index c929157..05fca40 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4545,7 +4545,7 @@ optimize_omp_library_calls (gimple entry_stmt)
&& find_omp_clause (gimple_omp_task_clauses (entry_stmt),
OMP_CLAUSE_UNTIED) != NULL);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple call = gsi_stmt (gsi);
@@ -4849,7 +4849,7 @@ expand_omp_taskreg (struct omp_region *region)
basic_block bb;
bool changed = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
changed |= gimple_purge_dead_eh_edges (bb);
if (changed)
cleanup_tree_cfg ();
@@ -7939,7 +7939,7 @@ expand_omp_target (struct omp_region *region)
basic_block bb;
bool changed = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
changed |= gimple_purge_dead_eh_edges (bb);
if (changed)
cleanup_tree_cfg ();
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 9ce17e5..a1204f9 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -266,7 +266,7 @@ alloc_mem (void)
/* Find the largest UID and create a mapping from UIDs to CUIDs. */
uid_cuid = XCNEWVEC (int, get_max_uid () + 1);
i = 1;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
@@ -828,7 +828,7 @@ compute_hash_table (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
diff --git a/gcc/postreload.c b/gcc/postreload.c
index b0c6342..bfa5a38 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -213,7 +213,7 @@ reload_cse_regs_1 (void)
cselib_init (CSELIB_RECORD_MEMORY);
init_alias_analysis ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
diff --git a/gcc/predict.c b/gcc/predict.c
index 6bb1b2c..78efb72 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1955,7 +1955,7 @@ strip_predict_hints (void)
gimple ass_stmt;
tree var;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator bi;
for (bi = gsi_start_bb (bb); !gsi_end_p (bi);)
@@ -2226,7 +2226,7 @@ tree_bb_level_predictions (void)
apply_return_prediction ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
@@ -2400,10 +2400,10 @@ tree_estimate_probability (void)
if (number_of_loops (cfun) > 1)
predict_loops ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
tree_estimate_probability_bb (bb);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
combine_predictions_for_bb (bb);
#ifdef ENABLE_CHECKING
@@ -2928,7 +2928,7 @@ expensive_function_p (int threshold)
/* Maximally BB_FREQ_MAX^2 so overflow won't happen. */
limit = ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency * threshold;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
@@ -2997,7 +2997,7 @@ estimate_bb_frequencies (bool force)
estimate_loops ();
memcpy (&freq_max, &real_zero, sizeof (real_zero));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (sreal_compare (&freq_max, &BLOCK_INFO (bb)->frequency) < 0)
memcpy (&freq_max, &BLOCK_INFO (bb)->frequency, sizeof (freq_max));
@@ -3055,7 +3055,7 @@ compute_function_frequency (void)
functions to unlikely and that is most of what we care about. */
if (!cfun->after_inlining)
node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (maybe_hot_bb_p (cfun, bb))
{
diff --git a/gcc/profile.c b/gcc/profile.c
index 24c16aa..62b126c 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -354,7 +354,7 @@ is_inconsistent (void)
{
basic_block bb;
bool inconsistent = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
inconsistent |= is_edge_inconsistent (bb->preds);
if (!dump_file && inconsistent)
@@ -692,7 +692,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
/* If the graph has been correctly solved, every block will have a
succ and pred count of zero. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gcc_assert (!BB_INFO (bb)->succ_count && !BB_INFO (bb)->pred_count);
}
@@ -1021,7 +1021,7 @@ branch_prob (void)
We also add fake exit edges for each call and asm statement in the
basic, since it may not return. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int need_exit_edge = 0, need_entry_edge = 0;
int have_exit_edge = 0, have_entry_edge = 0;
@@ -1260,7 +1260,7 @@ branch_prob (void)
/* Initialize the output. */
output_location (NULL, 0, NULL, NULL);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
gcov_position_t offset = 0;
diff --git a/gcc/ree.c b/gcc/ree.c
index 87427fd..9938e98 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -835,7 +835,7 @@ find_removable_extensions (void)
rtx insn, set;
unsigned *def_map = XCNEWVEC (unsigned, max_insn_uid);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (!NONDEBUG_INSN_P (insn))
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 6aad466..87b9821 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -2846,7 +2846,7 @@ compensate_edges (void)
starting_stack_p = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb != ENTRY_BLOCK_PTR_FOR_FN (cfun))
{
edge e;
@@ -3153,7 +3153,7 @@ convert_regs (void)
/* ??? Process all unreachable blocks. Though there's no excuse
for keeping these even when not optimizing. */
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
block_info bi = BLOCK_INFO (b);
@@ -3212,7 +3212,7 @@ reg_to_stack (void)
/* Set up block info for each basic block. */
alloc_aux_for_blocks (sizeof (struct block_info_def));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
block_info bi = BLOCK_INFO (bb);
edge_iterator ei;
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 0438875..3c9ef3d 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1076,7 +1076,7 @@ copyprop_hardreg_forward (void)
= create_alloc_pool ("debug insn changes pool",
sizeof (struct queued_debug_insn_change), 256);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bitmap_set_bit (visited, bb->index);
@@ -1112,7 +1112,7 @@ copyprop_hardreg_forward (void)
if (MAY_HAVE_DEBUG_INSNS)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bitmap_bit_p (visited, bb->index)
&& all_vd[bb->index].n_debug_insn_changes)
{
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index db66a09..46288eb 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1266,7 +1266,7 @@ init_subregs_of_mode (void)
bitmap_obstack_initialize (&srom_obstack);
subregs_of_mode = BITMAP_ALLOC (&srom_obstack);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
find_subregs_of_mode (PATTERN (insn), subregs_of_mode);
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 3c242fb..9ff94d0 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -674,7 +674,7 @@ regrename_analyze (bitmap bb_mask)
/* Gather some information about the blocks in this function. */
rename_info = XCNEWVEC (struct bb_rename_info, n_basic_blocks_for_fn (cfun));
i = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct bb_rename_info *ri = rename_info + i;
ri->bb = bb;
@@ -778,7 +778,7 @@ regrename_analyze (bitmap bb_mask)
We perform the analysis for both incoming and outgoing edges, but we
only need to merge once (in the second part, after verifying outgoing
edges). */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct bb_rename_info *bb_ri = (struct bb_rename_info *) bb->aux;
unsigned j;
@@ -843,7 +843,7 @@ regrename_analyze (bitmap bb_mask)
}
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
struct bb_rename_info *bb_ri = (struct bb_rename_info *) bb->aux;
unsigned j;
@@ -920,7 +920,7 @@ regrename_analyze (bitmap bb_mask)
free (rename_info);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->aux = NULL;
}
diff --git a/gcc/regstat.c b/gcc/regstat.c
index 48d27c3..6a191d8 100644
--- a/gcc/regstat.c
+++ b/gcc/regstat.c
@@ -375,7 +375,7 @@ regstat_compute_ri (void)
reg_info_p = XCNEWVEC (struct reg_info_t, max_regno);
local_live_last_luid = XNEWVEC (int, max_regno);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
regstat_bb_compute_ri (bb->index, live, artificial_uses,
local_live, local_processed,
@@ -522,7 +522,7 @@ regstat_compute_calls_crossed (void)
reg_info_p_size = max_regno;
reg_info_p = XCNEWVEC (struct reg_info_t, max_regno);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
regstat_bb_compute_calls_crossed (bb->index, live);
}
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 15c6db5..47439ce 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -613,7 +613,7 @@ has_nonexceptional_receiver (void)
/* First determine which blocks can reach exit via normal paths. */
tos = worklist = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) + 1);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_REACHABLE;
/* Place the exit block on our worklist. */
@@ -641,7 +641,7 @@ has_nonexceptional_receiver (void)
/* Now see if there's a reachable block with an exceptional incoming
edge. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->flags & BB_REACHABLE && bb_has_abnormal_pred (bb))
return true;
@@ -1048,7 +1048,7 @@ reload (rtx first, int global)
pseudo. */
if (! frame_pointer_needed)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear_bit (df_get_live_in (bb), HARD_FRAME_POINTER_REGNUM);
/* Come here (with failure set nonzero) if we can't get enough spill
@@ -1592,7 +1592,7 @@ calculate_elim_costs_all_insns (void)
set_initial_elim_offsets ();
set_initial_label_offsets ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
elim_bb = bb;
diff --git a/gcc/resource.c b/gcc/resource.c
index 861d969..442c852 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1219,7 +1219,7 @@ init_resource_info (rtx epilogue_insn)
bb_ticks = XCNEWVEC (int, last_basic_block_for_fn (cfun));
/* Set the BLOCK_FOR_INSN of each label that starts a basic block. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (LABEL_P (BB_HEAD (bb)))
BLOCK_FOR_INSN (BB_HEAD (bb)) = bb;
}
@@ -1258,7 +1258,7 @@ free_resource_info (void)
bb_ticks = NULL;
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (LABEL_P (BB_HEAD (bb)))
BLOCK_FOR_INSN (BB_HEAD (bb)) = NULL;
}
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 73af0a7..d4baec5 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -637,7 +637,7 @@ schedule_ebbs (void)
schedule_ebbs_init ();
/* Schedule every region in the subroutine. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx head = BB_HEAD (bb);
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index a85ee5b..7fa9759 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -272,7 +272,7 @@ is_cfg_nonregular (void)
/* If we have insns which refer to labels as non-jumped-to operands,
then we consider the cfg not well structured. */
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
FOR_BB_INSNS (b, insn)
{
rtx note, next, set, dest;
@@ -317,7 +317,7 @@ is_cfg_nonregular (void)
Unreachable loops with a single block are detected here. This
test is redundant with the one in find_rgns, but it's much
cheaper to go ahead and catch the trivial case here. */
- FOR_EACH_BB (b)
+ FOR_EACH_BB_FN (b, cfun)
{
if (EDGE_COUNT (b->preds) == 0
|| (single_pred_p (b)
@@ -479,7 +479,7 @@ find_single_block_region (bool ebbs_p)
probability_cutoff = PARAM_VALUE (TRACER_MIN_BRANCH_PROBABILITY);
probability_cutoff = REG_BR_PROB_BASE / 100 * probability_cutoff;
- FOR_EACH_BB (ebb_start)
+ FOR_EACH_BB_FN (ebb_start, cfun)
{
RGN_NR_BLOCKS (nr_regions) = 0;
RGN_BLOCKS (nr_regions) = i;
@@ -512,7 +512,7 @@ find_single_block_region (bool ebbs_p)
}
}
else
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rgn_bb_table[nr_regions] = bb->index;
RGN_NR_BLOCKS (nr_regions) = 1;
@@ -762,7 +762,7 @@ haifa_find_rgns (void)
the entry node by placing a nonzero value in dfs_nr. Thus if
dfs_nr is zero for any block, then it must be unreachable. */
unreachable = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (dfs_nr[bb->index] == 0)
{
unreachable = 1;
@@ -773,7 +773,7 @@ haifa_find_rgns (void)
to hold degree counts. */
degree = dfs_nr;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
degree[bb->index] = EDGE_COUNT (bb->preds);
/* Do not perform region scheduling if there are any unreachable
@@ -807,7 +807,7 @@ haifa_find_rgns (void)
/* Find blocks which are inner loop headers. We still have non-reducible
loops to consider at this point. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bitmap_bit_p (header, bb->index) && bitmap_bit_p (inner, bb->index))
{
@@ -826,7 +826,7 @@ haifa_find_rgns (void)
If there exists a block that is not dominated by the loop
header, then the block is reachable from outside the loop
and thus the loop is not a natural loop. */
- FOR_EACH_BB (jbb)
+ FOR_EACH_BB_FN (jbb, cfun)
{
/* First identify blocks in the loop, except for the loop
entry block. */
@@ -874,7 +874,7 @@ haifa_find_rgns (void)
Place those blocks into the queue. */
if (no_loops)
{
- FOR_EACH_BB (jbb)
+ FOR_EACH_BB_FN (jbb, cfun)
/* Leaf nodes have only a single successor which must
be EXIT_BLOCK. */
if (single_succ_p (jbb)
@@ -1052,7 +1052,7 @@ haifa_find_rgns (void)
/* Any block that did not end up in a region is placed into a region
by itself. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (degree[bb->index] >= 0)
{
rgn_bb_table[idx] = bb->index;
@@ -3281,7 +3281,7 @@ sched_rgn_local_init (int rgn)
/* Use ->aux to implement EDGE_TO_BIT mapping. */
rgn_nr_edges = 0;
- FOR_EACH_BB (block)
+ FOR_EACH_BB_FN (block, cfun)
{
if (CONTAINING_RGN (block->index) != rgn)
continue;
@@ -3291,7 +3291,7 @@ sched_rgn_local_init (int rgn)
rgn_edges = XNEWVEC (edge, rgn_nr_edges);
rgn_nr_edges = 0;
- FOR_EACH_BB (block)
+ FOR_EACH_BB_FN (block, cfun)
{
if (CONTAINING_RGN (block->index) != rgn)
continue;
@@ -3312,7 +3312,7 @@ sched_rgn_local_init (int rgn)
/* Cleanup ->aux used for EDGE_TO_BIT mapping. */
/* We don't need them anymore. But we want to avoid duplication of
aux fields in the newly created edges. */
- FOR_EACH_BB (block)
+ FOR_EACH_BB_FN (block, cfun)
{
if (CONTAINING_RGN (block->index) != rgn)
continue;
diff --git a/gcc/sel-sched-dump.c b/gcc/sel-sched-dump.c
index 347b5eb..2e46770 100644
--- a/gcc/sel-sched-dump.c
+++ b/gcc/sel-sched-dump.c
@@ -750,7 +750,7 @@ sel_dump_cfg_2 (FILE *f, int flags)
if (flags & SEL_DUMP_CFG_FUNCTION_NAME)
fprintf (f, "function [label = \"%s\"];\n", current_function_name ());
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
insn_t insn = BB_HEAD (bb);
insn_t next_tail = NEXT_INSN (BB_END (bb));
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index f7cc9ec..942d909 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4321,7 +4321,7 @@ init_lv_sets (void)
basic_block bb;
/* Initialize of LV sets. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
init_lv_set (bb);
/* Don't forget EXIT_BLOCK. */
@@ -4349,7 +4349,7 @@ free_lv_sets (void)
free_lv_set (EXIT_BLOCK_PTR_FOR_FN (cfun));
/* Free LV sets. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (BB_LV_SET (bb))
free_lv_set (bb);
}
@@ -6155,7 +6155,7 @@ make_regions_from_the_rest (void)
for (i = 0; i < last_basic_block_for_fn (cfun); i++)
loop_hdr[i] = -1;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->loop_father && !bb->loop_father->num == 0
&& !(bb->flags & BB_IRREDUCIBLE_LOOP))
@@ -6165,7 +6165,7 @@ make_regions_from_the_rest (void)
/* For each basic block degree is calculated as the number of incoming
edges, that are going out of bbs that are not yet scheduled.
The basic blocks that are scheduled have degree value of zero. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
degree[bb->index] = 0;
@@ -6183,7 +6183,7 @@ make_regions_from_the_rest (void)
/* Any block that did not end up in a region is placed into a region
by itself. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (degree[bb->index] >= 0)
{
rgn_bb_table[cur_rgn_blocks] = bb->index;
diff --git a/gcc/sese.c b/gcc/sese.c
index 7e59ac8..5e47ef7 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -156,7 +156,7 @@ build_sese_loop_nests (sese region)
basic_block bb;
struct loop *loop0, *loop1;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb_in_sese_p (bb, region))
{
struct loop *loop = bb->loop_father;
@@ -303,10 +303,10 @@ sese_build_liveouts (sese region, bitmap liveouts)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
sese_build_liveouts_bb (region, liveouts, bb);
if (MAY_HAVE_DEBUG_STMTS)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
sese_reset_debug_liveouts_bb (region, liveouts, bb);
}
diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index 68ccd16..acca801 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -58,7 +58,7 @@ notice_stack_pointer_modification (void)
been used. */
crtl->sp_is_unchanging = !cfun->calls_alloca;
if (crtl->sp_is_unchanging)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index 808b0a7..57c991a 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -656,7 +656,7 @@ compute_store_table (void)
already_set = XNEWVEC (int, max_gcse_regno);
/* Find all the stores we care about. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* First compute the registers set in this block. */
FOR_BB_INSNS (bb, insn)
@@ -1061,7 +1061,7 @@ build_store_vectors (void)
bitmap_vector_clear (st_transp, last_basic_block_for_fn (cfun));
regs_set_in_block = XNEWVEC (int, max_gcse_regno);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
memset (regs_set_in_block, 0, sizeof (int) * max_gcse_regno);
@@ -1188,7 +1188,7 @@ one_store_motion_pass (void)
/* Now we want to insert the new stores which are going to be needed. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bitmap_bit_p (st_delete_map[bb->index], ptr->index))
{
delete_store (ptr, bb);
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
index be5a204..041f25d 100644
--- a/gcc/testsuite/g++.dg/plugin/selfassign.c
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -261,7 +261,7 @@ execute_warn_self_assign (void)
gimple_stmt_iterator gsi;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
warn_self_assign (gsi_stmt (gsi));
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
index be5a204..041f25d 100644
--- a/gcc/testsuite/gcc.dg/plugin/selfassign.c
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -261,7 +261,7 @@ execute_warn_self_assign (void)
gimple_stmt_iterator gsi;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
warn_self_assign (gsi_stmt (gsi));
diff --git a/gcc/tracer.c b/gcc/tracer.c
index de6877a..a40cbeb 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -256,7 +256,7 @@ tail_duplicate (void)
branch_ratio_cutoff =
(REG_BR_PROB_BASE / 100 * PARAM_VALUE (TRACER_MIN_BRANCH_RATIO));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
int n = count_insns (bb);
if (!ignore_bb_p (bb))
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 2a6597d..c9af680 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2656,7 +2656,7 @@ compute_transaction_bits (void)
certainly don't need it to calculate CDI_DOMINATOR info. */
gate_tm_init ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bb->flags &= ~BB_IN_TRANSACTION;
for (region = all_tm_regions; region; region = region->next)
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 19402e3..32d0d5a 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -876,7 +876,7 @@ tree_call_cdce (void)
gimple_stmt_iterator i;
bool something_changed = false;
auto_vec<gimple> cond_dead_built_in_calls;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Collect dead call candidates. */
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ec365b5..98434ac 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -302,7 +302,7 @@ replace_loop_annotate ()
}
/* Remove IFN_ANNOTATE. Safeguard for the case loop->latch == NULL. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gsi = gsi_last_bb (bb);
stmt = gsi_stmt (gsi);
@@ -456,7 +456,7 @@ factor_computed_gotos (void)
Examine the last statement in each basic block to see if the block
ends with a computed goto. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_last_bb (bb);
gimple last;
@@ -635,7 +635,7 @@ fold_cond_expr_cond (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple stmt = last_stmt (bb);
@@ -682,7 +682,7 @@ make_edges (void)
EDGE_FALLTHRU);
/* Traverse the basic block array placing edges. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last = last_stmt (bb);
bool fallthru;
@@ -836,7 +836,7 @@ assign_discriminators (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
@@ -1055,7 +1055,7 @@ make_abnormal_goto_edges (basic_block bb, bool for_call)
basic_block target_bb;
gimple_stmt_iterator gsi;
- FOR_EACH_BB (target_bb)
+ FOR_EACH_BB_FN (target_bb, cfun)
{
for (gsi = gsi_start_bb (target_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1235,7 +1235,7 @@ cleanup_dead_labels (void)
/* Find a suitable label for each block. We use the first user-defined
label if there is one, or otherwise just the first label we see. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
@@ -1271,7 +1271,7 @@ cleanup_dead_labels (void)
/* Now redirect all jumps/branches to the selected label.
First do so for each block ending in a control statement. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple stmt = last_stmt (bb);
tree label, new_label;
@@ -1363,7 +1363,7 @@ cleanup_dead_labels (void)
/* Finally, purge dead labels. All user-defined labels and labels that
can be the target of non-local gotos and labels which have their
address taken are preserved. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
tree label_for_this_bb = label_for_bb[bb->index].label;
@@ -1487,7 +1487,7 @@ group_case_labels (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple stmt = last_stmt (bb);
if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
@@ -2160,7 +2160,7 @@ dump_cfg_stats (FILE *file)
SCALE (size), LABEL (size));
num_edges = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
num_edges += EDGE_COUNT (bb->succs);
size = num_edges * sizeof (struct edge_def);
total += size;
@@ -4894,7 +4894,7 @@ gimple_verify_flow_info (void)
err = 1;
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool found_ctrl_stmt = false;
@@ -7241,7 +7241,7 @@ print_loop (FILE *file, struct loop *loop, int indent, int verbosity)
if (verbosity >= 1)
{
fprintf (file, "%s{\n", s_indent);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->loop_father == loop)
print_loops_bb (file, bb, indent, verbosity);
@@ -8331,7 +8331,7 @@ execute_fixup_cfg (void)
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
e->count = apply_scale (e->count, count_scale);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bb->count = apply_scale (bb->count, count_scale);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 50b4a68..949b21d 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -640,7 +640,7 @@ cleanup_tree_cfg_1 (void)
recording of edge to CASE_LABEL_EXPR. */
start_recording_case_labels ();
- /* Start by iterating over all basic blocks. We cannot use FOR_EACH_BB,
+ /* Start by iterating over all basic blocks. We cannot use FOR_EACH_BB_FN,
since the basic blocks may get removed. */
n = last_basic_block_for_fn (cfun);
for (i = NUM_FIXED_BLOCKS; i < n; i++)
@@ -918,7 +918,7 @@ merge_phi_nodes (void)
calculate_dominance_info (CDI_DOMINATORS);
/* Find all PHI nodes that we may be able to merge. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
basic_block dest;
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index ff5ccab..8c9a3aa 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -207,7 +207,7 @@ init_dont_simulate_again (void)
gimple phi;
bool saw_a_complex_op = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1637,7 +1637,7 @@ tree_lower_complex (void)
/* ??? Ideally we'd traverse the blocks in breadth-first order. */
old_last_basic_block = last_basic_block_for_fn (cfun);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
if (bb->index >= old_last_basic_block)
continue;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 27d6a71..2d964d5 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -279,7 +279,7 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d));
/* Walk all the statements in the function counting references. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
@@ -741,7 +741,7 @@ dump_enumerated_decls (FILE *file, int flags)
memset (&wi, '\0', sizeof (wi));
wi.info = (void *) &decl_list;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 85dc79f..467eb20 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3304,7 +3304,7 @@ execute_lower_resx (void)
mnt_map = pointer_map_create ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last = last_stmt (bb);
if (last && is_gimple_resx (last))
@@ -3710,7 +3710,7 @@ execute_lower_eh_dispatch (void)
assign_filter_values ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last = last_stmt (bb);
if (last == NULL)
@@ -3810,7 +3810,7 @@ mark_reachable_handlers (sbitmap *r_reachablep, sbitmap *lp_reachablep)
else
lp_reachable = NULL;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index 9ba25fc..32599eb 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -638,7 +638,7 @@ lower_emutls_function_body (struct cgraph_node *node)
create a node for it. */
d.builtin_node = cgraph_get_create_node (d.builtin_decl);
- FOR_EACH_BB (d.bb)
+ FOR_EACH_BB_FN (d.bb, cfun)
{
gimple_stmt_iterator gsi;
unsigned int i, nedge;
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 7f6a150..71a25f1 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1815,7 +1815,7 @@ main_tree_if_conversion (void)
#ifdef ENABLE_CHECKING
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
gcc_assert (!bb->aux);
}
#endif
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index ed06cb9..ab8e40b 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4569,7 +4569,7 @@ optimize_inline_calls (tree fn)
will split id->current_basic_block, and the new blocks will
follow it; we'll trudge through them, processing their CALL_EXPRs
along the way. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
inlined_p |= gimple_expand_calls_inline (bb, &id);
pop_gimplify_context (NULL);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index b6d3dd7..8e539f2 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -2320,7 +2320,7 @@ rewrite_into_ssa (void)
/* Initialize dominance frontier. */
dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
/* 1- Compute dominance frontiers. */
@@ -2337,7 +2337,7 @@ rewrite_into_ssa (void)
rewrite_blocks (ENTRY_BLOCK_PTR_FOR_FN (cfun), REWRITE_ALL);
/* Free allocated memory. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear (&dfs[bb->index]);
free (dfs);
@@ -3270,7 +3270,7 @@ update_ssa (unsigned update_flags)
/* If the caller requested PHI nodes to be added, compute
dominance frontiers. */
dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
compute_dominance_frontiers (dfs);
@@ -3296,7 +3296,7 @@ update_ssa (unsigned update_flags)
insert_updated_phi_nodes_for (sym, dfs, blocks_to_update,
update_flags);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear (&dfs[bb->index]);
free (dfs);
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index b42993d..e00463d 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -144,7 +144,7 @@ tree_nrv (void)
return 0;
/* Look through each block for assignments to the RESULT_DECL. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -238,7 +238,7 @@ tree_nrv (void)
RESULT. */
data.var = found;
data.result = result;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
{
@@ -358,7 +358,7 @@ execute_return_slot_opt (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 6a587e1..c83345f 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -1211,7 +1211,7 @@ static unsigned int
compute_object_sizes (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 8df3026..c5bba789 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -835,7 +835,7 @@ eliminate_useless_phis (void)
gimple_stmt_iterator gsi;
tree result;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); )
{
@@ -893,7 +893,7 @@ rewrite_trees (var_map map ATTRIBUTE_UNUSED)
/* Search for PHIs where the destination has no partition, but one
or more arguments has a partition. This should not happen and can
create incorrect code. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1101,7 +1101,7 @@ insert_backedge_copies (void)
mark_dfs_back_edges ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Mark block as possibly needing calculation of UIDs. */
bb->aux = &bb->aux;
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 537c246..51e997c 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -637,7 +637,7 @@ tree_profiling (void)
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index ada942d..59e44cb 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -3276,7 +3276,7 @@ scev_const_prop (void)
if (number_of_loops (cfun) <= 1)
return 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
loop = bb->loop_father;
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 9aa526f..ebd4218 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1252,7 +1252,7 @@ scan_function (void)
basic_block bb;
bool ret = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -3311,7 +3311,7 @@ sra_modify_function_body (void)
bool cfg_changed = false;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_start_bb (bb);
while (!gsi_end_p (gsi))
@@ -3795,7 +3795,7 @@ propagate_dereference_distances (void)
auto_vec<basic_block> queue (last_basic_block_for_fn (cfun));
queue.quick_push (ENTRY_BLOCK_PTR_FOR_FN (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
queue.quick_push (bb);
bb->aux = bb;
@@ -4572,7 +4572,7 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments)
bool cfg_changed = false;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
@@ -4811,7 +4811,7 @@ convert_callers (struct cgraph_node *node, tree old_decl,
if (!encountered_recursive_call)
return;
- FOR_EACH_BB (this_block)
+ FOR_EACH_BB_FN (this_block, cfun)
{
gimple_stmt_iterator gsi;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 3d05258..7e07771 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -774,7 +774,7 @@ ccp_initialize (void)
const_val = XCNEWVEC (prop_value_t, n_const_val);
/* Initialize simulation flags for PHI nodes and statements. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
@@ -808,7 +808,7 @@ ccp_initialize (void)
/* Now process PHI nodes. We never clear the simulate_again flag on
phi nodes, since we do not know which edges are executable yet,
except for phi nodes for virtual operands when we do not do store ccp. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
@@ -2508,7 +2508,7 @@ execute_fold_all_builtins (void)
basic_block bb;
unsigned int todoflags = 0;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
for (i = gsi_start_bb (bb); !gsi_end_p (i); )
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 70158d5..38a4078 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -821,7 +821,7 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
live = new_live_track (map);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
@@ -929,7 +929,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
map = init_var_map (num_ssa_names);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
tree arg;
@@ -1183,7 +1183,7 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl,
in the coalesce list because they do not need to be sorted, and simply
consume extra memory/compilation time in large programs. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_ABNORMAL)
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 0dd5e14..3da262b 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -469,7 +469,7 @@ init_copy_prop (void)
n_copy_of = num_ssa_names;
copy_of = XCNEWVEC (prop_value_t, n_copy_of);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
int depth = bb_loop_depth (bb);
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 90e070f..c7d514f 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -325,7 +325,7 @@ rename_ssa_copies (void)
map = init_var_map (num_ssa_names);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Scan for real copies. */
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -341,7 +341,7 @@ rename_ssa_copies (void)
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Treat PHI nodes as copies between the result and each argument. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 701dd44..5abef5c 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -374,7 +374,7 @@ find_obviously_necessary_stmts (bool aggressive)
gimple phi, stmt;
int flags;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* PHI nodes are never inherently necessary. */
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -404,7 +404,7 @@ find_obviously_necessary_stmts (bool aggressive)
struct loop *loop;
scev_initialize ();
if (mark_irreducible_loops ())
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -1325,7 +1325,7 @@ eliminate_unnecessary_stmts (void)
}
}
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Remove dead PHI nodes. */
something_changed |= remove_dead_phis (bb);
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 6cf60be..2bd2a86 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -795,7 +795,7 @@ free_all_edge_infos (void)
edge_iterator ei;
edge e;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->preds)
{
@@ -866,7 +866,7 @@ tree_ssa_dominator_optimize (void)
{
gimple_stmt_iterator gsi;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
update_stmt_if_modified (gsi_stmt (gsi));
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 6e6d115..a77a639 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -3386,7 +3386,7 @@ ssa_forward_propagate_and_combine (void)
cfg_changed = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 6ccf2fb..da7198b 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -673,7 +673,7 @@ clear_unused_block_pointer (void)
basic_block bb;
gimple_stmt_iterator gsi;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
unsigned i;
@@ -791,7 +791,7 @@ remove_unused_locals (void)
usedvars = BITMAP_ALLOC (NULL);
/* Walk the CFG marking all referenced symbols. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
size_t i;
@@ -856,7 +856,7 @@ remove_unused_locals (void)
ignores them, and the second pass (if there were any) tries to remove
them. */
if (have_local_clobbers)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
@@ -963,11 +963,11 @@ new_tree_live_info (var_map map)
live->num_blocks = last_basic_block_for_fn (cfun);
live->livein = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&live->livein[bb->index], &liveness_bitmap_obstack);
live->liveout = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_initialize (&live->liveout[bb->index], &liveness_bitmap_obstack);
live->work_stack = XNEWVEC (int, last_basic_block_for_fn (cfun));
@@ -1149,11 +1149,11 @@ calculate_live_on_exit (tree_live_info_p liveinfo)
edge_iterator ei;
/* live on entry calculations used liveout vectors for defs, clear them. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
bitmap_clear (&liveinfo->liveout[bb->index]);
/* Set all the live-on-exit bits for uses in PHIs. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
size_t i;
@@ -1294,7 +1294,7 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag)
if ((flag & LIVEDUMP_ENTRY) && live->livein)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (f, "\nLive on entry to BB%d : ", bb->index);
EXECUTE_IF_SET_IN_BITMAP (&live->livein[bb->index], 0, i, bi)
@@ -1308,7 +1308,7 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag)
if ((flag & LIVEDUMP_EXIT) && live->liveout)
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (f, "\nLive on exit from BB%d : ", bb->index);
EXECUTE_IF_SET_IN_BITMAP (&live->liveout[bb->index], 0, i, bi)
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 3aaf2b2..cbcdc37 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1601,7 +1601,7 @@ analyze_memory_references (void)
loops postorder. */
i = 0;
bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
if (bb->loop_father != current_loops->tree_root)
bbs[i++] = bb;
n = i;
@@ -2406,7 +2406,7 @@ fill_always_executed_in (void)
struct loop *loop;
bitmap_clear (contains_call);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -2478,7 +2478,7 @@ tree_ssa_lim_finalize (void)
free_aux_for_edges ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
SET_ALWAYS_EXECUTED_IN (bb, NULL);
bitmap_obstack_release (&lim_bitmap_obstack);
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 76d5958..ed30c7b0 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -463,7 +463,7 @@ find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks, bitmap need_phis)
EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi)
find_uses_to_rename_bb (BASIC_BLOCK_FOR_FN (cfun, index), use_blocks, need_phis);
else
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
find_uses_to_rename_bb (bb, use_blocks, need_phis);
}
@@ -602,7 +602,7 @@ verify_loop_closed_ssa (bool verify_ssa_p)
timevar_push (TV_VERIFY_LOOP_CLOSED);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index f77c016..1c89f45 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -527,7 +527,7 @@ execute_cse_reciprocals (void)
calculate_dominance_info (CDI_POST_DOMINATORS);
#ifdef ENABLE_CHECKING
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
gcc_assert (!bb->aux);
#endif
@@ -540,7 +540,7 @@ execute_cse_reciprocals (void)
execute_cse_reciprocals_1 (NULL, name);
}
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
gimple phi;
@@ -1419,7 +1419,7 @@ execute_cse_sincos (void)
calculate_dominance_info (CDI_DOMINATORS);
memset (&sincos_stats, 0, sizeof (sincos_stats));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
bool cleanup_eh = false;
@@ -1939,7 +1939,7 @@ execute_optimize_bswap (void)
memset (&bswap_stats, 0, sizeof (bswap_stats));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
@@ -2785,7 +2785,7 @@ execute_optimize_widening_mul (void)
memset (&widen_mul_stats, 0, sizeof (widen_mul_stats));
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 55ae68b..f9f084b 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -1097,7 +1097,7 @@ substitute_and_fold (ssa_prop_get_value_fn get_value_fn,
}
/* Propagate into all uses and fold. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 16679f4..9ec1512 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -6778,7 +6778,7 @@ compute_points_to_sets (void)
intra_create_variable_infos ();
/* Now walk all statements and build the constraint set. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
@@ -6825,7 +6825,7 @@ compute_points_to_sets (void)
}
/* Compute the call-used/clobbered sets. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index a0eac67..4e05246 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -754,7 +754,7 @@ find_same_succ (void)
same_succ same = same_succ_alloc ();
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
find_same_succ_bb (bb, &same);
if (same == NULL)
@@ -1015,7 +1015,7 @@ reset_cluster_vectors (void)
for (i = 0; i < all_clusters.length (); ++i)
delete_cluster (all_clusters[i]);
all_clusters.truncate (0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
BB_CLUSTER (bb) = NULL;
}
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index fa6a248..22ae47b 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -683,7 +683,7 @@ find_replaceable_exprs (var_map map)
bitmap_obstack_initialize (&ter_bitmap_obstack);
table = new_temp_expr_table (map);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
find_replaceable_in_bb (table, bb);
gcc_checking_assert (bitmap_empty_p (table->partition_in_use));
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 9289c11..6f978e2 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -1631,7 +1631,7 @@ thread_through_all_blocks (bool may_peel_loop_headers)
ahead and thread it, else ignore it. */
basic_block bb;
edge e;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* If we do end up threading here, we can remove elements from
BB->preds. Thus we can not use the FOR_EACH_EDGE iterator. */
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index d38e0dd..63a2e10 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -65,7 +65,7 @@ associate_equivalences_with_edges (void)
/* Walk over each block. If the block ends with a control statement,
then it might create a useful equivalence. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_last_bb (bb);
gimple stmt;
@@ -406,7 +406,7 @@ tree_ssa_uncprop (void)
/* we just need to empty elements out of the hash table, and cleanup the
AUX field on the edges. */
val_ssa_equiv.dispose ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 4fd5fb8..c6b0a90 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -176,7 +176,7 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
gimple_stmt_iterator gsi;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun)), bb);
@@ -2130,7 +2130,7 @@ execute_late_warn_uninitialized (void)
added_to_worklist = pointer_set_create ();
/* Initialize worklist */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index f1025b2..8c1aaf2 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -999,7 +999,7 @@ verify_ssa (bool check_modified_stmt)
/* Now verify all the uses and make sure they agree with the definitions
found in the previous pass. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge e;
gimple phi;
@@ -1456,7 +1456,7 @@ execute_update_addresses_taken (void)
/* Collect into ADDRESSES_TAKEN all variables whose address is taken within
the function body. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1558,7 +1558,7 @@ execute_update_addresses_taken (void)
variables and operands need to be rewritten to expose bare symbols. */
if (!bitmap_empty_p (suitable_for_renaming))
{
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 8b168e0..dc82340 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -536,7 +536,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
@@ -703,7 +703,7 @@ execute_optimize_stdarg (void)
|| TREE_TYPE (cfun_va_list) == char_type_node);
gcc_assert (is_gimple_reg_type (cfun_va_list) == va_list_simple_ptr);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
@@ -813,7 +813,7 @@ execute_optimize_stdarg (void)
memset (&wi, 0, sizeof (wi));
wi.info = si.va_list_vars;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index f6b17b8..efcc94d 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1420,7 +1420,7 @@ do_switchconv (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
const char *failure_reason;
gimple stmt = last_stmt (bb);
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index d55485d..098012c 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1541,7 +1541,7 @@ expand_vector_operations (void)
basic_block bb;
bool cfg_changed = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index c11f8a8..e5d201f 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -157,7 +157,7 @@ adjust_simduid_builtins (hash_table <simduid_to_vf> &htab)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator i;
@@ -265,7 +265,7 @@ note_simd_array_uses (hash_table <simd_array_to_simduid> *htab)
wi.info = &ns;
ns.htab = htab;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -475,7 +475,7 @@ execute_vect_slp (void)
init_stmt_vec_info_vec ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
vect_location = find_bb_location (bb);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 06b6259..8ab6d76 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -6431,7 +6431,7 @@ check_all_array_refs (void)
basic_block bb;
gimple_stmt_iterator si;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
edge_iterator ei;
edge e;
@@ -6593,7 +6593,7 @@ remove_range_assertions (void)
/* Note that the BSI iterator bump happens at the bottom of the
loop and no bump is necessary if we're removing the statement
referenced by the current BSI. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (si = gsi_after_labels (bb), is_unreachable = -1; !gsi_end_p (si);)
{
gimple stmt = gsi_stmt (si);
@@ -6708,7 +6708,7 @@ vrp_initialize (void)
vr_value = XCNEWVEC (value_range_t *, num_vr_values);
vr_phi_edge_counts = XCNEWVEC (int, num_ssa_names);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
@@ -9543,7 +9543,7 @@ identify_jump_threads (void)
I doubt it's worth the effort for the classes of jump
threading opportunities we are trying to identify at this
point in compilation. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple last;
diff --git a/gcc/tsan.c b/gcc/tsan.c
index 4efcfe5..d12459f 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -640,7 +640,7 @@ instrument_memory_accesses (void)
gimple_stmt_iterator gsi;
bool fentry_exit_instrument = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
fentry_exit_instrument |= instrument_gimple (&gsi);
return fentry_exit_instrument;
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 846e884..51b4f8d 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -741,7 +741,7 @@ ubsan_pass (void)
basic_block bb;
gimple_stmt_iterator gsi;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index d509354..c684835 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -542,7 +542,7 @@ verify_histograms (void)
error_found = false;
visited_hists = pointer_set_create ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
@@ -648,7 +648,7 @@ gimple_value_profile_transformations (void)
gimple_stmt_iterator gsi;
bool changed = false;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
@@ -1944,7 +1944,7 @@ gimple_find_values_to_profile (histogram_values *values)
histogram_value hist = NULL;
values->create (0);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
gimple_values_to_profile (gsi_stmt (gsi), values);
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 5bd0799..175ec01 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -6941,7 +6941,7 @@ vt_find_locations (void)
in_pending = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (in_worklist);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
fibheap_insert (pending, bb_order[bb->index], bb);
bitmap_ones (in_pending);
@@ -7101,7 +7101,7 @@ vt_find_locations (void)
}
if (success && MAY_HAVE_DEBUG_INSNS)
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
gcc_assert (VTI (bb)->flooded);
free (bb_order);
@@ -7229,7 +7229,7 @@ dump_dataflow_sets (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
fprintf (dump_file, "\nBasic block %d:\n", bb->index);
fprintf (dump_file, "IN:\n");
@@ -9402,7 +9402,7 @@ vt_emit_notes (void)
/* Free memory occupied by the out hash tables, as they aren't used
anymore. */
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
dataflow_set_clear (&VTI (bb)->out);
/* Enable emitting notes by functions (mainly by set_variable_part and
@@ -9418,7 +9418,7 @@ vt_emit_notes (void)
dataflow_set_init (&cur);
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
/* Emit the notes for changes of variable locations between two
subsequent basic blocks. */
@@ -9995,7 +9995,7 @@ vt_initialize (void)
vt_add_function_parameters ();
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
rtx insn;
HOST_WIDE_INT pre, post = 0;
@@ -10138,7 +10138,7 @@ delete_debug_insns (void)
if (!MAY_HAVE_DEBUG_INSNS)
return;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
FOR_BB_INSNS_SAFE (bb, insn, next)
if (DEBUG_INSN_P (insn))
@@ -10181,7 +10181,7 @@ vt_finalize (void)
{
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_EACH_BB_FN (bb, cfun)
{
VTI (bb)->mos.release ();
}
David Malcolm
2013-12-06 14:51:36 UTC
Permalink
* basic-block.h (last_basic_block): Eliminate macro.

* asan.c (transform_statements): Eliminate use of last_basic_block
in favor of last_basic_block_for_fn, in order to make use of cfun
explicit.
* bb-reorder.c (copy_bb, reorder_basic_blocks): Likewise.
* bt-load.c (compute_defs_uses_and_gen, compute_kill, compute_out,
link_btr_uses, build_btr_def_use_webs, migrate_btr_defs): Likewise.
* cfg.c (compact_blocks): Likewise.
* cfganal.c (mark_dfs_back_edges,
control_dependences::control_dependences, post_order_compute,
pre_and_rev_post_order_compute_fn, dfs_enumerate_from, compute_idf,
single_pred_before_succ_order): Likewise.
* cfgbuild.c (make_edges): Likewise.
* cfgexpand.c (add_scope_conflicts, gimple_expand_cfg): Likewise.
* cfghooks.c (verify_flow_info): Likewise.
* cfgloop.c (verify_loop_structure): Likewise.
* cfgloopanal.c (just_once_each_iteration_p,
mark_irreducible_loops): Likewise.
* cfgloopmanip.c (fix_bb_placements, remove_path,
update_dominators_in_loop): Likewise.
* cfgrtl.c (create_basic_block_structure, rtl_create_basic_block,
break_superblocks, rtl_flow_call_edges_add): Likewise.
* config/epiphany/resolve-sw-modes.c (resolve_sw_modes): Likewise.
* config/frv/frv.c (frv_optimize_membar): Likewise.
* config/mips/mips.c (r10k_insert_cache_barriers): Likewise.
* config/spu/spu.c (spu_machine_dependent_reorg): Likewise.
* cprop.c (compute_local_properties, find_implicit_sets,
bypass_conditional_jumps, one_cprop_pass): Likewise.
* cse.c (cse_main): Likewise.
* df-core.c (rest_of_handle_df_initialize, df_worklist_dataflow,
df_analyze, df_grow_bb_info, df_compact_blocks): Likewise.
* df-problems.c (df_lr_verify_solution_start,
df_live_verify_solution_start, df_md_local_compute): Likewise.
* dominance.c (init_dom_info, calc_dfs_tree_nonrec, calc_dfs_tree,
calc_idoms): Likewise.
* domwalk.c (dom_walker::walk): Likewise.
* dse.c (dse_step0, dse_step3): Likewise.
* function.c (epilogue_done): Likewise.
* gcse.c (alloc_gcse_mem, compute_local_properties,
prune_insertions_deletions, compute_pre_data,
pre_expr_reaches_here_p, one_pre_gcse_pass,
compute_code_hoist_vbeinout, should_hoist_expr_to_dom, hoist_code,
one_code_hoisting_pass): Likewise.
* graph.c (draw_cfg_nodes_no_loops): Likewise.
* graphite-sese-to-poly.c (build_scop_bbs): Likewise.
* haifa-sched.c (unlink_bb_notes): Likewise.
* ipa-split.c (execute_split_functions): Likewise.
* ira-build.c (create_loop_tree_nodes,
remove_unnecessary_regions): Likewise.
* ira-emit.c (ira_emit): Likewise.
* ira.c (find_moveable_pseudos, ira): Likewise.
* lcm.c (compute_antinout_edge, compute_laterin,
compute_insert_delete, pre_edge_lcm, compute_available,
compute_nearerout, compute_rev_insert_delete,
pre_edge_rev_lcm): Likewise.
* loop-unroll.c (opt_info_start_duplication,
apply_opt_in_copies): Likewise.
* lower-subreg.c (decompose_multiword_subregs): Likewise.
* lra-lives.c (lra_create_live_ranges): Likewise.
* lra.c (lra): Likewise.
* mode-switching.c (optimize_mode_switching): Likewise.
* recog.c (split_all_insns): Likewise.
* regcprop.c (copyprop_hardreg_forward): Likewise.
* regrename.c (regrename_analyze): Likewise.
* reload1.c (reload): Likewise.
* resource.c (init_resource_info): Likewise.
* sched-rgn.c (haifa_find_rgns, extend_rgns, compute_trg_info,
realloc_bb_state_array, schedule_region, extend_regions): Likewise.
* sel-sched-ir.c (sel_extend_global_bb_info, extend_region_bb_info,
recompute_rev_top_order, sel_init_pipelining,
make_regions_from_the_rest): Likewise.
* store-motion.c (remove_reachable_equiv_notes,build_store_vectors)
Likewise.
* tracer.c (tail_duplicate): Likewise.
* trans-mem.c (tm_region_init, get_bb_regions_instrumented): Likewise.
* tree-cfg.c (create_bb, cleanup_dead_labels, gimple_dump_cfg,
gimple_flow_call_edges_add): Likewise.
* tree-cfgcleanup.c (split_bbs_on_noreturn_calls,
cleanup_tree_cfg_1): Likewise.
* tree-complex.c (tree_lower_complex): Likewise.
* tree-inline.c (copy_cfg_body): Likewise.
* tree-into-ssa.c (mark_phi_for_rewrite, rewrite_into_ssa,
prepare_def_site_for, update_ssa): Likewise.
* tree-ssa-dce.c (tree_dce_init, perform_tree_ssa_dce): Likewise.
* tree-ssa-dom.c (record_edge_info): Likewise.
* tree-ssa-live.c (new_tree_live_info, live_worklist): Likewise.
* tree-ssa-loop-im.c (fill_always_executed_in_1): Likewise.
* tree-ssa-loop-manip.c (copy_phi_node_args
gimple_duplicate_loop_to_header_edge): Likewise.
* tree-ssa-pre.c (compute_antic): Likewise.
* tree-ssa-propagate.c (ssa_prop_init): Likewise.
* tree-ssa-reassoc.c (init_reassoc): Likewise.
* tree-ssa-sccvn.c (init_scc_vn): Likewise.
* tree-ssa-tail-merge.c (init_worklist): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-stdarg.c (reachable_at_most_once): Likewise.
* tree-vrp.c (find_assert_locations): Likewise.
* var-tracking.c (vt_find_locations): Likewise.
---
gcc/asan.c | 2 +-
gcc/basic-block.h | 3 -
gcc/bb-reorder.c | 7 ++-
gcc/bt-load.c | 30 +++++-----
gcc/cfg.c | 4 +-
gcc/cfganal.c | 25 ++++----
gcc/cfgbuild.c | 2 +-
gcc/cfgexpand.c | 4 +-
gcc/cfghooks.c | 4 +-
gcc/cfgloop.c | 4 +-
gcc/cfgloopanal.c | 4 +-
gcc/cfgloopmanip.c | 6 +-
gcc/cfgrtl.c | 13 +++--
gcc/config/epiphany/resolve-sw-modes.c | 4 +-
gcc/config/frv/frv.c | 4 +-
gcc/config/mips/mips.c | 4 +-
gcc/config/spu/spu.c | 2 +-
gcc/cprop.c | 15 ++---
gcc/cse.c | 4 +-
gcc/df-core.c | 26 +++++----
gcc/df-problems.c | 10 ++--
gcc/dominance.c | 15 +++--
gcc/domwalk.c | 2 +-
gcc/dse.c | 4 +-
gcc/function.c | 2 +-
gcc/gcse.c | 32 +++++-----
gcc/graph.c | 2 +-
gcc/graphite-sese-to-poly.c | 2 +-
gcc/haifa-sched.c | 2 +-
gcc/ipa-split.c | 2 +-
gcc/ira-build.c | 13 +++--
gcc/ira-emit.c | 10 ++--
gcc/ira.c | 12 ++--
gcc/lcm.c | 103 +++++++++++++++++++--------------
gcc/loop-unroll.c | 10 +++-
gcc/lower-subreg.c | 2 +-
gcc/lra-lives.c | 2 +-
gcc/lra.c | 2 +-
gcc/mode-switching.c | 17 +++---
gcc/recog.c | 2 +-
gcc/regcprop.c | 4 +-
gcc/regrename.c | 2 +-
gcc/reload1.c | 2 +-
gcc/resource.c | 2 +-
gcc/sched-rgn.c | 43 ++++++++------
gcc/sel-sched-ir.c | 17 +++---
gcc/store-motion.c | 32 +++++-----
gcc/tracer.c | 6 +-
gcc/trans-mem.c | 4 +-
gcc/tree-cfg.c | 19 +++---
gcc/tree-cfgcleanup.c | 4 +-
gcc/tree-complex.c | 2 +-
gcc/tree-inline.c | 4 +-
gcc/tree-into-ssa.c | 19 +++---
gcc/tree-ssa-dce.c | 7 ++-
gcc/tree-ssa-dom.c | 2 +-
gcc/tree-ssa-live.c | 10 ++--
gcc/tree-ssa-loop-im.c | 2 +-
gcc/tree-ssa-loop-manip.c | 8 +--
gcc/tree-ssa-pre.c | 4 +-
gcc/tree-ssa-propagate.c | 4 +-
gcc/tree-ssa-reassoc.c | 2 +-
gcc/tree-ssa-sccvn.c | 2 +-
gcc/tree-ssa-tail-merge.c | 2 +-
gcc/tree-ssa-uncprop.c | 2 +-
gcc/tree-stdarg.c | 2 +-
gcc/tree-vrp.c | 10 ++--
gcc/var-tracking.c | 8 +--
68 files changed, 349 insertions(+), 289 deletions(-)

diff --git a/gcc/asan.c b/gcc/asan.c
index 74140d6..09c0667 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2041,7 +2041,7 @@ transform_statements (void)
{
basic_block bb, last_bb = NULL;
gimple_stmt_iterator i;
- int saved_last_basic_block = last_basic_block;
+ int saved_last_basic_block = last_basic_block_for_fn (cfun);

FOR_EACH_BB (bb)
{
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index d000a43..174b650 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -326,9 +326,6 @@ struct GTY(()) control_flow_graph {
#define SET_BASIC_BLOCK_FOR_FN(FN,N,BB) \
((*basic_block_info_for_fn (FN))[(N)] = (BB))

-/* Defines for textual backward source compatibility. */
-#define last_basic_block (cfun->cfg->x_last_basic_block)
-
/* For iterating over basic blocks. */
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
for (BB = FROM; BB != TO; BB = BB->DIR)
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index fc7b5b7..363af2d 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -826,12 +826,13 @@ copy_bb (basic_block old_bb, edge e, basic_block bb, int trace)
"Duplicated bb %d (created bb %d)\n",
old_bb->index, new_bb->index);

- if (new_bb->index >= array_size || last_basic_block > array_size)
+ if (new_bb->index >= array_size
+ || last_basic_block_for_fn (cfun) > array_size)
{
int i;
int new_size;

- new_size = MAX (last_basic_block, new_bb->index + 1);
+ new_size = MAX (last_basic_block_for_fn (cfun), new_bb->index + 1);
new_size = GET_ARRAY_SIZE (new_size);
bbd = XRESIZEVEC (bbro_basic_block_data, bbd, new_size);
for (i = array_size; i < new_size; i++)
@@ -2234,7 +2235,7 @@ reorder_basic_blocks (void)
uncond_jump_length = get_uncond_jump_length ();

/* We need to know some information for each basic block. */
- array_size = GET_ARRAY_SIZE (last_basic_block);
+ array_size = GET_ARRAY_SIZE (last_basic_block_for_fn (cfun));
bbd = XNEWVEC (bbro_basic_block_data, array_size);
for (i = 0; i < array_size; i++)
{
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index bbd0dd8..83b3eba 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -457,8 +457,8 @@ compute_defs_uses_and_gen (fibheap_t all_btr_defs, btr_def *def_array,
btr_def_group all_btr_def_groups = NULL;
defs_uses_info info;

- bitmap_vector_clear (bb_gen, last_basic_block);
- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
+ bitmap_vector_clear (bb_gen, last_basic_block_for_fn (cfun));
+ for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
{
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
int reg;
@@ -618,8 +618,8 @@ compute_kill (sbitmap *bb_kill, sbitmap *btr_defset,

/* For each basic block, form the set BB_KILL - the set
of definitions that the block kills. */
- bitmap_vector_clear (bb_kill, last_basic_block);
- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
+ bitmap_vector_clear (bb_kill, last_basic_block_for_fn (cfun));
+ for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
{
for (regno = first_btr; regno <= last_btr; regno++)
if (TEST_HARD_REG_BIT (all_btrs, regno)
@@ -642,14 +642,14 @@ compute_out (sbitmap *bb_out, sbitmap *bb_gen, sbitmap *bb_kill, int max_uid)
int changed;
sbitmap bb_in = sbitmap_alloc (max_uid);

- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
+ for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
bitmap_copy (bb_out[i], bb_gen[i]);

changed = 1;
while (changed)
{
changed = 0;
- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
+ for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
{
bitmap_union_of_preds (bb_in, bb_out, BASIC_BLOCK_FOR_FN (cfun, i));
changed |= bitmap_ior_and_compl (bb_out[i], bb_gen[i],
@@ -668,7 +668,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,

/* Link uses to the uses lists of all of their reaching defs.
Count up the number of reaching defs of each use. */
- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
+ for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
{
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
rtx insn;
@@ -780,8 +780,10 @@ build_btr_def_use_webs (fibheap_t all_btr_defs)
btr_user *use_array = XCNEWVEC (btr_user, max_uid);
sbitmap *btr_defset = sbitmap_vector_alloc (
(last_btr - first_btr) + 1, max_uid);
- sbitmap *bb_gen = sbitmap_vector_alloc (last_basic_block, max_uid);
- HARD_REG_SET *btrs_written = XCNEWVEC (HARD_REG_SET, last_basic_block);
+ sbitmap *bb_gen = sbitmap_vector_alloc (last_basic_block_for_fn (cfun),
+ max_uid);
+ HARD_REG_SET *btrs_written = XCNEWVEC (HARD_REG_SET,
+ last_basic_block_for_fn (cfun));
sbitmap *bb_kill;
sbitmap *bb_out;

@@ -790,11 +792,11 @@ build_btr_def_use_webs (fibheap_t all_btr_defs)
compute_defs_uses_and_gen (all_btr_defs, def_array, use_array, btr_defset,
bb_gen, btrs_written);

- bb_kill = sbitmap_vector_alloc (last_basic_block, max_uid);
+ bb_kill = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), max_uid);
compute_kill (bb_kill, btr_defset, btrs_written);
free (btrs_written);

- bb_out = sbitmap_vector_alloc (last_basic_block, max_uid);
+ bb_out = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), max_uid);
compute_out (bb_out, bb_gen, bb_kill, max_uid);

sbitmap_vector_free (bb_gen);
@@ -1405,7 +1407,7 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)
{
int i;

- for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
+ for (i = NUM_FIXED_BLOCKS; i < last_basic_block_for_fn (cfun); i++)
{
basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
fprintf (dump_file,
@@ -1428,8 +1430,8 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)
first_btr = reg;
}

- btrs_live = XCNEWVEC (HARD_REG_SET, last_basic_block);
- btrs_live_at_end = XCNEWVEC (HARD_REG_SET, last_basic_block);
+ btrs_live = XCNEWVEC (HARD_REG_SET, last_basic_block_for_fn (cfun));
+ btrs_live_at_end = XCNEWVEC (HARD_REG_SET, last_basic_block_for_fn (cfun));

build_btr_def_use_webs (all_btr_defs);

diff --git a/gcc/cfg.c b/gcc/cfg.c
index 3337372..6c3181d 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -171,10 +171,10 @@ compact_blocks (void)
}
gcc_assert (i == n_basic_blocks_for_fn (cfun));

- for (; i < last_basic_block; i++)
+ for (; i < last_basic_block_for_fn (cfun); i++)
SET_BASIC_BLOCK_FOR_FN (cfun, i, NULL);
}
- last_basic_block = n_basic_blocks_for_fn (cfun);
+ last_basic_block_for_fn (cfun) = n_basic_blocks_for_fn (cfun);
}

/* Remove block B from the basic block array. */
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index ad5928a..9900d82 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -72,15 +72,15 @@ mark_dfs_back_edges (void)
bool found = false;

/* Allocate the preorder and postorder number arrays. */
- pre = XCNEWVEC (int, last_basic_block);
- post = XCNEWVEC (int, last_basic_block);
+ pre = XCNEWVEC (int, last_basic_block_for_fn (cfun));
+ post = XCNEWVEC (int, last_basic_block_for_fn (cfun));

/* Allocate stack for back-tracking up CFG. */
stack = XNEWVEC (edge_iterator, n_basic_blocks_for_fn (cfun) + 1);
sp = 0;

/* Allocate bitmap to track nodes that have been visited. */
- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));

/* None of the nodes in the CFG have been visited yet. */
bitmap_clear (visited);
@@ -428,8 +428,8 @@ control_dependences::control_dependences (struct edge_list *edges)
: m_el (edges)
{
timevar_push (TV_CONTROL_DEPENDENCES);
- control_dependence_map.create (last_basic_block);
- for (int i = 0; i < last_basic_block; ++i)
+ control_dependence_map.create (last_basic_block_for_fn (cfun));
+ for (int i = 0; i < last_basic_block_for_fn (cfun); ++i)
control_dependence_map.quick_push (BITMAP_ALLOC (NULL));
for (int i = 0; i < NUM_EDGES (m_el); ++i)
find_control_dependence (i);
@@ -622,7 +622,7 @@ post_order_compute (int *post_order, bool include_entry_exit,
sp = 0;

/* Allocate bitmap to track nodes that have been visited. */
- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));

/* None of the nodes in the CFG have been visited yet. */
bitmap_clear (visited);
@@ -778,7 +778,7 @@ inverted_post_order_compute (int *post_order)
sp = 0;

/* Allocate bitmap to track nodes that have been visited. */
- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));

/* None of the nodes in the CFG have been visited yet. */
bitmap_clear (visited);
@@ -931,7 +931,7 @@ pre_and_rev_post_order_compute_fn (struct function *fn,
rev_post_order_num -= NUM_FIXED_BLOCKS;

/* Allocate bitmap to track nodes that have been visited. */
- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));

/* None of the nodes in the CFG have been visited yet. */
bitmap_clear (visited);
@@ -1062,7 +1062,7 @@ flow_dfs_compute_reverse_init (depth_first_search_ds data)
data->sp = 0;

/* Allocate bitmap to track nodes that have been visited. */
- data->visited_blocks = sbitmap_alloc (last_basic_block);
+ data->visited_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));

/* None of the nodes in the CFG have been visited yet. */
bitmap_clear (data->visited_blocks);
@@ -1147,7 +1147,7 @@ dfs_enumerate_from (basic_block bb, int reverse,
#define VISITED_P(BB) (bitmap_bit_p (visited, (BB)->index))

/* Resize the VISITED sbitmap if necessary. */
- size = last_basic_block;
+ size = last_basic_block_for_fn (cfun);
if (size < 10)
size = 10;

@@ -1313,7 +1313,8 @@ compute_idf (bitmap def_blocks, bitmap_head *dfs)
form, the basic blocks where new and/or old names are defined
may have disappeared by CFG cleanup calls. In this case,
we may pull a non-existing block from the work stack. */
- gcc_checking_assert (bb_index < (unsigned) last_basic_block);
+ gcc_checking_assert (bb_index
+ < (unsigned) last_basic_block_for_fn (cfun));

EXECUTE_IF_AND_COMPL_IN_BITMAP (&dfs[bb_index], phi_insertion_points,
0, i, bi)
@@ -1508,7 +1509,7 @@ single_pred_before_succ_order (void)
basic_block *order = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
unsigned n = n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS;
unsigned np, i;
- sbitmap visited = sbitmap_alloc (last_basic_block);
+ sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun));

#define MARK_VISITED(BB) (bitmap_set_bit (visited, (BB)->index))
#define VISITED_P(BB) (bitmap_bit_p (visited, (BB)->index))
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index a0c2c66..f73bbc5 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -209,7 +209,7 @@ make_edges (basic_block min, basic_block max, int update_p)
nearly fully-connected CFGs. In that case we spend a significant
amount of time searching the edge lists for duplicates. */
if (forced_labels || cfun->cfg->max_jumptable_ents > 100)
- edge_cache = sbitmap_alloc (last_basic_block);
+ edge_cache = sbitmap_alloc (last_basic_block_for_fn (cfun));

/* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block
is always the entry. */
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index d98ac5b..014f78b 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -501,7 +501,7 @@ add_scope_conflicts (void)
FOR_ALL_BB (bb)
bb->aux = BITMAP_ALLOC (&stack_var_bitmap_obstack);

- rpo = XNEWVEC (int, last_basic_block);
+ rpo = XNEWVEC (int, last_basic_block_for_fn (cfun));
n_bbs = pre_and_rev_post_order_compute (NULL, rpo, false);

changed = true;
@@ -5809,7 +5809,7 @@ gimple_expand_cfg (void)
}
}

- blocks = sbitmap_alloc (last_basic_block);
+ blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_ones (blocks);
find_many_sub_basic_blocks (blocks);
sbitmap_free (blocks);
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index ab1c15f..2400965 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -98,8 +98,8 @@ verify_flow_info (void)
basic_block *last_visited;

timevar_push (TV_CFG_VERIFY);
- last_visited = XCNEWVEC (basic_block, last_basic_block);
- edge_checksum = XCNEWVEC (size_t, last_basic_block);
+ last_visited = XCNEWVEC (basic_block, last_basic_block_for_fn (cfun));
+ edge_checksum = XCNEWVEC (size_t, last_basic_block_for_fn (cfun));

/* Check bb chain & numbers. */
last_bb_seen = ENTRY_BLOCK_PTR_FOR_FN (cfun);
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 6245605..9d28950 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1364,7 +1364,7 @@ verify_loop_structure (void)
}

/* Check the recorded loop father and sizes of loops. */
- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (visited);
bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
@@ -1478,7 +1478,7 @@ verify_loop_structure (void)
if (loops_state_satisfies_p (LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS))
{
/* Record old info. */
- irreds = sbitmap_alloc (last_basic_block);
+ irreds = sbitmap_alloc (last_basic_block_for_fn (cfun));
FOR_EACH_BB (bb)
{
edge_iterator ei;
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index 2260f4b..84b61c1 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -64,7 +64,7 @@ just_once_each_iteration_p (const struct loop *loop, const_basic_block bb)

LOOPS is the loop tree. */

-#define LOOP_REPR(LOOP) ((LOOP)->num + last_basic_block)
+#define LOOP_REPR(LOOP) ((LOOP)->num + last_basic_block_for_fn (cfun))
#define BB_REPR(BB) ((BB)->index + 1)

bool
@@ -94,7 +94,7 @@ mark_irreducible_loops (void)
}

/* Create the edge lists. */
- g = new_graph (last_basic_block + num);
+ g = new_graph (last_basic_block_for_fn (cfun) + num);

FOR_BB_BETWEEN (act, ENTRY_BLOCK_PTR_FOR_FN (cfun),
EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb)
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 7a6b201..2bb8b6a 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -204,7 +204,7 @@ fix_bb_placements (basic_block from,
|| from == base_loop->header)
return;

- in_queue = sbitmap_alloc (last_basic_block);
+ in_queue = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (in_queue);
bitmap_set_bit (in_queue, from->index);
/* Prevent us from going out of the base_loop. */
@@ -348,7 +348,7 @@ remove_path (edge e)

n_bord_bbs = 0;
bord_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
- seen = sbitmap_alloc (last_basic_block);
+ seen = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (seen);

/* Find "border" hexes -- i.e. those with predecessor in removed path. */
@@ -623,7 +623,7 @@ update_dominators_in_loop (struct loop *loop)
basic_block *body;
unsigned i;

- seen = sbitmap_alloc (last_basic_block);
+ seen = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (seen);
body = get_loop_body (loop);

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 34fe4f3..5dc52a6 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -328,7 +328,7 @@ create_basic_block_structure (rtx head, rtx end, rtx bb_note, basic_block after)

BB_HEAD (bb) = head;
BB_END (bb) = end;
- bb->index = last_basic_block++;
+ bb->index = last_basic_block_for_fn (cfun)++;
bb->flags = BB_NEW | BB_RTL;
link_block (bb, after);
SET_BASIC_BLOCK_FOR_FN (cfun, bb->index, bb);
@@ -355,9 +355,12 @@ rtl_create_basic_block (void *headp, void *endp, basic_block after)
basic_block bb;

/* Grow the basic block array if needed. */
- if ((size_t) last_basic_block >= basic_block_info_for_fn (cfun)->length ())
+ if ((size_t) last_basic_block_for_fn (cfun)
+ >= basic_block_info_for_fn (cfun)->length ())
{
- size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
+ size_t new_size =
+ (last_basic_block_for_fn (cfun)
+ + (last_basic_block_for_fn (cfun) + 3) / 4);
vec_safe_grow_cleared (basic_block_info_for_fn (cfun), new_size);
}

@@ -4252,7 +4255,7 @@ break_superblocks (void)
bool need = false;
basic_block bb;

- superblocks = sbitmap_alloc (last_basic_block);
+ superblocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (superblocks);

FOR_EACH_BB (bb)
@@ -4778,7 +4781,7 @@ rtl_flow_call_edges_add (sbitmap blocks)
{
int i;
int blocks_split = 0;
- int last_bb = last_basic_block;
+ int last_bb = last_basic_block_for_fn (cfun);
bool check_last_block = false;

if (n_basic_blocks_for_fn (cfun) == NUM_FIXED_BLOCKS)
diff --git a/gcc/config/epiphany/resolve-sw-modes.c b/gcc/config/epiphany/resolve-sw-modes.c
index b43b4d9..a780254 100644
--- a/gcc/config/epiphany/resolve-sw-modes.c
+++ b/gcc/config/epiphany/resolve-sw-modes.c
@@ -61,8 +61,8 @@ resolve_sw_modes (void)
bool need_commit = false;
bool finalize_fp_sets = (MACHINE_FUNCTION (cfun)->unknown_mode_sets == 0);

- todo.create (last_basic_block);
- pushed = sbitmap_alloc (last_basic_block);
+ todo.create (last_basic_block_for_fn (cfun));
+ pushed = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (pushed);
if (!finalize_fp_sets)
{
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index a5eb2c1..a5aeb75 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -8067,8 +8067,8 @@ frv_optimize_membar (void)
rtx *last_membar;

compute_bb_for_insn ();
- first_io = XCNEWVEC (struct frv_io, last_basic_block);
- last_membar = XCNEWVEC (rtx, last_basic_block);
+ first_io = XCNEWVEC (struct frv_io, last_basic_block_for_fn (cfun));
+ last_membar = XCNEWVEC (rtx, last_basic_block_for_fn (cfun));

FOR_EACH_BB (bb)
frv_optimize_membar_local (bb, &first_io[bb->index],
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 7903443..f19478c 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15071,11 +15071,11 @@ r10k_insert_cache_barriers (void)

/* Bit X of PROTECTED_BBS is set if the last operation in basic block
X is protected by a cache barrier. */
- protected_bbs = sbitmap_alloc (last_basic_block);
+ protected_bbs = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (protected_bbs);

/* Iterate over the basic blocks in reverse post-order. */
- rev_post_order = XNEWVEC (int, last_basic_block);
+ rev_post_order = XNEWVEC (int, last_basic_block_for_fn (cfun));
n = pre_and_rev_post_order_compute (NULL, rev_post_order, false);
for (i = 0; i < n; i++)
{
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index a658ee6..1a9895e 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2469,7 +2469,7 @@ spu_machine_dependent_reorg (void)
return;
}

- blocks = sbitmap_alloc (last_basic_block);
+ blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (blocks);

in_spu_reorg = 1;
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 9b8bd1e..600c617 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -595,8 +595,8 @@ compute_local_properties (sbitmap *kill, sbitmap *comp,
unsigned int i;

/* Initialize the bitmaps that were passed in. */
- bitmap_vector_clear (kill, last_basic_block);
- bitmap_vector_clear (comp, last_basic_block);
+ bitmap_vector_clear (kill, last_basic_block_for_fn (cfun));
+ bitmap_vector_clear (comp, last_basic_block_for_fn (cfun));

for (i = 0; i < table->size; i++)
{
@@ -1355,7 +1355,7 @@ find_implicit_sets (void)
rtx cond, new_rtx;
unsigned int count = 0;
bool edges_split = false;
- size_t implicit_sets_size = last_basic_block + 10;
+ size_t implicit_sets_size = last_basic_block_for_fn (cfun) + 10;

implicit_sets = XCNEWVEC (rtx, implicit_sets_size);

@@ -1667,7 +1667,7 @@ bypass_conditional_jumps (void)
if (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
return 0;

- bypass_last_basic_block = last_basic_block;
+ bypass_last_basic_block = last_basic_block_for_fn (cfun);
mark_dfs_back_edges ();

changed = 0;
@@ -1809,8 +1809,8 @@ one_cprop_pass (void)
df_analyze ();

/* Initialize implicit_set_indexes array. */
- implicit_set_indexes = XNEWVEC (int, last_basic_block);
- for (i = 0; i < last_basic_block; i++)
+ implicit_set_indexes = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ for (i = 0; i < last_basic_block_for_fn (cfun); i++)
implicit_set_indexes[i] = -1;

alloc_hash_table (&set_hash_table);
@@ -1827,7 +1827,8 @@ one_cprop_pass (void)
basic_block bb;
rtx insn;

- alloc_cprop_mem (last_basic_block, set_hash_table.n_elems);
+ alloc_cprop_mem (last_basic_block_for_fn (cfun),
+ set_hash_table.n_elems);
compute_cprop_data ();

free (implicit_set_indexes);
diff --git a/gcc/cse.c b/gcc/cse.c
index 215beb0..74ae8ba 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6522,7 +6522,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
{
struct cse_basic_block_data ebb_data;
basic_block bb;
- int *rc_order = XNEWVEC (int, last_basic_block);
+ int *rc_order = XNEWVEC (int, last_basic_block_for_fn (cfun));
int i, n_blocks;

df_set_flags (DF_LR_RUN_DCE);
@@ -6551,7 +6551,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
reg_eqv_table = XNEWVEC (struct reg_eqv_elem, nregs);

/* Set up the table of already visited basic blocks. */
- cse_visited_basic_blocks = sbitmap_alloc (last_basic_block);
+ cse_visited_basic_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (cse_visited_basic_blocks);

/* Loop over basic blocks in reverse completion order (RPO),
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 87419c2..d41fb72 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -721,8 +721,8 @@ rest_of_handle_df_initialize (void)
if (optimize > 1)
df_live_add_problem ();

- df->postorder = XNEWVEC (int, last_basic_block);
- df->postorder_inverted = XNEWVEC (int, last_basic_block);
+ df->postorder = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ df->postorder_inverted = XNEWVEC (int, last_basic_block_for_fn (cfun));
df->n_blocks = post_order_compute (df->postorder, true, true);
df->n_blocks_inverted = inverted_post_order_compute (df->postorder_inverted);
gcc_assert (df->n_blocks == df->n_blocks_inverted);
@@ -1115,7 +1115,7 @@ df_worklist_dataflow (struct dataflow *dataflow,
int n_blocks)
{
bitmap pending = BITMAP_ALLOC (&df_bitmap_obstack);
- sbitmap considered = sbitmap_alloc (last_basic_block);
+ sbitmap considered = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_iterator bi;
unsigned int *bbindex_to_postorder;
int i;
@@ -1125,11 +1125,12 @@ df_worklist_dataflow (struct dataflow *dataflow,
gcc_assert (dir != DF_NONE);

/* BBINDEX_TO_POSTORDER maps the bb->index to the reverse postorder. */
- bbindex_to_postorder = XNEWVEC (unsigned int, last_basic_block);
+ bbindex_to_postorder = XNEWVEC (unsigned int,
+ last_basic_block_for_fn (cfun));

/* Initialize the array to an out-of-bound value. */
- for (i = 0; i < last_basic_block; i++)
- bbindex_to_postorder[i] = last_basic_block;
+ for (i = 0; i < last_basic_block_for_fn (cfun); i++)
+ bbindex_to_postorder[i] = last_basic_block_for_fn (cfun);

/* Initialize the considered map. */
bitmap_clear (considered);
@@ -1236,8 +1237,8 @@ df_analyze (void)

free (df->postorder);
free (df->postorder_inverted);
- df->postorder = XNEWVEC (int, last_basic_block);
- df->postorder_inverted = XNEWVEC (int, last_basic_block);
+ df->postorder = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ df->postorder_inverted = XNEWVEC (int, last_basic_block_for_fn (cfun));
df->n_blocks = post_order_compute (df->postorder, true, true);
df->n_blocks_inverted = inverted_post_order_compute (df->postorder_inverted);

@@ -1481,7 +1482,7 @@ df_set_bb_dirty (basic_block bb)
void
df_grow_bb_info (struct dataflow *dflow)
{
- unsigned int new_size = last_basic_block + 1;
+ unsigned int new_size = last_basic_block_for_fn (cfun) + 1;
if (dflow->block_info_size < new_size)
{
new_size += new_size / 4;
@@ -1553,7 +1554,8 @@ df_compact_blocks (void)
/* Now shuffle the block info for the problem. */
if (dflow->problem->free_bb_fun)
{
- int size = last_basic_block * dflow->problem->block_info_elt_size;
+ int size = (last_basic_block_for_fn (cfun)
+ * dflow->problem->block_info_elt_size);
problem_temps = XNEWVAR (char, size);
df_grow_bb_info (dflow);
memcpy (problem_temps, dflow->block_info, size);
@@ -1571,7 +1573,7 @@ df_compact_blocks (void)
}
memset ((char *)dflow->block_info
+ i * dflow->problem->block_info_elt_size, 0,
- (last_basic_block - i)
+ (last_basic_block_for_fn (cfun) - i)
* dflow->problem->block_info_elt_size);
free (problem_temps);
}
@@ -1608,7 +1610,7 @@ df_compact_blocks (void)

gcc_assert (i == n_basic_blocks_for_fn (cfun));

- for (; i < last_basic_block; i++)
+ for (; i < last_basic_block_for_fn (cfun); i++)
SET_BASIC_BLOCK_FOR_FN (cfun, i, NULL);

#ifdef DF_DEBUG_CFG
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 2b42b48..ab19372 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -1173,8 +1173,8 @@ df_lr_verify_solution_start (void)
df_lr->solutions_dirty = true;

problem_data = (struct df_lr_problem_data *)df_lr->problem_data;
- problem_data->in = XNEWVEC (bitmap_head, last_basic_block);
- problem_data->out = XNEWVEC (bitmap_head, last_basic_block);
+ problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
+ problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));

FOR_ALL_BB (bb)
{
@@ -1710,8 +1710,8 @@ df_live_verify_solution_start (void)
df_live->solutions_dirty = true;

problem_data = (struct df_live_problem_data *)df_live->problem_data;
- problem_data->in = XNEWVEC (bitmap_head, last_basic_block);
- problem_data->out = XNEWVEC (bitmap_head, last_basic_block);
+ problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
+ problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));

FOR_ALL_BB (bb)
{
@@ -4315,7 +4315,7 @@ df_md_local_compute (bitmap all_blocks)

bitmap_clear (&seen_in_insn);

- frontiers = XNEWVEC (bitmap_head, last_basic_block);
+ frontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
FOR_ALL_BB (bb)
bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);

diff --git a/gcc/dominance.c b/gcc/dominance.c
index e9d2265..af73078 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -159,7 +159,8 @@ init_dom_info (struct dom_info *di, enum cdi_direction dir)
init_ar (di->set_size, unsigned int, num, 1);
init_ar (di->set_child, TBB, num, 0);

- init_ar (di->dfs_order, TBB, (unsigned int) last_basic_block + 1, 0);
+ init_ar (di->dfs_order, TBB,
+ (unsigned int) last_basic_block_for_fn (cfun) + 1, 0);
init_ar (di->dfs_to_bb, basic_block, num, 0);

di->dfsnum = 1;
@@ -296,7 +297,7 @@ calc_dfs_tree_nonrec (struct dom_info *di, basic_block bb, bool reverse)
if (bb != en_block)
my_i = di->dfs_order[bb->index];
else
- my_i = di->dfs_order[last_basic_block];
+ my_i = di->dfs_order[last_basic_block_for_fn (cfun)];
child_i = di->dfs_order[bn->index] = di->dfsnum++;
di->dfs_to_bb[child_i] = bn;
di->dfs_parent[child_i] = my_i;
@@ -335,7 +336,7 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
/* The first block is the ENTRY_BLOCK (or EXIT_BLOCK if REVERSE). */
basic_block begin = (reverse
? EXIT_BLOCK_PTR_FOR_FN (cfun) : ENTRY_BLOCK_PTR_FOR_FN (cfun));
- di->dfs_order[last_basic_block] = di->dfsnum;
+ di->dfs_order[last_basic_block_for_fn (cfun)] = di->dfsnum;
di->dfs_to_bb[di->dfsnum] = begin;
di->dfsnum++;

@@ -367,7 +368,8 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
bitmap_set_bit (di->fake_exit_edge, b->index);
di->dfs_order[b->index] = di->dfsnum;
di->dfs_to_bb[di->dfsnum] = b;
- di->dfs_parent[di->dfsnum] = di->dfs_order[last_basic_block];
+ di->dfs_parent[di->dfsnum] =
+ di->dfs_order[last_basic_block_for_fn (cfun)];
di->dfsnum++;
calc_dfs_tree_nonrec (di, b, reverse);
}
@@ -384,7 +386,8 @@ calc_dfs_tree (struct dom_info *di, bool reverse)
bitmap_set_bit (di->fake_exit_edge, b2->index);
di->dfs_order[b2->index] = di->dfsnum;
di->dfs_to_bb[di->dfsnum] = b2;
- di->dfs_parent[di->dfsnum] = di->dfs_order[last_basic_block];
+ di->dfs_parent[di->dfsnum] =
+ di->dfs_order[last_basic_block_for_fn (cfun)];
di->dfsnum++;
calc_dfs_tree_nonrec (di, b2, reverse);
gcc_checking_assert (di->dfs_order[b->index]);
@@ -546,7 +549,7 @@ calc_idoms (struct dom_info *di, bool reverse)
if (b == en_block)
{
do_fake_exit_edge:
- k1 = di->dfs_order[last_basic_block];
+ k1 = di->dfs_order[last_basic_block_for_fn (cfun)];
}
else
k1 = di->dfs_order[b->index];
diff --git a/gcc/domwalk.c b/gcc/domwalk.c
index 3350e4b..e84c8f7 100644
--- a/gcc/domwalk.c
+++ b/gcc/domwalk.c
@@ -159,7 +159,7 @@ dom_walker::walk (basic_block bb)
{
postorder = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
postorder_num = inverted_post_order_compute (postorder);
- bb_postorder = XNEWVEC (int, last_basic_block);
+ bb_postorder = XNEWVEC (int, last_basic_block_for_fn (cfun));
for (int i = 0; i < postorder_num; ++i)
bb_postorder[postorder[i]] = i;
free (postorder);
diff --git a/gcc/dse.c b/gcc/dse.c
index 2d8ce1e..a926cb8 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -772,7 +772,7 @@ dse_step0 (void)

rtx_group_table.create (11);

- bb_table = XNEWVEC (bb_info_t, last_basic_block);
+ bb_table = XNEWVEC (bb_info_t, last_basic_block_for_fn (cfun));
rtx_group_next_id = 0;

stores_off_frame_dead_at_return = !cfun->stdarg;
@@ -3283,7 +3283,7 @@ static void
dse_step3 (bool for_spills)
{
basic_block bb;
- sbitmap unreachable_blocks = sbitmap_alloc (last_basic_block);
+ sbitmap unreachable_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
sbitmap_iterator sbi;
bitmap all_ones = NULL;
unsigned int i;
diff --git a/gcc/function.c b/gcc/function.c
index 2c8d781..d257af4 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6498,7 +6498,7 @@ epilogue_done:
commit_edge_insertions ();

/* Look for basic blocks within the prologue insns. */
- blocks = sbitmap_alloc (last_basic_block);
+ blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (blocks);
bitmap_set_bit (blocks, entry_edge->dest->index);
bitmap_set_bit (blocks, orig_entry_edge->dest->index);
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 8928c85..fa25a46 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -633,8 +633,9 @@ alloc_gcse_mem (void)
pre-processor limitation with template types in macro arguments. */
typedef vec<rtx> vec_rtx_heap;
typedef vec<modify_pair> vec_modify_pair_heap;
- modify_mem_list = GCNEWVEC (vec_rtx_heap, last_basic_block);
- canon_modify_mem_list = GCNEWVEC (vec_modify_pair_heap, last_basic_block);
+ modify_mem_list = GCNEWVEC (vec_rtx_heap, last_basic_block_for_fn (cfun));
+ canon_modify_mem_list = GCNEWVEC (vec_modify_pair_heap,
+ last_basic_block_for_fn (cfun));
modify_mem_list_set = BITMAP_ALLOC (NULL);
blocks_with_calls = BITMAP_ALLOC (NULL);
}
@@ -685,13 +686,13 @@ compute_local_properties (sbitmap *transp, sbitmap *comp, sbitmap *antloc,
/* Initialize any bitmaps that were passed in. */
if (transp)
{
- bitmap_vector_ones (transp, last_basic_block);
+ bitmap_vector_ones (transp, last_basic_block_for_fn (cfun));
}

if (comp)
- bitmap_vector_clear (comp, last_basic_block);
+ bitmap_vector_clear (comp, last_basic_block_for_fn (cfun));
if (antloc)
- bitmap_vector_clear (antloc, last_basic_block);
+ bitmap_vector_clear (antloc, last_basic_block_for_fn (cfun));

for (i = 0; i < table->size; i++)
{
@@ -1972,7 +1973,7 @@ prune_insertions_deletions (int n_elems)

/* Similarly for deletions, but those occur in blocks rather than on
edges. */
- for (i = 0; i < (unsigned) last_basic_block; i++)
+ for (i = 0; i < (unsigned) last_basic_block_for_fn (cfun); i++)
{
EXECUTE_IF_SET_IN_BITMAP (pre_delete_map[i], 0, j, sbi)
deletions[j]++;
@@ -1993,7 +1994,7 @@ prune_insertions_deletions (int n_elems)
for (i = 0; i < (unsigned) n_edges_for_fn (cfun); i++)
bitmap_clear_bit (pre_insert_map[i], j);

- for (i = 0; i < (unsigned) last_basic_block; i++)
+ for (i = 0; i < (unsigned) last_basic_block_for_fn (cfun); i++)
bitmap_clear_bit (pre_delete_map[i], j);
}

@@ -2012,7 +2013,7 @@ compute_pre_data (void)

compute_local_properties (transp, comp, antloc, &expr_hash_table);
prune_expressions (true);
- bitmap_vector_clear (ae_kill, last_basic_block);
+ bitmap_vector_clear (ae_kill, last_basic_block_for_fn (cfun));

/* Compute ae_kill for each basic block using:

@@ -2103,7 +2104,7 @@ static int
pre_expr_reaches_here_p (basic_block occr_bb, struct expr *expr, basic_block bb)
{
int rval;
- char *visited = XCNEWVEC (char, last_basic_block);
+ char *visited = XCNEWVEC (char, last_basic_block_for_fn (cfun));

rval = pre_expr_reaches_here_p_work (occr_bb, expr, bb, visited);

@@ -2687,7 +2688,7 @@ one_pre_gcse_pass (void)
if (expr_hash_table.n_elems > 0)
{
struct edge_list *edge_list;
- alloc_pre_mem (last_basic_block, expr_hash_table.n_elems);
+ alloc_pre_mem (last_basic_block_for_fn (cfun), expr_hash_table.n_elems);
edge_list = compute_pre_data ();
changed |= pre_gcse (edge_list);
free_edge_list (edge_list);
@@ -2816,8 +2817,8 @@ compute_code_hoist_vbeinout (void)
int changed, passes;
basic_block bb;

- bitmap_vector_clear (hoist_vbeout, last_basic_block);
- bitmap_vector_clear (hoist_vbein, last_basic_block);
+ bitmap_vector_clear (hoist_vbeout, last_basic_block_for_fn (cfun));
+ bitmap_vector_clear (hoist_vbein, last_basic_block_for_fn (cfun));

passes = 0;
changed = 1;
@@ -3033,7 +3034,7 @@ should_hoist_expr_to_dom (basic_block expr_bb, struct expr *expr,
if (visited == NULL)
{
visited_allocated_locally = 1;
- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (visited);
}

@@ -3166,7 +3167,7 @@ hoist_code (void)
data to restrict distance an expression can travel. */

to_bb_head = XCNEWVEC (int, get_max_uid ());
- bb_size = XCNEWVEC (int, last_basic_block);
+ bb_size = XCNEWVEC (int, last_basic_block_for_fn (cfun));

FOR_EACH_BB (bb)
{
@@ -3622,7 +3623,8 @@ one_code_hoisting_pass (void)

if (expr_hash_table.n_elems > 0)
{
- alloc_code_hoist_mem (last_basic_block, expr_hash_table.n_elems);
+ alloc_code_hoist_mem (last_basic_block_for_fn (cfun),
+ expr_hash_table.n_elems);
compute_code_hoist_data ();
changed = hoist_code ();
free_code_hoist_mem ();
diff --git a/gcc/graph.c b/gcc/graph.c
index 3f02cab..6c405d8 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -157,7 +157,7 @@ draw_cfg_nodes_no_loops (pretty_printer *pp, struct function *fun)
int i, n;
sbitmap visited;

- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (visited);

n = pre_and_rev_post_order_compute_fn (fun, NULL, rpo, true);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 0eebbab..975db63 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -423,7 +423,7 @@ build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb)
static void
build_scop_bbs (scop_p scop)
{
- sbitmap visited = sbitmap_alloc (last_basic_block);
+ sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
sese region = SCOP_REGION (scop);

bitmap_clear (visited);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 8d47eb9..d5e3309 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -8075,7 +8075,7 @@ unlink_bb_notes (basic_block first, basic_block last)
if (first == last)
return;

- bb_header = XNEWVEC (rtx, last_basic_block);
+ bb_header = XNEWVEC (rtx, last_basic_block_for_fn (cfun));

/* Make a sentinel. */
if (last->next_bb != EXIT_BLOCK_PTR_FOR_FN (cfun))
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index f8fa0ee..d5dfb8d 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1593,7 +1593,7 @@ execute_split_functions (void)
calculate_dominance_info (CDI_DOMINATORS);

/* Compute local info about basic blocks and determine function size/time. */
- bb_info_vec.safe_grow_cleared (last_basic_block + 1);
+ bb_info_vec.safe_grow_cleared (last_basic_block_for_fn (cfun) + 1);
memset (&best_split_point, 0, sizeof (best_split_point));
FOR_EACH_BB (bb)
{
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 09e22d7..f9258ee 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -138,9 +138,10 @@ create_loop_tree_nodes (void)

ira_bb_nodes
= ((struct ira_loop_tree_node *)
- ira_allocate (sizeof (struct ira_loop_tree_node) * last_basic_block));
- last_basic_block_before_change = last_basic_block;
- for (i = 0; i < (unsigned int) last_basic_block; i++)
+ ira_allocate (sizeof (struct ira_loop_tree_node)
+ * last_basic_block_for_fn (cfun)));
+ last_basic_block_before_change = last_basic_block_for_fn (cfun);
+ for (i = 0; i < (unsigned int) last_basic_block_for_fn (cfun); i++)
{
ira_bb_nodes[i].regno_allocno_map = NULL;
memset (ira_bb_nodes[i].reg_pressure, 0,
@@ -2605,8 +2606,10 @@ remove_unnecessary_regions (bool all_p)
mark_all_loops_for_removal ();
else
mark_loops_for_removal ();
- children_vec.create (last_basic_block + number_of_loops (cfun));
- removed_loop_vec.create (last_basic_block + number_of_loops (cfun));
+ children_vec.create (last_basic_block_for_fn (cfun)
+ + number_of_loops (cfun));
+ removed_loop_vec.create (last_basic_block_for_fn (cfun)
+ + number_of_loops (cfun));
remove_uneccesary_loop_nodes_from_loop_tree (ira_loop_tree_root);
children_vec.release ();
if (all_p)
diff --git a/gcc/ira-emit.c b/gcc/ira-emit.c
index 198fa47..d59461b 100644
--- a/gcc/ira-emit.c
+++ b/gcc/ira-emit.c
@@ -1239,15 +1239,17 @@ ira_emit (bool loops_p)
edge e;
ira_allocno_t a;
ira_allocno_iterator ai;
+ size_t sz;

FOR_EACH_ALLOCNO (a, ai)
ALLOCNO_EMIT_DATA (a)->reg = regno_reg_rtx[ALLOCNO_REGNO (a)];
if (! loops_p)
return;
- at_bb_start = (move_t *) ira_allocate (sizeof (move_t) * last_basic_block);
- memset (at_bb_start, 0, sizeof (move_t) * last_basic_block);
- at_bb_end = (move_t *) ira_allocate (sizeof (move_t) * last_basic_block);
- memset (at_bb_end, 0, sizeof (move_t) * last_basic_block);
+ sz = sizeof (move_t) * last_basic_block_for_fn (cfun);
+ at_bb_start = (move_t *) ira_allocate (sz);
+ memset (at_bb_start, 0, sz);
+ at_bb_end = (move_t *) ira_allocate (sz);
+ memset (at_bb_end, 0, sz);
local_allocno_bitmap = ira_allocate_bitmap ();
used_regno_bitmap = ira_allocate_bitmap ();
renamed_regno_bitmap = ira_allocate_bitmap ();
diff --git a/gcc/ira.c b/gcc/ira.c
index b3477ae..ae35035 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4507,12 +4507,15 @@ find_moveable_pseudos (void)
int *uid_luid = XNEWVEC (int, max_uid);
rtx *closest_uses = XNEWVEC (rtx, max_regs);
/* A set of registers which are live but not modified throughout a block. */
- bitmap_head *bb_transp_live = XNEWVEC (bitmap_head, last_basic_block);
+ bitmap_head *bb_transp_live = XNEWVEC (bitmap_head,
+ last_basic_block_for_fn (cfun));
/* A set of registers which only exist in a given basic block. */
- bitmap_head *bb_local = XNEWVEC (bitmap_head, last_basic_block);
+ bitmap_head *bb_local = XNEWVEC (bitmap_head,
+ last_basic_block_for_fn (cfun));
/* A set of registers which are set once, in an instruction that can be
moved freely downwards, but are otherwise transparent to a block. */
- bitmap_head *bb_moveable_reg_sets = XNEWVEC (bitmap_head, last_basic_block);
+ bitmap_head *bb_moveable_reg_sets = XNEWVEC (bitmap_head,
+ last_basic_block_for_fn (cfun));
bitmap_head live, used, set, interesting, unusable_as_input;
bitmap_iterator bi;
bitmap_initialize (&interesting, 0);
@@ -5187,7 +5190,8 @@ ira (FILE *f)
pseudos and 10K blocks or 100K pseudos and 1K blocks), we will
use simplified and faster algorithms in LRA. */
lra_simple_p
- = (ira_use_lra_p && max_reg_num () >= (1 << 26) / last_basic_block);
+ = (ira_use_lra_p
+ && max_reg_num () >= (1 << 26) / last_basic_block_for_fn (cfun));
if (lra_simple_p)
{
/* It permits to skip live range splitting in LRA. */
diff --git a/gcc/lcm.c b/gcc/lcm.c
index aa63c72..1129d6c 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -105,7 +105,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin,

/* We want a maximal solution, so make an optimistic initialization of
ANTIN. */
- bitmap_vector_ones (antin, last_basic_block);
+ bitmap_vector_ones (antin, last_basic_block_for_fn (cfun));

/* Put every block on the worklist; this is necessary because of the
optimistic initialization of ANTIN above. */
@@ -330,10 +330,10 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest,
/* Computation of insertion and deletion points requires computing LATERIN
for the EXIT block. We allocated an extra entry in the LATERIN array
for just this purpose. */
- bitmap_ones (laterin[last_basic_block]);
+ bitmap_ones (laterin[last_basic_block_for_fn (cfun)]);
FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
- bitmap_and (laterin[last_basic_block],
- laterin[last_basic_block],
+ bitmap_and (laterin[last_basic_block_for_fn (cfun)],
+ laterin[last_basic_block_for_fn (cfun)],
later[(size_t) e->aux]);

clear_aux_for_edges ();
@@ -359,7 +359,8 @@ compute_insert_delete (struct edge_list *edge_list, sbitmap *antloc,
basic_block b = INDEX_EDGE_SUCC_BB (edge_list, x);

if (b == EXIT_BLOCK_PTR_FOR_FN (cfun))
- bitmap_and_compl (insert[x], later[x], laterin[last_basic_block]);
+ bitmap_and_compl (insert[x], later[x],
+ laterin[last_basic_block_for_fn (cfun)]);
else
bitmap_and_compl (insert[x], later[x], laterin[b->index]);
}
@@ -389,29 +390,35 @@ pre_edge_lcm (int n_exprs, sbitmap *transp,
fprintf (dump_file, "Edge List:\n");
verify_edge_list (dump_file, edge_list);
print_edge_list (dump_file, edge_list);
- dump_bitmap_vector (dump_file, "transp", "", transp, last_basic_block);
- dump_bitmap_vector (dump_file, "antloc", "", antloc, last_basic_block);
- dump_bitmap_vector (dump_file, "avloc", "", avloc, last_basic_block);
- dump_bitmap_vector (dump_file, "kill", "", kill, last_basic_block);
+ dump_bitmap_vector (dump_file, "transp", "", transp,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "antloc", "", antloc,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "avloc", "", avloc,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "kill", "", kill,
+ last_basic_block_for_fn (cfun));
}
#endif

/* Compute global availability. */
- avin = sbitmap_vector_alloc (last_basic_block, n_exprs);
- avout = sbitmap_vector_alloc (last_basic_block, n_exprs);
+ avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
+ avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
compute_available (avloc, kill, avout, avin);
sbitmap_vector_free (avin);

/* Compute global anticipatability. */
- antin = sbitmap_vector_alloc (last_basic_block, n_exprs);
- antout = sbitmap_vector_alloc (last_basic_block, n_exprs);
+ antin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
+ antout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
compute_antinout_edge (antloc, transp, antin, antout);

#ifdef LCM_DEBUG_INFO
if (dump_file)
{
- dump_bitmap_vector (dump_file, "antin", "", antin, last_basic_block);
- dump_bitmap_vector (dump_file, "antout", "", antout, last_basic_block);
+ dump_bitmap_vector (dump_file, "antin", "", antin,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "antout", "", antout,
+ last_basic_block_for_fn (cfun));
}
#endif

@@ -431,13 +438,15 @@ pre_edge_lcm (int n_exprs, sbitmap *transp,
later = sbitmap_vector_alloc (num_edges, n_exprs);

/* Allocate an extra element for the exit block in the laterin vector. */
- laterin = sbitmap_vector_alloc (last_basic_block + 1, n_exprs);
+ laterin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun) + 1,
+ n_exprs);
compute_laterin (edge_list, earliest, antloc, later, laterin);

#ifdef LCM_DEBUG_INFO
if (dump_file)
{
- dump_bitmap_vector (dump_file, "laterin", "", laterin, last_basic_block + 1);
+ dump_bitmap_vector (dump_file, "laterin", "", laterin,
+ last_basic_block_for_fn (cfun) + 1);
dump_bitmap_vector (dump_file, "later", "", later, num_edges);
}
#endif
@@ -445,9 +454,9 @@ pre_edge_lcm (int n_exprs, sbitmap *transp,
sbitmap_vector_free (earliest);

*insert = sbitmap_vector_alloc (num_edges, n_exprs);
- *del = sbitmap_vector_alloc (last_basic_block, n_exprs);
+ *del = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
bitmap_vector_clear (*insert, num_edges);
- bitmap_vector_clear (*del, last_basic_block);
+ bitmap_vector_clear (*del, last_basic_block_for_fn (cfun));
compute_insert_delete (edge_list, antloc, later, laterin, *insert, *del);

sbitmap_vector_free (laterin);
@@ -458,7 +467,7 @@ pre_edge_lcm (int n_exprs, sbitmap *transp,
{
dump_bitmap_vector (dump_file, "pre_insert_map", "", *insert, num_edges);
dump_bitmap_vector (dump_file, "pre_delete_map", "", *del,
- last_basic_block);
+ last_basic_block_for_fn (cfun));
}
#endif

@@ -484,7 +493,7 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout,
XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS);

/* We want a maximal solution. */
- bitmap_vector_ones (avout, last_basic_block);
+ bitmap_vector_ones (avout, last_basic_block_for_fn (cfun));

/* Put every block on the worklist; this is necessary because of the
optimistic initialization of AVOUT above. */
@@ -666,10 +675,10 @@ compute_nearerout (struct edge_list *edge_list, sbitmap *farthest,
/* Computation of insertion and deletion points requires computing NEAREROUT
for the ENTRY block. We allocated an extra entry in the NEAREROUT array
for just this purpose. */
- bitmap_ones (nearerout[last_basic_block]);
+ bitmap_ones (nearerout[last_basic_block_for_fn (cfun)]);
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
- bitmap_and (nearerout[last_basic_block],
- nearerout[last_basic_block],
+ bitmap_and (nearerout[last_basic_block_for_fn (cfun)],
+ nearerout[last_basic_block_for_fn (cfun)],
nearer[(size_t) e->aux]);

clear_aux_for_edges ();
@@ -694,7 +703,8 @@ compute_rev_insert_delete (struct edge_list *edge_list, sbitmap *st_avloc,
{
basic_block b = INDEX_EDGE_PRED_BB (edge_list, x);
if (b == ENTRY_BLOCK_PTR_FOR_FN (cfun))
- bitmap_and_compl (insert[x], nearer[x], nearerout[last_basic_block]);
+ bitmap_and_compl (insert[x], nearer[x],
+ nearerout[last_basic_block_for_fn (cfun)]);
else
bitmap_and_compl (insert[x], nearer[x], nearerout[b->index]);
}
@@ -719,15 +729,15 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp,
edge_list = create_edge_list ();
num_edges = NUM_EDGES (edge_list);

- st_antin = sbitmap_vector_alloc (last_basic_block, n_exprs);
- st_antout = sbitmap_vector_alloc (last_basic_block, n_exprs);
- bitmap_vector_clear (st_antin, last_basic_block);
- bitmap_vector_clear (st_antout, last_basic_block);
+ st_antin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
+ st_antout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
+ bitmap_vector_clear (st_antin, last_basic_block_for_fn (cfun));
+ bitmap_vector_clear (st_antout, last_basic_block_for_fn (cfun));
compute_antinout_edge (st_antloc, transp, st_antin, st_antout);

/* Compute global anticipatability. */
- st_avout = sbitmap_vector_alloc (last_basic_block, n_exprs);
- st_avin = sbitmap_vector_alloc (last_basic_block, n_exprs);
+ st_avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
+ st_avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
compute_available (st_avloc, kill, st_avout, st_avin);

#ifdef LCM_DEBUG_INFO
@@ -736,20 +746,26 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp,
fprintf (dump_file, "Edge List:\n");
verify_edge_list (dump_file, edge_list);
print_edge_list (dump_file, edge_list);
- dump_bitmap_vector (dump_file, "transp", "", transp, last_basic_block);
- dump_bitmap_vector (dump_file, "st_avloc", "", st_avloc, last_basic_block);
- dump_bitmap_vector (dump_file, "st_antloc", "", st_antloc, last_basic_block);
- dump_bitmap_vector (dump_file, "st_antin", "", st_antin, last_basic_block);
- dump_bitmap_vector (dump_file, "st_antout", "", st_antout, last_basic_block);
- dump_bitmap_vector (dump_file, "st_kill", "", kill, last_basic_block);
+ dump_bitmap_vector (dump_file, "transp", "", transp,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_avloc", "", st_avloc,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_antloc", "", st_antloc,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_antin", "", st_antin,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_antout", "", st_antout,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_kill", "", kill,
+ last_basic_block_for_fn (cfun));
}
#endif

#ifdef LCM_DEBUG_INFO
if (dump_file)
{
- dump_bitmap_vector (dump_file, "st_avout", "", st_avout, last_basic_block);
- dump_bitmap_vector (dump_file, "st_avin", "", st_avin, last_basic_block);
+ dump_bitmap_vector (dump_file, "st_avout", "", st_avout, last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_avin", "", st_avin, last_basic_block_for_fn (cfun));
}
#endif

@@ -772,14 +788,15 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp,
nearer = sbitmap_vector_alloc (num_edges, n_exprs);

/* Allocate an extra element for the entry block. */
- nearerout = sbitmap_vector_alloc (last_basic_block + 1, n_exprs);
+ nearerout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun) + 1,
+ n_exprs);
compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout);

#ifdef LCM_DEBUG_INFO
if (dump_file)
{
dump_bitmap_vector (dump_file, "nearerout", "", nearerout,
- last_basic_block + 1);
+ last_basic_block_for_fn (cfun) + 1);
dump_bitmap_vector (dump_file, "nearer", "", nearer, num_edges);
}
#endif
@@ -787,7 +804,7 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp,
sbitmap_vector_free (farthest);

*insert = sbitmap_vector_alloc (num_edges, n_exprs);
- *del = sbitmap_vector_alloc (last_basic_block, n_exprs);
+ *del = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs);
compute_rev_insert_delete (edge_list, st_avloc, nearer, nearerout,
*insert, *del);

@@ -799,7 +816,7 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp,
{
dump_bitmap_vector (dump_file, "pre_insert_map", "", *insert, num_edges);
dump_bitmap_vector (dump_file, "pre_delete_map", "", *del,
- last_basic_block);
+ last_basic_block_for_fn (cfun));
}
#endif
return edge_list;
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index d1c7b9c..24ed83f 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -2007,7 +2007,7 @@ static void
opt_info_start_duplication (struct opt_info *opt_info)
{
if (opt_info)
- opt_info->first_new_block = last_basic_block;
+ opt_info->first_new_block = last_basic_block_for_fn (cfun);
}

/* Determine the number of iterations between initialization of the base
@@ -2368,7 +2368,9 @@ apply_opt_in_copies (struct opt_info *opt_info,
for (ivts = opt_info->iv_to_split_head; ivts; ivts = ivts->next)
allocate_basic_variable (ivts);

- for (i = opt_info->first_new_block; i < (unsigned) last_basic_block; i++)
+ for (i = opt_info->first_new_block;
+ i < (unsigned) last_basic_block_for_fn (cfun);
+ i++)
{
bb = BASIC_BLOCK_FOR_FN (cfun, i);
orig_bb = get_bb_original (bb);
@@ -2444,7 +2446,9 @@ apply_opt_in_copies (struct opt_info *opt_info,
/* Rewrite also the original loop body. Find them as originals of the blocks
in the last copied iteration, i.e. those that have
get_bb_copy (get_bb_original (bb)) == bb. */
- for (i = opt_info->first_new_block; i < (unsigned) last_basic_block; i++)
+ for (i = opt_info->first_new_block;
+ i < (unsigned) last_basic_block_for_fn (cfun);
+ i++)
{
bb = BASIC_BLOCK_FOR_FN (cfun, i);
orig_bb = get_bb_original (bb);
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 6c9d622..60c47b9 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1537,7 +1537,7 @@ decompose_multiword_subregs (bool decompose_copies)

propagate_pseudo_copies ();

- sub_blocks = sbitmap_alloc (last_basic_block);
+ sub_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (sub_blocks);

EXECUTE_IF_SET_IN_BITMAP (decomposable_context, 0, regno, iter)
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index d2082fe..a677f86 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -996,7 +996,7 @@ lra_create_live_ranges (bool all_p)
curr_point = 0;
point_freq_vec.create (get_max_uid () * 2);
lra_point_freq = point_freq_vec.address ();
- int *post_order_rev_cfg = XNEWVEC (int, last_basic_block);
+ int *post_order_rev_cfg = XNEWVEC (int, last_basic_block_for_fn (cfun));
int n_blocks_inverted = inverted_post_order_compute (post_order_rev_cfg);
lra_assert (n_blocks_inverted == n_basic_blocks_for_fn (cfun));
for (i = n_blocks_inverted - 1; i >= 0; --i)
diff --git a/gcc/lra.c b/gcc/lra.c
index d21d864..50a0786 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2422,7 +2422,7 @@ lra (FILE *f)
if (cfun->can_throw_non_call_exceptions)
{
sbitmap blocks;
- blocks = sbitmap_alloc (last_basic_block);
+ blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_ones (blocks);
find_many_sub_basic_blocks (blocks);
sbitmap_free (blocks);
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index ed45094..a9e5069 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -480,7 +480,8 @@ optimize_mode_switching (void)
entry_exit_extra = 3;
#endif
bb_info[n_entities]
- = XCNEWVEC (struct bb_info, last_basic_block + entry_exit_extra);
+ = XCNEWVEC (struct bb_info,
+ last_basic_block_for_fn (cfun) + entry_exit_extra);
entity_map[n_entities++] = e;
if (num_modes[e] > max_num_modes)
max_num_modes = num_modes[e];
@@ -500,11 +501,11 @@ optimize_mode_switching (void)

/* Create the bitmap vectors. */

- antic = sbitmap_vector_alloc (last_basic_block, n_entities);
- transp = sbitmap_vector_alloc (last_basic_block, n_entities);
- comp = sbitmap_vector_alloc (last_basic_block, n_entities);
+ antic = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities);
+ transp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities);
+ comp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities);

- bitmap_vector_ones (transp, last_basic_block);
+ bitmap_vector_ones (transp, last_basic_block_for_fn (cfun));

for (j = n_entities - 1; j >= 0; j--)
{
@@ -608,7 +609,7 @@ optimize_mode_switching (void)
#endif /* NORMAL_MODE */
}

- kill = sbitmap_vector_alloc (last_basic_block, n_entities);
+ kill = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_entities);
for (i = 0; i < max_num_modes; i++)
{
int current_mode[N_ENTITIES];
@@ -616,8 +617,8 @@ optimize_mode_switching (void)
sbitmap *insert;

/* Set the anticipatable and computing arrays. */
- bitmap_vector_clear (antic, last_basic_block);
- bitmap_vector_clear (comp, last_basic_block);
+ bitmap_vector_clear (antic, last_basic_block_for_fn (cfun));
+ bitmap_vector_clear (comp, last_basic_block_for_fn (cfun));
for (j = n_entities - 1; j >= 0; j--)
{
int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
diff --git a/gcc/recog.c b/gcc/recog.c
index 7f59756..c59aa0e 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -2898,7 +2898,7 @@ split_all_insns (void)
bool changed;
basic_block bb;

- blocks = sbitmap_alloc (last_basic_block);
+ blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (blocks);
changed = false;

diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 9b52a63..0438875 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1066,9 +1066,9 @@ copyprop_hardreg_forward (void)
sbitmap visited;
bool analyze_called = false;

- all_vd = XNEWVEC (struct value_data, last_basic_block);
+ all_vd = XNEWVEC (struct value_data, last_basic_block_for_fn (cfun));

- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (visited);

if (MAY_HAVE_DEBUG_INSNS)
diff --git a/gcc/regrename.c b/gcc/regrename.c
index ac8b0f3..3c242fb 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -668,7 +668,7 @@ regrename_analyze (bitmap bb_mask)
int n_bbs;
int *inverse_postorder;

- inverse_postorder = XNEWVEC (int, last_basic_block);
+ inverse_postorder = XNEWVEC (int, last_basic_block_for_fn (cfun));
n_bbs = pre_and_rev_post_order_compute (NULL, inverse_postorder, false);

/* Gather some information about the blocks in this function. */
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 6864ec1..15c6db5 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -1283,7 +1283,7 @@ reload (rtx first, int global)
if (cfun->can_throw_non_call_exceptions)
{
sbitmap blocks;
- blocks = sbitmap_alloc (last_basic_block);
+ blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_ones (blocks);
find_many_sub_basic_blocks (blocks);
sbitmap_free (blocks);
diff --git a/gcc/resource.c b/gcc/resource.c
index 3106a09..861d969 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1216,7 +1216,7 @@ init_resource_info (rtx epilogue_insn)

/* Allocate and initialize the tables used by mark_target_live_regs. */
target_hash_table = XCNEWVEC (struct target_info *, TARGET_HASH_PRIME);
- bb_ticks = XCNEWVEC (int, last_basic_block);
+ bb_ticks = XCNEWVEC (int, last_basic_block_for_fn (cfun));

/* Set the BLOCK_FOR_INSN of each label that starts a basic block. */
FOR_EACH_BB (bb)
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 2d8b939..a85ee5b 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -642,23 +642,23 @@ haifa_find_rgns (void)
STACK, SP and DFS_NR are only used during the first traversal. */

/* Allocate and initialize variables for the first traversal. */
- max_hdr = XNEWVEC (int, last_basic_block);
- dfs_nr = XCNEWVEC (int, last_basic_block);
+ max_hdr = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ dfs_nr = XCNEWVEC (int, last_basic_block_for_fn (cfun));
stack = XNEWVEC (edge_iterator, n_edges_for_fn (cfun));

- inner = sbitmap_alloc (last_basic_block);
+ inner = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_ones (inner);

- header = sbitmap_alloc (last_basic_block);
+ header = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (header);

- in_queue = sbitmap_alloc (last_basic_block);
+ in_queue = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (in_queue);

- in_stack = sbitmap_alloc (last_basic_block);
+ in_stack = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (in_stack);

- for (i = 0; i < last_basic_block; i++)
+ for (i = 0; i < last_basic_block_for_fn (cfun); i++)
max_hdr[i] = -1;

#define EDGE_PASSED(E) (ei_end_p ((E)) || ei_edge ((E))->aux)
@@ -799,8 +799,9 @@ haifa_find_rgns (void)
extend_regions_p = PARAM_VALUE (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS) > 0;
if (extend_regions_p)
{
- degree1 = XNEWVEC (int, last_basic_block);
- extended_rgn_header = sbitmap_alloc (last_basic_block);
+ degree1 = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ extended_rgn_header =
+ sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (extended_rgn_header);
}

@@ -854,7 +855,8 @@ haifa_find_rgns (void)
/* We save degree in case when we meet a too_large region
and cancel it. We need a correct degree later when
calling extend_rgns. */
- memcpy (degree1, degree, last_basic_block * sizeof (int));
+ memcpy (degree1, degree,
+ last_basic_block_for_fn (cfun) * sizeof (int));

/* Decrease degree of all I's successors for topological
ordering. */
@@ -1161,9 +1163,9 @@ extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)

max_iter = PARAM_VALUE (PARAM_MAX_SCHED_EXTEND_REGIONS_ITERS);

- max_hdr = XNEWVEC (int, last_basic_block);
+ max_hdr = XNEWVEC (int, last_basic_block_for_fn (cfun));

- order = XNEWVEC (int, last_basic_block);
+ order = XNEWVEC (int, last_basic_block_for_fn (cfun));
post_order_compute (order, false, false);

for (i = nblocks - 1; i >= 0; i--)
@@ -1514,7 +1516,7 @@ compute_trg_info (int trg)
sp->is_speculative = 0;
sp->src_prob = REG_BR_PROB_BASE;

- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));

for (i = trg + 1; i < current_nr_blocks; i++)
{
@@ -2936,11 +2938,11 @@ static void
realloc_bb_state_array (int saved_last_basic_block)
{
char *old_bb_state_array = bb_state_array;
- size_t lbb = (size_t) last_basic_block;
+ size_t lbb = (size_t) last_basic_block_for_fn (cfun);
size_t slbb = (size_t) saved_last_basic_block;

/* Nothing to do if nothing changed since the last time this was called. */
- if (saved_last_basic_block == last_basic_block)
+ if (saved_last_basic_block == last_basic_block_for_fn (cfun))
return;

/* The selective scheduler doesn't use the state arrays. */
@@ -3060,7 +3062,7 @@ schedule_region (int rgn)
if (dbg_cnt (sched_block))
{
edge f;
- int saved_last_basic_block = last_basic_block;
+ int saved_last_basic_block = last_basic_block_for_fn (cfun);

schedule_block (&curr_bb, bb_state[first_bb->index]);
gcc_assert (EBB_FIRST_BB (bb) == first_bb);
@@ -3430,9 +3432,12 @@ void
extend_regions (void)
{
rgn_table = XRESIZEVEC (region, rgn_table, n_basic_blocks_for_fn (cfun));
- rgn_bb_table = XRESIZEVEC (int, rgn_bb_table, n_basic_blocks_for_fn (cfun));
- block_to_bb = XRESIZEVEC (int, block_to_bb, last_basic_block);
- containing_rgn = XRESIZEVEC (int, containing_rgn, last_basic_block);
+ rgn_bb_table = XRESIZEVEC (int, rgn_bb_table,
+ n_basic_blocks_for_fn (cfun));
+ block_to_bb = XRESIZEVEC (int, block_to_bb,
+ last_basic_block_for_fn (cfun));
+ containing_rgn = XRESIZEVEC (int, containing_rgn,
+ last_basic_block_for_fn (cfun));
}

void
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index da84cce..f7cc9ec 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4095,14 +4095,14 @@ get_seqno_by_preds (rtx insn)
void
sel_extend_global_bb_info (void)
{
- sel_global_bb_info.safe_grow_cleared (last_basic_block);
+ sel_global_bb_info.safe_grow_cleared (last_basic_block_for_fn (cfun));
}

/* Extend region-scope data structures for basic blocks. */
static void
extend_region_bb_info (void)
{
- sel_region_bb_info.safe_grow_cleared (last_basic_block);
+ sel_region_bb_info.safe_grow_cleared (last_basic_block_for_fn (cfun));
}

/* Extend all data structures to fit for all basic blocks. */
@@ -4905,9 +4905,10 @@ recompute_rev_top_order (void)
int *postorder;
int n_blocks, i;

- if (!rev_top_order_index || rev_top_order_index_len < last_basic_block)
+ if (!rev_top_order_index
+ || rev_top_order_index_len < last_basic_block_for_fn (cfun))
{
- rev_top_order_index_len = last_basic_block;
+ rev_top_order_index_len = last_basic_block_for_fn (cfun);
rev_top_order_index = XRESIZEVEC (int, rev_top_order_index,
rev_top_order_index_len);
}
@@ -6079,7 +6080,7 @@ sel_init_pipelining (void)
| LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS);
current_loop_nest = NULL;

- bbs_in_loop_rgns = sbitmap_alloc (last_basic_block);
+ bbs_in_loop_rgns = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (bbs_in_loop_rgns);

recompute_rev_top_order ();
@@ -6145,13 +6146,13 @@ make_regions_from_the_rest (void)
/* LOOP_HDR[I] == -1 if I-th bb doesn't belong to any loop,
LOOP_HDR[I] == LOOP_HDR[J] iff basic blocks I and J reside within the same
loop. */
- loop_hdr = XNEWVEC (int, last_basic_block);
- degree = XCNEWVEC (int, last_basic_block);
+ loop_hdr = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ degree = XCNEWVEC (int, last_basic_block_for_fn (cfun));


/* For each basic block that belongs to some loop assign the number
of innermost loop it belongs to. */
- for (i = 0; i < last_basic_block; i++)
+ for (i = 0; i < last_basic_block_for_fn (cfun); i++)
loop_hdr[i] = -1;

FOR_EACH_BB (bb)
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index 378d6c7..808b0a7 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -844,7 +844,7 @@ remove_reachable_equiv_notes (basic_block bb, struct st_expr *smexpr)
edge_iterator *stack, ei;
int sp;
edge act;
- sbitmap visited = sbitmap_alloc (last_basic_block);
+ sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
rtx last, insn, note;
rtx mem = smexpr->pattern;

@@ -1016,11 +1016,13 @@ build_store_vectors (void)

/* Build the gen_vector. This is any store in the table which is not killed
by aliasing later in its block. */
- st_avloc = sbitmap_vector_alloc (last_basic_block, num_stores);
- bitmap_vector_clear (st_avloc, last_basic_block);
+ st_avloc = sbitmap_vector_alloc (last_basic_block_for_fn (cfun),
+ num_stores);
+ bitmap_vector_clear (st_avloc, last_basic_block_for_fn (cfun));

- st_antloc = sbitmap_vector_alloc (last_basic_block, num_stores);
- bitmap_vector_clear (st_antloc, last_basic_block);
+ st_antloc = sbitmap_vector_alloc (last_basic_block_for_fn (cfun),
+ num_stores);
+ bitmap_vector_clear (st_antloc, last_basic_block_for_fn (cfun));

for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
{
@@ -1052,11 +1054,11 @@ build_store_vectors (void)
}
}

- st_kill = sbitmap_vector_alloc (last_basic_block, num_stores);
- bitmap_vector_clear (st_kill, last_basic_block);
+ st_kill = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), num_stores);
+ bitmap_vector_clear (st_kill, last_basic_block_for_fn (cfun));

- st_transp = sbitmap_vector_alloc (last_basic_block, num_stores);
- bitmap_vector_clear (st_transp, last_basic_block);
+ st_transp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), num_stores);
+ bitmap_vector_clear (st_transp, last_basic_block_for_fn (cfun));
regs_set_in_block = XNEWVEC (int, max_gcse_regno);

FOR_EACH_BB (bb)
@@ -1095,10 +1097,14 @@ build_store_vectors (void)

if (dump_file)
{
- dump_bitmap_vector (dump_file, "st_antloc", "", st_antloc, last_basic_block);
- dump_bitmap_vector (dump_file, "st_kill", "", st_kill, last_basic_block);
- dump_bitmap_vector (dump_file, "st_transp", "", st_transp, last_basic_block);
- dump_bitmap_vector (dump_file, "st_avloc", "", st_avloc, last_basic_block);
+ dump_bitmap_vector (dump_file, "st_antloc", "", st_antloc,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_kill", "", st_kill,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_transp", "", st_transp,
+ last_basic_block_for_fn (cfun));
+ dump_bitmap_vector (dump_file, "st_avloc", "", st_avloc,
+ last_basic_block_for_fn (cfun));
}
}

diff --git a/gcc/tracer.c b/gcc/tracer.c
index 99689500..de6877a 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -230,9 +230,9 @@ find_trace (basic_block bb, basic_block *trace)
static bool
tail_duplicate (void)
{
- fibnode_t *blocks = XCNEWVEC (fibnode_t, last_basic_block);
+ fibnode_t *blocks = XCNEWVEC (fibnode_t, last_basic_block_for_fn (cfun));
basic_block *trace = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun));
- int *counts = XNEWVEC (int, last_basic_block);
+ int *counts = XNEWVEC (int, last_basic_block_for_fn (cfun));
int ninsns = 0, nduplicated = 0;
gcov_type weighted_insns = 0, traced_insns = 0;
fibheap_t heap = fibheap_new ();
@@ -243,7 +243,7 @@ tail_duplicate (void)

/* Create an oversized sbitmap to reduce the chance that we need to
resize it. */
- bb_seen = sbitmap_alloc (last_basic_block * 2);
+ bb_seen = sbitmap_alloc (last_basic_block_for_fn (cfun) * 2);
bitmap_clear (bb_seen);
initialize_original_copy_tables ();

diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 39715b8..2a6597d 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -1956,7 +1956,7 @@ tm_region_init (struct tm_region *region)
/* We could store this information in bb->aux, but we may get called
through get_all_tm_blocks() from another pass that may be already
using bb->aux. */
- bb_regions.safe_grow_cleared (last_basic_block);
+ bb_regions.safe_grow_cleared (last_basic_block_for_fn (cfun));

queue.safe_push (bb);
bb_regions[bb->index] = region;
@@ -2628,7 +2628,7 @@ static vec<tm_region_p>
get_bb_regions_instrumented (bool traverse_clones,
bool include_uninstrumented_p)
{
- unsigned n = last_basic_block;
+ unsigned n = last_basic_block_for_fn (cfun);
struct bb2reg_stuff stuff;
vec<tm_region_p> ret;

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 57d6487..ec365b5 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -597,7 +597,7 @@ create_bb (void *h, void *e, basic_block after)
not have to clear the newly allocated basic block here. */
bb = alloc_block ();

- bb->index = last_basic_block;
+ bb->index = last_basic_block_for_fn (cfun);
bb->flags = BB_NEW;
set_bb_seq (bb, h ? (gimple_seq) h : NULL);

@@ -605,17 +605,20 @@ create_bb (void *h, void *e, basic_block after)
link_block (bb, after);

/* Grow the basic block array if needed. */
- if ((size_t) last_basic_block == basic_block_info_for_fn (cfun)->length ())
+ if ((size_t) last_basic_block_for_fn (cfun)
+ == basic_block_info_for_fn (cfun)->length ())
{
- size_t new_size = last_basic_block + (last_basic_block + 3) / 4;
+ size_t new_size =
+ (last_basic_block_for_fn (cfun)
+ + (last_basic_block_for_fn (cfun) + 3) / 4);
vec_safe_grow_cleared (basic_block_info_for_fn (cfun), new_size);
}

/* Add the newly created block to the array. */
- SET_BASIC_BLOCK_FOR_FN (cfun, last_basic_block, bb);
+ SET_BASIC_BLOCK_FOR_FN (cfun, last_basic_block_for_fn (cfun), bb);

n_basic_blocks_for_fn (cfun)++;
- last_basic_block++;
+ last_basic_block_for_fn (cfun)++;

return bb;
}
@@ -1228,7 +1231,7 @@ void
cleanup_dead_labels (void)
{
basic_block bb;
- label_for_bb = XCNEWVEC (struct label_record, last_basic_block);
+ label_for_bb = XCNEWVEC (struct label_record, last_basic_block_for_fn (cfun));

/* Find a suitable label for each block. We use the first user-defined
label if there is one, or otherwise just the first label we see. */
@@ -2116,7 +2119,7 @@ gimple_dump_cfg (FILE *file, int flags)
dump_function_header (file, current_function_decl, flags);
fprintf (file, ";; \n%d basic blocks, %d edges, last basic block %d.\n\n",
n_basic_blocks_for_fn (cfun), n_edges_for_fn (cfun),
- last_basic_block);
+ last_basic_block_for_fn (cfun));

brief_dump_cfg (file, flags | TDF_COMMENT);
fprintf (file, "\n");
@@ -7430,7 +7433,7 @@ gimple_flow_call_edges_add (sbitmap blocks)
{
int i;
int blocks_split = 0;
- int last_bb = last_basic_block;
+ int last_bb = last_basic_block_for_fn (cfun);
bool check_last_block = false;

if (n_basic_blocks_for_fn (cfun) == NUM_FIXED_BLOCKS)
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 76d9749..50b4a68 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -585,7 +585,7 @@ split_bbs_on_noreturn_calls (void)
BB is present in the cfg. */
if (bb == NULL
|| bb->index < NUM_FIXED_BLOCKS
- || bb->index >= last_basic_block
+ || bb->index >= last_basic_block_for_fn (cfun)
|| BASIC_BLOCK_FOR_FN (cfun, bb->index) != bb
|| !gimple_call_noreturn_p (stmt))
continue;
@@ -642,7 +642,7 @@ cleanup_tree_cfg_1 (void)

/* Start by iterating over all basic blocks. We cannot use FOR_EACH_BB,
since the basic blocks may get removed. */
- n = last_basic_block;
+ n = last_basic_block_for_fn (cfun);
for (i = NUM_FIXED_BLOCKS; i < n; i++)
{
bb = BASIC_BLOCK_FOR_FN (cfun, i);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 80a978e..ff5ccab 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1636,7 +1636,7 @@ tree_lower_complex (void)
update_parameter_components ();

/* ??? Ideally we'd traverse the blocks in breadth-first order. */
- old_last_basic_block = last_basic_block;
+ old_last_basic_block = last_basic_block_for_fn (cfun);
FOR_EACH_BB (bb)
{
if (bb->index >= old_last_basic_block)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index fd7eedb..ed06cb9 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2488,7 +2488,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
new_bb->loop_father = entry_block_map->loop_father;
}

- last = last_basic_block;
+ last = last_basic_block_for_fn (cfun);

/* Now that we've duplicated the blocks, duplicate their edges. */
bool can_make_abormal_goto
@@ -2544,7 +2544,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,

/* Zero out AUX fields of newly created block during EH edge
insertion. */
- for (; last < last_basic_block; last++)
+ for (; last < last_basic_block_for_fn (cfun); last++)
{
if (need_debug_cleanup)
maybe_move_debug_stmts_to_successors (id,
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index ac10440..b6d3dd7 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -964,7 +964,7 @@ mark_phi_for_rewrite (basic_block bb, gimple phi)

bitmap_set_bit (blocks_with_phis_to_rewrite, idx);

- n = (unsigned) last_basic_block + 1;
+ n = (unsigned) last_basic_block_for_fn (cfun) + 1;
if (phis_to_rewrite.length () < n)
phis_to_rewrite.safe_grow_cleared (n);

@@ -2315,11 +2315,11 @@ rewrite_into_ssa (void)
/* Initialize the set of interesting blocks. The callback
mark_def_sites will add to this set those blocks that the renamer
should process. */
- interesting_blocks = sbitmap_alloc (last_basic_block);
+ interesting_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (interesting_blocks);

/* Initialize dominance frontier. */
- dfs = XNEWVEC (bitmap_head, last_basic_block);
+ dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
FOR_EACH_BB (bb)
bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);

@@ -2635,7 +2635,7 @@ prepare_def_site_for (tree name, bool insert_phi_p)
bb = gimple_bb (stmt);
if (bb)
{
- gcc_checking_assert (bb->index < last_basic_block);
+ gcc_checking_assert (bb->index < last_basic_block_for_fn (cfun));
mark_block_for_update (bb);
mark_def_interesting (name, stmt, bb, insert_phi_p);
}
@@ -3185,7 +3185,7 @@ update_ssa (unsigned update_flags)

blocks_with_phis_to_rewrite = BITMAP_ALLOC (NULL);
if (!phis_to_rewrite.exists ())
- phis_to_rewrite.create (last_basic_block + 1);
+ phis_to_rewrite.create (last_basic_block_for_fn (cfun) + 1);
blocks_to_update = BITMAP_ALLOC (NULL);

/* Ensure that the dominance information is up-to-date. */
@@ -3269,7 +3269,7 @@ update_ssa (unsigned update_flags)

/* If the caller requested PHI nodes to be added, compute
dominance frontiers. */
- dfs = XNEWVEC (bitmap_head, last_basic_block);
+ dfs = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
FOR_EACH_BB (bb)
bitmap_initialize (&dfs[bb->index], &bitmap_default_obstack);
compute_dominance_frontiers (dfs);
@@ -3317,7 +3317,7 @@ update_ssa (unsigned update_flags)
get_var_info (sym)->info.current_def = NULL_TREE;

/* Now start the renaming process at START_BB. */
- interesting_blocks = sbitmap_alloc (last_basic_block);
+ interesting_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (interesting_blocks);
EXECUTE_IF_SET_IN_BITMAP (blocks_to_update, 0, i, bi)
bitmap_set_bit (interesting_blocks, i);
@@ -3340,9 +3340,10 @@ update_ssa (unsigned update_flags)
c = 0;
EXECUTE_IF_SET_IN_BITMAP (blocks_to_update, 0, i, bi)
c++;
- fprintf (dump_file, "Number of blocks in CFG: %d\n", last_basic_block);
+ fprintf (dump_file, "Number of blocks in CFG: %d\n",
+ last_basic_block_for_fn (cfun));
fprintf (dump_file, "Number of blocks to update: %d (%3.0f%%)\n",
- c, PERCENT (c, last_basic_block));
+ c, PERCENT (c, last_basic_block_for_fn (cfun)));

if (dump_flags & TDF_DETAILS)
{
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 8fc6fce..701dd44 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1364,9 +1364,9 @@ tree_dce_init (bool aggressive)

if (aggressive)
{
- last_stmt_necessary = sbitmap_alloc (last_basic_block);
+ last_stmt_necessary = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (last_stmt_necessary);
- bb_contains_live_stmts = sbitmap_alloc (last_basic_block);
+ bb_contains_live_stmts = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (bb_contains_live_stmts);
}

@@ -1432,7 +1432,8 @@ perform_tree_ssa_dce (bool aggressive)
calculate_dominance_info (CDI_POST_DOMINATORS);
cd = new control_dependences (create_edge_list ());

- visited_control_parents = sbitmap_alloc (last_basic_block);
+ visited_control_parents =
+ sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (visited_control_parents);

mark_dfs_back_edges ();
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index ebdf511..6cf60be 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1793,7 +1793,7 @@ record_edge_info (basic_block bb)
{
int i;
int n_labels = gimple_switch_num_labels (stmt);
- tree *info = XCNEWVEC (tree, last_basic_block);
+ tree *info = XCNEWVEC (tree, last_basic_block_for_fn (cfun));
edge e;
edge_iterator ei;

diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 5d1a3b9..6ccf2fb 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -960,17 +960,17 @@ new_tree_live_info (var_map map)

live = XNEW (struct tree_live_info_d);
live->map = map;
- live->num_blocks = last_basic_block;
+ live->num_blocks = last_basic_block_for_fn (cfun);

- live->livein = XNEWVEC (bitmap_head, last_basic_block);
+ live->livein = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
FOR_EACH_BB (bb)
bitmap_initialize (&live->livein[bb->index], &liveness_bitmap_obstack);

- live->liveout = XNEWVEC (bitmap_head, last_basic_block);
+ live->liveout = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
FOR_EACH_BB (bb)
bitmap_initialize (&live->liveout[bb->index], &liveness_bitmap_obstack);

- live->work_stack = XNEWVEC (int, last_basic_block);
+ live->work_stack = XNEWVEC (int, last_basic_block_for_fn (cfun));
live->stack_top = live->work_stack;

live->global = BITMAP_ALLOC (&liveness_bitmap_obstack);
@@ -1043,7 +1043,7 @@ live_worklist (tree_live_info_p live)
{
unsigned b;
basic_block bb;
- sbitmap visited = sbitmap_alloc (last_basic_block + 1);
+ sbitmap visited = sbitmap_alloc (last_basic_block_for_fn (cfun) + 1);
bitmap tmp = BITMAP_ALLOC (&liveness_bitmap_obstack);

bitmap_clear (visited);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 6292576..3aaf2b2 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -2401,7 +2401,7 @@ fill_always_executed_in_1 (struct loop *loop, sbitmap contains_call)
static void
fill_always_executed_in (void)
{
- sbitmap contains_call = sbitmap_alloc (last_basic_block);
+ sbitmap contains_call = sbitmap_alloc (last_basic_block_for_fn (cfun));
basic_block bb;
struct loop *loop;

diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index de667ad..76d5958 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -728,13 +728,13 @@ copy_phi_node_args (unsigned first_new_block)
{
unsigned i;

- for (i = first_new_block; i < (unsigned) last_basic_block; i++)
+ for (i = first_new_block; i < (unsigned) last_basic_block_for_fn (cfun); i++)
BASIC_BLOCK_FOR_FN (cfun, i)->flags |= BB_DUPLICATED;

- for (i = first_new_block; i < (unsigned) last_basic_block; i++)
+ for (i = first_new_block; i < (unsigned) last_basic_block_for_fn (cfun); i++)
add_phi_args_after_copy_bb (BASIC_BLOCK_FOR_FN (cfun, i));

- for (i = first_new_block; i < (unsigned) last_basic_block; i++)
+ for (i = first_new_block; i < (unsigned) last_basic_block_for_fn (cfun); i++)
BASIC_BLOCK_FOR_FN (cfun, i)->flags &= ~BB_DUPLICATED;
}

@@ -772,7 +772,7 @@ gimple_duplicate_loop_to_header_edge (struct loop *loop, edge e,
verify_loop_closed_ssa (true);
#endif

- first_new_block = last_basic_block;
+ first_new_block = last_basic_block_for_fn (cfun);
if (!duplicate_loop_to_header_edge (loop, e, ndupl, wont_exit,
orig, to_remove, flags))
return false;
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index dcce38a..c1c5b4f 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2442,7 +2442,7 @@ compute_antic (void)

/* If any predecessor edges are abnormal, we punt, so antic_in is empty.
We pre-build the map of blocks with incoming abnormal edges here. */
- has_abnormal_preds = sbitmap_alloc (last_basic_block);
+ has_abnormal_preds = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (has_abnormal_preds);

FOR_ALL_BB (block)
@@ -2471,7 +2471,7 @@ compute_antic (void)
/* At the exit block we anticipate nothing. */
BB_VISITED (EXIT_BLOCK_PTR_FOR_FN (cfun)) = 1;

- changed_blocks = sbitmap_alloc (last_basic_block + 1);
+ changed_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun) + 1);
bitmap_ones (changed_blocks);
while (changed)
{
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 783b651..55ae68b 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -495,10 +495,10 @@ ssa_prop_init (void)
vec_alloc (interesting_ssa_edges, 20);
vec_alloc (varying_ssa_edges, 20);

- executable_blocks = sbitmap_alloc (last_basic_block);
+ executable_blocks = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (executable_blocks);

- bb_in_list = sbitmap_alloc (last_basic_block);
+ bb_in_list = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (bb_in_list);

if (dump_file && (dump_flags & TDF_DETAILS))
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 9108983..1392879 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -4564,7 +4564,7 @@ init_reassoc (void)
/* Reverse RPO (Reverse Post Order) will give us something where
deeper loops come later. */
pre_and_rev_post_order_compute (NULL, bbs, false);
- bb_rank = XCNEWVEC (long, last_basic_block);
+ bb_rank = XCNEWVEC (long, last_basic_block_for_fn (cfun));
operand_rank = pointer_map_create ();

/* Give each default definition a distinct rank. This includes
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index e98652c..c271778 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -3984,7 +3984,7 @@ init_scc_vn (void)

shared_lookup_phiargs.create (0);
shared_lookup_references.create (0);
- rpo_numbers = XNEWVEC (int, last_basic_block);
+ rpo_numbers = XNEWVEC (int, last_basic_block_for_fn (cfun));
rpo_numbers_temp =
XNEWVEC (int, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS);
pre_and_rev_post_order_compute (NULL, rpo_numbers_temp, false);
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index fbcbf78..a0eac67 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -771,7 +771,7 @@ init_worklist (void)
{
alloc_aux_for_blocks (sizeof (struct aux_bb_info));
same_succ_htab.create (n_basic_blocks_for_fn (cfun));
- same_succ_edge_flags = XCNEWVEC (int, last_basic_block);
+ same_succ_edge_flags = XCNEWVEC (int, last_basic_block_for_fn (cfun));
deleted_bbs = BITMAP_ALLOC (NULL);
deleted_bb_preds = BITMAP_ALLOC (NULL);
worklist.create (n_basic_blocks_for_fn (cfun));
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 92652de..d38e0dd 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -179,7 +179,7 @@ associate_equivalences_with_edges (void)
&& !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (cond))
{
int i, n_labels = gimple_switch_num_labels (stmt);
- tree *info = XCNEWVEC (tree, last_basic_block);
+ tree *info = XCNEWVEC (tree, last_basic_block_for_fn (cfun));

/* Walk over the case label vector. Record blocks
which are reached by a single case label which represents
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 5a22cfd..8b168e0 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -72,7 +72,7 @@ reachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb)
if (! dominated_by_p (CDI_DOMINATORS, va_arg_bb, va_start_bb))
return false;

- visited = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (visited);
ret = true;

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 785e72f..06b6259 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5934,13 +5934,13 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
static bool
find_assert_locations (void)
{
- int *rpo = XNEWVEC (int, last_basic_block);
- int *bb_rpo = XNEWVEC (int, last_basic_block);
- int *last_rpo = XCNEWVEC (int, last_basic_block);
+ int *rpo = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ int *bb_rpo = XNEWVEC (int, last_basic_block_for_fn (cfun));
+ int *last_rpo = XCNEWVEC (int, last_basic_block_for_fn (cfun));
int rpo_cnt, i;
bool need_asserts;

- live = XCNEWVEC (sbitmap, last_basic_block);
+ live = XCNEWVEC (sbitmap, last_basic_block_for_fn (cfun));
rpo_cnt = pre_and_rev_post_order_compute (NULL, rpo, false);
for (i = 0; i < rpo_cnt; ++i)
bb_rpo[rpo[i]] = i;
@@ -6034,7 +6034,7 @@ find_assert_locations (void)
XDELETEVEC (rpo);
XDELETEVEC (bb_rpo);
XDELETEVEC (last_rpo);
- for (i = 0; i < last_basic_block; ++i)
+ for (i = 0; i < last_basic_block_for_fn (cfun); ++i)
if (live[i])
sbitmap_free (live[i]);
XDELETEVEC (live);
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 7d4a983..5bd0799 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -6928,7 +6928,7 @@ vt_find_locations (void)
/* Compute reverse completion order of depth first search of the CFG
so that the data-flow runs faster. */
rc_order = XNEWVEC (int, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS);
- bb_order = XNEWVEC (int, last_basic_block);
+ bb_order = XNEWVEC (int, last_basic_block_for_fn (cfun));
pre_and_rev_post_order_compute (NULL, rc_order, false);
for (i = 0; i < n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; i++)
bb_order[rc_order[i]] = i;
@@ -6936,9 +6936,9 @@ vt_find_locations (void)

worklist = fibheap_new ();
pending = fibheap_new ();
- visited = sbitmap_alloc (last_basic_block);
- in_worklist = sbitmap_alloc (last_basic_block);
- in_pending = sbitmap_alloc (last_basic_block);
+ visited = sbitmap_alloc (last_basic_block_for_fn (cfun));
+ in_worklist = sbitmap_alloc (last_basic_block_for_fn (cfun));
+ in_pending = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (in_worklist);

FOR_EACH_BB (bb)
--
1.7.11.7
Steven Bosscher
2013-12-06 15:57:24 UTC
Permalink
Post by David Malcolm
* asan.c (transform_statements): Eliminate use of last_basic_block
in favor of last_basic_block_for_fn, in order to make use of cfun
explicit.
Can we please make all this _for_fn go away?

Ciao!
Steven
Oleg Endo
2013-12-06 18:56:58 UTC
Permalink
Post by Steven Bosscher
Post by David Malcolm
* asan.c (transform_statements): Eliminate use of last_basic_block
in favor of last_basic_block_for_fn, in order to make use of cfun
explicit.
Can we please make all this _for_fn go away?
Sorry if this has been discussed before... but why not adding member
functions to 'function' instead of freestanding macros/functions that
take a function* as a first argument? This would also make it easier to
eliminate the "_for_fn" (freestanding function/macro name clashes etc) I
think.

Cheers,
Oleg
Richard Biener
2013-12-06 20:27:17 UTC
Permalink
Post by David Malcolm
Post by Steven Bosscher
Post by David Malcolm
* asan.c (transform_statements): Eliminate use of
last_basic_block
Post by Steven Bosscher
Post by David Malcolm
in favor of last_basic_block_for_fn, in order to make use
of cfun
Post by Steven Bosscher
Post by David Malcolm
explicit.
Can we please make all this _for_fn go away?
Sorry if this has been discussed before... but why not adding member
functions to 'function' instead of freestanding macros/functions that
take a function* as a first argument? This would also make it easier to
eliminate the "_for_fn" (freestanding function/macro name clashes etc) I
think.
Both can be done, but these patches make cfun uses explicit which was the goal while following existing practice.

Richard.
Post by David Malcolm
Cheers,
Oleg
David Malcolm
2013-12-09 21:47:50 UTC
Permalink
Post by Richard Biener
Post by David Malcolm
Post by Steven Bosscher
Post by David Malcolm
* asan.c (transform_statements): Eliminate use of
last_basic_block
Post by Steven Bosscher
Post by David Malcolm
in favor of last_basic_block_for_fn, in order to make use
of cfun
Post by Steven Bosscher
Post by David Malcolm
explicit.
Can we please make all this _for_fn go away?
Sorry if this has been discussed before... but why not adding member
functions to 'function' instead of freestanding macros/functions that
take a function* as a first argument? This would also make it easier to
eliminate the "_for_fn" (freestanding function/macro name clashes etc) I
think.
Both can be done, but these patches make cfun uses explicit which was the goal while following existing practice.
Yes, longer-term I'd prefer member functions. The approach I posted
approach gives identical results to the status quo after a trip through
the preprocessor, so is somewhat lower-risk than introducing inlinable
member functions. (and in any case, all of the repeated implicit
dereferencing of "cfun->" seems inefficient to me, but not something I
plan to touch in stage3)

I've gone ahead and committed the patch series to trunk, test-building
before each commit, and fixing up patches 11 and 12 for the issues noted
by Oleg (the config/sh files had .cc suffixes, and hence didn't show up
in my grepping; I updated my grep accordingly).

There are still 4 macros in function.h that implicitly use cfun, which
it's less clear to me how to remove:
#define current_function_funcdef_no
#define current_loops
#define dom_computed
#define n_bbs_in_dom_tree

plus various other cfun-using macros elsewhere in headers...

FWIW, here are the svn revisions of what I committed, vs the numbering
of the patches in the emails:
0001: r205816
0002: r205817
0003: r205818
0004: r205820
0005: r205821
0006: r205822
0007: r205823
0008: r205824
0009: r205825
0010: r205826
0011: r205828
0012: r205829
0013: r205830

Hope this is all sane
Dave
Oleg Endo
2013-12-09 21:52:49 UTC
Permalink
Post by David Malcolm
Yes, longer-term I'd prefer member functions. The approach I posted
approach gives identical results to the status quo after a trip through
the preprocessor, so is somewhat lower-risk than introducing inlinable
member functions. (and in any case, all of the repeated implicit
dereferencing of "cfun->" seems inefficient to me, but not something I
plan to touch in stage3)
Understandable.
Post by David Malcolm
I've gone ahead and committed the patch series to trunk, test-building
before each commit, and fixing up patches 11 and 12 for the issues noted
by Oleg (the config/sh files had .cc suffixes, and hence didn't show up
in my grepping; I updated my grep accordingly).
Thanks!

Cheers,
Oleg
Richard Biener
2013-12-10 09:43:20 UTC
Permalink
Post by David Malcolm
Post by Richard Biener
Post by David Malcolm
Post by Steven Bosscher
Post by David Malcolm
* asan.c (transform_statements): Eliminate use of
last_basic_block
Post by Steven Bosscher
Post by David Malcolm
in favor of last_basic_block_for_fn, in order to make use
of cfun
Post by Steven Bosscher
Post by David Malcolm
explicit.
Can we please make all this _for_fn go away?
Sorry if this has been discussed before... but why not adding member
functions to 'function' instead of freestanding macros/functions that
take a function* as a first argument? This would also make it easier to
eliminate the "_for_fn" (freestanding function/macro name clashes etc) I
think.
Both can be done, but these patches make cfun uses explicit which was the goal while following existing practice.
Yes, longer-term I'd prefer member functions. The approach I posted
approach gives identical results to the status quo after a trip through
the preprocessor, so is somewhat lower-risk than introducing inlinable
member functions. (and in any case, all of the repeated implicit
dereferencing of "cfun->" seems inefficient to me, but not something I
plan to touch in stage3)
I've gone ahead and committed the patch series to trunk, test-building
before each commit, and fixing up patches 11 and 12 for the issues noted
by Oleg (the config/sh files had .cc suffixes, and hence didn't show up
in my grepping; I updated my grep accordingly).
There are still 4 macros in function.h that implicitly use cfun, which
#define current_function_funcdef_no
fundef_no_for_fn (cfun)
Post by David Malcolm
#define current_loops
loops_for_fn (cfun)
Post by David Malcolm
#define dom_computed
less obvious - we have DOM info computed only for a single function
throughout the compilation (so rooting DOM info from struct function
is somewhat odd). I wouldn't touch it unless the DOM API gets
a _fn API variant (if that is desired at all).
Post by David Malcolm
#define n_bbs_in_dom_tree
Likewise.

As of using more C++ I was thinking about providing context by
means of adding accessors to gimple_opt_pass that automagically
provide the 'cfun' argument. That of course means making
passes really classes derived from gimple_opt_pass. The idea
is that from being a gimple_opt_pass you know you are working
with a single function (and the pass instance can have a pointer
to it, to get rid of 'cfun') and that there should be a convenient
API to use from such context where the function you work with
is implicit.

Of course that would overload gimple_opt_pass with various API
wrappers (or we'd use multiple inheritance and API objects).

Richard.
Post by David Malcolm
plus various other cfun-using macros elsewhere in headers...
FWIW, here are the svn revisions of what I committed, vs the numbering
0001: r205816
0002: r205817
0003: r205818
0004: r205820
0005: r205821
0006: r205822
0007: r205823
0008: r205824
0009: r205825
0010: r205826
0011: r205828
0012: r205829
0013: r205830
Hope this is all sane
Dave
--
Richard Biener <***@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer
David Malcolm
2013-12-06 14:51:39 UTC
Permalink
gcc/
* basic-block.h (FOR_ALL_BB): Eliminate macro.

* cfg.c (alloc_aux_for_blocks, clear_aux_for_blocks): Replace
uses of FOR_ALL_BB with FOR_ALL_BB_FN, making uses of cfun explicit.

* cfganal.c (inverted_post_order_compute): Likewise.
* cfgcleanup.c (try_optimize_cfg): Likewise.
* cfgexpand.c (add_scope_conflicts): Likewise.
* cfghooks.c (dump_flow_info, account_profile_record): Likewise.
* cfgrtl.c (relink_block_chain): Likewise.
* dce.c (mark_artificial_uses): Likewise.
* df-core.c (df_set_blocks, df_compute_cfg_image, df_dump): Likewise.
* df-problems.c (df_lr_verify_solution_start,
df_lr_verify_solution_end, df_lr_verify_transfer_functions,
df_live_verify_solution_start, df_live_verify_solution_end,
df_live_set_all_dirty, df_live_verify_transfer_functions,
df_md_local_comput): Likewise.
* df-scan.c (df_scan_free_internal, df_scan_alloc)
df_reorganize_refs_by_insn, df_scan_verify): Likewise.
* dominance.c (compute_dom_fast_query, calculate_dominance_info,
free_dominance_info): Likewise.
* dse.c (dse_step1, dse_step3, dse_step4, dse_step6): Likewise.
* graph.c (draw_cfg_edges): Likewise.
* graphite-scop-detection.c (print_graphite_scop_statistics,
dot_all_scops_1): Likewise.
* graphite.c (print_global_statistics,
print_graphite_scop_statistics): Likewise.
* ira.c (do_reload): Likewise.
* loop-init.c (loop_optimizer_finalize): Likewise.
* lto-streamer-in.c (input_function): Likewise.
* lto-streamer-out.c (output_function): Likewise.
* mcf.c (adjust_cfg_counts): Likewise.
* predict.c (estimate_loops): Likewise.
* sched-rgn.c (haifa_find_rgns): Likewise.
* tree-cfg.c (split_critical_edges): Likewise.
* tree-dfa.c (renumber_gimple_stmt_uids): Likewise.
* tree-loop-distribution.c (tree_loop_distribution): Likewise.
* tree-ssa-pre.c (compute_antic, insert, init_pre): Likewise.
* tree-ssa-propagate.c (ssa_prop_init): Likewise.
* var-tracking.c (vt_initialize, vt_finalize): Likewise.
* vtable-verify.c (vtable_verify_main): Likewise.
* web.c (web_main): Likewise.
---
gcc/basic-block.h | 3 ---
gcc/cfg.c | 4 ++--
gcc/cfganal.c | 2 +-
gcc/cfgcleanup.c | 2 +-
gcc/cfgexpand.c | 4 ++--
gcc/cfghooks.c | 4 ++--
gcc/cfgrtl.c | 2 +-
gcc/dce.c | 2 +-
gcc/df-core.c | 8 ++++----
gcc/df-problems.c | 22 +++++++++++-----------
gcc/df-scan.c | 8 ++++----
gcc/df.h | 2 +-
gcc/dominance.c | 6 +++---
gcc/dse.c | 8 ++++----
gcc/graph.c | 2 +-
gcc/graphite-scop-detection.c | 6 +++---
gcc/graphite.c | 4 ++--
gcc/ira.c | 4 ++--
gcc/loop-init.c | 2 +-
gcc/lto-streamer-in.c | 4 ++--
gcc/lto-streamer-out.c | 4 ++--
gcc/mcf.c | 2 +-
gcc/predict.c | 2 +-
gcc/sched-rgn.c | 2 +-
gcc/tree-cfg.c | 2 +-
gcc/tree-dfa.c | 2 +-
gcc/tree-loop-distribution.c | 2 +-
gcc/tree-ssa-pre.c | 8 ++++----
gcc/tree-ssa-propagate.c | 2 +-
gcc/var-tracking.c | 4 ++--
gcc/vtable-verify.c | 2 +-
gcc/web.c | 6 +++---
32 files changed, 67 insertions(+), 70 deletions(-)

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index 75f16ac..b323a1f 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -362,9 +362,6 @@ struct GTY(()) control_flow_graph {
/* Cycles through _all_ basic blocks, even the fake ones (entry and
exit block). */

-#define FOR_ALL_BB(BB) \
- for (BB = ENTRY_BLOCK_PTR_FOR_FN (cfun); BB; BB = BB->next_bb)
-
#define FOR_ALL_BB_FN(BB, FN) \
for (BB = ENTRY_BLOCK_PTR_FOR_FN (FN); BB; BB = BB->next_bb)

diff --git a/gcc/cfg.c b/gcc/cfg.c
index 4f9d769..d4d00a4 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -576,7 +576,7 @@ alloc_aux_for_blocks (int size)
{
basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
alloc_aux_for_block (bb, size);
}
}
@@ -588,7 +588,7 @@ clear_aux_for_blocks (void)
{
basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->aux = NULL;
}

diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 3371b4a..d7e0382 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -784,7 +784,7 @@ inverted_post_order_compute (int *post_order)
bitmap_clear (visited);

/* Put all blocks that have no successor into the initial work list. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
if (EDGE_COUNT (bb->succs) == 0)
{
/* Push the initial edge on to the stack. */
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index cf72c03..684ab0f 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -2864,7 +2864,7 @@ try_optimize_cfg (int mode)
while (changed);
}

- FOR_ALL_BB (b)
+ FOR_ALL_BB_FN (b, cfun)
b->flags &= ~(BB_FORWARDER_BLOCK | BB_NONTHREADABLE_BLOCK);

return changed_overall;
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 56bcd80..a73bd41 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -498,7 +498,7 @@ add_scope_conflicts (void)

We then do a mostly classical bitmap liveness algorithm. */

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->aux = BITMAP_ALLOC (&stack_var_bitmap_obstack);

rpo = XNEWVEC (int, last_basic_block_for_fn (cfun));
@@ -525,7 +525,7 @@ add_scope_conflicts (void)

free (rpo);
BITMAP_FREE (work);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
BITMAP_FREE (bb->aux);
}

diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 78218b5..7a16887 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -325,7 +325,7 @@ dump_flow_info (FILE *file, int flags)

fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks_for_fn (cfun),
n_edges_for_fn (cfun));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
dump_bb (file, bb, 0, flags);

putc ('\n', file);
@@ -1408,7 +1408,7 @@ account_profile_record (struct profile_record *record, int after_pass)
int sum;
gcov_type lsum;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& profile_status_for_fn (cfun) != PROFILE_ABSENT)
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 7734ac1..1a63249 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -3619,7 +3619,7 @@ relink_block_chain (bool stay_in_cfglayout_mode)
EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb = prev_bb;

/* Then, clean up the aux fields. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb->aux = NULL;
if (!stay_in_cfglayout_mode)
diff --git a/gcc/dce.c b/gcc/dce.c
index 843dfc6..7e8278f 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -663,7 +663,7 @@ mark_artificial_uses (void)
struct df_link *defs;
df_ref *use_rec;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
for (use_rec = df_get_artificial_uses (bb->index);
*use_rec; use_rec++)
diff --git a/gcc/df-core.c b/gcc/df-core.c
index ba57d39..045b54f 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -549,7 +549,7 @@ df_set_blocks (bitmap blocks)
{
basic_block bb;
bitmap_initialize (&blocks_to_reset, &df_bitmap_obstack);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_set_bit (&blocks_to_reset, bb->index);
}
@@ -1720,7 +1720,7 @@ df_compute_cfg_image (void)
int i;
int * map;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
size += EDGE_COUNT (bb->succs);
}
@@ -1728,7 +1728,7 @@ df_compute_cfg_image (void)
map = XNEWVEC (int, size);
map[0] = size;
i = 1;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
edge_iterator ei;
edge e;
@@ -2021,7 +2021,7 @@ df_dump (FILE *file)
basic_block bb;
df_dump_start (file);

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
df_print_bb_index (bb, file);
df_dump_top (bb, file);
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 70f7254..4b926b6 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -1176,7 +1176,7 @@ df_lr_verify_solution_start (void)
problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_initialize (&problem_data->in[bb->index], &problem_data->lr_bitmaps);
bitmap_initialize (&problem_data->out[bb->index], &problem_data->lr_bitmaps);
@@ -1205,7 +1205,7 @@ df_lr_verify_solution_end (void)
in df_lr_finalize for details. */
df_lr->solutions_dirty = false;
else
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LR_IN (bb)))
|| (!bitmap_equal_p (&problem_data->out[bb->index], DF_LR_OUT (bb))))
@@ -1217,7 +1217,7 @@ df_lr_verify_solution_end (void)

/* Cannot delete them immediately because you may want to dump them
if the comparison fails. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_clear (&problem_data->in[bb->index]);
bitmap_clear (&problem_data->out[bb->index]);
@@ -1294,7 +1294,7 @@ df_lr_verify_transfer_functions (void)
bitmap_initialize (&saved_use, &bitmap_default_obstack);
bitmap_initialize (&all_blocks, &bitmap_default_obstack);

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
bitmap_set_bit (&all_blocks, bb->index);
@@ -1713,7 +1713,7 @@ df_live_verify_solution_start (void)
problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_initialize (&problem_data->in[bb->index], &problem_data->live_bitmaps);
bitmap_initialize (&problem_data->out[bb->index], &problem_data->live_bitmaps);
@@ -1736,7 +1736,7 @@ df_live_verify_solution_end (void)
if (!problem_data->out)
return;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LIVE_IN (bb)))
|| (!bitmap_equal_p (&problem_data->out[bb->index], DF_LIVE_OUT (bb))))
@@ -1748,7 +1748,7 @@ df_live_verify_solution_end (void)

/* Cannot delete them immediately because you may want to dump them
if the comparison fails. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_clear (&problem_data->in[bb->index]);
bitmap_clear (&problem_data->out[bb->index]);
@@ -1814,7 +1814,7 @@ void
df_live_set_all_dirty (void)
{
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_set_bit (df_live->out_of_date_transfer_functions,
bb->index);
}
@@ -1840,7 +1840,7 @@ df_live_verify_transfer_functions (void)

df_grow_insn_info ();

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
bitmap_set_bit (&all_blocks, bb->index);
@@ -4316,7 +4316,7 @@ df_md_local_compute (bitmap all_blocks)
bitmap_clear (&seen_in_insn);

frontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);

compute_dominance_frontiers (frontiers);
@@ -4334,7 +4334,7 @@ df_md_local_compute (bitmap all_blocks)
}
}

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_clear (&frontiers[bb->index]);
free (frontiers);
}
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 9f6f67a..a35b12f 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -213,7 +213,7 @@ df_scan_free_internal (void)
}
}

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
unsigned int bb_index = bb->index;
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
@@ -355,7 +355,7 @@ df_scan_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
df_grow_insn_info ();
df_grow_bb_info (df_scan);

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
unsigned int bb_index = bb->index;
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
@@ -1887,7 +1887,7 @@ df_reorganize_refs_by_insn (struct df_ref_info *ref_info,
}
else
{
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
offset = df_reorganize_refs_by_insn_bb (bb, offset, ref_info,
include_defs, include_uses,
include_eq_uses);
@@ -4569,7 +4569,7 @@ df_scan_verify (void)
clear a mark that has not been set as this means that the ref in
the block or insn was not in the reg chain. */

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
df_bb_verify (bb);

/* (4) See if all reg chains are traversed a second time. This time
diff --git a/gcc/df.h b/gcc/df.h
index e3ca67b..579712c 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -176,7 +176,7 @@ enum df_ref_order
DF_REF_ORDER_BY_REG_WITH_NOTES,

/* Organize the refs in insn order. The insns are ordered within a
- block, and the blocks are ordered by FOR_ALL_BB. */
+ block, and the blocks are ordered by FOR_ALL_BB_FN. */
DF_REF_ORDER_BY_INSN,

/* For uses, the refs within eq notes may be added for
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 69816c1..77f9471 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -624,7 +624,7 @@ compute_dom_fast_query (enum cdi_direction dir)
if (dom_computed[dir_index] == DOM_OK)
return;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if (!bb->dom[dir_index]->father)
assign_dfs_numbers (bb->dom[dir_index], &num);
@@ -652,7 +652,7 @@ calculate_dominance_info (enum cdi_direction dir)
{
gcc_assert (!n_bbs_in_dom_tree[dir_index]);

- FOR_ALL_BB (b)
+ FOR_ALL_BB_FN (b, cfun)
{
b->dom[dir_index] = et_new_tree (b);
}
@@ -689,7 +689,7 @@ free_dominance_info (enum cdi_direction dir)
if (!dom_info_available_p (dir))
return;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
et_free_tree_force (bb->dom[dir_index]);
bb->dom[dir_index] = NULL;
diff --git a/gcc/dse.c b/gcc/dse.c
index e5b0850..958097d 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -2708,7 +2708,7 @@ dse_step1 (void)
bitmap_set_bit (all_blocks, ENTRY_BLOCK);
bitmap_set_bit (all_blocks, EXIT_BLOCK);

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
insn_info_t ptr;
bb_info_t bb_info = (bb_info_t) pool_alloc (bb_info_pool);
@@ -3290,7 +3290,7 @@ dse_step3 (bool for_spills)

bitmap_ones (unreachable_blocks);

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
if (bb_info->gen)
@@ -3469,7 +3469,7 @@ dse_step4 (void)
basic_block bb;

fprintf (dump_file, "\n\n*** Global dataflow info after analysis.\n");
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];

@@ -3617,7 +3617,7 @@ dse_step6 (void)
{
basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
insn_info_t insn_info = bb_info->last_insn;
diff --git a/gcc/graph.c b/gcc/graph.c
index 6c405d8..545de44 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -255,7 +255,7 @@ draw_cfg_edges (pretty_printer *pp, struct function *fun)
{
basic_block bb;
mark_dfs_back_edges ();
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
draw_cfg_node_succ_edges (pp, fun->funcdef_no, bb);

/* Add an invisible edge from ENTRY to EXIT, to improve the graph layout. */
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index a8db98d..fea15e5 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1114,7 +1114,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)

basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
@@ -1450,7 +1450,7 @@ dot_all_scops_1 (FILE *file, vec<scop_p> scops)

fprintf (file, "digraph all {\n");

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
int part_of_scop = false;

@@ -1557,7 +1557,7 @@ dot_all_scops_1 (FILE *file, vec<scop_p> scops)
fprintf (file, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
}

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index a573ea7..8af0402 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -94,7 +94,7 @@ print_global_statistics (FILE* file)

basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;

@@ -150,7 +150,7 @@ print_graphite_scop_statistics (FILE* file, scop_p scop)

basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
diff --git a/gcc/ira.c b/gcc/ira.c
index 7403870..d6462ca 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5443,7 +5443,7 @@ do_reload (void)
loop_optimizer_finalize ();
free_dominance_info (CDI_DOMINATORS);
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->loop_father = NULL;
current_loops = NULL;

@@ -5492,7 +5492,7 @@ do_reload (void)
loop_optimizer_finalize ();
free_dominance_info (CDI_DOMINATORS);
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->loop_father = NULL;
current_loops = NULL;

diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 3dc6953..8c5553b 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -169,7 +169,7 @@ loop_optimizer_finalize (void)
ggc_free (current_loops);
current_loops = NULL;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb->loop_father = NULL;
}
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 8dc94bd..9d4466b 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -976,7 +976,7 @@ input_function (tree fn_decl, struct data_in *data_in,
/* Fix up the call statements that are mentioned in the callgraph
edges. */
set_gimple_stmt_max_uid (cfun, 0);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -991,7 +991,7 @@ input_function (tree fn_decl, struct data_in *data_in,
}
}
stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator bsi = gsi_start_phis (bb);
while (!gsi_end_p (bsi))
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 615cc84..205518f 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1868,7 +1868,7 @@ output_function (struct cgraph_node *node)
virtual PHIs get re-computed on-the-fly which would make numbers
inconsistent. */
set_gimple_stmt_max_uid (cfun, 0);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
@@ -1887,7 +1887,7 @@ output_function (struct cgraph_node *node)
}
/* To avoid keeping duplicate gimple IDs in the statements, renumber
virtual phis now. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/mcf.c b/gcc/mcf.c
index f9b5505..146b43c 100644
--- a/gcc/mcf.c
+++ b/gcc/mcf.c
@@ -1245,7 +1245,7 @@ adjust_cfg_counts (fixup_graph_type *fixup_graph)
sum_edge_counts (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds);

/* Compute edge probabilities. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if (bb->count)
{
diff --git a/gcc/predict.c b/gcc/predict.c
index 78efb72..a5ad34f 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2757,7 +2757,7 @@ estimate_loops (void)
estimate_loops_at_level (current_loops->tree_root->inner);

/* Now propagate the frequencies through all the blocks. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_set_bit (tovisit, bb->index);
}
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 7fa9759..863cd1d 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -745,7 +745,7 @@ haifa_find_rgns (void)
}

/* Reset ->aux field used by EDGE_PASSED. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
edge_iterator ei;
edge e;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 98434ac..03e177a 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7940,7 +7940,7 @@ split_critical_edges (void)
expensive. So we want to enable recording of edge to CASE_LABEL_EXPR
mappings around the calls to split_edge. */
start_recording_case_labels ();
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
{
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 2d964d5..302822c 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -80,7 +80,7 @@ renumber_gimple_stmt_uids (void)
basic_block bb;

set_gimple_stmt_max_uid (cfun, 0);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator bsi;
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index abf69f4..7d86b08 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1677,7 +1677,7 @@ tree_loop_distribution (void)
basic_block bb;
control_dependences *cd = NULL;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index c1c5b4f..bceea77 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2445,7 +2445,7 @@ compute_antic (void)
has_abnormal_preds = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (has_abnormal_preds);

- FOR_ALL_BB (block)
+ FOR_ALL_BB_FN (block, cfun)
{
edge_iterator ei;
edge e;
@@ -3660,7 +3660,7 @@ insert (void)
basic_block bb;
int num_iterations = 0;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
NEW_SETS (bb) = bitmap_set_new ();

while (new_stuff)
@@ -3673,7 +3673,7 @@ insert (void)
/* Clear the NEW sets before the next iteration. We have already
fully propagated its contents. */
if (new_stuff)
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_set_free (NEW_SETS (bb));
}
statistics_histogram_event (cfun, "insert iterations", num_iterations);
@@ -4672,7 +4672,7 @@ init_pre (void)
sizeof (struct bitmap_set), 30);
pre_expr_pool = create_alloc_pool ("pre_expr nodes",
sizeof (struct pre_expr_d), 30);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
EXP_GEN (bb) = bitmap_set_new ();
PHI_GEN (bb) = bitmap_set_new ();
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index f9f084b..fc8041f 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -509,7 +509,7 @@ ssa_prop_init (void)

/* Initially assume that every edge in the CFG is not executable.
(including the edges coming out of the entry block). */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;

diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 175ec01..f38cbe1 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -9847,7 +9847,7 @@ vt_initialize (void)
changed_variables.create (10);

/* Init the IN and OUT sets. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
VTI (bb)->visited = false;
VTI (bb)->flooded = false;
@@ -10186,7 +10186,7 @@ vt_finalize (void)
VTI (bb)->mos.release ();
}

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
dataflow_set_destroy (&VTI (bb)->in);
dataflow_set_destroy (&VTI (bb)->out);
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index 46c5621..401f40b 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -746,7 +746,7 @@ vtable_verify_main (void)
unsigned int ret = 1;
basic_block bb;

- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
verify_bb_vtables (bb);

return ret;
diff --git a/gcc/web.c b/gcc/web.c
index 8e8c465..d281f45 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -351,7 +351,7 @@ web_main (void)
df_set_flags (DF_DEFER_INSN_RESCAN);

/* Assign ids to the uses. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
@@ -379,7 +379,7 @@ web_main (void)
use_entry = XCNEWVEC (struct web_entry, uses_num);

/* Produce the web. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
@@ -404,7 +404,7 @@ web_main (void)

/* Update the instruction stream, allocating new registers for split pseudos
in progress. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
--
1.7.11.7
David Malcolm
2013-12-06 14:51:32 UTC
Permalink
gcc/
* basic-block.h (BASIC_BLOCK): Eliminate macro.

* alias.c (init_alias_analysis): Eliminate BASIC_BLOCK macro in
favor of uses of BASIC_BLOCK_FOR_FN, making uses of cfun explicit.
* bt-load.c (compute_defs_uses_and_gen, compute_out, link_btr_uses,
block_at_edge_of_live_range_p, migrate_btr_defs): Likewise.
* caller-save.c (insert_one_insn): Likewise.
* cfg.c (debug_bb, get_bb_original, get_bb_copy): Likewise.
* cfgexpand.c (add_scope_conflicts): Likewise.
* cfghooks.c (verify_flow_info): Likewise.
* cfgloop.c (flow_loops_find): Likewise.
* cfgrtl.c (rtl_flow_call_edges_add): Likewise.
* config/mips/mips.c (r10k_insert_cache_barriers): Likewise.
* config/s390/s390.c (s390_optimize_nonescaping_tx): Likewise.
* config/spu/spu.c (spu_machine_dependent_reorg): Likewise.
* cse.c (cse_main): Likewise.
* dce.c (fast_dce): Likewise.
* df-core.c (df_set_blocks, df_worklist_propagate_forward,
df_worklist_propagate_backward, df_worklist_dataflow_doublequeue,
df_bb_replace, df_dump_region): Likewise.
* df-problems.c (df_rd_bb_local_compute, df_lr_bb_local_compute,
df_live_bb_local_compute, df_chain_remove_problem)
df_chain_create_bb, df_word_lr_bb_local_compute, df_note_bb_compute,
df_md_bb_local_compute, df_md_local_compute,
df_md_transfer_function): Likewise.
* df-scan.c (df_scan_blocks, df_reorganize_refs_by_reg_by_insn,
df_reorganize_refs_by_insn, df_bb_refs_collect,
df_record_entry_block_defs, df_update_entry_block_defs,
df_record_exit_block_uses): Likewise.
* dominance.c (nearest_common_dominator_for_set): Likewise.
* gcse.c (hoist_code): Likewise.
* graph.c (draw_cfg_nodes_no_loops): Likewise.
* ipa-inline-analysis.c (param_change_prob,
estimate_function_body_sizes): Likewise.
* ipa-split.c (dominated_by_forbidden): Likewise.
* loop-unroll.c (apply_opt_in_copies): Likewise.
* lower-subreg.c (decompose_multiword_subregs): Likewise.
* lra-lives.c (lra_create_live_ranges): Likewise.
* predict.c (propagate_freq): Likewise.
* regrename.c (regrename_analyze): Likewise.
* regstat.c (regstat_bb_compute_ri,
regstat_bb_compute_calls_crossed): Likewise.
* resource.c (mark_target_live_regs): Likewise.
* sched-ebb.c (ebb_fix_recovery_cfg): Likewise.
* sched-int.h (EBB_FIRST_BB, EBB_LAST_BB): Likewise.
* sched-rgn.c (debug_region, dump_region_dot, too_large,
haifa_find_rgns, extend_rgns, compute_dom_prob_ps, update_live,
propagate_deps, sched_is_disabled_for_current_region_p): Likewise.
* sched-vis.c (debug_bb_n_slim): Likewise.
* sel-sched-ir.c (sel_finish_global_and_expr, verify_backedges,
purge_empty_blocks, sel_remove_loop_preheader): Likewise.
* sel-sched.c (remove_insns_that_need_bookkeeping)
(current_region_empty_p, sel_region_init,
simplify_changed_insns): Likewise.
* trans-mem.c (execute_tm_mark, execute_tm_edges,
tm_memopt_compute_antic, ipa_tm_scan_irr_function): Likewise.
* tree-cfg.c (make_edges, end_recording_case_labels,
label_to_block_fn, gimple_debug_bb, gimple_flow_call_edges_add,
remove_edge_and_dominated_blocks, remove_edge_and_dominated_blocks,
gimple_purge_all_dead_eh_edges,
gimple_purge_all_dead_abnormal_call_edges): Likewise.
* tree-cfgcleanup.c (fixup_noreturn_call,
split_bbs_on_noreturn_calls, cleanup_tree_cfg_1): Likewise.
* tree-inline.c (copy_cfg_body, fold_marked_statements): Likewise.
* tree-into-ssa.c (set_livein_block, prune_unused_phi_nodes,
insert_phi_nodes_for, insert_updated_phi_nodes_for): Likewise.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
* tree-ssa-live.c (live_worklist): Likewise.
* tree-ssa-loop-manip.c (compute_live_loop_exits,
add_exit_phis_var, find_uses_to_rename, copy_phi_node_args): Likewise.
* tree-ssa-pre.c (compute_antic): Likewise.
* tree-ssa-reassoc.c (update_range_test, optimize_range_tests): Likewise.
* tree-ssa-sink.c (nearest_common_dominator_of_uses): Likewise.
* tree-ssa-tail-merge.c (same_succ_hash, same_succ_def::equal,
same_succ_flush_bbs, update_worklist, set_cluster,
same_phi_alternatives, find_clusters_1, apply_clusters,
update_debug_stmts): Likewise.
* tree-ssa-threadupdate.c (mark_threaded_blocks,
thread_through_all_blocks): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-vrp.c (find_assert_locations): Likewise.
---
gcc/alias.c | 2 +-
gcc/basic-block.h | 2 --
gcc/bt-load.c | 15 ++++++++-------
gcc/caller-save.c | 8 ++++----
gcc/cfg.c | 6 +++---
gcc/cfgexpand.c | 2 +-
gcc/cfghooks.c | 2 +-
gcc/cfgloop.c | 2 +-
gcc/cfgrtl.c | 2 +-
gcc/config/mips/mips.c | 2 +-
gcc/config/s390/s390.c | 2 +-
gcc/config/spu/spu.c | 2 +-
gcc/cse.c | 2 +-
gcc/dce.c | 2 +-
gcc/df-core.c | 18 +++++++++---------
gcc/df-problems.c | 20 ++++++++++----------
gcc/df-scan.c | 26 ++++++++++++++++----------
gcc/dominance.c | 6 +++---
gcc/gcse.c | 4 ++--
gcc/graph.c | 2 +-
gcc/ipa-inline-analysis.c | 4 ++--
gcc/ipa-split.c | 3 ++-
gcc/loop-unroll.c | 4 ++--
gcc/lower-subreg.c | 2 +-
gcc/lra-lives.c | 2 +-
gcc/predict.c | 2 +-
gcc/regrename.c | 2 +-
gcc/regstat.c | 4 ++--
gcc/resource.c | 7 ++++---
gcc/sched-ebb.c | 2 +-
gcc/sched-int.h | 5 +++--
gcc/sched-rgn.c | 32 ++++++++++++++++++++------------
gcc/sched-vis.c | 2 +-
gcc/sel-sched-ir.c | 8 ++++----
gcc/sel-sched.c | 18 ++++++++++--------
gcc/trans-mem.c | 9 +++++----
gcc/tree-cfg.c | 22 ++++++++++++----------
gcc/tree-cfgcleanup.c | 8 ++++----
gcc/tree-inline.c | 19 +++++++++++--------
gcc/tree-into-ssa.c | 18 ++++++++++--------
gcc/tree-ssa-dom.c | 2 +-
gcc/tree-ssa-live.c | 2 +-
gcc/tree-ssa-loop-manip.c | 12 ++++++------
gcc/tree-ssa-pre.c | 4 ++--
gcc/tree-ssa-reassoc.c | 6 ++++--
gcc/tree-ssa-sink.c | 4 ++--
gcc/tree-ssa-tail-merge.c | 26 +++++++++++++-------------
gcc/tree-ssa-threadupdate.c | 8 ++++----
gcc/tree-ssa-uncprop.c | 3 ++-
gcc/tree-vrp.c | 2 +-
50 files changed, 199 insertions(+), 170 deletions(-)

diff --git a/gcc/alias.c b/gcc/alias.c
index 6a73b09..6290c83 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2989,7 +2989,7 @@ init_alias_analysis (void)
/* Walk the insns adding values to the new_reg_base_value array. */
for (i = 0; i < rpo_cnt; i++)
{
- basic_block bb = BASIC_BLOCK (rpo[i]);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, rpo[i]);
FOR_BB_INSNS (bb, insn)
{
if (NONDEBUG_INSN_P (insn))
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index f759e27..3bd011e 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -332,8 +332,6 @@ struct GTY(()) control_flow_graph {
#define label_to_block_map (cfun->cfg->x_label_to_block_map)
#define profile_status (cfun->cfg->x_profile_status)

-#define BASIC_BLOCK(N) ((*basic_block_info)[(N)])
-
/* For iterating over basic blocks. */
#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
for (BB = FROM; BB != TO; BB = BB->DIR)
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index 09eea06..bbd0dd8 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -460,7 +460,7 @@ compute_defs_uses_and_gen (fibheap_t all_btr_defs, btr_def *def_array,
bitmap_vector_clear (bb_gen, last_basic_block);
for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
int reg;
btr_def defs_this_bb = NULL;
rtx insn;
@@ -651,7 +651,7 @@ compute_out (sbitmap *bb_out, sbitmap *bb_gen, sbitmap *bb_kill, int max_uid)
changed = 0;
for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
{
- bitmap_union_of_preds (bb_in, bb_out, BASIC_BLOCK (i));
+ bitmap_union_of_preds (bb_in, bb_out, BASIC_BLOCK_FOR_FN (cfun, i));
changed |= bitmap_ior_and_compl (bb_out[i], bb_gen[i],
bb_in, bb_kill[i]);
}
@@ -670,11 +670,11 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
Count up the number of reaching defs of each use. */
for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
rtx insn;
rtx last;

- bitmap_union_of_preds (reaching_defs, bb_out, BASIC_BLOCK (i));
+ bitmap_union_of_preds (reaching_defs, bb_out, BASIC_BLOCK_FOR_FN (cfun, i));
for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb));
insn != last;
insn = NEXT_INSN (insn))
@@ -814,13 +814,14 @@ build_btr_def_use_webs (fibheap_t all_btr_defs)
static int
block_at_edge_of_live_range_p (int bb, btr_def def)
{
- if (def->other_btr_uses_before_def && BASIC_BLOCK (bb) == def->bb)
+ if (def->other_btr_uses_before_def
+ && BASIC_BLOCK_FOR_FN (cfun, bb) == def->bb)
return 1;
else if (def->other_btr_uses_after_use)
{
btr_user user;
for (user = def->uses; user != NULL; user = user->next)
- if (BASIC_BLOCK (bb) == user->bb)
+ if (BASIC_BLOCK_FOR_FN (cfun, bb) == user->bb)
return 1;
}
return 0;
@@ -1406,7 +1407,7 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)

for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
fprintf (dump_file,
"Basic block %d: count = " HOST_WIDEST_INT_PRINT_DEC
" loop-depth = %d idom = %d\n",
diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index b134cde..628fc0b 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -1414,8 +1414,8 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
&new_chain->live_throughout);

CLEAR_REG_SET (&new_chain->dead_or_set);
- if (chain->insn == BB_HEAD (BASIC_BLOCK (chain->block)))
- BB_HEAD (BASIC_BLOCK (chain->block)) = new_chain->insn;
+ if (chain->insn == BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)))
+ BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn;
}
else
{
@@ -1434,8 +1434,8 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
note_stores (PATTERN (chain->insn), add_stored_regs,
&new_chain->live_throughout);
CLEAR_REG_SET (&new_chain->dead_or_set);
- if (chain->insn == BB_END (BASIC_BLOCK (chain->block)))
- BB_END (BASIC_BLOCK (chain->block)) = new_chain->insn;
+ if (chain->insn == BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)))
+ BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn;
}
new_chain->block = chain->block;
new_chain->is_caller_save_insn = 1;
diff --git a/gcc/cfg.c b/gcc/cfg.c
index f386168..3337372 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -690,7 +690,7 @@ debug_bb (basic_block bb)
DEBUG_FUNCTION basic_block
debug_bb_n (int n)
{
- basic_block bb = BASIC_BLOCK (n);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, n);
debug_bb (bb);
return bb;
}
@@ -1139,7 +1139,7 @@ get_bb_original (basic_block bb)
key.index1 = bb->index;
entry = bb_original.find (&key);
if (entry)
- return BASIC_BLOCK (entry->index2);
+ return BASIC_BLOCK_FOR_FN (cfun, entry->index2);
else
return NULL;
}
@@ -1164,7 +1164,7 @@ get_bb_copy (basic_block bb)
key.index1 = bb->index;
entry = bb_copy.find (&key);
if (entry)
- return BASIC_BLOCK (entry->index2);
+ return BASIC_BLOCK_FOR_FN (cfun, entry->index2);
else
return NULL;
}
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 853ace2..d98ac5b 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -512,7 +512,7 @@ add_scope_conflicts (void)
for (i = 0; i < n_bbs; i++)
{
bitmap active;
- bb = BASIC_BLOCK (rpo[i]);
+ bb = BASIC_BLOCK_FOR_FN (cfun, rpo[i]);
active = (bitmap)bb->aux;
add_scope_conflicts_1 (bb, work, false);
if (bitmap_ior_into (active, work))
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 2535c90..0cd6af0 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -106,7 +106,7 @@ verify_flow_info (void)
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb, NULL, next_bb)
{
if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
- && bb != BASIC_BLOCK (bb->index))
+ && bb != BASIC_BLOCK_FOR_FN (cfun, bb->index))
{
error ("bb %d on wrong place", bb->index);
err = 1;
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 0b12e73..6245605 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -439,7 +439,7 @@ flow_loops_find (struct loops *loops)
auto_vec<loop_p> larray (loops->larray->length ());
for (b = 0; b < n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS; b++)
{
- basic_block header = BASIC_BLOCK (rc_order[b]);
+ basic_block header = BASIC_BLOCK_FOR_FN (cfun, rc_order[b]);
if (bb_loop_header_p (header))
{
struct loop *loop;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 045d78b..de110f4 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -4831,7 +4831,7 @@ rtl_flow_call_edges_add (sbitmap blocks)

for (i = NUM_FIXED_BLOCKS; i < last_bb; i++)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
rtx insn;
rtx prev_insn;

diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 36ba6df..7903443 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15079,7 +15079,7 @@ r10k_insert_cache_barriers (void)
n = pre_and_rev_post_order_compute (NULL, rev_post_order, false);
for (i = 0; i < n; i++)
{
- bb = BASIC_BLOCK (rev_post_order[i]);
+ bb = BASIC_BLOCK_FOR_FN (cfun, rev_post_order[i]);

/* If this block is only reached by unconditional edges, and if the
source of every edge is protected, the beginning of the block is
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index a435b2d..fcd7532 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -7982,7 +7982,7 @@ s390_optimize_nonescaping_tx (void)

for (bb_index = 0; bb_index < n_basic_blocks_for_fn (cfun); bb_index++)
{
- bb = BASIC_BLOCK (bb_index);
+ bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);

if (!bb)
continue;
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 5b8aef1..a658ee6 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2490,7 +2490,7 @@ spu_machine_dependent_reorg (void)

for (i = n_basic_blocks_for_fn (cfun) - 1; i >= 0; i--)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
branch = 0;
if (spu_bb_info[i].prop_jump)
{
diff --git a/gcc/cse.c b/gcc/cse.c
index d5357f0..215beb0 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6564,7 +6564,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
processed before. */
do
{
- bb = BASIC_BLOCK (rc_order[i++]);
+ bb = BASIC_BLOCK_FOR_FN (cfun, rc_order[i++]);
}
while (bitmap_bit_p (cse_visited_basic_blocks, bb->index)
&& i < n_blocks);
diff --git a/gcc/dce.c b/gcc/dce.c
index 5c11cbe..07d31f7 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -1065,7 +1065,7 @@ fast_dce (bool word_level)
for (i = 0; i < n_blocks; i++)
{
int index = postorder[i];
- basic_block bb = BASIC_BLOCK (index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, index);
bool local_changed;

if (index < NUM_FIXED_BLOCKS)
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 4fb92a9..87419c2 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -520,7 +520,7 @@ df_set_blocks (bitmap blocks)

EXECUTE_IF_SET_IN_BITMAP (&diff, 0, bb_index, bi)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
if (bb)
{
void *bb_info = df_get_bb_info (dflow, bb_index);
@@ -933,7 +933,7 @@ df_worklist_propagate_forward (struct dataflow *dataflow,
{
edge e;
edge_iterator ei;
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
bool changed = !age;

/* Calculate <conf_op> of incoming edges. */
@@ -978,7 +978,7 @@ df_worklist_propagate_backward (struct dataflow *dataflow,
{
edge e;
edge_iterator ei;
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
bool changed = !age;

/* Calculate <conf_op> of incoming edges. */
@@ -1067,7 +1067,7 @@ df_worklist_dataflow_doublequeue (struct dataflow *dataflow,

bitmap_clear_bit (pending, index);
bb_index = blocks_in_postorder[index];
- bb = BASIC_BLOCK (bb_index);
+ bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
prev_age = last_visit_age[index];
if (dir == DF_FORWARD)
changed = df_worklist_propagate_forward (dataflow, bb_index,
@@ -1086,7 +1086,7 @@ df_worklist_dataflow_doublequeue (struct dataflow *dataflow,
bitmap_clear (worklist);
}
for (i = 0; i < n_blocks; i++)
- BASIC_BLOCK (blocks_in_postorder[i])->aux = NULL;
+ BASIC_BLOCK_FOR_FN (cfun, blocks_in_postorder[i])->aux = NULL;

BITMAP_FREE (worklist);
BITMAP_FREE (pending);
@@ -1631,7 +1631,7 @@ df_bb_replace (int old_index, basic_block new_block)
fprintf (dump_file, "shoving block %d into %d\n", new_block_index, old_index);

gcc_assert (df);
- gcc_assert (BASIC_BLOCK (old_index) == NULL);
+ gcc_assert (BASIC_BLOCK_FOR_FN (cfun, old_index) == NULL);

for (p = 0; p < df->num_problems_defined; p++)
{
@@ -1647,7 +1647,7 @@ df_bb_replace (int old_index, basic_block new_block)
df_clear_bb_dirty (new_block);
SET_BASIC_BLOCK_FOR_FN (cfun, old_index, new_block);
new_block->index = old_index;
- df_set_bb_dirty (BASIC_BLOCK (old_index));
+ df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, old_index));
SET_BASIC_BLOCK_FOR_FN (cfun, new_block_index, NULL);
}

@@ -1659,7 +1659,7 @@ df_bb_replace (int old_index, basic_block new_block)
void
df_bb_delete (int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
int i;

if (!df)
@@ -2045,7 +2045,7 @@ df_dump_region (FILE *file)

EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, bb_index, bi)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
dump_bb (file, bb, 0, TDF_DETAILS);
}
fprintf (file, "\n");
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index c6349c8..2b42b48 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -353,7 +353,7 @@ df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
static void
df_rd_bb_local_compute (unsigned int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
rtx insn;

@@ -835,7 +835,7 @@ df_lr_reset (bitmap all_blocks)
static void
df_lr_bb_local_compute (unsigned int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb_index);
rtx insn;
df_ref *def_rec;
@@ -1462,7 +1462,7 @@ df_live_reset (bitmap all_blocks)
static void
df_live_bb_local_compute (unsigned int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb_index);
rtx insn;
df_ref *def_rec;
@@ -1987,7 +1987,7 @@ df_chain_remove_problem (void)
rtx insn;
df_ref *def_rec;
df_ref *use_rec;
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);

if (df_chain_problem_p (DF_DU_CHAIN))
for (def_rec = df_get_artificial_defs (bb->index); *def_rec; def_rec++)
@@ -2105,7 +2105,7 @@ df_chain_create_bb_process_use (bitmap local_rd,
static void
df_chain_create_bb (unsigned int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
rtx insn;
bitmap_head cpy;
@@ -2531,7 +2531,7 @@ df_word_lr_mark_ref (df_ref ref, bool is_set, regset live)
static void
df_word_lr_bb_local_compute (unsigned int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_word_lr_bb_info *bb_info = df_word_lr_get_bb_info (bb_index);
rtx insn;
df_ref *def_rec;
@@ -3154,7 +3154,7 @@ static void
df_note_bb_compute (unsigned int bb_index,
bitmap live, bitmap do_not_gen, bitmap artificial_uses)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn;
df_ref *def_rec;
df_ref *use_rec;
@@ -4271,7 +4271,7 @@ df_md_bb_local_compute_process_def (struct df_md_bb_info *bb_info,
static void
df_md_bb_local_compute (unsigned int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
rtx insn;

@@ -4327,7 +4327,7 @@ df_md_local_compute (bitmap all_blocks)
bitmap kill = &df_md_get_bb_info (bb_index)->kill;
EXECUTE_IF_SET_IN_BITMAP (&frontiers[bb_index], 0, df_bb_index, bi2)
{
- basic_block bb = BASIC_BLOCK (df_bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, df_bb_index);
if (bitmap_bit_p (all_blocks, df_bb_index))
bitmap_ior_and_into (&df_md_get_bb_info (df_bb_index)->init, kill,
df_get_live_in (bb));
@@ -4360,7 +4360,7 @@ df_md_reset (bitmap all_blocks)
static bool
df_md_transfer_function (int bb_index)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
struct df_md_bb_info *bb_info = df_md_get_bb_info (bb_index);
bitmap in = &bb_info->in;
bitmap out = &bb_info->out;
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index eb7e4d4..5f0ba4a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -669,8 +669,8 @@ df_scan_blocks (void)
df_record_entry_block_defs (df->entry_block_defs);
df_get_exit_block_use_set (df->exit_block_uses);
df_record_exit_block_uses (df->exit_block_uses);
- df_set_bb_dirty (BASIC_BLOCK (ENTRY_BLOCK));
- df_set_bb_dirty (BASIC_BLOCK (EXIT_BLOCK));
+ df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, ENTRY_BLOCK));
+ df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK));

/* Regular blocks */
FOR_EACH_BB (bb)
@@ -1637,7 +1637,7 @@ df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info,

EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, bb_index, bi)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn;
df_ref *ref_rec;

@@ -1691,7 +1691,7 @@ df_reorganize_refs_by_reg_by_insn (struct df_ref_info *ref_info,

EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, bb_index, bi)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn;
df_ref *ref_rec;

@@ -1876,7 +1876,9 @@ df_reorganize_refs_by_insn (struct df_ref_info *ref_info,

EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, index, bi)
{
- offset = df_reorganize_refs_by_insn_bb (BASIC_BLOCK (index), offset, ref_info,
+ offset = df_reorganize_refs_by_insn_bb (BASIC_BLOCK_FOR_FN (cfun,
+ index),
+ offset, ref_info,
include_defs, include_uses,
include_eq_uses);
}
@@ -3616,7 +3618,7 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb)
void
df_bb_refs_record (int bb_index, bool scan_insns)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn;
int luid = 0;

@@ -3890,7 +3892,9 @@ df_record_entry_block_defs (bitmap entry_block_defs)
df_entry_block_defs_collect (&collection_rec, entry_block_defs);

/* Process bb_refs chain */
- df_refs_add_to_chains (&collection_rec, BASIC_BLOCK (ENTRY_BLOCK), NULL,
+ df_refs_add_to_chains (&collection_rec,
+ BASIC_BLOCK_FOR_FN (cfun, ENTRY_BLOCK),
+ NULL,
copy_defs);
}

@@ -3929,7 +3933,7 @@ df_update_entry_block_defs (void)
{
df_record_entry_block_defs (&refs);
bitmap_copy (df->entry_block_defs, &refs);
- df_set_bb_dirty (BASIC_BLOCK (ENTRY_BLOCK));
+ df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, ENTRY_BLOCK));
}
bitmap_clear (&refs);
}
@@ -4061,7 +4065,9 @@ df_record_exit_block_uses (bitmap exit_block_uses)
df_exit_block_uses_collect (&collection_rec, exit_block_uses);

/* Process bb_refs chain */
- df_refs_add_to_chains (&collection_rec, BASIC_BLOCK (EXIT_BLOCK), NULL,
+ df_refs_add_to_chains (&collection_rec,
+ BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK),
+ NULL,
copy_uses);
}

@@ -4100,7 +4106,7 @@ df_update_exit_block_uses (void)
{
df_record_exit_block_uses (&refs);
bitmap_copy (df->exit_block_uses,& refs);
- df_set_bb_dirty (BASIC_BLOCK (EXIT_BLOCK));
+ df_set_bb_dirty (BASIC_BLOCK_FOR_FN (cfun, EXIT_BLOCK));
}
bitmap_clear (&refs);
}
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 5ece3f6..e9d2265 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -884,10 +884,10 @@ nearest_common_dominator_for_set (enum cdi_direction dir, bitmap blocks)
basic_block dom;

first = bitmap_first_set_bit (blocks);
- dom = BASIC_BLOCK (first);
+ dom = BASIC_BLOCK_FOR_FN (cfun, first);
EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
- if (dom != BASIC_BLOCK (i))
- dom = nearest_common_dominator (dir, dom, BASIC_BLOCK (i));
+ if (dom != BASIC_BLOCK_FOR_FN (cfun, i))
+ dom = nearest_common_dominator (dir, dom, BASIC_BLOCK_FOR_FN (cfun, i));

return dom;
}
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 2c1ca21..8928c85 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3337,7 +3337,7 @@ hoist_code (void)
data->max_reg_pressure[pressure_class] += nregs;
EXECUTE_IF_SET_IN_BITMAP (hoisted_bbs, 0, k, bi)
{
- data = BB_DATA (BASIC_BLOCK (k));
+ data = BB_DATA (BASIC_BLOCK_FOR_FN (cfun, k));
data->max_reg_pressure[pressure_class] += nregs;
}
}
@@ -3348,7 +3348,7 @@ hoist_code (void)
hoisted. */
EXECUTE_IF_SET_IN_BITMAP (hoisted_bbs, 0, k, bi)
{
- data = BB_DATA (BASIC_BLOCK (k));
+ data = BB_DATA (BASIC_BLOCK_FOR_FN (cfun, k));
bitmap_copy (data->live_in, data->backup);
data->max_reg_pressure[pressure_class]
= data->old_pressure;
diff --git a/gcc/graph.c b/gcc/graph.c
index b75135a..3f02cab 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -164,7 +164,7 @@ draw_cfg_nodes_no_loops (pretty_printer *pp, struct function *fun)
for (i = n_basic_blocks_for_fn (fun) - n;
i < n_basic_blocks_for_fn (fun); i++)
{
- basic_block bb = BASIC_BLOCK (rpo[i]);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, rpo[i]);
draw_cfg_node (pp, fun->funcdef_no, bb);
bitmap_set_bit (visited, bb->index);
}
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index ad6fe8f..e4ef9d4 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2152,7 +2152,7 @@ param_change_prob (gimple stmt, int i)
max = 1;

EXECUTE_IF_SET_IN_BITMAP (info.bb_set, 0, index, bi)
- max = MIN (max, BASIC_BLOCK (index)->frequency);
+ max = MIN (max, BASIC_BLOCK_FOR_FN (cfun, index)->frequency);

BITMAP_FREE (info.bb_set);
if (max < bb->frequency)
@@ -2408,7 +2408,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
nblocks = pre_and_rev_post_order_compute (NULL, order, false);
for (n = 0; n < nblocks; n++)
{
- bb = BASIC_BLOCK (order[n]);
+ bb = BASIC_BLOCK_FOR_FN (cfun, order[n]);
freq = compute_call_stmt_bb_frequency (node->decl, bb);

/* TODO: Obviously predicates can be propagated down across CFG. */
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index d2e2d6f..eca86da 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -362,7 +362,8 @@ dominated_by_forbidden (basic_block bb)

EXECUTE_IF_SET_IN_BITMAP (forbidden_dominators, 1, dom_bb, bi)
{
- if (dominated_by_p (CDI_DOMINATORS, bb, BASIC_BLOCK (dom_bb)))
+ if (dominated_by_p (CDI_DOMINATORS, bb,
+ BASIC_BLOCK_FOR_FN (cfun, dom_bb)))
return true;
}

diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 557915f..9910b4e 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -2370,7 +2370,7 @@ apply_opt_in_copies (struct opt_info *opt_info,

for (i = opt_info->first_new_block; i < (unsigned) last_basic_block; i++)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
orig_bb = get_bb_original (bb);

/* bb->aux holds position in copy sequence initialized by
@@ -2446,7 +2446,7 @@ apply_opt_in_copies (struct opt_info *opt_info,
get_bb_copy (get_bb_original (bb)) == bb. */
for (i = opt_info->first_new_block; i < (unsigned) last_basic_block; i++)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
orig_bb = get_bb_original (bb);
if (get_bb_copy (orig_bb) != bb)
continue;
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index e67bc35..6c9d622 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1647,7 +1647,7 @@ decompose_multiword_subregs (bool decompose_copies)
rtx insn, end;
edge fallthru;

- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
insn = BB_HEAD (bb);
end = BB_END (bb);

diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index efc19f2..d2082fe 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -1001,7 +1001,7 @@ lra_create_live_ranges (bool all_p)
lra_assert (n_blocks_inverted == n_basic_blocks_for_fn (cfun));
for (i = n_blocks_inverted - 1; i >= 0; --i)
{
- bb = BASIC_BLOCK (post_order_rev_cfg[i]);
+ bb = BASIC_BLOCK_FOR_FN (cfun, post_order_rev_cfg[i]);
if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb
== ENTRY_BLOCK_PTR_FOR_FN (cfun))
continue;
diff --git a/gcc/predict.c b/gcc/predict.c
index e959a3b..1dec4dc 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2596,7 +2596,7 @@ propagate_freq (basic_block head, bitmap tovisit)
edge_iterator ei;
int count = 0;

- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);

FOR_EACH_EDGE (e, ei, bb->preds)
{
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 5e86fa5..ac8b0f3 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -696,7 +696,7 @@ regrename_analyze (bitmap bb_mask)

for (i = 0; i < n_bbs; i++)
{
- basic_block bb1 = BASIC_BLOCK (inverse_postorder[i]);
+ basic_block bb1 = BASIC_BLOCK_FOR_FN (cfun, inverse_postorder[i]);
struct bb_rename_info *this_info;
bool success;
edge e;
diff --git a/gcc/regstat.c b/gcc/regstat.c
index 85678a7..48d27c3 100644
--- a/gcc/regstat.c
+++ b/gcc/regstat.c
@@ -120,7 +120,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
bitmap local_live, bitmap local_processed,
int *local_live_last_luid)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn;
df_ref *def_rec;
df_ref *use_rec;
@@ -440,7 +440,7 @@ regstat_get_setjmp_crosses (void)
static void
regstat_bb_compute_calls_crossed (unsigned int bb_index, bitmap live)
{
- basic_block bb = BASIC_BLOCK (bb_index);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
rtx insn;
df_ref *def_rec;
df_ref *use_rec;
diff --git a/gcc/resource.c b/gcc/resource.c
index 4609c3a..3106a09 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -918,7 +918,8 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
information, we can get it from there unless the insn at the
start of the basic block has been deleted. */
if (tinfo && tinfo->block != -1
- && ! INSN_DELETED_P (BB_HEAD (BASIC_BLOCK (tinfo->block))))
+ && ! INSN_DELETED_P (BB_HEAD (BASIC_BLOCK_FOR_FN (cfun,
+ tinfo->block))))
b = tinfo->block;
}

@@ -958,7 +959,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
to use the LR problem. Otherwise, we must assume everything is live. */
if (b != -1)
{
- regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
+ regset regs_live = DF_LR_IN (BASIC_BLOCK_FOR_FN (cfun, b));
rtx start_insn, stop_insn;

/* Compute hard regs live at start of block. */
@@ -967,7 +968,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
/* Get starting and ending insn, handling the case where each might
be a SEQUENCE. */
start_insn = (b == ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb->index ?
- insns : BB_HEAD (BASIC_BLOCK (b)));
+ insns : BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, b)));
stop_insn = target;

if (NONJUMP_INSN_P (start_insn)
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 955501a..73af0a7 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -737,7 +737,7 @@ ebb_fix_recovery_cfg (int bbi ATTRIBUTE_UNUSED, int jump_bbi,
gcc_assert (last_bb->index != bbi);

if (jump_bb_nexti == last_bb->index)
- last_bb = BASIC_BLOCK (jump_bbi);
+ last_bb = BASIC_BLOCK_FOR_FN (cfun, jump_bbi);
}

#endif /* INSN_SCHEDULING */
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 84b5cb5..22ece1d 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -1416,8 +1416,9 @@ extern int *containing_rgn;
/* The mapping from ebb to block. */
extern int *ebb_head;
#define BB_TO_BLOCK(ebb) (rgn_bb_table[ebb_head[ebb]])
-#define EBB_FIRST_BB(ebb) BASIC_BLOCK (BB_TO_BLOCK (ebb))
-#define EBB_LAST_BB(ebb) BASIC_BLOCK (rgn_bb_table[ebb_head[ebb + 1] - 1])
+#define EBB_FIRST_BB(ebb) BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (ebb))
+#define EBB_LAST_BB(ebb) \
+ BASIC_BLOCK_FOR_FN (cfun, rgn_bb_table[ebb_head[ebb + 1] - 1])
#define INSN_BB(INSN) (BLOCK_TO_BB (BLOCK_NUM (INSN)))

extern int current_nr_blocks;
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 1663e2f..2d8b939 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -401,7 +401,8 @@ debug_region (int rgn)

for (bb = 0; bb < rgn_table[rgn].rgn_nr_blocks; bb++)
{
- dump_bb (stderr, BASIC_BLOCK (rgn_bb_table[current_blocks + bb]),
+ dump_bb (stderr,
+ BASIC_BLOCK_FOR_FN (cfun, rgn_bb_table[current_blocks + bb]),
0, TDF_SLIM | TDF_BLOCKS);
fprintf (stderr, "\n");
}
@@ -440,7 +441,7 @@ dump_region_dot (FILE *f, int rgn)
edge e;
edge_iterator ei;
int src_bb_num = rgn_bb_table[current_blocks + i];
- basic_block bb = BASIC_BLOCK (src_bb_num);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, src_bb_num);

FOR_EACH_EDGE (e, ei, bb->succs)
if (bb_in_region_p (e->dest->index, rgn))
@@ -554,7 +555,7 @@ too_large (int block, int *num_bbs, int *num_insns)
{
(*num_bbs)++;
(*num_insns) += (common_sched_info->estimate_number_of_insns
- (BASIC_BLOCK (block)));
+ (BASIC_BLOCK_FOR_FN (cfun, block)));

return ((*num_bbs > PARAM_VALUE (PARAM_MAX_SCHED_REGION_BLOCKS))
|| (*num_insns > PARAM_VALUE (PARAM_MAX_SCHED_REGION_INSNS)));
@@ -948,7 +949,8 @@ haifa_find_rgns (void)
edge e;
child = queue[++head];

- FOR_EACH_EDGE (e, ei, BASIC_BLOCK (child)->preds)
+ FOR_EACH_EDGE (e, ei,
+ BASIC_BLOCK_FOR_FN (cfun, child)->preds)
{
node = e->src->index;

@@ -1005,7 +1007,9 @@ haifa_find_rgns (void)
CONTAINING_RGN (child) = nr_regions;
queue[head] = queue[tail--];

- FOR_EACH_EDGE (e, ei, BASIC_BLOCK (child)->succs)
+ FOR_EACH_EDGE (e, ei,
+ BASIC_BLOCK_FOR_FN (cfun,
+ child)->succs)
if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
--degree[e->dest->index];
}
@@ -1200,7 +1204,7 @@ extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
{
int hdr = -1;

- FOR_EACH_EDGE (e, ei, BASIC_BLOCK (bbn)->preds)
+ FOR_EACH_EDGE (e, ei, BASIC_BLOCK_FOR_FN (cfun, bbn)->preds)
{
int predn = e->src->index;

@@ -1304,7 +1308,7 @@ extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)
CONTAINING_RGN (bbn) = nr_regions;
BLOCK_TO_BB (bbn) = 0;

- FOR_EACH_EDGE (e, ei, BASIC_BLOCK (bbn)->succs)
+ FOR_EACH_EDGE (e, ei, BASIC_BLOCK_FOR_FN (cfun, bbn)->succs)
if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
degree[e->dest->index]--;

@@ -1361,7 +1365,8 @@ extend_rgns (int *degree, int *idxp, sbitmap header, int *loop_hdr)

idx++;

- FOR_EACH_EDGE (e, ei, BASIC_BLOCK (succn)->succs)
+ FOR_EACH_EDGE (e, ei,
+ BASIC_BLOCK_FOR_FN (cfun, succn)->succs)
if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
degree[e->dest->index]--;
}
@@ -1420,7 +1425,8 @@ compute_dom_prob_ps (int bb)
/* Initialize dom[bb] to '111..1'. */
bitmap_ones (dom[bb]);

- FOR_EACH_EDGE (in_edge, in_ei, BASIC_BLOCK (BB_TO_BLOCK (bb))->preds)
+ FOR_EACH_EDGE (in_edge, in_ei,
+ BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (bb))->preds)
{
int pred_bb;
edge out_edge;
@@ -1838,7 +1844,8 @@ update_live (rtx insn, int src)
(bb_from == bb_to \
|| IS_RGN_ENTRY (bb_from) \
|| (bitmap_bit_p (ancestor_edges[bb_to], \
- EDGE_TO_BIT (single_pred_edge (BASIC_BLOCK (BB_TO_BLOCK (bb_from)))))))
+ EDGE_TO_BIT (single_pred_edge (BASIC_BLOCK_FOR_FN (cfun, \
+ BB_TO_BLOCK (bb_from)))))))

/* Turns on the fed_by_spec_load flag for insns fed by load_insn. */

@@ -2655,7 +2662,7 @@ deps_join (struct deps_desc *succ_deps, struct deps_desc *pred_deps)
static void
propagate_deps (int bb, struct deps_desc *pred_deps)
{
- basic_block block = BASIC_BLOCK (BB_TO_BLOCK (bb));
+ basic_block block = BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (bb));
edge_iterator ei;
edge e;

@@ -2864,7 +2871,8 @@ sched_is_disabled_for_current_region_p (void)
int bb;

for (bb = 0; bb < current_nr_blocks; bb++)
- if (!(BASIC_BLOCK (BB_TO_BLOCK (bb))->flags & BB_DISABLE_SCHEDULE))
+ if (!(BASIC_BLOCK_FOR_FN (cfun,
+ BB_TO_BLOCK (bb))->flags & BB_DISABLE_SCHEDULE))
return false;

return true;
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index a965c4d..57b28a0 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -873,7 +873,7 @@ extern void debug_bb_n_slim (int);
DEBUG_FUNCTION void
debug_bb_n_slim (int n)
{
- basic_block bb = BASIC_BLOCK (n);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, n);
debug_bb_slim (bb);
}

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 7dfc703..da84cce 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3075,7 +3075,7 @@ sel_finish_global_and_expr (void)
bbs.create (current_nr_blocks);

for (i = 0; i < current_nr_blocks; i++)
- bbs.quick_push (BASIC_BLOCK (BB_TO_BLOCK (i)));
+ bbs.quick_push (BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i)));

/* Clear AV_SETs and INSN_EXPRs. */
{
@@ -3627,7 +3627,7 @@ verify_backedges (void)
edge_iterator ei;

for (i = 0; i < current_nr_blocks; i++)
- FOR_EACH_EDGE (e, ei, BASIC_BLOCK (BB_TO_BLOCK (i))->succs)
+ FOR_EACH_EDGE (e, ei, BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i))->succs)
if (in_current_region_p (e->dest)
&& BLOCK_TO_BB (e->dest->index) < i)
n++;
@@ -3897,7 +3897,7 @@ purge_empty_blocks (void)
/* Do not attempt to delete the first basic block in the region. */
for (i = 1; i < current_nr_blocks; )
{
- basic_block b = BASIC_BLOCK (BB_TO_BLOCK (i));
+ basic_block b = BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i));

if (maybe_tidy_empty_bb (b))
continue;
@@ -6346,7 +6346,7 @@ sel_remove_loop_preheader (void)
/* Add blocks that aren't within the current loop to PREHEADER_BLOCKS. */
for (i = 0; i < RGN_NR_BLOCKS (cur_rgn); i++)
{
- bb = BASIC_BLOCK (BB_TO_BLOCK (i));
+ bb = BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i));

/* If the basic block belongs to region, but doesn't belong to
corresponding loop, then it should be a preheader. */
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 1195f7e..3e1fd96 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4903,7 +4903,8 @@ remove_insns_that_need_bookkeeping (fence_t fence, av_set_t *av_ptr)
&& (EXPR_SPEC (expr)
|| !EXPR_ORIG_BB_INDEX (expr)
|| !dominated_by_p (CDI_DOMINATORS,
- BASIC_BLOCK (EXPR_ORIG_BB_INDEX (expr)),
+ BASIC_BLOCK_FOR_FN (cfun,
+ EXPR_ORIG_BB_INDEX (expr)),
BLOCK_FOR_INSN (FENCE_INSN (fence)))))
{
if (sched_verbose >= 4)
@@ -6886,7 +6887,7 @@ current_region_empty_p (void)
{
int i;
for (i = 0; i < current_nr_blocks; i++)
- if (! sel_bb_empty_p (BASIC_BLOCK (BB_TO_BLOCK (i))))
+ if (! sel_bb_empty_p (BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i))))
return false;

return true;
@@ -6945,7 +6946,7 @@ sel_region_init (int rgn)
bbs.create (current_nr_blocks);

for (i = 0; i < current_nr_blocks; i++)
- bbs.quick_push (BASIC_BLOCK (BB_TO_BLOCK (i)));
+ bbs.quick_push (BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i)));

sel_init_bbs (bbs);

@@ -6980,13 +6981,14 @@ sel_region_init (int rgn)
compute_live for the first insn of the loop. */
if (current_loop_nest)
{
- int header = (sel_is_loop_preheader_p (BASIC_BLOCK (BB_TO_BLOCK (0)))
- ? 1
- : 0);
+ int header =
+ (sel_is_loop_preheader_p (BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (0)))
+ ? 1
+ : 0);

if (current_nr_blocks == header + 1)
update_liveness_on_insn
- (sel_bb_head (BASIC_BLOCK (BB_TO_BLOCK (header))));
+ (sel_bb_head (BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (header))));
}

/* Set hooks so that no newly generated insn will go out unnoticed. */
@@ -7024,7 +7026,7 @@ simplify_changed_insns (void)

for (i = 0; i < current_nr_blocks; i++)
{
- basic_block bb = BASIC_BLOCK (BB_TO_BLOCK (i));
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (i));
rtx insn;

FOR_BB_INSNS (bb, insn)
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index b2adc3d..39715b8 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2993,7 +2993,7 @@ execute_tm_mark (void)
&& sub & GTMA_MAY_ENTER_IRREVOCABLE)
continue;
}
- expand_block_tm (r, BASIC_BLOCK (i));
+ expand_block_tm (r, BASIC_BLOCK_FOR_FN (cfun, i));
}
}

@@ -3184,7 +3184,7 @@ execute_tm_edges (void)

FOR_EACH_VEC_ELT (bb_regions, i, r)
if (r != NULL)
- expand_block_edges (r, BASIC_BLOCK (i));
+ expand_block_edges (r, BASIC_BLOCK_FOR_FN (cfun, i));

bb_regions.release ();

@@ -3700,7 +3700,7 @@ tm_memopt_compute_antic (struct tm_region *region,
unsigned int i;
bitmap_iterator bi;
EXECUTE_IF_SET_IN_BITMAP (region->exit_blocks, 0, i, bi)
- BB_VISITED_P (BASIC_BLOCK (i)) = true;
+ BB_VISITED_P (BASIC_BLOCK_FOR_FN (cfun, i)) = true;
}

qin = worklist;
@@ -4572,7 +4572,8 @@ ipa_tm_scan_irr_function (struct cgraph_node *node, bool for_clone)
unsigned i;

EXECUTE_IF_SET_IN_BITMAP (new_irr, 0, i, bmi)
- ipa_tm_decrement_clone_counts (BASIC_BLOCK (i), for_clone);
+ ipa_tm_decrement_clone_counts (BASIC_BLOCK_FOR_FN (cfun, i),
+ for_clone);

if (old_irr)
{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 2d7916b..a706730 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -672,7 +672,8 @@ make_edges (void)

/* Create an edge from entry to the first block with executable
statements in it. */
- make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), BASIC_BLOCK (NUM_FIXED_BLOCKS),
+ make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun),
+ BASIC_BLOCK_FOR_FN (cfun, NUM_FIXED_BLOCKS),
EDGE_FALLTHRU);

/* Traverse the basic block array placing edges. */
@@ -943,7 +944,7 @@ end_recording_case_labels (void)
edge_to_cases = NULL;
EXECUTE_IF_SET_IN_BITMAP (touched_switch_bbs, 0, i, bi)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
if (bb)
{
gimple stmt = last_stmt (bb);
@@ -1027,7 +1028,8 @@ label_to_block_fn (struct function *ifun, tree dest)
and undefined variable warnings quite right. */
if (seen_error () && uid < 0)
{
- gimple_stmt_iterator gsi = gsi_start_bb (BASIC_BLOCK (NUM_FIXED_BLOCKS));
+ gimple_stmt_iterator gsi =
+ gsi_start_bb (BASIC_BLOCK_FOR_FN (cfun, NUM_FIXED_BLOCKS));
gimple stmt;

stmt = gimple_build_label (dest);
@@ -2082,8 +2084,8 @@ gimple_debug_bb (basic_block bb)
basic_block
gimple_debug_bb_n (int n)
{
- gimple_debug_bb (BASIC_BLOCK (n));
- return BASIC_BLOCK (n);
+ gimple_debug_bb (BASIC_BLOCK_FOR_FN (cfun, n));
+ return BASIC_BLOCK_FOR_FN (cfun, n);
}


@@ -7476,7 +7478,7 @@ gimple_flow_call_edges_add (sbitmap blocks)
return or not... */
for (i = 0; i < last_bb; i++)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
gimple_stmt_iterator gsi;
gimple stmt, last_stmt;

@@ -7605,7 +7607,7 @@ remove_edge_and_dominated_blocks (edge e)

EXECUTE_IF_SET_IN_BITMAP (df, 0, i, bi)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
bitmap_set_bit (df_idom,
get_immediate_dominator (CDI_DOMINATORS, bb)->index);
}
@@ -7643,7 +7645,7 @@ remove_edge_and_dominated_blocks (edge e)
the dominance frontier of E. Therefore, Y belongs to DF_IDOM. */
EXECUTE_IF_SET_IN_BITMAP (df_idom, 0, i, bi)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
for (dbb = first_dom_son (CDI_DOMINATORS, bb);
dbb;
dbb = next_dom_son (CDI_DOMINATORS, dbb))
@@ -7696,7 +7698,7 @@ gimple_purge_all_dead_eh_edges (const_bitmap blocks)

EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);

/* Earlier gimple_purge_dead_eh_edges could have removed
this basic block already. */
@@ -7753,7 +7755,7 @@ gimple_purge_all_dead_abnormal_call_edges (const_bitmap blocks)

EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);

/* Earlier gimple_purge_dead_abnormal_call_edges could have removed
this basic block already. */
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index ab8a394..76d9749 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -551,7 +551,7 @@ fixup_noreturn_call (gimple stmt)
SET_USE (use_p, error_mark_node);
}
EXECUTE_IF_SET_IN_BITMAP (blocks, 0, bb_index, bi)
- delete_basic_block (BASIC_BLOCK (bb_index));
+ delete_basic_block (BASIC_BLOCK_FOR_FN (cfun, bb_index));
BITMAP_FREE (blocks);
release_ssa_name (op);
}
@@ -586,7 +586,7 @@ split_bbs_on_noreturn_calls (void)
if (bb == NULL
|| bb->index < NUM_FIXED_BLOCKS
|| bb->index >= last_basic_block
- || BASIC_BLOCK (bb->index) != bb
+ || BASIC_BLOCK_FOR_FN (cfun, bb->index) != bb
|| !gimple_call_noreturn_p (stmt))
continue;

@@ -645,7 +645,7 @@ cleanup_tree_cfg_1 (void)
n = last_basic_block;
for (i = NUM_FIXED_BLOCKS; i < n; i++)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
if (bb)
retval |= cleanup_tree_cfg_bb (bb);
}
@@ -658,7 +658,7 @@ cleanup_tree_cfg_1 (void)
if (i < NUM_FIXED_BLOCKS)
continue;

- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
if (!bb)
continue;

diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index abc216d..1d1bc1e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2547,12 +2547,13 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
for (; last < last_basic_block; last++)
{
if (need_debug_cleanup)
- maybe_move_debug_stmts_to_successors (id, BASIC_BLOCK (last));
- BASIC_BLOCK (last)->aux = NULL;
+ maybe_move_debug_stmts_to_successors (id,
+ BASIC_BLOCK_FOR_FN (cfun, last));
+ BASIC_BLOCK_FOR_FN (cfun, last)->aux = NULL;
/* Update call edge destinations. This can not be done before loop
info is updated, because we may split basic blocks. */
if (id->transform_call_graph_edges == CB_CGE_DUPLICATE)
- redirect_all_calls (id, BASIC_BLOCK (last));
+ redirect_all_calls (id, BASIC_BLOCK_FOR_FN (cfun, last));
}
entry_block_map->aux = NULL;
exit_block_map->aux = NULL;
@@ -4443,11 +4444,11 @@ static void
fold_marked_statements (int first, struct pointer_set_t *statements)
{
for (; first < n_basic_blocks_for_fn (cfun); first++)
- if (BASIC_BLOCK (first))
+ if (BASIC_BLOCK_FOR_FN (cfun, first))
{
gimple_stmt_iterator gsi;

- for (gsi = gsi_start_bb (BASIC_BLOCK (first));
+ for (gsi = gsi_start_bb (BASIC_BLOCK_FOR_FN (cfun, first));
!gsi_end_p (gsi);
gsi_next (&gsi))
if (pointer_set_contains (statements, gsi_stmt (gsi)))
@@ -4473,7 +4474,7 @@ fold_marked_statements (int first, struct pointer_set_t *statements)
break;
}
if (gsi_end_p (i2))
- i2 = gsi_start_bb (BASIC_BLOCK (first));
+ i2 = gsi_start_bb (BASIC_BLOCK_FOR_FN (cfun, first));
else
gsi_next (&i2);
while (1)
@@ -4497,7 +4498,8 @@ fold_marked_statements (int first, struct pointer_set_t *statements)
is mood anyway. */
if (maybe_clean_or_replace_eh_stmt (old_stmt,
new_stmt))
- gimple_purge_dead_eh_edges (BASIC_BLOCK (first));
+ gimple_purge_dead_eh_edges (
+ BASIC_BLOCK_FOR_FN (cfun, first));
break;
}
gsi_next (&i2);
@@ -4517,7 +4519,8 @@ fold_marked_statements (int first, struct pointer_set_t *statements)
new_stmt);

if (maybe_clean_or_replace_eh_stmt (old_stmt, new_stmt))
- gimple_purge_dead_eh_edges (BASIC_BLOCK (first));
+ gimple_purge_dead_eh_edges (BASIC_BLOCK_FOR_FN (cfun,
+ first));
}
}
}
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 0067cfe..ac10440 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -558,7 +558,7 @@ set_livein_block (tree var, basic_block bb)

if (def_block_index == -1
|| ! dominated_by_p (CDI_DOMINATORS, bb,
- BASIC_BLOCK (def_block_index)))
+ BASIC_BLOCK_FOR_FN (cfun, def_block_index)))
info->need_phi_state = NEED_PHI_STATE_MAYBE;
}
else
@@ -821,7 +821,7 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
adef = 1;
EXECUTE_IF_SET_IN_BITMAP (to_remove, 0, i, bi)
{
- def_bb = BASIC_BLOCK (i);
+ def_bb = BASIC_BLOCK_FOR_FN (cfun, i);
defs[adef].bb_index = i;
defs[adef].dfs_num = bb_dom_dfs_in (CDI_DOMINATORS, def_bb);
defs[adef + 1].bb_index = i;
@@ -895,7 +895,8 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
p = b;
else
{
- use_bb = get_immediate_dominator (CDI_DOMINATORS, BASIC_BLOCK (b));
+ use_bb = get_immediate_dominator (CDI_DOMINATORS,
+ BASIC_BLOCK_FOR_FN (cfun, b));
p = find_dfsnum_interval (defs, n_defs,
bb_dom_dfs_in (CDI_DOMINATORS, use_bb));
if (!bitmap_bit_p (phis, p))
@@ -907,7 +908,7 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses)
continue;

/* Add the new uses to the worklist. */
- def_bb = BASIC_BLOCK (p);
+ def_bb = BASIC_BLOCK_FOR_FN (cfun, p);
FOR_EACH_EDGE (e, ei, def_bb->preds)
{
u = e->src->index;
@@ -1004,7 +1005,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
/* And insert the PHI nodes. */
EXECUTE_IF_SET_IN_BITMAP (phi_insertion_points, 0, bb_index, bi)
{
- bb = BASIC_BLOCK (bb_index);
+ bb = BASIC_BLOCK_FOR_FN (cfun, bb_index);
if (update_p)
mark_block_for_update (bb);

@@ -3021,8 +3022,9 @@ insert_updated_phi_nodes_for (tree var, bitmap_head *dfs, bitmap blocks,
db->def_blocks);
if (entry != ENTRY_BLOCK_PTR_FOR_FN (cfun))
EXECUTE_IF_SET_IN_BITMAP (idf, 0, i, bi)
- if (BASIC_BLOCK (i) != entry
- && dominated_by_p (CDI_DOMINATORS, BASIC_BLOCK (i), entry))
+ if (BASIC_BLOCK_FOR_FN (cfun, i) != entry
+ && dominated_by_p (CDI_DOMINATORS,
+ BASIC_BLOCK_FOR_FN (cfun, i), entry))
bitmap_set_bit (pruned_idf, i);
}
else
@@ -3054,7 +3056,7 @@ insert_updated_phi_nodes_for (tree var, bitmap_head *dfs, bitmap blocks,
{
edge e;
edge_iterator ei;
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);

FOR_EACH_EDGE (e, ei, bb->preds)
if (e->src->index >= 0)
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 82005af..ebdf511 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -902,7 +902,7 @@ tree_ssa_dominator_optimize (void)
iterator. */
EXECUTE_IF_SET_IN_BITMAP (need_eh_cleanup, 0, i, bi)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
if (bb == NULL)
continue;
while (single_succ_p (bb)
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 8ad5d9a..5d1a3b9 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1057,7 +1057,7 @@ live_worklist (tree_live_info_p live)
while (live->stack_top != live->work_stack)
{
b = *--(live->stack_top);
- loe_visit_block (live, BASIC_BLOCK (b), visited, tmp);
+ loe_visit_block (live, BASIC_BLOCK_FOR_FN (cfun, b), visited, tmp);
}

BITMAP_FREE (tmp);
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index e1d55ff..de667ad 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -202,7 +202,7 @@ compute_live_loop_exits (bitmap live_exits, bitmap use_blocks,

EXECUTE_IF_SET_IN_BITMAP (use_blocks, 0, i, bi)
{
- basic_block use_bb = BASIC_BLOCK (i);
+ basic_block use_bb = BASIC_BLOCK_FOR_FN (cfun, i);
struct loop *use_loop = use_bb->loop_father;
gcc_checking_assert (def_loop != use_loop
&& ! flow_loop_nested_p (def_loop, use_loop));
@@ -325,7 +325,7 @@ add_exit_phis_var (tree var, bitmap use_blocks, bitmap *loop_exits)

EXECUTE_IF_SET_IN_BITMAP (live_exits, 0, index, bi)
{
- add_exit_phi (BASIC_BLOCK (index), var);
+ add_exit_phi (BASIC_BLOCK_FOR_FN (cfun, index), var);
}

BITMAP_FREE (live_exits);
@@ -461,7 +461,7 @@ find_uses_to_rename (bitmap changed_bbs, bitmap *use_blocks, bitmap need_phis)

if (changed_bbs)
EXECUTE_IF_SET_IN_BITMAP (changed_bbs, 0, index, bi)
- find_uses_to_rename_bb (BASIC_BLOCK (index), use_blocks, need_phis);
+ find_uses_to_rename_bb (BASIC_BLOCK_FOR_FN (cfun, index), use_blocks, need_phis);
else
FOR_EACH_BB (bb)
find_uses_to_rename_bb (bb, use_blocks, need_phis);
@@ -729,13 +729,13 @@ copy_phi_node_args (unsigned first_new_block)
unsigned i;

for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- BASIC_BLOCK (i)->flags |= BB_DUPLICATED;
+ BASIC_BLOCK_FOR_FN (cfun, i)->flags |= BB_DUPLICATED;

for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- add_phi_args_after_copy_bb (BASIC_BLOCK (i));
+ add_phi_args_after_copy_bb (BASIC_BLOCK_FOR_FN (cfun, i));

for (i = first_new_block; i < (unsigned) last_basic_block; i++)
- BASIC_BLOCK (i)->flags &= ~BB_DUPLICATED;
+ BASIC_BLOCK_FOR_FN (cfun, i)->flags &= ~BB_DUPLICATED;
}


diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index f9ac337..dcce38a 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2487,7 +2487,7 @@ compute_antic (void)
{
if (bitmap_bit_p (changed_blocks, postorder[i]))
{
- basic_block block = BASIC_BLOCK (postorder[i]);
+ basic_block block = BASIC_BLOCK_FOR_FN (cfun, postorder[i]);
changed |= compute_antic_aux (block,
bitmap_bit_p (has_abnormal_preds,
block->index));
@@ -2516,7 +2516,7 @@ compute_antic (void)
{
if (bitmap_bit_p (changed_blocks, postorder[i]))
{
- basic_block block = BASIC_BLOCK (postorder[i]);
+ basic_block block = BASIC_BLOCK_FOR_FN (cfun, postorder[i]);
changed
|= compute_partial_antic_aux (block,
bitmap_bit_p (has_abnormal_preds,
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 7145559..9108983 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -2028,7 +2028,8 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange,
{
operand_entry_t oe = (*ops)[range->idx];
tree op = oe->op;
- gimple stmt = op ? SSA_NAME_DEF_STMT (op) : last_stmt (BASIC_BLOCK (oe->id));
+ gimple stmt = op ? SSA_NAME_DEF_STMT (op) :
+ last_stmt (BASIC_BLOCK_FOR_FN (cfun, oe->id));
location_t loc = gimple_location (stmt);
tree optype = op ? TREE_TYPE (op) : boolean_type_node;
tree tem = build_range_check (loc, optype, exp, in_p, low, high);
@@ -2281,7 +2282,8 @@ optimize_range_tests (enum tree_code opcode,
oe = (*ops)[i];
ranges[i].idx = i;
init_range_entry (ranges + i, oe->op,
- oe->op ? NULL : last_stmt (BASIC_BLOCK (oe->id)));
+ oe->op ? NULL :
+ last_stmt (BASIC_BLOCK_FOR_FN (cfun, oe->id)));
/* For | invert it now, we will invert it again before emitting
the optimized expression. */
if (opcode == BIT_IOR_EXPR
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index 947a58a..ecc1f6b 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -182,10 +182,10 @@ nearest_common_dominator_of_uses (gimple stmt, bool *debug_stmts)
bitmap_set_bit (blocks, useblock->index);
}
}
- commondom = BASIC_BLOCK (bitmap_first_set_bit (blocks));
+ commondom = BASIC_BLOCK_FOR_FN (cfun, bitmap_first_set_bit (blocks));
EXECUTE_IF_SET_IN_BITMAP (blocks, 0, j, bi)
commondom = nearest_common_dominator (CDI_DOMINATORS, commondom,
- BASIC_BLOCK (j));
+ BASIC_BLOCK_FOR_FN (cfun, j));
BITMAP_FREE (blocks);
return commondom;
}
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index d722a9b..fbcbf78 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -454,7 +454,7 @@ same_succ_hash (const_same_succ e)
int flags;
unsigned int i;
unsigned int first = bitmap_first_set_bit (e->bbs);
- basic_block bb = BASIC_BLOCK (first);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, first);
int size = 0;
gimple_stmt_iterator gsi;
gimple stmt;
@@ -502,8 +502,8 @@ same_succ_hash (const_same_succ e)

EXECUTE_IF_SET_IN_BITMAP (e->succs, 0, s, bs)
{
- int n = find_edge (bb, BASIC_BLOCK (s))->dest_idx;
- for (gsi = gsi_start_phis (BASIC_BLOCK (s)); !gsi_end_p (gsi);
+ int n = find_edge (bb, BASIC_BLOCK_FOR_FN (cfun, s))->dest_idx;
+ for (gsi = gsi_start_phis (BASIC_BLOCK_FOR_FN (cfun, s)); !gsi_end_p (gsi);
gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
@@ -572,8 +572,8 @@ same_succ_def::equal (const value_type *e1, const compare_type *e2)
first1 = bitmap_first_set_bit (e1->bbs);
first2 = bitmap_first_set_bit (e2->bbs);

- bb1 = BASIC_BLOCK (first1);
- bb2 = BASIC_BLOCK (first2);
+ bb1 = BASIC_BLOCK_FOR_FN (cfun, first1);
+ bb2 = BASIC_BLOCK_FOR_FN (cfun, first2);

if (BB_SIZE (bb1) != BB_SIZE (bb2))
return 0;
@@ -834,7 +834,7 @@ same_succ_flush_bbs (bitmap bbs)
bitmap_iterator bi;

EXECUTE_IF_SET_IN_BITMAP (bbs, 0, i, bi)
- same_succ_flush_bb (BASIC_BLOCK (i));
+ same_succ_flush_bb (BASIC_BLOCK_FOR_FN (cfun, i));
}

/* Release the last vdef in BB, either normal or phi result. */
@@ -887,7 +887,7 @@ update_worklist (void)
same = same_succ_alloc ();
EXECUTE_IF_SET_IN_BITMAP (deleted_bb_preds, 0, i, bi)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
gcc_assert (bb != NULL);
find_same_succ_bb (bb, &same);
if (same == NULL)
@@ -1075,7 +1075,7 @@ set_cluster (basic_block bb1, basic_block bb2)
merge = BB_CLUSTER (bb1);
merge_clusters (merge, old);
EXECUTE_IF_SET_IN_BITMAP (old->bbs, 0, i, bi)
- BB_CLUSTER (BASIC_BLOCK (i)) = merge;
+ BB_CLUSTER (BASIC_BLOCK_FOR_FN (cfun, i)) = merge;
all_clusters[old->index] = NULL;
update_rep_bb (merge, old->rep_bb);
delete_cluster (old);
@@ -1320,7 +1320,7 @@ same_phi_alternatives (same_succ same_succ, basic_block bb1, basic_block bb2)

EXECUTE_IF_SET_IN_BITMAP (same_succ->succs, 0, s, bs)
{
- succ = BASIC_BLOCK (s);
+ succ = BASIC_BLOCK_FOR_FN (cfun, s);
e1 = find_edge (bb1, succ);
e2 = find_edge (bb2, succ);
if (e1->flags & EDGE_COMPLEX
@@ -1406,7 +1406,7 @@ find_clusters_1 (same_succ same_succ)

EXECUTE_IF_SET_IN_BITMAP (same_succ->bbs, 0, i, bi)
{
- bb1 = BASIC_BLOCK (i);
+ bb1 = BASIC_BLOCK_FOR_FN (cfun, i);

/* TODO: handle blocks with phi-nodes. We'll have to find corresponding
phi-nodes in bb1 and bb2, with the same alternatives for the same
@@ -1417,7 +1417,7 @@ find_clusters_1 (same_succ same_succ)
nr_comparisons = 0;
EXECUTE_IF_SET_IN_BITMAP (same_succ->bbs, i + 1, j, bj)
{
- bb2 = BASIC_BLOCK (j);
+ bb2 = BASIC_BLOCK_FOR_FN (cfun, j);

if (bb_has_non_vop_phi (bb2))
continue;
@@ -1573,7 +1573,7 @@ apply_clusters (void)
bitmap_clear_bit (c->bbs, bb2->index);
EXECUTE_IF_SET_IN_BITMAP (c->bbs, 0, j, bj)
{
- bb1 = BASIC_BLOCK (j);
+ bb1 = BASIC_BLOCK_FOR_FN (cfun, j);
bitmap_clear_bit (update_bbs, bb1->index);

replace_block_by (bb1, bb2);
@@ -1633,7 +1633,7 @@ update_debug_stmts (void)
gimple stmt;
gimple_stmt_iterator gsi;

- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
stmt = gsi_stmt (gsi);
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index ad727a1..9289c11 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -1412,7 +1412,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
{
EXECUTE_IF_SET_IN_BITMAP (tmp, 0, i, bi)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
if (EDGE_COUNT (bb->preds) > 1
&& !redirection_block_p (bb))
{
@@ -1442,7 +1442,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
by trimming off the end of the jump thread path. */
EXECUTE_IF_SET_IN_BITMAP (tmp, 0, i, bi)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->aux)
@@ -1512,7 +1512,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
we have to iterate on those rather than the threaded_edges vector. */
EXECUTE_IF_SET_IN_BITMAP (tmp, 0, i, bi)
{
- bb = BASIC_BLOCK (i);
+ bb = BASIC_BLOCK_FOR_FN (cfun, i);
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->aux)
@@ -1592,7 +1592,7 @@ thread_through_all_blocks (bool may_peel_loop_headers)
loop structure. */
EXECUTE_IF_SET_IN_BITMAP (threaded_blocks, 0, i, bi)
{
- basic_block bb = BASIC_BLOCK (i);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, i);

if (EDGE_COUNT (bb->preds) > 0)
retval |= thread_block (bb, true);
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 44194b8..92652de 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -214,7 +214,8 @@ associate_equivalences_with_edges (void)
equivalency = XNEW (struct edge_equivalency);
equivalency->rhs = x;
equivalency->lhs = cond;
- find_edge (bb, BASIC_BLOCK (i))->aux = equivalency;
+ find_edge (bb, BASIC_BLOCK_FOR_FN (cfun, i))->aux =
+ equivalency;
}
}
free (info);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index d9da996..785e72f 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5975,7 +5975,7 @@ find_assert_locations (void)
need_asserts = false;
for (i = rpo_cnt - 1; i >= 0; --i)
{
- basic_block bb = BASIC_BLOCK (rpo[i]);
+ basic_block bb = BASIC_BLOCK_FOR_FN (cfun, rpo[i]);
edge e;
edge_iterator ei;
--
1.7.11.7
Richard Biener
2013-12-06 15:41:38 UTC
Permalink
Post by David Malcolm
I have a series of 13 follow-up patches which remove the remaining
"cfun"-using macros from basic-block.h
Successfully bootstrapped&regtested on x86_64-unknown-linux-gnu.
These were pre-approved in stage1, and are mechanical in nature [1]
I'd like to apply these to trunk now, but given that we're now in
stage3, do I need to wait until the next stage1?
No, its ok now.
Post by David Malcolm
The first 4 patches rename various "_for_function|_FOR_FUNCTION"
macros to "_for_fn|_FOR_FN" for consistency with the earlier
patches in this thread.
The remaining patches eliminate cfun-using macros in favor of
the "_for_fn|_FOR_FN" variant, making uses of cfun explicit.
There are still some macros in function.h that implicitly use
cfun, but it's less clear what to replace them with.
Note to self: here's a grep invocation for ensuring that no new
for m in \
basic_block_info_for_function BASIC_BLOCK_FOR_FUNCTION \
SET_BASIC_BLOCK_FOR_FUNCTION last_basic_block_for_function \
label_to_block_map_for_function profile_status_for_function \
SET_BASIC_BLOCK BASIC_BLOCK basic_block_info label_to_block_map \
profile_status last_basic_block FOR_EACH_BB FOR_EACH_BB_REVERSE \
FOR_ALL_BB ;
do
grep -nH -E -w $m \
gcc/*.[ch] gcc/config/*.[ch] gcc/config/*/*.{c,h,md} ;
done
(this currently has 11 false-positives)
After the patches the macros should be removed so that no new uses appear.

Thanks, Richard.
Post by David Malcolm
[1] with one exception, in patch 10 in gcc/ira-emit.c (ira_emit) where
I introduced a new local to avoid overlong lines.
Rename macros (basic_block_info_for_function,
BASIC_BLOCK_FOR_FUNCTION, SET_BASIC_BLOCK_FOR_FUNCTION)
Rename last_basic_block_for_function to last_basic_block_for_fn.
Rename label_to_block_map_for_function to label_to_block_map_for_fn.
Rename profile_status_for_function to profile_status_for_fn.
Eliminate SET_BASIC_BLOCK macro.
Eliminate BASIC_BLOCK macro.
Eliminate basic_block_info macro.
Eliminate label_to_block_map macro.
Eliminate profile_status macro.
Eliminate last_basic_block macro.
Eliminate FOR_EACH_BB macro.
Eliminate FOR_EACH_BB_REVERSE macro.
Eliminate FOR_ALL_BB macro.
gcc/alias.c | 2 +-
gcc/asan.c | 6 +-
gcc/auto-inc-dec.c | 2 +-
gcc/basic-block.h | 32 +++------
gcc/bb-reorder.c | 29 ++++----
gcc/bt-load.c | 45 ++++++------
gcc/caller-save.c | 8 +--
gcc/cfg.c | 32 ++++-----
gcc/cfganal.c | 35 +++++-----
gcc/cfgbuild.c | 12 ++--
gcc/cfgcleanup.c | 6 +-
gcc/cfgexpand.c | 14 ++--
gcc/cfghooks.c | 16 ++---
gcc/cfgloop.c | 20 +++---
gcc/cfgloopanal.c | 8 +--
gcc/cfgloopmanip.c | 6 +-
gcc/cfgrtl.c | 61 ++++++++--------
gcc/cgraphbuild.c | 8 +--
gcc/combine-stack-adj.c | 2 +-
gcc/combine.c | 8 +--
gcc/config/arm/arm.c | 4 +-
gcc/config/bfin/bfin.c | 4 +-
gcc/config/c6x/c6x.c | 6 +-
gcc/config/epiphany/resolve-sw-modes.c | 6 +-
gcc/config/frv/frv.c | 8 +--
gcc/config/i386/i386.c | 2 +-
gcc/config/ia64/ia64.c | 6 +-
gcc/config/mips/mips.c | 8 +--
gcc/config/picochip/picochip.c | 2 +-
gcc/config/rs6000/rs6000.c | 2 +-
gcc/config/s390/s390.c | 4 +-
gcc/config/sh/sh.c | 2 +-
gcc/config/spu/spu.c | 6 +-
gcc/config/tilegx/tilegx.c | 4 +-
gcc/config/tilepro/tilepro.c | 4 +-
gcc/coverage.c | 2 +-
gcc/cprop.c | 23 ++++---
gcc/cse.c | 8 +--
gcc/dce.c | 10 +--
gcc/df-core.c | 68 +++++++++---------
gcc/df-problems.c | 54 +++++++--------
gcc/df-scan.c | 42 ++++++-----
gcc/df.h | 2 +-
gcc/dominance.c | 37 +++++-----
gcc/domwalk.c | 2 +-
gcc/dse.c | 14 ++--
gcc/except.c | 2 +-
gcc/final.c | 6 +-
gcc/function.c | 16 ++---
gcc/gcse.c | 54 ++++++++-------
gcc/gimple-iterator.c | 2 +-
gcc/gimple-ssa-isolate-paths.c | 4 +-
gcc/gimple-streamer-in.c | 4 +-
gcc/gimple.c | 8 ++-
gcc/graph.c | 6 +-
gcc/graphite-scop-detection.c | 6 +-
gcc/graphite-sese-to-poly.c | 6 +-
gcc/graphite.c | 6 +-
gcc/haifa-sched.c | 4 +-
gcc/hw-doloop.c | 6 +-
gcc/ifcvt.c | 2 +-
gcc/init-regs.c | 2 +-
gcc/internal-fn.c | 6 +-
gcc/ipa-inline-analysis.c | 4 +-
gcc/ipa-prop.c | 2 +-
gcc/ipa-pure-const.c | 2 +-
gcc/ipa-split.c | 13 ++--
gcc/ipa-utils.c | 8 +--
gcc/ira-build.c | 15 ++--
gcc/ira-costs.c | 2 +-
gcc/ira-emit.c | 24 ++++---
gcc/ira.c | 42 ++++++-----
gcc/jump.c | 2 +-
gcc/lcm.c | 115
++++++++++++++++++-------------
gcc/loop-init.c | 6 +-
gcc/loop-invariant.c | 2 +-
gcc/loop-unroll.c | 16 +++--
gcc/lower-subreg.c | 8 +--
gcc/lra-assigns.c | 2 +-
gcc/lra-coalesce.c | 4 +-
gcc/lra-constraints.c | 4 +-
gcc/lra-eliminations.c | 2 +-
gcc/lra-lives.c | 4 +-
gcc/lra-spills.c | 6 +-
gcc/lra.c | 10 +--
gcc/lto-streamer-in.c | 28 ++++----
gcc/lto-streamer-out.c | 8 +--
gcc/mcf.c | 4 +-
gcc/mode-switching.c | 27 ++++----
gcc/modulo-sched.c | 2 +-
gcc/omp-low.c | 6 +-
gcc/optabs.c | 2 +-
gcc/postreload-gcse.c | 4 +-
gcc/postreload.c | 4 +-
gcc/predict.c | 54 +++++++--------
gcc/profile.c | 12 ++--
gcc/recog.c | 6 +-
gcc/ree.c | 2 +-
gcc/reg-stack.c | 6 +-
gcc/regcprop.c | 8 +--
gcc/reginfo.c | 2 +-
gcc/regrename.c | 12 ++--
gcc/regstat.c | 8 +--
gcc/reload1.c | 10 +--
gcc/resource.c | 13 ++--
gcc/sched-ebb.c | 4 +-
gcc/sched-int.h | 5 +-
gcc/sched-rgn.c | 103
+++++++++++++++------------
gcc/sched-vis.c | 2 +-
gcc/sel-sched-dump.c | 2 +-
gcc/sel-sched-ir.c | 35 +++++-----
gcc/sel-sched.c | 22 +++---
gcc/sese.c | 6 +-
gcc/stack-ptr-mod.c | 2 +-
gcc/store-motion.c | 38 +++++-----
gcc/testsuite/g++.dg/plugin/selfassign.c | 2 +-
gcc/testsuite/gcc.dg/plugin/selfassign.c | 2 +-
gcc/tracer.c | 8 +--
gcc/trans-mem.c | 15 ++--
gcc/tree-call-cdce.c | 2 +-
gcc/tree-cfg.c | 108
+++++++++++++++--------------
gcc/tree-cfgcleanup.c | 16 ++---
gcc/tree-complex.c | 6 +-
gcc/tree-dfa.c | 6 +-
gcc/tree-eh.c | 6 +-
gcc/tree-emutls.c | 2 +-
gcc/tree-if-conv.c | 2 +-
gcc/tree-inline.c | 32 +++++----
gcc/tree-into-ssa.c | 45 ++++++------
gcc/tree-loop-distribution.c | 2 +-
gcc/tree-nrv.c | 6 +-
gcc/tree-object-size.c | 2 +-
gcc/tree-outof-ssa.c | 6 +-
gcc/tree-profile.c | 2 +-
gcc/tree-scalar-evolution.c | 2 +-
gcc/tree-sra.c | 14 ++--
gcc/tree-ssa-ccp.c | 6 +-
gcc/tree-ssa-coalesce.c | 6 +-
gcc/tree-ssa-copy.c | 2 +-
gcc/tree-ssa-copyrename.c | 4 +-
gcc/tree-ssa-dce.c | 13 ++--
gcc/tree-ssa-dom.c | 8 +--
gcc/tree-ssa-forwprop.c | 2 +-
gcc/tree-ssa-live.c | 32 ++++-----
gcc/tree-ssa-loop-im.c | 8 +--
gcc/tree-ssa-loop-manip.c | 24 +++----
gcc/tree-ssa-math-opts.c | 10 +--
gcc/tree-ssa-pre.c | 16 ++---
gcc/tree-ssa-propagate.c | 8 +--
gcc/tree-ssa-reassoc.c | 8 ++-
gcc/tree-ssa-sccvn.c | 2 +-
gcc/tree-ssa-sink.c | 4 +-
gcc/tree-ssa-structalias.c | 4 +-
gcc/tree-ssa-tail-merge.c | 32 ++++-----
gcc/tree-ssa-ter.c | 2 +-
gcc/tree-ssa-threadupdate.c | 10 +--
gcc/tree-ssa-uncprop.c | 9 +--
gcc/tree-ssa-uninit.c | 4 +-
gcc/tree-ssa.c | 6 +-
gcc/tree-stdarg.c | 8 +--
gcc/tree-switch-conversion.c | 2 +-
gcc/tree-vect-generic.c | 2 +-
gcc/tree-vectorizer.c | 6 +-
gcc/tree-vrp.c | 20 +++---
gcc/tsan.c | 2 +-
gcc/ubsan.c | 2 +-
gcc/value-prof.c | 6 +-
gcc/var-tracking.c | 28 ++++----
gcc/vtable-verify.c | 2 +-
gcc/web.c | 6 +-
170 files changed, 1112 insertions(+), 1030 deletions(-)
David Malcolm
2013-12-09 21:49:23 UTC
Permalink
Post by Richard Biener
Post by David Malcolm
I have a series of 13 follow-up patches which remove the remaining
"cfun"-using macros from basic-block.h
Successfully bootstrapped&regtested on x86_64-unknown-linux-gnu.
These were pre-approved in stage1, and are mechanical in nature [1]
I'd like to apply these to trunk now, but given that we're now in
stage3, do I need to wait until the next stage1?
No, its ok now.
Thanks; as noted elsewhere, I've committed these now.

[...]
Post by Richard Biener
After the patches the macros should be removed so that no new uses appear.
Done.
Loading...