49 std::function<
bool(
unsigned )> matchesWidth,
60 "mode. using default match all rule.");
61 matchesMode = [](
uint32_t) {
return true; };
67 "width. using default match all rule.");
68 matchesWidth = [](unsigned) {
return true; };
74 "instruction. using default match all rule.");
79 rule->
mode = matchesMode;
80 rule->
width = matchesWidth;
81 rule->
instr = matchesInstr;
90 uint32_t refmode = std::get<0>(tuple);
91 unsigned refwidth = std::get<1>(tuple);
92 std::string refname = std::get<2>(tuple);
95 [refwidth](
unsigned width) {
return refwidth == width; },
103 std::regex refmode = std::get<0>(tuple);
104 std::regex refwidth = std::get<1>(tuple);
105 std::regex refname = std::get<2>(tuple);
108 [refwidth](
unsigned width) {
return std::regex_match(
etiss::toString(width), refwidth); },
115 for (
auto iter =
rules_.begin(); iter !=
rules_.end(); ++iter)
124 bool verifyCompleteness =
true;
126 std::set<etiss::instr::Instruction *> found;
127 std::set<etiss::instr::Instruction *> matched;
128 if (verifyCompleteness)
137 for (
auto iter =
rules_.begin(); iter !=
rules_.end(); ++iter)
146 vis.foreach ([&matched, rule](etiss::instr::InstructionSet &is) {
147 unsigned width = is.width_;
148 if (rule->width(width))
150 is.foreach ([&matched, rule](etiss::instr::Instruction &instr) {
151 if (rule->instr(instr))
153 matched.insert(&instr);
154 rule->handler(instr);
164 if (verifyCompleteness)
166 for (
auto iter = matched.begin(); iter != matched.end(); ++iter)
170 for (
auto iter = found.begin(); iter != found.end(); ++iter)
173 ((DataSheetAccurateTiming *)
this)->_getPluginName() +
174 "] ignored instruction " + (*iter)->toString());
static __inline__ uint32_t
virtual void initInstrSet(etiss::instr::ModedInstructionSet &) const
performs lookups for instructions that are in the modded instruction set to add timing code (e....
std::list< Rule * > rules_
void addRule(std::function< bool(uint32_t)> matchesMode, std::function< bool(unsigned)> matchesWidth, std::function< bool(etiss::instr::Instruction &)> matchesInstr, std::function< void(etiss::instr::Instruction &)> handleMatch)
this is the main add rule function.
virtual ~DataSheetAccurateTiming()
holds etiss::instr::Instruction instances and handles automatic instruction tree creation.
void foreach(std::function< void(Instruction &)> func)
holds information and translation callbacks for an instruction.
holds etiss::instr::VariableInstructionSet instances for different modes.
uint32_t getMode(VariableInstructionSet *vis)
void foreach(std::function< void(VariableInstructionSet &)> call)
holds etiss::instr::InstructionSet instances with different bit widths.
void foreach(std::function< void(InstructionSet &)> func)
ModedInstructionSet & parent_
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
std::string toString(const T &val)
conversion of type T to std::string.
void log(Verbosity level, std::string msg)
write log message at the given level.
std::function< void(etiss::instr::Instruction &)> handler
std::function< bool(etiss::instr::Instruction &)> instr
std::function< bool(unsigned)> width
std::function< bool(uint32_t)> mode