aot_emit_memory.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _AOT_EMIT_MEMORY_H_
  6. #define _AOT_EMIT_MEMORY_H_
  7. #include "aot_compiler.h"
  8. #if WASM_ENABLE_SHARED_MEMORY != 0
  9. #include "wasm_shared_memory.h"
  10. #endif
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. bool
  15. aot_compile_op_i32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  16. uint32 align, mem_offset_t offset, uint32 bytes,
  17. bool sign, bool atomic);
  18. bool
  19. aot_compile_op_i64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  20. uint32 align, mem_offset_t offset, uint32 bytes,
  21. bool sign, bool atomic);
  22. bool
  23. aot_compile_op_f32_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  24. uint32 align, mem_offset_t offset);
  25. bool
  26. aot_compile_op_f64_load(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  27. uint32 align, mem_offset_t offset);
  28. bool
  29. aot_compile_op_i32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  30. uint32 align, mem_offset_t offset, uint32 bytes,
  31. bool atomic);
  32. bool
  33. aot_compile_op_i64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  34. uint32 align, mem_offset_t offset, uint32 bytes,
  35. bool atomic);
  36. bool
  37. aot_compile_op_f32_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  38. uint32 align, mem_offset_t offset);
  39. bool
  40. aot_compile_op_f64_store(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  41. uint32 align, mem_offset_t offset);
  42. LLVMValueRef
  43. aot_check_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  44. mem_offset_t offset, uint32 bytes, bool enable_segue);
  45. bool
  46. aot_compile_op_memory_size(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  47. bool
  48. aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  49. bool
  50. check_memory_alignment(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  51. LLVMValueRef addr, uint32 align);
  52. LLVMValueRef
  53. check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  54. LLVMValueRef offset, LLVMValueRef bytes);
  55. #if WASM_ENABLE_BULK_MEMORY != 0
  56. bool
  57. aot_compile_op_memory_init(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  58. uint32 seg_index);
  59. bool
  60. aot_compile_op_data_drop(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  61. uint32 seg_index);
  62. bool
  63. aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  64. bool
  65. aot_compile_op_memory_fill(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  66. #endif
  67. #if WASM_ENABLE_SHARED_MEMORY != 0
  68. bool
  69. aot_compile_op_atomic_rmw(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  70. uint8 atomic_op, uint8 op_type, uint32 align,
  71. mem_offset_t offset, uint32 bytes);
  72. bool
  73. aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
  74. AOTFuncContext *func_ctx, uint8 op_type,
  75. uint32 align, mem_offset_t offset, uint32 bytes);
  76. bool
  77. aot_compile_op_atomic_wait(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  78. uint8 op_type, uint32 align, mem_offset_t offset,
  79. uint32 bytes);
  80. bool
  81. aot_compiler_op_atomic_notify(AOTCompContext *comp_ctx,
  82. AOTFuncContext *func_ctx, uint32 align,
  83. mem_offset_t offset, uint32 bytes);
  84. bool
  85. aot_compiler_op_atomic_fence(AOTCompContext *comp_ctx,
  86. AOTFuncContext *func_ctx);
  87. #endif
  88. #ifdef __cplusplus
  89. } /* end of extern "C" */
  90. #endif
  91. #endif /* end of _AOT_EMIT_MEMORY_H_ */