summaryrefslogtreecommitdiff
path: root/lib/codegen/include/code_gen/codegen.h
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2016-09-19 21:14:58 +0000
committerTuowen Zhao <ztuowen@gmail.com>2016-09-19 21:14:58 +0000
commit210f77d2c32f14d2e99577fd3c9842bb19d47e50 (patch)
tree5edb327c919b8309e301c3440fb6668a0075c8ef /lib/codegen/include/code_gen/codegen.h
parenta66ce5cd670c4d3c0dc449720f5bc45dd4c281b8 (diff)
downloadchill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.tar.gz
chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.tar.bz2
chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.zip
Moved most modules into lib
Diffstat (limited to 'lib/codegen/include/code_gen/codegen.h')
-rwxr-xr-xlib/codegen/include/code_gen/codegen.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/codegen/include/code_gen/codegen.h b/lib/codegen/include/code_gen/codegen.h
new file mode 100755
index 0000000..cb63bfd
--- /dev/null
+++ b/lib/codegen/include/code_gen/codegen.h
@@ -0,0 +1,48 @@
+#ifndef _CODEGEN_H
+#define _CODEGEN_H
+
+#include <omega/Relation.h>
+#include <code_gen/CG.h>
+#include <code_gen/CG_outputBuilder.h>
+#include <vector>
+#include <string>
+
+namespace omega {
+
+class CodeGen {
+public:
+ static const std::string loop_var_name_prefix;
+ static const int var_substitution_threshold;
+
+protected:
+ //! projected_IS_[level-1][new stmt#]
+ std::vector<std::vector<Relation> > projected_IS_;
+ //! transformations[original stmt#]
+ std::vector<Relation> xforms_;
+ //! no need to generate code for constraints satisfied in known
+ Relation known_;
+ //! map new stmt# to original stmt#
+ std::vector<int> remap_;
+
+public:
+ CodeGen(const std::vector<Relation> &xforms, const std::vector<Relation> &IS, const Relation &known = Relation::Null(),
+ std::vector< std::vector<int > > smtNonSplitLevels_ = std::vector< std::vector<int > >(),
+ std::vector< std::vector<std::string> > loopIdxNames_ = std::vector< std::vector<std::string> >(),
+ std::vector< std::pair<int, std::string> > syncs_ = std::vector< std::pair<int, std::string> >()
+ );
+ ~CodeGen() {}
+
+ CG_result *buildAST(int effort = 1);
+ int num_level() const { return projected_IS_.size(); }
+
+private:
+ CG_result *buildAST(int level, const BoolSet<> &active, bool split_on_const, const Relation &restriction);
+
+ friend class CG_result;
+ friend class CG_split;
+ friend class CG_loop;
+ friend class CG_leaf;
+};
+
+}
+#endif