streamline generated -O C++ code by relying on per-function profiles rather than aggregate profile

This commit is contained in:
Vern Paxson 2024-12-06 16:23:32 -08:00
parent 79c5790bbf
commit 612d99e751
3 changed files with 43 additions and 12 deletions

View file

@ -53,6 +53,19 @@ std::string Canonicalize(const std::string& name) const;
// be a EXPR_NAME).
std::string GlobalName(const ExprPtr& e) { return globals[e->AsNameExpr()->Id()->Name()]; }
// Globals that are used (appear in the profiles) of the bodies we're
// compiling. Includes globals just used as functions to call.
std::unordered_set<const ID*> all_accessed_globals;
// Same, but just the globals used in contexts beyond function calls.
std::unordered_set<const ID*> accessed_globals;
// Lambdas that are accessed.
std::unordered_set<const LambdaExpr*> accessed_lambdas;
// Events that are accessed.
std::unordered_set<std::string> accessed_events;
// Maps global names (not identifiers) to the names we use for them.
std::unordered_map<std::string, std::string> globals;