MCPcopy Create free account
hub / github.com/chigraph/chigraph / codegen

Method codegen

libchigraph/src/GraphModule.cpp:450–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448 }
449
450 Result codegen(size_t /*execInputID*/, const llvm::DebugLoc& nodeLocation,
451 const std::vector<llvm::Value*>& io, llvm::BasicBlock* codegenInto,
452 const std::vector<llvm::BasicBlock*>& outputBlocks,
453 std::unordered_map<std::string, std::shared_ptr<void>>& compileCache) override {
454 llvm::IRBuilder<> builder{codegenInto};
455 builder.SetCurrentDebugLocation(nodeLocation);
456
457 // create temp struct
458 auto tempStruct = builder.CreateAlloca(mStruct->dataType().llvmType());
459 builder.CreateStore(io[0], tempStruct);
460
461 for (auto id = 1; id < io.size(); ++id) {
462 auto ptr = builder.CreateStructGEP(
463#if LLVM_VERSION_AT_LEAST(3, 7)
464 nullptr,
465#endif
466 tempStruct, id - 1);
467 std::string s = stringifyLLVMType(ptr->getType());
468
469 auto val = builder.CreateLoad(ptr);
470 builder.CreateStore(val, io[id]);
471 }
472
473 builder.CreateBr(outputBlocks[0]);
474
475 return {};
476 }
477
478 nlohmann::json toJSON() const override { return {}; }
479 std::unique_ptr<NodeType> clone() const override {

Callers

nothing calls this directly

Calls 3

stringifyLLVMTypeFunction · 0.85
llvmTypeMethod · 0.80
dataTypeMethod · 0.80

Tested by

no test coverage detected