PandA-2024.02
|
Full implementation of Bit Value analysis as described in BitValue Inference: Detecting and Exploiting Narrow Bitwidth Computations Mihai Budiu Seth Copen Goldstein http://www.cs.cmu.edu/~seth/papers/budiu-tr00.pdf. More...
#include <Bit_Value.hpp>
Public Member Functions | |
Bit_Value (const ParameterConstRef Param, const application_managerRef AM, unsigned int f_id, const DesignFlowManagerConstRef dfm) | |
Constructor. More... | |
~Bit_Value () override | |
Destructor. More... | |
DesignFlowStep_Status | InternalExec () override |
perform the bit value analysis More... | |
void | Initialize () override |
Initialize the step (i.e., like a constructor, but executed just before exec. More... | |
bool | HasToBeExecuted () const override |
Check if this step has actually to be executed. More... | |
Public Member Functions inherited from FunctionFrontendFlowStep | |
FunctionFrontendFlowStep (const application_managerRef AppM, const unsigned int function_id, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
~FunctionFrontendFlowStep () override | |
Destructor. More... | |
void | ComputeRelationships (DesignFlowStepSet &relationship, const DesignFlowStep::RelationshipType relationship_type) override |
Compute the relationships of a step with other steps. More... | |
std::string | GetSignature () const override |
Return the signature of this step. More... | |
std::string | GetName () const override |
Return the name of this design step. More... | |
DesignFlowStep_Status | Exec () final |
Execute the step. More... | |
unsigned int | CGetBBVersion () const |
unsigned int | GetBitValueVersion () const |
void | PrintInitialIR () const override |
Dump the initial intermediate representation. More... | |
void | PrintFinalIR () const override |
Dump the final intermediate representation. More... | |
Public Member Functions inherited from FrontendFlowStep | |
FrontendFlowStep (const application_managerRef AppM, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
~FrontendFlowStep () override | |
Destructor. More... | |
virtual std::string | GetKindText () const |
Return the name of the type of this frontend flow step. More... | |
DesignFlowStepFactoryConstRef | CGetDesignFlowStepFactory () const override |
Return the factory to create this type of steps. More... | |
void | PrintTreeManager (const bool before) const |
Dump the tree manager. More... | |
Public Member Functions inherited from DesignFlowStep | |
DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
virtual | ~DesignFlowStep () |
Destructor. More... | |
DesignFlowStep_Status | GetStatus () const |
Return the status of this design step. More... | |
virtual void | WriteDot (std::ostream &out) const |
Write the label for a dot graph. More... | |
bool | IsComposed () const |
Returns if this step is composed. More... | |
int | CGetDebugLevel () const |
Return the debug level of the step. More... | |
Public Member Functions inherited from BitLatticeManipulator | |
BitLatticeManipulator (const tree_managerConstRef TM, const int debug_level) | |
Constructor. More... | |
~BitLatticeManipulator () | |
Destructor. More... | |
Private Member Functions | |
void | print_bitstring_map (const CustomMap< unsigned int, std::deque< bit_lattice >> &map) const |
Debugging function used to print the contents of the current and best maps. More... | |
unsigned long long | pointer_resizing (unsigned int output_id) const |
unsigned int | lsb_to_zero (const addr_expr *ae, bool safe) const |
void | initialize () |
Initializes best with C type as bitstring, signed_var and arguments using the information taken from the syntax tree given by the application manager. More... | |
void | clear_current () |
Clears all the entry in the current map, except for the input arguments. More... | |
void | forward () |
Applies the forward algorithm, as described in the paper, analyzing each assignment statement following the program order, and each phi. More... | |
void | backward () |
Applies the backward algorithm, as described in the paper, analyzing each assignment statement starting from the output, going up to the inputs, and each phi. More... | |
std::deque< bit_lattice > | forward_transfer (const gimple_assign *ga) const |
Takes a gimple assignment, analyzes the operation performed from the rhs and its input bitstring, and generate a bitstring from the output. More... | |
std::deque< bit_lattice > | backward_transfer (const gimple_assign *ga, unsigned int output_id) const |
Compute the inputs back propagation values, given a gimple assignment and the uid of the output variable. More... | |
std::deque< bit_lattice > | backward_chain (const tree_nodeConstRef &ssa) const |
bool | update_IR () |
Updates the bitvalues of the intermediate representation with the values taken from the input map. More... | |
std::deque< bit_lattice > | get_current (const tree_nodeConstRef &tn) const |
Given an operand, returns its current bitvalue. More... | |
std::deque< bit_lattice > | get_current_or_best (const tree_nodeConstRef &tn) const |
Given an operand, returns its current bitvalue, or its best if current is not available. More... | |
const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship > > | ComputeFrontendRelationships (const DesignFlowStep::RelationshipType relationship_type) const override |
Return the set of analyses in relationship with this design step. More... | |
Private Attributes | |
bool | not_frontend |
True if this step is not executed in the frontend. More... | |
std::vector< blocRef > | bb_topological |
Topologically ordered basic blocks. More... | |
CustomUnorderedMapUnstable< unsigned int, unsigned int > | direct_call_id_to_called_id |
Maps the id of a gimple statement to the id of the function called in that statement. More... | |
CustomUnorderedSet< unsigned int > | arguments |
Contains the input parameters of the function that's being analyzed. More... | |
Static Private Attributes | |
static const std::map< bit_lattice, std::map< bit_lattice, std::map< bit_lattice, std::deque< bit_lattice > > > > | plus_expr_map |
Map storing the implementation of the forward_transfer's plus_expr. More... | |
static const std::map< bit_lattice, std::map< bit_lattice, std::map< bit_lattice, std::deque< bit_lattice > > > > | minus_expr_map |
Map storing the implementation of the forward_transfer's minus_expr. More... | |
static const std::map< bit_lattice, std::map< bit_lattice, bit_lattice > > | bit_ior_expr_map |
Map storing the implementation of the forward_transfer's bit_ior_expr_map. More... | |
static const std::map< bit_lattice, std::map< bit_lattice, bit_lattice > > | bit_xor_expr_map |
Map storing the implementation of the forward_transfer's bit_xor_expr_map. More... | |
static const std::map< bit_lattice, std::map< bit_lattice, bit_lattice > > | bit_and_expr_map |
Map storing the implementation of the forward_transfer's bit_and_expr_map. More... | |
Additional Inherited Members | |
Public Types inherited from FrontendFlowStep | |
using | FunctionRelationship = enum { ALL_FUNCTIONS, CALLED_FUNCTIONS, CALLING_FUNCTIONS, SAME_FUNCTION, WHOLE_APPLICATION } |
The different relationship type between function analysis. More... | |
Public Types inherited from DesignFlowStep | |
enum | RelationshipType { DEPENDENCE_RELATIONSHIP, INVALIDATION_RELATIONSHIP, PRECEDENCE_RELATIONSHIP } |
The relationship type. More... | |
Static Public Member Functions inherited from FunctionFrontendFlowStep | |
static const std::string | ComputeSignature (const FrontendFlowStepType frontend_flow_step_type, const unsigned int function_id) |
Compute the signature of a function frontend flow step. More... | |
Static Public Member Functions inherited from FrontendFlowStep | |
static void | CreateSteps (const DesignFlowManagerConstRef design_flow_manager, const CustomUnorderedSet< std::pair< FrontendFlowStepType, FunctionRelationship >> &frontend_relationships, const application_managerConstRef application_manager, DesignFlowStepSet &relationships) |
Create the relationship steps of a step with other steps starting from already specified dependencies between frontend flow steps. More... | |
static const std::string | EnumToKindText (const FrontendFlowStepType frontend_flow_step_type) |
Given a frontend flow step type, return the name of the type. More... | |
Static Public Member Functions inherited from BitLatticeManipulator | |
static std::deque< bit_lattice > | sign_extend_bitstring (const std::deque< bit_lattice > &bitstring, bool bitstring_is_signed, size_t final_size) |
Extends a bitstring. More... | |
static void | sign_reduce_bitstring (std::deque< bit_lattice > &bitstring, bool bitstring_is_signed) |
Reduce the size of a bitstring erasing all but one most significant zeros in unsigned bitstring and all but one most significant values in signed bitstrings. More... | |
static bit_lattice | bit_sup (const bit_lattice a, const bit_lattice b) |
static bit_lattice | bit_inf (const bit_lattice a, const bit_lattice b) |
static std::deque< bit_lattice > | sup (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const size_t out_type_size, const bool out_is_signed, const bool out_is_bool) |
static std::deque< bit_lattice > | inf (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const size_t out_type_size, const bool out_is_signed, const bool out_is_bool) |
static unsigned long long | Size (const tree_nodeConstRef &t) |
static unsigned long long | size (const tree_managerConstRef tm, unsigned int index) |
static bool | isBetter (const std::string &a_string, const std::string &b_string) |
Protected Member Functions inherited from FunctionFrontendFlowStep | |
void | WriteBBGraphDot (const std::string &filename) const |
Write the current version of statement list in dot format. More... | |
Protected Member Functions inherited from BitLatticeManipulator | |
bool | IsSignedIntegerType (const tree_nodeConstRef &tn) const |
std::deque< bit_lattice > | sup (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const unsigned int output_uid) const |
Computes the sup between two bitstrings. More... | |
std::deque< bit_lattice > | sup (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const tree_nodeConstRef &out_node) const |
std::deque< bit_lattice > | inf (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const unsigned int output_uid) const |
Computes the inf between two bitstrings. More... | |
std::deque< bit_lattice > | inf (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const tree_nodeConstRef &out_node) const |
std::deque< bit_lattice > | constructor_bitstring (const tree_nodeRef &ctor_tn, unsigned int ssa_node_id) const |
auxiliary function used to build the bitstring lattice for read-only arrays More... | |
std::deque< bit_lattice > | string_cst_bitstring (const tree_nodeRef &strcst_tn, unsigned int ssa_node_id) const |
auxiliary function used to build the bitstring lattice for read-only string_cst More... | |
bool | IsHandledByBitvalue (const tree_nodeConstRef &tn) const |
Returns true if the type identified by type_id is handled by bitvalue analysis. More... | |
bool | mix () |
Mixes the content of current and best using the sup operation, storing the result in the best map. More... | |
bool | update_current (std::deque< bit_lattice > &res, const tree_nodeConstRef &tn) |
Given a bitstring res, and the id of a tree node ouput_uid, this functions checks if it is necessary to update the bistring stored in the current map used by the bitvalue analysis algorithm. More... | |
void | clear () |
Clean up the internal data structures. More... | |
Protected Attributes inherited from FunctionFrontendFlowStep | |
const FunctionBehaviorRef | function_behavior |
The function behavior of the function to be analyzed. More... | |
const unsigned int | function_id |
The index of the function to be analyzed. More... | |
unsigned int | bb_version |
The version of the basic block intermediate representation on which this step has been applied. More... | |
unsigned int | bitvalue_version |
The version of the bitvalue information on which this step has been applied. More... | |
Protected Attributes inherited from FrontendFlowStep | |
const application_managerRef | AppM |
The application manager. More... | |
const FrontendFlowStepType | frontend_flow_step_type |
The type of this step. More... | |
unsigned int | print_counter |
Print counter. More... | |
Protected Attributes inherited from DesignFlowStep | |
bool | composed |
True if this step represents a composition of design flow steps (e.g., a flow); must be set by specialized constructors. More... | |
const Wrefcount< const DesignFlowManager > | design_flow_manager |
The design flow manager. More... | |
const ParameterConstRef | parameters |
Set of input parameters. More... | |
int | debug_level |
The debug level. More... | |
const int | output_level |
The output level. More... | |
Protected Attributes inherited from BitLatticeManipulator | |
const tree_managerConstRef | TM |
CustomMap< unsigned int, std::deque< bit_lattice > > | current |
Map of the current bit-values of each variable. More... | |
CustomMap< unsigned int, std::deque< bit_lattice > > | best |
Map of the best bit-values of each variable. More... | |
CustomSet< unsigned int > | signed_var |
Set storing the signed ssa. More... | |
const int | bl_debug_level |
The debug level of methods of this class - it cannot be named debug_level because of ambiguity of FrontendFlowStep::debug_level derived classes. More... | |
Full implementation of Bit Value analysis as described in BitValue Inference: Detecting and Exploiting Narrow Bitwidth Computations Mihai Budiu Seth Copen Goldstein http://www.cs.cmu.edu/~seth/papers/budiu-tr00.pdf.
Definition at line 79 of file Bit_Value.hpp.
Bit_Value::Bit_Value | ( | const ParameterConstRef | Param, |
const application_managerRef | AM, | ||
unsigned int | f_id, | ||
const DesignFlowManagerConstRef | dfm | ||
) |
Constructor.
_Param | is the set of the parameters |
_AppM | is the application manager |
function_id | is the identifier of the function |
design_flow_manager | is the design flow manager |
Definition at line 917 of file Bit_Value.cpp.
References DesignFlowStep::debug_level, DEBUG_LEVEL_NONE, GET_CLASS, DesignFlowStep::parameters, and ~Bit_Value().
|
overridedefault |
|
private |
Applies the backward algorithm, as described in the paper, analyzing each assignment statement starting from the output, going up to the inputs, and each phi.
Uses the backward_transfer() function to compute the output's bitstring, that stores in current. The algorithm loops until current is modified.
Definition at line 192 of file Bit_Value_backward.cpp.
References FrontendFlowStep::AppM, backward_chain(), bb_topological, bitstring_constant(), bitstring_to_string(), tree_helper::CGetType(), BitLatticeManipulator::current, DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, FunctionFrontendFlowStep::function_id, GET_CONST_NODE, get_current_or_best(), GET_INDEX_CONST_NODE, tree_helper::get_required_values(), INDENT_DBG_MEX, tree_node::index, BitLatticeManipulator::IsHandledByBitvalue(), STR, THROW_ASSERT, THROW_UNREACHABLE, BitLatticeManipulator::TM, and BitLatticeManipulator::update_current().
Referenced by InternalExec().
|
private |
Definition at line 74 of file Bit_Value_backward.cpp.
References FrontendFlowStep::AppM, backward_transfer(), BitLatticeManipulator::best, bitstring_to_string(), tree_helper::CGetType(), create_u_bitstring(), create_x_bitstring(), BitLatticeManipulator::current, DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, direct_call_id_to_called_id, FunctionFrontendFlowStep::function_id, GET_CONST_NODE, get_current_or_best(), GET_INDEX_CONST_NODE, INDENT_DBG_MEX, BitLatticeManipulator::inf(), BitLatticeManipulator::IsHandledByBitvalue(), BitLatticeManipulator::Size(), STR, string_to_bitstring(), THROW_ASSERT, THROW_UNREACHABLE, and BitLatticeManipulator::TM.
Referenced by backward().
|
private |
Compute the inputs back propagation values, given a gimple assignment and the uid of the output variable.
ga | gimple assignment that is being analyzed |
output_id | uid of the output of the given gimple assignment. |
Definition at line 329 of file Bit_Value_backward.cpp.
References FrontendFlowStep::AppM, BitLatticeManipulator::best, BitLatticeManipulator::bit_inf(), bitstring_constant(), bitstring_to_string(), CASE_CPP_NODES, CASE_CST_NODES, CASE_DECL_NODES, CASE_FAKE_NODES, CASE_GIMPLE_NODES, CASE_PRAGMA_NODES, CASE_TERNARY_EXPRESSION, CASE_TYPE_NODES, CASE_UNARY_EXPRESSION, ceil_log2(), create_u_bitstring(), BitLatticeManipulator::current, DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, direct_call_id_to_called_id, GET_CONST_NODE, get_current_or_best(), GET_INDEX_CONST_NODE, GET_INDEX_NODE, tree_helper::GetConstValue(), tree_node::GetString(), INDENT_DBG_MEX, index, tree_node::index, BitLatticeManipulator::inf(), tree_helper::is_int(), BitLatticeManipulator::IsHandledByBitvalue(), BitLatticeManipulator::IsSignedIntegerType(), tree_helper::IsSignedIntegerType(), max, min, offset, ONE, gimple_assign::op0, gimple_assign::op1, pointer_resizing(), BitLatticeManipulator::sign_extend_bitstring(), BitLatticeManipulator::Size(), BitLatticeManipulator::size(), STR, string_to_bitstring(), gimple_assign::temporary_address, THROW_ASSERT, THROW_ERROR, THROW_UNREACHABLE, BitLatticeManipulator::TM, tree_node::ToString(), U, X, and ZERO.
Referenced by backward_chain().
|
private |
Clears all the entry in the current map, except for the input arguments.
Definition at line 1883 of file Bit_Value.cpp.
References arguments, BitLatticeManipulator::best, BitLatticeManipulator::current, and FunctionFrontendFlowStep::function_id.
Referenced by InternalExec().
|
overrideprivatevirtual |
Return the set of analyses in relationship with this design step.
relationship_type | is the type of relationship to be considered |
Implements FrontendFlowStep.
Definition at line 929 of file Bit_Value.cpp.
References CALLED_FUNCTIONS, DesignFlowStep::DEPENDENCE_RELATIONSHIP, DesignFlowStep::INVALIDATION_RELATIONSHIP, DesignFlowStep::parameters, DesignFlowStep::PRECEDENCE_RELATIONSHIP, SAME_FUNCTION, and THROW_UNREACHABLE.
|
private |
Applies the forward algorithm, as described in the paper, analyzing each assignment statement following the program order, and each phi.
Uses the forward_transfer() function to compute the output's bitstring, that stores in current. The algorithm loops until current is modified.
Definition at line 81 of file Bit_Value_forward.cpp.
References FrontendFlowStep::AppM, bb_topological, BitLatticeManipulator::best, bitstring_to_string(), tree_helper::CGetType(), create_bitstring_from_constant(), create_x_bitstring(), BitLatticeManipulator::current, DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, forward_transfer(), FunctionFrontendFlowStep::function_id, GET_CONST_NODE, get_current(), GET_INDEX_CONST_NODE, GET_NODE, tree_helper::get_required_values(), tree_node::GetString(), INDENT_DBG_MEX, BitLatticeManipulator::inf(), BitLatticeManipulator::IsHandledByBitvalue(), BitLatticeManipulator::IsSignedIntegerType(), tree_helper::IsSignedIntegerType(), phi, BitLatticeManipulator::Size(), STR, THROW_ASSERT, THROW_UNREACHABLE, BitLatticeManipulator::TM, ToString(), and BitLatticeManipulator::update_current().
Referenced by InternalExec().
|
private |
Takes a gimple assignment, analyzes the operation performed from the rhs and its input bitstring, and generate a bitstring from the output.
ga | assignment to analyze |
Definition at line 365 of file Bit_Value_forward.cpp.
References FrontendFlowStep::AppM, bit_and_expr_map, bit_ior_expr_map, bit_xor_expr_map, bitstring_to_string(), CASE_CPP_NODES, CASE_DECL_NODES, CASE_FAKE_NODES, CASE_GIMPLE_NODES, CASE_PRAGMA_NODES, CASE_TYPE_NODES, tree_helper::CGetType(), create_u_bitstring(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, direct_call_id_to_called_id, GET_CONST_NODE, get_current(), GET_INDEX_NODE, tree_helper::GetConstValue(), tree_node::GetString(), INDENT_DBG_MEX, index, tree_node::index, BitLatticeManipulator::inf(), tree_helper::IsBooleanType(), BitLatticeManipulator::IsHandledByBitvalue(), BitLatticeManipulator::IsSignedIntegerType(), lsb_to_zero(), max, min, minus_expr_map, offset, ONE, gimple_assign::op0, gimple_assign::op1, DesignFlowStep::parameters, plus_expr_map, BitLatticeManipulator::sign_extend_bitstring(), BitLatticeManipulator::Size(), STR, string_to_bitstring(), THROW_ASSERT, THROW_ERROR, THROW_UNREACHABLE, BitLatticeManipulator::TM, tree_node::ToString(), U, X, and ZERO.
Referenced by forward().
|
private |
Given an operand, returns its current bitvalue.
tn | Operand node |
Definition at line 63 of file Bit_Value_forward.cpp.
References BitLatticeManipulator::best, BitLatticeManipulator::current, GET_CONST_NODE, GET_INDEX_CONST_NODE, THROW_ASSERT, and THROW_UNREACHABLE.
Referenced by forward(), and forward_transfer().
|
private |
Given an operand, returns its current bitvalue, or its best if current is not available.
tn | Operand node |
Definition at line 62 of file Bit_Value_backward.cpp.
References BitLatticeManipulator::best, BitLatticeManipulator::current, GET_CONST_NODE, GET_INDEX_CONST_NODE, and THROW_ASSERT.
Referenced by backward(), backward_chain(), and backward_transfer().
|
overridevirtual |
Check if this step has actually to be executed.
Reimplemented from FunctionFrontendFlowStep.
Definition at line 968 of file Bit_Value.cpp.
References FunctionFrontendFlowStep::bitvalue_version, FunctionFrontendFlowStep::function_behavior, and FunctionFrontendFlowStep::HasToBeExecuted().
|
private |
Initializes best with C type as bitstring, signed_var and arguments using the information taken from the syntax tree given by the application manager.
Scan all the gimple assign statements in each bloc if the left hand side is signed this is inserted into the signed_var set (this information is used by the signextension)
for each lhs variable in the gimple_assign instruction and entry is created in the best map the entry in the map is of the type <GET_INDEX_NODE(lhs), bit_string of <U>s of the variable lenght> for each gimple_assign the used variables are checked against the values in the parm set in order to identify the parameters of the function when those are found their ssa index node is added in the best map and in the arguments map ( used by the clear() function )
Scans each phi in the bloc (not virtual) res of the phi is added to the signed_var set if it's signed, and to the best map
The edge of each phi are scanned, if the edge is carrying a constant of type integer_cst the index of the integer_cst node is used to identify it, one entry is created for the best table mapping the integer_cst index to its bitstring representation if the value of the constant is negative it's added to the signed_var set
if the edge is carrying a ssa variable it's checked if its a parameter, if it is, it is added to the arguments set and, it is added to the best map
check if this assignment is a load from a constant array
and now something for the written variables
check if this assignment is a load from a constant array
Definition at line 1171 of file Bit_Value.cpp.
References FrontendFlowStep::AppM, arguments, B, bb_topological, FunctionFrontendFlowStep::bb_version, BitLatticeManipulator::best, bitstring_to_string(), tree_helper::CGetType(), BitLatticeManipulator::clear(), BitLatticeManipulator::constructor_bitstring(), create_bitstring_from_constant(), create_u_bitstring(), create_x_bitstring(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, direct_call_id_to_called_id, FunctionFrontendFlowStep::function_behavior, FunctionFrontendFlowStep::function_id, tree_helper::get_base_index(), GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_INDEX_NODE, GET_NODE, tree_helper::get_required_values(), tree_helper::GetConstValue(), tree_helper::GetFunctionReturnType(), FunctionFrontendFlowStep::GetName(), INDENT_DBG_MEX, BitLatticeManipulator::inf(), tree_helper::is_natural(), BitLatticeManipulator::IsHandledByBitvalue(), tree_helper::IsSignedIntegerType(), MEMCPY, phi, print_bitstring_map(), BitLatticeManipulator::sign_extend_bitstring(), BitLatticeManipulator::sign_reduce_bitstring(), BitLatticeManipulator::signed_var, BitLatticeManipulator::Size(), STR, BitLatticeManipulator::string_cst_bitstring(), string_to_bitstring(), BitLatticeManipulator::sup(), lenet_tvm::target, THROW_ASSERT, THROW_UNREACHABLE, BitLatticeManipulator::TM, X, and ZERO.
Referenced by InternalExec().
|
overridevirtual |
Initialize the step (i.e., like a constructor, but executed just before exec.
store the IR BB graph ala boost::graph
add vertices
add edges
add a connection between entry and exit thus avoiding problems with non terminating code
Reimplemented from DesignFlowStep.
Definition at line 973 of file Bit_Value.cpp.
References FrontendFlowStep::AppM, bb_topological, dominance< GraphObj >::calculate_dominance_info(), CFG_SELECTOR, BBGraph::CGetBBNodeInfo(), ApplicationFrontendFlowStep::ComputeSignature(), D_SELECTOR, DesignFlowStep::design_flow_manager, EMPTY, bloc::ENTRY_BLOCK_ID, bloc::EXIT_BLOCK_ID, FunctionFrontendFlowStep::function_id, GET_CONST_NODE, BBGraph::GetBBGraphInfo(), Wrefcount< T >::lock(), not_frontend, DesignFlowStep::parameters, sl, STR, THROW_ASSERT, BitLatticeManipulator::TM, and graph::TopologicalSort().
|
overridevirtual |
perform the bit value analysis
Implements FunctionFrontendFlowStep.
Definition at line 1047 of file Bit_Value.cpp.
References arguments, backward(), bb_topological, BitLatticeManipulator::best, BitLatticeManipulator::clear(), clear_current(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, direct_call_id_to_called_id, forward(), FunctionFrontendFlowStep::function_behavior, INDENT_DBG_MEX, initialize(), BitLatticeManipulator::mix(), DesignFlowStep::parameters, print_bitstring_map(), PRINT_DBG_MEX, test_panda::restart, SUCCESS, UNCHANGED, and update_IR().
|
private |
Definition at line 888 of file Bit_Value.cpp.
References align(), FrontendFlowStep::AppM, GET_CONST_NODE, and index.
Referenced by forward_transfer().
|
private |
added to consider the 64bit alignment of the allocated variables
check if it clash with the alignment:
Definition at line 819 of file Bit_Value.cpp.
References align(), FrontendFlowStep::AppM, CompilerWrapper::CGetPointerSize(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FunctionFrontendFlowStep::function_behavior, FunctionFrontendFlowStep::function_id, tree_helper::get_base_index(), INDENT_DBG_MEX, index, not_frontend, DesignFlowStep::parameters, BitLatticeManipulator::size(), STR, and BitLatticeManipulator::TM.
Referenced by backward_transfer().
|
private |
Debugging function used to print the contents of the current and best maps.
map | map to be printed |
Definition at line 1095 of file Bit_Value.cpp.
References bitstring_to_string(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, FunctionFrontendFlowStep::function_behavior, INDENT_DBG_MEX, map, and STR.
Referenced by initialize(), and InternalExec().
|
private |
Updates the bitvalues of the intermediate representation with the values taken from the input map.
Definition at line 1112 of file Bit_Value.cpp.
References FrontendFlowStep::AppM, BitLatticeManipulator::best, bitstring_to_string(), DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, FunctionFrontendFlowStep::GetName(), INDENT_DBG_MEX, BitLatticeManipulator::isBetter(), tree_helper::name_function(), THROW_ERROR, and BitLatticeManipulator::TM.
Referenced by InternalExec().
|
private |
Contains the input parameters of the function that's being analyzed.
Definition at line 127 of file Bit_Value.hpp.
Referenced by clear_current(), initialize(), and InternalExec().
|
private |
Topologically ordered basic blocks.
Definition at line 115 of file Bit_Value.hpp.
Referenced by backward(), forward(), initialize(), Initialize(), and InternalExec().
|
staticprivate |
Map storing the implementation of the forward_transfer's bit_and_expr_map.
Definition at line 107 of file Bit_Value.hpp.
Referenced by forward_transfer().
|
staticprivate |
Map storing the implementation of the forward_transfer's bit_ior_expr_map.
Definition at line 97 of file Bit_Value.hpp.
Referenced by forward_transfer().
|
staticprivate |
Map storing the implementation of the forward_transfer's bit_xor_expr_map.
Definition at line 102 of file Bit_Value.hpp.
Referenced by forward_transfer().
|
private |
Maps the id of a gimple statement to the id of the function called in that statement.
This relationship is created only for direct calls, because for indirect calls there is not a one-to-one relationship
Definition at line 122 of file Bit_Value.hpp.
Referenced by backward_chain(), backward_transfer(), forward_transfer(), initialize(), and InternalExec().
|
staticprivate |
Map storing the implementation of the forward_transfer's minus_expr.
Definition at line 92 of file Bit_Value.hpp.
Referenced by forward_transfer().
|
private |
True if this step is not executed in the frontend.
Definition at line 110 of file Bit_Value.hpp.
Referenced by Initialize(), and pointer_resizing().
|
staticprivate |
Map storing the implementation of the forward_transfer's plus_expr.
Header include.
. include behavior includes design_flows include frontend_analysis HLS include HLS/memory include STD include STL includes tree include wrapper/compiler include
Definition at line 86 of file Bit_Value.hpp.
Referenced by forward_transfer().