[llvm] r242886 - [X86] Add .intel_syntax noprefix directive to intel-syntax x86 asm output
Michael Kuperstein
michael.m.kuperstein at intel.com
Wed Jul 22 03:49:44 PDT 2015
Author: mkuper
Date: Wed Jul 22 05:49:44 2015
New Revision: 242886
URL: http://llvm.org/viewvc/llvm-project?rev=242886&view=rev
Log:
[X86] Add .intel_syntax noprefix directive to intel-syntax x86 asm output
Patch by: michael.zuckerman at intel.com
Differential Revision: http://reviews.llvm.org/D11223
Added:
llvm/trunk/test/MC/X86/intel-syntax-print.ll
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/lib/MC/MCStreamer.cpp
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=242886&r1=242885&r2=242886&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Jul 22 05:49:44 2015
@@ -682,6 +682,8 @@ public:
virtual void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except);
virtual void EmitWinEHHandlerData();
+ virtual void EmitSyntaxDirective();
+
/// \brief Emit the given \p Instruction into the current section.
virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI);
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=242886&r1=242885&r2=242886&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Wed Jul 22 05:49:44 2015
@@ -78,6 +78,9 @@ public:
}
EmitCommentsAndEOL();
}
+
+ virtual void EmitSyntaxDirective();
+
void EmitCommentsAndEOL();
/// isVerboseAsm - Return true if this streamer supports verbose assembly at
@@ -480,6 +483,14 @@ void MCAsmStreamer::EmitSymbolDesc(MCSym
EmitEOL();
}
+void MCAsmStreamer::EmitSyntaxDirective() {
+ if (MAI->getAssemblerDialect() == 1)
+ OS << "\t.intel_syntax noprefix\n";
+ // FIXME: Currently emit unprefix'ed registers.
+ // The intel_syntax directive has one optional argument
+ // with may have a value of prefix or noprefix.
+}
+
void MCAsmStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) {
OS << "\t.def\t ";
Symbol->print(OS, MAI);
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=242886&r1=242885&r2=242886&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Wed Jul 22 05:49:44 2015
@@ -467,6 +467,8 @@ void MCStreamer::EmitWinEHHandlerData()
report_fatal_error("Chained unwind areas can't have handlers!");
}
+void MCStreamer::EmitSyntaxDirective() {}
+
void MCStreamer::EmitWinCFIPushReg(unsigned Register) {
EnsureValidWinFrameInfo();
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=242886&r1=242885&r2=242886&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Wed Jul 22 05:49:44 2015
@@ -535,6 +535,7 @@ void X86AsmPrinter::EmitStartOfAsmFile(M
S, MCConstantExpr::create(int64_t(1), MMI->getContext()));
}
}
+ OutStreamer->EmitSyntaxDirective();
}
static void
Added: llvm/trunk/test/MC/X86/intel-syntax-print.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/intel-syntax-print.ll?rev=242886&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/intel-syntax-print.ll (added)
+++ llvm/trunk/test/MC/X86/intel-syntax-print.ll Wed Jul 22 05:49:44 2015
@@ -0,0 +1,9 @@
+; RUN: llc -x86-asm-syntax=intel < %s | FileCheck %s -check-prefix=INTEL
+; RUN: llc -x86-asm-syntax=att < %s | FileCheck %s -check-prefix=ATT
+
+; INTEL: .intel_syntax noprefix
+; ATT-NOT: .intel_syntax noprefix
+define i32 @test() {
+entry:
+ ret i32 0
+}
More information about the llvm-commits
mailing list