1 //===-- LegalizeTypes.h - Definition of the DAG Type Legalizer class ------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the DAGTypeLegalizer class. This is a private interface
11 // shared between the code that implements the SelectionDAG::LegalizeTypes
14 //===----------------------------------------------------------------------===//
16 #ifndef SELECTIONDAG_LEGALIZETYPES_H
17 #define SELECTIONDAG_LEGALIZETYPES_H
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"
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.
34 class VISIBILITY_HIDDEN DAGTypeLegalizer {
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.
41 /// ReadyToProcess - All operands have been processed, so this node is ready
45 /// NewNode - This is a new node that was created in the process of
46 /// legalizing some other node.
49 /// Processed - This is a node that has already been processed.
52 // 1+ - This is a node which has this many unlegalized operands.
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.
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;
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)) {
78 assert(false && "Unknown legalize action!");
79 case TargetLowering::Legal:
81 case TargetLowering::Promote:
82 return PromoteInteger;
83 case TargetLowering::Expand:
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.
90 else if (VT.getSizeInBits() ==
91 TLI.getTypeToTransformTo(VT).getSizeInBits())
95 } else if (VT.getVectorNumElements() == 1) {
96 return ScalarizeVector;
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;
108 /// PromotedIntegers - For integer nodes that are below legal width, this map
109 /// indicates what promoted value to use.
110 DenseMap<SDOperand, SDOperand> PromotedIntegers;
112 /// ExpandedIntegers - For integer nodes that need to be expanded this map
113 /// indicates which operands are the expanded version of the input.
114 DenseMap<SDOperand, std::pair<SDOperand, SDOperand> > ExpandedIntegers;
116 /// SoftenedFloats - For floating point nodes converted to integers of
117 /// the same size, this map indicates the converted value to use.
118 DenseMap<SDOperand, SDOperand> SoftenedFloats;
120 /// ExpandedFloats - For float nodes that need to be expanded this map
121 /// indicates which operands are the expanded version of the input.
122 DenseMap<SDOperand, std::pair<SDOperand, SDOperand> > ExpandedFloats;
124 /// ScalarizedVectors - For nodes that are <1 x ty>, this map indicates the
125 /// scalar value of type 'ty' to use.
126 DenseMap<SDOperand, SDOperand> ScalarizedVectors;
128 /// SplitVectors - For nodes that need to be split this map indicates
129 /// which operands are the expanded version of the input.
130 DenseMap<SDOperand, std::pair<SDOperand, SDOperand> > SplitVectors;
132 /// ReplacedNodes - For nodes that have been replaced with another,
133 /// indicates the replacement node to use.
134 DenseMap<SDOperand, SDOperand> ReplacedNodes;
136 /// Worklist - This defines a worklist of nodes to process. In order to be
137 /// pushed onto this worklist, all operands of a node must have already been
139 SmallVector<SDNode*, 128> Worklist;
142 explicit DAGTypeLegalizer(SelectionDAG &dag)
143 : TLI(dag.getTargetLoweringInfo()), DAG(dag),
144 ValueTypeActions(TLI.getValueTypeActions()) {
145 assert(MVT::LAST_VALUETYPE <= 32 &&
146 "Too many value types for ValueTypeActions to hold!");
151 /// ReanalyzeNode - Recompute the NodeID and correct processed operands
152 /// for the specified node, adding it to the worklist if ready.
153 void ReanalyzeNode(SDNode *N) {
154 N->setNodeId(NewNode);
158 void NoteDeletion(SDNode *Old, SDNode *New) {
161 for (unsigned i = 0, e = Old->getNumValues(); i != e; ++i)
162 ReplacedNodes[SDOperand(Old, i)] = SDOperand(New, i);
166 void AnalyzeNewNode(SDNode *&N);
168 void ReplaceValueWith(SDOperand From, SDOperand To);
169 void ReplaceNodeWith(SDNode *From, SDNode *To);
171 void RemapNode(SDOperand &N);
172 void ExpungeNode(SDNode *N);
175 SDOperand CreateStackStoreLoad(SDOperand Op, MVT DestVT);
176 SDOperand MakeLibCall(RTLIB::Libcall LC, MVT RetVT,
177 const SDOperand *Ops, unsigned NumOps, bool isSigned);
179 SDOperand BitConvertToInteger(SDOperand Op);
180 SDOperand JoinIntegers(SDOperand Lo, SDOperand Hi);
181 void SplitInteger(SDOperand Op, SDOperand &Lo, SDOperand &Hi);
182 void SplitInteger(SDOperand Op, MVT LoVT, MVT HiVT,
183 SDOperand &Lo, SDOperand &Hi);
185 SDOperand GetVectorElementPointer(SDOperand VecPtr, MVT EltVT,
188 //===--------------------------------------------------------------------===//
189 // Integer Promotion Support: LegalizeIntegerTypes.cpp
190 //===--------------------------------------------------------------------===//
192 SDOperand GetPromotedInteger(SDOperand Op) {
193 SDOperand &PromotedOp = PromotedIntegers[Op];
194 RemapNode(PromotedOp);
195 assert(PromotedOp.Val && "Operand wasn't promoted?");
198 void SetPromotedInteger(SDOperand Op, SDOperand Result);
200 /// ZExtPromotedInteger - Get a promoted operand and zero extend it to the
202 SDOperand ZExtPromotedInteger(SDOperand Op) {
203 MVT OldVT = Op.getValueType();
204 Op = GetPromotedInteger(Op);
205 return DAG.getZeroExtendInReg(Op, OldVT);
208 // Integer Result Promotion.
209 void PromoteIntegerResult(SDNode *N, unsigned ResNo);
210 SDOperand PromoteIntRes_BIT_CONVERT(SDNode *N);
211 SDOperand PromoteIntRes_BUILD_PAIR(SDNode *N);
212 SDOperand PromoteIntRes_Constant(SDNode *N);
213 SDOperand PromoteIntRes_CTLZ(SDNode *N);
214 SDOperand PromoteIntRes_CTPOP(SDNode *N);
215 SDOperand PromoteIntRes_CTTZ(SDNode *N);
216 SDOperand PromoteIntRes_EXTRACT_VECTOR_ELT(SDNode *N);
217 SDOperand PromoteIntRes_FP_TO_XINT(SDNode *N);
218 SDOperand PromoteIntRes_INT_EXTEND(SDNode *N);
219 SDOperand PromoteIntRes_LOAD(LoadSDNode *N);
220 SDOperand PromoteIntRes_SDIV(SDNode *N);
221 SDOperand PromoteIntRes_SELECT (SDNode *N);
222 SDOperand PromoteIntRes_SELECT_CC(SDNode *N);
223 SDOperand PromoteIntRes_SETCC(SDNode *N);
224 SDOperand PromoteIntRes_SHL(SDNode *N);
225 SDOperand PromoteIntRes_SimpleIntBinOp(SDNode *N);
226 SDOperand PromoteIntRes_SRA(SDNode *N);
227 SDOperand PromoteIntRes_SRL(SDNode *N);
228 SDOperand PromoteIntRes_TRUNCATE(SDNode *N);
229 SDOperand PromoteIntRes_UDIV(SDNode *N);
230 SDOperand PromoteIntRes_UNDEF(SDNode *N);
231 SDOperand PromoteIntRes_VAARG(SDNode *N);
233 // Integer Operand Promotion.
234 bool PromoteIntegerOperand(SDNode *N, unsigned OperandNo);
235 SDOperand PromoteIntOp_ANY_EXTEND(SDNode *N);
236 SDOperand PromoteIntOp_BUILD_PAIR(SDNode *N);
237 SDOperand PromoteIntOp_BR_CC(SDNode *N, unsigned OpNo);
238 SDOperand PromoteIntOp_BRCOND(SDNode *N, unsigned OpNo);
239 SDOperand PromoteIntOp_BUILD_VECTOR(SDNode *N);
240 SDOperand PromoteIntOp_FP_EXTEND(SDNode *N);
241 SDOperand PromoteIntOp_FP_ROUND(SDNode *N);
242 SDOperand PromoteIntOp_INT_TO_FP(SDNode *N);
243 SDOperand PromoteIntOp_INSERT_VECTOR_ELT(SDNode *N, unsigned OpNo);
244 SDOperand PromoteIntOp_MEMBARRIER(SDNode *N);
245 SDOperand PromoteIntOp_SELECT(SDNode *N, unsigned OpNo);
246 SDOperand PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo);
247 SDOperand PromoteIntOp_SETCC(SDNode *N, unsigned OpNo);
248 SDOperand PromoteIntOp_SIGN_EXTEND(SDNode *N);
249 SDOperand PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo);
250 SDOperand PromoteIntOp_TRUNCATE(SDNode *N);
251 SDOperand PromoteIntOp_ZERO_EXTEND(SDNode *N);
253 void PromoteSetCCOperands(SDOperand &LHS,SDOperand &RHS, ISD::CondCode Code);
255 //===--------------------------------------------------------------------===//
256 // Integer Expansion Support: LegalizeIntegerTypes.cpp
257 //===--------------------------------------------------------------------===//
259 void GetExpandedInteger(SDOperand Op, SDOperand &Lo, SDOperand &Hi);
260 void SetExpandedInteger(SDOperand Op, SDOperand Lo, SDOperand Hi);
262 // Integer Result Expansion.
263 void ExpandIntegerResult(SDNode *N, unsigned ResNo);
264 void ExpandIntRes_ANY_EXTEND (SDNode *N, SDOperand &Lo, SDOperand &Hi);
265 void ExpandIntRes_AssertZext (SDNode *N, SDOperand &Lo, SDOperand &Hi);
266 void ExpandIntRes_Constant (SDNode *N, SDOperand &Lo, SDOperand &Hi);
267 void ExpandIntRes_CTLZ (SDNode *N, SDOperand &Lo, SDOperand &Hi);
268 void ExpandIntRes_CTPOP (SDNode *N, SDOperand &Lo, SDOperand &Hi);
269 void ExpandIntRes_CTTZ (SDNode *N, SDOperand &Lo, SDOperand &Hi);
270 void ExpandIntRes_LOAD (LoadSDNode *N, SDOperand &Lo, SDOperand &Hi);
271 void ExpandIntRes_SIGN_EXTEND (SDNode *N, SDOperand &Lo, SDOperand &Hi);
272 void ExpandIntRes_SIGN_EXTEND_INREG (SDNode *N, SDOperand &Lo, SDOperand &Hi);
273 void ExpandIntRes_TRUNCATE (SDNode *N, SDOperand &Lo, SDOperand &Hi);
274 void ExpandIntRes_ZERO_EXTEND (SDNode *N, SDOperand &Lo, SDOperand &Hi);
275 void ExpandIntRes_FP_TO_SINT (SDNode *N, SDOperand &Lo, SDOperand &Hi);
276 void ExpandIntRes_FP_TO_UINT (SDNode *N, SDOperand &Lo, SDOperand &Hi);
278 void ExpandIntRes_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi);
279 void ExpandIntRes_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi);
280 void ExpandIntRes_ADDSUBC (SDNode *N, SDOperand &Lo, SDOperand &Hi);
281 void ExpandIntRes_ADDSUBE (SDNode *N, SDOperand &Lo, SDOperand &Hi);
282 void ExpandIntRes_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi);
283 void ExpandIntRes_MUL (SDNode *N, SDOperand &Lo, SDOperand &Hi);
284 void ExpandIntRes_SDIV (SDNode *N, SDOperand &Lo, SDOperand &Hi);
285 void ExpandIntRes_SREM (SDNode *N, SDOperand &Lo, SDOperand &Hi);
286 void ExpandIntRes_UDIV (SDNode *N, SDOperand &Lo, SDOperand &Hi);
287 void ExpandIntRes_UREM (SDNode *N, SDOperand &Lo, SDOperand &Hi);
288 void ExpandIntRes_Shift (SDNode *N, SDOperand &Lo, SDOperand &Hi);
290 void ExpandShiftByConstant(SDNode *N, unsigned Amt,
291 SDOperand &Lo, SDOperand &Hi);
292 bool ExpandShiftWithKnownAmountBit(SDNode *N, SDOperand &Lo, SDOperand &Hi);
294 // Integer Operand Expansion.
295 bool ExpandIntegerOperand(SDNode *N, unsigned OperandNo);
296 SDOperand ExpandIntOp_BIT_CONVERT(SDNode *N);
297 SDOperand ExpandIntOp_BR_CC(SDNode *N);
298 SDOperand ExpandIntOp_BUILD_VECTOR(SDNode *N);
299 SDOperand ExpandIntOp_EXTRACT_ELEMENT(SDNode *N);
300 SDOperand ExpandIntOp_SELECT_CC(SDNode *N);
301 SDOperand ExpandIntOp_SETCC(SDNode *N);
302 SDOperand ExpandIntOp_SINT_TO_FP(SDOperand Source, MVT DestTy);
303 SDOperand ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo);
304 SDOperand ExpandIntOp_TRUNCATE(SDNode *N);
305 SDOperand ExpandIntOp_UINT_TO_FP(SDOperand Source, MVT DestTy);
307 void IntegerExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS,
308 ISD::CondCode &CCCode);
310 //===--------------------------------------------------------------------===//
311 // Float to Integer Conversion Support: LegalizeFloatTypes.cpp
312 //===--------------------------------------------------------------------===//
314 SDOperand GetSoftenedFloat(SDOperand Op) {
315 SDOperand &SoftenedOp = SoftenedFloats[Op];
316 RemapNode(SoftenedOp);
317 assert(SoftenedOp.Val && "Operand wasn't converted to integer?");
320 void SetSoftenedFloat(SDOperand Op, SDOperand Result);
322 // Result Float to Integer Conversion.
323 void SoftenFloatResult(SDNode *N, unsigned OpNo);
324 SDOperand SoftenFloatRes_BIT_CONVERT(SDNode *N);
325 SDOperand SoftenFloatRes_BUILD_PAIR(SDNode *N);
326 SDOperand SoftenFloatRes_ConstantFP(ConstantFPSDNode *N);
327 SDOperand SoftenFloatRes_FADD(SDNode *N);
328 SDOperand SoftenFloatRes_FCOPYSIGN(SDNode *N);
329 SDOperand SoftenFloatRes_FMUL(SDNode *N);
330 SDOperand SoftenFloatRes_FP_EXTEND(SDNode *N);
331 SDOperand SoftenFloatRes_FP_ROUND(SDNode *N);
332 SDOperand SoftenFloatRes_FPOWI(SDNode *N);
333 SDOperand SoftenFloatRes_FSUB(SDNode *N);
334 SDOperand SoftenFloatRes_LOAD(SDNode *N);
335 SDOperand SoftenFloatRes_SELECT(SDNode *N);
336 SDOperand SoftenFloatRes_SELECT_CC(SDNode *N);
337 SDOperand SoftenFloatRes_SINT_TO_FP(SDNode *N);
338 SDOperand SoftenFloatRes_UINT_TO_FP(SDNode *N);
340 // Operand Float to Integer Conversion.
341 bool SoftenFloatOperand(SDNode *N, unsigned OpNo);
342 SDOperand SoftenFloatOp_BIT_CONVERT(SDNode *N);
343 SDOperand SoftenFloatOp_BR_CC(SDNode *N);
344 SDOperand SoftenFloatOp_FP_TO_SINT(SDNode *N);
345 SDOperand SoftenFloatOp_FP_TO_UINT(SDNode *N);
346 SDOperand SoftenFloatOp_SELECT_CC(SDNode *N);
347 SDOperand SoftenFloatOp_SETCC(SDNode *N);
348 SDOperand SoftenFloatOp_STORE(SDNode *N, unsigned OpNo);
350 void SoftenSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS,
351 ISD::CondCode &CCCode);
353 //===--------------------------------------------------------------------===//
354 // Float Expansion Support: LegalizeFloatTypes.cpp
355 //===--------------------------------------------------------------------===//
357 void GetExpandedFloat(SDOperand Op, SDOperand &Lo, SDOperand &Hi);
358 void SetExpandedFloat(SDOperand Op, SDOperand Lo, SDOperand Hi);
360 // Float Result Expansion.
361 void ExpandFloatResult(SDNode *N, unsigned ResNo);
362 void ExpandFloatRes_ConstantFP(SDNode *N, SDOperand &Lo, SDOperand &Hi);
363 void ExpandFloatRes_FADD (SDNode *N, SDOperand &Lo, SDOperand &Hi);
364 void ExpandFloatRes_FDIV (SDNode *N, SDOperand &Lo, SDOperand &Hi);
365 void ExpandFloatRes_FMUL (SDNode *N, SDOperand &Lo, SDOperand &Hi);
366 void ExpandFloatRes_FSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi);
367 void ExpandFloatRes_LOAD (SDNode *N, SDOperand &Lo, SDOperand &Hi);
368 void ExpandFloatRes_XINT_TO_FP(SDNode *N, SDOperand &Lo, SDOperand &Hi);
370 // Float Operand Expansion.
371 bool ExpandFloatOperand(SDNode *N, unsigned OperandNo);
372 SDOperand ExpandFloatOp_BR_CC(SDNode *N);
373 SDOperand ExpandFloatOp_FP_ROUND(SDNode *N);
374 SDOperand ExpandFloatOp_FP_TO_SINT(SDNode *N);
375 SDOperand ExpandFloatOp_FP_TO_UINT(SDNode *N);
376 SDOperand ExpandFloatOp_SELECT_CC(SDNode *N);
377 SDOperand ExpandFloatOp_SETCC(SDNode *N);
378 SDOperand ExpandFloatOp_STORE(SDNode *N, unsigned OpNo);
380 void FloatExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS,
381 ISD::CondCode &CCCode);
383 //===--------------------------------------------------------------------===//
384 // Scalarization Support: LegalizeVectorTypes.cpp
385 //===--------------------------------------------------------------------===//
387 SDOperand GetScalarizedVector(SDOperand Op) {
388 SDOperand &ScalarizedOp = ScalarizedVectors[Op];
389 RemapNode(ScalarizedOp);
390 assert(ScalarizedOp.Val && "Operand wasn't scalarized?");
393 void SetScalarizedVector(SDOperand Op, SDOperand Result);
395 // Vector Result Scalarization: <1 x ty> -> ty.
396 void ScalarizeVectorResult(SDNode *N, unsigned OpNo);
397 SDOperand ScalarizeVecRes_BinOp(SDNode *N);
398 SDOperand ScalarizeVecRes_UnaryOp(SDNode *N);
400 SDOperand ScalarizeVecRes_BIT_CONVERT(SDNode *N);
401 SDOperand ScalarizeVecRes_FPOWI(SDNode *N);
402 SDOperand ScalarizeVecRes_INSERT_VECTOR_ELT(SDNode *N);
403 SDOperand ScalarizeVecRes_LOAD(LoadSDNode *N);
404 SDOperand ScalarizeVecRes_SELECT(SDNode *N);
405 SDOperand ScalarizeVecRes_UNDEF(SDNode *N);
406 SDOperand ScalarizeVecRes_VECTOR_SHUFFLE(SDNode *N);
408 // Vector Operand Scalarization: <1 x ty> -> ty.
409 bool ScalarizeVectorOperand(SDNode *N, unsigned OpNo);
410 SDOperand ScalarizeVecOp_BIT_CONVERT(SDNode *N);
411 SDOperand ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
412 SDOperand ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo);
414 //===--------------------------------------------------------------------===//
415 // Vector Splitting Support: LegalizeVectorTypes.cpp
416 //===--------------------------------------------------------------------===//
418 void GetSplitVector(SDOperand Op, SDOperand &Lo, SDOperand &Hi);
419 void SetSplitVector(SDOperand Op, SDOperand Lo, SDOperand Hi);
421 // Vector Result Splitting: <128 x ty> -> 2 x <64 x ty>.
422 void SplitVectorResult(SDNode *N, unsigned OpNo);
424 void SplitVecRes_UNDEF(SDNode *N, SDOperand &Lo, SDOperand &Hi);
425 void SplitVecRes_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi);
426 void SplitVecRes_BUILD_PAIR(SDNode *N, SDOperand &Lo, SDOperand &Hi);
427 void SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi);
428 void SplitVecRes_VECTOR_SHUFFLE(SDNode *N, SDOperand &Lo, SDOperand &Hi);
430 void SplitVecRes_BUILD_VECTOR(SDNode *N, SDOperand &Lo, SDOperand &Hi);
431 void SplitVecRes_CONCAT_VECTORS(SDNode *N, SDOperand &Lo, SDOperand &Hi);
432 void SplitVecRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, SDOperand &Hi);
433 void SplitVecRes_UnOp(SDNode *N, SDOperand &Lo, SDOperand &Hi);
434 void SplitVecRes_BinOp(SDNode *N, SDOperand &Lo, SDOperand &Hi);
435 void SplitVecRes_FPOWI(SDNode *N, SDOperand &Lo, SDOperand &Hi);
437 // Vector Operand Splitting: <128 x ty> -> 2 x <64 x ty>.
438 bool SplitVectorOperand(SDNode *N, unsigned OpNo);
440 SDOperand SplitVecOp_BIT_CONVERT(SDNode *N);
441 SDOperand SplitVecOp_EXTRACT_SUBVECTOR(SDNode *N);
442 SDOperand SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *N);
443 SDOperand SplitVecOp_RET(SDNode *N, unsigned OpNo);
444 SDOperand SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo);
445 SDOperand SplitVecOp_VECTOR_SHUFFLE(SDNode *N, unsigned OpNo);
447 //===--------------------------------------------------------------------===//
448 // Generic Splitting: LegalizeTypesGeneric.cpp
449 //===--------------------------------------------------------------------===//
451 // Legalization methods which only use that the illegal type is split into two
452 // not necessarily identical types. As such they can be used for splitting
453 // vectors and expanding integers and floats.
455 void GetSplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi) {
456 if (Op.getValueType().isVector())
457 GetSplitVector(Op, Lo, Hi);
458 else if (Op.getValueType().isInteger())
459 GetExpandedInteger(Op, Lo, Hi);
461 GetExpandedFloat(Op, Lo, Hi);
464 /// GetSplitDestVTs - Compute the VTs needed for the low/hi parts of a type
465 /// which is split (or expanded) into two not necessarily identical pieces.
466 void GetSplitDestVTs(MVT InVT, MVT &LoVT, MVT &HiVT);
468 // Generic Result Splitting.
469 void SplitRes_MERGE_VALUES(SDNode *N, SDOperand &Lo, SDOperand &Hi);
470 void SplitRes_SELECT (SDNode *N, SDOperand &Lo, SDOperand &Hi);
471 void SplitRes_SELECT_CC (SDNode *N, SDOperand &Lo, SDOperand &Hi);
472 void SplitRes_UNDEF (SDNode *N, SDOperand &Lo, SDOperand &Hi);
474 //===--------------------------------------------------------------------===//
475 // Generic Expansion: LegalizeTypesGeneric.cpp
476 //===--------------------------------------------------------------------===//
478 // Legalization methods which only use that the illegal type is split into two
479 // identical types of half the size, and that the Lo/Hi part is stored first
480 // in memory on little/big-endian machines, followed by the Hi/Lo part. As
481 // such they can be used for expanding integers and floats.
483 void GetExpandedOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi) {
484 if (Op.getValueType().isInteger())
485 GetExpandedInteger(Op, Lo, Hi);
487 GetExpandedFloat(Op, Lo, Hi);
490 // Generic Result Expansion.
491 void ExpandRes_BIT_CONVERT (SDNode *N, SDOperand &Lo, SDOperand &Hi);
492 void ExpandRes_BUILD_PAIR (SDNode *N, SDOperand &Lo, SDOperand &Hi);
493 void ExpandRes_EXTRACT_ELEMENT (SDNode *N, SDOperand &Lo, SDOperand &Hi);
494 void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi);
495 void ExpandRes_NormalLoad (SDNode *N, SDOperand &Lo, SDOperand &Hi);
497 // Generic Operand Expansion.
498 SDOperand ExpandOp_BIT_CONVERT (SDNode *N);
499 SDOperand ExpandOp_BUILD_VECTOR (SDNode *N);
500 SDOperand ExpandOp_EXTRACT_ELEMENT(SDNode *N);
501 SDOperand ExpandOp_NormalStore (SDNode *N, unsigned OpNo);
505 } // end namespace llvm.