aot_export.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. /**
  6. * @file aot_export.h
  7. *
  8. * @brief This file defines the exported AOT compilation APIs
  9. */
  10. #ifndef _AOT_EXPORT_H
  11. #define _AOT_EXPORT_H
  12. #include <stdint.h>
  13. #include <stdbool.h>
  14. #include "aot_comp_option.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. struct AOTCompData;
  19. typedef struct AOTCompData *aot_comp_data_t;
  20. struct AOTCompContext;
  21. typedef struct AOTCompContext *aot_comp_context_t;
  22. struct AOTObjectData;
  23. typedef struct AOTObjectData *aot_obj_data_t;
  24. aot_comp_data_t
  25. aot_create_comp_data(void *wasm_module, const char *target_arch,
  26. bool gc_enabled);
  27. void
  28. aot_destroy_comp_data(aot_comp_data_t comp_data);
  29. #if WASM_ENABLE_DEBUG_AOT != 0
  30. typedef void *dwarf_extractor_handle_t;
  31. dwarf_extractor_handle_t
  32. create_dwarf_extractor(aot_comp_data_t comp_data, char *file_name);
  33. #endif
  34. enum {
  35. AOT_FORMAT_FILE,
  36. AOT_OBJECT_FILE,
  37. AOT_LLVMIR_UNOPT_FILE,
  38. AOT_LLVMIR_OPT_FILE,
  39. };
  40. bool
  41. aot_compiler_init(void);
  42. void
  43. aot_compiler_destroy(void);
  44. aot_comp_context_t
  45. aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
  46. void
  47. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  48. bool
  49. aot_compile_wasm(aot_comp_context_t comp_ctx);
  50. aot_obj_data_t
  51. aot_obj_data_create(aot_comp_context_t comp_ctx);
  52. void
  53. aot_obj_data_destroy(aot_obj_data_t obj_data);
  54. uint32_t
  55. aot_get_aot_file_size(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  56. aot_obj_data_t obj_data);
  57. uint8_t *
  58. aot_emit_aot_file_buf(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  59. uint32_t *p_aot_file_size);
  60. bool
  61. aot_emit_aot_file_buf_ex(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  62. aot_obj_data_t obj_data, uint8_t *aot_file_buf,
  63. uint32_t aot_file_size);
  64. bool
  65. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  66. bool
  67. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  68. bool
  69. aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  70. const char *file_name);
  71. void
  72. aot_destroy_aot_file(uint8_t *aot_file);
  73. char *
  74. aot_get_last_error(void);
  75. uint32_t
  76. aot_get_plt_table_size(void);
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80. #endif /* end of _AOT_EXPORT_H */