All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
misc.h
Go to the documentation of this file.
1 #ifndef MISC_H_INCLUDED_
2 #define MISC_H_INCLUDED_
3 
4 #include "rose.h"
5 #include <string>
6 
7 namespace risc
8 {
9 
10 namespace tools
11 {
12 
19 bool
20 is_data_structure(SgType* type);
21 
28 bool
29 is_builtin_type(SgType* type);
30 
31 
38 bool
39 class_types_are_identical(SgClassDefinition* cd1, SgClassDefinition* cd2);
40 
47 bool
48 is_func_name(const SgFunctionDeclaration* function, const std::string& name);
49 
55 void
56 print_indented(std::string s, unsigned indent);
57 
64 SgClassDefinition*
65 class_definition_of_variable(SgVariableDeclaration* var_decl);
66 
74 bool
75 is_builtin_function(SgFunctionDeclaration *func_decl);
76 
99 bool
100 all_cfg_branches_end_in_break(SgNode *node, int &break_counter);
101 
124 bool
125 all_cfg_branches_end_in_continue(SgNode *node, int &continue_counter);
126 
134 SgStatement*
136 
145 bool
146 is_conditional_break(SgScopeStatement const * const loop_stmt,
147  SgBreakStmt const * const break_stmt);
148 
155 SgScopeStatement*
156 find_break_surrounding_scope(SgBreakStmt *break_stmt);
157 
167 bool
168 break_belongs_to_loop(SgScopeStatement *loop_stmt,
169  SgBreakStmt const * const break_stmt);
170 
171 bool is_located_in_rose_header(SgNode *node);
172 
180 SgMemberFunctionDeclaration*
181 get_constructor(SgClassDefinition *class_def);
182 
191 void
193  std::string &input,
194  const std::string &from,
195  const std::string &to);
196 
202 std::string get_mangled_name(SgClassDefinition *class_def);
203 
209 SgVariableSymbol* find_global_variable(std::string name, SgProject *project);
210 
211 
217 bool is_known_function(SgFunctionDeclaration *statement);
218 
224 bool is_in_std_namespace(SgDeclarationStatement *statement);
225 
231 bool is_in_systemc_namespace(SgDeclarationStatement *statement);
232 
238 bool is_in_gnu_cxx_namespace(SgDeclarationStatement *statement);
239 
248 SgVariableSymbol* get_most_outer_var(SgExpression *expr);
249 
254 bool has_no_variable_expressions(SgExpression *expr);
255 
256 }; // end namespace tools
257 
258 }; // end namespace risc
259 
260 #endif /* MISC_H_INCLUDED_ */
261 
262 /* ex: set softtabstop=2 tabstop=2 shiftwidth=2 expandtab: */
bool has_no_variable_expressions(SgExpression *expr)
This function returns true, if the expression contains only literals.
Definition: misc.cpp:660
bool is_in_gnu_cxx_namespace(SgDeclarationStatement *statement)
This function checks if the statement is declared in the systemc namespace (sc_core/sc_dt) ...
Definition: misc.cpp:565
void print_indented(std::string s, unsigned indent)
Prints a string with indention.
Definition: misc.cpp:80
SgClassDefinition * class_definition_of_variable(SgVariableDeclaration *var_decl)
Determines the class defintion of varialbe It is expected that the type is SgClassType.
Definition: misc.cpp:97
bool is_in_systemc_namespace(SgDeclarationStatement *statement)
This function checks if the statement is declared in the systemc namespace (sc_core/sc_dt) ...
Definition: misc.cpp:593
bool class_types_are_identical(SgClassDefinition *cd1, SgClassDefinition *cd2)
Compares two classes.
Definition: misc.cpp:72
bool is_conditional_break(SgScopeStatement const *const loop_stmt, SgBreakStmt const *const break_stmt)
This function checks if a given break statement is unconditioned.
Definition: misc.cpp:357
SgStatement * get_previous_stmt_in_basic_block(SgNode *node)
This function determines the previous statement of the statement &#39;node&#39; in the next surrounding basic...
Definition: misc.cpp:327
bool is_data_structure(SgType *type)
This function checks if the passed type represents a data structure.
Definition: misc.cpp:4
SgVariableSymbol * find_global_variable(std::string name, SgProject *project)
This function search in the global namespace for the variable with the name &#39;name&#39; and return the ass...
Definition: misc.cpp:488
bool is_known_function(SgFunctionDeclaration *statement)
This function checks if the statement is ::memset ::free ::rand ::putchar ::printf.
Definition: misc.cpp:520
SgVariableSymbol * get_most_outer_var(SgExpression *expr)
The function returns the most outer variable in an expression. Example: a -&gt; a array[i] -&gt; array arra...
Definition: misc.cpp:623
bool is_func_name(const SgFunctionDeclaration *function, const std::string &name)
Compares the function name with the given string.
Definition: misc.cpp:90
bool all_cfg_branches_end_in_continue(SgNode *node, int &continue_counter)
This function determines if all cfg branches in the statement &#39;node&#39; will end in a continue statement...
Definition: misc.cpp:265
SgMemberFunctionDeclaration * get_constructor(SgClassDefinition *class_def)
This function returns the constructor of class. For a module, primitive channel, and a hierarchical c...
Definition: misc.cpp:424
std::string get_mangled_name(SgClassDefinition *class_def)
This function returns the mangled name of a class definition. The mangled name is in the style of A::...
Definition: misc.cpp:479
SgScopeStatement * find_break_surrounding_scope(SgBreakStmt *break_stmt)
This function finds the surrounding scope statement of a break. The break can be surrounded by a whil...
Definition: misc.cpp:380
bool all_cfg_branches_end_in_break(SgNode *node, int &break_counter)
This function determines if all cfg branches in the statement &#39;node&#39; will end in a break statement...
Definition: misc.cpp:200
void find_and_replace_all(std::string &input, const std::string &from, const std::string &to)
This function searches for the given string from and replaces all occurrences with the string to in t...
Definition: misc.cpp:464
bool is_in_std_namespace(SgDeclarationStatement *statement)
This function checks if the statement is declared in the std namespace.
Definition: misc.cpp:537
bool is_builtin_function(SgFunctionDeclaration *func_decl)
Checks if a given function is a C++ builtin function This function is taken/inspired from the Rose bu...
Definition: misc.cpp:135
bool is_located_in_rose_header(SgNode *node)
Definition: misc.cpp:177
bool break_belongs_to_loop(SgScopeStatement *loop_stmt, SgBreakStmt const *const break_stmt)
This function checks if a given break statement belongs to a given loop statements.
Definition: misc.cpp:406
bool is_builtin_type(SgType *type)
This function checks if the passed type represents a C++ builtin type.
Definition: misc.cpp:19