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

Method codegen

libchigraph/src/LangModule.cpp:316–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314 }
315
316 Result codegen(
317 size_t /*execInputID*/, const llvm::DebugLoc& nodeLocation,
318 const std::vector<llvm::Value*>& io, llvm::BasicBlock* codegenInto,
319 const std::vector<llvm::BasicBlock*>& outputBlocks,
320 std::unordered_map<std::string, std::shared_ptr<void>>& /*compileCache*/) override {
321 assert(io.size() == 2 && codegenInto != nullptr && outputBlocks.size() == 1);
322
323 llvm::IRBuilder<> builder(codegenInto);
324 builder.SetCurrentDebugLocation(nodeLocation);
325
326 auto casted =
327 builder.CreateCast(llvm::Instruction::CastOps::SIToFP, io[0], builder.getFloatTy());
328 builder.CreateStore(casted, io[1]);
329
330 builder.CreateBr(outputBlocks[0]);
331
332 return {};
333 }
334
335 std::unique_ptr<NodeType> clone() const override {
336 return std::make_unique<IntToFloatNodeType>(*this);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected