summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-28 20:42:31 +0000
committerChris Lattner <sabre@nondot.org>2010-08-28 20:42:31 +0000
commit7a05e6dca2c87f9b5294acec50ac59db9a97acb7 (patch)
treed55ea041c73d8de7abdfae62aed5e7d1d9d91563 /llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
parent112b6ee3f2a476539ecf6cc87bed8220dbf7917e (diff)
downloadbcm5719-llvm-7a05e6dca2c87f9b5294acec50ac59db9a97acb7.tar.gz
bcm5719-llvm-7a05e6dca2c87f9b5294acec50ac59db9a97acb7.zip
I have manually decoded the imm field of an insertps one too many
times. This patch causes llc and llvm-mc (which both default to verbose-asm) to print out comments after a few common shuffle instructions which indicates the shuffle mask, e.g.: insertps $113, %xmm3, %xmm0 ## xmm0 = zero,xmm0[1,2],xmm3[1] unpcklps %xmm1, %xmm0 ## xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1] pshufd $1, %xmm1, %xmm1 ## xmm1 = xmm1[1,0,0,0] This is carefully factored to keep the information extraction (of the shuffle mask) separate from the printing logic. I plan to move the extraction part out somewhere else at some point for other parts of the x86 backend that want to introspect on the behavior of shuffles. llvm-svn: 112387
Diffstat (limited to 'llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp')
-rw-r--r--llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
index f2cdb5ba55e..554b96c96e0 100644
--- a/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
+++ b/llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp
@@ -14,6 +14,7 @@
#define DEBUG_TYPE "asm-printer"
#include "X86ATTInstPrinter.h"
+#include "X86InstComments.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
@@ -31,6 +32,10 @@ using namespace llvm;
void X86ATTInstPrinter::printInst(const MCInst *MI, raw_ostream &OS) {
printInstruction(MI, OS);
+
+ // If verbose assembly is enabled, we can print some informative comments.
+ if (CommentStream)
+ EmitAnyX86InstComments(MI, *CommentStream, getRegisterName);
}
StringRef X86ATTInstPrinter::getOpcodeName(unsigned Opcode) const {
return getInstructionName(Opcode);
OpenPOWER on IntegriCloud