| 182 | } |
| 183 | |
| 184 | std::string finalize_code() const override |
| 185 | { |
| 186 | std::string code = finalize_preamble(); |
| 187 | |
| 188 | // Add sampler definitions |
| 189 | for (const sampler &info : _module.samplers) |
| 190 | code += _blocks.at(info.id); |
| 191 | |
| 192 | // Add storage definitions |
| 193 | for (const storage &info : _module.storages) |
| 194 | code += _blocks.at(info.id); |
| 195 | |
| 196 | // Add global definitions (struct types, global variables, ...) |
| 197 | code += _blocks.at(0); |
| 198 | |
| 199 | // Add function definitions |
| 200 | for (const std::unique_ptr<function> &func : _functions) |
| 201 | { |
| 202 | assert(func->unique_name[0] == 'F' || func->unique_name[0] == 'E'); |
| 203 | const bool is_entry_point = func->unique_name[0] == 'E'; |
| 204 | if (is_entry_point) |
| 205 | code += "#ifdef " + func->unique_name + '\n'; |
| 206 | |
| 207 | code += _blocks.at(func->id); |
| 208 | |
| 209 | if (is_entry_point) |
| 210 | code += "#endif\n"; |
| 211 | } |
| 212 | |
| 213 | return code; |
| 214 | } |
| 215 | bool assemble_code_for_entry_point(const std::string &entry_point_name, std::string &code, std::string &, std::string &) const override |
| 216 | { |
| 217 | const function *const entry_point = find_function(entry_point_name); |
no test coverage detected