On Wed, Apr 22, 2020 at 8:40 PM Giuliano Belinassi <giuliano.belina...@usp.br> wrote: > > This patch refactors tree-ssa-operands.c by wrapping the global > variables into a class, and also removes unused code. > > Just sending this for when Stage1 is back again. > > I ran the testsuite and bootstraped in a x86_64 linux machine and > found no issues.
First of all thanks for doing this. I have a few editorial suggestions about the class setup - first the name build_virtual_operands is badly chosen, I prefer operand_scanner. Second I suggest to have the CTOR take the invariants as arguments which is the stmt we operate on and its containing function. Thus, operand_scanner (function *, gimple *); which makes passing those down functions unnecessary. Since build_vuses is now a member and allocated for each stmt which would be a regression I'd suggest to use an auto_vec with some pre-allocated storage, thus change it to auto_vec<tree *, 16> build_uses; that also makes the destructor trivial (please simply remove cleanup_build_arrays). I guess there's further possibilities for streamlining the initialization/teardown process but that's better done as followup. Otherwise the change looks OK to me. Thanks, Richard. > gcc/ChangeLog: > 2020-04-22 Giuliano Belinassi <giuliano.belina...@usp.br> > > * tree-ssa-operands.c (build_virtual_operands): New class. > (operands_bitmap_obstack): Remove. > (n_initialized): Remove. > (build_uses): Move to build_virtual_operands class. > (build_vuse): Same as above. > (build_vdef): Same as above. > (verify_ssa_operands): Same as above. > (finalize_ssa_uses): Same as above. > (cleanup_build_arrays): Same as above. > (finalize_ssa_stmt_operands): Same as above. > (start_ssa_stmt_operands): Same as above. > (append_use): Same as above. > (append_vdef): Same as above. > (add_virtual_operand): Same as above. > (add_stmt_operand): Same as above. > (get_mem_ref_operands): Same as above. > (get_tmr_operands): Same as above. > (maybe_add_call_vops): Same as above. > (get_asm_stmt_operands): Same as above. > (get_expr_operands): Same as above. > (parse_ssa_operands): Same as above. > (finalize_ssa_defs): Same as above. > (build_ssa_operands): Same as above, plus create a C-like wrapper. > (update_stmt_operands): Create an instance of build_virtual_operands.