aot_export.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. uint32_t opt_level;
  49. uint32_t size_level;
  50. uint32_t output_format;
  51. uint32_t bounds_checks;
  52. char **custom_sections;
  53. uint32_t custom_sections_count;
  54. } AOTCompOption, *aot_comp_option_t;
  55. aot_comp_context_t
  56. aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
  57. void
  58. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  59. bool
  60. aot_compile_wasm(aot_comp_context_t comp_ctx);
  61. bool
  62. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  63. bool
  64. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  65. bool
  66. aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  67. const char *file_name);
  68. void
  69. aot_destroy_aot_file(uint8_t *aot_file);
  70. char *
  71. aot_get_last_error();
  72. uint32_t
  73. aot_get_plt_table_size();
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* end of _AOT_EXPORT_H */