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