blob: 3c030a683565a3a03f03df65fc3e0a348ce55594 [file] [log] [blame]
Chris Lattner1911fd42006-09-04 04:14:57 +00001//===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00002//
Misha Brukman5dfe3a92004-06-21 16:55:25 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukmanb5f662f2005-04-21 23:30:14 +00007//
Misha Brukman5dfe3a92004-06-21 16:55:25 +00008//===----------------------------------------------------------------------===//
9//
10// This file contains the entry points for global functions defined in the LLVM
11// PowerPC back-end.
12//
13//===----------------------------------------------------------------------===//
14
Chris Lattner1911fd42006-09-04 04:14:57 +000015#ifndef LLVM_TARGET_POWERPC_H
16#define LLVM_TARGET_POWERPC_H
Misha Brukman5dfe3a92004-06-21 16:55:25 +000017
Chris Lattnerb46443a2010-11-15 08:49:58 +000018#include <string>
19
Chris Lattneraf53a872006-11-04 05:27:39 +000020// GCC #defines PPC on Linux but we use it as our namespace name
21#undef PPC
22
Misha Brukman5dfe3a92004-06-21 16:55:25 +000023namespace llvm {
Chris Lattneraf53a872006-11-04 05:27:39 +000024 class PPCTargetMachine;
Chris Lattneraf53a872006-11-04 05:27:39 +000025 class FunctionPass;
David Greene71847812009-07-14 20:18:05 +000026 class formatted_raw_ostream;
Chris Lattner8d63ba82010-11-14 21:09:28 +000027 class JITCodeEmitter;
28 class Target;
Chris Lattnera7217c82010-11-14 21:12:33 +000029 class MachineInstr;
Chris Lattnera7217c82010-11-14 21:12:33 +000030 class AsmPrinter;
Chris Lattner5ffe38e2010-11-15 04:16:32 +000031 class MCInst;
32 class MCCodeEmitter;
33 class MCContext;
Evan Cheng59ee62d2011-07-11 03:57:24 +000034 class MCInstrInfo;
35 class MCSubtargetInfo;
Chris Lattner5ffe38e2010-11-15 04:16:32 +000036 class TargetMachine;
Chris Lattnerb46443a2010-11-15 08:49:58 +000037 class TargetAsmBackend;
Chris Lattneraf53a872006-11-04 05:27:39 +000038
Chris Lattner6d2ff122010-11-15 03:13:19 +000039 FunctionPass *createPPCBranchSelectionPass();
40 FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
41 FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
42 JITCodeEmitter &MCE);
Evan Cheng59ee62d2011-07-11 03:57:24 +000043 MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
44 const MCSubtargetInfo &STI,
Chris Lattner5ffe38e2010-11-15 04:16:32 +000045 MCContext &Ctx);
Chris Lattnerb46443a2010-11-15 08:49:58 +000046 TargetAsmBackend *createPPCAsmBackend(const Target &, const std::string &);
Chris Lattner6d2ff122010-11-15 03:13:19 +000047
48 void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
Roman Divackya1000742011-06-09 20:25:38 +000049 AsmPrinter &AP, bool isDarwin);
Chris Lattner6d2ff122010-11-15 03:13:19 +000050
51 extern Target ThePPC32Target;
52 extern Target ThePPC64Target;
53
Chris Lattnerb9082582010-11-14 23:42:06 +000054 namespace PPCII {
55
56 /// Target Operand Flag enum.
57 enum TOF {
58 //===------------------------------------------------------------------===//
59 // PPC Specific MachineOperand flags.
60 MO_NO_FLAG,
61
62 /// MO_DARWIN_STUB - On a symbol operand "FOO", this indicates that the
63 /// reference is actually to the "FOO$stub" symbol. This is used for calls
64 /// and jumps to external functions on Tiger and earlier.
Chris Lattner6d2ff122010-11-15 03:13:19 +000065 MO_DARWIN_STUB = 1,
Chris Lattnerb9082582010-11-14 23:42:06 +000066
Chris Lattner6d2ff122010-11-15 03:13:19 +000067 /// MO_LO16, MO_HA16 - lo16(symbol) and ha16(symbol)
68 MO_LO16 = 4, MO_HA16 = 8,
Chris Lattner1e61e692010-11-15 02:46:57 +000069
Chris Lattner6d2ff122010-11-15 03:13:19 +000070 /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
71 /// the function's picbase, e.g. lo16(symbol-picbase).
72 MO_PIC_FLAG = 16,
73
74 /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
75 /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
76 MO_NLP_FLAG = 32,
Chris Lattner1e61e692010-11-15 02:46:57 +000077
Chris Lattner6d2ff122010-11-15 03:13:19 +000078 /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
79 /// symbol with hidden visibility. This causes a different kind of
80 /// non-lazy-pointer to be generated.
81 MO_NLP_HIDDEN_FLAG = 64
Chris Lattnerb9082582010-11-14 23:42:06 +000082 };
83 } // end namespace PPCII
84
Misha Brukman5dfe3a92004-06-21 16:55:25 +000085} // end namespace llvm;
86
Misha Brukman5dfe3a92004-06-21 16:55:25 +000087// Defines symbolic names for PowerPC registers. This defines a mapping from
88// register name to register number.
89//
Evan Cheng73f50d92011-06-27 18:32:37 +000090#define GET_REGINFO_ENUM
91#include "PPCGenRegisterInfo.inc"
Misha Brukman5dfe3a92004-06-21 16:55:25 +000092
93// Defines symbolic names for the PowerPC instructions.
94//
Evan Cheng22fee2d2011-06-28 20:07:07 +000095#define GET_INSTRINFO_ENUM
96#include "PPCGenInstrInfo.inc"
Misha Brukman5dfe3a92004-06-21 16:55:25 +000097
98#endif