blob: 4b9f0e1b1b75c8669b8d76712d30af3fc3ac5646 [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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000015#ifndef LLVM_LIB_TARGET_POWERPC_PPC_H
16#define LLVM_LIB_TARGET_POWERPC_PPC_H
Misha Brukmane05203f2004-06-21 16:55:25 +000017
Hiroshi Inoue51020282017-06-27 04:52:17 +000018#include "llvm/Support/CodeGen.h"
Evan Chengbc153d42011-07-14 20:59:42 +000019#include "MCTargetDesc/PPCMCTargetDesc.h"
Chris Lattneraac9fa72010-11-15 08:49:58 +000020
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;
Chris Lattner5c1b0cd2010-11-14 21:12:33 +000028 class MachineInstr;
Tim Shencee75362017-09-22 18:30:02 +000029 class MachineOperand;
Chris Lattner5c1b0cd2010-11-14 21:12:33 +000030 class AsmPrinter;
Chris Lattner9ec375c2010-11-15 04:16:32 +000031 class MCInst;
Tim Shencee75362017-09-22 18:30:02 +000032 class MCOperand;
Craig Topperb25fda92012-03-17 18:46:09 +000033
Eric Christopherb16eacf2017-06-29 23:28:45 +000034 FunctionPass *createPPCCTRLoops();
Hal Finkel8ca38842013-05-20 16:08:17 +000035#ifndef NDEBUG
36 FunctionPass *createPPCCTRLoopsVerify();
37#endif
Hal Finkelc9dd0202015-02-05 18:43:00 +000038 FunctionPass *createPPCLoopPreIncPrepPass(PPCTargetMachine &TM);
Hal Finkel8340de12015-05-18 06:25:59 +000039 FunctionPass *createPPCTOCRegDepsPass();
Hal Finkelb5aa7e52013-04-08 16:24:03 +000040 FunctionPass *createPPCEarlyReturnPass();
Hal Finkel27774d92014-03-13 07:58:58 +000041 FunctionPass *createPPCVSXCopyPass();
Hal Finkel174e5902014-03-25 23:29:21 +000042 FunctionPass *createPPCVSXFMAMutatePass();
Bill Schmidtfe723b92015-04-27 19:57:34 +000043 FunctionPass *createPPCVSXSwapRemovalPass();
Bill Schmidt34af5e12015-11-10 21:38:26 +000044 FunctionPass *createPPCMIPeepholePass();
Chris Lattnerdd6df842010-11-15 03:13:19 +000045 FunctionPass *createPPCBranchSelectionPass();
Lei Huang34e66212017-09-12 18:39:11 +000046 FunctionPass *createPPCBranchCoalescingPass();
Hal Finkelfc353912016-03-31 20:39:41 +000047 FunctionPass *createPPCQPXLoadSplatPass();
Hiroshi Inoue51020282017-06-27 04:52:17 +000048 FunctionPass *createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL);
Bill Schmidt82f1c772015-02-10 19:09:05 +000049 FunctionPass *createPPCTLSDynamicCallPass();
Eric Christopher9fd267c2017-03-31 02:16:54 +000050 FunctionPass *createPPCBoolRetToIntPass();
Tony Jiang8e8c4442017-01-16 20:12:26 +000051 FunctionPass *createPPCExpandISELPass();
Chris Lattnerdd6df842010-11-15 03:13:19 +000052 void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
Ulrich Weigand266db7f2013-07-08 20:20:51 +000053 AsmPrinter &AP, bool isDarwin);
Tim Shencee75362017-09-22 18:30:02 +000054 bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
55 MCOperand &OutMO, AsmPrinter &AP,
56 bool isDarwin);
Hal Finkel4e5ca9e2013-01-25 23:05:59 +000057
Hal Finkel174e5902014-03-25 23:29:21 +000058 void initializePPCVSXFMAMutatePass(PassRegistry&);
Kit Bartona1c712f2015-12-07 20:50:29 +000059 void initializePPCBoolRetToIntPass(PassRegistry&);
Tony Jiang8e8c4442017-01-16 20:12:26 +000060 void initializePPCExpandISELPass(PassRegistry &);
Hiroshi Inoue6989caa2017-06-29 14:13:38 +000061 void initializePPCTLSDynamicCallPass(PassRegistry &);
Hal Finkel174e5902014-03-25 23:29:21 +000062 extern char &PPCVSXFMAMutateID;
63
Chris Lattnerdf8e17d2010-11-14 23:42:06 +000064 namespace PPCII {
65
66 /// Target Operand Flag enum.
67 enum TOF {
68 //===------------------------------------------------------------------===//
69 // PPC Specific MachineOperand flags.
70 MO_NO_FLAG,
Rafael Espindolaa99ccfc2016-06-29 14:59:50 +000071
72 /// On a symbol operand "FOO", this indicates that the reference is actually
73 /// to "FOO@plt". This is used for calls and jumps to external functions on
Hal Finkel3ee2af72014-07-18 23:29:49 +000074 /// for PIC calls on Linux and ELF systems.
Rafael Espindolaa99ccfc2016-06-29 14:59:50 +000075 MO_PLT = 1,
76
Chris Lattnerdd6df842010-11-15 03:13:19 +000077 /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
78 /// the function's picbase, e.g. lo16(symbol-picbase).
Bill Schmidt3822ef22013-02-21 00:05:29 +000079 MO_PIC_FLAG = 2,
Chris Lattnerdd6df842010-11-15 03:13:19 +000080
81 /// MO_NLP_FLAG - If this bit is set, the symbol reference is actually to
82 /// the non_lazy_ptr for the global, e.g. lo16(symbol$non_lazy_ptr-picbase).
Bill Schmidt3822ef22013-02-21 00:05:29 +000083 MO_NLP_FLAG = 4,
Rafael Espindolaa99ccfc2016-06-29 14:59:50 +000084
Chris Lattnerdd6df842010-11-15 03:13:19 +000085 /// MO_NLP_HIDDEN_FLAG - If this bit is set, the symbol reference is to a
86 /// symbol with hidden visibility. This causes a different kind of
87 /// non-lazy-pointer to be generated.
Bill Schmidt3822ef22013-02-21 00:05:29 +000088 MO_NLP_HIDDEN_FLAG = 8,
Roman Divackye3f15c982012-06-04 17:36:38 +000089
90 /// The next are not flags but distinct values.
Bill Schmidt3822ef22013-02-21 00:05:29 +000091 MO_ACCESS_MASK = 0xf0,
Roman Divackye3f15c982012-06-04 17:36:38 +000092
Ulrich Weigandd51c09f2013-06-21 14:42:20 +000093 /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
94 MO_LO = 1 << 4,
95 MO_HA = 2 << 4,
Roman Divackye3f15c982012-06-04 17:36:38 +000096
Ulrich Weigandd51c09f2013-06-21 14:42:20 +000097 MO_TPREL_LO = 4 << 4,
98 MO_TPREL_HA = 3 << 4,
Bill Schmidt3822ef22013-02-21 00:05:29 +000099
100 /// These values identify relocations on immediates folded
101 /// into memory operations.
Ulrich Weigandd51c09f2013-06-21 14:42:20 +0000102 MO_DTPREL_LO = 5 << 4,
Rafael Espindolaa99ccfc2016-06-29 14:59:50 +0000103 MO_TLSLD_LO = 6 << 4,
104 MO_TOC_LO = 7 << 4,
Ulrich Weigand5b427592013-07-05 12:22:36 +0000105
106 // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
Rafael Espindolaa99ccfc2016-06-29 14:59:50 +0000107 MO_TLS = 8 << 4
Chris Lattnerdf8e17d2010-11-14 23:42:06 +0000108 };
109 } // end namespace PPCII
110
Alexander Kornienkof00654e2015-06-23 09:49:53 +0000111} // end namespace llvm;
Misha Brukmane05203f2004-06-21 16:55:25 +0000112
Misha Brukmane05203f2004-06-21 16:55:25 +0000113#endif