aot_export.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. enum {
  21. AOT_FORMAT_FILE,
  22. AOT_OBJECT_FILE,
  23. AOT_LLVMIR_UNOPT_FILE,
  24. AOT_LLVMIR_OPT_FILE,
  25. };
  26. typedef struct AOTCompOption{
  27. bool is_jit_mode;
  28. bool is_indirect_mode;
  29. char *target_arch;
  30. char *target_abi;
  31. char *target_cpu;
  32. char *cpu_features;
  33. bool is_sgx_platform;
  34. bool enable_bulk_memory;
  35. bool enable_thread_mgr;
  36. bool enable_tail_call;
  37. bool enable_simd;
  38. bool enable_ref_types;
  39. bool enable_aux_stack_check;
  40. bool enable_aux_stack_frame;
  41. bool disable_llvm_intrinsics;
  42. uint32_t opt_level;
  43. uint32_t size_level;
  44. uint32_t output_format;
  45. uint32_t bounds_checks;
  46. } AOTCompOption, *aot_comp_option_t;
  47. aot_comp_context_t
  48. aot_create_comp_context(aot_comp_data_t comp_data,
  49. aot_comp_option_t option);
  50. void
  51. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  52. bool
  53. aot_compile_wasm(aot_comp_context_t comp_ctx);
  54. bool
  55. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  56. bool
  57. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  58. bool
  59. aot_emit_aot_file(aot_comp_context_t comp_ctx,
  60. aot_comp_data_t comp_data,
  61. const char *file_name);
  62. void
  63. aot_destroy_aot_file(uint8_t *aot_file);
  64. bool
  65. aot_compile_wasm_file_init();
  66. uint8_t*
  67. aot_compile_wasm_file(const uint8_t *wasm_file_buf, uint32_t wasm_file_size,
  68. uint32_t opt_level, uint32_t size_level,
  69. char *error_buf, uint32_t error_buf_size,
  70. uint32_t *p_aot_file_size);
  71. void
  72. aot_compile_wasm_file_destroy();
  73. char*
  74. aot_get_last_error();
  75. uint32_t
  76. aot_get_plt_table_size();
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif /* end of _AOT_EXPORT_H */