This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Static sem_item_optimizer instance in ipa-icf pass


Hi,

I stumbled across this during my work on a gcc compiler plugin [1].

During the ipa-icf pass semantic items (`sem_function` and `sem_variable`) are generated to find potential candidates for function or variable merging.

In `ipa-icf.c` there is a static variable `optimizer` (of type `sem_item_optimizer`) which is initialized before and destroyed after the ipa-icf pass. This variable is used by the semantic items. Therefore it is not possible to use `sem_function` or `sem_variable` outside of the icf pass (as the static optimizer is NULL). E.g. create a `sem_function` variable with `sem_function::parse`.

Is this intended? I would like to use `sem_function` objects (independently from the icf pass) to compare functions that were generated by our gcc plugin (or is this a bad idea).

It seems that (non-static) member functions like `sem_item_optimizer::parse_func_and_vars` use this static `optimizer` instance (through some indirections [2]) which looks kinda wrong to me.

Regards,
Flo


[1] https://github.com/luhsra/multiverse

[2] Calls:
   sem_item_optimizer::parse_funcs_and_vars  [ipa_icf.c:2666]
   sem_function::parse                       [ipa_icf.c:1691]
   sem_function::init                        [ipa_icf.c:1387]
   sem_function::hash_stmt                   [ipa_icf.c:1617]
   sem_function::add_type                    [ipa_icf.c:1547]
     uses static sem_item_optimizer optimzer [ipa_icf.c:94]




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]