ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Slicing Class Reference

#include <Slicing.h>

Static Public Member Functions

static void completeSlice (SgProject *sgproject)
 Interface 1: Performs a complete slice, that is slices the input file and produces a compilable output file. More...
 
static void sliceOnlyStmtWithControl (SgProject *sgproject, set< SgNode * > &stmt)
 Interface 2: This function performs the same slicing as sliceOnlyStmts, however in addition this function includes statements connected to the control structure as well as return statements. More...
 
static void sliceOnlyStmts (SgProject *sgproject, set< SgNode * > &stmt_in_slice)
 Interface 3: This function finds only the statements that directly affect the slicing criterion. This function gives the same statements as the definition use associations gives. The protected function "onlyStmts" does the actual work, while this function is supposed to be the public one, which is called. More...
 

Static Protected Member Functions

static void init (SgProject *sgproject, set< SgStatement * > &slicing_criterion, SgFunctionDefinition *&func_defn)
 This function initiates the slicing process by finding the slicing criterion and the function definition in which the slicing criterion is, from the SgProject. More...
 
static void onlyStmts (set< SgStatement * > slicing_criterion, SgFunctionDefinition *func_defn, set< SgNode * > &stmt_in_slice)
 This function finds only the statements that directly affect the slicing criterion. This function gives the same statements as the definition use associations gives. More...
 
static void addControlStmts (SgProject *sgproject, MarkingNodes &v, SgFunctionDefinition *func_defn, set< SgNode * > &stmt_in_slice)
 This function, called after a call to "onlyStmts", adds the control structure around the statements from the call on "onlyStmts". More...
 
static void keepNeededFunc (SgProject *sgproject, MarkingNodes v, SgFunctionDefinition *func_defn)
 This function finds all needed functions and "unmarks" (that is remove the keep attribute from) the AST function declaration nodes that are not needed for the slice. More...
 
static void FindSlicingCriterion (SgGlobal *root, set< SgStatement * > &stmts)
 This function finds the statements between the pragma declarations. This is done using a traversal starting in the node "root" and collecting all the statements that are between the pragmas in the return variable " set<SgStatement*> stmts". More...
 
static void writeStatements (set< SgStatement * > stmts, string heading)
 Useful debugging function that writes the statements of a set to screen. More...
 
static void writeNodes (set< SgNode * > stmts, string heading)
 Useful debugging function that writes the nodes of a set to screen. More...
 
static bool isInList (SgNode *node, list< SgFunctionDeclaration * > funclist)
 This function returns a boolean value according to whether a SgNode is in a list of SgFunctionDeclarations. This function is used for including functions that are called in the slice, and to not include functions not called. More...
 

Detailed Description

This class controls the different parts of the slicing process: From the input of a SgProject object to the removal of nodes.

The slicing is divided into the following steps:

  1. Identifying the slicing criterion, that is the statements we are doing slicing on. These statements are placed between pragma declarations.
    See Also
    SlicingCriterion
  2. Identify the function definition is which the slicing cirterion is. These two first steps are done in the function "init".
    See Also
    init.
  3. Finding the statements which affect the slicing criterion, using the Definition Use Chain. This is done in the function "onlyStmts" which uses the class FindStatements.
    See Also
    onlyStmts, FindStatements
  4. Marking nodes in the AST is done in a traversal "MarkingNodes". If a node is in the set of statements necessary for the slice, then we mark the node with a AST attribute. At the same time we collect statements from the control statements which we might need to do a slicing on. Then we have to do the previous step one more time for these statements and then this traversal of marking as well. This is done in the function "addControlStmts". We also collect the functions that are called within the slice. Later the functions that are not needed for the slice are removed. This last part is done in the function "keepNeededFunc".
    See Also
    MarkingNodes, addControlStmts, keepNeededFunc.
  5. When we have found all statements necessary for the slice and also marked the nodes in the AST, then we are ready to remove the AST nodes which are not marked to be kept, and thus not needed for the slice.
    See Also
    RemovalOfNodes

Definition at line 34 of file Slicing.h.

Member Function Documentation

static void Slicing::completeSlice ( SgProject sgproject)
static

Interface 1: Performs a complete slice, that is slices the input file and produces a compilable output file.

static void Slicing::sliceOnlyStmtWithControl ( SgProject sgproject,
set< SgNode * > &  stmt 
)
static

Interface 2: This function performs the same slicing as sliceOnlyStmts, however in addition this function includes statements connected to the control structure as well as return statements.

static void Slicing::sliceOnlyStmts ( SgProject sgproject,
set< SgNode * > &  stmt_in_slice 
)
static

Interface 3: This function finds only the statements that directly affect the slicing criterion. This function gives the same statements as the definition use associations gives. The protected function "onlyStmts" does the actual work, while this function is supposed to be the public one, which is called.

static void Slicing::init ( SgProject sgproject,
set< SgStatement * > &  slicing_criterion,
SgFunctionDefinition *&  func_defn 
)
staticprotected

This function initiates the slicing process by finding the slicing criterion and the function definition in which the slicing criterion is, from the SgProject.

static void Slicing::onlyStmts ( set< SgStatement * >  slicing_criterion,
SgFunctionDefinition func_defn,
set< SgNode * > &  stmt_in_slice 
)
staticprotected

This function finds only the statements that directly affect the slicing criterion. This function gives the same statements as the definition use associations gives.

static void Slicing::addControlStmts ( SgProject sgproject,
MarkingNodes v,
SgFunctionDefinition func_defn,
set< SgNode * > &  stmt_in_slice 
)
staticprotected

This function, called after a call to "onlyStmts", adds the control structure around the statements from the call on "onlyStmts".

static void Slicing::keepNeededFunc ( SgProject sgproject,
MarkingNodes  v,
SgFunctionDefinition func_defn 
)
staticprotected

This function finds all needed functions and "unmarks" (that is remove the keep attribute from) the AST function declaration nodes that are not needed for the slice.

static void Slicing::FindSlicingCriterion ( SgGlobal root,
set< SgStatement * > &  stmts 
)
staticprotected

This function finds the statements between the pragma declarations. This is done using a traversal starting in the node "root" and collecting all the statements that are between the pragmas in the return variable " set<SgStatement*> stmts".

static void Slicing::writeStatements ( set< SgStatement * >  stmts,
string  heading 
)
staticprotected

Useful debugging function that writes the statements of a set to screen.

...

static void Slicing::writeNodes ( set< SgNode * >  stmts,
string  heading 
)
staticprotected

Useful debugging function that writes the nodes of a set to screen.

static bool Slicing::isInList ( SgNode node,
list< SgFunctionDeclaration * >  funclist 
)
staticprotected

This function returns a boolean value according to whether a SgNode is in a list of SgFunctionDeclarations. This function is used for including functions that are called in the slice, and to not include functions not called.


The documentation for this class was generated from the following file: