aot_emit_memory.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. unsigned int *alignp);
  46. bool
  47. aot_compile_op_memory_size(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  48. bool
  49. aot_compile_op_memory_grow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  50. bool
  51. check_memory_alignment(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  52. LLVMValueRef addr, uint32 align);
  53. LLVMValueRef
  54. check_bulk_memory_overflow(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  55. LLVMValueRef offset, LLVMValueRef bytes);
  56. #if WASM_ENABLE_BULK_MEMORY != 0
  57. bool
  58. aot_compile_op_memory_init(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  59. uint32 seg_index);
  60. bool
  61. aot_compile_op_data_drop(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  62. uint32 seg_index);
  63. bool
  64. aot_compile_op_memory_copy(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  65. bool
  66. aot_compile_op_memory_fill(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
  67. #endif
  68. #if WASM_ENABLE_SHARED_MEMORY != 0
  69. bool
  70. aot_compile_op_atomic_rmw(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  71. uint8 atomic_op, uint8 op_type, uint32 align,
  72. mem_offset_t offset, uint32 bytes);
  73. bool
  74. aot_compile_op_atomic_cmpxchg(AOTCompContext *comp_ctx,
  75. AOTFuncContext *func_ctx, uint8 op_type,
  76. uint32 align, mem_offset_t offset, uint32 bytes);
  77. bool
  78. aot_compile_op_atomic_wait(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
  79. uint8 op_type, uint32 align, mem_offset_t offset,
  80. uint32 bytes);
  81. bool
  82. aot_compiler_op_atomic_notify(AOTCompContext *comp_ctx,
  83. AOTFuncContext *func_ctx, uint32 align,
  84. mem_offset_t offset, uint32 bytes);
  85. bool
  86. aot_compiler_op_atomic_fence(AOTCompContext *comp_ctx,
  87. AOTFuncContext *func_ctx);
  88. #endif
  89. #ifdef __cplusplus
  90. } /* end of extern "C" */
  91. #endif
  92. #endif /* end of _AOT_EMIT_MEMORY_H_ */