Re: [PATCH][2/2] GIMPLE Frontend, middle-end changes
On Thu, 17 Nov 2016, Jeff Law wrote: > On 11/17/2016 01:20 AM, Richard Biener wrote: > > On Wed, 16 Nov 2016, Jeff Law wrote: > > > > > On 10/28/2016 05:51 AM, Richard Biener wrote: > > > > > > > > These are the middle-end changes and additions to the testsuite. > > > > > > > > They are pretty self-contained, I've organized the changelog > > > > entries below in areas of changes: > > > > > > > > 1) dump changes - we add a -gimple dump modifier that allows most > > > > function dumps to be directy fed back into the GIMPLE FE > > > > > > > > 2) pass manager changes to implement the startwith("pass-name") > > > > feature which implements unit-testing for GIMPLE passes > > > > > > > > 3) support for "SSA" input, a __PHI stmt that is lowered once the > > > > CFG is built, a facility to allow a specific SSA name to be allocated > > > > plus a small required change in the SSA rewriter to allow for > > > > pre-existing PHI arguments > > > > > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu (together with > > > > [1/2]). > > > > > > > > I can approve all these changes myself but any comments are welcome. > > > My only worry would be ensuring that in the case where we're asking for a > > > particular SSA_NAME in make_ssa_name_fn that we assert the requested name > > > is > > > available. > > > > > > ISTM that if it's > the highest current version or in the freelist, then > > > we > > > ought to be safe. If it isn't safe then we should either issue an error, > > > or > > > renumber the preexisting SSA_NAME (and determining if it's safe to > > > renumber > > > the preexisting SSA_NAME may require more context than we have). > > > > An alternative interface would be to return NULL rather than asserting. > > OTOH the single caller requesting a specific version first does a lookup > > if the SSA name already exists, so it is safe. > I have a slight preference for enforcing safety within the name manager, but I > can live with doing the checking in the caller. Actually safety is enforced by means of an assert ... the caller would have to check anyway (for a NULL result). IMHO doing tricks like re-numbering on already taken versions doesn't make sense as that doesn't guarantee earlier assigned versions stay the same. It's really a special thing for the parser which wants to preserve SSA name versions as in the source. Richard.
Re: [PATCH][2/2] GIMPLE Frontend, middle-end changes
On 11/17/2016 01:20 AM, Richard Biener wrote: On Wed, 16 Nov 2016, Jeff Law wrote: On 10/28/2016 05:51 AM, Richard Biener wrote: These are the middle-end changes and additions to the testsuite. They are pretty self-contained, I've organized the changelog entries below in areas of changes: 1) dump changes - we add a -gimple dump modifier that allows most function dumps to be directy fed back into the GIMPLE FE 2) pass manager changes to implement the startwith("pass-name") feature which implements unit-testing for GIMPLE passes 3) support for "SSA" input, a __PHI stmt that is lowered once the CFG is built, a facility to allow a specific SSA name to be allocated plus a small required change in the SSA rewriter to allow for pre-existing PHI arguments Bootstrapped and tested on x86_64-unknown-linux-gnu (together with [1/2]). I can approve all these changes myself but any comments are welcome. My only worry would be ensuring that in the case where we're asking for a particular SSA_NAME in make_ssa_name_fn that we assert the requested name is available. ISTM that if it's > the highest current version or in the freelist, then we ought to be safe. If it isn't safe then we should either issue an error, or renumber the preexisting SSA_NAME (and determining if it's safe to renumber the preexisting SSA_NAME may require more context than we have). An alternative interface would be to return NULL rather than asserting. OTOH the single caller requesting a specific version first does a lookup if the SSA name already exists, so it is safe. I have a slight preference for enforcing safety within the name manager, but I can live with doing the checking in the caller. jeff
Re: [PATCH][2/2] GIMPLE Frontend, middle-end changes
On Wed, 16 Nov 2016, Jeff Law wrote: > On 10/28/2016 05:51 AM, Richard Biener wrote: > > > > These are the middle-end changes and additions to the testsuite. > > > > They are pretty self-contained, I've organized the changelog > > entries below in areas of changes: > > > > 1) dump changes - we add a -gimple dump modifier that allows most > > function dumps to be directy fed back into the GIMPLE FE > > > > 2) pass manager changes to implement the startwith("pass-name") > > feature which implements unit-testing for GIMPLE passes > > > > 3) support for "SSA" input, a __PHI stmt that is lowered once the > > CFG is built, a facility to allow a specific SSA name to be allocated > > plus a small required change in the SSA rewriter to allow for > > pre-existing PHI arguments > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu (together with [1/2]). > > > > I can approve all these changes myself but any comments are welcome. > My only worry would be ensuring that in the case where we're asking for a > particular SSA_NAME in make_ssa_name_fn that we assert the requested name is > available. > > ISTM that if it's > the highest current version or in the freelist, then we > ought to be safe. If it isn't safe then we should either issue an error, or > renumber the preexisting SSA_NAME (and determining if it's safe to renumber > the preexisting SSA_NAME may require more context than we have). An alternative interface would be to return NULL rather than asserting. OTOH the single caller requesting a specific version first does a lookup if the SSA name already exists, so it is safe. Richard.
Re: [PATCH][2/2] GIMPLE Frontend, middle-end changes
On 10/28/2016 05:51 AM, Richard Biener wrote: These are the middle-end changes and additions to the testsuite. They are pretty self-contained, I've organized the changelog entries below in areas of changes: 1) dump changes - we add a -gimple dump modifier that allows most function dumps to be directy fed back into the GIMPLE FE 2) pass manager changes to implement the startwith("pass-name") feature which implements unit-testing for GIMPLE passes 3) support for "SSA" input, a __PHI stmt that is lowered once the CFG is built, a facility to allow a specific SSA name to be allocated plus a small required change in the SSA rewriter to allow for pre-existing PHI arguments Bootstrapped and tested on x86_64-unknown-linux-gnu (together with [1/2]). I can approve all these changes myself but any comments are welcome. My only worry would be ensuring that in the case where we're asking for a particular SSA_NAME in make_ssa_name_fn that we assert the requested name is available. ISTM that if it's > the highest current version or in the freelist, then we ought to be safe. If it isn't safe then we should either issue an error, or renumber the preexisting SSA_NAME (and determining if it's safe to renumber the preexisting SSA_NAME may require more context than we have). jeff
[PATCH][2/2] GIMPLE Frontend, middle-end changes
These are the middle-end changes and additions to the testsuite. They are pretty self-contained, I've organized the changelog entries below in areas of changes: 1) dump changes - we add a -gimple dump modifier that allows most function dumps to be directy fed back into the GIMPLE FE 2) pass manager changes to implement the startwith("pass-name") feature which implements unit-testing for GIMPLE passes 3) support for "SSA" input, a __PHI stmt that is lowered once the CFG is built, a facility to allow a specific SSA name to be allocated plus a small required change in the SSA rewriter to allow for pre-existing PHI arguments Bootstrapped and tested on x86_64-unknown-linux-gnu (together with [1/2]). I can approve all these changes myself but any comments are welcome. Thanks, Richard. 2016-10-28 Prasad GhangalRichard Biener * dumpfile.h (TDF_GIMPLE): Add. * dumpfile.c (dump_options): Add gimple. * gimple-pretty-print.c (dump_gimple_switch): Adjust dump for TDF_GIMPLE. (dump_gimple_label): Likewise. (dump_gimple_phi): Likewise. (dump_gimple_bb_header): Likewise. (dump_phi_nodes): Likewise. (pp_cfg_jump): Likewise. Pass in dump flags. (dump_implicit_edges): Adjust. * passes.c (pass_init_dump_file): Do not dump function header for TDF_GIMPLE. * tree-cfg.c (dump_function_to_file): Dump function return type and __GIMPLE keyword for TDF_GIMPLE. Change guard for dumping GIMPLE stmts. * tree-pretty-print.c (dump_decl_name): Adjust dump for TDF_GIMPLE. (dump_generic_node): Likewise. * function.h (struct function): Add pass_startwith member. * passes.c (execute_one_pass): Implement startwith. * tree-ssanames.c (make_ssa_name_fn): New argument, check for version and assign proper version for parsed ssa names. * tree-ssanames.h (make_ssa_name_fn): Add new argument to the function. * internal-fn.c (expand_PHI): New function. * internal-fn.h (expand_PHI): Declared here. * internal-fn.def: New defination for PHI. * tree-cfg.c (lower_phi_internal_fn): New function. (build_gimple_cfg): Call it. (verify_gimple_call): Condition for passing label as arg in internal function PHI. * tree-into-ssa.c (rewrite_add_phi_arguments): Handle already present PHIs with arguments. testsuite/ * gcc.dg/gimplefe-1.c: New testcase. * gcc.dg/gimplefe-2.c: Likewise. * gcc.dg/gimplefe-3.c: Likewise. * gcc.dg/gimplefe-4.c: Likewise. * gcc.dg/gimplefe-5.c: Likewise. * gcc.dg/gimplefe-6.c: Likewise. * gcc.dg/gimplefe-7.c: Likewise. * gcc.dg/gimplefe-8.c: Likewise. * gcc.dg/gimplefe-9.c: Likewise. * gcc.dg/gimplefe-10.c: Likewise. * gcc.dg/gimplefe-11.c: Likewise. * gcc.dg/gimplefe-12.c: Likewise. * gcc.dg/gimplefe-13.c: Likewise. * gcc.dg/gimplefe-14.c: Likewise. * gcc.dg/gimplefe-15.c: Likewise. * gcc.dg/gimplefe-16.c: Likewise. * gcc.dg/gimplefe-17.c: Likewise. * gcc.dg/gimplefe-18.c: Likewise. diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 74522a6..e9483bc 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -108,13 +108,15 @@ static const struct dump_option_value_info dump_options[] = {"nouid", TDF_NOUID}, {"enumerate_locals", TDF_ENUMERATE_LOCALS}, {"scev", TDF_SCEV}, + {"gimple", TDF_GIMPLE}, {"optimized", MSG_OPTIMIZED_LOCATIONS}, {"missed", MSG_MISSED_OPTIMIZATION}, {"note", MSG_NOTE}, {"optall", MSG_ALL}, {"all", ~(TDF_RAW | TDF_SLIM | TDF_LINENO | TDF_TREE | TDF_RTL | TDF_IPA | TDF_STMTADDR | TDF_GRAPH | TDF_DIAGNOSTIC | TDF_VERBOSE - | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV)}, + | TDF_RHS_ONLY | TDF_NOUID | TDF_ENUMERATE_LOCALS | TDF_SCEV + | TDF_GIMPLE)}, {NULL, 0} }; diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 3f08b16..b7d70f2 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -82,9 +82,10 @@ enum tree_dump_index #define TDF_CSELIB (1 << 23) /* Dump cselib details. */ #define TDF_SCEV (1 << 24) /* Dump SCEV details. */ #define TDF_COMMENT(1 << 25) /* Dump lines with prefix ";;" */ -#define MSG_OPTIMIZED_LOCATIONS (1 << 26) /* -fopt-info optimized sources */ -#define MSG_MISSED_OPTIMIZATION (1 << 27) /* missed opportunities */ -#define MSG_NOTE (1 << 28) /* general optimization info */ +#define TDF_GIMPLE (1 << 26) /* Dump in GIMPLE FE syntax */ +#define MSG_OPTIMIZED_LOCATIONS (1 << 27) /* -fopt-info optimized sources */ +#define MSG_MISSED_OPTIMIZATION (1 << 28) /* missed opportunities */ +#define MSG_NOTE (1 << 29) /* general optimization info */ #define MSG_ALL