1 //===-- PPCISelLowering.h - PPC32 DAG Lowering Interface --------*- C++ -*-===//
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 interfaces that PPC uses to lower LLVM code into a
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_POWERPC_PPCISELLOWERING_H
16 #define LLVM_LIB_TARGET_POWERPC_PPCISELLOWERING_H
19 #include "PPCInstrInfo.h"
20 #include "PPCRegisterInfo.h"
21 #include "llvm/CodeGen/CallingConvLower.h"
22 #include "llvm/CodeGen/SelectionDAG.h"
23 #include "llvm/Target/TargetLowering.h"
28 // Start the numbering where the builtin ops and target ops leave off.
29 FIRST_NUMBER = ISD::BUILTIN_OP_END,
31 /// FSEL - Traditional three-operand fsel node.
35 /// FCFID - The FCFID instruction, taking an f64 operand and producing
36 /// and f64 value containing the FP representation of the integer that
37 /// was temporarily in the f64 operand.
40 /// Newer FCFID[US] integer-to-floating-point conversion instructions for
41 /// unsigned integers and single-precision outputs.
42 FCFIDU, FCFIDS, FCFIDUS,
44 /// FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64
45 /// operand, producing an f64 value containing the integer representation
49 /// Newer FCTI[D,W]UZ floating-point-to-integer conversion instructions for
50 /// unsigned integers.
53 /// Reciprocal estimate instructions (unary FP ops).
56 // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking
57 // three v4f32 operands and producing a v4f32 result.
60 /// VPERM - The PPC VPERM Instruction.
64 /// Hi/Lo - These represent the high and low 16-bit parts of a global
65 /// address respectively. These nodes have two operands, the first of
66 /// which must be a TargetGlobalAddress, and the second of which must be a
67 /// Constant. Selected naively, these turn into 'lis G+C' and 'li G+C',
68 /// though these are usually folded into other nodes.
73 /// The following two target-specific nodes are used for calls through
74 /// function pointers in the 64-bit SVR4 ABI.
76 /// Like a regular LOAD but additionally taking/producing a flag.
79 /// Like LOAD (taking/producing a flag), but using r2 as hard-coded
83 /// OPRC, CHAIN = DYNALLOC(CHAIN, NEGSIZE, FRAME_INDEX)
84 /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to
85 /// compute an allocation on the stack.
88 /// GlobalBaseReg - On Darwin, this node represents the result of the mflr
89 /// at function entry, used for PIC code.
92 /// These nodes represent the 32-bit PPC shifts that operate on 6-bit
93 /// shift amounts. These nodes are generated by the multi-precision shift
97 /// The combination of sra[wd]i and addze used to implemented signed
98 /// integer division by a power of 2. The first operand is the dividend,
99 /// and the second is the constant shift amount (representing the
103 /// CALL - A direct function call.
104 /// CALL_NOP is a call with the special NOP which follows 64-bit
108 /// CALL_TLS and CALL_NOP_TLS - Versions of CALL and CALL_NOP used
109 /// to access TLS variables.
110 CALL_TLS, CALL_NOP_TLS,
112 /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a
113 /// MTCTR instruction.
116 /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a
117 /// BCTRL instruction.
120 /// Return with a flag operand, matched by 'blr'
123 /// R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction.
124 /// This copies the bits corresponding to the specified CRREG into the
125 /// resultant GPR. Bits corresponding to other CR regs are undefined.
128 // FIXME: Remove these once the ANDI glue bug is fixed:
129 /// i1 = ANDIo_1_[EQ|GT]_BIT(i32 or i64 x) - Represents the result of the
130 /// eq or gt bit of CR0 after executing andi. x, 1. This is used to
131 /// implement truncation of i32 or i64 to i1.
132 ANDIo_1_EQ_BIT, ANDIo_1_GT_BIT,
134 // READ_TIME_BASE - A read of the 64-bit time-base register on a 32-bit
135 // target (returns (Lo, Hi)). It takes a chain operand.
138 // EH_SJLJ_SETJMP - SjLj exception handling setjmp.
141 // EH_SJLJ_LONGJMP - SjLj exception handling longjmp.
144 /// RESVEC = VCMP(LHS, RHS, OPC) - Represents one of the altivec VCMP*
145 /// instructions. For lack of better number, we use the opcode number
146 /// encoding for the OPC field to identify the compare. For example, 838
150 /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the
151 /// altivec VCMP*o instructions. For lack of better number, we use the
152 /// opcode number encoding for the OPC field to identify the compare. For
153 /// example, 838 is VCMPGTSH.
156 /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This
157 /// corresponds to the COND_BRANCH pseudo instruction. CRRC is the
158 /// condition register to branch on, OPC is the branch opcode to use (e.g.
159 /// PPC::BLE), DESTBB is the destination block to branch to, and INFLAG is
160 /// an optional input flag argument.
163 /// CHAIN = BDNZ CHAIN, DESTBB - These are used to create counter-based
167 /// F8RC = FADDRTZ F8RC, F8RC - This is an FADD done with rounding
168 /// towards zero. Used only as part of the long double-to-int
169 /// conversion sequence.
172 /// F8RC = MFFS - This moves the FPSCR (not modeled) into the register.
175 /// LARX = This corresponds to PPC l{w|d}arx instrcution: load and
176 /// reserve indexed. This is used to implement atomic operations.
179 /// STCX = This corresponds to PPC stcx. instrcution: store conditional
180 /// indexed. This is used to implement atomic operations.
183 /// TC_RETURN - A tail call return.
185 /// operand #1 callee (register or absolute)
186 /// operand #2 stack adjustment
187 /// operand #3 optional in flag
190 /// ch, gl = CR6[UN]SET ch, inglue - Toggle CR bit 6 for SVR4 vararg calls
194 /// GPRC = address of _GLOBAL_OFFSET_TABLE_. Used by initial-exec TLS
198 /// GPRC = address of _GLOBAL_OFFSET_TABLE_. Used by general dynamic and
199 /// local dynamic TLS on PPC32.
202 /// G8RC = ADDIS_GOT_TPREL_HA %X2, Symbol - Used by the initial-exec
203 /// TLS model, produces an ADDIS8 instruction that adds the GOT
204 /// base to sym\@got\@tprel\@ha.
207 /// G8RC = LD_GOT_TPREL_L Symbol, G8RReg - Used by the initial-exec
208 /// TLS model, produces a LD instruction with base register G8RReg
209 /// and offset sym\@got\@tprel\@l. This completes the addition that
210 /// finds the offset of "sym" relative to the thread pointer.
213 /// G8RC = ADD_TLS G8RReg, Symbol - Used by the initial-exec TLS
214 /// model, produces an ADD instruction that adds the contents of
215 /// G8RReg to the thread pointer. Symbol contains a relocation
216 /// sym\@tls which is to be replaced by the thread pointer and
217 /// identifies to the linker that the instruction is part of a
221 /// G8RC = ADDIS_TLSGD_HA %X2, Symbol - For the general-dynamic TLS
222 /// model, produces an ADDIS8 instruction that adds the GOT base
223 /// register to sym\@got\@tlsgd\@ha.
226 /// G8RC = ADDI_TLSGD_L G8RReg, Symbol - For the general-dynamic TLS
227 /// model, produces an ADDI8 instruction that adds G8RReg to
228 /// sym\@got\@tlsgd\@l.
231 /// G8RC = ADDIS_TLSLD_HA %X2, Symbol - For the local-dynamic TLS
232 /// model, produces an ADDIS8 instruction that adds the GOT base
233 /// register to sym\@got\@tlsld\@ha.
236 /// G8RC = ADDI_TLSLD_L G8RReg, Symbol - For the local-dynamic TLS
237 /// model, produces an ADDI8 instruction that adds G8RReg to
238 /// sym\@got\@tlsld\@l.
241 /// G8RC = ADDIS_DTPREL_HA %X3, Symbol, Chain - For the
242 /// local-dynamic TLS model, produces an ADDIS8 instruction
243 /// that adds X3 to sym\@dtprel\@ha. The Chain operand is needed
244 /// to tie this in place following a copy to %X3 from the result
245 /// of a GET_TLSLD_ADDR.
248 /// G8RC = ADDI_DTPREL_L G8RReg, Symbol - For the local-dynamic TLS
249 /// model, produces an ADDI8 instruction that adds G8RReg to
250 /// sym\@got\@dtprel\@l.
253 /// VRRC = VADD_SPLAT Elt, EltSize - Temporary node to be expanded
254 /// during instruction selection to optimize a BUILD_VECTOR into
255 /// operations on splats. This is necessary to avoid losing these
256 /// optimizations due to constant folding.
259 /// CHAIN = SC CHAIN, Imm128 - System call. The 7-bit unsigned
260 /// operand identifies the operating system entry point.
263 /// VSRC, CHAIN = XXSWAPD CHAIN, VSRC - Occurs only for little
264 /// endian. Maps to an xxswapd instruction that corrects an lxvd2x
265 /// or stxvd2x instruction. The chain is necessary because the
266 /// sequence replaces a load and needs to provide the same number
270 /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a
271 /// byte-swapping store instruction. It byte-swaps the low "Type" bits of
272 /// the GPRC input, then stores it through Ptr. Type can be either i16 or
274 STBRX = ISD::FIRST_TARGET_MEMORY_OPCODE,
276 /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a
277 /// byte-swapping load instruction. It loads "Type" bits, byte swaps it,
278 /// then puts it in the bottom bits of the GPRC. TYPE can be either i16
282 /// STFIWX - The STFIWX instruction. The first operand is an input token
283 /// chain, then an f64 value to store, then an address to store it to.
286 /// GPRC, CHAIN = LFIWAX CHAIN, Ptr - This is a floating-point
287 /// load which sign-extends from a 32-bit integer value into the
288 /// destination 64-bit register.
291 /// GPRC, CHAIN = LFIWZX CHAIN, Ptr - This is a floating-point
292 /// load which zero-extends from a 32-bit integer value into the
293 /// destination 64-bit register.
296 /// G8RC = ADDIS_TOC_HA %X2, Symbol - For medium and large code model,
297 /// produces an ADDIS8 instruction that adds the TOC base register to
301 /// G8RC = LD_TOC_L Symbol, G8RReg - For medium and large code model,
302 /// produces a LD instruction with base register G8RReg and offset
303 /// sym\@toc\@l. Preceded by an ADDIS_TOC_HA to form a full 32-bit offset.
306 /// G8RC = ADDI_TOC_L G8RReg, Symbol - For medium code model, produces
307 /// an ADDI8 instruction that adds G8RReg to sym\@toc\@l.
308 /// Preceded by an ADDIS_TOC_HA to form a full 32-bit offset.
311 /// VSRC, CHAIN = LXVD2X_LE CHAIN, Ptr - Occurs only for little endian.
312 /// Maps directly to an lxvd2x instruction that will be followed by
316 /// CHAIN = STXVD2X CHAIN, VSRC, Ptr - Occurs only for little endian.
317 /// Maps directly to an stxvd2x instruction that will be preceded by
323 /// Define some predicates that are used for node matching.
325 /// isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a
326 /// VPKUHUM instruction.
327 bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind,
330 /// isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a
331 /// VPKUWUM instruction.
332 bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind,
335 /// isVMRGLShuffleMask - Return true if this is a shuffle mask suitable for
336 /// a VRGL* instruction with the specified unit size (1,2 or 4 bytes).
337 bool isVMRGLShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
338 unsigned ShuffleKind, SelectionDAG &DAG);
340 /// isVMRGHShuffleMask - Return true if this is a shuffle mask suitable for
341 /// a VRGH* instruction with the specified unit size (1,2 or 4 bytes).
342 bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize,
343 unsigned ShuffleKind, SelectionDAG &DAG);
345 /// isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the
346 /// shift amount, otherwise return -1.
347 int isVSLDOIShuffleMask(SDNode *N, unsigned ShuffleKind,
350 /// isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand
351 /// specifies a splat of a single element that is suitable for input to
352 /// VSPLTB/VSPLTH/VSPLTW.
353 bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize);
355 /// isAllNegativeZeroVector - Returns true if all elements of build_vector
357 bool isAllNegativeZeroVector(SDNode *N);
359 /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the
360 /// specified isSplatShuffleMask VECTOR_SHUFFLE mask.
361 unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize, SelectionDAG &DAG);
363 /// get_VSPLTI_elt - If this is a build_vector of constants which can be
364 /// formed by using a vspltis[bhw] instruction of the specified element
365 /// size, return the constant being splatted. The ByteSize field indicates
366 /// the number of bytes of each element [124] -> [bhw].
367 SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG);
371 class PPCTargetLowering : public TargetLowering {
372 const PPCSubtarget &Subtarget;
375 explicit PPCTargetLowering(const PPCTargetMachine &TM);
377 /// getTargetNodeName() - This method returns the name of a target specific
379 const char *getTargetNodeName(unsigned Opcode) const override;
381 MVT getScalarShiftAmountTy(EVT LHSTy) const override { return MVT::i32; }
383 /// getSetCCResultType - Return the ISD::SETCC ValueType
384 EVT getSetCCResultType(LLVMContext &Context, EVT VT) const override;
386 /// Return true if target always beneficiates from combining into FMA for a
387 /// given value type. This must typically return false on targets where FMA
388 /// takes more cycles to execute than FADD.
389 bool enableAggressiveFMAFusion(EVT VT) const override;
391 /// getPreIndexedAddressParts - returns true by value, base pointer and
392 /// offset pointer and addressing mode by reference if the node's address
393 /// can be legally represented as pre-indexed load / store address.
394 bool getPreIndexedAddressParts(SDNode *N, SDValue &Base,
396 ISD::MemIndexedMode &AM,
397 SelectionDAG &DAG) const override;
399 /// SelectAddressRegReg - Given the specified addressed, check to see if it
400 /// can be represented as an indexed [r+r] operation. Returns false if it
401 /// can be more efficiently represented with [r+imm].
402 bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index,
403 SelectionDAG &DAG) const;
405 /// SelectAddressRegImm - Returns true if the address N can be represented
406 /// by a base register plus a signed 16-bit displacement [r+imm], and if it
407 /// is not better represented as reg+reg. If Aligned is true, only accept
408 /// displacements suitable for STD and friends, i.e. multiples of 4.
409 bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base,
410 SelectionDAG &DAG, bool Aligned) const;
412 /// SelectAddressRegRegOnly - Given the specified addressed, force it to be
413 /// represented as an indexed [r+r] operation.
414 bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index,
415 SelectionDAG &DAG) const;
417 Sched::Preference getSchedulingPreference(SDNode *N) const override;
419 /// LowerOperation - Provide custom lowering hooks for some operations.
421 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
423 /// ReplaceNodeResults - Replace the results of node with an illegal result
424 /// type with new values built out of custom code.
426 void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results,
427 SelectionDAG &DAG) const override;
429 SDValue expandVSXLoadForLE(SDNode *N, DAGCombinerInfo &DCI) const;
430 SDValue expandVSXStoreForLE(SDNode *N, DAGCombinerInfo &DCI) const;
432 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
434 SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,
435 std::vector<SDNode *> *Created) const override;
437 unsigned getRegisterByName(const char* RegName, EVT VT) const override;
439 void computeKnownBitsForTargetNode(const SDValue Op,
442 const SelectionDAG &DAG,
443 unsigned Depth = 0) const override;
445 Instruction* emitLeadingFence(IRBuilder<> &Builder, AtomicOrdering Ord,
446 bool IsStore, bool IsLoad) const override;
447 Instruction* emitTrailingFence(IRBuilder<> &Builder, AtomicOrdering Ord,
448 bool IsStore, bool IsLoad) const override;
451 EmitInstrWithCustomInserter(MachineInstr *MI,
452 MachineBasicBlock *MBB) const override;
453 MachineBasicBlock *EmitAtomicBinary(MachineInstr *MI,
454 MachineBasicBlock *MBB, bool is64Bit,
455 unsigned BinOpcode) const;
456 MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr *MI,
457 MachineBasicBlock *MBB,
458 bool is8bit, unsigned Opcode) const;
460 MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr *MI,
461 MachineBasicBlock *MBB) const;
463 MachineBasicBlock *emitEHSjLjLongJmp(MachineInstr *MI,
464 MachineBasicBlock *MBB) const;
467 getConstraintType(const std::string &Constraint) const override;
469 /// Examine constraint string and operand type and determine a weight value.
470 /// The operand object must already have been set up with the operand type.
471 ConstraintWeight getSingleConstraintMatchWeight(
472 AsmOperandInfo &info, const char *constraint) const override;
474 std::pair<unsigned, const TargetRegisterClass*>
475 getRegForInlineAsmConstraint(const std::string &Constraint,
476 MVT VT) const override;
478 /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate
479 /// function arguments in the caller parameter area. This is the actual
480 /// alignment, not its logarithm.
481 unsigned getByValTypeAlignment(Type *Ty) const override;
483 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
484 /// vector. If it is invalid, don't add anything to Ops.
485 void LowerAsmOperandForConstraint(SDValue Op,
486 std::string &Constraint,
487 std::vector<SDValue> &Ops,
488 SelectionDAG &DAG) const override;
490 /// isLegalAddressingMode - Return true if the addressing mode represented
491 /// by AM is legal for this target, for a load/store of the specified type.
492 bool isLegalAddressingMode(const AddrMode &AM, Type *Ty) const override;
494 /// isLegalICmpImmediate - Return true if the specified immediate is legal
495 /// icmp immediate, that is the target has icmp instructions which can
496 /// compare a register against the immediate without having to materialize
497 /// the immediate into a register.
498 bool isLegalICmpImmediate(int64_t Imm) const override;
500 /// isLegalAddImmediate - Return true if the specified immediate is legal
501 /// add immediate, that is the target has add instructions which can
502 /// add a register and the immediate without having to materialize
503 /// the immediate into a register.
504 bool isLegalAddImmediate(int64_t Imm) const override;
506 /// isTruncateFree - Return true if it's free to truncate a value of
507 /// type Ty1 to type Ty2. e.g. On PPC it's free to truncate a i64 value in
508 /// register X1 to i32 by referencing its sub-register R1.
509 bool isTruncateFree(Type *Ty1, Type *Ty2) const override;
510 bool isTruncateFree(EVT VT1, EVT VT2) const override;
512 /// \brief Returns true if it is beneficial to convert a load of a constant
513 /// to just the constant itself.
514 bool shouldConvertConstantLoadToIntImm(const APInt &Imm,
515 Type *Ty) const override;
517 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
519 bool getTgtMemIntrinsic(IntrinsicInfo &Info,
521 unsigned Intrinsic) const override;
523 /// getOptimalMemOpType - Returns the target specific optimal type for load
524 /// and store operations as a result of memset, memcpy, and memmove
525 /// lowering. If DstAlign is zero that means it's safe to destination
526 /// alignment can satisfy any constraint. Similarly if SrcAlign is zero it
527 /// means there isn't a need to check it against alignment requirement,
528 /// probably because the source does not need to be loaded. If 'IsMemset' is
529 /// true, that means it's expanding a memset. If 'ZeroMemset' is true, that
530 /// means it's a memset of zero. 'MemcpyStrSrc' indicates whether the memcpy
531 /// source is constant so it does not need to be loaded.
532 /// It returns EVT::Other if the type should be determined using generic
533 /// target-independent logic.
535 getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign,
536 bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc,
537 MachineFunction &MF) const override;
539 /// Is unaligned memory access allowed for the given type, and is it fast
540 /// relative to software emulation.
541 bool allowsMisalignedMemoryAccesses(EVT VT,
544 bool *Fast = nullptr) const override;
546 /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster
547 /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be
548 /// expanded to FMAs when this method returns true, otherwise fmuladd is
549 /// expanded to fmul + fadd.
550 bool isFMAFasterThanFMulAndFAdd(EVT VT) const override;
552 // Should we expand the build vector with shuffles?
554 shouldExpandBuildVectorWithShuffles(EVT VT,
555 unsigned DefinedValues) const override;
557 /// createFastISel - This method returns a target-specific FastISel object,
558 /// or null if the target does not support "fast" instruction selection.
559 FastISel *createFastISel(FunctionLoweringInfo &FuncInfo,
560 const TargetLibraryInfo *LibInfo) const override;
562 /// \brief Returns true if an argument of type Ty needs to be passed in a
563 /// contiguous block of registers in calling convention CallConv.
564 bool functionArgumentNeedsConsecutiveRegisters(
565 Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override {
566 // We support any array type as "consecutive" block in the parameter
567 // save area. The element type defines the alignment requirement and
568 // whether the argument should go in GPRs, FPRs, or VRs if available.
570 // Note that clang uses this capability both to implement the ELFv2
571 // homogeneous float/vector aggregate ABI, and to avoid having to use
572 // "byval" when passing aggregates that might fully fit in registers.
573 return Ty->isArrayTy();
577 SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const;
578 SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const;
581 IsEligibleForTailCallOptimization(SDValue Callee,
582 CallingConv::ID CalleeCC,
584 const SmallVectorImpl<ISD::InputArg> &Ins,
585 SelectionDAG& DAG) const;
587 SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG & DAG,
595 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
596 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
597 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
598 SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
599 std::pair<SDValue,SDValue> lowerTLSCall(SDValue Op, SDLoc dl,
600 SelectionDAG &DAG) const;
601 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
602 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
603 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
604 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
605 SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
606 SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
607 SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
608 const PPCSubtarget &Subtarget) const;
609 SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG,
610 const PPCSubtarget &Subtarget) const;
611 SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG,
612 const PPCSubtarget &Subtarget) const;
613 SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG,
614 const PPCSubtarget &Subtarget) const;
615 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG,
616 const PPCSubtarget &Subtarget) const;
617 SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const;
618 SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const;
619 SDValue LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const;
620 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
621 SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG, SDLoc dl) const;
622 SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
623 SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const;
624 SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const;
625 SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const;
626 SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const;
627 SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
628 SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
629 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
630 SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
631 SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const;
632 SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const;
634 SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
635 CallingConv::ID CallConv, bool isVarArg,
636 const SmallVectorImpl<ISD::InputArg> &Ins,
637 SDLoc dl, SelectionDAG &DAG,
638 SmallVectorImpl<SDValue> &InVals) const;
639 SDValue FinishCall(CallingConv::ID CallConv, SDLoc dl, bool isTailCall,
642 SmallVector<std::pair<unsigned, SDValue>, 8>
644 SDValue InFlag, SDValue Chain,
646 int SPDiff, unsigned NumBytes,
647 const SmallVectorImpl<ISD::InputArg> &Ins,
648 SmallVectorImpl<SDValue> &InVals) const;
651 LowerFormalArguments(SDValue Chain,
652 CallingConv::ID CallConv, bool isVarArg,
653 const SmallVectorImpl<ISD::InputArg> &Ins,
654 SDLoc dl, SelectionDAG &DAG,
655 SmallVectorImpl<SDValue> &InVals) const override;
658 LowerCall(TargetLowering::CallLoweringInfo &CLI,
659 SmallVectorImpl<SDValue> &InVals) const override;
662 CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
664 const SmallVectorImpl<ISD::OutputArg> &Outs,
665 LLVMContext &Context) const override;
668 LowerReturn(SDValue Chain,
669 CallingConv::ID CallConv, bool isVarArg,
670 const SmallVectorImpl<ISD::OutputArg> &Outs,
671 const SmallVectorImpl<SDValue> &OutVals,
672 SDLoc dl, SelectionDAG &DAG) const override;
675 extendArgForPPC64(ISD::ArgFlagsTy Flags, EVT ObjectVT, SelectionDAG &DAG,
676 SDValue ArgVal, SDLoc dl) const;
679 LowerFormalArguments_Darwin(SDValue Chain,
680 CallingConv::ID CallConv, bool isVarArg,
681 const SmallVectorImpl<ISD::InputArg> &Ins,
682 SDLoc dl, SelectionDAG &DAG,
683 SmallVectorImpl<SDValue> &InVals) const;
685 LowerFormalArguments_64SVR4(SDValue Chain,
686 CallingConv::ID CallConv, bool isVarArg,
687 const SmallVectorImpl<ISD::InputArg> &Ins,
688 SDLoc dl, SelectionDAG &DAG,
689 SmallVectorImpl<SDValue> &InVals) const;
691 LowerFormalArguments_32SVR4(SDValue Chain,
692 CallingConv::ID CallConv, bool isVarArg,
693 const SmallVectorImpl<ISD::InputArg> &Ins,
694 SDLoc dl, SelectionDAG &DAG,
695 SmallVectorImpl<SDValue> &InVals) const;
698 createMemcpyOutsideCallSeq(SDValue Arg, SDValue PtrOff,
699 SDValue CallSeqStart, ISD::ArgFlagsTy Flags,
700 SelectionDAG &DAG, SDLoc dl) const;
703 LowerCall_Darwin(SDValue Chain, SDValue Callee,
704 CallingConv::ID CallConv,
705 bool isVarArg, bool isTailCall,
706 const SmallVectorImpl<ISD::OutputArg> &Outs,
707 const SmallVectorImpl<SDValue> &OutVals,
708 const SmallVectorImpl<ISD::InputArg> &Ins,
709 SDLoc dl, SelectionDAG &DAG,
710 SmallVectorImpl<SDValue> &InVals) const;
712 LowerCall_64SVR4(SDValue Chain, SDValue Callee,
713 CallingConv::ID CallConv,
714 bool isVarArg, bool isTailCall,
715 const SmallVectorImpl<ISD::OutputArg> &Outs,
716 const SmallVectorImpl<SDValue> &OutVals,
717 const SmallVectorImpl<ISD::InputArg> &Ins,
718 SDLoc dl, SelectionDAG &DAG,
719 SmallVectorImpl<SDValue> &InVals) const;
721 LowerCall_32SVR4(SDValue Chain, SDValue Callee, CallingConv::ID CallConv,
722 bool isVarArg, bool isTailCall,
723 const SmallVectorImpl<ISD::OutputArg> &Outs,
724 const SmallVectorImpl<SDValue> &OutVals,
725 const SmallVectorImpl<ISD::InputArg> &Ins,
726 SDLoc dl, SelectionDAG &DAG,
727 SmallVectorImpl<SDValue> &InVals) const;
729 SDValue lowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const;
730 SDValue lowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const;
732 SDValue DAGCombineExtBoolTrunc(SDNode *N, DAGCombinerInfo &DCI) const;
733 SDValue DAGCombineTruncBoolExt(SDNode *N, DAGCombinerInfo &DCI) const;
735 SDValue getRsqrtEstimate(SDValue Operand, DAGCombinerInfo &DCI,
736 unsigned &RefinementSteps,
737 bool &UseOneConstNR) const override;
738 SDValue getRecipEstimate(SDValue Operand, DAGCombinerInfo &DCI,
739 unsigned &RefinementSteps) const override;
740 bool combineRepeatedFPDivisors(unsigned NumUsers) const override;
742 CCAssignFn *useFastISelCCs(unsigned Flag) const;
746 FastISel *createFastISel(FunctionLoweringInfo &FuncInfo,
747 const TargetLibraryInfo *LibInfo);
750 bool CC_PPC32_SVR4_Custom_Dummy(unsigned &ValNo, MVT &ValVT, MVT &LocVT,
751 CCValAssign::LocInfo &LocInfo,
752 ISD::ArgFlagsTy &ArgFlags,
755 bool CC_PPC32_SVR4_Custom_AlignArgRegs(unsigned &ValNo, MVT &ValVT,
757 CCValAssign::LocInfo &LocInfo,
758 ISD::ArgFlagsTy &ArgFlags,
761 bool CC_PPC32_SVR4_Custom_AlignFPArgRegs(unsigned &ValNo, MVT &ValVT,
763 CCValAssign::LocInfo &LocInfo,
764 ISD::ArgFlagsTy &ArgFlags,
768 #endif // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H