diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-19 21:14:58 +0000 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2016-09-19 21:14:58 +0000 |
commit | 210f77d2c32f14d2e99577fd3c9842bb19d47e50 (patch) | |
tree | 5edb327c919b8309e301c3440fb6668a0075c8ef /include/irtools.hh | |
parent | a66ce5cd670c4d3c0dc449720f5bc45dd4c281b8 (diff) | |
download | chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.tar.gz chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.tar.bz2 chill-210f77d2c32f14d2e99577fd3c9842bb19d47e50.zip |
Moved most modules into lib
Diffstat (limited to 'include/irtools.hh')
-rw-r--r-- | include/irtools.hh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/irtools.hh b/include/irtools.hh new file mode 100644 index 0000000..a3b552a --- /dev/null +++ b/include/irtools.hh @@ -0,0 +1,48 @@ +#ifndef IRTOOLS_HH +#define IRTOOLS_HH + +/*! + * \file + * \brief Useful tools to analyze code in compiler IR format. + */ + +#include <vector> +#include <omega.h> +#include <code_gen/CG_outputRepr.h> +#include "ir_code.hh" +#include "dep.hh" + +//! It is used to initialize a loop. +struct ir_tree_node { + IR_Control *content; + ir_tree_node *parent; + std::vector<ir_tree_node *> children; +/*! + * * For a loop node, payload is its mapped iteration space dimension. + * * For a simple block node, payload is its mapped statement number. + * * Normal if-else is splitted into two nodes + * * the one with odd payload represents then-part and + * * the one with even payload represents else-part. + */ + int payload; + + ~ir_tree_node() { + for (int i = 0; i < children.size(); i++) + delete children[i]; + delete content; + } +}; + +std::vector<ir_tree_node *> build_ir_tree(IR_Control *control, + ir_tree_node *parent = NULL); +std::vector<ir_tree_node *> extract_ir_stmts( + const std::vector<ir_tree_node *> &ir_tree); +bool is_dependence_valid(ir_tree_node *src_node, ir_tree_node *dst_node, + const DependenceVector &dv, bool before); +std::pair<std::vector<DependenceVector>, std::vector<DependenceVector> > test_data_dependences( + IR_Code *ir, const omega::CG_outputRepr *repr1, + const omega::Relation &IS1, const omega::CG_outputRepr *repr2, + const omega::Relation &IS2, std::vector<omega::Free_Var_Decl*> &freevar, + std::vector<std::string> index, int i, int j); + +#endif |