UNPKG

@specs-feup/clava

Version:

A C/C++ source-to-source compiler written in Typescript

70 lines 2.1 kB
import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; import ControlFlowGraph from "../graphs/ControlFlowGraph.js"; export default class LivenessAnalyser { /** * A Cytoscape graph representing the CFG */ private cfg; /** * Maps each CFG node ID to the corresponding def set */ private defs; /** * Maps each CFG node ID to the corresponding use set */ private uses; /** * Maps each CFG node ID to the corresponding LiveIn set */ private liveIn; /** * Maps each CFG node ID to the corresponding LiveOut set */ private liveOut; /** * Creates a new instance of the LivenessAnalyser class * @param cfg - The control flow graph. Can be either a Cytoscape graph or a ControlFlowGraph object. */ constructor(cfg: ControlFlowGraph | cytoscape.Core); /** * Checks if the given control flow graph is a Cytoscape graph or a ControlFlowGraph object. * Additionally, verifies if each instruction list node contains only one statement. * @param cfg - The control flow graph to be validated */ private validateCfg; /** * Computes the def, use, live in and live out sets of each CFG node * @returns An array that contains the def, use, live in and live out of each CFG node. */ analyse(): [ Map<string, Set<string>>, Map<string, Set<string>>, Map<string, Set<string>>, Map<string, Set<string>> ]; /** * * @param $jp - * @returns The def set for the given joinpoint */ private computeDef; /** * * @param $jp - * @returns The use set for the given joinpoint */ private computeUse; /** * Computes the def set of each CFG node according to its type */ private computeDefs; /** * Computes the use set of each CFG node according to its type */ private computeUses; /** * Computes the LiveIn and LiveOut set of each CFG node */ private computeLiveInOut; } //# sourceMappingURL=LivenessAnalyser.d.ts.map