mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
driver glue for invoking use-def construction
This commit is contained in:
parent
372fb8b197
commit
94b85e3527
1 changed files with 15 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include "zeek/script_opt/Inline.h"
|
#include "zeek/script_opt/Inline.h"
|
||||||
#include "zeek/script_opt/Reduce.h"
|
#include "zeek/script_opt/Reduce.h"
|
||||||
#include "zeek/script_opt/GenRDs.h"
|
#include "zeek/script_opt/GenRDs.h"
|
||||||
|
#include "zeek/script_opt/UseDefs.h"
|
||||||
|
|
||||||
|
|
||||||
namespace zeek::detail {
|
namespace zeek::detail {
|
||||||
|
@ -76,11 +77,25 @@ void optimize_func(ScriptFunc* f, std::shared_ptr<ProfileFunc> pf,
|
||||||
|
|
||||||
f->ReplaceBody(body, new_body);
|
f->ReplaceBody(body, new_body);
|
||||||
body = new_body;
|
body = new_body;
|
||||||
|
|
||||||
|
// Profile the new body.
|
||||||
|
pf = std::make_shared<ProfileFunc>(false);
|
||||||
body->Traverse(pf.get());
|
body->Traverse(pf.get());
|
||||||
|
|
||||||
|
// Compute its reaching definitions.
|
||||||
RD_Decorate reduced_rds(pf);
|
RD_Decorate reduced_rds(pf);
|
||||||
reduced_rds.TraverseFunction(f, scope, body);
|
reduced_rds.TraverseFunction(f, scope, body);
|
||||||
|
|
||||||
|
rc->SetDefSetsMgr(reduced_rds.GetDefSetsMgr());
|
||||||
|
|
||||||
|
auto ud = std::make_unique<UseDefs>(body, rc);
|
||||||
|
ud->Analyze();
|
||||||
|
|
||||||
|
if ( analysis_options.dump_uds )
|
||||||
|
ud->Dump();
|
||||||
|
|
||||||
|
ud->RemoveUnused();
|
||||||
|
|
||||||
int new_frame_size =
|
int new_frame_size =
|
||||||
scope->Length() + rc->NumTemps() + rc->NumNewLocals();
|
scope->Length() + rc->NumTemps() + rc->NumNewLocals();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue