5 redef class AnalysisManager
6 var opt_cfg
= new OptionBool("Print the CFG to \"cfg
.dot\
" (for debugging purposes)", "--cfg")
7 var opt_cfg_long
= new OptionBool("Print the long format CFG", "--cfg-long")
9 var opt_cfg_inline
= new OptionBool("Inline function calls in the CFG", "--inline")
10 #var opt_cfg_not_inline = new OptionBool("Do not inline function calls in the CFG", "--no-inline")
12 var cfg
: nullable CFG = null
18 opts
.add_option
(opt_cfg
)
19 opts
.add_option
(opt_cfg_long
)
20 #opts.add_option(opt_cfg_not_inline)
21 opts
.add_option
(opt_cfg_inline
)
24 redef fun build_cfg
(model
)
29 if cfg
.has_function_calls
then
30 #if not opt_cfg_not_inline.value then
31 if opt_cfg_inline
.value
then
35 var to_link
= new List[BasicBlock]
36 if not cfg
.link_ret_to_calls
(cfg
.start
, to_link
, new List[BasicBlock], 0) then
37 manager
.fatal_error
(model
.lines
.first
, "failed to organize function calls")
42 if opt_cfg
.value
or opt_cfg_long
.value
then
43 var of
= new OFStream.open
("cfg.dot")
44 cfg
.print_dot
(of
, opt_cfg_long
.value
)
48 verify_cfg_sanity
(cfg
)