Lines Matching defs:os

56 void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
61 os << "\n_" << first << rest << "_\n\n";
71 void mlir::tblgen::emitDescription(StringRef description, raw_ostream &os) {
72 raw_indented_ostream ros(os);
80 raw_ostream &os, StringRef prefix) {
83 raw_indented_ostream ros(os);
91 static void emitIfNotEmpty(StringRef str, raw_ostream &os) {
93 emitDescription(str, os);
94 os << "\n";
100 static void emitNamedConstraint(const T &it, raw_ostream &os) {
102 os << "| `" << it.name << "`";
104 os << "&laquo;unnamed&raquo;";
105 os << " | " << it.constraint.getSummary() << "\n";
114 raw_ostream &os) {
115 os << "\nSyntax:\n\n```\noperation ::= `" << opName << "` ";
120 os << split.first.trim() << "\n";
125 os.indent(indent) << formatChunk << "\n";
127 os << "```\n\n";
136 static void emitOpTraitsDoc(const Operator &op, raw_ostream &os) {
158 raw_string_ostream os(effectStr);
159 os << effectName << "{";
161 interleaveComma(list, os, [&](const Record *rec) {
165 os << effect << " on " << rec->getValueAsString("resource");
167 os << "}";
178 interleaveComma(traits, os << "\nTraits: ");
179 os << "\n";
182 interleaveComma(interfaces, os << "\nInterfaces: ");
183 os << "\n";
186 interleaveComma(effects, os << "\nEffects: ");
187 os << "\n";
198 static void emitOpDoc(const Operator &op, raw_ostream &os) {
202 os << formatv("### `{0}` ({1})\n", op.getOperationName(), className);
206 emitSummary(op.getSummary(), os);
209 os);
211 mlir::tblgen::emitDescription(op.getDescription(), os);
213 emitOpTraitsDoc(op, os);
217 os << "\n#### Attributes:\n\n";
221 os << "<table>\n";
223 os << "<tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr>\n";
227 os << "<tr>";
228 os << "<td><code>" << it.name << "</code></td><td>" << storageType
235 os << "<details>" << "<summary>" << it.attr.getSummary() << "</summary>"
240 os << it.attr.getSummary();
242 os << "</td></tr>\n";
244 os << "</table>\n";
249 os << "\n#### Operands:\n\n";
250 os << "| Operand | Description |\n"
253 emitNamedConstraint(it, os);
258 os << "\n#### Results:\n\n";
259 os << "| Result | Description |\n"
262 emitNamedConstraint(it, os);
267 os << "\n#### Successors:\n\n";
268 os << "| Successor | Description |\n"
271 emitNamedConstraint(it, os);
274 os << "\n";
277 static void emitSourceLink(StringRef inputFilename, raw_ostream &os) {
284 os << "[source](https://github.com/llvm/llvm-project/blob/main/"
288 static void emitOpDoc(const RecordKeeper &records, raw_ostream &os) {
291 os << "<!-- Autogenerated by mlir-tblgen; don't manually edit -->\n";
292 emitSourceLink(records.getInputFilename(), os);
294 emitOpDoc(Operator(opDef), os);
301 static void emitAttrDoc(const Attribute &attr, raw_ostream &os) {
302 os << "### " << attr.getSummary() << "\n\n";
303 emitDescription(attr.getDescription(), os);
304 os << "\n\n";
311 static void emitTypeDoc(const Type &type, raw_ostream &os) {
312 os << "### " << type.getSummary() << "\n\n";
313 emitDescription(type.getDescription(), os);
314 os << "\n\n";
322 raw_ostream &os) {
326 os << "\nSyntax: `" << prefix << def.getDialect().getName() << "."
331 os << "\nSyntax:\n\n```\n"
336 os << " " << param.getSyntax();
338 os << ",";
339 os << " # " << param.getName() << "\n";
341 os << ">\n```\n";
344 static void emitAttrOrTypeDefDoc(const AttrOrTypeDef &def, raw_ostream &os) {
345 os << formatv("### {0}\n", def.getCppClassName());
349 os << "\n" << def.getSummary() << "\n";
353 emitAttrOrTypeDefAssemblyFormat(def, os);
357 os << "\n";
358 mlir::tblgen::emitDescription(def.getDescription(), os);
364 os << "\n#### Parameters:\n\n";
365 os << "| Parameter | C++ type | Description |\n"
369 os << "| " << it.getName() << " | `" << it.getCppType() << "` | "
374 os << "\n";
377 static void emitAttrOrTypeDefDoc(const RecordKeeper &records, raw_ostream &os,
381 os << "<!-- Autogenerated by mlir-tblgen; don't manually edit -->\n";
383 emitAttrOrTypeDefDoc(AttrOrTypeDef(def), os);
390 static void emitEnumDoc(const EnumAttr &def, raw_ostream &os) {
391 os << formatv("### {0}\n", def.getEnumClassName());
395 os << "\n" << def.getSummary() << "\n";
399 os << "\n#### Cases:\n\n";
400 os << "| Symbol | Value | String |\n"
403 os << "| " << it.getSymbol() << " | `" << it.getValue() << "` | "
407 os << "\n";
410 static void emitEnumDoc(const RecordKeeper &records, raw_ostream &os) {
411 os << "<!-- Autogenerated by mlir-tblgen; don't manually edit -->\n";
413 emitEnumDoc(EnumAttr(def), os);
433 static void maybeNest(bool nest, llvm::function_ref<void(raw_ostream &os)> fn,
434 raw_ostream &os) {
440 os << "#";
441 os << x << "\n";
448 ArrayRef<EnumAttr> enums, raw_ostream &os) {
450 os << "## Operations\n\n";
451 emitSourceLink(inputFilename, os);
456 [&](raw_ostream &os) {
458 os << "## " << StringRef(grouping.summary).trim() << "\n\n";
459 emitDescription(grouping.description, os);
460 os << "\n\n";
463 emitOpDoc(op, os);
466 os);
471 os << "## Attribute constraints\n\n";
473 emitAttrDoc(attr, os);
477 os << "## Attributes\n\n";
479 emitAttrOrTypeDefDoc(def, os);
484 os << "## Type constraints\n\n";
486 emitTypeDoc(type, os);
490 os << "## Types\n\n";
492 emitAttrOrTypeDefDoc(def, os);
496 os << "## Enums\n\n";
498 emitEnumDoc(def, os);
506 ArrayRef<EnumAttr> enums, raw_ostream &os) {
507 os << "# '" << dialect.getName() << "' Dialect\n\n";
508 emitIfNotEmpty(dialect.getSummary(), os);
509 emitIfNotEmpty(dialect.getDescription(), os);
514 os << "[TOC]\n\n";
517 os);
520 static bool emitDialectDoc(const RecordKeeper &records, raw_ostream &os) {
599 os << "<!-- Autogenerated by mlir-tblgen; don't manually edit -->\n";
602 dialectEnums, os);
613 [](const RecordKeeper &records, raw_ostream &os) {
614 emitAttrOrTypeDefDoc(records, os, "AttrDef");
620 [](const RecordKeeper &records, raw_ostream &os) {
621 emitOpDoc(records, os);
627 [](const RecordKeeper &records, raw_ostream &os) {
628 emitAttrOrTypeDefDoc(records, os, "TypeDef");
634 [](const RecordKeeper &records, raw_ostream &os) {
635 emitEnumDoc(records, os);
641 [](const RecordKeeper &records, raw_ostream &os) {
642 return emitDialectDoc(records, os);