blob: bcad94f4096a4083a728750e5609b73736c40806 [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
Evan Chengc60f9b72011-07-14 20:59:42 +000018#include "MCTargetDesc/PPCMCTargetDesc.h"
Chris Lattnerb46443a2010-11-15 08:49:58 +000019#include <string>
20
Chris Lattneraf53a872006-11-04 05:27:39 +000021// GCC #defines PPC on Linux but we use it as our namespace name
22#undef PPC
23
Misha Brukman5dfe3a92004-06-21 16:55:25 +000024namespace llvm {
Chris Lattneraf53a872006-11-04 05:27:39 +000025 class PPCTargetMachine;
Chris Lattneraf53a872006-11-04 05:27:39 +000026 class FunctionPass;
Hal Finkela8b289b2013-01-25 23:05:59 +000027 class ImmutablePass;
Chris Lattner8d63ba82010-11-14 21:09:28 +000028 class JITCodeEmitter;
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;
Craig Topper79aa3412012-03-17 18:46:09 +000032
Hal Finkelb1fd3cd2013-05-15 21:37:41 +000033 FunctionPass *createPPCCTRLoops(PPCTargetMachine &TM);
Hal Finkele50c8c12013-05-20 16:08:17 +000034#ifndef NDEBUG
35 FunctionPass *createPPCCTRLoopsVerify();
36#endif
Hal Finkel5ee67e82013-04-08 16:24:03 +000037 FunctionPass *createPPCEarlyReturnPass();
Chris Lattner6d2ff122010-11-15 03:13:19 +000038 FunctionPass *createPPCBranchSelectionPass();
39 FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
40 FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
41 JITCodeEmitter &MCE);
Chris Lattner6d2ff122010-11-15 03:13:19 +000042 void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
Ulrich Weigandea18f0c2013-06-20 16:58:14 +000043 AsmPrinter &AP);
Hal Finkela8b289b2013-01-25 23:05:59 +000044
45 /// \brief Creates an PPC-specific Target Transformation Info pass.
46 ImmutablePass *createPPCTargetTransformInfoPass(const PPCTargetMachine *TM);
Hal Finkel5ee67e82013-04-08 16:24:03 +000047
Chris Lattnerb9082582010-11-14 23:42:06 +000048 namespace PPCII {
49
50 /// Target Operand Flag enum.
51 enum TOF {
52 //===------------------------------------------------------------------===//
53 // PPC Specific MachineOperand flags.
54 MO_NO_FLAG,
55
56 /// MO_DARWIN_STUB - On a symbol operand "FOO", this indicates that the
57 /// reference is actually to the "FOO$stub" symbol. This is used for calls
58 /// and jumps to external functions on Tiger and earlier.
Chris Lattner6d2ff122010-11-15 03:13:19 +000059 MO_DARWIN_STUB = 1,
Chris Lattnerb9082582010-11-14 23:42:06 +000060
Chris Lattner6d2ff122010-11-15 03:13:19 +000061 /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
62 /// the function's picbase, e.g. lo16(symbol-picbase).
Bill Schmidt06ab2c82013-02-21 00:05:29 +000063 MO_PIC_FLAG = 2,
Chris Lattner6d2ff122010-11-15 03:13:19 +000064
65 /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
66 /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
Bill Schmidt06ab2c82013-02-21 00:05:29 +000067 MO_NLP_FLAG = 4,
Chris Lattner1e61e692010-11-15 02:46:57 +000068
Chris Lattner6d2ff122010-11-15 03:13:19 +000069 /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
70 /// symbol with hidden visibility. This causes a different kind of
71 /// non-lazy-pointer to be generated.
Bill Schmidt06ab2c82013-02-21 00:05:29 +000072 MO_NLP_HIDDEN_FLAG = 8,
Roman Divackyfd42ed62012-06-04 17:36:38 +000073
74 /// The next are not flags but distinct values.
Bill Schmidt06ab2c82013-02-21 00:05:29 +000075 MO_ACCESS_MASK = 0xf0,
Roman Divackyfd42ed62012-06-04 17:36:38 +000076
77 /// MO_LO16, MO_HA16 - lo16(symbol) and ha16(symbol)
Bill Schmidt06ab2c82013-02-21 00:05:29 +000078 MO_LO16 = 1 << 4,
79 MO_HA16 = 2 << 4,
Roman Divackyfd42ed62012-06-04 17:36:38 +000080
Bill Schmidt06ab2c82013-02-21 00:05:29 +000081 MO_TPREL16_HA = 3 << 4,
82 MO_TPREL16_LO = 4 << 4,
83
84 /// These values identify relocations on immediates folded
85 /// into memory operations.
86 MO_DTPREL16_LO = 5 << 4,
87 MO_TLSLD16_LO = 6 << 4,
88 MO_TOC16_LO = 7 << 4
Chris Lattnerb9082582010-11-14 23:42:06 +000089 };
90 } // end namespace PPCII
91
Misha Brukman5dfe3a92004-06-21 16:55:25 +000092} // end namespace llvm;
93
Misha Brukman5dfe3a92004-06-21 16:55:25 +000094#endif