[X86] Don't pass getRegisterName from the InstPrinters into EmitAnyX86InstComments. Just always use the function from the ATTPrinter. NFC

The IntelPrinter and the ATTPrinter produce the same strings for the same input. We already use the ATTPrinter explicitly in several other places.

llvm-svn: 328762
diff --git a/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp b/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
index 5941e06..dbc2570 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
+++ b/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
@@ -47,8 +47,7 @@
 
   // If verbose assembly is enabled, we can print some informative comments.
   if (CommentStream)
-    HasCustomInstComment =
-        EmitAnyX86InstComments(MI, *CommentStream, MII, getRegisterName);
+    HasCustomInstComment = EmitAnyX86InstComments(MI, *CommentStream, MII);
 
   unsigned Flags = MI->getFlags();
   if ((TSFlags & X86II::LOCK) || (Flags & X86::IP_HAS_LOCK))
diff --git a/llvm/lib/Target/X86/InstPrinter/X86InstComments.cpp b/llvm/lib/Target/X86/InstPrinter/X86InstComments.cpp
index 72117cd..37bed37 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86InstComments.cpp
+++ b/llvm/lib/Target/X86/InstPrinter/X86InstComments.cpp
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "X86InstComments.h"
+#include "X86ATTInstPrinter.h"
 #include "MCTargetDesc/X86BaseInfo.h"
 #include "MCTargetDesc/X86MCTargetDesc.h"
 #include "Utils/X86ShuffleDecode.h"
@@ -218,10 +219,13 @@
   return getVectorRegSize(OpReg) / ScalarSize;
 }
 
+static const char *getRegName(unsigned Reg) {
+  return X86ATTInstPrinter::getRegisterName(Reg);
+}
+
 /// Wraps the destination register name with AVX512 mask/maskz filtering.
 static void printMasking(raw_ostream &OS, const MCInst *MI,
-                         const MCInstrInfo &MCII,
-                         const char *(*getRegName)(unsigned)) {
+                         const MCInstrInfo &MCII) {
   const MCInstrDesc &Desc = MCII.get(MI->getOpcode());
   uint64_t TSFlags = Desc.TSFlags;
 
@@ -244,8 +248,7 @@
     OS << " {z}";
 }
 
-static bool printFMA3Comments(const MCInst *MI, raw_ostream &OS,
-                              const char *(*getRegName)(unsigned)) {
+static bool printFMA3Comments(const MCInst *MI, raw_ostream &OS) {
   const char *Mul1Name = nullptr, *Mul2Name = nullptr, *AccName = nullptr;
   unsigned NumOperands = MI->getNumOperands();
   bool RegForm = false;
@@ -495,15 +498,14 @@
 /// newline terminated strings to the specified string if desired.  This
 /// information is shown in disassembly dumps when verbose assembly is enabled.
 bool llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
-                                  const MCInstrInfo &MCII,
-                                  const char *(*getRegName)(unsigned)) {
+                                  const MCInstrInfo &MCII) {
   // If this is a shuffle operation, the switch should fill in this state.
   SmallVector<int, 8> ShuffleMask;
   const char *DestName = nullptr, *Src1Name = nullptr, *Src2Name = nullptr;
   unsigned NumOperands = MI->getNumOperands();
   bool RegForm = false;
 
-  if (printFMA3Comments(MI, OS, getRegName))
+  if (printFMA3Comments(MI, OS))
     return true;
 
   switch (MI->getOpcode()) {
@@ -1254,7 +1256,7 @@
   if (!DestName) DestName = Src1Name;
   if (DestName) {
     OS << DestName;
-    printMasking(OS, MI, MCII, getRegName);
+    printMasking(OS, MI, MCII);
   } else
     OS << "mem";
 
diff --git a/llvm/lib/Target/X86/InstPrinter/X86InstComments.h b/llvm/lib/Target/X86/InstPrinter/X86InstComments.h
index 0ba3e74..40dffa5 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86InstComments.h
+++ b/llvm/lib/Target/X86/InstPrinter/X86InstComments.h
@@ -21,8 +21,7 @@
   class MCInstrInfo;
   class raw_ostream;
   bool EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
-                              const MCInstrInfo &MCII,
-                              const char *(*getRegName)(unsigned));
+                              const MCInstrInfo &MCII);
 }
 
 #endif
diff --git a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
index 0e0a02b..0e06975 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
+++ b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
@@ -59,7 +59,7 @@
 
   // If verbose assembly is enabled, we can print some informative comments.
   if (CommentStream)
-    EmitAnyX86InstComments(MI, *CommentStream, MII, getRegisterName);
+    EmitAnyX86InstComments(MI, *CommentStream, MII);
 }
 
 void X86IntelInstPrinter::printSSEAVXCC(const MCInst *MI, unsigned Op,