Message ID | CABu31nNFpGkFmmvj8k=+b+bQYgof0tEtAoSC-L5G9HMSe+4VCw@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Wed, Jul 11, 2012 at 9:39 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote: > Hello, > > GCC calls free_after_parsing in rest_of_clean_state. > That's way too late, it can be done in free_lang_data_in_cgraph instead. But that's only called with -flto ... I think it should be called in cgraph_finalize_function instead (being optimistic here - heh). Richard. > While there, I noticed a silly loop in final.c, and cleaned that up too. > > Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk? > > Ciao! > Steven > > * final.c (final): Don't loop to find max_uid. > (rest_of_clean_state): Don't call free_after_parsing here. > * tree.c (free_lang_data_in_cgraph): Call free_after_parsing here. > > Index: final.c > =================================================================== > --- final.c (revision 189423) > +++ final.c (working copy) > @@ -1826,7 +1826,6 @@ void > final (rtx first, FILE *file, int optimize_p) > { > rtx insn, next; > - int max_uid = 0; > int seen = 0; > > /* Used for -dA dump. */ > @@ -1837,11 +1836,9 @@ final (rtx first, FILE *file, int optimi > > last_ignored_compare = 0; > > +#ifdef HAVE_cc0 > for (insn = first; insn; insn = NEXT_INSN (insn)) > { > - if (INSN_UID (insn) > max_uid) /* Find largest UID. */ > - max_uid = INSN_UID (insn); > -#ifdef HAVE_cc0 > /* If CC tracking across branches is enabled, record the insn which > jumps to each branch only reached from one place. */ > if (optimize_p && JUMP_P (insn)) > @@ -1852,8 +1849,8 @@ final (rtx first, FILE *file, int optimi > LABEL_REFS (lab) = insn; > } > } > -#endif > } > +#endif > > init_recog (); > > @@ -4500,7 +4497,6 @@ rest_of_clean_state (void) > init_recog_no_volatile (); > > /* We're done with this function. Free up memory if we can. */ > - free_after_parsing (cfun); > free_after_compilation (cfun); > return 0; > } > Index: tree.c > =================================================================== > --- tree.c (revision 189423) > +++ tree.c (working copy) > @@ -5167,16 +5167,19 @@ assign_assembler_name_if_neeeded (tree t > > > /* Free language specific information for every operand and expression > - in every node of the call graph. This process operates in three stages: > + in every node of the call graph. This process operates in four stages: > > - 1- Every callgraph node and varpool node is traversed looking for > + 1- Every function is traversed to free any front-end specific > + data hung from the function's struct function->language. > + > + 2- Every callgraph node and varpool node is traversed looking for > decls and types embedded in them. This is a more exhaustive > search than that done by find_referenced_vars, because it will > also collect individual fields, decls embedded in types, etc. > > - 2- All the decls found are sent to free_lang_data_in_decl. > + 3- All the decls found are sent to free_lang_data_in_decl. > > - 3- All the types found are sent to free_lang_data_in_type. > + 4- All the types found are sent to free_lang_data_in_type. > > The ordering between decls and types is important because > free_lang_data_in_decl sets assembler names, which includes > @@ -5193,6 +5196,10 @@ free_lang_data_in_cgraph (void) > unsigned i; > alias_pair *p; > > + /* Clear out function->language. */ > + FOR_EACH_FUNCTION (n) > + free_after_parsing (DECL_STRUCT_FUNCTION (n->symbol.decl)); > + > /* Initialize sets and arrays to store referenced decls and types. */ > fld.pset = pointer_set_create (); > fld.worklist = NULL;
Index: final.c =================================================================== --- final.c (revision 189423) +++ final.c (working copy) @@ -1826,7 +1826,6 @@ void final (rtx first, FILE *file, int optimize_p) { rtx insn, next; - int max_uid = 0; int seen = 0; /* Used for -dA dump. */ @@ -1837,11 +1836,9 @@ final (rtx first, FILE *file, int optimi last_ignored_compare = 0; +#ifdef HAVE_cc0 for (insn = first; insn; insn = NEXT_INSN (insn)) { - if (INSN_UID (insn) > max_uid) /* Find largest UID. */ - max_uid = INSN_UID (insn); -#ifdef HAVE_cc0 /* If CC tracking across branches is enabled, record the insn which jumps to each branch only reached from one place. */ if (optimize_p && JUMP_P (insn)) @@ -1852,8 +1849,8 @@ final (rtx first, FILE *file, int optimi LABEL_REFS (lab) = insn; } } -#endif } +#endif init_recog (); @@ -4500,7 +4497,6 @@ rest_of_clean_state (void) init_recog_no_volatile (); /* We're done with this function. Free up memory if we can. */ - free_after_parsing (cfun); free_after_compilation (cfun); return 0; } Index: tree.c =================================================================== --- tree.c (revision 189423) +++ tree.c (working copy) @@ -5167,16 +5167,19 @@ assign_assembler_name_if_neeeded (tree t /* Free language specific information for every operand and expression - in every node of the call graph. This process operates in three stages: + in every node of the call graph. This process operates in four stages: - 1- Every callgraph node and varpool node is traversed looking for + 1- Every function is traversed to free any front-end specific + data hung from the function's struct function->language. + + 2- Every callgraph node and varpool node is traversed looking for decls and types embedded in them. This is a more exhaustive search than that done by find_referenced_vars, because it will also collect individual fields, decls embedded in types, etc. - 2- All the decls found are sent to free_lang_data_in_decl. + 3- All the decls found are sent to free_lang_data_in_decl. - 3- All the types found are sent to free_lang_data_in_type. + 4- All the types found are sent to free_lang_data_in_type. The ordering between decls and types is important because free_lang_data_in_decl sets assembler names, which includes @@ -5193,6 +5196,10 @@ free_lang_data_in_cgraph (void) unsigned i; alias_pair *p; + /* Clear out function->language. */ + FOR_EACH_FUNCTION (n) + free_after_parsing (DECL_STRUCT_FUNCTION (n->symbol.decl)); + /* Initialize sets and arrays to store referenced decls and types. */ fld.pset = pointer_set_create (); fld.worklist = NULL;