target.hpp 1.19 KB
Newer Older
Paul's avatar
Paul committed
1
2
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_TARGET_HPP
Paul's avatar
Paul committed
3
4
5
6
7
8

#include <string>
#include <functional>
#include <memory>
#include <type_traits>
#include <utility>
Paul's avatar
Paul committed
9
#include <vector>
Paul's avatar
Paul committed
10
#include <migraph/context.hpp>
Paul's avatar
Paul committed
11
#include <migraph/pass.hpp>
Paul's avatar
Paul committed
12

Paul's avatar
Paul committed
13
namespace migraph {
Paul's avatar
Paul committed
14

Paul's avatar
Paul committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#if DOXYGEN

/// A compilation target
struct target
{
    /// A unique name used to identify the target
    std::string name() const;
    /// The transformation passes to be run
    /**
     * @brief The transformation pass to be run during compilation.
     * @details [long description]
     * 
     * @param ctx This is the target-dependent context that is created by `get_context`
     * @return The passes to be ran
     */
    std::vector<pass> get_passes(context& ctx) const;
    /**
     * @brief Construct a context for the target.
     * @return The context to be used during compilation and execution.
     */
    context get_context() const;
};

#else
Paul's avatar
Paul committed
39
40
41
42

<%
interface('target',
    virtual('name', returns='std::string', const=True),
Paul's avatar
Paul committed
43
    virtual('get_passes', ctx='context&', returns='std::vector<pass>', const=True),
Paul's avatar
Paul committed
44
    virtual('get_context', returns='context', const=True)
Paul's avatar
Paul committed
45
46
47
)
%>

Paul's avatar
Paul committed
48
49
#endif

Paul's avatar
Paul committed
50
} // namespace migraph
Paul's avatar
Paul committed
51
52

#endif