aot_export.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _AOT_EXPORT_H
  6. #define _AOT_EXPORT_H
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. struct AOTCompData;
  13. typedef struct AOTCompData *aot_comp_data_t;
  14. struct AOTCompContext;
  15. typedef struct AOTCompContext *aot_comp_context_t;
  16. aot_comp_data_t
  17. aot_create_comp_data(void *wasm_module);
  18. void
  19. aot_destroy_comp_data(aot_comp_data_t comp_data);
  20. #if WASM_ENABLE_DEBUG_AOT != 0
  21. typedef void *dwarf_extractor_handle_t;
  22. dwarf_extractor_handle_t
  23. create_dwarf_extractor(aot_comp_data_t comp_data, char *file_name);
  24. #endif
  25. enum {
  26. AOT_FORMAT_FILE,
  27. AOT_OBJECT_FILE,
  28. AOT_LLVMIR_UNOPT_FILE,
  29. AOT_LLVMIR_OPT_FILE,
  30. };
  31. /* always sync it with AOTCompOption in compilation/aot_llvm.h */
  32. typedef struct AOTCompOption {
  33. bool is_jit_mode;
  34. bool is_indirect_mode;
  35. char *target_arch;
  36. char *target_abi;
  37. char *target_cpu;
  38. char *cpu_features;
  39. bool is_sgx_platform;
  40. bool enable_bulk_memory;
  41. bool enable_thread_mgr;
  42. bool enable_tail_call;
  43. bool enable_simd;
  44. bool enable_ref_types;
  45. bool enable_aux_stack_check;
  46. bool enable_aux_stack_frame;
  47. bool disable_llvm_intrinsics;
  48. bool disable_llvm_lto;
  49. bool enable_llvm_pgo;
  50. bool enable_stack_estimation;
  51. char *use_prof_file;
  52. uint32_t opt_level;
  53. uint32_t size_level;
  54. uint32_t output_format;
  55. uint32_t bounds_checks;
  56. uint32_t stack_bounds_checks;
  57. uint32_t segue_flags;
  58. char **custom_sections;
  59. uint32_t custom_sections_count;
  60. const char *stack_usage_file;
  61. const char *llvm_passes;
  62. const char *builtin_intrinsics;
  63. } AOTCompOption, *aot_comp_option_t;
  64. bool
  65. aot_compiler_init(void);
  66. void
  67. aot_compiler_destroy(void);
  68. aot_comp_context_t
  69. aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
  70. void
  71. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  72. bool
  73. aot_compile_wasm(aot_comp_context_t comp_ctx);
  74. bool
  75. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  76. bool
  77. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  78. bool
  79. aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  80. const char *file_name);
  81. void
  82. aot_destroy_aot_file(uint8_t *aot_file);
  83. char *
  84. aot_get_last_error();
  85. uint32_t
  86. aot_get_plt_table_size();
  87. #ifdef __cplusplus
  88. }
  89. #endif
  90. #endif /* end of _AOT_EXPORT_H */