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

collective of all the instruction mapping More...

#include <CGRAInstMap.hpp>

Public Member Functions

 InstMap ()
 Constructor. More...
 
InstMapEntryfind (StringRef opcode)
 find an entry for the instruction More...
 
InstMapEntryfind (Instruction *I)
 find an entry for the instruction More...
 
Error add_generic_inst (StringRef opcode)
 add a generic instruction without mapping condition More...
 
void add_custom_inst (StringRef opcode, ModuleAnalysisManager &MAM)
 add a custom instruction More...
 
Error add_map_entry (StringRef opcode, MapCondition *map_cond)
 add an entry with a mapping condition More...
 

Private Types

using entry_ptr = std::shared_ptr< InstMapEntry >
 
using entry_iterator = SmallVector< entry_ptr >::iterator
 
using entry_generator = std::function< entry_ptr(MapCondition *)>
 

Private Attributes

SmallVector< entry_ptrentries
 
StringMap< entry_ptrdefaultEntries
 

Static Private Attributes

static StringMap< entry_generatorentry_gen
 

Detailed Description

collective of all the instruction mapping

Member Typedef Documentation

◆ entry_generator

using CGRAOmp::InstMap::entry_generator = std::function<entry_ptr(MapCondition*)>
private

◆ entry_iterator

using CGRAOmp::InstMap::entry_iterator = SmallVector<entry_ptr>::iterator
private

◆ entry_ptr

using CGRAOmp::InstMap::entry_ptr = std::shared_ptr<InstMapEntry>
private

Constructor & Destructor Documentation

◆ InstMap()

CGRAOmp::InstMap::InstMap ( )
inline

Constructor.

Member Function Documentation

◆ add_custom_inst()

void InstMap::add_custom_inst ( StringRef  opcode,
ModuleAnalysisManager &  MAM 
)

add a custom instruction

Parameters
opcodeopcode string of the instruction (= the corresponding function name)
MAMModuleAnalysisManager

◆ add_generic_inst()

Error InstMap::add_generic_inst ( StringRef  opcode)

add a generic instruction without mapping condition

Parameters
opcodeopcode string of the instruction
Returns
Error is returned if unknown opcode is specified

◆ add_map_entry()

Error InstMap::add_map_entry ( StringRef  opcode,
MapCondition map_cond 
)

add an entry with a mapping condition

Parameters
opcodeopcode string of the instruction
map_condmapping condition instance
Returns
Error is returned if the opcode of an instruction is not added yet.

When a generic instruction is added to InstMap, a default entry, which matches any instruction with the same opcode, is added. This method is called, then the default entry is erased.

◆ find() [1/2]

InstMapEntry * InstMap::find ( Instruction *  I)

find an entry for the instruction

Parameters
Ian instruction
Returns
a pointer of InstMapEntry is return if an entry is found. Otherwise, it return nullptr.

◆ find() [2/2]

InstMapEntry * InstMap::find ( StringRef  opcode)

find an entry for the instruction

Parameters
opcodeopcode of the instruction
Returns
a pointer of InstMapEntry is return if an entry is found. Otherwise, it return nullptr.

Member Data Documentation

◆ defaultEntries

StringMap<entry_ptr> CGRAOmp::InstMap::defaultEntries
private

◆ entries

SmallVector<entry_ptr> CGRAOmp::InstMap::entries
private

◆ entry_gen

StringMap< InstMap::entry_generator > InstMap::entry_gen
staticprivate

look-up table of functions to instantiate an entry from an inputed opcode key: opcode string


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