pass.hpp 682 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
#ifndef MIGRAPH_GUARD_PASS_HPP
#define MIGRAPH_GUARD_PASS_HPP

Paul's avatar
Paul committed
4
#include <cassert>
Paul's avatar
Paul committed
5
6
7
8
9
10
11
12
13
14
#include <string>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>

namespace migraph {

struct program;

Paul's avatar
Paul committed
15
16
#ifdef DOXYGEN

Paul's avatar
Paul committed
17
18
/// An interface for applying a transformation to the instructions in a
/// `program`
Paul's avatar
Paul committed
19
20
21
22
23
struct pass
{
    /// A unique name used to identify the pass
    std::string name() const;
    /// Run the pass on the program
Paul's avatar
Paul committed
24
    void apply(program& p) const;
Paul's avatar
Paul committed
25
26
27
28
};

#else

Paul's avatar
Paul committed
29
30
31
32
33
34
35
<%
interface('pass',
    virtual('name', returns='std::string', const=True),
    virtual('apply', returns='void', p='program &', const=True)
)
%>

Paul's avatar
Paul committed
36
37
#endif

Paul's avatar
Paul committed
38
39
40
} // namespace migraph

#endif