aot_export.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. uint32_t opt_level;
  33. uint32_t output_format;
  34. } AOTCompOption, *aot_comp_option_t;
  35. aot_comp_context_t
  36. aot_create_comp_context(aot_comp_data_t comp_data,
  37. aot_comp_option_t option);
  38. void
  39. aot_destroy_comp_context(aot_comp_context_t comp_ctx);
  40. bool
  41. aot_compile_wasm(aot_comp_context_t comp_ctx);
  42. bool
  43. aot_emit_llvm_file(aot_comp_context_t comp_ctx, const char *file_name);
  44. bool
  45. aot_emit_object_file(aot_comp_context_t comp_ctx, const char *file_name);
  46. bool
  47. aot_emit_aot_file(aot_comp_context_t comp_ctx,
  48. 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 */