@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
30 lines (29 loc) • 1.66 kB
TypeScript
import type { ControlFlowInformation } from './control-flow-graph';
import type { NormalizedAst } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { DataflowGraph } from '../dataflow/graph/graph';
import { cfgAnalyzeDeadCode } from './cfg-dead-code';
export interface CfgPassInfo {
ast?: NormalizedAst;
dfg?: DataflowGraph;
}
export type CfgSimplificationPass = (cfg: ControlFlowInformation, info: CfgPassInfo) => ControlFlowInformation;
export declare const CfgSimplificationPasses: {
readonly 'unique-cf-sets': typeof uniqueControlFlowSets;
readonly 'analyze-dead-code': typeof cfgAnalyzeDeadCode;
readonly 'remove-dead-code': typeof cfgRemoveDeadCode;
readonly 'to-basic-blocks': typeof toBasicBlocks;
};
export type CfgSimplificationPassName = keyof typeof CfgSimplificationPasses;
export declare const DefaultCfgSimplificationOrder: ["unique-cf-sets"];
/**
* Simplify the control flow information by applying the given passes.
* This may reduce the vertex count, in- and outgoing edges, entry and exit points, etc.
*/
export declare function simplifyControlFlowInformation(cfg: ControlFlowInformation, info: CfgPassInfo, passes?: readonly CfgSimplificationPassName[]): ControlFlowInformation;
/**
* removes dead vertices and edges from the control flow graph.
*/
declare function cfgRemoveDeadCode(cfg: ControlFlowInformation, _info?: CfgPassInfo): ControlFlowInformation;
declare function uniqueControlFlowSets(cfg: ControlFlowInformation, _info?: CfgPassInfo): ControlFlowInformation;
declare function toBasicBlocks(cfg: ControlFlowInformation, _info?: CfgPassInfo): ControlFlowInformation;
export {};