[PATCH] D40417: [CodeGen] Print register names in lowercase in both MIR and debug output

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 10:56:38 PST 2017


MatzeB accepted this revision.
MatzeB added a comment.
This revision is now accepted and ready to land.

LGTM, thanks. I've had one comment about the lowercase printing below. It's only a very minor issue, so feel free to fix this as part of this commit or separate it out into a separate patch.



================
Comment at: lib/CodeGen/TargetRegisterInfo.cpp:97
     else if (TRI && Reg < TRI->getNumRegs())
-      OS << '%' << TRI->getName(Reg);
+      OS << '%' << StringRef(TRI->getName(Reg)).lower();
     else
----------------
This creates a temporary std::string object each time.

How about adding a `printLowerCase(const char *String, raw_ostream &OS)` function to StringExtras.h that transforms the characters to lowercase as they are printed? (May also want to move ascii_tolower() from StringRef.cpp to StringExtras.h to share code).


https://reviews.llvm.org/D40417





More information about the llvm-commits mailing list