tensorflow/compiler/mlir/tensorflow/translate/derived_attr_populator_gen.cc
// The function below has a non-constant reference as that is required by LLVM's
// TableGenMain.
// NOLINTNEXTLINE
The function below has a non-constant reference as that is required by LLVM's
TableGenMain.
NOLINTNEXTLINE
The function below has a non - constant reference as that is required by LLVM ' s TableGenMain . NOLINTNEXTLINE
static bool DerivedAttrWritersMain(raw_ostream &os, RecordKeeper &records) {
  emitSourceFileHeader("MLIR Derived TensorFlow Attributes Populators", os);
  std::vector<Record *> defs = records.getAllDerivedDefinitions("TF_Op");
  llvm::sort(defs, LessRecord());
  std::vector<Operator> ops;
  ops.reserve(defs.size());
  for (const auto *def : defs) {
    ops.emplace_back(Operator(def));
    const Operator &op = ops.back();
    if (op.getDialectName() != "tf")
      PrintFatalError(op.getLoc(),
                      "unexpected op name format: 'TF_' prefix missing");
    if (!op.getCppClassName().endswith("Op"))
      PrintFatalError(op.getLoc(),
                      "unexpected op name format: 'Op' suffix missing");
  }
  EmitOpAttrPopulators(ops, &os);
  EmitInstAttrPopulator(ops, &os);
  EmitOpAttrNameCollector(ops, &os);
  EmitInstAttrNameCollector(ops, &os);
  return false;
}
static bool DerivedAttrWritersMain ( raw_ostream & os , RecordKeeper & records ) { emitSourceFileHeader ( " " , os ) ; std :: vector < Record * > defs = records . getAllDerivedDefinitions ( " " ) ; llvm :: sort ( defs , LessRecord ( ) ) ; std :: vector < Operator > ops ; ops . reserve ( defs . size ( ) ) ; for ( const auto * def : defs ) { ops . emplace_back ( Operator ( def ) ) ; const Operator & op = ops . back ( ) ; if ( op . getDialectName ( ) != " " ) PrintFatalError ( op . getLoc ( ) , " " ) ; if ( ! op . getCppClassName ( ) . endswith ( " " ) ) PrintFatalError ( op . getLoc ( ) , " " ) ; } EmitOpAttrPopulators ( ops , & os ) ; EmitInstAttrPopulator ( ops , & os ) ; EmitOpAttrNameCollector ( ops , & os ) ; EmitInstAttrNameCollector ( ops , & os ) ; return false ; }
The function below has a non-constant reference as that is required by LLVM's
TableGenMain.
The function below has a non - constant reference as that is required by LLVM ' s TableGenMain .
// Retrieve all the definitions derived from TF_Op and sort by record name. // Wrap TensorFlow op definitions into tblgen Operator wrapper and verify // them.