MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / compileAtomicStore

Method compileAtomicStore

lib/llvm/compiler.cpp:4045–4068  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4043 }
4044 }
4045 void compileAtomicStore(unsigned MemoryIndex, uint64_t MemoryOffset,
4046 unsigned Alignment, LLVM::Type, LLVM::Type TargetType,
4047 bool Signed = false) noexcept {
4048 auto V = stackPop();
4049
4050 if (Signed) {
4051 V = Builder.createSExtOrTrunc(V, TargetType);
4052 } else {
4053 V = Builder.createZExtOrTrunc(V, TargetType);
4054 }
4055 V = switchEndian(V);
4056 auto Offset = Builder.createZExt(Stack.back(), Context.Int64Ty);
4057 if (MemoryOffset != 0) {
4058 Offset = Builder.createAdd(Offset, LLContext.getInt64(MemoryOffset));
4059 }
4060 compileAtomicCheckOffsetAlignment(Offset, TargetType);
4061 auto VPtr = Builder.createInBoundsGEP1(
4062 Context.Int8Ty, Context.getMemory(Builder, ExecCtx, MemoryIndex),
4063 Offset);
4064 auto Ptr = Builder.createBitCast(VPtr, TargetType.getPointerTo());
4065 auto Store = Builder.createStore(V, Ptr, true);
4066 Store.setAlignment(1 << Alignment);
4067 Store.setOrdering(LLVMAtomicOrderingSequentiallyConsistent);
4068 }
4069
4070 void compileAtomicRMWOp(unsigned MemoryIndex, uint64_t MemoryOffset,
4071 [[maybe_unused]] unsigned Alignment,

Callers

nothing calls this directly

Calls 13

createSExtOrTruncMethod · 0.80
createZExtOrTruncMethod · 0.80
createZExtMethod · 0.80
backMethod · 0.80
createAddMethod · 0.80
getInt64Method · 0.80
createInBoundsGEP1Method · 0.80
createBitCastMethod · 0.80
getPointerToMethod · 0.80
createStoreMethod · 0.80
setAlignmentMethod · 0.80
setOrderingMethod · 0.80

Tested by

no test coverage detected