aot_export.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. aot_comp_data_t
  23. aot_create_comp_data(void *wasm_module, const char *target_arch,
  24. bool gc_enabled);
  25. void
  26. aot_destroy_comp_data(aot_comp_data_t comp_data);
  27. #if WASM_ENABLE_DEBUG_AOT != 0
  28. typedef void *dwarf_extractor_handle_t;
  29. dwarf_extractor_handle_t
  30. create_dwarf_extractor(aot_comp_data_t comp_data, char *file_name);
  31. #endif
  32. enum {
  33. AOT_FORMAT_FILE,
  34. AOT_OBJECT_FILE,
  35. AOT_LLVMIR_UNOPT_FILE,
  36. AOT_LLVMIR_OPT_FILE,
  37. };
  38. bool
  39. aot_compiler_init(void);
  40. void
  41. aot_compiler_destroy(void);
  42. aot_comp_context_t
  43. aot_create_comp_context(aot_comp_data_t comp_data, aot_comp_option_t option);
  44. void
  45. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  46. bool
  47. aot_compile_wasm(aot_comp_context_t comp_ctx);
  48. bool
  49. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  50. bool
  51. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  52. bool
  53. aot_emit_aot_file(aot_comp_context_t comp_ctx, aot_comp_data_t comp_data,
  54. const char *file_name);
  55. void
  56. aot_destroy_aot_file(uint8_t *aot_file);
  57. char *
  58. aot_get_last_error();
  59. uint32_t
  60. aot_get_plt_table_size();
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif /* end of _AOT_EXPORT_H */