On Thu, 2014-11-13 at 11:45 +0100, Richard Biener wrote: > On Thu, Nov 13, 2014 at 2:41 AM, David Malcolm <[email protected]> wrote: > > On Tue, 2014-11-11 at 11:43 +0100, Richard Biener wrote: > >> On Tue, Nov 11, 2014 at 8:26 AM, Jakub Jelinek <[email protected]> wrote: > >> > On Mon, Nov 10, 2014 at 05:27:50PM -0500, David Malcolm wrote: > >> >> On Sat, 2014-11-08 at 14:56 +0100, Jakub Jelinek wrote: > >> >> > On Sat, Nov 08, 2014 at 01:07:28PM +0100, Richard Biener wrote: > >> >> > > To be constructive here - the above case is from within a > >> >> > > GIMPLE_ASSIGN case label > >> >> > > and thus I'd have expected > >> >> > > > >> >> > > case GIMPLE_ASSIGN: > >> >> > > { > >> >> > > gassign *a1 = as_a <gassign *> (s1); > >> >> > > gassign *a2 = as_a <gassign *> (s2); > >> >> > > lhs1 = gimple_assign_lhs (a1); > >> >> > > lhs2 = gimple_assign_lhs (a2); > >> >> > > if (TREE_CODE (lhs1) != SSA_NAME > >> >> > > && TREE_CODE (lhs2) != SSA_NAME) > >> >> > > return (operand_equal_p (lhs1, lhs2, 0) > >> >> > > && gimple_operand_equal_value_p (gimple_assign_rhs1 > >> >> > > (a1), > >> >> > > gimple_assign_rhs1 > >> >> > > (a2))); > >> >> > > else if (TREE_CODE (lhs1) == SSA_NAME > >> >> > > && TREE_CODE (lhs2) == SSA_NAME) > >> >> > > return vn_valueize (lhs1) == vn_valueize (lhs2); > >> >> > > return false; > >> >> > > } > >> >> > > > >> >> > > instead. That's the kind of changes I have expected and have > >> >> > > approved of. > >> >> > > >> >> > But even that looks like just adding extra work for all developers, > >> >> > with no > >> >> > gain. You only have to add extra code and extra temporaries, in > >> >> > switches > >> >> > typically also have to add {} because of the temporaries and thus > >> >> > extra > >> >> > indentation level, and it doesn't simplify anything in the code. > >> >> > >> >> The branch attempts to use the C++ typesystem to capture information > >> >> about the kinds of gimple statement we expect, both: > >> >> (A) so that the compiler can detect type errors, and > >> >> (B) as a comprehension aid to the human reader of the code > >> >> > >> >> The ideal here is when function params and struct field can be > >> >> strengthened from "gimple" to a subclass ptr. This captures the > >> >> knowledge that every use of a function or within a struct has a given > >> >> gimple code. > >> > > >> > I just don't like all the as_a/is_a stuff enforced everywhere, > >> > it means more typing, more temporaries, more indentation. > >> > So, as I view it, instead of the checks being done cheaply (yes, I think > >> > the gimple checking as we have right now is very cheap) under the > >> > hood by the accessors (gimple_assign_{lhs,rhs1} etc.), those changes > >> > put the burden on the developers, who has to check that manually through > >> > the as_a/is_a stuff everywhere, more typing and uglier syntax. > >> > I just don't see that as a step forward, instead a huge step backwards. > >> > But perhaps I'm alone with this. > >> > Can you e.g. compare the size of - lines in your patchset combined, and > >> > size of + lines in your patchset? As in, if your changes lead to less > >> > typing or more. > >> > >> I see two ways out here. One is to add overloads to all the functions > >> taking the special types like > >> > >> tree > >> gimple_assign_rhs1 (gimple *); > >> > >> or simply add > >> > >> gassign *operator ()(gimple *g) { return as_a <gassign *> (g); } > >> > >> into a gimple-compat.h header which you include in places that > >> are not converted "nicely". > > > > Thanks for the suggestions. > > > > Am I missing something, or is the gimple-compat.h idea above not valid C > > ++? > > > > Note that "gimple" is still a typedef to > > gimple_statement_base * > > (as noted before, the gimple -> gimple * change would break everyone > > else's patches, so we talked about that as a followup patch for early > > stage3). > > > > Given that, if I try to create an "operator ()" outside of a class, I > > get this error: > > > > ‘gassign* operator()(gimple)’ must be a nonstatic member function > > > > which is emitted from cp/decl.c's grok_op_properties: > > /* An operator function must either be a non-static member function > > or have at least one parameter of a class, a reference to a class, > > an enumeration, or a reference to an enumeration. 13.4.0.6 */ > > > > I tried making it a member function of gimple_statement_base, but that > > doesn't work either: we want a conversion > > from a gimple_statement_base * to a gassign *, not > > from a gimple_statement_base to a gassign *. > > > > Is there some syntactic trick here that I'm missing? Sorry if I'm being > > dumb (I can imagine there's a way of doing it by making "gimple" become > > some kind of wrapped ptr class, but that way lies madness, surely). > > Hmm. > > struct assign; > struct base { > operator assign *() const { return (assign *)this; } > }; > struct assign : base { > }; > > void foo (assign *); > void bar (base *b) > { > foo (b); > } > > doesn't work, but > > void bar (base &b) > { > foo (b); > } > > does. Indeed C++ doesn't seem to provide what is necessary > for the compat trick :( > > So the gimple-compat.h header would need to provide > additional overloads for the affected functions like > > inline tree > gimple_assign_rhs1 (gimple *g) > { > return gimple_assign_rhs1 (as_a <gassign *> (g)); > } > > that would work for me as well. > > >> Both avoid manually making the compiler happy (which the > >> explicit as_a<> stuff is! It doesn't add any "checking" - it's > >> just placing the as_a<> at the callers and thus make the > >> runtine ICE fire there). > >> > >> As much as I don't like "global" conversion operators I don't > >> like adding overloads to all of the accessor functions even more. > > > > (nods) > > > > Some other options: > > > > Option 3: only convert the "easy" accessors: the ones I already did in > > the /89 patch kit, as reviewed by Jeff, and rebased by me recently, > > which is this 92-patch kit: > > "[gimple-classes, committed 00/92] Initial slew of commits": > > https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02791.html > > Doing so converts about half of the gimple_foo_ accessors to taking a > > gfoo *, giving a mixture of GIMPLE_CHECK vs subclass use. I believe > > the quality of those patches was higher than the later ones on the > > branch: I was doing the places that didn't require the invasive/verbose > > changes seen in the later patches. Shelve the remaining ~80 > > increasingly ugly patches, starting a new branch to contain just the > > good ones. > > > > > > Option 4: don't convert any accessors, but instead focus on fields of > > structs (e.g. "call_stmt" within a cgraph_edge), and on params of other > > functions (e.g. phi-manipulation code). That way we'd avoid the > > inconsistency of some accessors using GIMPLE_CHECK and some using > > subclasses - all would continue to consistently use GIMPLE_CHECK, but > > there would be some extra type-checking and self-documentation of the > > expected statement kinds in the code. > > > > > > > > FWIW, option 3 is my preferred approach (I've already done the bulk of > > the work and it's already been reviewed; it would need an update merger > > from trunk, and there's the big gimple to gimple * fixup you wanted). > > Works for me as well. The compat solution looks somewhat appealing > as we can then incrementally fix up things rather than requiring to > mass-convert everything. > > Thanks, > Richard.
I still prefer option 3 above (i.e. go with the patches Jeff reviewed, with the fixups discussed earlier, with a merger from trunk), but I had a go at implementing your gimple-compat.h idea. Attached is a patch against e74b2ecd78d21fc7bcc2f50dacc92819e0e69e6b on the gimple-classes branch (the last commit before I went overboard with the as_a changes), which converts the remaining gimple_assign_ accessors to take a gassign *, adding a gimple-compat.h to provide overloaded accessors taking just a gimple for those source files that needed them. It also strengthens some places I spotted where converting params, locals or fields from gimple to gassign * was simple and obvious. Successfully bootstrapped®rtested on x86_64-unknown-linux-gnu, comparing the branch+patch against master r216746 (2014-10-27). This only covers gimple_assign_; it would still be a hybrid of is-a and GIMPLE_CHECK unless I extended the patch to cover all the other accessors. Do you want me to continue converting things for gimple-compat.h to see what a set of patches for that approach looks like? If so, would it be better to split things out and have a gimple-compat-assign.h, gimple-compat-call.h etc rather than one big gimple-compat.h? That said, I still prefer option 3. > >> Whether you enable them generally or just for selected files > >> via a gimple-compat.h will be up to you (but I'd rather get > >> rid of them at some point). > >> > >> Note this allows seamless transform of "random" functions > >> taking a gimple now but really only expecting a single kind. > >> > >> Note that we don't absolutely have to rush this all in for GCC 5. > >> Being the very first for GCC 6 stage1 is another possibility. > >> We just should get it right. > > > > Thanks > > Dave > >
>From 225ca0e9a4c37f4b0d259de2325a474c905bffd9 Mon Sep 17 00:00:00 2001 From: David Malcolm <[email protected]> Date: Thu, 13 Nov 2014 15:46:41 -0500 Subject: [PATCH] Add gimple-compat.h and port remaining gimple_assign accessors gcc/ChangeLog.gimple-classes: * gimple-compat.h: New file. * gimple.h (is_a_helper <const gassign *>::test): New. (gimple_assign_rhs_could_trap_p): Strengthen param "s" from gimple to gassign *s. (gimple_assign_set_lhs): Likewise for param "gs". (gimple_assign_set_rhs1): Likewise. (gimple_assign_set_rhs2): Likewise. (gimple_assign_set_rhs3): Likewise. (gimple_assign_set_nontemporal_move): Likewise. (gimple_assign_set_rhs_code): Likewise for param "s". (gimple_assign_lhs): Strengthen param "gs" from const_gimple to const gassign *. (gimple_assign_lhs_ptr): Likewise. (gimple_assign_rhs1): Likewise. (gimple_assign_rhs1_ptr): Likewise. (gimple_assign_rhs2): Likewise. (gimple_assign_rhs2_ptr): Likewise. (gimple_assign_rhs3): Likewise. (gimple_assign_rhs3_ptr): Likewise. (gimple_assign_rhs_code): Likewise. (gimple_assign_rhs_class): Likewise. (gimple_assign_single_p): Make typesafe. (gimple_assign_load_p): Likewise. (gimple_assign_cast_p): Likewise. (gimple_clobber_p): Likewise. (gimple_expr_type): Likewise, by introducing a const gassign * "assign" within the GIMPLE_ASSIGN "else" clause. Replace a gimple_get_lhs call with a gimple_assign_lhs. * asan.c: Include gimple-compat.h. (build_shadow_mem_access): Strengthen local "g" from gimple to gassign *. (maybe_create_ssa_name): Likewise. (maybe_cast_to_ptrmode): Likewise. (instrument_strlen_call): Likewise. (maybe_instrument_assignment): Likewise for local "s". * auto-profile.c: Include gimple-compat.h. * cfgexpand.c: Likewise. * expr.c: Likewise. * gimple-builder.c: Likewise. * gimple-fold.c: Likewise. * gimple-match-head.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-walk.c: Likewise. Remove redundant second include of gimple-walk.h. * gimple.c: Include gimple-compat.h. (gimple_assign_rhs_could_trap_p): Strengthen param "s" from gimple to gassign *s. * gimplify-me.c: Include gimple-compat.h. * graphite-sese-to-poly.c: Likewise. * ipa-icf-gimple.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * sese.c: Likewise. * trans-mem.c: Likewise. (tm_log_emit_saves): Strengthen local "stmt" from gimple to gassign *. * tree-affine.c: Include gimple-compat.h. * tree-call-cdce.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c (lower_emutls_1): Strengthen local "x" from gimple to gassign *. * tree-if-conv.c: Include gimple-compat.h. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-scalar-evolution.c: Likewise. (follow_ssa_edge_in_rhs): Strengthen param "stmt" from gimple to gassign *. (follow_ssa_edge): Add a checked cast to gassign * within case GIMPLE_ASSIGN. * tree-sra.c: Include gimple-compat.h. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c (struct switch_conv_info): Strengthen fields "arr_ref_first" and "arr_ref_last" from gimple to gassign *. (build_one_array): Likewise for local "load". (build_arrays): Likewise for local "stmt". * tree-vect-data-refs.c: Include gimple-compat.h. * tree-vect-generic.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. (vect_init_vector): Strengthen local "init_stmt" from gimple to gassign *. * tree-vrp.c: Include gimple-compat.h. * tsan.c: Likewise. * ubsan.c: Likewise. * value-prof.c: Likewise. * vtable-verify.c: Likewise. --- gcc/ChangeLog.gimple-classes | 139 ++++++++++++++++++++++++++++++++++++ gcc/asan.c | 11 +-- gcc/auto-profile.c | 1 + gcc/cfgexpand.c | 1 + gcc/expr.c | 1 + gcc/gimple-builder.c | 1 + gcc/gimple-compat.h | 123 +++++++++++++++++++++++++++++++ gcc/gimple-fold.c | 1 + gcc/gimple-match-head.c | 1 + gcc/gimple-ssa-isolate-paths.c | 1 + gcc/gimple-ssa-strength-reduction.c | 1 + gcc/gimple-walk.c | 2 +- gcc/gimple.c | 4 +- gcc/gimple.h | 98 ++++++++++++------------- gcc/gimplify-me.c | 1 + gcc/graphite-sese-to-poly.c | 1 + gcc/ipa-icf-gimple.c | 1 + gcc/ipa-inline-analysis.c | 1 + gcc/ipa-polymorphic-call.c | 1 + gcc/ipa-prop.c | 1 + gcc/ipa-split.c | 1 + gcc/omp-low.c | 1 + gcc/predict.c | 1 + gcc/sese.c | 1 + gcc/trans-mem.c | 3 +- gcc/tree-affine.c | 1 + gcc/tree-call-cdce.c | 2 + gcc/tree-complex.c | 1 + gcc/tree-data-ref.c | 1 + gcc/tree-eh.c | 1 + gcc/tree-emutls.c | 2 +- gcc/tree-if-conv.c | 1 + gcc/tree-inline.c | 1 + gcc/tree-into-ssa.c | 1 + gcc/tree-loop-distribution.c | 1 + gcc/tree-nested.c | 1 + gcc/tree-nrv.c | 1 + gcc/tree-object-size.c | 1 + gcc/tree-outof-ssa.c | 1 + gcc/tree-parloops.c | 1 + gcc/tree-predcom.c | 1 + gcc/tree-scalar-evolution.c | 5 +- gcc/tree-sra.c | 1 + gcc/tree-ssa-alias.c | 1 + gcc/tree-ssa-ccp.c | 1 + gcc/tree-ssa-coalesce.c | 1 + gcc/tree-ssa-copy.c | 1 + gcc/tree-ssa-copyrename.c | 1 + gcc/tree-ssa-dce.c | 1 + gcc/tree-ssa-dom.c | 1 + gcc/tree-ssa-dse.c | 1 + gcc/tree-ssa-forwprop.c | 1 + gcc/tree-ssa-ifcombine.c | 1 + gcc/tree-ssa-live.c | 1 + gcc/tree-ssa-loop-ch.c | 1 + gcc/tree-ssa-loop-im.c | 1 + gcc/tree-ssa-loop-ivcanon.c | 1 + gcc/tree-ssa-loop-ivopts.c | 1 + gcc/tree-ssa-loop-niter.c | 1 + gcc/tree-ssa-loop-prefetch.c | 1 + gcc/tree-ssa-math-opts.c | 1 + gcc/tree-ssa-phiopt.c | 1 + gcc/tree-ssa-phiprop.c | 1 + gcc/tree-ssa-pre.c | 1 + gcc/tree-ssa-propagate.c | 1 + gcc/tree-ssa-reassoc.c | 1 + gcc/tree-ssa-sccvn.c | 1 + gcc/tree-ssa-sink.c | 1 + gcc/tree-ssa-strlen.c | 1 + gcc/tree-ssa-structalias.c | 1 + gcc/tree-ssa-tail-merge.c | 1 + gcc/tree-ssa-ter.c | 1 + gcc/tree-ssa-threadedge.c | 1 + gcc/tree-ssa-uninit.c | 1 + gcc/tree-ssa.c | 1 + gcc/tree-stdarg.c | 1 + gcc/tree-switch-conversion.c | 8 +-- gcc/tree-vect-data-refs.c | 1 + gcc/tree-vect-generic.c | 1 + gcc/tree-vect-loop.c | 1 + gcc/tree-vect-patterns.c | 1 + gcc/tree-vect-slp.c | 1 + gcc/tree-vect-stmts.c | 3 +- gcc/tree-vrp.c | 1 + gcc/tsan.c | 1 + gcc/ubsan.c | 1 + gcc/value-prof.c | 1 + gcc/vtable-verify.c | 1 + 88 files changed, 406 insertions(+), 70 deletions(-) create mode 100644 gcc/gimple-compat.h diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 133965c..e78b4b0 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,3 +1,142 @@ +2014-11-13 David Malcolm <[email protected]> + + * gimple-compat.h: New file. + * gimple.h (is_a_helper <const gassign *>::test): New. + (gimple_assign_rhs_could_trap_p): Strengthen param "s" from gimple + to gassign *s. + (gimple_assign_set_lhs): Likewise for param "gs". + (gimple_assign_set_rhs1): Likewise. + (gimple_assign_set_rhs2): Likewise. + (gimple_assign_set_rhs3): Likewise. + (gimple_assign_set_nontemporal_move): Likewise. + (gimple_assign_set_rhs_code): Likewise for param "s". + (gimple_assign_lhs): Strengthen param "gs" from const_gimple to + const gassign *. + (gimple_assign_lhs_ptr): Likewise. + (gimple_assign_rhs1): Likewise. + (gimple_assign_rhs1_ptr): Likewise. + (gimple_assign_rhs2): Likewise. + (gimple_assign_rhs2_ptr): Likewise. + (gimple_assign_rhs3): Likewise. + (gimple_assign_rhs3_ptr): Likewise. + (gimple_assign_rhs_code): Likewise. + (gimple_assign_rhs_class): Likewise. + (gimple_assign_single_p): Make typesafe. + (gimple_assign_load_p): Likewise. + (gimple_assign_cast_p): Likewise. + (gimple_clobber_p): Likewise. + (gimple_expr_type): Likewise, by introducing a const gassign * + "assign" within the GIMPLE_ASSIGN "else" clause. Replace a + gimple_get_lhs call with a gimple_assign_lhs. + + * asan.c: Include gimple-compat.h. + (build_shadow_mem_access): Strengthen local "g" from gimple to + gassign *. + (maybe_create_ssa_name): Likewise. + (maybe_cast_to_ptrmode): Likewise. + (instrument_strlen_call): Likewise. + (maybe_instrument_assignment): Likewise for local "s". + * auto-profile.c: Include gimple-compat.h. + * cfgexpand.c: Likewise. + * expr.c: Likewise. + * gimple-builder.c: Likewise. + * gimple-fold.c: Likewise. + * gimple-match-head.c: Likewise. + * gimple-ssa-isolate-paths.c: Likewise. + * gimple-ssa-strength-reduction.c: Likewise. + * gimple-walk.c: Likewise. Remove redundant second include of + gimple-walk.h. + * gimple.c: Include gimple-compat.h. + (gimple_assign_rhs_could_trap_p): Strengthen param "s" from gimple + to gassign *s. + * gimplify-me.c: Include gimple-compat.h. + * graphite-sese-to-poly.c: Likewise. + * ipa-icf-gimple.c: Likewise. + * ipa-inline-analysis.c: Likewise. + * ipa-polymorphic-call.c: Likewise. + * ipa-prop.c: Likewise. + * ipa-split.c: Likewise. + * omp-low.c: Likewise. + * predict.c: Likewise. + * sese.c: Likewise. + * trans-mem.c: Likewise. + (tm_log_emit_saves): Strengthen local "stmt" from gimple to + gassign *. + * tree-affine.c: Include gimple-compat.h. + * tree-call-cdce.c: Likewise. + * tree-complex.c: Likewise. + * tree-data-ref.c: Likewise. + * tree-eh.c: Likewise. + * tree-emutls.c (lower_emutls_1): Strengthen local "x" from gimple + to gassign *. + * tree-if-conv.c: Include gimple-compat.h. + * tree-inline.c: Likewise. + * tree-into-ssa.c: Likewise. + * tree-loop-distribution.c: Likewise. + * tree-nested.c: Likewise. + * tree-nrv.c: Likewise. + * tree-object-size.c: Likewise. + * tree-outof-ssa.c: Likewise. + * tree-parloops.c: Likewise. + * tree-predcom.c: Likewise. + * tree-scalar-evolution.c: Likewise. + (follow_ssa_edge_in_rhs): Strengthen param "stmt" from gimple to + gassign *. + (follow_ssa_edge): Add a checked cast to gassign * within + case GIMPLE_ASSIGN. + * tree-sra.c: Include gimple-compat.h. + * tree-ssa-alias.c: Likewise. + * tree-ssa-ccp.c: Likewise. + * tree-ssa-coalesce.c: Likewise. + * tree-ssa-copy.c: Likewise. + * tree-ssa-copyrename.c: Likewise. + * tree-ssa-dce.c: Likewise. + * tree-ssa-dom.c: Likewise. + * tree-ssa-dse.c: Likewise. + * tree-ssa-forwprop.c: Likewise. + * tree-ssa-ifcombine.c: Likewise. + * tree-ssa-live.c: Likewise. + * tree-ssa-loop-ch.c: Likewise. + * tree-ssa-loop-im.c: Likewise. + * tree-ssa-loop-ivcanon.c: Likewise. + * tree-ssa-loop-ivopts.c: Likewise. + * tree-ssa-loop-niter.c: Likewise. + * tree-ssa-loop-prefetch.c: Likewise. + * tree-ssa-math-opts.c: Likewise. + * tree-ssa-phiopt.c: Likewise. + * tree-ssa-phiprop.c: Likewise. + * tree-ssa-pre.c: Likewise. + * tree-ssa-propagate.c: Likewise. + * tree-ssa-reassoc.c: Likewise. + * tree-ssa-sccvn.c: Likewise. + * tree-ssa-sink.c: Likewise. + * tree-ssa-strlen.c: Likewise. + * tree-ssa-structalias.c: Likewise. + * tree-ssa-tail-merge.c: Likewise. + * tree-ssa-ter.c: Likewise. + * tree-ssa-threadedge.c: Likewise. + * tree-ssa-uninit.c: Likewise. + * tree-ssa.c: Likewise. + * tree-stdarg.c: Likewise. + * tree-switch-conversion.c (struct switch_conv_info): Strengthen + fields "arr_ref_first" and "arr_ref_last" from gimple to + gassign *. + (build_one_array): Likewise for local "load". + (build_arrays): Likewise for local "stmt". + * tree-vect-data-refs.c: Include gimple-compat.h. + * tree-vect-generic.c: Likewise. + * tree-vect-loop.c: Likewise. + * tree-vect-patterns.c: Likewise. + * tree-vect-slp.c: Likewise. + * tree-vect-stmts.c: Likewise. + (vect_init_vector): Strengthen local "init_stmt" from gimple to + gassign *. + * tree-vrp.c: Include gimple-compat.h. + * tsan.c: Likewise. + * ubsan.c: Likewise. + * value-prof.c: Likewise. + * vtable-verify.c: Likewise. + 2014-10-28 David Malcolm <[email protected]> * auto-profile.c (autofdo::function_instance::find_icall_target_map): diff --git a/gcc/asan.c b/gcc/asan.c index 9a310b4..cb8d5d0 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -67,6 +67,7 @@ along with GCC; see the file COPYING3. If not see #include "ubsan.h" #include "params.h" #include "builtins.h" +#include "gimple-compat.h" /* AddressSanitizer finds out-of-bounds and use-after-free bugs with <2x slowdown on average. @@ -1523,7 +1524,7 @@ build_shadow_mem_access (gimple_stmt_iterator *gsi, location_t location, { tree t, uintptr_type = TREE_TYPE (base_addr); tree shadow_type = TREE_TYPE (shadow_ptr_type); - gimple g; + gassign *g; t = build_int_cst (uintptr_type, ASAN_SHADOW_SHIFT); g = gimple_build_assign_with_ops (RSHIFT_EXPR, @@ -1564,7 +1565,7 @@ maybe_create_ssa_name (location_t loc, tree base, gimple_stmt_iterator *iter, { if (TREE_CODE (base) == SSA_NAME) return base; - gimple g + gassign *g = gimple_build_assign_with_ops (TREE_CODE (base), make_ssa_name (TREE_TYPE (base), NULL), base, NULL_TREE); @@ -1585,7 +1586,7 @@ maybe_cast_to_ptrmode (location_t loc, tree len, gimple_stmt_iterator *iter, { if (ptrofftype_p (len)) return len; - gimple g + gassign *g = gimple_build_assign_with_ops (NOP_EXPR, make_ssa_name (pointer_sized_int_node, NULL), len, NULL); @@ -1854,7 +1855,7 @@ instrument_mem_region_access (tree base, tree len, static bool instrument_strlen_call (gimple_stmt_iterator *iter) { - gimple g; + gassign *g; gcall *call = as_a <gcall *> (gsi_stmt (*iter)); gcc_assert (is_gimple_call (call)); @@ -1980,7 +1981,7 @@ instrument_builtin_call (gimple_stmt_iterator *iter) static bool maybe_instrument_assignment (gimple_stmt_iterator *iter) { - gimple s = gsi_stmt (*iter); + gassign *s = as_a <gassign *> (gsi_stmt (*iter)); gcc_assert (gimple_assign_single_p (s)); diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index ba4e567..3dfe831 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -67,6 +67,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "stringpool.h" #include "auto-profile.h" +#include "gimple-compat.h" /* The following routines implements AutoFDO optimization. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index a2cb483..eed4354 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -85,6 +85,7 @@ along with GCC; see the file COPYING3. If not see #include "recog.h" #include "output.h" #include "builtins.h" +#include "gimple-compat.h" /* Some systems use __main in a way incompatible with its use in gcc, in these cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to diff --git a/gcc/expr.c b/gcc/expr.c index a5bf13a..7929725 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -75,6 +75,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-address.h" #include "cfgexpand.h" #include "builtins.h" +#include "gimple-compat.h" #ifndef STACK_PUSH_CODE #ifdef STACK_GROWS_DOWNWARD diff --git a/gcc/gimple-builder.c b/gcc/gimple-builder.c index a7c6c4e..aad2ce9 100644 --- a/gcc/gimple-builder.c +++ b/gcc/gimple-builder.c @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "is-a.h" #include "gimple.h" #include "tree-ssanames.h" +#include "gimple-compat.h" /* Return the expression type to use based on the CODE and type of diff --git a/gcc/gimple-compat.h b/gcc/gimple-compat.h new file mode 100644 index 0000000..cbc37a0 --- /dev/null +++ b/gcc/gimple-compat.h @@ -0,0 +1,123 @@ +/* Compatibility for source files using gimple accessors with base class. + + Copyright (C) 2014 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef GCC_GIMPLE_COMPAT_H +#define GCC_GIMPLE_COMPAT_H + +/* Compatibility implementations of various gimple_assign_ accessors, + taking a gimple/const_gimple rather than a gassign *. */ + +static inline tree +gimple_assign_lhs (const_gimple gs) +{ + return gimple_assign_lhs (as_a <const gassign *> (gs)); +} + +static inline tree * +gimple_assign_lhs_ptr (const_gimple gs) +{ + return gimple_assign_lhs_ptr (as_a <const gassign *> (gs)); +} + +static inline void +gimple_assign_set_lhs (gimple gs, tree lhs) +{ + gimple_assign_set_lhs (as_a <gassign *> (gs), lhs); +} + +static inline enum gimple_rhs_class +gimple_assign_rhs_class (const_gimple gs) +{ + return gimple_assign_rhs_class (as_a <const gassign *> (gs)); +} + +static inline tree +gimple_assign_rhs1 (const_gimple gs) +{ + return gimple_assign_rhs1 (as_a <const gassign *> (gs)); +} + +static inline tree * +gimple_assign_rhs1_ptr (const_gimple gs) +{ + return gimple_assign_rhs1_ptr (as_a <const gassign *> (gs)); +} + +static inline void +gimple_assign_set_rhs1 (gimple gs, tree rhs) +{ + gimple_assign_set_rhs1 (as_a <gassign *> (gs), rhs); +} + +static inline tree +gimple_assign_rhs2 (const_gimple gs) +{ + return gimple_assign_rhs2 (as_a <const gassign *> (gs)); +} + +static inline tree * +gimple_assign_rhs2_ptr (const_gimple gs) +{ + return gimple_assign_rhs2_ptr (as_a <const gassign *> (gs)); +} + +static inline void +gimple_assign_set_rhs2 (gimple gs, tree rhs) +{ + gimple_assign_set_rhs2 (as_a <gassign *> (gs), rhs); +} + +static inline tree +gimple_assign_rhs3 (const_gimple gs) +{ + return gimple_assign_rhs3 (as_a <const gassign *> (gs)); +} + +static inline void +gimple_assign_set_rhs3 (gimple gs, tree rhs) +{ + gimple_assign_set_rhs3 (as_a <gassign *> (gs), rhs); +} + +static inline void +gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal) +{ + gimple_assign_set_nontemporal_move (as_a <gassign *> (gs), nontemporal); +} + +static inline enum tree_code +gimple_assign_rhs_code (const_gimple gs) +{ + return gimple_assign_rhs_code (as_a <const gassign *> (gs)); +} + +static inline void +gimple_assign_set_rhs_code (gimple s, enum tree_code code) +{ + gimple_assign_set_rhs_code (as_a <gassign *> (s), code); +} + +static inline bool +gimple_assign_rhs_could_trap_p (gimple gs) +{ + return gimple_assign_rhs_could_trap_p (as_a <gassign *> (gs)); +} + +#endif /* GCC_GIMPLE_COMPAT_H */ diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 4b45648..9fe6b3a 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "output.h" #include "tree-eh.h" #include "gimple-match.h" +#include "gimple-compat.h" /* Return true when DECL can be referenced from current unit. FROM_DECL (if non-null) specify constructor of variable DECL was taken from. diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 9c6da59..12caa7e 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "ssa-iterators.h" #include "dumpfile.h" #include "gimple-match.h" +#include "gimple-compat.h" /* Forward declarations of the private auto-generated matchers. diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c index ea8ead0..04d7eca 100644 --- a/gcc/gimple-ssa-isolate-paths.c +++ b/gcc/gimple-ssa-isolate-paths.c @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "diagnostic-core.h" #include "intl.h" +#include "gimple-compat.h" static bool cfg_altered; diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 0831f92..bb6e7eb 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -76,6 +76,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-affine.h" #include "wide-int-print.h" #include "builtins.h" +#include "gimple-compat.h" /* Information about a strength reduction candidate. Each statement in the candidate table represents an expression of one of the diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index a6ea1ec..5f6abff 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -41,8 +41,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple.h" #include "gimple-iterator.h" #include "gimple-walk.h" -#include "gimple-walk.h" #include "demangle.h" +#include "gimple-compat.h" /* Walk all the statements in the sequence *PSEQ calling walk_gimple_stmt on each one. WI is as in walk_gimple_stmt. diff --git a/gcc/gimple.c b/gcc/gimple.c index 061a7a1..eb7f474 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "bitmap.h" #include "stringpool.h" #include "tree-ssanames.h" +#include "gimple-compat.h" /* All the tuples have their operand vector (if present) at the very bottom @@ -1947,9 +1948,8 @@ gimple_could_trap_p (gimple s) /* Return true if RHS of a GIMPLE_ASSIGN S can trap. */ bool -gimple_assign_rhs_could_trap_p (gimple s) +gimple_assign_rhs_could_trap_p (gassign *s) { - gcc_assert (is_gimple_assign (s)); return gimple_could_trap_p_1 (s, true, false); } diff --git a/gcc/gimple.h b/gcc/gimple.h index ccafde5..d87709f 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -1110,6 +1110,14 @@ is_a_helper <const gasm *>::test (const_gimple gs) template <> template <> inline bool +is_a_helper <const gassign *>::test (const_gimple gs) +{ + return gs->code == GIMPLE_ASSIGN; +} + +template <> +template <> +inline bool is_a_helper <const gbind *>::test (const_gimple gs) { return gs->code == GIMPLE_BIND; @@ -1376,7 +1384,7 @@ gimple gimple_copy (gimple); bool gimple_has_side_effects (const_gimple); bool gimple_could_trap_p_1 (gimple, bool, bool); bool gimple_could_trap_p (gimple); -bool gimple_assign_rhs_could_trap_p (gimple); +bool gimple_assign_rhs_could_trap_p (gassign *); extern void dump_gimple_statistics (void); unsigned get_gimple_rhs_num_ops (enum tree_code); extern tree canonicalize_cond_expr_cond (tree); @@ -2270,9 +2278,8 @@ get_gimple_rhs_class (enum tree_code code) /* Return the LHS of assignment statement GS. */ static inline tree -gimple_assign_lhs (const_gimple gs) +gimple_assign_lhs (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); return gimple_op (gs, 0); } @@ -2280,9 +2287,8 @@ gimple_assign_lhs (const_gimple gs) /* Return a pointer to the LHS of assignment statement GS. */ static inline tree * -gimple_assign_lhs_ptr (const_gimple gs) +gimple_assign_lhs_ptr (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); return gimple_op_ptr (gs, 0); } @@ -2290,9 +2296,8 @@ gimple_assign_lhs_ptr (const_gimple gs) /* Set LHS to be the LHS operand of assignment statement GS. */ static inline void -gimple_assign_set_lhs (gimple gs, tree lhs) +gimple_assign_set_lhs (gassign *gs, tree lhs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); gimple_set_op (gs, 0, lhs); if (lhs && TREE_CODE (lhs) == SSA_NAME) @@ -2303,9 +2308,8 @@ gimple_assign_set_lhs (gimple gs, tree lhs) /* Return the first operand on the RHS of assignment statement GS. */ static inline tree -gimple_assign_rhs1 (const_gimple gs) +gimple_assign_rhs1 (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); return gimple_op (gs, 1); } @@ -2314,19 +2318,16 @@ gimple_assign_rhs1 (const_gimple gs) statement GS. */ static inline tree * -gimple_assign_rhs1_ptr (const_gimple gs) +gimple_assign_rhs1_ptr (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); return gimple_op_ptr (gs, 1); } /* Set RHS to be the first operand on the RHS of assignment statement GS. */ static inline void -gimple_assign_set_rhs1 (gimple gs, tree rhs) +gimple_assign_set_rhs1 (gassign *gs, tree rhs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - gimple_set_op (gs, 1, rhs); } @@ -2335,10 +2336,8 @@ gimple_assign_set_rhs1 (gimple gs, tree rhs) If GS does not have two operands, NULL is returned instead. */ static inline tree -gimple_assign_rhs2 (const_gimple gs) +gimple_assign_rhs2 (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - if (gimple_num_ops (gs) >= 3) return gimple_op (gs, 2); else @@ -2350,9 +2349,8 @@ gimple_assign_rhs2 (const_gimple gs) statement GS. */ static inline tree * -gimple_assign_rhs2_ptr (const_gimple gs) +gimple_assign_rhs2_ptr (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); return gimple_op_ptr (gs, 2); } @@ -2360,10 +2358,8 @@ gimple_assign_rhs2_ptr (const_gimple gs) /* Set RHS to be the second operand on the RHS of assignment statement GS. */ static inline void -gimple_assign_set_rhs2 (gimple gs, tree rhs) +gimple_assign_set_rhs2 (gassign *gs, tree rhs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - gimple_set_op (gs, 2, rhs); } @@ -2371,10 +2367,8 @@ gimple_assign_set_rhs2 (gimple gs, tree rhs) If GS does not have two operands, NULL is returned instead. */ static inline tree -gimple_assign_rhs3 (const_gimple gs) +gimple_assign_rhs3 (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - if (gimple_num_ops (gs) >= 4) return gimple_op (gs, 3); else @@ -2385,9 +2379,8 @@ gimple_assign_rhs3 (const_gimple gs) statement GS. */ static inline tree * -gimple_assign_rhs3_ptr (const_gimple gs) +gimple_assign_rhs3_ptr (const gassign *gs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); return gimple_op_ptr (gs, 3); } @@ -2395,10 +2388,8 @@ gimple_assign_rhs3_ptr (const_gimple gs) /* Set RHS to be the third operand on the RHS of assignment statement GS. */ static inline void -gimple_assign_set_rhs3 (gimple gs, tree rhs) +gimple_assign_set_rhs3 (gassign *gs, tree rhs) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); - gimple_set_op (gs, 3, rhs); } @@ -2423,9 +2414,8 @@ gimple_assign_nontemporal_move_p (const gassign *gs) /* Sets nontemporal move flag of GS to NONTEMPORAL. */ static inline void -gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal) +gimple_assign_set_nontemporal_move (gassign *gs, bool nontemporal) { - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); gs->nontemporal_move = nontemporal; } @@ -2435,10 +2425,9 @@ gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal) tree code of the object. */ static inline enum tree_code -gimple_assign_rhs_code (const_gimple gs) +gimple_assign_rhs_code (const gassign *gs) { enum tree_code code; - GIMPLE_CHECK (gs, GIMPLE_ASSIGN); code = (enum tree_code) gs->subcode; /* While we initially set subcode to the TREE_CODE of the rhs for @@ -2455,9 +2444,8 @@ gimple_assign_rhs_code (const_gimple gs) assignment S. */ static inline void -gimple_assign_set_rhs_code (gimple s, enum tree_code code) +gimple_assign_set_rhs_code (gassign *s, enum tree_code code) { - GIMPLE_CHECK (s, GIMPLE_ASSIGN); s->subcode = code; } @@ -2467,7 +2455,7 @@ gimple_assign_set_rhs_code (gimple s, enum tree_code code) This will never return GIMPLE_INVALID_RHS. */ static inline enum gimple_rhs_class -gimple_assign_rhs_class (const_gimple gs) +gimple_assign_rhs_class (const gassign *gs) { return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); } @@ -2481,8 +2469,9 @@ gimple_assign_rhs_class (const_gimple gs) static inline bool gimple_assign_single_p (const_gimple gs) { - return (is_gimple_assign (gs) - && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); + if (const gassign *assign = dyn_cast <const gassign *> (gs)) + return gimple_assign_rhs_class (assign) == GIMPLE_SINGLE_RHS; + return false; } /* Return true if GS performs a store to its lhs. */ @@ -2502,7 +2491,7 @@ gimple_assign_load_p (const_gimple gs) tree rhs; if (!gimple_assign_single_p (gs)) return false; - rhs = gimple_assign_rhs1 (gs); + rhs = gimple_assign_rhs1 (as_a <const gassign *> (gs)); if (TREE_CODE (rhs) == WITH_SIZE_EXPR) return true; rhs = get_base_address (rhs); @@ -2518,7 +2507,7 @@ gimple_assign_cast_p (const_gimple s) { if (is_gimple_assign (s)) { - enum tree_code sc = gimple_assign_rhs_code (s); + enum tree_code sc = gimple_assign_rhs_code (as_a <const gassign *> (s)); return CONVERT_EXPR_CODE_P (sc) || sc == VIEW_CONVERT_EXPR || sc == FIX_TRUNC_EXPR; @@ -2533,7 +2522,7 @@ static inline bool gimple_clobber_p (const_gimple s) { return gimple_assign_single_p (s) - && TREE_CLOBBER_P (gimple_assign_rhs1 (s)); + && TREE_CLOBBER_P (gimple_assign_rhs1 (as_a <const gassign *> (s))); } /* Return true if GS is a GIMPLE_CALL. */ @@ -5626,17 +5615,20 @@ gimple_expr_type (const_gimple stmt) type = gimple_call_return_type (call_stmt); } else - switch (gimple_assign_rhs_code (stmt)) - { - case POINTER_PLUS_EXPR: - type = TREE_TYPE (gimple_assign_rhs1 (stmt)); - break; - - default: - /* As fallback use the type of the LHS. */ - type = TREE_TYPE (gimple_get_lhs (stmt)); - break; - } + { + const gassign *assign = as_a <const gassign *> (stmt); + switch (gimple_assign_rhs_code (assign)) + { + case POINTER_PLUS_EXPR: + type = TREE_TYPE (gimple_assign_rhs1 (assign)); + break; + + default: + /* As fallback use the type of the LHS. */ + type = TREE_TYPE (gimple_assign_lhs (assign)); + break; + } + } return type; } else if (code == GIMPLE_COND) diff --git a/gcc/gimplify-me.c b/gcc/gimplify-me.c index 9d969de..1009b2f 100644 --- a/gcc/gimplify-me.c +++ b/gcc/gimplify-me.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-ssa.h" #include "stringpool.h" #include "tree-ssanames.h" +#include "gimple-compat.h" /* Expand EXPR to list of gimple statements STMTS. GIMPLE_TEST_F specifies diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 16d1bb6..1c08c3c 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -86,6 +86,7 @@ extern "C" { #include "domwalk.h" #include "sese.h" #include "tree-ssa-propagate.h" +#include "gimple-compat.h" #ifdef HAVE_isl #include "expr.h" diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 9ebef25..ddf253a 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "ipa-icf-gimple.h" #include "ipa-icf.h" +#include "gimple-compat.h" namespace ipa_icf_gimple { diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index aa8a596..642e1b5 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -116,6 +116,7 @@ along with GCC; see the file COPYING3. If not see #include "ipa-utils.h" #include "cilk.h" #include "cfgexpand.h" +#include "gimple-compat.h" /* Estimate runtime of function can easilly run into huge numbers with many nested loops. Be sure we can compute time * INLINE_SIZE_SCALE * 2 in an diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index 3f2d303..9a69f7e 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -51,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "data-streamer.h" #include "lto-streamer.h" #include "streamer-hooks.h" +#include "gimple-compat.h" /* Return true when TYPE contains an polymorphic type and thus is interesting for devirtualization machinery. */ diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 47a8f03..41534a6 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see #include "domwalk.h" #include "builtins.h" #include "calls.h" +#include "gimple-compat.h" /* Intermediate information that we get from alias analysis about a particular parameter in a particular basic_block. When a parameter or the memory it diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 145aceb..1f6c9dc 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -122,6 +122,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-pretty-print.h" #include "ipa-inline.h" #include "cfgloop.h" +#include "gimple-compat.h" /* Per basic block info. */ diff --git a/gcc/omp-low.c b/gcc/omp-low.c index e53f4ff..da6fec3 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -81,6 +81,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-nested.h" #include "tree-eh.h" #include "cilk.h" +#include "gimple-compat.h" /* Lowering of OpenMP parallel and workshare constructs proceeds in two diff --git a/gcc/predict.c b/gcc/predict.c index 352417a..6674300 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -77,6 +77,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "tree-scalar-evolution.h" #include "cfgloop.h" +#include "gimple-compat.h" /* real constants: 0, 1, 1-1/REG_BR_PROB_BASE, REG_BR_PROB_BASE, 1/REG_BR_PROB_BASE, 0.5, BB_FREQ_MAX. */ diff --git a/gcc/sese.c b/gcc/sese.c index e0869e0..660d6d9 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "sese.h" #include "tree-ssa-propagate.h" +#include "gimple-compat.h" /* Helper function for debug_rename_map. */ diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index eb1f5be..d584ed4 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -65,6 +65,7 @@ #include "gimple-pretty-print.h" #include "cfgloop.h" #include "tree-ssa-address.h" +#include "gimple-compat.h" #define A_RUNINSTRUMENTEDCODE 0x0001 @@ -1281,7 +1282,7 @@ tm_log_emit_saves (basic_block entry_block, basic_block bb) { size_t i; gimple_stmt_iterator gsi = gsi_last_bb (bb); - gimple stmt; + gassign *stmt; struct tm_log_entry l, *lp; for (i = 0; i < tm_log_save_addresses.length (); ++i) diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c index 4c61cd0..fda862d 100644 --- a/gcc/tree-affine.c +++ b/gcc/tree-affine.c @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "cfgexpand.h" #include "wide-int-print.h" +#include "gimple-compat.h" /* Extends CST as appropriate for the affine combinations COMB. */ diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 23c2df5..2b98ccd 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -49,6 +49,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-into-ssa.h" #include "tree-pass.h" #include "flags.h" +#include "gimple-compat.h" + /* Conditional dead call elimination diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index dbc01f4..eb4c85a 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-propagate.h" #include "tree-hasher.h" #include "cfgloop.h" +#include "gimple-compat.h" /* For each complex ssa name, a lattice value. We're interested in finding diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 4a16c3a..c94b2ec 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -107,6 +107,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "tree-affine.h" #include "params.h" +#include "gimple-compat.h" static struct datadep_stats { diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index a27ed35..34da690 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "cfgloop.h" #include "gimple-low.h" +#include "gimple-compat.h" /* In some instances a tree and a gimple need to be stored in a same table, i.e. in hash tables. This is a structure to do this. */ diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c index f456b4b..ec3ea61 100644 --- a/gcc/tree-emutls.c +++ b/gcc/tree-emutls.c @@ -489,7 +489,7 @@ lower_emutls_1 (tree *ptr, int *walk_subtrees, void *cb_data) new assignment statement, and substitute yet another SSA_NAME. */ if (wi->changed) { - gimple x; + gassign *x; addr = create_tmp_var (TREE_TYPE (t), NULL); x = gimple_build_assign (addr, t); diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index f0beb31..0cd73c4 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -126,6 +126,7 @@ along with GCC; see the file COPYING3. If not see #include "dbgcnt.h" #include "expr.h" #include "optabs.h" +#include "gimple-compat.h" /* List of basic blocks in if-conversion-suitable order. */ static basic_block *ifc_bbs; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index e005da1..dd46529 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -75,6 +75,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "cfgloop.h" #include "builtins.h" +#include "gimple-compat.h" #include "rtl.h" /* FIXME: For asm_str_count. */ diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 70b523c..a370f45 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "diagnostic-core.h" #include "tree-into-ssa.h" +#include "gimple-compat.h" #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y)) diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 31ea04c..94b9d85 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "gimple-pretty-print.h" #include "tree-vectorizer.h" +#include "gimple-compat.h" /* A Reduced Dependence Graph (RDG) vertex representing a statement. */ diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index a254a1c..3fc9271 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -51,6 +51,7 @@ #include "expr.h" /* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL. */ #include "langhooks.h" #include "gimple-low.h" +#include "gimple-compat.h" /* The object of this pass is to lower the representation of a set of nested diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index 182039e..b50619f 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" /* For "optimize" in gate_pass_return_slot. FIXME: That should be up to the pass manager, but pass_nrv is not in pass_all_optimizations. */ +#include "gimple-compat.h" /* This file implements return value optimizations for functions which return aggregate types. diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c index 20b9956..7dfa176 100644 --- a/gcc/tree-object-size.c +++ b/gcc/tree-object-size.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-phinodes.h" #include "ssa-iterators.h" #include "builtins.h" +#include "gimple-compat.h" struct object_size_info { diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index bb57053..798b440 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-ter.h" #include "tree-ssa-coalesce.h" #include "tree-outof-ssa.h" +#include "gimple-compat.h" /* FIXME: A lot of code here deals with expanding to RTL. All that code should be in cfgexpand.c. */ diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index a1e0778..702a6fe 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -68,6 +68,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-parloops.h" #include "omp-low.h" #include "tree-nested.h" +#include "gimple-compat.h" /* This pass tries to distribute iterations of loops into several threads. The implementation is straightforward -- for each loop we test whether its diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 93a523c..297805b 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -233,6 +233,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-affine.h" #include "tree-inline.h" #include "wide-int-print.h" +#include "gimple-compat.h" /* The maximum number of iterations between the considered memory references. */ diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 38b0767..746cb14 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -298,6 +298,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-propagate.h" #include "gimple-fold.h" #include "gimplify-me.h" +#include "gimple-compat.h" static tree analyze_scalar_evolution_1 (struct loop *, tree, tree); static tree analyze_scalar_evolution_for_address_of (struct loop *loop, @@ -1150,7 +1151,7 @@ follow_ssa_edge_expr (struct loop *loop, gimple at_stmt, tree expr, Return true if the strongly connected component has been found. */ static t_bool -follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt, +follow_ssa_edge_in_rhs (struct loop *loop, gassign *stmt, gphi *halting_phi, tree *evolution_of_loop, int limit) { @@ -1388,7 +1389,7 @@ follow_ssa_edge (struct loop *loop, gimple def, gphi *halting_phi, return t_false; case GIMPLE_ASSIGN: - return follow_ssa_edge_in_rhs (loop, def, halting_phi, + return follow_ssa_edge_in_rhs (loop, as_a <gassign *> (def), halting_phi, evolution_of_loop, limit); default: diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 85a9a87..3092125 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -123,6 +123,7 @@ along with GCC; see the file COPYING3. If not see #include "ipa-inline.h" #include "ipa-utils.h" #include "builtins.h" +#include "gimple-compat.h" /* Enumeration of all aggregate reductions we can do. */ enum sra_mode { SRA_MODE_EARLY_IPA, /* early call regularization */ diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 9b55e0d..eb53fad 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "alloc-pool.h" #include "tree-ssa-alias.h" #include "ipa-reference.h" +#include "gimple-compat.h" /* Broad overview of how alias analysis on gimple works: diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index bf7577a..8bb2c53 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -164,6 +164,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "wide-int-print.h" #include "builtins.h" +#include "gimple-compat.h" /* Possible lattice values. */ diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index 7d1825d..b8b0726 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-live.h" #include "tree-ssa-coalesce.h" #include "diagnostic-core.h" +#include "gimple-compat.h" /* This set of routines implements a coalesce_list. This is an object which diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 3833dff..818a100 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-scalar-evolution.h" #include "tree-ssa-dom.h" #include "tree-ssa-loop-niter.h" +#include "gimple-compat.h" /* This file implements the copy propagation pass and provides a diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c index cd7bac5..231ff3f 100644 --- a/gcc/tree-ssa-copyrename.c +++ b/gcc/tree-ssa-copyrename.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-live.h" #include "tree-pass.h" #include "langhooks.h" +#include "gimple-compat.h" static struct { diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 06ffb24..e5e5475 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -84,6 +84,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "cfgloop.h" #include "tree-scalar-evolution.h" +#include "gimple-compat.h" static struct stmt_stats { diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 747354b..9278629 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -66,6 +66,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-threadedge.h" #include "tree-ssa-dom.h" #include "inchash.h" +#include "gimple-compat.h" /* This file implements optimizations on the dominator tree. */ diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 91017ff..3093904 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "langhooks.h" #include "tree-cfgcleanup.h" +#include "gimple-compat.h" /* This file implements dead store elimination. diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 55de465..b16c77a 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -67,6 +67,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfgcleanup.h" #include "tree-into-ssa.h" #include "cfganal.h" +#include "gimple-compat.h" /* This pass propagates the RHS of assignment statements into use sites of the LHS of the assignment. It's basically a specialized diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 9fd7113..764b9d1 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-phinodes.h" #include "ssa-iterators.h" #include "tree-pass.h" +#include "gimple-compat.h" #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT #define LOGICAL_OP_NON_SHORT_CIRCUIT \ diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index db11e3e..33ab5a6 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "debug.h" #include "flags.h" +#include "gimple-compat.h" #ifdef ENABLE_CHECKING static void verify_live_on_entry (tree_live_info_p); diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index 300b2fa..5b5edf0 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "flags.h" #include "tree-ssa-threadedge.h" +#include "gimple-compat.h" /* Duplicates headers of loops if they are small enough, so that the statements in the loop body are always executed when the loop is entered. This diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 6f64f4a..edfc8f3 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-propagate.h" #include "trans-mem.h" #include "gimple-fold.h" +#include "gimple-compat.h" /* TODO: Support for predicated code motion. I.e. diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index e205216..8aff3a9 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "tree-cfgcleanup.h" #include "builtins.h" +#include "gimple-compat.h" /* Specifies types of loops that may be unrolled. */ diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index f0237e0..ac71e40 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -120,6 +120,7 @@ along with GCC; see the file COPYING3. If not see #include "expmed.h" #include "tree-ssa-address.h" #include "builtins.h" +#include "gimple-compat.h" /* FIXME: Expressions are expanded to RTL in this pass to determine the cost of different addressing modes. This should be moved to a TBD diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index fd4d5bf..a6f6238 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "tree-ssanames.h" #include "wide-int-print.h" +#include "gimple-compat.h" #define SWAP(X, Y) do { affine_iv *tmp = (X); (X) = (Y); (Y) = tmp; } while (0) diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index c06c755..41935f3 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -60,6 +60,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "tree-inline.h" #include "tree-data-ref.h" +#include "gimple-compat.h" /* FIXME: Needed for optabs, but this should all be moved to a TBD interface diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 5211b89..d3e8d3f 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -125,6 +125,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "gimple-pretty-print.h" #include "builtins.h" +#include "gimple-compat.h" /* FIXME: RTL headers have to be included here for optabs. */ #include "rtl.h" /* Because optabs.h wants enum rtx_code. */ diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index ccb6c6b..c4ac573 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "optabs.h" #include "tree-scalar-evolution.h" #include "tree-inline.h" +#include "gimple-compat.h" #ifndef HAVE_conditional_move #define HAVE_conditional_move (0) diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c index 8caab38..8f97b39 100644 --- a/gcc/tree-ssa-phiprop.c +++ b/gcc/tree-ssa-phiprop.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "langhooks.h" #include "flags.h" +#include "gimple-compat.h" /* This pass propagates indirect loads through the PHI node for its address to make the load source possibly non-addressable and to diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 886e6fc2..4d098a7 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -76,6 +76,7 @@ along with GCC; see the file COPYING3. If not see #include "ipa-prop.h" #include "tree-ssa-propagate.h" #include "ipa-utils.h" +#include "gimple-compat.h" /* TODO: diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index c246ed6..7140f61 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -60,6 +60,7 @@ #include "langhooks.h" #include "value-prof.h" #include "domwalk.h" +#include "gimple-compat.h" /* This file implements a generic value propagation engine based on the same propagation used by the SSA-CCP algorithm [1]. diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index dec357a..4840f26 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -74,6 +74,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "gimplify.h" #include "optabs.h" +#include "gimple-compat.h" /* This is a simple global reassociation pass. It is, in part, based on the LLVM pass of the same name (They do some things more/less diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 683e50e..4c5e7c6 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-sccvn.h" #include "tree-cfg.h" #include "domwalk.h" +#include "gimple-compat.h" /* This algorithm is based on the SCC algorithm presented by Keith Cooper and L. Taylor Simpson in "SCC-Based Value numbering" diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index c6d8712..6d8c511 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "cfgloop.h" #include "params.h" +#include "gimple-compat.h" /* TODO: 1. Sinking store only using scalar promotion (IE without moving the RHS): diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 4d35bc9..114bbff 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-pretty-print.h" #include "params.h" #include "expr.h" +#include "gimple-compat.h" /* A vector indexed by SSA_NAME_VERSION. 0 means unknown, positive value is an index into strinfo vector, negative value stands for diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index e1f0e66..66d1dbf 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -61,6 +61,7 @@ #include "splay-tree.h" #include "params.h" #include "alias.h" +#include "gimple-compat.h" /* The idea behind this analyzer is to generate set constraints from the program, then solve the resulting constraints in order to generate the diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 5678657..1bff1e6 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -228,6 +228,7 @@ along with GCC; see the file COPYING3. If not see #include "cfgloop.h" #include "tree-pass.h" #include "trans-mem.h" +#include "gimple-compat.h" /* Describes a group of bbs with the same successors. The successor bbs are cached in succs, and the successor edge flags are cached in succ_flags. diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c index 96b3959..afddc00 100644 --- a/gcc/tree-ssa-ter.c +++ b/gcc/tree-ssa-ter.c @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-outof-ssa.h" #include "flags.h" #include "gimple-walk.h" +#include "gimple-compat.h" /* Temporary Expression Replacement (TER) diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 1f3825d..972f1a9 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "tree-ssa-threadedge.h" #include "builtins.h" +#include "gimple-compat.h" /* To avoid code explosion due to jump threading, we limit the number of statements we are going to copy. This variable diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index 9fa3acf..f4039b6 100644 --- a/gcc/tree-ssa-uninit.c +++ b/gcc/tree-ssa-uninit.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "diagnostic-core.h" #include "params.h" +#include "gimple-compat.h" /* This implements the pass that does predicate aware warning on uses of possibly uninitialized variables. The pass first collects the set of diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index b893df9..a433b7c 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "cfgloop.h" #include "cfgexpand.h" +#include "gimple-compat.h" /* Pointer map of variable mappings, keyed by edge. */ static hash_map<edge, auto_vec<edge_var_map> > *edge_var_maps; diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index 7bf3335..f71c4f6 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "sbitmap.h" #include "tree-pass.h" #include "tree-stdarg.h" +#include "gimple-compat.h" /* A simple pass that attempts to optimize stdarg functions on architectures that need to save register arguments to stack on entry to stdarg functions. diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 334d775..f5172e9 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -599,10 +599,10 @@ struct switch_conv_info /* The first load statement that loads a temporary from a new static array. */ - gimple arr_ref_first; + gassign *arr_ref_first; /* The last load statement that loads a temporary from a new static array. */ - gimple arr_ref_last; + gassign *arr_ref_last; /* String reason why the case wasn't a good candidate that is written to the dump file, if there is one. */ @@ -1037,7 +1037,7 @@ build_one_array (gswitch *swtch, int num, tree arr_index_type, gphi *phi, tree tidx, struct switch_conv_info *info) { tree name, cst; - gimple load; + gassign *load; gimple_stmt_iterator gsi = gsi_for_stmt (swtch); location_t loc = gimple_location (swtch); @@ -1103,7 +1103,7 @@ build_arrays (gswitch *swtch, struct switch_conv_info *info) { tree arr_index_type; tree tidx, sub, utype; - gimple stmt; + gassign *stmt; gimple_stmt_iterator gsi; gphi_iterator gpi; int i; diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index de6a531..2f42894 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -69,6 +69,7 @@ along with GCC; see the file COPYING3. If not see #include "optabs.h" #include "builtins.h" #include "varasm.h" +#include "gimple-compat.h" /* Return true if load- or store-lanes optab OPTAB is implemented for COUNT vectors of type VECTYPE. NAME is the name of OPTAB. */ diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 55ab637..c3a2437 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "diagnostic.h" #include "target.h" +#include "gimple-compat.h" /* Need to include rtl.h, expr.h, etc. for optabs. */ #include "expr.h" diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 5149db7..e63c21d 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -66,6 +66,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-scalar-evolution.h" #include "tree-vectorizer.h" #include "target.h" +#include "gimple-compat.h" /* Loop Vectorization Pass. diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index b84248e..f16dcbf 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "dumpfile.h" #include "builtins.h" +#include "gimple-compat.h" /* Pattern recognition functions */ static gimple vect_recog_widen_sum_pattern (vec<gimple> *, tree *, diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 0e9abdb..85e01ed 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "optabs.h" #include "tree-vectorizer.h" #include "langhooks.h" +#include "gimple-compat.h" /* Extract the location of the basic block in the source code. Return the basic block location if succeed and NULL if not. */ diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 02ac7d0..f42adae 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -66,6 +66,7 @@ along with GCC; see the file COPYING3. If not see #include "dumpfile.h" #include "cgraph.h" #include "builtins.h" +#include "gimple-compat.h" /* For lang_hooks.types.type_for_mode. */ #include "langhooks.h" @@ -1314,7 +1315,7 @@ tree vect_init_vector (gimple stmt, tree val, tree type, gimple_stmt_iterator *gsi) { tree new_var; - gimple init_stmt; + gassign *init_stmt; tree vec_oprnd; tree new_temp; diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 43ffcfe..4614fba 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -72,6 +72,7 @@ along with GCC; see the file COPYING3. If not see #include "optabs.h" #include "tree-ssa-threadedge.h" #include "wide-int.h" +#include "gimple-compat.h" diff --git a/gcc/tsan.c b/gcc/tsan.c index 0577104..83a5931 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-propagate.h" #include "tsan.h" #include "asan.h" +#include "gimple-compat.h" /* Number of instrumented memory accesses in the current function. */ diff --git a/gcc/ubsan.c b/gcc/ubsan.c index 7a69000..e8dc598 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "dfp.h" #include "builtins.h" #include "tree-object-size.h" +#include "gimple-compat.h" /* Map from a tree to a VAR_DECL tree. */ diff --git a/gcc/value-prof.c b/gcc/value-prof.c index b35c437..5a4033e 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -69,6 +69,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "tree-nested.h" #include "params.h" +#include "gimple-compat.h" /* In this file value profile based optimizations are placed. Currently the following optimizations are implemented (for more detailed descriptions diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c index c7105d5..0815802 100644 --- a/gcc/vtable-verify.c +++ b/gcc/vtable-verify.c @@ -161,6 +161,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssanames.h" #include "tree-pass.h" #include "cfgloop.h" +#include "gimple-compat.h" #include "vtable-verify.h" -- 1.8.5.3
