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

Method codegen

libchigraph/src/GraphModule.cpp:497–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495 }
496
497 Result codegen(size_t /*execInputID*/, const llvm::DebugLoc& nodeLocation,
498 const std::vector<llvm::Value*>& io, llvm::BasicBlock* codegenInto,
499 const std::vector<llvm::BasicBlock*>& outputBlocks,
500 std::unordered_map<std::string, std::shared_ptr<void>>& compileCache) override {
501 llvm::IRBuilder<> builder{codegenInto};
502 builder.SetCurrentDebugLocation(nodeLocation);
503
504 std::shared_ptr<void>& local = compileCache[mDataType.name];
505
506 if (local == nullptr) {
507 // create a new one!
508 local = std::make_shared<llvm::Value*>(builder.CreateAlloca(mDataType.type.llvmType()));
509 }
510
511 // set the value!
512 builder.CreateStore(io[0], *static_cast<llvm::Value**>(local.get()));
513
514 builder.CreateBr(outputBlocks[0]);
515
516 return {};
517 }
518
519 nlohmann::json toJSON() const override { return mDataType.type.qualifiedName(); }
520 std::unique_ptr<NodeType> clone() const override {

Callers

nothing calls this directly

Calls 2

llvmTypeMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected