aot_export.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 *dwar_extractor_handle_t;
  22. dwar_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. typedef struct AOTCompOption {
  32. bool is_jit_mode;
  33. bool is_indirect_mode;
  34. char *target_arch;
  35. char *target_abi;
  36. char *target_cpu;
  37. char *cpu_features;
  38. bool is_sgx_platform;
  39. bool enable_bulk_memory;
  40. bool enable_thread_mgr;
  41. bool enable_tail_call;
  42. bool enable_simd;
  43. bool enable_ref_types;
  44. bool enable_aux_stack_check;
  45. bool enable_aux_stack_frame;
  46. bool disable_llvm_intrinsics;
  47. bool disable_llvm_lto;
  48. bool enable_llvm_pgo;
  49. bool enable_stack_estimation;
  50. char *use_prof_file;
  51. uint32_t opt_level;
  52. uint32_t size_level;
  53. uint32_t output_format;
  54. uint32_t bounds_checks;
  55. uint32_t stack_bounds_checks;
  56. uint32_t segue_flags;
  57. char **custom_sections;
  58. uint32_t custom_sections_count;
  59. const char *stack_usage_file;
  60. const char *llvm_passes;
  61. const char *builtin_intrinsics;
  62. } AOTCompOption, *aot_comp_option_t;
  63. bool
  64. aot_compiler_init(void);
  65. void
  66. aot_compiler_destroy(void);
  67. aot_comp_context_t
  68. aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
  69. void
  70. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  71. bool
  72. aot_compile_wasm(aot_comp_context_t comp_ctx);
  73. bool
  74. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  75. bool
  76. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  77. bool
  78. aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  79. const char *file_name);
  80. void
  81. aot_destroy_aot_file(uint8_t *aot_file);
  82. char *
  83. aot_get_last_error();
  84. uint32_t
  85. aot_get_plt_table_size();
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89. #endif /* end of _AOT_EXPORT_H */