The function below has a non-constant reference as that is required by LLVM's TableGenMain. NOLINTNEXTLINE
| 325 | // TableGenMain. |
| 326 | // NOLINTNEXTLINE |
| 327 | static bool OperatorWritersMain(raw_ostream &os, RecordKeeper &records) { |
| 328 | emitSourceFileHeader("MLIR TFLite FlatBuffer Builders", os); |
| 329 | |
| 330 | // Retrieve all the definitions derived from TFL_Op and sort by record name. |
| 331 | std::vector<Record *> defs = records.getAllDerivedDefinitions("TFL_Op"); |
| 332 | llvm::sort(defs, LessRecord()); |
| 333 | |
| 334 | for (const auto *def : defs) { |
| 335 | // TFLite ops in the .td file are expected to follow the naming convention: |
| 336 | // TFL_<OpName>Op. |
| 337 | // The generated TFLite op C++ class should be TFL::<OpName>Op. |
| 338 | // The generated operator's options should be tflite::<OpName>Options. |
| 339 | // The option builder should be Create<OpName>Options. |
| 340 | if (!def->getName().startswith("TFL_")) |
| 341 | PrintFatalError(def->getLoc(), |
| 342 | "unexpected op name format: 'TFL_' prefix missing"); |
| 343 | if (!def->getName().endswith("Op")) |
| 344 | PrintFatalError(def->getLoc(), |
| 345 | "unexpected op name format: 'Op' suffix missing"); |
| 346 | } |
| 347 | |
| 348 | EmitOptionBuilders(records, defs, &os); |
| 349 | os << "\n\n"; |
| 350 | EmitOperatorBuilders(defs, &os); |
| 351 | os << "\n\n"; |
| 352 | EmitGetBuiltinOpCode(defs, &os); |
| 353 | os << "\n\n"; |
| 354 | EmitBuildOperator(defs, &os); |
| 355 | os << "\n\n"; |
| 356 | EmitBuiltinOptionsToAttributes(records, defs, &os); |
| 357 | |
| 358 | return false; |
| 359 | } |
| 360 | |
| 361 | static void GenOperandResultVerifier(raw_ostream &os, |
| 362 | llvm::ArrayRef<llvm::Init *> values, |
nothing calls this directly
no test coverage detected