aot_export.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 <inttypes.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. char *target_arch;
  29. char *target_abi;
  30. char *target_cpu;
  31. char *cpu_features;
  32. bool enable_bulk_memory;
  33. bool enable_thread_mgr;
  34. bool enable_tail_call;
  35. bool enable_simd;
  36. bool is_sgx_platform;
  37. uint32_t opt_level;
  38. uint32_t size_level;
  39. uint32_t output_format;
  40. uint32_t bounds_checks;
  41. } AOTCompOption, *aot_comp_option_t;
  42. aot_comp_context_t
  43. aot_create_comp_context(aot_comp_data_t comp_data,
  44. aot_comp_option_t option);
  45. void
  46. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  47. bool
  48. aot_compile_wasm(aot_comp_context_t comp_ctx);
  49. bool
  50. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  51. bool
  52. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  53. bool
  54. aot_emit_aot_file(aot_comp_context_t comp_ctx,
  55. aot_comp_data_t comp_data,
  56. const char *file_name);
  57. void
  58. aot_destroy_aot_file(uint8_t *aot_file);
  59. char*
  60. aot_get_last_error();
  61. uint32_t
  62. aot_get_plt_table_size();
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* end of _AOT_EXPORT_H */