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;
24 //===--------------------------------------------------------------------===//
25 // TargetMachOWriterInfo
26 //===--------------------------------------------------------------------===//
28 class TargetMachOWriterInfo {
29 uint32_t CPUType; // CPU specifier
30 uint32_t CPUSubType; // Machine specifier
32 // The various CPU_TYPE_* constants are already defined by at least one
33 // system header file and create compilation errors if not respected.
34 #if !defined(CPU_TYPE_I386)
35 #define CPU_TYPE_I386 7
37 #if !defined(CPU_TYPE_X86_64)
38 #define CPU_TYPE_X86_64 (CPU_TYPE_I386 | 0x1000000)
40 #if !defined(CPU_TYPE_ARM)
41 #define CPU_TYPE_ARM 12
43 #if !defined(CPU_TYPE_SPARC)
44 #define CPU_TYPE_SPARC 14
46 #if !defined(CPU_TYPE_POWERPC)
47 #define CPU_TYPE_POWERPC 18
49 #if !defined(CPU_TYPE_POWERPC64)
50 #define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | 0x1000000)
53 // Constants for the cputype field
54 // see <mach/machine.h>
56 HDR_CPU_TYPE_I386 = CPU_TYPE_I386,
57 HDR_CPU_TYPE_X86_64 = CPU_TYPE_X86_64,
58 HDR_CPU_TYPE_ARM = CPU_TYPE_ARM,
59 HDR_CPU_TYPE_SPARC = CPU_TYPE_SPARC,
60 HDR_CPU_TYPE_POWERPC = CPU_TYPE_POWERPC,
61 HDR_CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC64
64 #if !defined(CPU_SUBTYPE_I386_ALL)
65 #define CPU_SUBTYPE_I386_ALL 3
67 #if !defined(CPU_SUBTYPE_X86_64_ALL)
68 #define CPU_SUBTYPE_X86_64_ALL 3
70 #if !defined(CPU_SUBTYPE_ARM_ALL)
71 #define CPU_SUBTYPE_ARM_ALL 0
73 #if !defined(CPU_SUBTYPE_SPARC_ALL)
74 #define CPU_SUBTYPE_SPARC_ALL 0
76 #if !defined(CPU_SUBTYPE_POWERPC_ALL)
77 #define CPU_SUBTYPE_POWERPC_ALL 0
80 // Constants for the cpusubtype field
81 // see <mach/machine.h>
83 HDR_CPU_SUBTYPE_I386_ALL = CPU_SUBTYPE_I386_ALL,
84 HDR_CPU_SUBTYPE_X86_64_ALL = CPU_SUBTYPE_X86_64_ALL,
85 HDR_CPU_SUBTYPE_ARM_ALL = CPU_SUBTYPE_ARM_ALL,
86 HDR_CPU_SUBTYPE_SPARC_ALL = CPU_SUBTYPE_SPARC_ALL,
87 HDR_CPU_SUBTYPE_POWERPC_ALL = CPU_SUBTYPE_POWERPC_ALL
90 TargetMachOWriterInfo(uint32_t cputype, uint32_t cpusubtype)
91 : CPUType(cputype), CPUSubType(cpusubtype) {}
92 virtual ~TargetMachOWriterInfo();
94 virtual MachineRelocation GetJTRelocation(unsigned Offset,
95 MachineBasicBlock *MBB) const;
97 virtual unsigned GetTargetRelocation(MachineRelocation &MR,
101 OutputBuffer &RelocOut,
102 OutputBuffer &SecOut,
104 bool Extern) const { return 0; }
106 uint32_t getCPUType() const { return CPUType; }
107 uint32_t getCPUSubType() const { return CPUSubType; }
110 } // end llvm namespace
112 #endif // LLVM_TARGET_TARGETMACHOWRITERINFO_H