blob: 69ed9f7d0487d2b59d173214f911c9e612b1833f [file] [log] [blame]
Bill Wendling841056a2007-01-24 03:36:05 +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
Bill Wendling736610c2007-02-03 02:41:58 +000022 class MachineRelocation;
23 class OutputBuffer;
Bill Wendling841056a2007-01-24 03:36:05 +000024 class PPCTargetMachine;
25
Bill Wendling2b721822007-01-24 07:13:56 +000026 class PPCMachOWriterInfo : public TargetMachOWriterInfo {
27 public:
Bill Wendling841056a2007-01-24 03:36:05 +000028 PPCMachOWriterInfo(const PPCTargetMachine &TM);
Bill Wendling736610c2007-02-03 02:41:58 +000029 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 Begemanfec910c2007-02-28 07:40:50 +000037 bool Scattered, bool Extern) const;
Bill Wendling736610c2007-02-03 02:41:58 +000038
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 Wendling841056a2007-01-24 03:36:05 +000051 };
52
53} // end llvm namespace
54
55#endif // PPC_MACHO_WRITER_INFO_H