Refine wasm loader and interpreter, enhance wamrc to support SGX (#167)
Former-commit-id: 76f4a121d3c2a67114414fc60e80eba4bf49aa8e [formerly b1ab47945a40e6b249c9aa205d61281301585ea6] Former-commit-id: 8e5c6e895eae22051a79a8d337a87cd2f431b6bc
This commit is contained in:
@ -186,7 +186,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case WASM_OP_DROP_32:
|
||||
case WASM_OP_DROP:
|
||||
if (!aot_compile_op_drop(comp_ctx, func_ctx, true))
|
||||
return false;
|
||||
break;
|
||||
@ -196,7 +196,7 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case WASM_OP_SELECT_32:
|
||||
case WASM_OP_SELECT:
|
||||
if (!aot_compile_op_select(comp_ctx, func_ctx, true))
|
||||
return false;
|
||||
break;
|
||||
|
||||
@ -837,7 +837,8 @@ aot_create_comp_context(AOTCompData *comp_data,
|
||||
char *triple_norm_new = NULL, *cpu_new = NULL;
|
||||
char *err = NULL, *fp_round= "round.tonearest", *fp_exce = "fpexcept.strict";
|
||||
char triple_buf[32] = {0};
|
||||
uint32 opt_level;
|
||||
uint32 opt_level, size_level;
|
||||
LLVMCodeModel code_model;
|
||||
|
||||
/* Initialize LLVM environment */
|
||||
LLVMInitializeAllTargetInfos();
|
||||
@ -896,6 +897,7 @@ aot_create_comp_context(AOTCompData *comp_data,
|
||||
cpu = option->target_cpu;
|
||||
features = option->cpu_features;
|
||||
opt_level = option->opt_level;
|
||||
size_level = option->size_level;
|
||||
|
||||
if (arch) {
|
||||
/* Add default sub-arch if not specified */
|
||||
@ -1001,6 +1003,7 @@ aot_create_comp_context(AOTCompData *comp_data,
|
||||
bh_printf(" target cpu: %s\n", cpu);
|
||||
bh_printf(" cpu features: %s\n", features);
|
||||
bh_printf(" opt level: %d\n", opt_level);
|
||||
bh_printf(" size level: %d\n", size_level);
|
||||
switch (option->output_format) {
|
||||
case AOT_LLVMIR_UNOPT_FILE:
|
||||
bh_printf(" output format: unoptimized LLVM IR\n");
|
||||
@ -1030,11 +1033,21 @@ aot_create_comp_context(AOTCompData *comp_data,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Set code model */
|
||||
if (size_level == 0)
|
||||
code_model = LLVMCodeModelLarge;
|
||||
else if (size_level == 1)
|
||||
code_model = LLVMCodeModelMedium;
|
||||
else if (size_level == 2)
|
||||
code_model = LLVMCodeModelKernel;
|
||||
else
|
||||
code_model = LLVMCodeModelSmall;
|
||||
|
||||
/* Create the target machine */
|
||||
if (!(comp_ctx->target_machine =
|
||||
LLVMCreateTargetMachine(target, triple_norm, cpu, features,
|
||||
opt_level, LLVMRelocStatic,
|
||||
LLVMCodeModelSmall))) {
|
||||
code_model))) {
|
||||
aot_set_last_error("create LLVM target machine failed.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -219,6 +219,7 @@ typedef struct AOTCompOption{
|
||||
char *target_cpu;
|
||||
char *cpu_features;
|
||||
uint32 opt_level;
|
||||
uint32 size_level;
|
||||
uint32 output_format;
|
||||
} AOTCompOption, *aot_comp_option_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user