PandA-2024.02
|
Inter-Procedural extension of the 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 <BitValueIPA.hpp>
Public Member Functions | |
BitValueIPA (const application_managerRef AM, const DesignFlowManagerConstRef dfm, const ParameterConstRef parameters) | |
STD include. More... | |
~BitValueIPA () override | |
DesignFlowStep_Status | Exec () override |
Execute the step. More... | |
bool | HasToBeExecuted () const override |
Check if this step has actually to be executed. More... | |
Public Member Functions inherited from ApplicationFrontendFlowStep | |
ApplicationFrontendFlowStep (const application_managerRef AppM, const FrontendFlowStepType frontend_flow_step_type, const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
~ApplicationFrontendFlowStep () override | |
Destructor. 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... | |
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... | |
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 DesignFlowStep | |
DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
virtual | ~DesignFlowStep () |
Destructor. More... | |
virtual void | Initialize () |
Initialize the step (i.e., like a constructor, but executed just before exec. 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... | |
Protected Member Functions | |
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... | |
void | ComputeRelationships (DesignFlowStepSet &relationships, const DesignFlowStep::RelationshipType relationship_type) override |
Compute the relationships of a step with other steps. 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 | |
CustomOrderedSet< unsigned int > | fun_id_to_restart |
stores the function ids of the functions whose Bit_Value intra procedural steps have to be invalidated by this step More... | |
CustomOrderedSet< unsigned int > | fun_id_to_restart_caller |
std::map< unsigned int, unsigned int > | last_bitvalue_ver |
std::map< unsigned int, unsigned int > | last_bb_ver |
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... | |
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 ApplicationFrontendFlowStep | |
static const std::string | ComputeSignature (const FrontendFlowStepType frontend_flow_step_type) |
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) |
Inter-Procedural extension of the 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 59 of file BitValueIPA.hpp.
BitValueIPA::BitValueIPA | ( | const application_managerRef | AM, |
const DesignFlowManagerConstRef | dfm, | ||
const ParameterConstRef | parameters | ||
) |
STD include.
Definition at line 80 of file BitValueIPA.cpp.
References DesignFlowStep::debug_level, DEBUG_LEVEL_NONE, GET_CLASS, DesignFlowStep::parameters, and ~BitValueIPA().
|
overridedefault |
|
overrideprotectedvirtual |
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 91 of file BitValueIPA.cpp.
References ALL_FUNCTIONS, DesignFlowStep::DEPENDENCE_RELATIONSHIP, DesignFlowStep::INVALIDATION_RELATIONSHIP, DesignFlowStep::parameters, DesignFlowStep::PRECEDENCE_RELATIONSHIP, THROW_UNREACHABLE, and WHOLE_APPLICATION.
|
overrideprotectedvirtual |
Compute the relationships of a step with other steps.
dependencies | is where relationships will be stored |
relationship_type | is the type of relationship to be computed |
Reimplemented from FrontendFlowStep.
Definition at line 128 of file BitValueIPA.cpp.
References FrontendFlowStep::ComputeRelationships(), FunctionFrontendFlowStep::ComputeSignature(), DesignFlowStep::design_flow_manager, fun_id_to_restart, fun_id_to_restart_caller, DesignFlowStep::INVALIDATION_RELATIONSHIP, Wrefcount< T >::lock(), NULL_VERTEX, and THROW_ASSERT.
|
overridevirtual |
Execute the step.
In case of indirect calls (e.g., pointer to function) no Bit Value IPA can be done.
Implements ApplicationFrontendFlowStep.
Definition at line 171 of file BitValueIPA.cpp.
References FrontendFlowStep::AppM, BitLatticeManipulator::best, bitstring_to_string(), tree_helper::CGetType(), BitLatticeManipulator::clear(), create_bitstring_from_constant(), create_u_bitstring(), create_x_bitstring(), BitLatticeManipulator::current, DesignFlowStep::debug_level, DEBUG_LEVEL_PEDANTIC, edges, fun_id_to_restart, fun_id_to_restart_caller, GET_CONST_NODE, GET_INDEX_CONST_NODE, GET_INDEX_NODE, GET_NODE, tree_helper::GetConstValue(), tree_helper::GetFunctionReturnType(), ApplicationFrontendFlowStep::GetName(), tree_node::GetString(), INDENT_DBG_MEX, BitLatticeManipulator::inf(), BitLatticeManipulator::isBetter(), BitLatticeManipulator::IsHandledByBitvalue(), tree_helper::IsScalarType(), tree_helper::IsSignedIntegerType(), last_bb_ver, last_bitvalue_ver, BitLatticeManipulator::mix(), DesignFlowStep::parameters, test_panda::restart, BitLatticeManipulator::signed_var, BitLatticeManipulator::Size(), BitLatticeManipulator::size(), STR, string_to_bitstring(), SUCCESS, BitLatticeManipulator::sup(), THROW_ASSERT, THROW_ERROR, THROW_UNREACHABLE, BitLatticeManipulator::TM, UNCHANGED, and BitLatticeManipulator::update_current().
|
overridevirtual |
Check if this step has actually to be executed.
Reimplemented from ApplicationFrontendFlowStep.
Definition at line 157 of file BitValueIPA.cpp.
References FrontendFlowStep::AppM, last_bb_ver, and last_bitvalue_ver.
|
protected |
stores the function ids of the functions whose Bit_Value intra procedural steps have to be invalidated by this step
Definition at line 66 of file BitValueIPA.hpp.
Referenced by ComputeRelationships(), and Exec().
|
protected |
Definition at line 67 of file BitValueIPA.hpp.
Referenced by ComputeRelationships(), and Exec().
|
protected |
Definition at line 71 of file BitValueIPA.hpp.
Referenced by Exec(), and HasToBeExecuted().
|
protected |
Definition at line 69 of file BitValueIPA.hpp.
Referenced by Exec(), and HasToBeExecuted().