instruction.hpp 614 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
    : op(std::move(o)), result(std::move(r)), arguments(std::move(args)), lit()
Paul's avatar
Paul committed
17
18
19
    {}

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

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

}

#endif