- Eliminate MCCodeEmitter's dependency on TargetMachine. It now uses MCInstrInfo
[oota-llvm.git] / lib / Target / PowerPC / PPC.h
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_TARGET_POWERPC_H
16 #define LLVM_TARGET_POWERPC_H
17
18 #include <string>
19
20 // GCC #defines PPC on Linux but we use it as our namespace name
21 #undef PPC
22
23 namespace llvm {
24   class PPCTargetMachine;
25   class FunctionPass;
26   class formatted_raw_ostream;
27   class JITCodeEmitter;
28   class Target;
29   class MachineInstr;
30   class AsmPrinter;
31   class MCInst;
32   class MCCodeEmitter;
33   class MCContext;
34   class MCInstrInfo;
35   class MCSubtargetInfo;
36   class TargetMachine;
37   class TargetAsmBackend;
38   
39   FunctionPass *createPPCBranchSelectionPass();
40   FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
41   FunctionPass *createPPCJITCodeEmitterPass(PPCTargetMachine &TM,
42                                             JITCodeEmitter &MCE);
43   MCCodeEmitter *createPPCMCCodeEmitter(const MCInstrInfo &MCII,
44                                         const MCSubtargetInfo &STI,
45                                         MCContext &Ctx);
46   TargetAsmBackend *createPPCAsmBackend(const Target &, const std::string &);
47   
48   void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
49                                     AsmPrinter &AP, bool isDarwin);
50   
51   extern Target ThePPC32Target;
52   extern Target ThePPC64Target;
53   
54   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.
65     MO_DARWIN_STUB = 1,
66     
67     /// MO_LO16, MO_HA16 - lo16(symbol) and ha16(symbol)
68     MO_LO16 = 4, MO_HA16 = 8,
69
70     /// 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,
77     
78     /// 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
82   };
83   } // end namespace PPCII
84   
85 } // end namespace llvm;
86
87 // Defines symbolic names for PowerPC registers.  This defines a mapping from
88 // register name to register number.
89 //
90 #define GET_REGINFO_ENUM
91 #include "PPCGenRegisterInfo.inc"
92
93 // Defines symbolic names for the PowerPC instructions.
94 //
95 #define GET_INSTRINFO_ENUM
96 #include "PPCGenInstrInfo.inc"
97
98 #endif