gcc config
[prop.git] / prop-src / dataflow.pcc
blob4cc1a4c5ec2ed5c7bfc8181d2bde3d548f32cf9a
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file implements the dataflow analyzer generator.
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #include <iostream.h>
7 #include "basics.ph"
8 #include "dataflow.ph"
9 #include "type.h"
10 #include "ir.ph"
12 ///////////////////////////////////////////////////////////////////////////////
14 //  Instantiate the Prop datatypes.
16 ///////////////////////////////////////////////////////////////////////////////
17 instantiate datatype Domain, List<Domain>;
19 ///////////////////////////////////////////////////////////////////////////////
21 //  Pretty printer for a sequence of domains.
23 ///////////////////////////////////////////////////////////////////////////////
24 ostream& print_domains (ostream& f, Id sep, Domains d)
25 {  match while (d) of
26       #[ ]:              { return f; }
27    |  #[ one ]:          { return f << one; }
28    |  #[ one ... rest ]: { f << one << sep; d = rest; }
29    end match;
32 ///////////////////////////////////////////////////////////////////////////////
34 //  Pretty printer for domains.
36 ///////////////////////////////////////////////////////////////////////////////
37 ostream& operator << (ostream& f, Domain d)
38 {  match (d) of
39       UNITdom:        { f << "unit"; }
40    |  FINSETdom ty:   { f << "setof<" << ty << ">"; }
41    |  LIFTdom d:      { f << "lift<" << d << ">"; }
42    |  SUMdom d:       { print_domains(f," + ",d); }
43    |  PRODUCTdom d:   { print_domains(f," * ",d); }
44    end match;
45    return f;
48 ///////////////////////////////////////////////////////////////////////////////
50 //  The dataflow class
52 ///////////////////////////////////////////////////////////////////////////////
53 DataflowClass::DataflowClass(Id id, Inherits i, TyQual q, Decls d)
54    : ClassDefinition(DATAFLOW_CLASS,
55                      id,#[],add_inherit("DataflowBase",#[],i),q,d) {}
56 DataflowClass::~DataflowClass() {}
58 void DataflowClass::gen_class_interface(CodeGen& C)
62 ///////////////////////////////////////////////////////////////////////////////
64 //  Constructor and destructor for the dataflow compiler.
66 ///////////////////////////////////////////////////////////////////////////////
67 DataflowCompiler:: DataflowCompiler () {}
68 DataflowCompiler::~DataflowCompiler () {}