Custom lower all BUILD_VECTOR's so that we can compile vec_splat_u8(8) into
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9Internals.h
1 //===-- SparcV9Internals.h --------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines stuff that is to be private to the SparcV9 backend, but is
11 // shared among different portions of the backend.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef SPARCV9INTERNALS_H
16 #define SPARCV9INTERNALS_H
17
18 #include "llvm/CodeGen/MachineInstrBuilder.h"
19 #include "llvm/Target/TargetMachine.h"
20 #include "llvm/Target/TargetSchedInfo.h"
21 #include "llvm/Target/TargetFrameInfo.h"
22 #include "SparcV9RegInfo.h"
23 #include "llvm/Type.h"
24 #include "SparcV9RegClassInfo.h"
25
26 namespace llvm {
27
28 class V9LiveRange;
29 class SparcV9TargetMachine;
30 class ModulePass;
31 class GetElementPtrInst;
32
33 enum SparcV9InstrSchedClass {
34   SPARC_NONE,           /* Instructions with no scheduling restrictions */
35   SPARC_IEUN,           /* Integer class that can use IEU0 or IEU1 */
36   SPARC_IEU0,           /* Integer class IEU0 */
37   SPARC_IEU1,           /* Integer class IEU1 */
38   SPARC_FPM,            /* FP Multiply or Divide instructions */
39   SPARC_FPA,            /* All other FP instructions */
40   SPARC_CTI,            /* Control-transfer instructions */
41   SPARC_LD,             /* Load instructions */
42   SPARC_ST,             /* Store instructions */
43   SPARC_SINGLE,         /* Instructions that must issue by themselves */
44
45   SPARC_INV,            /* This should stay at the end for the next value */
46   SPARC_NUM_SCHED_CLASSES = SPARC_INV
47 };
48
49
50 //---------------------------------------------------------------------------
51 // enum SparcV9MachineOpCode.
52 // const TargetInstrDescriptor SparcV9MachineInstrDesc[]
53 //
54 // Purpose:
55 //   Description of UltraSparcV9 machine instructions.
56 //
57 //---------------------------------------------------------------------------
58
59 namespace V9 {
60   enum SparcV9MachineOpCode {
61 #define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \
62           NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS)             \
63    ENUM,
64 #include "SparcV9Instr.def"
65
66     // End-of-array marker
67     INVALID_OPCODE,
68     NUM_REAL_OPCODES = PHI,             // number of valid opcodes
69     NUM_TOTAL_OPCODES = INVALID_OPCODE
70   };
71 }
72
73 // Array of machine instruction descriptions...
74 extern const TargetInstrDescriptor SparcV9MachineInstrDesc[];
75
76 //---------------------------------------------------------------------------
77 // class SparcV9SchedInfo
78 //
79 // Purpose:
80 //   Interface to instruction scheduling information for UltraSPARC.
81 //   The parameter values above are based on UltraSPARC IIi.
82 //---------------------------------------------------------------------------
83
84 class SparcV9SchedInfo: public TargetSchedInfo {
85 public:
86   SparcV9SchedInfo(const TargetMachine &tgt);
87 protected:
88   virtual void initializeResources();
89 };
90
91 /// createStackSlotsPass - External interface to stack-slots pass that enters 2
92 /// empty slots at the top of each function stack
93 ///
94 FunctionPass *createStackSlotsPass(const TargetMachine &TM);
95
96 /// Specializes LLVM code for a target machine.
97 ///
98 FunctionPass *createPreSelectionPass(const TargetMachine &TM);
99
100 // DecomposeMultiDimRefs - Convert multi-dimensional references consisting of
101 // any combination of 2 or more array and structure indices into a sequence of
102 // instructions (using getelementpr and cast) so that each instruction has at
103 // most one index (except structure references, which need an extra leading
104 // index of [0]).
105 // This pass decomposes all multi-dimensional references in a function.
106 FunctionPass *createDecomposeMultiDimRefsPass();
107
108 // This function decomposes a single instance of such a reference.
109 // Return value: true if the instruction was replaced; false otherwise.
110 //
111 bool DecomposeArrayRef(GetElementPtrInst* GEP);
112
113 /// Peephole optimization pass operating on machine code
114 ///
115 FunctionPass *createPeepholeOptsPass(const TargetMachine &TM);
116
117 /// Writes out assembly code for the module, one function at a time
118 ///
119 FunctionPass *createAsmPrinterPass(std::ostream &Out, TargetMachine &TM);
120
121 /// getPrologEpilogInsertionPass - Inserts prolog/epilog code.
122 ///
123 FunctionPass* createPrologEpilogInsertionPass();
124
125 /// getBytecodeAsmPrinterPass - Emits final LLVM bytecode to assembly file.
126 ///
127 ModulePass* createBytecodeAsmPrinterPass(std::ostream &Out);
128
129 FunctionPass *createSparcV9MachineCodeDestructionPass();
130
131 } // End llvm namespace
132
133 #endif