nany
bootstrap
libnanyc
details
ir
instruction.h
1
#pragma once
2
#include "libnanyc.h"
3
#include "details/ir/isa/opcodes.h"
4
#include "details/ir/isa/data.h"
5
6
7
8
namespace
ny
{
9
namespace
ir {
10
11
12
struct
Instruction
final {
13
uint32_t opcodes[4];
14
16
template
<isa::Op O>
isa::Operand<O>
&
to
() {
17
return
reinterpret_cast<
isa::Operand<O>
&
>
(*this);
18
}
19
21
template
<isa::Op O>
const
isa::Operand<O>
&
to
()
const
{
22
return
reinterpret_cast<
const
isa::Operand<O>
&
>
(*this);
23
}
24
25
template
<isa::Op O>
26
static
Instruction
& fromOpcode(
isa::Operand<O>
& opc) {
27
return
reinterpret_cast<
Instruction
&
>
(opc);
28
}
29
30
template
<isa::Op O>
31
static
const
Instruction
& fromOpcode(
const
isa::Operand<O>
& opc) {
32
return
reinterpret_cast<
const
Instruction
&
>
(opc);
33
}
34
35
};
// struct Instruction
36
37
38
39
40
41
}
// namespace ir
42
}
// namespace ny
ny
Definition:
ast.cpp:6
ny::ir::Instruction::to
isa::Operand< O > & to()
Convert the instruction into an Opcode struct.
Definition:
instruction.h:16
ny::ir::Instruction
Definition:
instruction.h:12
ny::ir::Instruction::to
const isa::Operand< O > & to() const
Convert the instruction into an Opcode struct (const)
Definition:
instruction.h:21
ny::ir::isa::Operand
Definition:
data.h:85
Generated by
1.8.12