package herdtools7
Module Env.RunTimeSource
Internal representation for subprograms.
Parameters
module C : RunTimeConfSignature
Types and constructors.
type global = {static : StaticEnv.global;(*References the static environment.
*)storage : C.v Storage.t;(*Binds global variables to their names.
*)funcs : func ASTUtils.IMap.t;(*Declared subprograms, maps called identifier to their code.
*)
}The global part of an environment.
The local part of an environment.
Builds a static environment, with an empty local part.
empty_scoped scope is an empty local environment in the scope scope.
Accessors
Fetches an identifier from the environment.
mem x env is true iff x is bound in env.
declare_local x v env is env where x is now bound to v. This binding will be discarded by the call to pop_scope corresponding to the last call to push_scope before this declaration.
assign_local x v env is env where x is now bound to v. It is assumed to be already bound in env.
declare_global x v env is env where x is now bound to v. It is supposed that x is not bound in env.
assign_global x v env is env where x is now bound to v. It is assumed to be already bound in env.
remove_local x env is env where x is not bound.
assign x v env assigns x to v in env, and returns if x was declared as a local or global identifier.
Loop unrolling
Push a new unrolling counter on the stack. The associated loop will be unrolled C.unroll times.
Push a new unrolling counter on the stack. The associated loop will be unrolled C.unroll - 1 times.
tick_decr env is (stop, env') where
- if the last counter is lower or equal to 1,
stopis true and the last counter is discarded. - if the last counter is bigger or equal to 2,
stopis false and the counter is decremented of 1.
Scope handling
same_scope env1 env2 is true iff env1's scope and env2'scope are equal.
Push a new scope on the declaration stack. Variables declared here will be stored until the corresponding pop_scope.