[llvm] r315399 - [X86] Remove temporary std::string creation from shuffle comment printing. We can just write directly to the raw_ostream.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 10 17:46:09 PDT 2017
Author: ctopper
Date: Tue Oct 10 17:46:09 2017
New Revision: 315399
URL: http://llvm.org/viewvc/llvm-project?rev=315399&view=rev
Log:
[X86] Remove temporary std::string creation from shuffle comment printing. We can just write directly to the raw_ostream.
Modified:
llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp
Modified: llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp?rev=315399&r1=315398&r2=315399&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp (original)
+++ llvm/trunk/lib/Target/X86/InstPrinter/X86InstComments.cpp Tue Oct 10 17:46:09 2017
@@ -205,16 +205,14 @@ static MVT getZeroExtensionResultType(co
}
/// Wraps the destination register name with AVX512 mask/maskz filtering.
-static std::string getMaskName(const MCInst *MI, const char *DestName,
- const char *(*getRegName)(unsigned)) {
- std::string OpMaskName(DestName);
-
+static void printMasking(raw_ostream &OS, const MCInst *MI,
+ const char *(*getRegName)(unsigned)) {
bool MaskWithZero = false;
const char *MaskRegName = nullptr;
switch (MI->getOpcode()) {
default:
- return OpMaskName;
+ return;
CASE_MASKZ_MOVDUP(MOVDDUP, m)
CASE_MASKZ_MOVDUP(MOVDDUP, r)
CASE_MASKZ_MOVDUP(MOVSHDUP, m)
@@ -399,15 +397,11 @@ static std::string getMaskName(const MCI
}
// MASK: zmmX {%kY}
- OpMaskName += " {%";
- OpMaskName += MaskRegName;
- OpMaskName += "}";
+ OS << " {%" << MaskRegName << "}";
// MASKZ: zmmX {%kY} {z}
if (MaskWithZero)
- OpMaskName += " {z}";
-
- return OpMaskName;
+ OS << " {z}";
}
//===----------------------------------------------------------------------===//
@@ -1160,7 +1154,13 @@ bool llvm::EmitAnyX86InstComments(const
return false;
if (!DestName) DestName = Src1Name;
- OS << (DestName ? getMaskName(MI, DestName, getRegName) : "mem") << " = ";
+ if (DestName) {
+ OS << DestName;
+ printMasking(OS, MI, getRegName);
+ } else
+ OS << "mem";
+
+ OS << " = ";
// If the two sources are the same, canonicalize the input elements to be
// from the first src so that we get larger element spans.
More information about the llvm-commits
mailing list