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

Method compile

lib/llvm/compiler.cpp:592–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590 }
591
592 Expect<void>
593 compile(const AST::CodeSegment &Code,
594 std::pair<std::vector<ValType>, std::vector<ValType>> Type) noexcept {
595 auto RetBB = LLVM::BasicBlock::create(LLContext, F.Fn, "ret");
596 Type.first.clear();
597 enterBlock(RetBB, {}, {}, {}, std::move(Type));
598 EXPECTED_TRY(compile(Code.getExpr().getInstrs()));
599 assuming(ControlStack.empty());
600 compileReturn();
601
602 for (auto &[Error, BB] : TrapBB) {
603 Builder.positionAtEnd(BB);
604 updateInstrCount();
605 updateGasAtTrap();
606 auto CallTrap = Builder.createCall(
607 Context.Trap, {LLContext.getInt32(static_cast<uint32_t>(Error))});
608 CallTrap.addCallSiteAttribute(Context.NoReturn);
609 Builder.createUnreachable();
610 }
611 return {};
612 }
613
614 Expect<void> compile(AST::InstrView Instrs) noexcept {
615 auto Dispatch = [this](const AST::Instruction &Instr) -> Expect<void> {

Callers

nothing calls this directly

Calls 15

toLLVMTypeFunction · 0.85
UnexpectFunction · 0.85
ValTypeClass · 0.85
positionAtEndMethod · 0.80
createCallMethod · 0.80
getInt32Method · 0.80
addCallSiteAttributeMethod · 0.80
createUnreachableMethod · 0.80
createBrMethod · 0.80
resolveBlockTypeMethod · 0.80
getInsertBlockMethod · 0.80
createPHIMethod · 0.80

Tested by

no test coverage detected