This repository has been archived on 2023-11-05. You can view files and clone it, but cannot push or open issues or pull requests.
wasm-micro-runtime/core/iwasm/include/aot_export.h
Wenyong Huang db695fada4
Implement XIP feature and enable ARC target support (#694)
Implement XIP (Execution In Place) feature for AOT mode to enable running the AOT code inside AOT file directly, without memory mapping the executable memory for AOT code and applying relocations for text section. Developer can use wamrc with "--enable-indirect-mode --disable-llvm-intrinsics" flags to generate the AOT file and run iwasm with "--xip" flag. Known issues: there might still be some relocations in the text section which access the ".rodata" like sections.

And also enable ARC target support for both interpreter mode and AOT mode.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
2021-08-12 17:44:39 +08:00

105 lines
2.2 KiB
C

/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#ifndef _AOT_EXPORT_H
#define _AOT_EXPORT_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
struct AOTCompData;
typedef struct AOTCompData *aot_comp_data_t;
struct AOTCompContext;
typedef struct AOTCompContext *aot_comp_context_t;
aot_comp_data_t
aot_create_comp_data(void *wasm_module);
void
aot_destroy_comp_data(aot_comp_data_t comp_data);
enum {
AOT_FORMAT_FILE,
AOT_OBJECT_FILE,
AOT_LLVMIR_UNOPT_FILE,
AOT_LLVMIR_OPT_FILE,
};
typedef struct AOTCompOption{
bool is_jit_mode;
bool is_indirect_mode;
char *target_arch;
char *target_abi;
char *target_cpu;
char *cpu_features;
bool is_sgx_platform;
bool enable_bulk_memory;
bool enable_thread_mgr;
bool enable_tail_call;
bool enable_simd;
bool enable_ref_types;
bool enable_aux_stack_check;
bool enable_aux_stack_frame;
bool disable_llvm_intrinsics;
uint32_t opt_level;
uint32_t size_level;
uint32_t output_format;
uint32_t bounds_checks;
} AOTCompOption, *aot_comp_option_t;
aot_comp_context_t
aot_create_comp_context(aot_comp_data_t comp_data,
aot_comp_option_t option);
void
aot_destroy_comp_context(aot_comp_context_t comp_ctx);
bool
aot_compile_wasm(aot_comp_context_t comp_ctx);
bool
aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
bool
aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
bool
aot_emit_aot_file(aot_comp_context_t comp_ctx,
aot_comp_data_t comp_data,
const char *file_name);
void
aot_destroy_aot_file(uint8_t *aot_file);
bool
aot_compile_wasm_file_init();
uint8_t*
aot_compile_wasm_file(const uint8_t *wasm_file_buf, uint32_t wasm_file_size,
uint32_t opt_level, uint32_t size_level,
char *error_buf, uint32_t error_buf_size,
uint32_t *p_aot_file_size);
void
aot_compile_wasm_file_destroy();
char*
aot_get_last_error();
uint32_t
aot_get_plt_table_size();
#ifdef __cplusplus
}
#endif
#endif /* end of _AOT_EXPORT_H */