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

Method compileCallOp

lib/llvm/compiler.cpp:4256–4281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4254
4255private:
4256 void compileCallOp(const unsigned int FuncIndex) noexcept {
4257 const auto &FuncType =
4258 Context.CompositeTypes[std::get<0>(Context.Functions[FuncIndex])]
4259 ->getFuncType();
4260 const auto &Function = std::get<1>(Context.Functions[FuncIndex]);
4261 const auto &ParamTypes = FuncType.getParamTypes();
4262
4263 std::vector<LLVM::Value> Args(ParamTypes.size() + 1);
4264 Args[0] = F.Fn.getFirstParam();
4265 for (size_t I = 0; I < ParamTypes.size(); ++I) {
4266 const size_t J = ParamTypes.size() - 1 - I;
4267 Args[J + 1] = stackPop();
4268 }
4269
4270 auto Ret = Builder.createCall(Function, Args);
4271 auto Ty = Ret.getType();
4272 if (Ty.isVoidTy()) {
4273 // nothing to do
4274 } else if (Ty.isStructTy()) {
4275 for (auto Val : unpackStruct(Builder, Ret)) {
4276 stackPush(Val);
4277 }
4278 } else {
4279 stackPush(Ret);
4280 }
4281 }
4282
4283 void compileIndirectCallOp(const uint32_t TableIndex,
4284 const uint32_t FuncTypeIndex) noexcept {

Callers

nothing calls this directly

Calls 8

unpackStructFunction · 0.85
getParamTypesMethod · 0.80
getFirstParamMethod · 0.80
createCallMethod · 0.80
isVoidTyMethod · 0.80
isStructTyMethod · 0.80
sizeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected