ignore .lib and .exe
[prop.git] / prop-src / datagen.h
blobc4f50d8151e7cdfdc8650eb35eb56e7d90115e72
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // The Datatype compiler
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef datatype_compiler_h
7 #define datatype_compiler_h
9 #include "codegen.h"
10 #include "labelgen.h"
11 #include "ir.h"
12 #include "ast.h"
13 #include "hashtab.h"
15 ///////////////////////////////////////////////////////////////////////////////
17 // Forward class declarations
19 ///////////////////////////////////////////////////////////////////////////////
20 class DatatypeClass;
21 class DatatypeHierarchy;
23 ///////////////////////////////////////////////////////////////////////////////
25 // This class implements the datatype compiler.
27 ///////////////////////////////////////////////////////////////////////////////
28 class DatatypeCompiler : virtual public CodeGen {
29 DatatypeCompiler(const DatatypeCompiler&); // no copy constructor
30 void operator = (const DatatypeCompiler&); // no assignment
31 public:
32 ////////////////////////////////////////////////////////////////////////////
33 // Constructor and destructor
34 ////////////////////////////////////////////////////////////////////////////
35 DatatypeCompiler(TyOpt opt, int embedded_tags);
36 virtual ~DatatypeCompiler();
38 void preprocess_def (DatatypeDef);
40 ////////////////////////////////////////////////////////////////////////////
42 // Methods to enter and lookup a pattern constructor.
43 // These interact with the pattern/constructor environment.
44 // Called from the parser.
46 ////////////////////////////////////////////////////////////////////////////
47 static void add_law (LawDef);
48 static Pat lookup_pat (Id);
49 static Exp lookup_law (Id, Exps);
51 private:
53 friend class DatatypeClass;
54 friend class DatatypeHierarchy;
55 TyOpt optimizations; // optimizations in place
56 static int max_embedded_tags; // maximum number of tags that
57 // can be embedded into the
58 // lower bits of a pointer.
59 static int max_embedded_bits;
60 static LabelGen temp_vars;
61 static HashTable law_env;
63 protected:
65 ////////////////////////////////////////////////////////////////////////////
66 // Methods for mapping datatypes into C++ classes.
67 ////////////////////////////////////////////////////////////////////////////
68 void gen_datatype(DatatypeDefs, ViewDefs, LawDefs, TyDefs);
69 void gen_type_def(TyDef);
70 void gen_law_defs (LawDefs);
71 void gen_law_inverse (const Loc *, Id, Ids, Exp, Ty);
73 ////////////////////////////////////////////////////////////////////////////
74 // Methods for generating datatype instantiation code.
75 ////////////////////////////////////////////////////////////////////////////
76 void instantiate_datatypes (Bool external, Tys);
77 void instantiate_datatypes (Bool external, Ty);
80 #endif