Hi,

I added a pass right after lower_eh_dispatch and before
all_optimizations. In this pass, I'm trying to insert a new function
in the call graph by calling cgraph_add_new_function, as the comments
in cgraphunit.c mention that this function can be used at an arbitrary
point of the middle-end. The comments also say that the new function
will be enqueued for later compilation, avoiding the need for the
passes to be reentrant.

When my pass executes and cgraph_add_new_function is called,
cgraph_state's value is CGRAPH_STATE_EXPANSION. Thus,
cgraph_add_new_function decides to execute the lowering and early
local passes on the new function. When this happens, the state of some
global variables, like dump_file and current_pass, are changed but not
restored. As the original pass that called cgraph_add_new_function
will need such global variables later, I am saving their current state
and restoring them by hand after calling cgraph_add_new_function,
otherwise the compilation fails. That being, I'd like to know if that
is an indicator that I shouldn't be inserting a new function at this
point of compilation, since cgraph_add_new_function wasn't supposed to
affect the pass being executed.


Thanks in advance for your help,

--
Pericles Alves

Reply via email to