44 #ifndef TREE_MANIPULATION_HPP 45 #define TREE_MANIPULATION_HPP 74 #define ALGN_BIT_SIZE 64 75 #define ALGN_UNSIGNED_INT 32 77 #define ALGN_LONG_LONG_INT 64 78 #define ALGN_UNSIGNED_LONG_LONG_INT 64 80 #define ALGN_BOOLEAN 8 81 #define ALGN_POINTER_M64 64 82 #define ALGN_POINTER_M32 32 84 #define PREC_BIT_SIZE 64 85 #define PREC_UNSIGNED_INT 32 87 #define PREC_LONG_LONG_INT 64 88 #define PREC_UNSIGNED_LONG_LONG_INT 64 90 #define SIZE_VALUE_BIT_SIZE 64 91 #define SIZE_VALUE_UNSIGNED_INT 32 92 #define SIZE_VALUE_LONG_LONG_INT 64 93 #define SIZE_VALUE_UNSIGNED_LONG_LONG_INT 64 94 #define SIZE_VALUE_INT 32 95 #define SIZE_VALUE_BOOL 8 96 #define SIZE_VALUE_FUNCTION 8 97 #define SIZE_VALUE_POINTER_M32 32 98 #define SIZE_VALUE_POINTER_M64 64 100 #define MIN_VALUE_BIT_SIZE (std::numeric_limits<unsigned long long>::min()) 101 #define MIN_VALUE_INT (std::numeric_limits<int>::min()) 102 #define MIN_VALUE_UNSIGNED_INT (std::numeric_limits<unsigned int>::min()) 103 #define MIN_VALUE_LONG_LONG_INT (std::numeric_limits<long long>::min()) 104 #define MIN_VALUE_UNSIGNED_LONG_LONG_INT (std::numeric_limits<unsigned long long>::min()) 106 #define MAX_VALUE_BIT_SIZE (std::numeric_limits<unsigned long long>::max()) 107 #define MAX_VALUE_INT (std::numeric_limits<int>::max()) 108 #define MAX_VALUE_UNSIGNED_INT (std::numeric_limits<unsigned int>::max()) 109 #define MAX_VALUE_LONG_LONG_INT (std::numeric_limits<long long>::max()) 110 #define MAX_VALUE_UNSIGNED_LONG_LONG_INT (std::numeric_limits<unsigned long long>::max()) 144 const unsigned int integer_cst_nid)
const;
173 enum kind operation_kind)
const;
185 const std::string&
srcp,
enum kind operation_kind)
const;
199 enum kind operation_kind)
const;
214 const std::string&
srcp,
enum kind operation_kind)
const;
237 const std::string&
srcp)
const;
267 const std::string&
srcp,
int used,
bool register_flag =
false,
268 bool readonly_flag =
false)
const;
289 const std::string&
srcp,
unsigned int algn,
bool artificial_flag =
false)
const;
313 const std::string&
srcp,
unsigned int algn,
int used,
bool artificial_flag =
false,
314 int use_tmpl = -1,
bool static_static_flag =
false,
bool extern_flag =
false,
315 bool static_flag =
false,
bool register_flag =
false,
bool readonly_flag =
false,
316 const std::string& bit_values =
"",
bool addr_taken =
false,
317 bool addr_not_taken =
false)
const;
410 bool virtual_flag =
false)
const;
423 const std::vector<std::pair<tree_nodeRef, unsigned int>>& list_of_def_edge,
424 unsigned int function_decl_nid,
bool virtual_flag =
false)
const;
437 unsigned int function_decl_nid,
const std::string&
srcp)
const;
449 const std::string&
srcp)
const;
453 unsigned int function_decl_nid,
const std::string&
srcp)
const;
465 const std::string&
srcp)
const;
477 unsigned int function_decl_nid,
const std::string&
srcp)
const;
492 void create_goto(
const blocRef&
block,
unsigned int function_decl_nid,
unsigned int label_expr_nid)
const;
505 const std::vector<tree_nodeConstRef>& argsT,
const tree_nodeConstRef& returnType,
506 const std::string&
srcp,
bool with_body)
const;
524 blocRef
create_basic_block(std::map<unsigned int, blocRef>& list_of_bloc, std::vector<unsigned int> predecessors,
525 std::vector<unsigned int> successors, std::vector<tree_nodeRef> stmt,
unsigned int number,
526 unsigned int true_edge = 0,
unsigned int false_edge = 0,
527 std::vector<tree_nodeRef>
phi = std::vector<tree_nodeRef>())
const;
534 void bb_add_stmts(blocRef& bb,
const std::vector<tree_nodeRef>& stmt)
const;
548 void bb_add_successors(blocRef& bb,
const std::vector<unsigned int>& successors)
const;
562 void bb_add_predecessors(blocRef& bb,
const std::vector<unsigned int>& predecessors)
const;
624 void bb_set_true_edge(blocRef& bb,
const unsigned int& true_edge_index)
const;
635 unsigned int function_decl_nid)
const;
645 const blocRef&
block,
unsigned int function_decl_nid)
const;
655 const blocRef&
block,
unsigned int function_decl_nid)
const;
664 unsigned int function_decl_nid)
const;
676 unsigned int function_decl_nid)
const;
691 const blocRef&
block,
unsigned int function_decl_nid)
const;
701 const std::string&
srcp)
const;
719 const std::string&
srcp)
const;
754 const std::string& version_suffix);
tree_nodeRef CreateOrExpr(const tree_nodeConstRef &first_condition, const tree_nodeConstRef &second_condition, const blocRef &block, unsigned int function_decl_nid) const
Create an or expression.
tree_nodeRef CreateNotExpr(const tree_nodeConstRef &condition, const blocRef &block, unsigned int function_decl_nid) const
UTILITY.
~tree_manipulation()
This is the destructor of the tree_manipulation.
tree_nodeRef GetBitsizeType() const
Function that creates a bit_size type if it is not already present, otherwise it returns the one that...
tree_nodeRef ExtractCondition(const tree_nodeRef &condition, const blocRef &block, unsigned int function_decl_nid) const
Extract computation of condition from a gimple_cond.
tree_nodeRef create_quaternary_operation(const tree_nodeConstRef &type, const tree_nodeRef &op0, const tree_nodeRef &op1, const tree_nodeRef &op2, const tree_nodeRef &op3, const std::string &srcp, enum kind operation_kind) const
Function used to create a quaternary expression.
This struct specifies the field bloc (basic block).
tree_nodeRef CreateEqExpr(const tree_nodeConstRef &first_operand, const tree_nodeConstRef &second_operand, const blocRef &block, unsigned int function_decl_nid) const
Create an eq_expr.
void bb_set_false_edge(blocRef &bb, const unsigned int &false_edge_index) const
Function that sets in basic block bb the index of the then basic block in case the last statement is ...
tree_nodeRef create_gimple_cond(const tree_nodeRef &expr, unsigned int function_decl_nid, const std::string &srcp) const
GIMPLE_COND.
void bb_add_stmt(blocRef &bb, const tree_nodeRef &stmt) const
Function that adds in basic block bb the statement stmt.
tree_managerRef TreeM
Tree Manager.
tree_nodeRef create_translation_unit_decl() const
create or find a global scope
static unsigned int goto_label_unique_id
store a unique id used during the creation of the label_decl associated with a gimple_goto.
struct definition of the source position.
tree_nodeRef CreateUnsigned(const tree_nodeConstRef &signed_type) const
Create an unsigned integer type starting from signed type.
struct definition of the function_decl tree node.
This class manages the tree structures extracted from the raw file.
tree_nodeRef GetSizeType() const
create a sizetype builtin type in case it has not already been created, otherwise it returns the one ...
unsigned int InlineFunctionCall(const tree_nodeRef &call_node, const tree_nodeRef &caller_node)
Execute function call inlining of given call statement (call graph must be recomputed after inlining)...
void bb_remove_successor(blocRef &bb, const unsigned int &successor) const
Function that removes a successor in basic block bb.
tree_nodeRef CloneFunction(const tree_nodeRef &tn, const std::string &funNameSuffix)
CloneFunction duplicates a function.
tree_nodeRef create_binary_operation(const tree_nodeConstRef &type, const tree_nodeRef &op0, const tree_nodeRef &op1, const std::string &srcp, enum kind operation_kind) const
Function used to create a binary expression.
tree_nodeRef GetSignedIntegerType() const
Function that creates a integer type if it is not already present, otherwise it returns the one that ...
void bb_add_successor(blocRef &bb, const unsigned int &successor) const
Function that adds a successor in basic block bb.
tree_nodeRef CreateIntegerCst(const tree_nodeConstRef &type, integer_cst_t value, const unsigned int integer_cst_nid) const
CONST_OBJ_TREE_NODES.
tree_nodeRef CreateAddrExpr(const tree_nodeConstRef &tn, const std::string &srcp) const
Create an addr_expr.
redefinition of map to manage ordered/unordered structures
tree_nodeRef create_unary_operation(const tree_nodeConstRef &type, const tree_nodeRef &op, const std::string &srcp, enum kind operation_kind) const
EXPRESSION_TREE_NODES.
void bb_add_predecessor(blocRef &bb, const unsigned int &predecessor) const
Function that adds a predecessor in basic block bb.
tree_nodeRef CreateGimpleAssign(const tree_nodeConstRef &type, const tree_nodeConstRef &min, const tree_nodeConstRef &max, const tree_nodeRef &op, unsigned int function_decl_nid, const std::string &srcp) const
Create gimple assignment.
Abstract pure class for the tree structure.
tree_nodeRef create_parm_decl(const tree_nodeRef &name, const tree_nodeConstRef &type, const tree_nodeRef &scpe, const tree_nodeConstRef &argt, const tree_nodeRef &smt_ann, const tree_nodeRef &init, const std::string &srcp, int used, bool register_flag=false, bool readonly_flag=false) const
DECL_NODES.
blocRef create_basic_block(std::map< unsigned int, blocRef > &list_of_bloc, std::vector< unsigned int > predecessors, std::vector< unsigned int > successors, std::vector< tree_nodeRef > stmt, unsigned int number, unsigned int true_edge=0, unsigned int false_edge=0, std::vector< tree_nodeRef > phi=std::vector< tree_nodeRef >()) const
BASIC BLOCK.
void bb_set_true_edge(blocRef &bb, const unsigned int &true_edge_index) const
Function that sets in basic block bb the index of the if basic block in case the last statement is a ...
tree_nodeRef create_lut_expr(const tree_nodeConstRef &type, const tree_nodeRef &op0, const tree_nodeRef &op1, const tree_nodeRef &op2, const tree_nodeRef &op3, const tree_nodeRef &op4, const tree_nodeRef &op5, const tree_nodeRef &op6, const tree_nodeRef &op7, const tree_nodeRef &op8, const std::string &srcp) const
create_lut_expr: function used to create a generic lut_expr operation
void bb_remove_successors(blocRef &bb, const std::vector< unsigned int > &successors) const
Function that removes a list of successors in basic block bb.
tree_nodeRef CreateVectorBooleanType(const unsigned long long number_of_elements) const
Create a vector bool type.
tree_nodeRef GetPointerType(const tree_nodeConstRef &ptd, unsigned long long algn=0) const
Function that creates a pointer type if it is not already present, otherwise it returns the one that ...
void create_goto(const blocRef &block, unsigned int function_decl_nid, unsigned int label_expr_nid) const
create a goto expression.
const application_managerRef AppM
Application manager data structure.
void bb_add_successors(blocRef &bb, const std::vector< unsigned int > &successors) const
Function that adds a list of successors in basic block bb.
void bb_remove_predecessors(blocRef &bb, const std::vector< unsigned int > &predecessors) const
Function that removes a list of predecessors in basic block bb.
void bb_add_predecessors(blocRef &bb, const std::vector< unsigned int > &predecessors) const
Function that adds a list of predecessors in basic block bb.
void bb_remove_all_predecessors(blocRef &bb) const
Function that removes all the predecessors of basic block bb.
tree_nodeRef create_result_decl(const tree_nodeRef &name, const tree_nodeRef &type, const tree_nodeRef &scpe, const tree_nodeRef &size, const tree_nodeRef &smt_ann, const tree_nodeRef &init, const std::string &srcp, unsigned int algn, bool artificial_flag=false) const
Function used to create a result_decl.
tree_nodeRef GetFunctionType(const tree_nodeConstRef &returnType, const std::vector< tree_nodeConstRef > &argsT) const
Create a function type.
tree_nodeRef create_function_decl(const std::string &function_name, const tree_nodeRef &scpe, const std::vector< tree_nodeConstRef > &argsT, const tree_nodeConstRef &returnType, const std::string &srcp, bool with_body) const
create the declaration of a function without its body
const ParameterConstRef parameters
The set of input parameters.
tree_nodeRef GetBooleanType() const
Function that creates a boolean type if it is not already present, otherwise it returns the one that ...
This struct specifies the block node.
tree_nodeRef create_gimple_return(const tree_nodeConstRef &type, const tree_nodeConstRef &expr, unsigned int function_decl_nid, const std::string &srcp) const
GIMPLE_RETURN.
tree_nodeRef GetCustomIntegerType(unsigned long long prec, bool unsigned_p) const
create an integer type starting from a given prec
TreeVocabularyTokenTypes_TokenEnum
Template definition of refcount.
void init(int bucket[BUCKETSIZE])
tree_nodeRef CreateCallExpr(const tree_nodeConstRef &called_function, const std::vector< tree_nodeRef > &args, const std::string &srcp) const
Create a call_expr.
tree_nodeRef create_ternary_operation(const tree_nodeConstRef &type, const tree_nodeRef &op0, const tree_nodeRef &op1, const tree_nodeRef &op2, const std::string &srcp, enum kind operation_kind) const
Function used to create a ternary expression.
CONSTREF_FORWARD_DECL(Parameter)
bool VersionFunctionCall(const tree_nodeRef &call_node, const tree_nodeRef &caller_node, const std::string &version_suffix)
Perform function call versioning.
tree_nodeRef GetUnsignedLongLongType() const
Function that creates a long long unsigned int type if it is not already present, otherwise return th...
void bb_remove_all_successors(blocRef &bb) const
Function that removes all the successors of basic block bb.
This class manages the accesses to the CallGraph.
tree_nodeRef GetVoidType() const
TYPE_OBJ.
tree_nodeRef create_gimple_call(const tree_nodeConstRef &called_function, const std::vector< tree_nodeRef > &args, unsigned int function_decl_nid, const std::string &srcp) const
GIMPLE_CALL.
void bb_add_stmts(blocRef &bb, const std::vector< tree_nodeRef > &stmt) const
Function that adds in basic block bb the statements listed in vector stmt.
tree_nodeRef CreateNopExpr(const tree_nodeConstRef &operand, const tree_nodeConstRef &type, const tree_nodeConstRef &min, const tree_nodeConstRef &max, unsigned int function_decl_nid) const
Create a nop_expr to perform a conversion.
tree_nodeRef GetUnsignedIntegerType() const
Function that creates a unsigned integer type if it is not already present, otherwise it returns the ...
tree_nodeRef create_extract_bit_expr(const tree_nodeRef &op0, const tree_nodeRef &op1, const std::string &srcp) const
tree_nodeRef create_ssa_name(const tree_nodeConstRef &var, const tree_nodeConstRef &type, const tree_nodeConstRef &min, const tree_nodeConstRef &max, bool volatile_flag=false, bool virtual_flag=false) const
MISCELLANEOUS_OBJ_TREE_NODES.
REF_FORWARD_DECL(CallGraphManager)
tree_nodeRef CreateGimpleAssignAddrExpr(const tree_nodeConstRef &tn, unsigned int function_decl_nid, const std::string &srcp) const
Create a gimple_assign with op0 a new ssa_name, and op1 an addr_expr which takes the address of the t...
tree_nodeRef create_phi_node(tree_nodeRef &ssa_res, const std::vector< std::pair< tree_nodeRef, unsigned int >> &list_of_def_edge, unsigned int function_decl_nid, bool virtual_flag=false) const
GIMPLE_PHI.
const int debug_level
debug level.
const bool reuse
True if statements can be reused.
tree_nodeRef create_identifier_node(const std::string &strg) const
IDENTIFIER_TREE_NODE.
tree_manipulation(const tree_managerRef &TreeM, const ParameterConstRef ¶meters, const application_managerRef _AppM)
This is the constructor of the tree_manipulation.
tree_nodeRef create_gimple_modify_stmt(const tree_nodeRef &op0, const tree_nodeRef &op1, unsigned int function_decl_nid, const std::string &srcp) const
GIMPLE_ASSIGN.
This class creates a layer to add nodes and to manipulate the tree_nodes manager. ...
tree_nodeRef CreateAndExpr(const tree_nodeConstRef &first_condition, const tree_nodeConstRef &second_condition, const blocRef &block, unsigned int function_decl_nid) const
Create an or expression.
void bb_remove_predecessor(blocRef &bb, const unsigned int &predecessor) const
Function that removes a predecessor in basic block bb.
void create_label(const blocRef &block, unsigned int function_decl_nid) const
create a label expression in a header of a loop.
tree_nodeRef create_var_decl(const tree_nodeRef &name, const tree_nodeConstRef &type, const tree_nodeRef &scpe, const tree_nodeRef &size, const tree_nodeRef &smt_ann, const tree_nodeRef &init, const std::string &srcp, unsigned int algn, int used, bool artificial_flag=false, int use_tmpl=-1, bool static_static_flag=false, bool extern_flag=false, bool static_flag=false, bool register_flag=false, bool readonly_flag=false, const std::string &bit_values="", bool addr_taken=false, bool addr_not_taken=false) const
Function used to create a var_decl.