[llvm-commits] [llvm] r95113 - in /llvm/trunk: include/llvm/Support/MachO.h lib/MC/MCAssembler.cpp

Chris Lattner sabre at nondot.org
Tue Feb 2 11:38:15 PST 2010


Author: lattner
Date: Tue Feb  2 13:38:14 2010
New Revision: 95113

URL: http://llvm.org/viewvc/llvm-project?rev=95113&view=rev
Log:
Add a new top-level MachO.h file for manifest constants, fixing 
a layering violation from MC -> Target.

Added:
    llvm/trunk/include/llvm/Support/MachO.h
Modified:
    llvm/trunk/lib/MC/MCAssembler.cpp

Added: llvm/trunk/include/llvm/Support/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.h?rev=95113&view=auto

==============================================================================
--- llvm/trunk/include/llvm/Support/MachO.h (added)
+++ llvm/trunk/include/llvm/Support/MachO.h Tue Feb  2 13:38:14 2010
@@ -0,0 +1,56 @@
+//===-- llvm/Support/MachO.h - The MachO file format ------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines manifest constants for the MachO object file format.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_MACHO_H
+#define LLVM_SUPPORT_MACHO_H
+
+// NOTE: The enums in this file are intentially named to be different than those
+// in the headers in /usr/include/mach (on darwin systems) to avoid conflicts
+// with those macros.
+namespace llvm {
+  namespace MachO {
+    // Enums from <mach/machine.h>
+    enum {
+      // Capability bits used in the definition of cpu_type.
+      CPUArchMask = 0xff000000,   // Mask for architecture bits
+      CPUArchABI64 = 0x01000000,  // 64 bit ABI
+      
+      // Constants for the cputype field.
+      CPUTypeI386      = 7,
+      CPUTypeX86_64    = CPUTypeI386 | CPUArchABI64,
+      CPUTypeARM       = 12,
+      CPUTypeSPARC     = 14,
+      CPUTypePowerPC   = 18,
+      CPUTypePowerPC64 = CPUTypePowerPC | CPUArchABI64,
+
+
+      // Constants for the cpusubtype field.
+      
+      // X86
+      CPUSubType_I386_ALL    = 3,
+      CPUSubType_X86_64_ALL  = 3,
+      
+      // ARM
+      CPUSubType_ARM_ALL     = 0,
+      CPUSubType_ARM_V4T     = 5,
+      CPUSubType_ARM_V6      = 6,
+
+      // PowerPC
+      CPUSubType_POWERPC_ALL = 0,
+      
+      CPUSubType_SPARC_ALL   = 0
+    };
+  } // end namespace MachO
+} // end namespace llvm
+
+#endif

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=95113&r1=95112&r2=95113&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Tue Feb  2 13:38:14 2010
@@ -13,13 +13,13 @@
 #include "llvm/MC/MCSectionMachO.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCValue.h"
-#include "llvm/Target/TargetMachOWriterInfo.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/MachO.h"
 #include "llvm/Support/raw_ostream.h"
 #include <vector>
 using namespace llvm;
@@ -203,9 +203,9 @@
     Write32(Header_Magic32);
 
     // FIXME: Support cputype.
-    Write32(TargetMachOWriterInfo::HDR_CPU_TYPE_I386);
+    Write32(MachO::CPUTypeI386);
     // FIXME: Support cpusubtype.
-    Write32(TargetMachOWriterInfo::HDR_CPU_SUBTYPE_I386_ALL);
+    Write32(MachO::CPUSubType_I386_ALL);
     Write32(HFT_Object);
     Write32(NumLoadCommands);    // Object files have a single load command, the
                                  // segment.





More information about the llvm-commits mailing list