blob: 3c030a683565a3a03f03df65fc3e0a348ce55594 [file] [log] [blame]
Chris Lattner12e97302006-09-04 04:14:57 +00001//===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//
Misha Brukmanb4402432005-04-21 23:30:14 +00002//
Misha Brukmane05203f2004-06-21 16:55:25 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-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 Brukmanb4402432005-04-21 23:30:14 +00007//
Misha Brukmane05203f2004-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 Lattner12e97302006-09-04 04:14:57 +000015#ifndef LLVM_TARGET_POWERPC_H
16#define LLVM_TARGET_POWERPC_H
Misha Brukmane05203f2004-06-21 16:55:25 +000017
Chris Lattneraac9fa72010-11-15 08:49:58 +000018#include <string>
19
Chris Lattner6be72602006-11-04 05:27:39 +000020// GCC #defines PPC on Linux but we use it as our namespace name
21#undef PPC
22
Misha Brukmane05203f2004-06-21 16:55:25 +000023namespace llvm {
Chris Lattner6be72602006-11-04 05:27:39 +000024 class PPCTargetMachine;
Chris Lattner6be72602006-11-04 05:27:39 +000025 class FunctionPass;
David Greenea31f96c2009-07-14 20:18:05 +000026 class formatted_raw_ostream;
Chris Lattner0927edf2010-11-14 21:09:28 +000027 class JITCodeEmitter;
28 class Target;
Chris Lattner5c1b0cd2010-11-14 21:12:33 +000029 class MachineInstr;
Chris Lattner5c1b0cd2010-11-14 21:12:33 +000030 class AsmPrinter;
Chris Lattner9ec375c2010-11-15 04:16:32 +000031 class MCInst;
32 class MCCodeEmitter;
33 class MCContext;
Evan Chengc5e6d2f2011-07-11 03:57:24 +000034 class MCInstrInfo;
35 class MCSubtargetInfo;
Chris Lattner9ec375c2010-11-15 04:16:32 +000036 class TargetMachine;
Chris Lattneraac9fa72010-11-15 08:49:58 +000037 class TargetAsmBackend;
Chris Lattner6be72602006-11-04 05:27:39 +000038
Chris Lattnerdd6df842010-11-15 03:13:19 +000039 FunctionPass *createPPCBranchSelectionPass();
40 FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
41 FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
42 JITCodeEmitter &MCE);
Evan Chengc5e6d2f2011-07-11 03:57:24 +000043 MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
44 const MCSubtargetInfo &STI,
Chris Lattner9ec375c2010-11-15 04:16:32 +000045 MCContext &Ctx);
Chris Lattneraac9fa72010-11-15 08:49:58 +000046 TargetAsmBackend *createPPCAsmBackend(const Target &, const std::string &);
Chris Lattnerdd6df842010-11-15 03:13:19 +000047
48 void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
Roman Divacky4b5665a2011-06-09 20:25:38 +000049 AsmPrinter &AP, bool isDarwin);
Chris Lattnerdd6df842010-11-15 03:13:19 +000050
51 extern Target ThePPC32Target;
52 extern Target ThePPC64Target;
53
Chris Lattnerdf8e17d2010-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 Lattnerdd6df842010-11-15 03:13:19 +000065 MO_DARWIN_STUB = 1,
Chris Lattnerdf8e17d2010-11-14 23:42:06 +000066
Chris Lattnerdd6df842010-11-15 03:13:19 +000067 /// MO_LO16, MO_HA16 - lo16(symbol) and ha16(symbol)
68 MO_LO16 = 4, MO_HA16 = 8,
Chris Lattneredb9d842010-11-15 02:46:57 +000069
Chris Lattnerdd6df842010-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 Lattneredb9d842010-11-15 02:46:57 +000077
Chris Lattnerdd6df842010-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 Lattnerdf8e17d2010-11-14 23:42:06 +000082 };
83 } // end namespace PPCII
84
Misha Brukmane05203f2004-06-21 16:55:25 +000085} // end namespace llvm;
86
Misha Brukmane05203f2004-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 Chengd9997ac2011-06-27 18:32:37 +000090#define GET_REGINFO_ENUM
91#include "PPCGenRegisterInfo.inc"
Misha Brukmane05203f2004-06-21 16:55:25 +000092
93// Defines symbolic names for the PowerPC instructions.
94//
Evan Cheng1e210d02011-06-28 20:07:07 +000095#define GET_INSTRINFO_ENUM
96#include "PPCGenInstrInfo.inc"
Misha Brukmane05203f2004-06-21 16:55:25 +000097
98#endif