PandA-2024.02
Public Member Functions | Protected Member Functions | Protected Attributes
BitValueIPA Class Reference

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>

Inheritance diagram for BitValueIPA:
Inheritance graph
[legend]
Collaboration diagram for BitValueIPA:
Collaboration graph
[legend]

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_latticesup (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_latticesup (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const tree_nodeConstRef &out_node) const
 
std::deque< bit_latticeinf (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_latticeinf (const std::deque< bit_lattice > &a, const std::deque< bit_lattice > &b, const tree_nodeConstRef &out_node) const
 
std::deque< bit_latticeconstructor_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_latticestring_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 DesignFlowManagerdesign_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_latticesign_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_latticesup (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_latticeinf (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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BitValueIPA()

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().

Here is the call graph for this function:

◆ ~BitValueIPA()

BitValueIPA::~BitValueIPA ( )
overridedefault

Referenced by BitValueIPA().

Here is the caller graph for this function:

Member Function Documentation

◆ ComputeFrontendRelationships()

const CustomUnorderedSet< std::pair< FrontendFlowStepType, FrontendFlowStep::FunctionRelationship > > BitValueIPA::ComputeFrontendRelationships ( const DesignFlowStep::RelationshipType  relationship_type) const
overrideprotectedvirtual

Return the set of analyses in relationship with this design step.

Parameters
relationship_typeis 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.

◆ ComputeRelationships()

void BitValueIPA::ComputeRelationships ( DesignFlowStepSet relationship,
const DesignFlowStep::RelationshipType  relationship_type 
)
overrideprotectedvirtual

Compute the relationships of a step with other steps.

Parameters
dependenciesis where relationships will be stored
relationship_typeis 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.

Here is the call graph for this function:

◆ Exec()

DesignFlowStep_Status BitValueIPA::Exec ( )
overridevirtual

◆ HasToBeExecuted()

bool BitValueIPA::HasToBeExecuted ( ) const
overridevirtual

Check if this step has actually to be executed.

Returns
true if the step has to be executed

Reimplemented from ApplicationFrontendFlowStep.

Definition at line 157 of file BitValueIPA.cpp.

References FrontendFlowStep::AppM, last_bb_ver, and last_bitvalue_ver.

Field Documentation

◆ fun_id_to_restart

CustomOrderedSet<unsigned int> BitValueIPA::fun_id_to_restart
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().

◆ fun_id_to_restart_caller

CustomOrderedSet<unsigned int> BitValueIPA::fun_id_to_restart_caller
protected

Definition at line 67 of file BitValueIPA.hpp.

Referenced by ComputeRelationships(), and Exec().

◆ last_bb_ver

std::map<unsigned int, unsigned int> BitValueIPA::last_bb_ver
protected

Definition at line 71 of file BitValueIPA.hpp.

Referenced by Exec(), and HasToBeExecuted().

◆ last_bitvalue_ver

std::map<unsigned int, unsigned int> BitValueIPA::last_bitvalue_ver
protected

Definition at line 69 of file BitValueIPA.hpp.

Referenced by Exec(), and HasToBeExecuted().


The documentation for this class was generated from the following files:

Generated on Mon Feb 12 2024 13:03:46 for PandA-2024.02 by doxygen 1.8.13