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

Method compileLoadOp

lib/llvm/compiler.cpp:4648–4664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4646 }
4647
4648 void compileLoadOp(unsigned MemoryIndex, uint64_t Offset, unsigned Alignment,
4649 LLVM::Type LoadTy) noexcept {
4650 if constexpr (kForceUnalignment) {
4651 Alignment = 0;
4652 }
4653 auto Off = Builder.createZExt(stackPop(), Context.Int64Ty);
4654 if (Offset != 0) {
4655 Off = Builder.createAdd(Off, LLContext.getInt64(Offset));
4656 }
4657
4658 auto VPtr = Builder.createInBoundsGEP1(
4659 Context.Int8Ty, Context.getMemory(Builder, ExecCtx, MemoryIndex), Off);
4660 auto Ptr = Builder.createBitCast(VPtr, LoadTy.getPointerTo());
4661 auto LoadInst = Builder.createLoad(LoadTy, Ptr, true);
4662 LoadInst.setAlignment(1 << Alignment);
4663 stackPush(switchEndian(LoadInst));
4664 }
4665 void compileLoadOp(unsigned MemoryIndex, uint64_t Offset, unsigned Alignment,
4666 LLVM::Type LoadTy, LLVM::Type ExtendTy,
4667 bool Signed) noexcept {

Callers

nothing calls this directly

Calls 11

createZExtMethod · 0.80
createAddMethod · 0.80
getInt64Method · 0.80
createInBoundsGEP1Method · 0.80
createBitCastMethod · 0.80
getPointerToMethod · 0.80
createLoadMethod · 0.80
setAlignmentMethod · 0.80
backMethod · 0.80
createSExtMethod · 0.80
getMemoryMethod · 0.45

Tested by

no test coverage detected