diff --git a/llvm/include/llvm/Target/DarwinTargetAsmInfo.h b/llvm/include/llvm/Target/DarwinTargetAsmInfo.h index 2b5bf7c93149..0834390600f6 100644 --- a/llvm/include/llvm/Target/DarwinTargetAsmInfo.h +++ b/llvm/include/llvm/Target/DarwinTargetAsmInfo.h @@ -20,12 +20,11 @@ namespace llvm { class GlobalValue; class GlobalVariable; - class Triple; class Type; class Mangler; struct DarwinTargetAsmInfo : public TargetAsmInfo { - explicit DarwinTargetAsmInfo(const Triple &Triple); + explicit DarwinTargetAsmInfo(); }; } diff --git a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp index b3aa3bd9d515..0c3df82bfe26 100644 --- a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp +++ b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp @@ -40,8 +40,7 @@ static const char *const arm_asm_table[] = { 0,0 }; -ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const Triple &Triple) - : DarwinTargetAsmInfo(Triple) { +ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo() { AsmTransCBE = arm_asm_table; Data64bitsDirective = 0; CommentString = "@"; diff --git a/llvm/lib/Target/ARM/ARMTargetAsmInfo.h b/llvm/lib/Target/ARM/ARMTargetAsmInfo.h index 745f3c6ceac3..3fde8ba63078 100644 --- a/llvm/lib/Target/ARM/ARMTargetAsmInfo.h +++ b/llvm/lib/Target/ARM/ARMTargetAsmInfo.h @@ -19,7 +19,7 @@ namespace llvm { struct ARMDarwinTargetAsmInfo : public DarwinTargetAsmInfo { - explicit ARMDarwinTargetAsmInfo(const Triple &Triple); + explicit ARMDarwinTargetAsmInfo(); }; struct ARMELFTargetAsmInfo : public TargetAsmInfo { diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp index 1198aa94b56c..fbc5f38efea0 100644 --- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp +++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp @@ -32,7 +32,7 @@ static const TargetAsmInfo *createTargetAsmInfo(const Target &T, Triple TheTriple(TT); switch (TheTriple.getOS()) { case Triple::Darwin: - return new ARMDarwinTargetAsmInfo(TheTriple); + return new ARMDarwinTargetAsmInfo(); default: return new ARMELFTargetAsmInfo(); } diff --git a/llvm/lib/Target/DarwinTargetAsmInfo.cpp b/llvm/lib/Target/DarwinTargetAsmInfo.cpp index 937d057568a7..c37b41b70017 100644 --- a/llvm/lib/Target/DarwinTargetAsmInfo.cpp +++ b/llvm/lib/Target/DarwinTargetAsmInfo.cpp @@ -13,10 +13,9 @@ //===----------------------------------------------------------------------===// #include "llvm/Target/DarwinTargetAsmInfo.h" -#include "llvm/ADT/Triple.h" using namespace llvm; -DarwinTargetAsmInfo::DarwinTargetAsmInfo(const Triple &Triple) { +DarwinTargetAsmInfo::DarwinTargetAsmInfo() { // Common settings for all Darwin targets. // Syntax: GlobalPrefix = "_"; @@ -48,16 +47,13 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const Triple &Triple) { HasDotTypeDotSizeDirective = false; UsedDirective = "\t.no_dead_strip\t"; - // On Leopard (10.5 aka darwin9) and earlier, _foo.eh symbols must be exported - // so that the linker knows about them. This is not necessary on 10.6 and - // later, but it doesn't hurt anything. - if (Triple.getDarwinMajorNumber() < 10) - Is_EHSymbolPrivate = false; - - // Leopard (10.5 aka darwin9) and later support aligned common symbols. - COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9; - + // _foo.eh symbols are currently always exported so that the linker knows + // about them. This is not necessary on 10.6 and later, but it + // doesn't hurt anything. + // FIXME: I need to get this from Triple. + Is_EHSymbolPrivate = false; GlobalEHDirective = "\t.globl\t"; SupportsWeakOmittedEHFrame = false; + } diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp index 25920da0fe90..36cf2a5570dd 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp @@ -12,21 +12,19 @@ //===----------------------------------------------------------------------===// #include "PPCTargetAsmInfo.h" -#include "llvm/ADT/Triple.h" using namespace llvm; -PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const Triple &TheTriple) - : DarwinTargetAsmInfo(TheTriple) { +PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(bool is64Bit) { PCSymbol = "."; CommentString = ";"; ExceptionsType = ExceptionHandling::Dwarf; - if (TheTriple.getArch() != Triple::ppc64) + if (!is64Bit) Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode. AssemblerDialect = 1; // New-Style mnemonics. } -PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const Triple &TheTriple) { +PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(bool is64Bit) { CommentString = "#"; GlobalPrefix = ""; PrivateGlobalPrefix = ".L"; @@ -43,15 +41,13 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const Triple &TheTriple) { HasLEB128 = true; // Target asm supports leb128 directives (little-endian) // Exceptions handling - if (TheTriple.getArch() != Triple::ppc64) { + if (!is64Bit) ExceptionsType = ExceptionHandling::Dwarf; - Data64bitsDirective = 0; - } AbsoluteEHSectionOffsets = false; ZeroDirective = "\t.space\t"; SetDirective = "\t.set"; - + Data64bitsDirective = is64Bit ? "\t.quad\t" : 0; AlignmentIsInBytes = false; LCOMMDirective = "\t.lcomm\t"; AssemblerDialect = 0; // Old-Style mnemonics. diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h index 1e7e3d3745b3..c7f8862e7ff4 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h +++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.h @@ -14,16 +14,17 @@ #ifndef PPCTARGETASMINFO_H #define PPCTARGETASMINFO_H +#include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/DarwinTargetAsmInfo.h" namespace llvm { struct PPCDarwinTargetAsmInfo : public DarwinTargetAsmInfo { - explicit PPCDarwinTargetAsmInfo(const Triple &TheTriple); + explicit PPCDarwinTargetAsmInfo(bool is64Bit); }; struct PPCLinuxTargetAsmInfo : public TargetAsmInfo { - explicit PPCLinuxTargetAsmInfo(const Triple &TheTriple); + explicit PPCLinuxTargetAsmInfo(bool is64Bit); }; } // namespace llvm diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index a0d4fdb776b4..41f4699fc061 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -23,9 +23,10 @@ using namespace llvm; static const TargetAsmInfo *createTargetAsmInfo(const Target &T, const StringRef &TT) { Triple TheTriple(TT); + bool isPPC64 = TheTriple.getArch() == Triple::ppc64; if (TheTriple.getOS() == Triple::Darwin) - return new PPCDarwinTargetAsmInfo(TheTriple); - return new PPCLinuxTargetAsmInfo(TheTriple); + return new PPCDarwinTargetAsmInfo(isPPC64); + return new PPCLinuxTargetAsmInfo(isPPC64); } diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp index b6270108da23..d978eb179de8 100644 --- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp @@ -43,8 +43,7 @@ static const char *const x86_asm_table[] = { "{cc}", "cc", 0,0}; -X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) - : DarwinTargetAsmInfo(Triple) { +X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) { AsmTransCBE = x86_asm_table; AssemblerDialect = AsmWriterFlavor; @@ -55,6 +54,9 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) if (!is64Bit) Data64bitsDirective = 0; // we can't emit a 64-bit unit + // Leopard and above support aligned common symbols. + COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9; + if (is64Bit) { PersonalityPrefix = ""; PersonalitySuffix = "+4@GOTPCREL"; diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.h b/llvm/lib/Target/X86/X86TargetAsmInfo.h index 592d5e3396d7..91de36825910 100644 --- a/llvm/lib/Target/X86/X86TargetAsmInfo.h +++ b/llvm/lib/Target/X86/X86TargetAsmInfo.h @@ -19,6 +19,8 @@ #include "llvm/Target/DarwinTargetAsmInfo.h" namespace llvm { + class Triple; + struct X86DarwinTargetAsmInfo : public DarwinTargetAsmInfo { explicit X86DarwinTargetAsmInfo(const Triple &Triple); }; diff --git a/llvm/test/CodeGen/PowerPC/2008-12-12-EH.ll b/llvm/test/CodeGen/PowerPC/2008-12-12-EH.ll index 1e2a2e42d0a9..21218f55f039 100644 --- a/llvm/test/CodeGen/PowerPC/2008-12-12-EH.ll +++ b/llvm/test/CodeGen/PowerPC/2008-12-12-EH.ll @@ -1,6 +1,5 @@ ; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-unknown-linux-gnu | grep ^.L_Z1fv.eh ; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin9 | grep ^__Z1fv.eh -; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin10 | grep ^L__Z1fv.eh define void @_Z1fv() { entry: