Uniformize capitalization of NodeId.
[oota-llvm.git] / lib / CodeGen / SelectionDAG / LegalizeTypes.h
1 //===-- LegalizeTypes.h - Definition of the DAG Type Legalizer class ------===//
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 defines the DAGTypeLegalizer class.  This is a private interface
11 // shared between the code that implements the SelectionDAG::LegalizeTypes
12 // method.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef SELECTIONDAG_LEGALIZETYPES_H
17 #define SELECTIONDAG_LEGALIZETYPES_H
18
19 #define DEBUG_TYPE "legalize-types"
20 #include "llvm/CodeGen/SelectionDAG.h"
21 #include "llvm/Target/TargetLowering.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/Support/Compiler.h"
24 #include "llvm/Support/Debug.h"
25
26 namespace llvm {
27
28 //===----------------------------------------------------------------------===//
29 /// DAGTypeLegalizer - This takes an arbitrary SelectionDAG as input and hacks
30 /// on it until only value types the target machine can handle are left.  This
31 /// involves promoting small sizes to large sizes or splitting up large values
32 /// into small values.
33 ///
34 class VISIBILITY_HIDDEN DAGTypeLegalizer {
35   TargetLowering &TLI;
36   SelectionDAG &DAG;
37 public:
38   // NodeIdFlags - This pass uses the NodeId on the SDNodes to hold information
39   // about the state of the node.  The enum has all the values.
40   enum NodeIdFlags {
41     /// ReadyToProcess - All operands have been processed, so this node is ready
42     /// to be handled.
43     ReadyToProcess = 0,
44
45     /// NewNode - This is a new node that was created in the process of
46     /// legalizing some other node.
47     NewNode = -1,
48
49     /// Processed - This is a node that has already been processed.
50     Processed = -2
51
52     // 1+ - This is a node which has this many unlegalized operands.
53   };
54 private:
55   enum LegalizeAction {
56     Legal,           // The target natively supports this type.
57     PromoteInteger,  // Replace this integer type with a larger one.
58     ExpandInteger,   // Split this integer type into two of half the size.
59     SoftenFloat,     // Convert this float type to a same size integer type.
60     ExpandFloat,     // Split this float type into two of half the size.
61     ScalarizeVector, // Replace this one-element vector with its element type.
62     SplitVector      // This vector type should be split into smaller vectors.
63   };
64
65   /// ValueTypeActions - This is a bitvector that contains two bits for each
66   /// simple value type, where the two bits correspond to the LegalizeAction
67   /// enum from TargetLowering.  This can be queried with "getTypeAction(VT)".
68   TargetLowering::ValueTypeActionImpl ValueTypeActions;
69
70   /// getTypeAction - Return how we should legalize values of this type, either
71   /// it is already legal, or we need to promote it to a larger integer type, or
72   /// we need to expand it into multiple registers of a smaller integer type, or
73   /// we need to split a vector type into smaller vector types, or we need to
74   /// convert it to a different type of the same size.
75   LegalizeAction getTypeAction(MVT VT) const {
76     switch (ValueTypeActions.getTypeAction(VT)) {
77     default:
78       assert(false && "Unknown legalize action!");
79     case TargetLowering::Legal:
80       return Legal;
81     case TargetLowering::Promote:
82       return PromoteInteger;
83     case TargetLowering::Expand:
84       // Expand can mean
85       // 1) split scalar in half, 2) convert a float to an integer,
86       // 3) scalarize a single-element vector, 4) split a vector in two.
87       if (!VT.isVector()) {
88         if (VT.isInteger())
89           return ExpandInteger;
90         else if (VT.getSizeInBits() ==
91                  TLI.getTypeToTransformTo(VT).getSizeInBits())
92           return SoftenFloat;
93         else
94           return ExpandFloat;
95       } else if (VT.getVectorNumElements() == 1) {
96         return ScalarizeVector;
97       } else {
98         return SplitVector;
99       }
100     }
101   }
102
103   /// isTypeLegal - Return true if this type is legal on this target.
104   bool isTypeLegal(MVT VT) const {
105     return ValueTypeActions.getTypeAction(VT) == TargetLowering::Legal;
106   }
107
108   /// IgnoreNodeResults - Pretend all of this node's results are legal.
109   bool IgnoreNodeResults(SDNode *N) const {
110     return N->getOpcode() == ISD::TargetConstant;
111   }
112
113   /// PromotedIntegers - For integer nodes that are below legal width, this map
114   /// indicates what promoted value to use.
115   DenseMap<SDValue, SDValue> PromotedIntegers;
116
117   /// ExpandedIntegers - For integer nodes that need to be expanded this map
118   /// indicates which operands are the expanded version of the input.
119   DenseMap<SDValue, std::pair<SDValue, SDValue> > ExpandedIntegers;
120
121   /// SoftenedFloats - For floating point nodes converted to integers of
122   /// the same size, this map indicates the converted value to use.
123   DenseMap<SDValue, SDValue> SoftenedFloats;
124
125   /// ExpandedFloats - For float nodes that need to be expanded this map
126   /// indicates which operands are the expanded version of the input.
127   DenseMap<SDValue, std::pair<SDValue, SDValue> > ExpandedFloats;
128
129   /// ScalarizedVectors - For nodes that are <1 x ty>, this map indicates the
130   /// scalar value of type 'ty' to use.
131   DenseMap<SDValue, SDValue> ScalarizedVectors;
132
133   /// SplitVectors - For nodes that need to be split this map indicates
134   /// which operands are the expanded version of the input.
135   DenseMap<SDValue, std::pair<SDValue, SDValue> > SplitVectors;
136
137   /// ReplacedValues - For values that have been replaced with another,
138   /// indicates the replacement value to use.
139   DenseMap<SDValue, SDValue> ReplacedValues;
140
141   /// Worklist - This defines a worklist of nodes to process.  In order to be
142   /// pushed onto this worklist, all operands of a node must have already been
143   /// processed.
144   SmallVector<SDNode*, 128> Worklist;
145
146 public:
147   explicit DAGTypeLegalizer(SelectionDAG &dag)
148     : TLI(dag.getTargetLoweringInfo()), DAG(dag),
149     ValueTypeActions(TLI.getValueTypeActions()) {
150     assert(MVT::LAST_VALUETYPE <= 32 &&
151            "Too many value types for ValueTypeActions to hold!");
152   }
153
154   void run();
155
156   /// ReanalyzeNode - Recompute the NodeId and correct processed operands
157   /// for the specified node, adding it to the worklist if ready.
158   void ReanalyzeNode(SDNode *N) {
159     N->setNodeId(NewNode);
160     AnalyzeNewNode(N);
161     // The node may have changed but we don't care.
162   }
163
164   void NoteDeletion(SDNode *Old, SDNode *New) {
165     ExpungeNode(Old);
166     ExpungeNode(New);
167     for (unsigned i = 0, e = Old->getNumValues(); i != e; ++i)
168       ReplacedValues[SDValue(Old, i)] = SDValue(New, i);
169   }
170
171 private:
172   SDNode *AnalyzeNewNode(SDNode *N);
173   void AnalyzeNewValue(SDValue &Val);
174
175   void ReplaceValueWith(SDValue From, SDValue To);
176   void ReplaceNodeWith(SDNode *From, SDNode *To);
177
178   void RemapValue(SDValue &N);
179   void ExpungeNode(SDNode *N);
180
181   // Common routines.
182   SDValue CreateStackStoreLoad(SDValue Op, MVT DestVT);
183   SDValue MakeLibCall(RTLIB::Libcall LC, MVT RetVT,
184                         const SDValue *Ops, unsigned NumOps, bool isSigned);
185
186   SDValue BitConvertToInteger(SDValue Op);
187   SDValue JoinIntegers(SDValue Lo, SDValue Hi);
188   void SplitInteger(SDValue Op, SDValue &Lo, SDValue &Hi);
189   void SplitInteger(SDValue Op, MVT LoVT, MVT HiVT,
190                     SDValue &Lo, SDValue &Hi);
191
192   SDValue GetVectorElementPointer(SDValue VecPtr, MVT EltVT, SDValue Index);
193
194   //===--------------------------------------------------------------------===//
195   // Integer Promotion Support: LegalizeIntegerTypes.cpp
196   //===--------------------------------------------------------------------===//
197
198   SDValue GetPromotedInteger(SDValue Op) {
199     SDValue &PromotedOp = PromotedIntegers[Op];
200     RemapValue(PromotedOp);
201     assert(PromotedOp.getNode() && "Operand wasn't promoted?");
202     return PromotedOp;
203   }
204   void SetPromotedInteger(SDValue Op, SDValue Result);
205
206   /// ZExtPromotedInteger - Get a promoted operand and zero extend it to the
207   /// final size.
208   SDValue ZExtPromotedInteger(SDValue Op) {
209     MVT OldVT = Op.getValueType();
210     Op = GetPromotedInteger(Op);
211     return DAG.getZeroExtendInReg(Op, OldVT);
212   }
213
214   // Integer Result Promotion.
215   void PromoteIntegerResult(SDNode *N, unsigned ResNo);
216   SDValue PromoteIntRes_AssertSext(SDNode *N);
217   SDValue PromoteIntRes_AssertZext(SDNode *N);
218   SDValue PromoteIntRes_Atomic1(AtomicSDNode *N);
219   SDValue PromoteIntRes_Atomic2(AtomicSDNode *N);
220   SDValue PromoteIntRes_BIT_CONVERT(SDNode *N);
221   SDValue PromoteIntRes_BSWAP(SDNode *N);
222   SDValue PromoteIntRes_BUILD_PAIR(SDNode *N);
223   SDValue PromoteIntRes_Constant(SDNode *N);
224   SDValue PromoteIntRes_CTLZ(SDNode *N);
225   SDValue PromoteIntRes_CTPOP(SDNode *N);
226   SDValue PromoteIntRes_CTTZ(SDNode *N);
227   SDValue PromoteIntRes_EXTRACT_VECTOR_ELT(SDNode *N);
228   SDValue PromoteIntRes_FP_TO_XINT(SDNode *N);
229   SDValue PromoteIntRes_INT_EXTEND(SDNode *N);
230   SDValue PromoteIntRes_LOAD(LoadSDNode *N);
231   SDValue PromoteIntRes_SDIV(SDNode *N);
232   SDValue PromoteIntRes_SELECT   (SDNode *N);
233   SDValue PromoteIntRes_SELECT_CC(SDNode *N);
234   SDValue PromoteIntRes_SETCC(SDNode *N);
235   SDValue PromoteIntRes_SHL(SDNode *N);
236   SDValue PromoteIntRes_SimpleIntBinOp(SDNode *N);
237   SDValue PromoteIntRes_SIGN_EXTEND_INREG(SDNode *N);
238   SDValue PromoteIntRes_SRA(SDNode *N);
239   SDValue PromoteIntRes_SRL(SDNode *N);
240   SDValue PromoteIntRes_TRUNCATE(SDNode *N);
241   SDValue PromoteIntRes_UDIV(SDNode *N);
242   SDValue PromoteIntRes_UNDEF(SDNode *N);
243   SDValue PromoteIntRes_VAARG(SDNode *N);
244
245   // Integer Operand Promotion.
246   bool PromoteIntegerOperand(SDNode *N, unsigned OperandNo);
247   SDValue PromoteIntOp_ANY_EXTEND(SDNode *N);
248   SDValue PromoteIntOp_BUILD_PAIR(SDNode *N);
249   SDValue PromoteIntOp_BR_CC(SDNode *N, unsigned OpNo);
250   SDValue PromoteIntOp_BRCOND(SDNode *N, unsigned OpNo);
251   SDValue PromoteIntOp_BUILD_VECTOR(SDNode *N);
252   SDValue PromoteIntOp_FP_EXTEND(SDNode *N);
253   SDValue PromoteIntOp_FP_ROUND(SDNode *N);
254   SDValue PromoteIntOp_INT_TO_FP(SDNode *N);
255   SDValue PromoteIntOp_INSERT_VECTOR_ELT(SDNode *N, unsigned OpNo);
256   SDValue PromoteIntOp_MEMBARRIER(SDNode *N);
257   SDValue PromoteIntOp_SELECT(SDNode *N, unsigned OpNo);
258   SDValue PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo);
259   SDValue PromoteIntOp_SETCC(SDNode *N, unsigned OpNo);
260   SDValue PromoteIntOp_SIGN_EXTEND(SDNode *N);
261   SDValue PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo);
262   SDValue PromoteIntOp_TRUNCATE(SDNode *N);
263   SDValue PromoteIntOp_ZERO_EXTEND(SDNode *N);
264
265   void PromoteSetCCOperands(SDValue &LHS,SDValue &RHS, ISD::CondCode Code);
266
267   //===--------------------------------------------------------------------===//
268   // Integer Expansion Support: LegalizeIntegerTypes.cpp
269   //===--------------------------------------------------------------------===//
270
271   void GetExpandedInteger(SDValue Op, SDValue &Lo, SDValue &Hi);
272   void SetExpandedInteger(SDValue Op, SDValue Lo, SDValue Hi);
273
274   // Integer Result Expansion.
275   void ExpandIntegerResult(SDNode *N, unsigned ResNo);
276   void ExpandIntRes_ANY_EXTEND        (SDNode *N, SDValue &Lo, SDValue &Hi);
277   void ExpandIntRes_AssertSext        (SDNode *N, SDValue &Lo, SDValue &Hi);
278   void ExpandIntRes_AssertZext        (SDNode *N, SDValue &Lo, SDValue &Hi);
279   void ExpandIntRes_Constant          (SDNode *N, SDValue &Lo, SDValue &Hi);
280   void ExpandIntRes_CTLZ              (SDNode *N, SDValue &Lo, SDValue &Hi);
281   void ExpandIntRes_CTPOP             (SDNode *N, SDValue &Lo, SDValue &Hi);
282   void ExpandIntRes_CTTZ              (SDNode *N, SDValue &Lo, SDValue &Hi);
283   void ExpandIntRes_LOAD          (LoadSDNode *N, SDValue &Lo, SDValue &Hi);
284   void ExpandIntRes_SIGN_EXTEND       (SDNode *N, SDValue &Lo, SDValue &Hi);
285   void ExpandIntRes_SIGN_EXTEND_INREG (SDNode *N, SDValue &Lo, SDValue &Hi);
286   void ExpandIntRes_TRUNCATE          (SDNode *N, SDValue &Lo, SDValue &Hi);
287   void ExpandIntRes_ZERO_EXTEND       (SDNode *N, SDValue &Lo, SDValue &Hi);
288   void ExpandIntRes_FP_TO_SINT        (SDNode *N, SDValue &Lo, SDValue &Hi);
289   void ExpandIntRes_FP_TO_UINT        (SDNode *N, SDValue &Lo, SDValue &Hi);
290
291   void ExpandIntRes_Logical           (SDNode *N, SDValue &Lo, SDValue &Hi);
292   void ExpandIntRes_ADDSUB            (SDNode *N, SDValue &Lo, SDValue &Hi);
293   void ExpandIntRes_ADDSUBC           (SDNode *N, SDValue &Lo, SDValue &Hi);
294   void ExpandIntRes_ADDSUBE           (SDNode *N, SDValue &Lo, SDValue &Hi);
295   void ExpandIntRes_BSWAP             (SDNode *N, SDValue &Lo, SDValue &Hi);
296   void ExpandIntRes_MUL               (SDNode *N, SDValue &Lo, SDValue &Hi);
297   void ExpandIntRes_SDIV              (SDNode *N, SDValue &Lo, SDValue &Hi);
298   void ExpandIntRes_SREM              (SDNode *N, SDValue &Lo, SDValue &Hi);
299   void ExpandIntRes_UDIV              (SDNode *N, SDValue &Lo, SDValue &Hi);
300   void ExpandIntRes_UREM              (SDNode *N, SDValue &Lo, SDValue &Hi);
301   void ExpandIntRes_Shift             (SDNode *N, SDValue &Lo, SDValue &Hi);
302
303   void ExpandShiftByConstant(SDNode *N, unsigned Amt,
304                              SDValue &Lo, SDValue &Hi);
305   bool ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi);
306
307   // Integer Operand Expansion.
308   bool ExpandIntegerOperand(SDNode *N, unsigned OperandNo);
309   SDValue ExpandIntOp_BIT_CONVERT(SDNode *N);
310   SDValue ExpandIntOp_BR_CC(SDNode *N);
311   SDValue ExpandIntOp_BUILD_VECTOR(SDNode *N);
312   SDValue ExpandIntOp_EXTRACT_ELEMENT(SDNode *N);
313   SDValue ExpandIntOp_SELECT_CC(SDNode *N);
314   SDValue ExpandIntOp_SETCC(SDNode *N);
315   SDValue ExpandIntOp_SINT_TO_FP(SDNode *N);
316   SDValue ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo);
317   SDValue ExpandIntOp_TRUNCATE(SDNode *N);
318   SDValue ExpandIntOp_UINT_TO_FP(SDNode *N);
319
320   void IntegerExpandSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
321                                   ISD::CondCode &CCCode);
322
323   //===--------------------------------------------------------------------===//
324   // Float to Integer Conversion Support: LegalizeFloatTypes.cpp
325   //===--------------------------------------------------------------------===//
326
327   SDValue GetSoftenedFloat(SDValue Op) {
328     SDValue &SoftenedOp = SoftenedFloats[Op];
329     RemapValue(SoftenedOp);
330     assert(SoftenedOp.getNode() && "Operand wasn't converted to integer?");
331     return SoftenedOp;
332   }
333   void SetSoftenedFloat(SDValue Op, SDValue Result);
334
335   // Result Float to Integer Conversion.
336   void SoftenFloatResult(SDNode *N, unsigned OpNo);
337   SDValue SoftenFloatRes_BIT_CONVERT(SDNode *N);
338   SDValue SoftenFloatRes_BUILD_PAIR(SDNode *N);
339   SDValue SoftenFloatRes_ConstantFP(ConstantFPSDNode *N);
340   SDValue SoftenFloatRes_FABS(SDNode *N);
341   SDValue SoftenFloatRes_FADD(SDNode *N);
342   SDValue SoftenFloatRes_FCOPYSIGN(SDNode *N);
343   SDValue SoftenFloatRes_FDIV(SDNode *N);
344   SDValue SoftenFloatRes_FMUL(SDNode *N);
345   SDValue SoftenFloatRes_FP_EXTEND(SDNode *N);
346   SDValue SoftenFloatRes_FP_ROUND(SDNode *N);
347   SDValue SoftenFloatRes_FPOW(SDNode *N);
348   SDValue SoftenFloatRes_FPOWI(SDNode *N);
349   SDValue SoftenFloatRes_FSUB(SDNode *N);
350   SDValue SoftenFloatRes_LOAD(SDNode *N);
351   SDValue SoftenFloatRes_SELECT(SDNode *N);
352   SDValue SoftenFloatRes_SELECT_CC(SDNode *N);
353   SDValue SoftenFloatRes_SINT_TO_FP(SDNode *N);
354   SDValue SoftenFloatRes_UINT_TO_FP(SDNode *N);
355
356   // Operand Float to Integer Conversion.
357   bool SoftenFloatOperand(SDNode *N, unsigned OpNo);
358   SDValue SoftenFloatOp_BIT_CONVERT(SDNode *N);
359   SDValue SoftenFloatOp_BR_CC(SDNode *N);
360   SDValue SoftenFloatOp_FP_ROUND(SDNode *N);
361   SDValue SoftenFloatOp_FP_TO_SINT(SDNode *N);
362   SDValue SoftenFloatOp_FP_TO_UINT(SDNode *N);
363   SDValue SoftenFloatOp_SELECT_CC(SDNode *N);
364   SDValue SoftenFloatOp_SETCC(SDNode *N);
365   SDValue SoftenFloatOp_STORE(SDNode *N, unsigned OpNo);
366
367   void SoftenSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
368                            ISD::CondCode &CCCode);
369
370   //===--------------------------------------------------------------------===//
371   // Float Expansion Support: LegalizeFloatTypes.cpp
372   //===--------------------------------------------------------------------===//
373
374   void GetExpandedFloat(SDValue Op, SDValue &Lo, SDValue &Hi);
375   void SetExpandedFloat(SDValue Op, SDValue Lo, SDValue Hi);
376
377   // Float Result Expansion.
378   void ExpandFloatResult(SDNode *N, unsigned ResNo);
379   void ExpandFloatRes_ConstantFP(SDNode *N, SDValue &Lo, SDValue &Hi);
380   void ExpandFloatRes_FABS      (SDNode *N, SDValue &Lo, SDValue &Hi);
381   void ExpandFloatRes_FADD      (SDNode *N, SDValue &Lo, SDValue &Hi);
382   void ExpandFloatRes_FDIV      (SDNode *N, SDValue &Lo, SDValue &Hi);
383   void ExpandFloatRes_FMUL      (SDNode *N, SDValue &Lo, SDValue &Hi);
384   void ExpandFloatRes_FNEG      (SDNode *N, SDValue &Lo, SDValue &Hi);
385   void ExpandFloatRes_FP_EXTEND (SDNode *N, SDValue &Lo, SDValue &Hi);
386   void ExpandFloatRes_FSUB      (SDNode *N, SDValue &Lo, SDValue &Hi);
387   void ExpandFloatRes_LOAD      (SDNode *N, SDValue &Lo, SDValue &Hi);
388   void ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo, SDValue &Hi);
389
390   // Float Operand Expansion.
391   bool ExpandFloatOperand(SDNode *N, unsigned OperandNo);
392   SDValue ExpandFloatOp_BR_CC(SDNode *N);
393   SDValue ExpandFloatOp_FP_ROUND(SDNode *N);
394   SDValue ExpandFloatOp_FP_TO_SINT(SDNode *N);
395   SDValue ExpandFloatOp_FP_TO_UINT(SDNode *N);
396   SDValue ExpandFloatOp_SELECT_CC(SDNode *N);
397   SDValue ExpandFloatOp_SETCC(SDNode *N);
398   SDValue ExpandFloatOp_STORE(SDNode *N, unsigned OpNo);
399
400   void FloatExpandSetCCOperands(SDValue &NewLHS, SDValue &NewRHS,
401                                 ISD::CondCode &CCCode);
402
403   //===--------------------------------------------------------------------===//
404   // Scalarization Support: LegalizeVectorTypes.cpp
405   //===--------------------------------------------------------------------===//
406
407   SDValue GetScalarizedVector(SDValue Op) {
408     SDValue &ScalarizedOp = ScalarizedVectors[Op];
409     RemapValue(ScalarizedOp);
410     assert(ScalarizedOp.getNode() && "Operand wasn't scalarized?");
411     return ScalarizedOp;
412   }
413   void SetScalarizedVector(SDValue Op, SDValue Result);
414
415   // Vector Result Scalarization: <1 x ty> -> ty.
416   void ScalarizeVectorResult(SDNode *N, unsigned OpNo);
417   SDValue ScalarizeVecRes_BinOp(SDNode *N);
418   SDValue ScalarizeVecRes_UnaryOp(SDNode *N);
419
420   SDValue ScalarizeVecRes_BIT_CONVERT(SDNode *N);
421   SDValue ScalarizeVecRes_EXTRACT_SUBVECTOR(SDNode *N);
422   SDValue ScalarizeVecRes_FPOWI(SDNode *N);
423   SDValue ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *N);
424   SDValue ScalarizeVecRes_LOAD(LoadSDNode *N);
425   SDValue ScalarizeVecRes_SELECT(SDNode *N);
426   SDValue ScalarizeVecRes_UNDEF(SDNode *N);
427   SDValue ScalarizeVecRes_VECTOR_SHUFFLE(SDNode *N);
428   SDValue ScalarizeVecRes_VSETCC(SDNode *N);
429
430   // Vector Operand Scalarization: <1 x ty> -> ty.
431   bool ScalarizeVectorOperand(SDNode *N, unsigned OpNo);
432   SDValue ScalarizeVecOp_BIT_CONVERT(SDNode *N);
433   SDValue ScalarizeVecOp_CONCAT_VECTORS(SDNode *N);
434   SDValue ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
435   SDValue ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo);
436
437   //===--------------------------------------------------------------------===//
438   // Vector Splitting Support: LegalizeVectorTypes.cpp
439   //===--------------------------------------------------------------------===//
440
441   void GetSplitVector(SDValue Op, SDValue &Lo, SDValue &Hi);
442   void SetSplitVector(SDValue Op, SDValue Lo, SDValue Hi);
443
444   // Vector Result Splitting: <128 x ty> -> 2 x <64 x ty>.
445   void SplitVectorResult(SDNode *N, unsigned OpNo);
446   void SplitVecRes_BinOp(SDNode *N, SDValue &Lo, SDValue &Hi);
447   void SplitVecRes_UnaryOp(SDNode *N, SDValue &Lo, SDValue &Hi);
448
449   void SplitVecRes_BIT_CONVERT(SDNode *N, SDValue &Lo, SDValue &Hi);
450   void SplitVecRes_BUILD_PAIR(SDNode *N, SDValue &Lo, SDValue &Hi);
451   void SplitVecRes_BUILD_VECTOR(SDNode *N, SDValue &Lo, SDValue &Hi);
452   void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDValue &Lo, SDValue &Hi);
453   void SplitVecRes_FPOWI(SDNode *N, SDValue &Lo, SDValue &Hi);
454   void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi);
455   void SplitVecRes_LOAD(LoadSDNode *N, SDValue &Lo, SDValue &Hi);
456   void SplitVecRes_UNDEF(SDNode *N, SDValue &Lo, SDValue &Hi);
457   void SplitVecRes_VECTOR_SHUFFLE(SDNode *N, SDValue &Lo, SDValue &Hi);
458   void SplitVecRes_VSETCC(SDNode *N, SDValue &Lo, SDValue &Hi);
459
460   // Vector Operand Splitting: <128 x ty> -> 2 x <64 x ty>.
461   bool SplitVectorOperand(SDNode *N, unsigned OpNo);
462   SDValue SplitVecOp_UnaryOp(SDNode *N);
463
464   SDValue SplitVecOp_BIT_CONVERT(SDNode *N);
465   SDValue SplitVecOp_EXTRACT_SUBVECTOR(SDNode *N);
466   SDValue SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
467   SDValue SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo);
468   SDValue SplitVecOp_VECTOR_SHUFFLE(SDNode *N, unsigned OpNo);
469
470   //===--------------------------------------------------------------------===//
471   // Generic Splitting: LegalizeTypesGeneric.cpp
472   //===--------------------------------------------------------------------===//
473
474   // Legalization methods which only use that the illegal type is split into two
475   // not necessarily identical types.  As such they can be used for splitting
476   // vectors and expanding integers and floats.
477
478   void GetSplitOp(SDValue Op, SDValue &Lo, SDValue &Hi) {
479     if (Op.getValueType().isVector())
480       GetSplitVector(Op, Lo, Hi);
481     else if (Op.getValueType().isInteger())
482       GetExpandedInteger(Op, Lo, Hi);
483     else
484       GetExpandedFloat(Op, Lo, Hi);
485   }
486
487   /// GetSplitDestVTs - Compute the VTs needed for the low/hi parts of a type
488   /// which is split (or expanded) into two not necessarily identical pieces.
489   void GetSplitDestVTs(MVT InVT, MVT &LoVT, MVT &HiVT);
490
491   // Generic Result Splitting.
492   void SplitRes_MERGE_VALUES(SDNode *N, SDValue &Lo, SDValue &Hi);
493   void SplitRes_SELECT      (SDNode *N, SDValue &Lo, SDValue &Hi);
494   void SplitRes_SELECT_CC   (SDNode *N, SDValue &Lo, SDValue &Hi);
495   void SplitRes_UNDEF       (SDNode *N, SDValue &Lo, SDValue &Hi);
496
497   //===--------------------------------------------------------------------===//
498   // Generic Expansion: LegalizeTypesGeneric.cpp
499   //===--------------------------------------------------------------------===//
500
501   // Legalization methods which only use that the illegal type is split into two
502   // identical types of half the size, and that the Lo/Hi part is stored first
503   // in memory on little/big-endian machines, followed by the Hi/Lo part.  As
504   // such they can be used for expanding integers and floats.
505
506   void GetExpandedOp(SDValue Op, SDValue &Lo, SDValue &Hi) {
507     if (Op.getValueType().isInteger())
508       GetExpandedInteger(Op, Lo, Hi);
509     else
510       GetExpandedFloat(Op, Lo, Hi);
511   }
512
513   // Generic Result Expansion.
514   void ExpandRes_BIT_CONVERT       (SDNode *N, SDValue &Lo, SDValue &Hi);
515   void ExpandRes_BUILD_PAIR        (SDNode *N, SDValue &Lo, SDValue &Hi);
516   void ExpandRes_EXTRACT_ELEMENT   (SDNode *N, SDValue &Lo, SDValue &Hi);
517   void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi);
518   void ExpandRes_NormalLoad        (SDNode *N, SDValue &Lo, SDValue &Hi);
519   void ExpandRes_VAARG             (SDNode *N, SDValue &Lo, SDValue &Hi);
520
521   // Generic Operand Expansion.
522   SDValue ExpandOp_BIT_CONVERT    (SDNode *N);
523   SDValue ExpandOp_BUILD_VECTOR   (SDNode *N);
524   SDValue ExpandOp_EXTRACT_ELEMENT(SDNode *N);
525   SDValue ExpandOp_NormalStore    (SDNode *N, unsigned OpNo);
526
527 };
528
529 } // end namespace llvm.
530
531 #endif