instruction.hpp 649 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
#ifndef GUARD_RTGLIB_INSTRUCTION_HPP
#define GUARD_RTGLIB_INSTRUCTION_HPP

Paul's avatar
Paul committed
4
#include <rtg/literal.hpp>
Paul's avatar
Paul committed
5
#include <rtg/shape.hpp>
Paul's avatar
Paul committed
6
#include <rtg/builtin.hpp>
Paul's avatar
Paul committed
7
#include <string>
Paul's avatar
Paul committed
8
9
10
11
12

namespace rtg {

struct instruction
{
Paul's avatar
Paul committed
13
14
    instruction() {}

Paul's avatar
Paul committed
15
    instruction(operand o, shape r, std::vector<instruction*> args)
Paul's avatar
Paul committed
16
17
18
        : op(std::move(o)), result(std::move(r)), arguments(std::move(args)), lit()
    {
    }
Paul's avatar
Paul committed
19
20

    instruction(literal l)
Paul's avatar
Paul committed
21
22
23
        : op(builtin::literal{}), result(l.get_shape()), arguments(), lit(std::move(l))
    {
    }
Paul's avatar
Paul committed
24

Paul's avatar
Paul committed
25
    operand op;
Paul's avatar
Paul committed
26
27
    shape result;
    std::vector<instruction*> arguments;
Paul's avatar
Paul committed
28
    literal lit;
Paul's avatar
Paul committed
29
30
};

Paul's avatar
Paul committed
31
} // namespace rtg
Paul's avatar
Paul committed
32
33

#endif