Correctly handle a one-word struct passed byval on x86_64.
[oota-llvm.git] / lib / Target / PowerPC / PPCAsmBackend.cpp
index d8ab689bfa7add71106ff8e18ece388adf45ce29..f562a3f4f9e843b3c901f98e43f0ec23a14f7f43 100644 (file)
@@ -12,7 +12,6 @@
 #include "PPCFixupKinds.h"
 #include "llvm/MC/MCMachObjectWriter.h"
 #include "llvm/MC/MCSectionMachO.h"
-#include "llvm/MC/MCObjectFormat.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/Object/MachOFormat.h"
 #include "llvm/Target/TargetRegistry.h"
@@ -20,6 +19,10 @@ using namespace llvm;
 
 namespace {
 class PPCMachObjectWriter : public MCMachObjectTargetWriter {
+public:
+  PPCMachObjectWriter(bool Is64Bit, uint32_t CPUType,
+                      uint32_t CPUSubtype)
+    : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
 };
 
 class PPCAsmBackend : public TargetAsmBackend {
@@ -78,15 +81,8 @@ public:
 // FIXME: This should be in a separate file.
 namespace {
   class DarwinPPCAsmBackend : public PPCAsmBackend {
-    MCMachOObjectFormat Format;
   public:
-    DarwinPPCAsmBackend(const Target &T) : PPCAsmBackend(T) {
-      HasScatteredSymbols = true;
-    }
-    
-    virtual const MCObjectFormat &getObjectFormat() const {
-      return Format;
-    }
+    DarwinPPCAsmBackend(const Target &T) : PPCAsmBackend(T) { }
     
     void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize,
                     uint64_t Value) const {
@@ -95,12 +91,12 @@ namespace {
     
     MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
       bool is64 = getPointerSize() == 8;
-      return createMachObjectWriter(new PPCMachObjectWriter,
-                                    OS, /*Is64Bit=*/is64,
-                                    (is64 ? object::mach::CTM_PowerPC64 :
-                                     object::mach::CTM_PowerPC),
-                                    object::mach::CSPPC_ALL,
-                                    /*IsLittleEndian=*/false);
+      return createMachObjectWriter(new PPCMachObjectWriter(
+                                      /*Is64Bit=*/is64,
+                                      (is64 ? object::mach::CTM_PowerPC64 :
+                                       object::mach::CTM_PowerPC),
+                                      object::mach::CSPPC_ALL),
+                                    OS, /*IsLittleEndian=*/false);
     }
     
     virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
@@ -114,10 +110,8 @@ namespace {
 
 TargetAsmBackend *llvm::createPPCAsmBackend(const Target &T,
                                             const std::string &TT) {
-  switch (Triple(TT).getOS()) {
-  case Triple::Darwin:
+  if (Triple(TT).isOSDarwin())
     return new DarwinPPCAsmBackend(T);
-  default:
-    return 0;
-  }
+
+  return 0;
 }