<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div>Abandoned D60311 and opened D61499 in favour of case sensitivity.</div>
<div><br>
</div>
<div>-Markus</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Björn Pettersson A<br>
<b>Sent:</b> Thursday, May 2, 2019 3:18 PM<br>
<b>To:</b> Markus Lavin; llvm-dev@lists.llvm.org<br>
<b>Cc:</b> Björn Pettersson A<br>
<b>Subject:</b> RE: Upper case vs lower case in printed and parsed MIR</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Today the MIR parser expects lower case subregister names only.<br>
It then matches the parsed name with an (at runtime) lower casing<br>
of the subregister names stored in tablegen'd tables.<br>
<br>
Since there has been no more comments on these questions from<br>
Markus I suggest that D60311 should be abandoned, and then we should<br>
make a solution (focusing on subregister names) where the MIR parser<br>
should be case sensitive when parsing subregister names.<br>
<br>
(If we run into trouble with an unexpected amount of churn in any MIR<br>
testcases we could go for making the parser case insensitive.)<br>
<br>
Thus, the MIR parser won't be fully backwards compatible. And for example<br>
downstream repo maintainers (like myself) would need to update MIR<br>
tests to use the correct case in subregister names.<br>
<br>
/Björn<br>
<br>
> -----Original Message-----<br>
> From: llvm-dev <llvm-dev-bounces@lists.llvm.org> On Behalf Of Björn<br>
> Pettersson A via llvm-dev<br>
> Sent: den 15 april 2019 11:06<br>
> To: Markus Lavin <markus.lavin@ericsson.com>; llvm-dev@lists.llvm.org<br>
> Subject: Re: [llvm-dev] Upper case vs lower case in printed and parsed MIR<br>
> <br>
> > -----Original Message-----<br>
> > From: llvm-dev <llvm-dev-bounces@lists.llvm.org> On Behalf Of Markus<br>
> Lavin<br>
> > via llvm-dev<br>
> > Sent: den 11 april 2019 19:40<br>
> > To: llvm-dev@lists.llvm.org<br>
> > Subject: [llvm-dev] Upper case vs lower case in printed and parsed MIR<br>
> ><br>
> > I am confused about the rules for when upper and lower case letters<br>
> should<br>
> > be used in MIR.<br>
> ><br>
> > As an example our downstream target has upper case letters in its sub-<br>
> > register indices and as a result we cannot import exported MIR without<br>
> > manually 'lower casing' it first which is obviously rather annoying.<br>
> ><br>
> > Looking in <a href="https://llvm.org/docs/MIRLangRef.html">https://llvm.org/docs/MIRLangRef.html</a> it is stated that<br>
> > instruction names are case sensitive.<br>
> ><br>
> > For register names it appear that they are lower cased before printing<br>
> (see<br>
> > printReg in TargetRegisterInfo.cpp) and to match the definitions are also<br>
> > lower cased before loaded into the parser<br>
> > (see PerTargetMIParsingState::initNames2Regs in MIParser.cpp). For sub-<br>
> > register index names the latter happens but they are currently printed<br>
> with<br>
> > their original casing witch leads to our problem.<br>
> <br>
> Do we know if making register names case sensitive would be a big churn<br>
> (e.g. in .mir test cases)? I assume it would have quite big impact.<br>
> <br>
> ><br>
> > What is the right solution here, should they be lower cased when printing<br>
> > as well (as I tried to do in <a href="https://reviews.llvm.org/D60311)?">https://reviews.llvm.org/D60311)?</a><br>
> ><br>
> > To me it seems that preserving the original casing from the .td file<br>
> would<br>
> > be the most correct thing to do but then it would be inconsistent with<br>
> e.g.<br>
> > register names and would only add to the confusion it seems.<br>
> <br>
> Handling register names and subregister names consistently actually sounds<br>
> reasonable. Even though my first feeling was that it would be nice to print<br>
> the subregister names with the same casing as used in the code.<br>
> <br>
> There are however more strings so it is hard to know where to draw the line<br>
> when it comes to forcing lower case in the API, if instruction names are<br>
> still should be case sensitive. Should for example register class names<br>
> follow the same rule as for registers?<br>
> <br>
> If we want to force lower case (e.g. for register/subregister names), then<br>
> I think we want to avoid doing the lower casing at runtime and instead<br>
> tablegen should put the lower case names in the tables already from the<br>
> start.<br>
> <br>
> There is ofcourse the option of making the parsing case-insensitive (for<br>
> register names, subregister names). I guess that would make least churn,<br>
> since things would be backwards compatible with existing test cases (and<br>
> printouts could be handled just like today, even if it isn't consistent).<br>
> <br>
> <br>
> @Markus: We could even rename things in the RegisterInfo.td file for our<br>
> OOT<br>
> target to use lower case names (and by that hide the problems we currently<br>
> see).<br>
> But that would not help the community. So it would be nice to hear what<br>
> others have to say about this.<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> llvm-dev@lists.llvm.org<br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div>
</span></font></div>
</body>
</html>