Revert 78892 and 78895, these break generating working executables on

x86_64-apple-darwin10.

--- Reverse-merging r78895 into '.':
U    test/CodeGen/PowerPC/2008-12-12-EH.ll
U    lib/Target/DarwinTargetAsmInfo.cpp
--- Reverse-merging r78892 into '.':
U    include/llvm/Target/DarwinTargetAsmInfo.h
U    lib/Target/X86/X86TargetAsmInfo.cpp
U    lib/Target/X86/X86TargetAsmInfo.h
U    lib/Target/ARM/ARMTargetAsmInfo.h
U    lib/Target/ARM/ARMTargetMachine.cpp
U    lib/Target/ARM/ARMTargetAsmInfo.cpp
U    lib/Target/PowerPC/PPCTargetAsmInfo.cpp
U    lib/Target/PowerPC/PPCTargetAsmInfo.h
U    lib/Target/PowerPC/PPCTargetMachine.cpp
G    lib/Target/DarwinTargetAsmInfo.cpp

llvm-svn: 78919
This commit is contained in:
Daniel Dunbar 2009-08-13 17:03:38 +00:00
parent eba70d85cf
commit 86c065dd68
11 changed files with 28 additions and 33 deletions

View File

@ -20,12 +20,11 @@
namespace llvm { namespace llvm {
class GlobalValue; class GlobalValue;
class GlobalVariable; class GlobalVariable;
class Triple;
class Type; class Type;
class Mangler; class Mangler;
struct DarwinTargetAsmInfo : public TargetAsmInfo { struct DarwinTargetAsmInfo : public TargetAsmInfo {
explicit DarwinTargetAsmInfo(const Triple &Triple); explicit DarwinTargetAsmInfo();
}; };
} }

View File

@ -40,8 +40,7 @@ static const char *const arm_asm_table[] = {
0,0 0,0
}; };
ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const Triple &Triple) ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo() {
: DarwinTargetAsmInfo(Triple) {
AsmTransCBE = arm_asm_table; AsmTransCBE = arm_asm_table;
Data64bitsDirective = 0; Data64bitsDirective = 0;
CommentString = "@"; CommentString = "@";

View File

@ -19,7 +19,7 @@
namespace llvm { namespace llvm {
struct ARMDarwinTargetAsmInfo : public DarwinTargetAsmInfo { struct ARMDarwinTargetAsmInfo : public DarwinTargetAsmInfo {
explicit ARMDarwinTargetAsmInfo(const Triple &Triple); explicit ARMDarwinTargetAsmInfo();
}; };
struct ARMELFTargetAsmInfo : public TargetAsmInfo { struct ARMELFTargetAsmInfo : public TargetAsmInfo {

View File

@ -32,7 +32,7 @@ static const TargetAsmInfo *createTargetAsmInfo(const Target &T,
Triple TheTriple(TT); Triple TheTriple(TT);
switch (TheTriple.getOS()) { switch (TheTriple.getOS()) {
case Triple::Darwin: case Triple::Darwin:
return new ARMDarwinTargetAsmInfo(TheTriple); return new ARMDarwinTargetAsmInfo();
default: default:
return new ARMELFTargetAsmInfo(); return new ARMELFTargetAsmInfo();
} }

View File

@ -13,10 +13,9 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/Target/DarwinTargetAsmInfo.h" #include "llvm/Target/DarwinTargetAsmInfo.h"
#include "llvm/ADT/Triple.h"
using namespace llvm; using namespace llvm;
DarwinTargetAsmInfo::DarwinTargetAsmInfo(const Triple &Triple) { DarwinTargetAsmInfo::DarwinTargetAsmInfo() {
// Common settings for all Darwin targets. // Common settings for all Darwin targets.
// Syntax: // Syntax:
GlobalPrefix = "_"; GlobalPrefix = "_";
@ -48,16 +47,13 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const Triple &Triple) {
HasDotTypeDotSizeDirective = false; HasDotTypeDotSizeDirective = false;
UsedDirective = "\t.no_dead_strip\t"; UsedDirective = "\t.no_dead_strip\t";
// On Leopard (10.5 aka darwin9) and earlier, _foo.eh symbols must be exported // _foo.eh symbols are currently always exported so that the linker knows
// so that the linker knows about them. This is not necessary on 10.6 and // about them. This is not necessary on 10.6 and later, but it
// later, but it doesn't hurt anything. // doesn't hurt anything.
if (Triple.getDarwinMajorNumber() < 10) // FIXME: I need to get this from Triple.
Is_EHSymbolPrivate = false; Is_EHSymbolPrivate = false;
// Leopard (10.5 aka darwin9) and later support aligned common symbols.
COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9;
GlobalEHDirective = "\t.globl\t"; GlobalEHDirective = "\t.globl\t";
SupportsWeakOmittedEHFrame = false; SupportsWeakOmittedEHFrame = false;
} }

View File

@ -12,21 +12,19 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PPCTargetAsmInfo.h" #include "PPCTargetAsmInfo.h"
#include "llvm/ADT/Triple.h"
using namespace llvm; using namespace llvm;
PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const Triple &TheTriple) PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(bool is64Bit) {
: DarwinTargetAsmInfo(TheTriple) {
PCSymbol = "."; PCSymbol = ".";
CommentString = ";"; CommentString = ";";
ExceptionsType = ExceptionHandling::Dwarf; ExceptionsType = ExceptionHandling::Dwarf;
if (TheTriple.getArch() != Triple::ppc64) if (!is64Bit)
Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode. Data64bitsDirective = 0; // We can't emit a 64-bit unit in PPC32 mode.
AssemblerDialect = 1; // New-Style mnemonics. AssemblerDialect = 1; // New-Style mnemonics.
} }
PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const Triple &TheTriple) { PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(bool is64Bit) {
CommentString = "#"; CommentString = "#";
GlobalPrefix = ""; GlobalPrefix = "";
PrivateGlobalPrefix = ".L"; PrivateGlobalPrefix = ".L";
@ -43,15 +41,13 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const Triple &TheTriple) {
HasLEB128 = true; // Target asm supports leb128 directives (little-endian) HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
// Exceptions handling // Exceptions handling
if (TheTriple.getArch() != Triple::ppc64) { if (!is64Bit)
ExceptionsType = ExceptionHandling::Dwarf; ExceptionsType = ExceptionHandling::Dwarf;
Data64bitsDirective = 0;
}
AbsoluteEHSectionOffsets = false; AbsoluteEHSectionOffsets = false;
ZeroDirective = "\t.space\t"; ZeroDirective = "\t.space\t";
SetDirective = "\t.set"; SetDirective = "\t.set";
Data64bitsDirective = is64Bit ? "\t.quad\t" : 0;
AlignmentIsInBytes = false; AlignmentIsInBytes = false;
LCOMMDirective = "\t.lcomm\t"; LCOMMDirective = "\t.lcomm\t";
AssemblerDialect = 0; // Old-Style mnemonics. AssemblerDialect = 0; // Old-Style mnemonics.

View File

@ -14,16 +14,17 @@
#ifndef PPCTARGETASMINFO_H #ifndef PPCTARGETASMINFO_H
#define PPCTARGETASMINFO_H #define PPCTARGETASMINFO_H
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/DarwinTargetAsmInfo.h" #include "llvm/Target/DarwinTargetAsmInfo.h"
namespace llvm { namespace llvm {
struct PPCDarwinTargetAsmInfo : public DarwinTargetAsmInfo { struct PPCDarwinTargetAsmInfo : public DarwinTargetAsmInfo {
explicit PPCDarwinTargetAsmInfo(const Triple &TheTriple); explicit PPCDarwinTargetAsmInfo(bool is64Bit);
}; };
struct PPCLinuxTargetAsmInfo : public TargetAsmInfo { struct PPCLinuxTargetAsmInfo : public TargetAsmInfo {
explicit PPCLinuxTargetAsmInfo(const Triple &TheTriple); explicit PPCLinuxTargetAsmInfo(bool is64Bit);
}; };
} // namespace llvm } // namespace llvm

View File

@ -23,9 +23,10 @@ using namespace llvm;
static const TargetAsmInfo *createTargetAsmInfo(const Target &T, static const TargetAsmInfo *createTargetAsmInfo(const Target &T,
const StringRef &TT) { const StringRef &TT) {
Triple TheTriple(TT); Triple TheTriple(TT);
bool isPPC64 = TheTriple.getArch() == Triple::ppc64;
if (TheTriple.getOS() == Triple::Darwin) if (TheTriple.getOS() == Triple::Darwin)
return new PPCDarwinTargetAsmInfo(TheTriple); return new PPCDarwinTargetAsmInfo(isPPC64);
return new PPCLinuxTargetAsmInfo(TheTriple); return new PPCLinuxTargetAsmInfo(isPPC64);
} }

View File

@ -43,8 +43,7 @@ static const char *const x86_asm_table[] = {
"{cc}", "cc", "{cc}", "cc",
0,0}; 0,0};
X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple) {
: DarwinTargetAsmInfo(Triple) {
AsmTransCBE = x86_asm_table; AsmTransCBE = x86_asm_table;
AssemblerDialect = AsmWriterFlavor; AssemblerDialect = AsmWriterFlavor;
@ -55,6 +54,9 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple)
if (!is64Bit) if (!is64Bit)
Data64bitsDirective = 0; // we can't emit a 64-bit unit Data64bitsDirective = 0; // we can't emit a 64-bit unit
// Leopard and above support aligned common symbols.
COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9;
if (is64Bit) { if (is64Bit) {
PersonalityPrefix = ""; PersonalityPrefix = "";
PersonalitySuffix = "+4@GOTPCREL"; PersonalitySuffix = "+4@GOTPCREL";

View File

@ -19,6 +19,8 @@
#include "llvm/Target/DarwinTargetAsmInfo.h" #include "llvm/Target/DarwinTargetAsmInfo.h"
namespace llvm { namespace llvm {
class Triple;
struct X86DarwinTargetAsmInfo : public DarwinTargetAsmInfo { struct X86DarwinTargetAsmInfo : public DarwinTargetAsmInfo {
explicit X86DarwinTargetAsmInfo(const Triple &Triple); explicit X86DarwinTargetAsmInfo(const Triple &Triple);
}; };

View File

@ -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-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-darwin9 | grep ^__Z1fv.eh
; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin10 | grep ^L__Z1fv.eh
define void @_Z1fv() { define void @_Z1fv() {
entry: entry: