diff options
author | Bill Wendling <isanbard@gmail.com> | 2007-01-24 03:37:18 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2007-01-24 03:37:18 +0000 |
commit | 40fab4088ef79e0a27b153449419405e026c34f1 (patch) | |
tree | a6bad5e9317b8c981cf020e64285255c5f8ff632 /include | |
parent | 841056a2ad6fce7786378a27aced46e37122259f (diff) | |
download | external_llvm-40fab4088ef79e0a27b153449419405e026c34f1.zip external_llvm-40fab4088ef79e0a27b153449419405e026c34f1.tar.gz external_llvm-40fab4088ef79e0a27b153449419405e026c34f1.tar.bz2 |
Moved target-specific information to the TargetMachOWriterInfo obj.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachOWriter.h | 69 |
1 files changed, 7 insertions, 62 deletions
diff --git a/include/llvm/CodeGen/MachOWriter.h b/include/llvm/CodeGen/MachOWriter.h index 2bab987..dd98b95 100644 --- a/include/llvm/CodeGen/MachOWriter.h +++ b/include/llvm/CodeGen/MachOWriter.h @@ -19,6 +19,7 @@ #include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetMachOWriterInfo.h" namespace llvm { class GlobalVariable; @@ -126,8 +127,6 @@ namespace llvm { /// specific architecture type/subtype pair that is emitted to the file. struct MachOHeader { uint32_t magic; // mach magic number identifier - uint32_t cputype; // cpu specifier - uint32_t cpusubtype; // machine specifier uint32_t filetype; // type of file uint32_t ncmds; // number of load commands uint32_t sizeofcmds; // the size of all the load commands @@ -138,62 +137,6 @@ namespace llvm { /// up for emission to the file. DataBuffer HeaderData; - // The various CPU_TYPE_* constants are already defined by at least one - // system header file and create compilation errors if not respected. -#if !defined(CPU_TYPE_I386) -#define CPU_TYPE_I386 7 -#endif -#if !defined(CPU_TYPE_X86_64) -#define CPU_TYPE_X86_64 (CPU_TYPE_I386 | 0x1000000) -#endif -#if !defined(CPU_TYPE_ARM) -#define CPU_TYPE_ARM 12 -#endif -#if !defined(CPU_TYPE_SPARC) -#define CPU_TYPE_SPARC 14 -#endif -#if !defined(CPU_TYPE_POWERPC) -#define CPU_TYPE_POWERPC 18 -#endif -#if !defined(CPU_TYPE_POWERPC64) -#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | 0x1000000) -#endif - - // Constants for the cputype field - // see <mach/machine.h> - enum { HDR_CPU_TYPE_I386 = CPU_TYPE_I386, - HDR_CPU_TYPE_X86_64 = CPU_TYPE_X86_64, - HDR_CPU_TYPE_ARM = CPU_TYPE_ARM, - HDR_CPU_TYPE_SPARC = CPU_TYPE_SPARC, - HDR_CPU_TYPE_POWERPC = CPU_TYPE_POWERPC, - HDR_CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC64 - }; - -#if !defined(CPU_SUBTYPE_I386_ALL) -#define CPU_SUBTYPE_I386_ALL 3 -#endif -#if !defined(CPU_SUBTYPE_X86_64_ALL) -#define CPU_SUBTYPE_X86_64_ALL 3 -#endif -#if !defined(CPU_SUBTYPE_ARM_ALL) -#define CPU_SUBTYPE_ARM_ALL 0 -#endif -#if !defined(CPU_SUBTYPE_SPARC_ALL) -#define CPU_SUBTYPE_SPARC_ALL 0 -#endif -#if !defined(CPU_SUBTYPE_POWERPC_ALL) -#define CPU_SUBTYPE_POWERPC_ALL 0 - -#endif - // Constants for the cpusubtype field - // see <mach/machine.h> - enum { HDR_CPU_SUBTYPE_I386_ALL = CPU_SUBTYPE_I386_ALL, - HDR_CPU_SUBTYPE_X86_64_ALL = CPU_SUBTYPE_X86_64_ALL, - HDR_CPU_SUBTYPE_ARM_ALL = CPU_SUBTYPE_ARM_ALL, - HDR_CPU_SUBTYPE_SPARC_ALL = CPU_SUBTYPE_SPARC_ALL, - HDR_CPU_SUBTYPE_POWERPC_ALL = CPU_SUBTYPE_POWERPC_ALL - }; - // Constants for the filetype field // see <mach-o/loader.h> for additional info on the various types enum { MH_OBJECT = 1, // relocatable object file @@ -261,8 +204,8 @@ namespace llvm { // stack execution privilege. Only used in MH_EXECUTE filetype }; - MachOHeader() : magic(0), cputype(0), cpusubtype(0), filetype(0), - ncmds(0), sizeofcmds(0), flags(0), reserved(0) { } + MachOHeader() : magic(0), filetype(0), ncmds(0), sizeofcmds(0), flags(0), + reserved(0) { } /// cmdSize - This routine returns the size of the MachOSection as written /// to disk, depending on whether the destination is a 64 bit Mach-O file. @@ -671,8 +614,10 @@ namespace llvm { void BufferSymbolAndStringTable(); void CalculateRelocations(MachOSection &MOS); - virtual MachineRelocation GetJTRelocation(unsigned Offset, - MachineBasicBlock *MBB) = 0; + MachineRelocation GetJTRelocation(unsigned Offset, + MachineBasicBlock *MBB) const { + return TM.getMachOWriterInfo()->GetJTRelocation(Offset, MBB); + } virtual void GetTargetRelocation(MachineRelocation &MR, MachOSection &From, MachOSection &To) = 0; }; |