Bill Wendling | 841056a | 2007-01-24 03:36:05 +0000 | [diff] [blame] | 1 | //===-- PPCMachOWriterInfo.h - Mach-O Writer Info for PowerPC ---*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 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. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements Mach-O writer information for the PowerPC backend. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef PPC_MACHO_WRITER_INFO_H |
| 15 | #define PPC_MACHO_WRITER_INFO_H |
| 16 | |
| 17 | #include "llvm/Target/TargetMachOWriterInfo.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | |
| 21 | // Forward declarations |
Bill Wendling | 736610c | 2007-02-03 02:41:58 +0000 | [diff] [blame] | 22 | class MachineRelocation; |
| 23 | class OutputBuffer; |
Bill Wendling | 841056a | 2007-01-24 03:36:05 +0000 | [diff] [blame] | 24 | class PPCTargetMachine; |
| 25 | |
Bill Wendling | 2b72182 | 2007-01-24 07:13:56 +0000 | [diff] [blame] | 26 | class PPCMachOWriterInfo : public TargetMachOWriterInfo { |
| 27 | public: |
Bill Wendling | 841056a | 2007-01-24 03:36:05 +0000 | [diff] [blame] | 28 | PPCMachOWriterInfo(const PPCTargetMachine &TM); |
Bill Wendling | 736610c | 2007-02-03 02:41:58 +0000 | [diff] [blame] | 29 | virtual ~PPCMachOWriterInfo(); |
| 30 | |
| 31 | virtual unsigned GetTargetRelocation(MachineRelocation &MR, |
| 32 | unsigned FromIdx, |
| 33 | unsigned ToAddr, |
| 34 | unsigned ToIdx, |
| 35 | OutputBuffer &RelocOut, |
| 36 | OutputBuffer &SecOut, |
Nate Begeman | fec910c | 2007-02-28 07:40:50 +0000 | [diff] [blame] | 37 | bool Scattered, bool Extern) const; |
Bill Wendling | 736610c | 2007-02-03 02:41:58 +0000 | [diff] [blame] | 38 | |
| 39 | // Constants for the relocation r_type field. |
| 40 | // See <mach-o/ppc/reloc.h> |
| 41 | enum { |
| 42 | PPC_RELOC_VANILLA, // generic relocation |
| 43 | PPC_RELOC_PAIR, // the second relocation entry of a pair |
| 44 | PPC_RELOC_BR14, // 14 bit branch displacement to word address |
| 45 | PPC_RELOC_BR24, // 24 bit branch displacement to word address |
| 46 | PPC_RELOC_HI16, // a PAIR follows with the low 16 bits |
| 47 | PPC_RELOC_LO16, // a PAIR follows with the high 16 bits |
| 48 | PPC_RELOC_HA16, // a PAIR follows, which is sign extended to 32b |
| 49 | PPC_RELOC_LO14 // LO16 with low 2 bits implicitly zero |
| 50 | }; |
Bill Wendling | 841056a | 2007-01-24 03:36:05 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | } // end llvm namespace |
| 54 | |
| 55 | #endif // PPC_MACHO_WRITER_INFO_H |