4 #ifndef ILANG_MCM_AST_HELPER_H__
5 #define ILANG_MCM_AST_HELPER_H__
9 #include <unordered_map>
13 #include "ilang/vtarget-out/directive.h"
59 typedef std::unordered_map<Expr*, bool>
98 const std::set<std::shared_ptr<Func>> GetReferredFunc()
const;
102 class PureNestedStoreDetector {
105 typedef std::vector<std::pair<ExprPtr, ExprPtr>>
110 typedef std::unordered_map<Expr*, AddrDataVec>
115 bool isNestedStore(
const ExprPtr&);
117 const AddrDataVec& getStoreAddrDataVec(
const ExprPtr&);
127 struct MRF_HASH_FUNC {
128 std::size_t operator()(
const std::pair<TraceStep*, Expr*>& p)
const {
129 return std::hash()(p.first) ^ std::hash()(p.second);
135 part that exists in a trace step ?
class MemReadFinder {
139 typedef std::vector<std::pair<ExprPtr, ExprPtr>> AddrDataVec;
146 typedef std::unordered_map<std::string, AddrDataVec>
151 typedef std::unordered_map<MRFHashKey, MRFVal> MRFHashTable;
156 void FindAddrDataPairVecInExpr(
const ExprPtr& node, MRFVal& nad_map_);
159 void VisitNode(
const ExprPtr& node, MRFVal& nad_map_);
165 const AddrDataVec& FindAddrDataPairVecInInst(
const InstrPtr& instr,
166 const std::string& sname);
171 MemReadFinder(NestedMemAddrDataAvoider& n) : nested_finder_(n) {}
178 NestedMemAddrDataAvoider& nested_finder_;
185 #endif // ILANG_MCM_AST_HELPER_H__
bool getIteUnknownCondVal(const ExprPtr &e, ExprPtr &c, ExprPtr &v)
Function to deal with Ite(c, v, apply(unknown) );.
VarUseFinder(ProcessFuncType f)
Default constructor: do nothing.
Definition: ast_helper.h:39
Expr::ExprPtr ExprPtr
Pointer type for normal use of Expr.
Definition: expr.h:138
Class of traversing to find the application of functions in an AST.
Definition: ast_helper.h:82
std::set< std::shared_ptr< Func > > _func_refs
the functions used in app_func
Definition: ast_helper.h:86
Instr::InstrPtr InstrPtr
Pointer type for normal use of Instr.
Definition: instr.h:132
void hasFuncAppOnNode(const ExprPtr &e)
does a node contain a funcapp
void Traverse(const ExprPtr &expr, VarUseList &uses)
Find variable uses for an expression.
std::set< Expr * > visited
record whether a node has been visited
Definition: ast_helper.h:88
std::function< T(const ExprPtr &)> ProcessFuncType
Type of the function to process ExprPtr to T.
Definition: ast_helper.h:36
InstrLvlAbs::InstrLvlAbsPtr InstrLvlAbsPtr
Pointer type for normal use of InstrLvlAbs.
Definition: instr_lvl_abs.h:326
Class of traversing to avoid nested memory access in address.
Definition: ast_helper.h:57
bool NotNested(const ExprPtr &node)
std::set< T > VarUseList
Type of vector of ExprPtr with is_var() == true.
Definition: ast_helper.h:34
void hasFuncApp(const ExprPtr &expr)
does a tree contain funcapps?
~VarUseFinder()
Default destructor: do nothing.
Definition: ast_helper.h:41
Class of finding variable uses. So that we don't need to create pi variables for unused state variabl...
Definition: ast_helper.h:31