aot_export.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. #include "aot_comp_option.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. struct AOTCompData;
  14. typedef struct AOTCompData *aot_comp_data_t;
  15. struct AOTCompContext;
  16. typedef struct AOTCompContext *aot_comp_context_t;
  17. aot_comp_data_t
  18. aot_create_comp_data(void *wasm_module, const char *target_arch,
  19. bool gc_enabled);
  20. void
  21. aot_destroy_comp_data(aot_comp_data_t comp_data);
  22. #if WASM_ENABLE_DEBUG_AOT != 0
  23. typedef void *dwarf_extractor_handle_t;
  24. dwarf_extractor_handle_t
  25. create_dwarf_extractor(aot_comp_data_t comp_data, char *file_name);
  26. #endif
  27. enum {
  28. AOT_FORMAT_FILE,
  29. AOT_OBJECT_FILE,
  30. AOT_LLVMIR_UNOPT_FILE,
  31. AOT_LLVMIR_OPT_FILE,
  32. };
  33. bool
  34. aot_compiler_init(void);
  35. void
  36. aot_compiler_destroy(void);
  37. aot_comp_context_t
  38. aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
  39. void
  40. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  41. bool
  42. aot_compile_wasm(aot_comp_context_t comp_ctx);
  43. bool
  44. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  45. bool
  46. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  47. bool
  48. aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  49. const char *file_name);
  50. void
  51. aot_destroy_aot_file(uint8_t *aot_file);
  52. char *
  53. aot_get_last_error();
  54. uint32_t
  55. aot_get_plt_table_size();
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* end of _AOT_EXPORT_H */