<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi,</div><div><br><blockquote type="cite">It doesn't really require a spelling because it's not something that<br>the user can type out directly. If you went with two attributes<br>instead of one, then you don't require a spelling for it. You could<br>get away with something like:<br><br>def LoopHint : Attr {<br> let Args = [IntArgument<"type">,<br>                 ExprArgument<"value", 1>];<br>let AdditionalMembers = [{<br>   // Your static methods<br> }];<br>}<br><br>def VectorizeLoopHint : LoopHint;<br>def InterleaveLoopHint : LoopHint;<br><br>Pretty sure that would work for you. You definitely do not need a<br>spelling to get the class generated by tablegen (there are several<br>other attributes which are implicit-only and have no spelling).</blockquote></div><div><br></div><div>Something may be missing here. It fails to compile the td file:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><b>Basic/Attr.td:1763:25: </b><span style="color: #c33720"><b>error: </b></span><b>Couldn't find class 'LoopHint'</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">def VectorizeLoopHint : LoopHint;</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Changing def LoopHint for class LoopHint also fails</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><div style="margin: 0px;"><b>Basic/Attr.td:1763:1: </b><span style="color: rgb(195, 55, 32);"><b>error: </b></span><b>Record `InterleaveLoopHint', field `Spellings' does not have a list initializer!</b></div><div style="margin: 0px;">def InterleaveLoopHint : LoopHint;</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Adding an empty spelling `let Spellings = []’ allows it to get through the td file but it does not generate a LoopHint class causing the compilation of the generated code to fail.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><div style="margin: 0px;"><div style="margin: 0px;"><b>AST/Attrs.inc:2500:39: </b><span style="color: #c33720"><b>error: </b></span><b>expected class</b></div><div style="margin: 0px;"><b>      name</b></div><div style="margin: 0px;">class InterleaveLoopHintAttr : public LoopHint {</div></div></div><div><br></div><div>Perhaps I’m doing something wrong? But…</div><div><br></div><div>The pretty printing function is generated to blank anyway without a Spelling because the spelling is required by tablegen to generate the body of the function.</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">static void</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">writePrettyPrintFunction(Record &R,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">                         const std::vector<std::unique_ptr<Argument>> &Args,</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">                         raw_ostream &OS) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  std::vector<FlattenedSpelling> Spellings = GetFlattenedSpellings(R);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  OS << "void " << R.getName() << "Attr::printPretty("</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    << "raw_ostream &OS, const PrintingPolicy &Policy) const {\n";</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  if (Spellings.empty()) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    OS << "}\n\n";</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">    return;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">  }</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">…</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">I’m pretty sure a spelling is required unless you are providing the base class outside the td file. I’m looking at modifying the way pretty printing works now to generate a printer that prints the pragma. But it seems bad to specialize the code that generates the pretty printer for printing loop pragmas and so it will still be necessary to make some kind of a call into the LoopHintAttr to print the pragma.</div><div><br></div><div>Tyler</div></body></html>