qat.core.result_base module

class PreservedResults

Bases: object

A mechanism for result invalidation and preservation. Similar to LLVM’s new PassManager, we state that each transform pass must declare what analysis results it preserves. In this case, the pass returns a PreservedResults instance which is then used by the PassManager for cache housekeeping.

static all()

Indicates that all of the previously computed results remain valid. The pass manager will do nothing as analyses results are still safe and correct after the pass in question has finished running.

static discard(*res_obj)

Convenient inverse selector for the preserve() API. This will cause the pass manager to discard and evict only results pointed to by the argument.

static none()

Indicates that none of the previously computed results are valid. This will cause the pass manager to evict cached results after the (transform) pass in question has finished running.

static preserve(*res_obj)

Selective preservation of the results or indeed result sets indicated by the argument. This will cause the pass manager to filter through the result cache and preserve only the ones that the argument points to.

class ResultConcept

Bases: ABC

Base class describing the abstraction of an analysis result.

See ResultManager.

class ResultInfoMixin

Bases: ABC

Base mixin specifying result identification mechanism. A result has an id, name, and value.

See ResultManager.

id()
name()
value()
class ResultManager

Bases: object

Represents a collection of analysis results with caching and aggregation capabilities.

Passes that merely compute analyses on the IR must not invalidate prior results. Passes that mutate any IR units are likely to invalidate predecessor results.

An analysis pass can produce 1 or more result objects. There is in theory a duality between passes and the results they produce.

To keep things simple, the ResultManager is just a set of analysis results. Result identification is also kept trivial where a UUID is used internally. Proper identification mechanism will be called upon once we feel the need for a more sophisticated PassManager.

See PassManager.

add(res_obj)

Add a results object to the manager, overwriting any previous results of the same type.

Parameters:

res_obj (ResultInfoMixin) – Results from a pass, typically an analysis pass.

check_for_type(ty)

Checks the result manager contains a result with a given type.

Parameters:

ty (type) – The results type.

Return type:

bool

cleanup()
lookup_by_type(ty)

Find a result by its type. Throws an error if none or multiple are found.

Parameters:

ty (type[TypeVar(ResultType, bound= ResultInfoMixin)]) – The results type.

Return type:

TypeVar(ResultType, bound= ResultInfoMixin)

mark_as_dirty(*res_objs)
remove_by_type(ty)
property results
update(other_res_mgr)

Add the results from another results manager.

Parameters:

other_res_mgr (ResultManager)

class ResultModel(res_obj)

Bases: ResultConcept

Wrapper for any result object typically produced by an analysis pass.

See ResultManager.

property id
property value