summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-03-29 04:14:04 +0000
committerCraig Topper <craig.topper@intel.com>2018-03-29 04:14:04 +0000
commita21758fa2c38c1739bf2880e10e1ef8359196601 (patch)
tree192d20367bd43a399338dedbebf7b11513016a5b /llvm/lib
parentfa37026db3169f68cd62023af5cc871dcb7225fc (diff)
downloadbcm5719-llvm-a21758fa2c38c1739bf2880e10e1ef8359196601.tar.gz
bcm5719-llvm-a21758fa2c38c1739bf2880e10e1ef8359196601.zip
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp3
-rw-r--r--llvm/lib/Target/X86/InstPrinter/X86InstComments.cpp18
-rw-r--r--llvm/lib/Target/X86/InstPrinter/X86InstComments.h3
-rw-r--r--llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp2
4 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp b/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
index 5941e06d76c..dbc2570160e 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
+++ b/llvm/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
@@ -47,8 +47,7 @@ void X86ATTInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
// 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 72117cd231d..37bed37b099 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 @@ static unsigned getRegOperandNumElts(const MCInst *MI, unsigned ScalarSize,
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 @@ static void printMasking(raw_ostream &OS, const MCInst *MI,
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 @@ static bool printFMA3Comments(const MCInst *MI, raw_ostream &OS,
/// 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 @@ bool llvm::EmitAnyX86InstComments(const MCInst *MI, raw_ostream &OS,
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 0ba3e7401b3..40dffa5fbb8 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86InstComments.h
+++ b/llvm/lib/Target/X86/InstPrinter/X86InstComments.h
@@ -21,8 +21,7 @@ namespace llvm {
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 0e0a02b150a..0e069751821 100644
--- a/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
+++ b/llvm/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
@@ -59,7 +59,7 @@ void X86IntelInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
// 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,
OpenPOWER on IntegriCloud