[llvm-commits] [llvm] r145409 - in /llvm/trunk: include/llvm/MC/MCAsmInfoCOFF.h lib/MC/MCAsmInfoCOFF.cpp lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp test/MC/COFF/symbol-mangling.ll
Michael J. Spencer
bigcheesegs at gmail.com
Tue Nov 29 10:00:06 PST 2011
Author: mspencer
Date: Tue Nov 29 12:00:06 2011
New Revision: 145409
URL: http://llvm.org/viewvc/llvm-project?rev=145409&view=rev
Log:
MC/X86/COFF: Allow quotes in names when targeting MS/Windows,
as MC is the only assembler we support.
This splits MS/Windows and GNU/Windows ASM infos into two seperate classes.
While there is currently only one difference, full MS C++ ABI support will
require many more.
Added:
llvm/trunk/test/MC/COFF/symbol-mangling.ll
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfoCOFF.h
llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
Modified: llvm/trunk/include/llvm/MC/MCAsmInfoCOFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfoCOFF.h?rev=145409&r1=145408&r2=145409&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfoCOFF.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfoCOFF.h Tue Nov 29 12:00:06 2011
@@ -18,6 +18,16 @@
explicit MCAsmInfoCOFF();
};
+
+ class MCAsmInfoMicrosoft : public MCAsmInfoCOFF {
+ protected:
+ explicit MCAsmInfoMicrosoft();
+ };
+
+ class MCAsmInfoGNUCOFF : public MCAsmInfoCOFF {
+ protected:
+ explicit MCAsmInfoGNUCOFF();
+ };
}
Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=145409&r1=145408&r2=145409&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Tue Nov 29 12:00:06 2011
@@ -38,3 +38,11 @@
SupportsDataRegions = false;
}
+
+MCAsmInfoMicrosoft::MCAsmInfoMicrosoft() {
+ AllowQuotesInName = true;
+}
+
+MCAsmInfoGNUCOFF::MCAsmInfoGNUCOFF() {
+
+}
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp?rev=145409&r1=145408&r2=145409&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp Tue Nov 29 12:00:06 2011
@@ -125,7 +125,19 @@
0, SectionKind::getMetadata());
}
-X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple) {
+X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft(const Triple &Triple) {
+ if (Triple.getArch() == Triple::x86_64) {
+ GlobalPrefix = "";
+ PrivateGlobalPrefix = ".L";
+ }
+
+ AsmTransCBE = x86_asm_table;
+ AssemblerDialect = AsmWriterFlavor;
+
+ TextAlignFillValue = 0x90;
+}
+
+X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
if (Triple.getArch() == Triple::x86_64) {
GlobalPrefix = "";
PrivateGlobalPrefix = ".L";
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h?rev=145409&r1=145408&r2=145409&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.h Tue Nov 29 12:00:06 2011
@@ -38,8 +38,12 @@
virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const;
};
- struct X86MCAsmInfoCOFF : public MCAsmInfoCOFF {
- explicit X86MCAsmInfoCOFF(const Triple &Triple);
+ struct X86MCAsmInfoMicrosoft : public MCAsmInfoMicrosoft {
+ explicit X86MCAsmInfoMicrosoft(const Triple &Triple);
+ };
+
+ struct X86MCAsmInfoGNUCOFF : public MCAsmInfoGNUCOFF {
+ explicit X86MCAsmInfoGNUCOFF(const Triple &Triple);
};
} // namespace llvm
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp?rev=145409&r1=145408&r2=145409&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp Tue Nov 29 12:00:06 2011
@@ -361,8 +361,10 @@
MAI = new X86_64MCAsmInfoDarwin(TheTriple);
else
MAI = new X86MCAsmInfoDarwin(TheTriple);
- } else if (TheTriple.isOSWindows()) {
- MAI = new X86MCAsmInfoCOFF(TheTriple);
+ } else if (TheTriple.getOS() == Triple::Win32) {
+ MAI = new X86MCAsmInfoMicrosoft(TheTriple);
+ } else if (TheTriple.getOS() == Triple::MinGW32 || TheTriple.getOS() == Triple::Cygwin) {
+ MAI = new X86MCAsmInfoGNUCOFF(TheTriple);
} else {
MAI = new X86ELFMCAsmInfo(TheTriple);
}
Added: llvm/trunk/test/MC/COFF/symbol-mangling.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/symbol-mangling.ll?rev=145409&view=auto
==============================================================================
--- llvm/trunk/test/MC/COFF/symbol-mangling.ll (added)
+++ llvm/trunk/test/MC/COFF/symbol-mangling.ll Tue Nov 29 12:00:06 2011
@@ -0,0 +1,17 @@
+; The purpose of this test is to see if the MC layer properly handles symbol
+; names needing quoting on MS/Windows. This code is generated by clang when
+; using -cxx-abi microsoft.
+
+; RUN: llc -filetype=asm -mtriple i686-pc-win32 %s -o - | FileCheck %s
+
+; CHECK: ?sayhi at A@@QBEXXZ
+
+%struct.A = type {}
+
+define i32 @main() {
+entry:
+ tail call void @"\01?sayhi at A@@QBEXXZ"(%struct.A* null)
+ ret i32 0
+}
+
+declare void @"\01?sayhi at A@@QBEXXZ"(%struct.A*)
More information about the llvm-commits
mailing list