43 #ifndef BEHAVIORAL_HELPER_HPP 44 #define BEHAVIORAL_HELPER_HPP 47 #include "config_HAVE_FROM_PRAGMA_BUILT.hpp" 75 #define INTERNAL "internal_" 93 static std::map<unsigned int, std::pair<std::string, int>>
definitions;
96 static std::map<std::string, unsigned int>
used_name;
146 virtual std::tuple<std::string, unsigned int, unsigned int>
get_definition(
unsigned int index,
148 bool& is_system)
const;
158 const bool dot =
false)
const;
206 virtual std::string
print_type(
unsigned int type,
bool global =
false,
bool print_qualifiers =
false,
207 bool print_storage =
false,
unsigned int var = 0,
209 const std::string& prefix =
"",
const std::string& tail =
"")
const;
222 virtual unsigned long long get_size(
unsigned int var)
const;
284 virtual bool is_a_struct(
unsigned int variable)
const;
291 virtual bool is_an_union(
unsigned int variable)
const;
296 virtual bool is_an_array(
unsigned int variable)
const;
343 virtual bool is_static(
unsigned int decl)
const;
350 virtual bool is_extern(
unsigned int decl)
const;
463 virtual unsigned int get_type(
const unsigned int var)
const;
476 unsigned int GetElements(
const unsigned int type)
const;
591 virtual const std::string
get_label_name(
unsigned int label_expr_nid)
const;
628 bool init_has_to_be_printed)
const;
661 #if HAVE_FROM_PRAGMA_BUILT 665 size_t GetOmpForDegree()
const;
670 bool IsOmpFunctionAtomic()
const;
675 bool IsOmpBodyLoop()
const;
678 #if HAVE_FROM_PRAGMA_BUILT 682 bool IsOmpAtomic()
const;
707 bool CanBeMoved(
const unsigned int node_index)
const;
714 bool IsStore(
const unsigned int statement_index)
const;
721 bool IsLoad(
const unsigned int statement_index)
const;
728 bool IsLut(
const unsigned int statement_index)
const;
virtual unsigned long long get_size(unsigned int var) const
Return the size in bit of a C object.
std::string PrintVarDeclaration(unsigned int var, const var_pp_functorConstRef vppf, bool init_has_to_be_printed) const
This function prints the declaration of a variable without the closing ";".
bool CanBeMoved(const unsigned int node_index) const
Return if an operation can be moved.
bool CanBeSpeculated(const unsigned int node_index) const
Return true if an operation can be speculated.
virtual bool is_a_complex(unsigned int index) const
Return true if index is a variable or a type of type complex.
This struct specifies the field bloc (basic block).
virtual std::string PrintNode(const tree_nodeConstRef &node, vertex v, const var_pp_functorConstRef vppf) const
Print the operations corresponding to the node.
virtual std::string print_attributes(unsigned int var, const var_pp_functorConstRef vppf, bool first=true) const
Print the attributes associated to a variable.
virtual unsigned int get_intermediate_var(unsigned int obj) const
Return the intermediate variable of an operation.
virtual bool is_an_array_ref(unsigned int variable) const
Return true if the index is an array ref.
static void clear_renaming_table()
remove all the entries from the renaming table
std::string GetMangledFunctionName() const
virtual bool is_a_mem_ref(unsigned int variable) const
Return true if the index is a mem_ref.
bool get_opaque() const
Return the opaque flag.
virtual unsigned int get_component_ref_record(unsigned int obj) const
Return the record variable of a component ref.
std::string get_function_name() const
Return the name of the function.
void add_initialization(unsigned int var, unsigned int init)
Add the initialization of a variables.
virtual unsigned int end_with_a_cond_or_goto(const blocRef &block) const
Return the nodeID of the last statement of a basic block in case that statement is a cond or a goto e...
BehavioralHelper(const application_managerRef AppM, unsigned int index, bool body, const ParameterConstRef parameters)
Constructor.
bool is_a_vector(unsigned int variable) const
Return true if index is a variable or a type of type vector.
bool IsLoad(const unsigned int statement_index) const
Return if an operation is a load.
This class manages the tree structures extracted from the raw file.
virtual std::string PrintInit(const tree_nodeConstRef &var, const var_pp_functorConstRef vppf) const
Print the initialization part.
std::vector< tree_nodeRef > GetParameters() const
Return the list of index of original parameters of the function.
Class specification of the graph structures.
virtual std::string print_phinode_res(unsigned int phi_node_id, vertex v, const var_pp_functorConstRef vppf) const
virtual bool is_var_args() const
Returns true if this function is of var args type.
static std::map< unsigned int, std::string > vars_renaming_table
Variable renaming table.
std::string function_name
Name of the function.
unsigned int get_function_index() const
Return the index of the function.
virtual bool is_empty_return(unsigned int index) const
return true in case index is a return expr with an empty operand.
virtual unsigned int get_mem_ref_offset(unsigned int obj) const
Return the offset of a mem ref.
void set_opaque()
Set opaque flag to true.
virtual std::string print_type(unsigned int type, bool global=false, bool print_qualifiers=false, bool print_storage=false, unsigned int var=0, const var_pp_functorConstRef vppf=var_pp_functorConstRef(), const std::string &prefix="", const std::string &tail="") const
Print a type and its variable in case var is not zero.
const application_managerRef AppM
The application manager.
virtual unsigned int get_operand_from_unary_expr(unsigned int obj) const
Return the index of the operand if index is addr_expr, a realpart_expr or a imagpart_expr.
virtual bool is_a_result_decl(unsigned int obj) const
Return true if index is a result_decl.
virtual bool is_an_array(unsigned int variable) const
Return true if index is a variable or a type of type array.
std::map< unsigned int, unsigned int > initializations
Structure which stores initializations.
virtual bool is_unsigned(unsigned int index) const
Return true if index is a variable or a type of type unsigned int.
redefinition of map to manage ordered/unordered structures
bool IsDefaultSsaName(const unsigned int ssa_name_index) const
Return true if node is the default ssa_name.
bool has_implementation() const
Return true if function has implementation.
virtual bool is_a_realpart_expr(unsigned int obj) const
Return true if index is a realpart_expr.
Abstract pure class for the tree structure.
const tree_managerConstRef TM
The tree manager.
A set of const tree node.
virtual std::tuple< std::string, unsigned int, unsigned int > get_definition(unsigned int index, bool &is_system) const
Returns where the type index is defined.
virtual std::string PrintConstant(const tree_nodeConstRef &var, const var_pp_functorConstRef vppf=var_pp_functorConstRef()) const
Print the constant associated with var.
virtual bool is_a_pointer(unsigned int variable) const
Return true if index is a variable or a type of type pointer.
virtual bool is_operating_system_function(const unsigned int obj) const
Return true if function is an operating system function.
unsigned int is_name_used(std::string var) const
Return if a variable with this name already exists.
bool body
Flag to check if behavioral_graph_manager contains the function implementation.
static std::map< unsigned int, std::pair< std::string, int > > definitions
Maps between unqualified type and definition of a corresponding qualified type.
virtual std::string print_forward_declaration(unsigned int type) const
Print the declaration of a non built-in type.
virtual unsigned int get_array_ref_array(unsigned int obj) const
Return the array variable of an array ref.
const std::list< unsigned int > get_parameters() const
Return the list of index of original parameters of the function.
CustomOrderedSet< unsigned int > get_read_global_variables() const
Get the global variables read by the correspondent function.
void InvaildateVariableName(const unsigned int index)
Invalidate cached variable name.
const ParameterConstRef Param
The set of input parameters.
virtual bool is_an_enum(unsigned int index) const
Return true if index is a variable or a type of type enum.
virtual unsigned int GetInit(unsigned int var, CustomUnorderedSet< unsigned int > &list_of_variables) const
return the initialization object associated with the variable.
bool has_bit_field(unsigned int variable) const
Return true if the variable is a field_decl and it has a bitfield.
unsigned int GetFunctionReturnType(unsigned int function) const
Return the index associated with the type of the return of the function.
virtual bool is_va_start_call(unsigned int stm) const
return true in case stm is a va_start call_expr
virtual unsigned int is_named_pointer(const unsigned int index) const
return the nodeid of the named pointer (pointer_type with a name different
virtual bool is_extern(unsigned int decl) const
check if a given index is a extern declaration
redefinition of set to manage ordered/unordered structures
virtual int unsigned start_with_a_label(const blocRef &block) const
Return the nodeID of the first statement of a basic block in case that statement is a label expressio...
static void rename_a_variable(unsigned int var, const std::string &new_name)
rename a variable
virtual bool is_int(unsigned int index) const
Return true if index is a variable or a type of type int.
virtual unsigned int get_mem_ref_base(unsigned int obj) const
Return the base of a mem ref.
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
Base class functor used by prettyPrintVertex to print variables.
virtual bool is_bool(unsigned int index) const
Return true if index is a variable or a type of type bool.
bool function_has_to_be_printed(unsigned int f_id) const
returns true if the function body has to be printed by the C backend
unsigned int GetUnqualified(const unsigned int index) const
Return the unqualified version of a type.
virtual bool is_static(unsigned int decl) const
check if a given index is a static declaration
virtual bool is_a_constant(unsigned int obj) const
Return true if the index is a constant object.
std::string PrintVariable(unsigned int var) const
Print the name of the variable associated to the index.
virtual bool is_an_addr_expr(unsigned int variable) const
Return true if the index is an addr_expr.
This struct specifies the block node.
void set_not_opaque()
Set opaque flag to false.
virtual bool is_natural(unsigned int index) const
Return true if index is a variable grater than or equal to zero.
virtual bool is_a_struct(unsigned int variable) const
Return true if index is a variable or a type of type struct.
virtual ~BehavioralHelper()
Destructor.
Template definition of refcount.
void add_written_global_variable(unsigned int variable)
Add a writing of a global variables.
virtual void GetTypecast(const tree_nodeConstRef &tn, TreeNodeConstSet &types) const
return the types used in type casting by tn
void init(int bucket[BUCKETSIZE])
std::string print_vertex(const OpGraphConstRef g, const vertex v, const var_pp_functorConstRef vppf, const bool dot=false) const
Print the operations corrisponding to the vertex.
virtual bool is_real(unsigned int index) const
Return true if index is a variable or a type of type real.
bool IsStore(const unsigned int statement_index) const
Return if an operation is a store.
unsigned int GetElements(const unsigned int type) const
Given an array or a vector return the element type.
virtual unsigned int GetVarFromSsa(unsigned int index) const
Return the index of the variable base of a ssa var.
virtual bool is_a_imagpart_expr(unsigned int obj) const
Return true if index is a imagpart_expr.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
virtual bool is_an_union(unsigned int variable) const
Return true if index is a variable of a type of type union.
virtual unsigned int get_indirect_ref_var(unsigned int obj) const
Return the variable of an indirect ref.
virtual unsigned int get_type(const unsigned int var) const
Return the type of the variable.
void add_read_global_variable(unsigned int variable)
Add a read of a global variable.
bool opaque
Flag to check if a call to this function has to be treated as a TYPE_OPAQUE nodeID.
unsigned int function_index
Index of the function.
virtual unsigned int get_component_ref_field(unsigned int obj) const
Return the field index of a component ref.
virtual TreeNodeConstSet GetParameterTypes() const
Returns the types of the parameters.
virtual bool is_a_component_ref(unsigned int variable) const
Return true if the index is a component ref.
virtual bool is_an_indirect_ref(unsigned int variable) const
Return true if the index is an indirect ref.
static std::map< std::string, unsigned int > used_name
Set of variables name already used.
CONSTREF_FORWARD_DECL(OpGraph)
Class used to describe a particular graph with operations as nodes.
virtual std::string print_type_declaration(unsigned int type) const
Print the declaration of a non built-in type.
virtual const std::string get_label_name(unsigned int label_expr_nid) const
return the label name associated with the label expression
static std::map< unsigned int, std::string > vars_symbol_table
The var symbol table.
refcount< const var_pp_functor > var_pp_functorConstRef
bool IsLut(const unsigned int statement_index) const
Return if an operation is a lut_expr.
CustomOrderedSet< unsigned int > get_written_global_variables() const
Get the global variables written by the correspondent function.
REF_FORWARD_DECL(application_manager)
virtual unsigned int get_array_ref_index(unsigned int obj) const
Return the index variable of an array ref.
std::string get_asm_string(const unsigned int node_index) const
return the string associated with the gimple_asm
int debug_level
the debug level
virtual unsigned int get_pointed_type(const unsigned int type) const
Return the pointed type of a pointer.
virtual unsigned int get_attributes(unsigned int var) const
return the attributes associated with the variable.