MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / OperatorWritersMain

Function OperatorWritersMain

tensorflow/compiler/mlir/lite/converter_gen.cc:327–359  ·  view source on GitHub ↗

The function below has a non-constant reference as that is required by LLVM's TableGenMain. NOLINTNEXTLINE

Source from the content-addressed store, hash-verified

325// TableGenMain.
326// NOLINTNEXTLINE
327static 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
361static void GenOperandResultVerifier(raw_ostream &os,
362 llvm::ArrayRef<llvm::Init *> values,

Callers

nothing calls this directly

Calls 7

sortFunction · 0.85
EmitOptionBuildersFunction · 0.70
EmitOperatorBuildersFunction · 0.70
EmitGetBuiltinOpCodeFunction · 0.70
EmitBuildOperatorFunction · 0.70
getNameMethod · 0.45

Tested by

no test coverage detected