WAMR User APIs
aot_export.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Intel Corporation. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4  */
5 
13 #ifndef _AOT_EXPORT_H
14 #define _AOT_EXPORT_H
15 
16 #include <stdint.h>
17 #include <stdbool.h>
18 
19 #include "aot_comp_option.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 struct AOTCompData;
26 typedef struct AOTCompData *aot_comp_data_t;
27 
28 struct AOTCompContext;
29 typedef struct AOTCompContext *aot_comp_context_t;
30 
31 aot_comp_data_t
32 aot_create_comp_data(void *wasm_module, const char *target_arch,
33  bool gc_enabled);
34 
35 void
36 aot_destroy_comp_data(aot_comp_data_t comp_data);
37 
38 #if WASM_ENABLE_DEBUG_AOT != 0
39 typedef void *dwarf_extractor_handle_t;
40 dwarf_extractor_handle_t
41 create_dwarf_extractor(aot_comp_data_t comp_data, char *file_name);
42 #endif
43 
44 enum {
45  AOT_FORMAT_FILE,
46  AOT_OBJECT_FILE,
47  AOT_LLVMIR_UNOPT_FILE,
48  AOT_LLVMIR_OPT_FILE,
49 };
50 
51 bool
52 aot_compiler_init(void);
53 
54 void
55 aot_compiler_destroy(void);
56 
57 aot_comp_context_t
58 aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
59 
60 void
61 aot_destroy_comp_context(aot_comp_context_t comp_ctx);
62 
63 bool
64 aot_compile_wasm(aot_comp_context_t comp_ctx);
65 
66 bool
67 aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
68 
69 bool
70 aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
71 
72 bool
73 aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
74  const char *file_name);
75 
76 void
77 aot_destroy_aot_file(uint8_t *aot_file);
78 
79 char *
80 aot_get_last_error();
81 
82 uint32_t
83 aot_get_plt_table_size();
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* end of _AOT_EXPORT_H */