From f1f6f4a12566b988597a9113e003b09ea717e2ef Mon Sep 17 00:00:00 2001 From: "liang.he" Date: Wed, 2 Nov 2022 08:32:16 +0800 Subject: [PATCH] Remove unused codes in AOT compiler (#1668) Remove the setup of JIT LLVMOrcIRTransformLayerSetTransform and LLVMOrcObjectTransformLayerSetTransform which is commented. --- core/iwasm/compilation/aot_llvm.c | 47 ------------------------------- 1 file changed, 47 deletions(-) diff --git a/core/iwasm/compilation/aot_llvm.c b/core/iwasm/compilation/aot_llvm.c index 7a20dbba..e60e421b 100644 --- a/core/iwasm/compilation/aot_llvm.c +++ b/core/iwasm/compilation/aot_llvm.c @@ -1279,42 +1279,6 @@ aot_handle_llvm_errmsg(const char *string, LLVMErrorRef err) LLVMDisposeErrorMessage(err_msg); } -#ifndef NDEBUG -static LLVMErrorRef -run_pass(void *ctx, LLVMModuleRef module) -{ - /*AOTCompContext *comp_ctx = (AOTCompContext *)ctx;*/ - - size_t len; - LOG_VERBOSE("--- In IRTransformLayer @ M#%s, T#%ld---", - LLVMGetModuleIdentifier(module, &len), pthread_self()); - - /* TODO: enable this for JIT mode after fixing LLVM issues */ - /*aot_apply_llvm_new_pass_manager(comp_ctx, module);*/ - - bh_print_time("Begin to generate machine code"); - return LLVMErrorSuccess; -} - -static LLVMErrorRef -do_ir_transform(void *ctx, LLVMOrcThreadSafeModuleRef *module, - LLVMOrcMaterializationResponsibilityRef mr) -{ - (void)mr; - return LLVMOrcThreadSafeModuleWithModuleDo(*module, run_pass, ctx); -} - -static LLVMErrorRef -do_obj_transform(void *Ctx, LLVMMemoryBufferRef *ObjInOut) -{ - bh_print_time("Finish generating machine code"); - LOG_VERBOSE("--- In ObjectTransformLayer @ T#%ld ---", pthread_self()); - (void)Ctx; - (void)ObjInOut; - return LLVMErrorSuccess; -} -#endif - static bool create_target_machine_detect_host(AOTCompContext *comp_ctx) { @@ -1422,17 +1386,6 @@ orc_jit_create(AOTCompContext *comp_ctx) /* Ownership transfer: LLVMOrcLLJITBuilderRef -> LLVMOrcLLJITRef */ builder = NULL; -#ifndef NDEBUG - /* Setup TransformLayer */ - LLVMOrcIRTransformLayerSetTransform( - LLVMOrcLLLazyJITGetIRTransformLayer(orc_jit), *do_ir_transform, - comp_ctx); - - LLVMOrcObjectTransformLayerSetTransform( - LLVMOrcLLLazyJITGetObjTransformLayer(orc_jit), *do_obj_transform, - comp_ctx); -#endif - /* Ownership transfer: local -> AOTCompContext */ comp_ctx->orc_jit = orc_jit; orc_jit = NULL;