UNPKG

@specs-feup/clava

Version:

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

60 lines 3.01 kB
import { Call, FunctionJp, Statement } from "../../Joinpoints.js"; export default class Outliner { private verbose; private defaultPrefix; /** * Sets the verbosity of the outliner, with false being the equivalent of a silent mode (true is the default) * @param verbose - the verbosity of the outliner */ setVerbosity(verbose: boolean): void; /** * Sets the prefix used for the autogenerated names of the outlined functions * @param prefix - the prefix to be used */ setDefaultPrefix(prefix: string): void; /** * Applies function outlining to a code region delimited by two statements. * Function outlining is the process of removing a section of code from a function and placing it in a new function. * The beginning and end of the code region must be at the same scope level. * @param begin - the first statement of the outlining region * @param end - the last statement of the outlining region * @returns an array with the joinpoints of the outlined function and the call to it. * These values are merely references, and all changes have already been committed to the AST at this point */ outline(begin: Statement, end: Statement): (FunctionJp | Call)[] | undefined; /** * Applies function outlining to a code region delimited by two statements. * Function outlining is the process of removing a section of code from a function and placing it in a new function. * The beginning and end of the code region must be at the same scope level. * @param begin - the first statement of the outlining region * @param end - the last statement of the outlining region * @param functionName - the name to give to the outlined function * @returns an array with the joinpoints of the outlined function and the call to it. * These values are merely references, and all changes have already been committed to the AST at this point */ outlineWithName(begin: Statement, end: Statement, functionName: string): (FunctionJp | Call)[] | undefined; /** * Verifies if a code region can undergo function outlining. * This check is performed automatically by the outliner itself, but it can be invoked manually if desired. * @param begin - the first statement of the outlining region * @param end - the last statement of the outlining region * @returns true if the outlining region is valid, false otherwise */ checkOutline(begin: Statement, end: Statement): boolean; private ensureVoidReturn; private wrapBeginAndEnd; private findParentFunction; private findGlobalVars; private createCall; private createArgs; private createFunction; private findNonvoidReturnStmts; private scalarsToPointers; private createParams; private findRefsInRegion; private findDeclsWithDependency; private splitRegions; private printMsg; private generateFunctionName; } //# sourceMappingURL=Outliner.d.ts.map