| 139 | }; |
| 140 | |
| 141 | struct ConstFloatNodeType : NodeType { |
| 142 | ConstFloatNodeType(LangModule& mod, double num) |
| 143 | : NodeType(mod, "const-float", "Float Literal"), number(num) { |
| 144 | makePure(); |
| 145 | |
| 146 | setDataOutputs({{"", mod.typeFromName("float")}}); |
| 147 | } |
| 148 | |
| 149 | Result codegen( |
| 150 | size_t /*inputExecID*/, const llvm::DebugLoc& nodeLocation, |
| 151 | const std::vector<llvm::Value*>& io, llvm::BasicBlock* codegenInto, |
| 152 | const std::vector<llvm::BasicBlock*>& outputBlocks, |
| 153 | std::unordered_map<std::string, std::shared_ptr<void>>& /*compileCache*/) override { |
| 154 | assert(io.size() == 1 && codegenInto != nullptr && outputBlocks.size() == 1); |
| 155 | |
| 156 | llvm::IRBuilder<> builder(codegenInto); |
| 157 | builder.SetCurrentDebugLocation(nodeLocation); |
| 158 | |
| 159 | builder.CreateStore(llvm::ConstantFP::get(builder.getFloatTy(), number), io[0]); |
| 160 | builder.CreateBr(outputBlocks[0]); |
| 161 | |
| 162 | return {}; |
| 163 | } |
| 164 | |
| 165 | std::unique_ptr<NodeType> clone() const override { |
| 166 | return std::make_unique<ConstFloatNodeType>(*this); |
| 167 | } |
| 168 | |
| 169 | nlohmann::json toJSON() const override { return number; } |
| 170 | double number; |
| 171 | }; |
| 172 | |
| 173 | struct ConstBoolNodeType : NodeType { |
| 174 | ConstBoolNodeType(LangModule& mod, bool num) |
nothing calls this directly
no outgoing calls
no test coverage detected