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

Method compileAtomicCheckOffsetAlignment

lib/llvm/compiler.cpp:3963–3975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3961 }
3962
3963 void compileAtomicCheckOffsetAlignment(LLVM::Value Offset,
3964 LLVM::Type IntType) noexcept {
3965 const auto BitWidth = IntType.getIntegerBitWidth();
3966 auto BWMask = LLContext.getInt64((BitWidth >> 3) - 1);
3967 auto Value = Builder.createAnd(Offset, BWMask);
3968 auto OkBB = LLVM::BasicBlock::create(LLContext, F.Fn, "address_align_ok");
3969 auto IsAddressAligned = Builder.createLikely(
3970 Builder.createICmpEQ(Value, LLContext.getInt64(0)));
3971 Builder.createCondBr(IsAddressAligned, OkBB,
3972 getTrapBB(ErrCode::Value::UnalignedAtomicAccess));
3973
3974 Builder.positionAtEnd(OkBB);
3975 }
3976
3977 void compileMemoryFence() noexcept {
3978 Builder.createFence(LLVMAtomicOrderingSequentiallyConsistent);

Callers

nothing calls this directly

Calls 8

getIntegerBitWidthMethod · 0.80
getInt64Method · 0.80
createAndMethod · 0.80
createLikelyMethod · 0.80
createICmpEQMethod · 0.80
createCondBrMethod · 0.80
positionAtEndMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected