blob: ba5fa4f79b4e757b4ddc589bdcfdfab9eff2bb7d [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
Evan Chengbc153d42011-07-14 20:59:42 +000018#include "MCTargetDesc/PPCMCTargetDesc.h"
Chris Lattneraac9fa72010-11-15 08:49:58 +000019#include <string>
20
Chris Lattner6be72602006-11-04 05:27:39 +000021// GCC #defines PPC on Linux but we use it as our namespace name
22#undef PPC
23
Misha Brukmane05203f2004-06-21 16:55:25 +000024namespace llvm {
Chris Lattner6be72602006-11-04 05:27:39 +000025 class PPCTargetMachine;
Hal Finkel174e5902014-03-25 23:29:21 +000026 class PassRegistry;
Chris Lattner6be72602006-11-04 05:27:39 +000027 class FunctionPass;
Hal Finkel4e5ca9e2013-01-25 23:05:59 +000028 class ImmutablePass;
Eric Christopherb9fd9ed2014-08-07 22:02:54 +000029 class JITCodeEmitter;
Chris Lattner5c1b0cd2010-11-14 21:12:33 +000030 class MachineInstr;
Chris Lattner5c1b0cd2010-11-14 21:12:33 +000031 class AsmPrinter;
Chris Lattner9ec375c2010-11-15 04:16:32 +000032 class MCInst;
Craig Topperb25fda92012-03-17 18:46:09 +000033
Hal Finkel25c19922013-05-15 21:37:41 +000034 FunctionPass *createPPCCTRLoops(PPCTargetMachine &TM);
Hal Finkel8ca38842013-05-20 16:08:17 +000035#ifndef NDEBUG
36 FunctionPass *createPPCCTRLoopsVerify();
37#endif
Hal Finkelb5aa7e52013-04-08 16:24:03 +000038 FunctionPass *createPPCEarlyReturnPass();
Hal Finkel27774d92014-03-13 07:58:58 +000039 FunctionPass *createPPCVSXCopyPass();
Hal Finkelc6fc9b82014-03-27 23:12:31 +000040 FunctionPass *createPPCVSXCopyCleanupPass();
Hal Finkel174e5902014-03-25 23:29:21 +000041 FunctionPass *createPPCVSXFMAMutatePass();
Chris Lattnerdd6df842010-11-15 03:13:19 +000042 FunctionPass *createPPCBranchSelectionPass();
43 FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
Eric Christopherb9fd9ed2014-08-07 22:02:54 +000044 FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
45 JITCodeEmitter &MCE);
Chris Lattnerdd6df842010-11-15 03:13:19 +000046 void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
Ulrich Weigand266db7f2013-07-08 20:20:51 +000047 AsmPrinter &AP, bool isDarwin);
Hal Finkel4e5ca9e2013-01-25 23:05:59 +000048
49 /// \brief Creates an PPC-specific Target Transformation Info pass.
50 ImmutablePass *createPPCTargetTransformInfoPass(const PPCTargetMachine *TM);
Hal Finkelb5aa7e52013-04-08 16:24:03 +000051
Hal Finkel174e5902014-03-25 23:29:21 +000052 void initializePPCVSXFMAMutatePass(PassRegistry&);
53 extern char &PPCVSXFMAMutateID;
54
Chris Lattnerdf8e17d2010-11-14 23:42:06 +000055 namespace PPCII {
56
57 /// Target Operand Flag enum.
58 enum TOF {
59 //===------------------------------------------------------------------===//
60 // PPC Specific MachineOperand flags.
61 MO_NO_FLAG,
62
Hal Finkel3ee2af72014-07-18 23:29:49 +000063 /// MO_PLT_OR_STUB - On a symbol operand "FOO", this indicates that the
64 /// reference is actually to the "FOO$stub" or "FOO@plt" symbol. This is
65 /// used for calls and jumps to external functions on Tiger and earlier, and
66 /// for PIC calls on Linux and ELF systems.
67 MO_PLT_OR_STUB = 1,
Chris Lattnerdf8e17d2010-11-14 23:42:06 +000068
Chris Lattnerdd6df842010-11-15 03:13:19 +000069 /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
70 /// the function's picbase, e.g. lo16(symbol-picbase).
Bill Schmidt3822ef22013-02-21 00:05:29 +000071 MO_PIC_FLAG = 2,
Chris Lattnerdd6df842010-11-15 03:13:19 +000072
73 /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
74 /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
Bill Schmidt3822ef22013-02-21 00:05:29 +000075 MO_NLP_FLAG = 4,
Chris Lattneredb9d842010-11-15 02:46:57 +000076
Chris Lattnerdd6df842010-11-15 03:13:19 +000077 /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
78 /// symbol with hidden visibility. This causes a different kind of
79 /// non-lazy-pointer to be generated.
Bill Schmidt3822ef22013-02-21 00:05:29 +000080 MO_NLP_HIDDEN_FLAG = 8,
Roman Divackye3f15c982012-06-04 17:36:38 +000081
82 /// The next are not flags but distinct values.
Bill Schmidt3822ef22013-02-21 00:05:29 +000083 MO_ACCESS_MASK = 0xf0,
Roman Divackye3f15c982012-06-04 17:36:38 +000084
Ulrich Weigandd51c09f2013-06-21 14:42:20 +000085 /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
86 MO_LO = 1 << 4,
87 MO_HA = 2 << 4,
Roman Divackye3f15c982012-06-04 17:36:38 +000088
Ulrich Weigandd51c09f2013-06-21 14:42:20 +000089 MO_TPREL_LO = 4 << 4,
90 MO_TPREL_HA = 3 << 4,
Bill Schmidt3822ef22013-02-21 00:05:29 +000091
92 /// These values identify relocations on immediates folded
93 /// into memory operations.
Ulrich Weigandd51c09f2013-06-21 14:42:20 +000094 MO_DTPREL_LO = 5 << 4,
95 MO_TLSLD_LO = 6 << 4,
Ulrich Weigand5b427592013-07-05 12:22:36 +000096 MO_TOC_LO = 7 << 4,
97
98 // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
99 MO_TLS = 8 << 4
Chris Lattnerdf8e17d2010-11-14 23:42:06 +0000100 };
101 } // end namespace PPCII
102
Misha Brukmane05203f2004-06-21 16:55:25 +0000103} // end namespace llvm;
104
Misha Brukmane05203f2004-06-21 16:55:25 +0000105#endif