1 //===-- llvm/Target/TargetMachOWriterInfo.h - MachO Writer Info--*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Bill Wendling and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the TargetMachOWriterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_TARGETMACHOWRITERINFO_H
15 #define LLVM_TARGET_TARGETMACHOWRITERINFO_H
17 #include "llvm/CodeGen/MachineRelocation.h"
21 class MachineBasicBlock;
23 //===--------------------------------------------------------------------===//
24 // TargetMachOWriterInfo
25 //===--------------------------------------------------------------------===//
27 struct TargetMachOWriterInfo {
28 uint32_t CPUType; // CPU specifier
29 uint32_t CPUSubType; // Machine specifier
31 // The various CPU_TYPE_* constants are already defined by at least one
32 // system header file and create compilation errors if not respected.
33 #if !defined(CPU_TYPE_I386)
34 #define CPU_TYPE_I386 7
36 #if !defined(CPU_TYPE_X86_64)
37 #define CPU_TYPE_X86_64 (CPU_TYPE_I386 | 0x1000000)
39 #if !defined(CPU_TYPE_ARM)
40 #define CPU_TYPE_ARM 12
42 #if !defined(CPU_TYPE_SPARC)
43 #define CPU_TYPE_SPARC 14
45 #if !defined(CPU_TYPE_POWERPC)
46 #define CPU_TYPE_POWERPC 18
48 #if !defined(CPU_TYPE_POWERPC64)
49 #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | 0x1000000)
52 // Constants for the cputype field
53 // see <mach/machine.h>
55 HDR_CPU_TYPE_I386 = CPU_TYPE_I386,
56 HDR_CPU_TYPE_X86_64 = CPU_TYPE_X86_64,
57 HDR_CPU_TYPE_ARM = CPU_TYPE_ARM,
58 HDR_CPU_TYPE_SPARC = CPU_TYPE_SPARC,
59 HDR_CPU_TYPE_POWERPC = CPU_TYPE_POWERPC,
60 HDR_CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC64
63 #if !defined(CPU_SUBTYPE_I386_ALL)
64 #define CPU_SUBTYPE_I386_ALL 3
66 #if !defined(CPU_SUBTYPE_X86_64_ALL)
67 #define CPU_SUBTYPE_X86_64_ALL 3
69 #if !defined(CPU_SUBTYPE_ARM_ALL)
70 #define CPU_SUBTYPE_ARM_ALL 0
72 #if !defined(CPU_SUBTYPE_SPARC_ALL)
73 #define CPU_SUBTYPE_SPARC_ALL 0
75 #if !defined(CPU_SUBTYPE_POWERPC_ALL)
76 #define CPU_SUBTYPE_POWERPC_ALL 0
79 // Constants for the cpusubtype field
80 // see <mach/machine.h>
82 HDR_CPU_SUBTYPE_I386_ALL = CPU_SUBTYPE_I386_ALL,
83 HDR_CPU_SUBTYPE_X86_64_ALL = CPU_SUBTYPE_X86_64_ALL,
84 HDR_CPU_SUBTYPE_ARM_ALL = CPU_SUBTYPE_ARM_ALL,
85 HDR_CPU_SUBTYPE_SPARC_ALL = CPU_SUBTYPE_SPARC_ALL,
86 HDR_CPU_SUBTYPE_POWERPC_ALL = CPU_SUBTYPE_POWERPC_ALL
89 TargetMachOWriterInfo(uint32_t cputype, uint32_t cpusubtype)
90 : CPUType(cputype), CPUSubType(cpusubtype) {}
91 virtual ~TargetMachOWriterInfo() {}
93 virtual MachineRelocation GetJTRelocation(unsigned Offset,
94 MachineBasicBlock *MBB) const;
96 virtual const char *getPassName() const {
97 return "Mach-O Writer";
101 } // end llvm namespace
103 #endif // LLVM_TARGET_TARGETMACHOWRITERINFO_H