internal option to suppress control-flow optimization

This commit is contained in:
Vern Paxson 2024-08-06 08:25:58 +01:00 committed by Arne Welzel
parent 63f76c7f84
commit db22448270
3 changed files with 10 additions and 0 deletions

View file

@ -271,6 +271,7 @@ static void init_options() {
check_env_opt("ZEEK_REPORT_UNCOMPILABLE", analysis_options.report_uncompilable);
check_env_opt("ZEEK_ZAM_CODE", analysis_options.gen_ZAM_code);
check_env_opt("ZEEK_NO_ZAM_OPT", analysis_options.no_ZAM_opt);
check_env_opt("ZEEK_NO_ZAM_CONTROL_FLOW_OPT", analysis_options.no_ZAM_control_flow_opt);
check_env_opt("ZEEK_DUMP_ZAM", analysis_options.dump_ZAM);
check_env_opt("ZEEK_PROFILE", analysis_options.profile_ZAM);

View file

@ -72,6 +72,9 @@ struct AnalyOpt {
// Deactivate the low-level ZAM optimizer.
bool no_ZAM_opt = false;
// Deactivate ZAM optimization of control flow.
bool no_ZAM_control_flow_opt = false;
// Produce a profile of ZAM execution.
bool profile_ZAM = false;

View file

@ -144,6 +144,9 @@ bool ZAMCompiler::RemoveDeadCode() {
if ( ! i0->live )
continue;
if ( analysis_options.no_ZAM_control_flow_opt )
continue;
auto i1 = NextLiveInst(i0);
// Look for degenerate branches.
@ -181,6 +184,9 @@ bool ZAMCompiler::RemoveDeadCode() {
}
bool ZAMCompiler::CollapseGoTos() {
if ( analysis_options.no_ZAM_control_flow_opt )
return false;
bool did_change = false;
for ( auto& i0 : insts1 ) {