1 //===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the entry points for global functions defined in the LLVM
11 // PowerPC back-end.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_POWERPC_PPC_H
16 #define LLVM_LIB_TARGET_POWERPC_PPC_H
17 
18 #include "llvm/Support/CodeGen.h"
19 #include "MCTargetDesc/PPCMCTargetDesc.h"
20 
21 // GCC #defines PPC on Linux but we use it as our namespace name
22 #undef PPC
23 
24 namespace llvm {
25   class PPCTargetMachine;
26   class PassRegistry;
27   class FunctionPass;
28   class MachineInstr;
29   class MachineOperand;
30   class AsmPrinter;
31   class MCInst;
32   class MCOperand;
33 
34   FunctionPass *createPPCCTRLoops();
35 #ifndef NDEBUG
36   FunctionPass *createPPCCTRLoopsVerify();
37 #endif
38   FunctionPass *createPPCLoopPreIncPrepPass(PPCTargetMachine &TM);
39   FunctionPass *createPPCTOCRegDepsPass();
40   FunctionPass *createPPCEarlyReturnPass();
41   FunctionPass *createPPCVSXCopyPass();
42   FunctionPass *createPPCVSXFMAMutatePass();
43   FunctionPass *createPPCVSXSwapRemovalPass();
44   FunctionPass *createPPCMIPeepholePass();
45   FunctionPass *createPPCBranchSelectionPass();
46   FunctionPass *createPPCBranchCoalescingPass();
47   FunctionPass *createPPCQPXLoadSplatPass();
48   FunctionPass *createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL);
49   FunctionPass *createPPCTLSDynamicCallPass();
50   FunctionPass *createPPCBoolRetToIntPass();
51   FunctionPass *createPPCExpandISELPass();
52   void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
53                                     AsmPrinter &AP, bool isDarwin);
54   bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
55                                          MCOperand &OutMO, AsmPrinter &AP,
56                                          bool isDarwin);
57 
58   void initializePPCVSXFMAMutatePass(PassRegistry&);
59   void initializePPCBoolRetToIntPass(PassRegistry&);
60   void initializePPCExpandISELPass(PassRegistry &);
61   void initializePPCTLSDynamicCallPass(PassRegistry &);
62   extern char &PPCVSXFMAMutateID;
63 
64   namespace PPCII {
65 
66   /// Target Operand Flag enum.
67   enum TOF {
68     //===------------------------------------------------------------------===//
69     // PPC Specific MachineOperand flags.
70     MO_NO_FLAG,
71 
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
74     /// for PIC calls on Linux and ELF systems.
75     MO_PLT = 1,
76 
77     /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
78     /// the function's picbase, e.g. lo16(symbol-picbase).
79     MO_PIC_FLAG = 2,
80 
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).
83     MO_NLP_FLAG = 4,
84 
85     /// 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.
88     MO_NLP_HIDDEN_FLAG = 8,
89 
90     /// The next are not flags but distinct values.
91     MO_ACCESS_MASK = 0xf0,
92 
93     /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
94     MO_LO = 1 << 4,
95     MO_HA = 2 << 4,
96 
97     MO_TPREL_LO = 4 << 4,
98     MO_TPREL_HA = 3 << 4,
99 
100     /// These values identify relocations on immediates folded
101     /// into memory operations.
102     MO_DTPREL_LO = 5 << 4,
103     MO_TLSLD_LO = 6 << 4,
104     MO_TOC_LO = 7 << 4,
105 
106     // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
107     MO_TLS = 8 << 4
108   };
109   } // end namespace PPCII
110 
111 } // end namespace llvm;
112 
113 #endif
114