[llvm-dev] Upper case vs lower case in printed and parsed MIR

Markus Lavin via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 11 10:40:03 PDT 2019

I am confused about the rules for when upper and lower case letters should be used in MIR.

As an example our downstream target has upper case letters in its sub-register indices and as a result we cannot import exported MIR without manually 'lower casing' it first which is obviously rather annoying.

Looking in https://llvm.org/docs/MIRLangRef.html it is stated that instruction names are case sensitive.

For register names it appear that they are lower cased before printing (see printReg in TargetRegisterInfo.cpp) and to match the definitions are also lower cased before loaded into the parser (see PerTargetMIParsingState::initNames2Regs in MIParser.cpp). For sub-register index names the latter happens but they are currently printed with their original casing witch leads to our problem.

What is the right solution here, should they be lower cased when printing as well (as I tried to do in https://reviews.llvm.org/D60311)?

To me it seems that preserving the original casing from the .td file would be the most correct thing to do but then it would be inconsistent with e.g. register names and would only add to the confusion it seems.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190411/b5aa817e/attachment.html>

More information about the llvm-dev mailing list