writeOpcode
Zero-operand instructions
Function parameters
Parameters
- writer:anytype
- opcode:u8
Expressions can be evaluated in different contexts, each requiring its own set of inputs.
Types
A stack machine that can decode and run DWARF expressions.
Functions
- StackMachine
- A stack machine that can decode and run DWARF expressions.
Error sets in this namespace
Error Sets
Source
Implementation
pub fn writeOpcode(writer: anytype, comptime opcode: u8) !void {
if (options.call_frame_context and !comptime isOpcodeValidInCFA(opcode)) return error.InvalidCFAOpcode;
switch (opcode) {
OP.dup,
OP.drop,
OP.over,
OP.swap,
OP.rot,
OP.deref,
OP.xderef,
OP.push_object_address,
OP.form_tls_address,
OP.call_frame_cfa,
OP.abs,
OP.@"and",
OP.div,
OP.minus,
OP.mod,
OP.mul,
OP.neg,
OP.not,
OP.@"or",
OP.plus,
OP.shl,
OP.shr,
OP.shra,
OP.xor,
OP.le,
OP.ge,
OP.eq,
OP.lt,
OP.gt,
OP.ne,
OP.nop,
OP.stack_value,
=> try writer.writeByte(opcode),
else => @compileError("This opcode requires operands, use `write<Opcode>()` instead"),
}
}