Internal callback edge redirection and call adjustments in cgraph and ipa
Introduces logic for redirecting internal callback edges and adjusting call statements.
This commit adds new logic for redirecting internal callback edges and modifying their associated call statements within the cgraph and IPA components. Internal callback edges require a distinct redirection approach compared to regular ones, allowing for more extensive call statement modifications beyond simple address replacements. The changes update functions responsible for call modification to accommodate this, including argument remapping based on summaries describing the changes made. This ensures that call statements involving internal callback edges are handled correctly.
In Details
This patch touches cgraph.cc and ipa-param-manipulation.cc. In cgraph_edge::redirect_call_stmt_to_callee, it adds logic for internal edges, which differ from external ones. ipa_param_adjustments::modify_call and ipa_param_body_adjustments::modify_call_stmt are updated to handle argument modifications for callback edges. These functions create and use a summary describing changes, including indices for argument remapping. The core change is enabling the modification of call statements for internal callback edges, supporting the creation of IFN_ASSUME calls.
- cgraph
- Call Graph. A representation of the call relationships between functions in a program. GCC uses this to analyze and optimize call sites.
- IPA
- Inter-Procedural Analysis. GCC performs analysis and optimizations by looking at the entire program (all procedures) at once, rather than analyzing each procedure in isolation.
- callback edge
- An edge in the call graph that represents a function being called indirectly, often through a function pointer or a more complex mechanism. Internal callback edges are specific to GCC's internal representation.
- call statement
- A representation within GCC's intermediate representation that signifies a function call.
- IFN_ASSUME call
- An internal GCC construct representing an assumption about program behavior, often used for optimization purposes. These do not typically appear in the final compiled code.