reworking of command-line options related to script optimization

This commit is contained in:
Vern Paxson 2021-08-16 11:07:18 -07:00
parent 4637da37a7
commit ddac6e5f67
2 changed files with 108 additions and 48 deletions

View file

@ -19,12 +19,50 @@ namespace zeek::detail {
// Flags controlling what sorts of analysis to do.
struct AnalyOpt {
// If non-nil, then only analyze the given function/event/hook.
// Applies to both ZAM and C++.
std::optional<std::string> only_func;
// For a given compilation target, report functions that can't
// be compiled.
bool report_uncompilable = false;
////// Options relating to ZAM:
// Whether to analyze scripts.
bool activate = false;
// If true, compile all compileable functions, even those that
// are inlined. Mainly useful for ensuring compatibility for
// some tests in the test suite.
bool compile_all = false;
// Whether to optimize the AST.
bool optimize_AST = false;
// If true, do global inlining.
bool inliner = false;
// If true, report which functions are directly and indirectly
// recursive, and exit. Only germane if running the inliner.
bool report_recursive = false;
// If true, generate ZAM code for applicable function bodies,
// activating all optimizations.
bool gen_ZAM = false;
// Generate ZAM code, but do not turn on optimizations unless
// specified.
bool gen_ZAM_code = false;
// Deactivate the low-level ZAM optimizer.
bool no_ZAM_opt = false;
// Produce a profile of ZAM execution.
bool profile_ZAM = false;
// If true, dump out transformed code: the results of reducing
// interpreted scripts, and, if optimize is set, of then optimizing
// them. Always done if only_func is set.
@ -33,11 +71,23 @@ struct AnalyOpt {
// If true, dump out the use-defs for each analyzed function.
bool dump_uds = false;
// If non-nil, then only analyze the given function/event/hook.
std::optional<std::string> only_func;
// If true, dump out generated ZAM code.
bool dump_ZAM = false;
// If true, do global inlining.
bool inliner = false;
// If non-zero, looks for variables that are used-but-possibly-not-set,
// or set-but-not-used.
//
// If > 1, also reports on uses of uninitialized record fields and
// analyzes nested records in depth. Warning: with the current
// data structures this greatly increases analysis time.
//
// Included here with other ZAM-related options since conducting
// the analysis requires activating some of the machinery used
// for ZAM.
int usage_issues = 0;
////// Options relating to C++:
// If true, generate C++;
bool gen_CPP = false;
@ -61,25 +111,8 @@ struct AnalyOpt {
// If true, use C++ bodies if available.
bool use_CPP = false;
// If true, compile all compileable functions, even those that
// are inlined. Mainly useful for ensuring compatibility for
// some tests in the test suite.
bool compile_all = false;
// If true, report on available C++ bodies.
bool report_CPP = false;
// If true, report which functions are directly and indirectly
// recursive, and exit. Only germane if running the inliner.
bool report_recursive = false;
// If non-zero, looks for variables that are used-but-possibly-not-set,
// or set-but-not-used.
//
// If > 1, also reports on uses of uninitialized record fields and
// analyzes nested records in depth. Warning: with the current
// data structures this greatly increases analysis time.
int usage_issues = 0;
};
extern AnalyOpt analysis_options;