mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-29 21:17:17 +00:00
Clear more compile warnings reported by -Wshadow flag (#899)
This commit is contained in:
parent
4258b24bcc
commit
66e6e1f7cd
|
@ -1403,7 +1403,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
if (argc < func_type->param_cell_num) {
|
if (argc < func_type->param_cell_num) {
|
||||||
char buf[128];
|
char buf[108];
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"invalid argument count %u, must be no smaller than %u", argc,
|
"invalid argument count %u, must be no smaller than %u", argc,
|
||||||
func_type->param_cell_num);
|
func_type->param_cell_num);
|
||||||
|
|
|
@ -74,41 +74,41 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
|
||||||
#define SET_BUILDER_POS(llvm_block) \
|
#define SET_BUILDER_POS(llvm_block) \
|
||||||
LLVMPositionBuilderAtEnd(comp_ctx->builder, llvm_block)
|
LLVMPositionBuilderAtEnd(comp_ctx->builder, llvm_block)
|
||||||
|
|
||||||
#define CREATE_RESULT_VALUE_PHIS(block) \
|
#define CREATE_RESULT_VALUE_PHIS(block) \
|
||||||
do { \
|
do { \
|
||||||
if (block->result_count && !block->result_phis) { \
|
if (block->result_count && !block->result_phis) { \
|
||||||
uint32 i; \
|
uint32 _i; \
|
||||||
uint64 size; \
|
uint64 _size; \
|
||||||
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
|
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
|
||||||
/* Allocate memory */ \
|
/* Allocate memory */ \
|
||||||
size = sizeof(LLVMValueRef) * (uint64)block->result_count; \
|
_size = sizeof(LLVMValueRef) * (uint64)block->result_count; \
|
||||||
if (size >= UINT32_MAX \
|
if (_size >= UINT32_MAX \
|
||||||
|| !(block->result_phis = \
|
|| !(block->result_phis = \
|
||||||
wasm_runtime_malloc((uint32)size))) { \
|
wasm_runtime_malloc((uint32)_size))) { \
|
||||||
aot_set_last_error("allocate memory failed."); \
|
aot_set_last_error("allocate memory failed."); \
|
||||||
goto fail; \
|
goto fail; \
|
||||||
} \
|
} \
|
||||||
SET_BUILDER_POS(block->llvm_end_block); \
|
SET_BUILDER_POS(block->llvm_end_block); \
|
||||||
for (i = 0; i < block->result_count; i++) { \
|
for (_i = 0; _i < block->result_count; _i++) { \
|
||||||
if (!(block->result_phis[i] = LLVMBuildPhi( \
|
if (!(block->result_phis[_i] = LLVMBuildPhi( \
|
||||||
comp_ctx->builder, \
|
comp_ctx->builder, \
|
||||||
TO_LLVM_TYPE(block->result_types[i]), "phi"))) { \
|
TO_LLVM_TYPE(block->result_types[_i]), "phi"))) { \
|
||||||
aot_set_last_error("llvm build phi failed."); \
|
aot_set_last_error("llvm build phi failed."); \
|
||||||
goto fail; \
|
goto fail; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
SET_BUILDER_POS(block_curr); \
|
SET_BUILDER_POS(_block_curr); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ADD_TO_RESULT_PHIS(block, value, idx) \
|
#define ADD_TO_RESULT_PHIS(block, value, idx) \
|
||||||
do { \
|
do { \
|
||||||
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
|
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
|
||||||
LLVMTypeRef phi_ty = LLVMTypeOf(block->result_phis[idx]); \
|
LLVMTypeRef phi_ty = LLVMTypeOf(block->result_phis[idx]); \
|
||||||
LLVMTypeRef value_ty = LLVMTypeOf(value); \
|
LLVMTypeRef value_ty = LLVMTypeOf(value); \
|
||||||
bh_assert(LLVMGetTypeKind(phi_ty) == LLVMGetTypeKind(value_ty)); \
|
bh_assert(LLVMGetTypeKind(phi_ty) == LLVMGetTypeKind(value_ty)); \
|
||||||
bh_assert(LLVMGetTypeContext(phi_ty) == LLVMGetTypeContext(value_ty)); \
|
bh_assert(LLVMGetTypeContext(phi_ty) == LLVMGetTypeContext(value_ty)); \
|
||||||
LLVMAddIncoming(block->result_phis[idx], &value, &block_curr, 1); \
|
LLVMAddIncoming(block->result_phis[idx], &value, &_block_curr, 1); \
|
||||||
(void)phi_ty; \
|
(void)phi_ty; \
|
||||||
(void)value_ty; \
|
(void)value_ty; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -122,10 +122,10 @@ format_block_name(char *name, uint32 name_size, uint32 block_index,
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ADD_TO_PARAM_PHIS(block, value, idx) \
|
#define ADD_TO_PARAM_PHIS(block, value, idx) \
|
||||||
do { \
|
do { \
|
||||||
LLVMBasicBlockRef block_curr = CURR_BLOCK(); \
|
LLVMBasicBlockRef _block_curr = CURR_BLOCK(); \
|
||||||
LLVMAddIncoming(block->param_phis[idx], &value, &block_curr, 1); \
|
LLVMAddIncoming(block->param_phis[idx], &value, &_block_curr, 1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static LLVMBasicBlockRef
|
static LLVMBasicBlockRef
|
||||||
|
|
|
@ -85,7 +85,7 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||||
LLVMValueRef mem_base_addr, mem_check_bound;
|
LLVMValueRef mem_base_addr, mem_check_bound;
|
||||||
LLVMBasicBlockRef block_curr = LLVMGetInsertBlock(comp_ctx->builder);
|
LLVMBasicBlockRef block_curr = LLVMGetInsertBlock(comp_ctx->builder);
|
||||||
LLVMBasicBlockRef check_succ;
|
LLVMBasicBlockRef check_succ;
|
||||||
AOTValue *aot_value;
|
AOTValue *aot_value_top;
|
||||||
uint32 local_idx_of_aot_value = 0;
|
uint32 local_idx_of_aot_value = 0;
|
||||||
bool is_target_64bit, is_local_of_aot_value = false;
|
bool is_target_64bit, is_local_of_aot_value = false;
|
||||||
#if WASM_ENABLE_SHARED_MEMORY != 0
|
#if WASM_ENABLE_SHARED_MEMORY != 0
|
||||||
|
@ -114,13 +114,13 @@ aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aot_value =
|
aot_value_top =
|
||||||
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
|
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
|
||||||
if (aot_value) {
|
if (aot_value_top) {
|
||||||
/* aot_value is freed in the following POP_I32(addr),
|
/* aot_value_top is freed in the following POP_I32(addr),
|
||||||
so save its fields here for further use */
|
so save its fields here for further use */
|
||||||
is_local_of_aot_value = aot_value->is_local;
|
is_local_of_aot_value = aot_value_top->is_local;
|
||||||
local_idx_of_aot_value = aot_value->local_idx;
|
local_idx_of_aot_value = aot_value_top->local_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
POP_I32(addr);
|
POP_I32(addr);
|
||||||
|
|
|
@ -32,7 +32,7 @@ aot_compile_op_get_local(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||||
{
|
{
|
||||||
char name[32];
|
char name[32];
|
||||||
LLVMValueRef value;
|
LLVMValueRef value;
|
||||||
AOTValue *aot_value;
|
AOTValue *aot_value_top;
|
||||||
|
|
||||||
CHECK_LOCAL(local_idx);
|
CHECK_LOCAL(local_idx);
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ aot_compile_op_get_local(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
||||||
|
|
||||||
PUSH(value, get_local_type(func_ctx, local_idx));
|
PUSH(value, get_local_type(func_ctx, local_idx));
|
||||||
|
|
||||||
aot_value =
|
aot_value_top =
|
||||||
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
|
func_ctx->block_stack.block_list_end->value_stack.value_list_end;
|
||||||
aot_value->is_local = true;
|
aot_value_top->is_local = true;
|
||||||
aot_value->local_idx = local_idx;
|
aot_value_top->local_idx = local_idx;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -1813,7 +1813,7 @@ aot_create_comp_context(AOTCompData *comp_data, aot_comp_option_t option)
|
||||||
|
|
||||||
if (option->enable_simd) {
|
if (option->enable_simd) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
bool ret;
|
bool check_simd_ret;
|
||||||
|
|
||||||
comp_ctx->enable_simd = true;
|
comp_ctx->enable_simd = true;
|
||||||
|
|
||||||
|
@ -1822,9 +1822,10 @@ aot_create_comp_context(AOTCompData *comp_data, aot_comp_option_t option)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = aot_check_simd_compatibility(comp_ctx->target_arch, tmp);
|
check_simd_ret =
|
||||||
|
aot_check_simd_compatibility(comp_ctx->target_arch, tmp);
|
||||||
LLVMDisposeMessage(tmp);
|
LLVMDisposeMessage(tmp);
|
||||||
if (!ret) {
|
if (!check_simd_ret) {
|
||||||
aot_set_last_error("SIMD compatibility check failed, "
|
aot_set_last_error("SIMD compatibility check failed, "
|
||||||
"try adding --cpu=<cpu> to specify a cpu "
|
"try adding --cpu=<cpu> to specify a cpu "
|
||||||
"or adding --disable-simd to disable SIMD");
|
"or adding --disable-simd to disable SIMD");
|
||||||
|
|
|
@ -456,7 +456,6 @@ load_init_expr(const uint8 **p_buf, const uint8 *buf_end,
|
||||||
#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
|
#if (WASM_ENABLE_WAMR_COMPILER != 0) || (WASM_ENABLE_JIT != 0)
|
||||||
case INIT_EXPR_TYPE_V128_CONST:
|
case INIT_EXPR_TYPE_V128_CONST:
|
||||||
{
|
{
|
||||||
uint8 flag;
|
|
||||||
uint64 high, low;
|
uint64 high, low;
|
||||||
|
|
||||||
if (type != VALUE_TYPE_V128)
|
if (type != VALUE_TYPE_V128)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user