Avoid generating some unused LLVM IRs (#1696)

Refine the generated LLVM IRs at the beginning of each LLVM AOT/JIT function
to fasten the LLVM IR optimization:
- Only create argv_buf if there are func calls in this function
- Only create native stack bound if stack bound check is enabled
- Only create aux stack info if there is opcode set_global_aux_stack
- Only create native symbol if indirect_mode is enabled
- Only create memory info if there are memory operations
- Only create func_type_indexes if there is opcode call_indirect
This commit is contained in:
Wenyong Huang
2022-11-14 14:32:35 +08:00
committed by GitHub
parent 4b0660cf24
commit c70e1ebc3d
5 changed files with 376 additions and 190 deletions

View File

@ -247,11 +247,6 @@ struct WASMFunction {
uint32 max_stack_cell_num;
uint32 max_block_num;
/* Whether function has opcode memory.grow */
bool has_op_memory_grow;
/* Whether function has opcode call or
call_indirect */
bool has_op_func_call;
uint32 code_size;
uint8 *code;
#if WASM_ENABLE_FAST_INTERP != 0
@ -260,12 +255,29 @@ struct WASMFunction {
uint8 *consts;
uint32 const_cell_num;
#endif
#if WASM_ENABLE_FAST_JIT != 0
void *fast_jit_jitted_code;
#endif
#if WASM_ENABLE_JIT != 0
void *llvm_jit_func_ptr;
#endif
#if WASM_ENABLE_FAST_JIT != 0 || WASM_ENABLE_JIT != 0 \
|| WASM_ENABLE_WAMR_COMPILER != 0
/* Whether function has opcode memory.grow */
bool has_op_memory_grow;
/* Whether function has opcode call or call_indirect */
bool has_op_func_call;
#endif
#if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0
/* Whether function has memory operation opcodes */
bool has_memory_operations;
/* Whether function has opcode call_indirect */
bool has_op_call_indirect;
/* Whether function has opcode set_global_aux_stack */
bool has_op_set_global_aux_stack;
#endif
};
struct WASMGlobal {