#include <bitcode_writer.hpp>
|
| bitcode_writer (growable_allocator &alloc, std::size_t source_bytes, module &mod) |
|
| ~bitcode_writer () |
|
void | emit_unreachable () |
|
void | emit_nop () |
|
uint32_t | emit_end () |
|
uint32_t * | emit_return (uint32_t depth_change) |
|
void | emit_block () |
|
uint32_t | emit_loop () |
|
uint32_t * | emit_if () |
|
uint32_t * | emit_else (uint32_t *if_loc) |
|
uint32_t * | emit_br (uint32_t depth_change) |
|
uint32_t * | emit_br_if (uint32_t depth_change) |
|
auto | emit_br_table (uint32_t table_size) |
|
void | emit_call (const func_type &ft, uint32_t funcnum) |
|
void | emit_call_indirect (const func_type &ft, uint32_t functypeidx) |
|
void | emit_drop () |
|
void | emit_select () |
|
void | emit_get_local (uint32_t localidx) |
|
void | emit_set_local (uint32_t localidx) |
|
void | emit_tee_local (uint32_t localidx) |
|
void | emit_get_global (uint32_t localidx) |
|
void | emit_set_global (uint32_t localidx) |
|
void | emit_current_memory () |
|
void | emit_grow_memory () |
|
void | emit_i32_const (uint32_t value) |
|
void | emit_i64_const (uint64_t value) |
|
void | emit_f32_const (float value) |
|
void | emit_f64_const (double value) |
|
void | emit_error () |
|
void | fix_branch (uint32_t *branch, uint32_t target) |
|
void | emit_prologue (const func_type &ft, const guarded_vector< local_entry > &, uint32_t idx) |
|
void | emit_epilogue (const func_type &ft, const guarded_vector< local_entry > &locals, uint32_t idx) |
|
void | finalize (function_body &body) |
|
const void * | get_addr () const |
|
const void * | get_base_addr () const |
|
| bitcode_writer (growable_allocator &alloc, std::size_t source_bytes, module &mod) |
|
| ~bitcode_writer () |
|
void | emit_unreachable () |
|
void | emit_nop () |
|
uint32_t | emit_end () |
|
uint32_t * | emit_return (uint32_t depth_change) |
|
void | emit_block () |
|
uint32_t | emit_loop () |
|
uint32_t * | emit_if () |
|
uint32_t * | emit_else (uint32_t *if_loc) |
|
uint32_t * | emit_br (uint32_t depth_change) |
|
uint32_t * | emit_br_if (uint32_t depth_change) |
|
auto | emit_br_table (uint32_t table_size) |
|
void | emit_call (const func_type &ft, uint32_t funcnum) |
|
void | emit_call_indirect (const func_type &ft, uint32_t functypeidx) |
|
void | emit_drop () |
|
void | emit_select () |
|
void | emit_get_local (uint32_t localidx) |
|
void | emit_set_local (uint32_t localidx) |
|
void | emit_tee_local (uint32_t localidx) |
|
void | emit_get_global (uint32_t localidx) |
|
void | emit_set_global (uint32_t localidx) |
|
void | emit_current_memory () |
|
void | emit_grow_memory () |
|
void | emit_i32_const (uint32_t value) |
|
void | emit_i64_const (uint64_t value) |
|
void | emit_f32_const (float value) |
|
void | emit_f64_const (double value) |
|
void | emit_error () |
|
void | fix_branch (uint32_t *branch, uint32_t target) |
|
void | emit_prologue (const func_type &ft, const guarded_vector< local_entry > &, uint32_t idx) |
|
void | emit_epilogue (const func_type &ft, const guarded_vector< local_entry > &locals, uint32_t idx) |
|
void | finalize (function_body &body) |
|
const void * | get_addr () const |
|
const void * | get_base_addr () const |
|
Definition at line 14 of file bitcode_writer.hpp.
◆ bitcode_writer() [1/2]
Definition at line 22 of file bitcode_writer.hpp.
22 :
23 _allocator(alloc),
24 _code_segment_base(alloc.start_code()),
25 fb(alloc, source_bytes),
26 _mod(&mod) {}
◆ ~bitcode_writer() [1/2]
sysio::vm::bitcode_writer::~bitcode_writer |
( |
| ) |
|
|
inline |
◆ bitcode_writer() [2/2]
Definition at line 22 of file bitcode_writer.hpp.
22 :
23 _allocator(alloc),
24 _code_segment_base(alloc.start_code()),
25 fb(alloc, source_bytes),
26 _mod(&mod) {}
◆ ~bitcode_writer() [2/2]
sysio::vm::bitcode_writer::~bitcode_writer |
( |
| ) |
|
|
inline |
◆ emit_block() [1/2]
void sysio::vm::bitcode_writer::emit_block |
( |
| ) |
|
|
inline |
◆ emit_block() [2/2]
void sysio::vm::bitcode_writer::emit_block |
( |
| ) |
|
|
inline |
◆ emit_br() [1/2]
Definition at line 45 of file bitcode_writer.hpp.
45 {
46 auto& instr = append_instr(br_t{});
47 instr.data = depth_change;
48 return &instr.pc;
49 }
◆ emit_br() [2/2]
Definition at line 45 of file bitcode_writer.hpp.
45 {
46 auto& instr = append_instr(br_t{});
47 instr.data = depth_change;
48 return &instr.pc;
49 }
◆ emit_br_if() [1/2]
Definition at line 50 of file bitcode_writer.hpp.
50 {
51 auto& instr = append_instr(br_if_t{});
52 instr.data = depth_change;
53 return &instr.pc;
54 }
◆ emit_br_if() [2/2]
Definition at line 50 of file bitcode_writer.hpp.
50 {
51 auto& instr = append_instr(br_if_t{});
52 instr.data = depth_change;
53 return &instr.pc;
54 }
◆ emit_br_table() [1/2]
auto sysio::vm::bitcode_writer::emit_br_table |
( |
uint32_t | table_size | ) |
|
|
inline |
◆ emit_br_table() [2/2]
auto sysio::vm::bitcode_writer::emit_br_table |
( |
uint32_t | table_size | ) |
|
|
inline |
◆ emit_call() [1/2]
◆ emit_call() [2/2]
◆ emit_call_indirect() [1/2]
void sysio::vm::bitcode_writer::emit_call_indirect |
( |
const func_type & | ft, |
|
|
uint32_t | functypeidx ) |
|
inline |
Definition at line 93 of file bitcode_writer.hpp.
93{ fb[op_index++] = call_indirect_t{ functypeidx }; }
◆ emit_call_indirect() [2/2]
void sysio::vm::bitcode_writer::emit_call_indirect |
( |
const func_type & | ft, |
|
|
uint32_t | functypeidx ) |
|
inline |
Definition at line 93 of file bitcode_writer.hpp.
93{ fb[op_index++] = call_indirect_t{ functypeidx }; }
◆ emit_current_memory() [1/2]
void sysio::vm::bitcode_writer::emit_current_memory |
( |
| ) |
|
|
inline |
◆ emit_current_memory() [2/2]
void sysio::vm::bitcode_writer::emit_current_memory |
( |
| ) |
|
|
inline |
◆ emit_drop() [1/2]
void sysio::vm::bitcode_writer::emit_drop |
( |
| ) |
|
|
inline |
◆ emit_drop() [2/2]
void sysio::vm::bitcode_writer::emit_drop |
( |
| ) |
|
|
inline |
◆ emit_else() [1/2]
Definition at line 40 of file bitcode_writer.hpp.
40 {
41 auto& else_ = append_instr(else_t{});
42 *if_loc = _base_offset + op_index;
43 return &else_.pc;
44 }
◆ emit_else() [2/2]
Definition at line 40 of file bitcode_writer.hpp.
40 {
41 auto& else_ = append_instr(else_t{});
42 *if_loc = _base_offset + op_index;
43 return &else_.pc;
44 }
◆ emit_end() [1/2]
uint32_t sysio::vm::bitcode_writer::emit_end |
( |
| ) |
|
|
inline |
◆ emit_end() [2/2]
uint32_t sysio::vm::bitcode_writer::emit_end |
( |
| ) |
|
|
inline |
◆ emit_epilogue() [1/2]
Definition at line 288 of file bitcode_writer.hpp.
288 {
289 fb.resize(op_index + 1);
292 locals_count +=
locals[i].count;
293 }
294 fb[fb.size() - 1] = return_t{
static_cast<uint32_t>(locals_count + ft.param_types.size()), ft.return_count, 0, 0 };
295 }
◆ emit_epilogue() [2/2]
Definition at line 288 of file bitcode_writer.hpp.
288 {
289 fb.resize(op_index + 1);
292 locals_count +=
locals[i].count;
293 }
294 fb[fb.size() - 1] = return_t{
static_cast<uint32_t>(locals_count + ft.param_types.size()), ft.return_count, 0, 0 };
295 }
◆ emit_error() [1/2]
void sysio::vm::bitcode_writer::emit_error |
( |
| ) |
|
|
inline |
◆ emit_error() [2/2]
void sysio::vm::bitcode_writer::emit_error |
( |
| ) |
|
|
inline |
◆ emit_f32_const() [1/2]
void sysio::vm::bitcode_writer::emit_f32_const |
( |
float | value | ) |
|
|
inline |
◆ emit_f32_const() [2/2]
void sysio::vm::bitcode_writer::emit_f32_const |
( |
float | value | ) |
|
|
inline |
◆ emit_f64_const() [1/2]
void sysio::vm::bitcode_writer::emit_f64_const |
( |
double | value | ) |
|
|
inline |
◆ emit_f64_const() [2/2]
void sysio::vm::bitcode_writer::emit_f64_const |
( |
double | value | ) |
|
|
inline |
◆ emit_get_global() [1/2]
void sysio::vm::bitcode_writer::emit_get_global |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_get_global() [2/2]
void sysio::vm::bitcode_writer::emit_get_global |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_get_local() [1/2]
void sysio::vm::bitcode_writer::emit_get_local |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_get_local() [2/2]
void sysio::vm::bitcode_writer::emit_get_local |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_grow_memory() [1/2]
void sysio::vm::bitcode_writer::emit_grow_memory |
( |
| ) |
|
|
inline |
◆ emit_grow_memory() [2/2]
void sysio::vm::bitcode_writer::emit_grow_memory |
( |
| ) |
|
|
inline |
◆ emit_i32_const() [1/2]
void sysio::vm::bitcode_writer::emit_i32_const |
( |
uint32_t | value | ) |
|
|
inline |
◆ emit_i32_const() [2/2]
void sysio::vm::bitcode_writer::emit_i32_const |
( |
uint32_t | value | ) |
|
|
inline |
◆ emit_i64_const() [1/2]
void sysio::vm::bitcode_writer::emit_i64_const |
( |
uint64_t | value | ) |
|
|
inline |
◆ emit_i64_const() [2/2]
void sysio::vm::bitcode_writer::emit_i64_const |
( |
uint64_t | value | ) |
|
|
inline |
◆ emit_if() [1/2]
uint32_t * sysio::vm::bitcode_writer::emit_if |
( |
| ) |
|
|
inline |
Definition at line 36 of file bitcode_writer.hpp.
36 {
37 if_t& instr = append_instr(if_t{});
38 return &instr.pc;
39 }
◆ emit_if() [2/2]
uint32_t * sysio::vm::bitcode_writer::emit_if |
( |
| ) |
|
|
inline |
Definition at line 36 of file bitcode_writer.hpp.
36 {
37 if_t& instr = append_instr(if_t{});
38 return &instr.pc;
39 }
◆ emit_loop() [1/2]
uint32_t sysio::vm::bitcode_writer::emit_loop |
( |
| ) |
|
|
inline |
◆ emit_loop() [2/2]
uint32_t sysio::vm::bitcode_writer::emit_loop |
( |
| ) |
|
|
inline |
◆ emit_nop() [1/2]
void sysio::vm::bitcode_writer::emit_nop |
( |
| ) |
|
|
inline |
◆ emit_nop() [2/2]
void sysio::vm::bitcode_writer::emit_nop |
( |
| ) |
|
|
inline |
◆ emit_prologue() [1/2]
Definition at line 283 of file bitcode_writer.hpp.
283 {
284 op_index = 0;
285
287 }
managed_vector< T, growable_allocator > guarded_vector
guarded_vector< function_body > code
◆ emit_prologue() [2/2]
◆ emit_return() [1/2]
Definition at line 31 of file bitcode_writer.hpp.
31 {
33 }
uint32_t * emit_br(uint32_t depth_change)
◆ emit_return() [2/2]
◆ emit_select() [1/2]
void sysio::vm::bitcode_writer::emit_select |
( |
| ) |
|
|
inline |
◆ emit_select() [2/2]
void sysio::vm::bitcode_writer::emit_select |
( |
| ) |
|
|
inline |
◆ emit_set_global() [1/2]
void sysio::vm::bitcode_writer::emit_set_global |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_set_global() [2/2]
void sysio::vm::bitcode_writer::emit_set_global |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_set_local() [1/2]
void sysio::vm::bitcode_writer::emit_set_local |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_set_local() [2/2]
void sysio::vm::bitcode_writer::emit_set_local |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_tee_local() [1/2]
void sysio::vm::bitcode_writer::emit_tee_local |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_tee_local() [2/2]
void sysio::vm::bitcode_writer::emit_tee_local |
( |
uint32_t | localidx | ) |
|
|
inline |
◆ emit_unreachable() [1/2]
void sysio::vm::bitcode_writer::emit_unreachable |
( |
| ) |
|
|
inline |
◆ emit_unreachable() [2/2]
void sysio::vm::bitcode_writer::emit_unreachable |
( |
| ) |
|
|
inline |
◆ finalize() [1/2]
Definition at line 297 of file bitcode_writer.hpp.
297 {
298 op_index++;
299 fb.resize(op_index);
300 body.code = fb.raw();
301 body.size = op_index;
302 _base_offset += body.size;
303 }
◆ finalize() [2/2]
Definition at line 297 of file bitcode_writer.hpp.
297 {
298 op_index++;
299 fb.resize(op_index);
300 body.code = fb.raw();
301 body.size = op_index;
302 _base_offset += body.size;
303 }
◆ fix_branch() [1/2]
void sysio::vm::bitcode_writer::fix_branch |
( |
uint32_t * | branch, |
|
|
uint32_t | target ) |
|
inline |
◆ fix_branch() [2/2]
void sysio::vm::bitcode_writer::fix_branch |
( |
uint32_t * | branch, |
|
|
uint32_t | target ) |
|
inline |
◆ get_addr() [1/2]
const void * sysio::vm::bitcode_writer::get_addr |
( |
| ) |
const |
|
inline |
◆ get_addr() [2/2]
const void * sysio::vm::bitcode_writer::get_addr |
( |
| ) |
const |
|
inline |
◆ get_base_addr() [1/2]
const void * sysio::vm::bitcode_writer::get_base_addr |
( |
| ) |
const |
|
inline |
◆ get_base_addr() [2/2]
const void * sysio::vm::bitcode_writer::get_base_addr |
( |
| ) |
const |
|
inline |
◆ br_table_parser
The documentation for this class was generated from the following files: