blob: 69ed9f7d0487d2b59d173214f911c9e612b1833f [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- 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
19namespace llvm {
20
21 // Forward declarations
22 class MachineRelocation;
23 class OutputBuffer;
24 class PPCTargetMachine;
25
26 class PPCMachOWriterInfo : public TargetMachOWriterInfo {
27 public:
28 PPCMachOWriterInfo(const PPCTargetMachine &TM);
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,
37 bool Scattered, bool Extern) const;
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 };
51 };
52
53} // end llvm namespace
54
55#endif // PPC_MACHO_WRITER_INFO_H