ROSE  0.9.9.139
varSets.h
1 #ifndef VAR_SETS_H
2 #define VAR_SETS_H
3 
4 #include "genericDataflowCommon.h"
5 #include "VirtualCFGIterator.h"
6 #include "CallGraphTraverse.h"
7 #include "variables.h"
8 
9 namespace varSets
10 {
11 
12  /*=======================================
13  ============= Globals =============
14  =======================================*/
15 
16  // returns the set of all global variables
17  // getCompilerGen - if =true, the returned set includes compiler-generated variables and doesn't if =false
18  varIDSet& getGlobalVars(SgProject* project, bool getCompilerGen=false);
19 
20  // returns the set of all global arrays
21  // getCompilerGen - if =true, the returned set includes compiler-generated variables and doesn't if =false
22  varIDSet& getGlobalArrays(SgProject* project, bool getCompilerGen=false);
23 
24  // returns the set of all global scalars
25  // getCompilerGen - if =true, the returned set includes compiler-generated variables and doesn't if =false
26  varIDSet& getGlobalScalars(SgProject* project, bool getCompilerGen=false);
27 
28 
29  /*=======================================
30  ============ Locals ============
31  =======================================*/
32 
33  // returns the set of variables declared in the given function
34  varIDSet& getLocalVars(const Function& func, bool getCompilerGen=false);
35 
36  // returns the set of arrays declared in the given function
37  varIDSet& getLocalArrays(const Function& func, bool getCompilerGen=false);
38 
39  // returns the set of scalars declared in the given function
40  varIDSet& getLocalScalars(const Function& func, bool getCompilerGen=false);
41 
42 
43  /*=================================================
44  ============ Function Parameters ============
45  =================================================*/
46 
47  void initFuncParams(const Function& func, bool getCompilerGen=false);
48 
49  // returns the set of variables that are the parameters of the given function
50  varIDSet& getFuncParamVars(const Function& func, bool getCompilerGen=false);
51 
52  // returns the set of arrays that are the parameters of the given function
53  varIDSet& getFuncParamArrays(const Function& func, bool getCompilerGen=false);
54 
55  // returns the set of scalars that are the parameters of the given function
56  varIDSet& getFuncParamlScalars(const Function& func, bool getCompilerGen=false);
57 
58  /*=======================================
59  ======== Referenced Variables =======
60  =======================================*/
61 
62  // returns the set of variables referenced in the given function
63  varIDSet& getFuncRefVars(const Function& func);
64 
65  // returns the set of arrays referenced in the given function
66  varIDSet& getFuncRefArrays(const Function& func);
67 
68  // returns the set of scalars referenced in the given function
69  varIDSet& getFuncRefScalars(const Function& func);
70 
71 
72 
73  /*=======================================
74  ============ Utilities ============
75  =======================================*/
76 
77  // adds to declaredVars the set of all variables declared within the given AST sub-tree
78  // getCompilerGen - if =true, the returned set includes compiler-generated variables and doesn't if =false
79  void getDeclaredVars(SgNode* root, bool getCompilerGen, varIDSet& declaredVars);
80 
81  // given a set of variables, creates a new set that only contains the
82  // array variables in the original set and returns this set
83  varIDSet arraysFilter(varIDSet& vars);
84 
85  // given a set of variables, creates a new set that only contains the
86  // non-array variables in the original set and returns this set
87  varIDSet scalarsFilter(varIDSet& vars);
88 
89 }//namespace varSets
90 
91 #endif
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:8322
Definition: varSets.h:9
This class represents a source project, with a list of SgFile objects and global information about th...