This phase inlines all functions with type inline. It can be called from the command line with -fi. It needs both the cfg and a callgraph, so it calls both cfg_changer and callgraph_walker. This phase is NOT idempotent. It is idempotent assuming no recursive functions have been marked inline.
The function inliner works in two passes. The first identifies callsites which can/should be inlined. Under normal operation, it currently only inlines the call sites of functions of type inline. Hopefully, it will not be difficult to add other heuristics. The second pass inlines all call sites identified by the first pass.
After function inlining is complete, the code is re-dismantled to make certain all variables in each scope are unique.
function_inline needs the map generated by identify_inlinees. By identifying call sites to be inlined in a separate pass, we avoid problems with recursion
Implements Phase.
Definition at line 77 of file inliner.cc.
References identify_inlinees::callinline(), Dismantle::dismantle(), findmain(), cfg_changer::generate_cfg(), identify_inlinees::inlined(), function_inline::insert_proc(), Linker::link(), Linker::procedure_declarations(), function_inline::process(), identify_inlinees::procs(), CBZ::Program, and unit_list_p. |