InstMatching.h 909 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#ifndef LRUSECURITY_INST_MATCHING_H
#define LRUSECURITY_INST_MATCHING_H

#include <otawa/cfg/features.h>
#include <otawa/cfg/CFG.h>
#include <otawa/prog/Inst.h>
#include <otawa/icache/features.h>
#include <map>

namespace lrusecurity
{

class InstMatcher
{
public:
16
    InstMatcher(void){};
17
    void setupCFG(otawa::CFG *cfg);
Julien Balette-Pape's avatar
Julien Balette-Pape committed
18
    void setupColl(otawa::CFGCollection *collection);
19 20 21
    inline void insert(otawa::Inst *inst, otawa::BasicBlock *bb){_match.insert({inst, bb});};

    otawa::BasicBlock *match_instruction(otawa::Inst *instruction);
Julien Balette-Pape's avatar
Julien Balette-Pape committed
22
    inline otawa::BasicBlock *match_access(const otawa::icache::Access *access){return match_instruction(access->instruction());};
23

24
    inline void clean(void){_match = std::map<otawa::Inst *, otawa::BasicBlock *>();};
25 26 27 28 29 30 31 32

private:
    std::map<otawa::Inst *, otawa::BasicBlock *> _match;
};

} // namespace lrusecurity

#endif /* ifndef LRUSECURITY_INST_MATCHING_H */