Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
instruction_builder.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace bb::avm2::testing {
7
12
13 template <typename T> static OperandBuilder from(T value)
14 {
15 return OperandBuilder(simulation::Operand::from<T>(value));
16 }
17
19 {
20 is_indirect = true;
21 return *this;
22 }
24 {
25 is_relative = true;
26 return *this;
27 }
28
30 bool is_relative = false;
31 bool is_indirect = false;
32};
33
35 private:
38
39 public:
43
45 {
46 operands.push_back(operand);
47 return *this;
48 }
49 template <typename T> InstructionBuilder& operand(T value) { return operand(OperandBuilder::from<T>(value)); }
51 {
52 return operand(OperandBuilder::from<uint8_t>(static_cast<uint8_t>(tag)));
53 }
54
55 // We forward these to the last operand built, for convenience.
57 {
58 operands.back().indirect();
59 return *this;
60 }
62 {
63 operands.back().relative();
64 return *this;
65 }
66
68};
69
70} // namespace bb::avm2::testing
InstructionBuilder & operand(T value)
simulation::Instruction build() const
InstructionBuilder & operand(OperandBuilder operand)
std::vector< OperandBuilder > operands
InstructionBuilder & operand(MemoryTag tag)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
static OperandBuilder from(T value)
OperandBuilder(simulation::Operand operand)