pass.hpp 663 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef MIGRAPH_GUARD_PASS_HPP
#define MIGRAPH_GUARD_PASS_HPP

#include <string>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>

namespace migraph {

struct program;

Paul's avatar
Paul committed
14
15
#ifdef DOXYGEN

Paul's avatar
Paul committed
16
17
/// An interface for applying a transformation to the instructions in a
/// `program`
Paul's avatar
Paul committed
18
19
20
21
22
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
23
    void apply(program& p) const;
Paul's avatar
Paul committed
24
25
26
27
};

#else

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

Paul's avatar
Paul committed
35
36
#endif

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

#endif