let main () =
let not_quiet = Value_parameters.verbose_atleast 1 in
let mem_functions = Value_parameters.MemFunctions.get () in
if Value_parameters.MemExecAll.get ()
|| not (Cilutil.StringSet.is_empty mem_functions)
then begin
Value_parameters.feedback "====== MEMOIZING FUNCTIONS ======";
Globals.Functions.iter
(fun kf ->
let name = Kernel_function.get_name kf in
if Kernel_function.is_definition kf &&
(Value_parameters.MemExecAll.get ()
|| Cilutil.StringSet.mem name mem_functions)
then begin
Value_parameters.feedback "== function %a"
Kernel_function.pretty_name kf;
try
!Db.Value.memoize kf
with Db.Value.Aborted ->
Value_parameters.fatal "Cannot memoize %a: Analysis degenerated@."
Kernel_function.pretty_name kf
end)
end;
if Value_parameters.ForceValues.get () then begin
!Db.Value.compute ();
Value_parameters.result "====== VALUES COMPUTED ======";
end;
let forcederef = Parameters.Dynamic.Bool.get "-deref" in
let forceout = Parameters.Dynamic.Bool.get "-out" in
let forceinout = Parameters.Dynamic.Bool.get "-inout" in
let forceinput = Parameters.Dynamic.Bool.get "-input" in
let forceexternalout = Parameters.Dynamic.Bool.get "-out-external" in
let forceinputwithformals = Parameters.Dynamic.Bool.get "-input-with-formals"
in
if forceout
|| forceexternalout
|| forceinput
|| forceinputwithformals
|| forceinout
|| forcederef
|| Value_parameters.ForceValues.get ()
then begin
!Db.Semantic_Callgraph.topologically_iter_on_functions
(fun kf ->
if Kernel_function.is_definition kf then begin
let result display compute =
(if not_quiet then Value_parameters.result "%a" display else compute) kf
in
if forceout then
result !Db.Outputs.display !Db.Outputs.compute;
if forceexternalout then
result !Db.Outputs.display_external !Db.Outputs.compute;
if forceinput then
result !Db.Inputs.display !Db.Inputs.compute;
if forceinputwithformals then
if not_quiet then
Value_parameters.result "%a" !Db.Inputs.display_with_formals kf
;
if forceinout then
result !Db.InOutContext.display !Db.InOutContext.compute;
if forcederef then
result !Db.Derefs.display !Db.Derefs.compute;
if not_quiet && Value_parameters.ForceValues.get () then
Value_parameters.result "%a" Db.Value.display kf;
end)
end