CGRAOmp  0.1
Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CGRAOmp::MapCondition Class Reference

a representation of instruction mapping condition More...

#include <CGRAInstMap.hpp>

Public Member Functions

 MapCondition (StringRef map)
 Construct a new MapCondition object. More...
 
 MapCondition (const MapCondition &)=default
 Copy constructor. More...
 
 MapCondition (MapCondition &&)=default
 Move Constructor. More...
 
 ~MapCondition ()
 Destructor. More...
 
void setConst (int use, bool isLeft)
 Set a condition for a constant operand. More...
 
void setConst (double use, bool isLeft)
 Set a condition for a constant operand the condition is met if an instruction has the same constant operand. More...
 
Error setFlags (ArrayRef< std::string > flags)
 Set a condition for instruction flags the condition is met if an instruction has all the specified flags. More...
 
Error setPred (StringRef pred)
 Set a condition for the predicate type of icmp/fcmp. More...
 
bool match (Instruction *I)
 test if the instruction satisfies the condition More...
 
std::string getMapName ()
 get map name associated with this condition More...
 
void print (raw_ostream &OS)
 
void dump ()
 

Static Private Member Functions

static bool equal_double (double a, double b)
 equality comparetor for double values More...
 

Private Attributes

std::function< bool(Instruction *I)> match_use
 wrapper for const operand comparison More...
 
std::string map_name
 
int use_int
 
double use_double
 
SmallVector< StringRef > flag_list
 
CmpInst::Predicate cmp_pred
 
bool isUseInt = false
 
bool anyLHS
 
bool anyRHS
 
bool anyPred
 
int const_operand
 
StringRef pred_str
 

Static Private Attributes

static StringMap< std::function< bool(Instruction *)> > FlagGetter
 
static StringMap< CmpInst::Predicate > PredMap
 

Detailed Description

a representation of instruction mapping condition

Constructor & Destructor Documentation

◆ MapCondition() [1/3]

CGRAOmp::MapCondition::MapCondition ( StringRef  map)
inline

Construct a new MapCondition object.

Parameters
mapa name which the instruction to be mapped to

◆ MapCondition() [2/3]

CGRAOmp::MapCondition::MapCondition ( const MapCondition )
default

Copy constructor.

◆ MapCondition() [3/3]

CGRAOmp::MapCondition::MapCondition ( MapCondition &&  )
default

Move Constructor.

◆ ~MapCondition()

CGRAOmp::MapCondition::~MapCondition ( )
inline

Destructor.

Member Function Documentation

◆ dump()

void CGRAOmp::MapCondition::dump ( )
inline

◆ equal_double()

static bool CGRAOmp::MapCondition::equal_double ( double  a,
double  b 
)
inlinestaticprivate

equality comparetor for double values

Parameters
aone double value
bthe other double value
Returns
true if the two value seems to be the same.
otherwise false

◆ getMapName()

std::string CGRAOmp::MapCondition::getMapName ( )
inline

get map name associated with this condition

Returns
string of map name

◆ match()

bool MapCondition::match ( Instruction *  I)

test if the instruction satisfies the condition

Parameters
Iinstruction to be tested
Returns
true in the case of satisfying the condition
otherwise false

◆ print()

void MapCondition::print ( raw_ostream &  OS)

◆ setConst() [1/2]

void MapCondition::setConst ( double  use,
bool  isLeft 
)

Set a condition for a constant operand the condition is met if an instruction has the same constant operand.

Parameters
usea double value of the contant operant
isLefttrue if it is for the left hand side operand

◆ setConst() [2/2]

void MapCondition::setConst ( int  use,
bool  isLeft 
)

Set a condition for a constant operand.

Parameters
usean integer value of the contant operant
isLefttrue if it is for the left hand side operand

◆ setFlags()

Error MapCondition::setFlags ( ArrayRef< std::string >  flags)

Set a condition for instruction flags the condition is met if an instruction has all the specified flags.

Parameters
flagsa list of the flag
Returns
Error is returned if unknown flag is included in the flags

◆ setPred()

Error MapCondition::setPred ( StringRef  pred)

Set a condition for the predicate type of icmp/fcmp.

Parameters
preda predicate type
Returns
Error is returned if unknown predicate is specified

Member Data Documentation

◆ anyLHS

bool CGRAOmp::MapCondition::anyLHS
private

◆ anyPred

bool CGRAOmp::MapCondition::anyPred
private

◆ anyRHS

bool CGRAOmp::MapCondition::anyRHS
private

◆ cmp_pred

CmpInst::Predicate CGRAOmp::MapCondition::cmp_pred
private

◆ const_operand

int CGRAOmp::MapCondition::const_operand
private

◆ flag_list

SmallVector<StringRef> CGRAOmp::MapCondition::flag_list
private

◆ FlagGetter

StringMap< std::function< bool(Instruction *)> > MapCondition::FlagGetter
staticprivate

look-up table of functions to get flag from an inputed instruction key: string of flag

◆ isUseInt

bool CGRAOmp::MapCondition::isUseInt = false
private

◆ map_name

std::string CGRAOmp::MapCondition::map_name
private

◆ match_use

std::function<bool(Instruction*I)> CGRAOmp::MapCondition::match_use
private

wrapper for const operand comparison

◆ pred_str

StringRef CGRAOmp::MapCondition::pred_str
private

◆ PredMap

StringMap< CmpInst::Predicate > MapCondition::PredMap
staticprivate

look-up table of an enumeration of predicate key: string of predicate

◆ use_double

double CGRAOmp::MapCondition::use_double
private

◆ use_int

int CGRAOmp::MapCondition::use_int
private

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