ilasynth  1.0
ILASynth: Template-based ILA Synthesis Engine
imexport.hpp
Go to the documentation of this file.
1 #ifndef __IMEXPORT_HPP_DEFINED__
2 #define __IMEXPORT_HPP_DEFINED__
3 
4 #include <ilasynth/ast.hpp>
5 
7 
8 namespace ilasynth {
9 // A function object that export / import the synthesized AST.
10 class ImExport {
11 public:
12  typedef std::map<std::string, nptr_t> nref_map_t;
13 
14 private:
16 
17 public:
18  // Constructor.
19  ImExport(FuncReduction* funcRedPtr, int reduce = 0);
20 
21  // Destructor.
22  ~ImExport();
23 
24  // Export the ast for a single node to stream output
25  void exportAst(std::ostream& out, const Node* n);
26 
27  // Import one ast from input stream.
28  nptr_t importAst(Abstraction* c, std::istream& in);
29 
30  // helper function for the _nodeMap.
31  nptr_t mapFind(const std::string& name) const;
32  void mapInsert(const std::string& name, nptr_t nptr);
33  // add elements from the map to the abstraction.
34  void addMapVars(Abstraction* c);
35 
36 protected:
37 private:
38  // Function Reduction Module
40 
42  // parsing helper function.
43  char nextChar(std::istream& in) const;
44  std::string next(std::istream& in) const;
45  int eatIdx(std::istream& in) const;
46 
47  // figure out which bitvectorOp/boolOp is the opName specified.
48  BitvectorOp::Op getBvOpType(const std::string& opName) const;
49  BoolOp::Op getBoolOpType(const std::string& opName) const;
50  MemOp::Op getMemOpType(const std::string& opName) const;
51 
52  // export memValue.
53  void exportMemValues(std::ostream& out, const MemValues& val);
54  // import memValue.
55  MemValues importMemValue(std::istream& in, int aw, int dw);
56 };
57 
58 } // namespace ilasynth
59 
60 #endif
char nextChar(std::istream &in) const
std::map< std::string, nptr_t > nref_map_t
Definition: imexport.hpp:12
int reduceWhenImport
Definition: imexport.hpp:41
Op
Definition: bool.hpp:84
Definition: abstraction.hpp:31
Definition: funcReduct.hpp:13
MemValues importMemValue(std::istream &in, int aw, int dw)
nref_map_t _nodeMap
Definition: imexport.hpp:15
boost::shared_ptr< Node > nptr_t
Definition: node.hpp:24
nptr_t importAst(Abstraction *c, std::istream &in)
void mapInsert(const std::string &name, nptr_t nptr)
ImExport(FuncReduction *funcRedPtr, int reduce=0)
int eatIdx(std::istream &in) const
Definition: memvalues.hpp:20
Definition: abstraction.hpp:21
Definition: node.hpp:55
FuncReduction * FuncReductor
Definition: imexport.hpp:39
void exportMemValues(std::ostream &out, const MemValues &val)
BitvectorOp::Op getBvOpType(const std::string &opName) const
MemOp::Op getMemOpType(const std::string &opName) const
Op
Definition: bitvec.hpp:89
std::string next(std::istream &in) const
nptr_t mapFind(const std::string &name) const
Op
Definition: mem.hpp:69
BoolOp::Op getBoolOpType(const std::string &opName) const
void exportAst(std::ostream &out, const Node *n)
void addMapVars(Abstraction *c)
Definition: imexport.hpp:10