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

Method compileStoreOp

lib/llvm/compiler.cpp:4706–4730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4704 Context.Int64x2Ty);
4705 }
4706 void compileStoreOp(uint32_t MemoryIndex, uint64_t Offset, uint32_t Alignment,
4707 LLVM::Type LoadTy, bool Trunc = false,
4708 bool BitCast = false) noexcept {
4709 if constexpr (kForceUnalignment) {
4710 Alignment = 0;
4711 }
4712 auto V = stackPop();
4713 auto Off = Builder.createZExt(stackPop(), Context.Int64Ty);
4714 if (Offset != 0) {
4715 Off = Builder.createAdd(Off, LLContext.getInt64(Offset));
4716 }
4717
4718 if (Trunc) {
4719 V = Builder.createTrunc(V, LoadTy);
4720 }
4721 if (BitCast) {
4722 V = Builder.createBitCast(V, LoadTy);
4723 }
4724 V = switchEndian(V);
4725 auto VPtr = Builder.createInBoundsGEP1(
4726 Context.Int8Ty, Context.getMemory(Builder, ExecCtx, MemoryIndex), Off);
4727 auto Ptr = Builder.createBitCast(VPtr, LoadTy.getPointerTo());
4728 auto StoreInst = Builder.createStore(V, Ptr, true);
4729 StoreInst.setAlignment(1 << Alignment);
4730 }
4731 void compileStoreLaneOp(uint32_t MemoryIndex, uint64_t Offset,
4732 uint32_t Alignment, uint8_t Index, LLVM::Type LoadTy,
4733 LLVM::Type VectorTy) noexcept {

Callers

nothing calls this directly

Calls 10

createZExtMethod · 0.80
createAddMethod · 0.80
getInt64Method · 0.80
createTruncMethod · 0.80
createBitCastMethod · 0.80
createInBoundsGEP1Method · 0.80
getPointerToMethod · 0.80
createStoreMethod · 0.80
setAlignmentMethod · 0.80
getMemoryMethod · 0.45

Tested by

no test coverage detected