1*9880d681SAndroid Build Coastguard Worker //===-- PPCISelLowering.h - PPC32 DAG Lowering Interface --------*- C++ -*-===// 2*9880d681SAndroid Build Coastguard Worker // 3*9880d681SAndroid Build Coastguard Worker // The LLVM Compiler Infrastructure 4*9880d681SAndroid Build Coastguard Worker // 5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source 6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details. 7*9880d681SAndroid Build Coastguard Worker // 8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 9*9880d681SAndroid Build Coastguard Worker // 10*9880d681SAndroid Build Coastguard Worker // This file defines the interfaces that PPC uses to lower LLVM code into a 11*9880d681SAndroid Build Coastguard Worker // selection DAG. 12*9880d681SAndroid Build Coastguard Worker // 13*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===// 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_POWERPC_PPCISELLOWERING_H 16*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_POWERPC_PPCISELLOWERING_H 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker #include "PPC.h" 19*9880d681SAndroid Build Coastguard Worker #include "PPCInstrInfo.h" 20*9880d681SAndroid Build Coastguard Worker #include "PPCRegisterInfo.h" 21*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/CallingConvLower.h" 22*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/SelectionDAG.h" 23*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetLowering.h" 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker namespace llvm { 26*9880d681SAndroid Build Coastguard Worker namespace PPCISD { 27*9880d681SAndroid Build Coastguard Worker enum NodeType : unsigned { 28*9880d681SAndroid Build Coastguard Worker // Start the numbering where the builtin ops and target ops leave off. 29*9880d681SAndroid Build Coastguard Worker FIRST_NUMBER = ISD::BUILTIN_OP_END, 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Worker /// FSEL - Traditional three-operand fsel node. 32*9880d681SAndroid Build Coastguard Worker /// 33*9880d681SAndroid Build Coastguard Worker FSEL, 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker /// FCFID - The FCFID instruction, taking an f64 operand and producing 36*9880d681SAndroid Build Coastguard Worker /// and f64 value containing the FP representation of the integer that 37*9880d681SAndroid Build Coastguard Worker /// was temporarily in the f64 operand. 38*9880d681SAndroid Build Coastguard Worker FCFID, 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker /// Newer FCFID[US] integer-to-floating-point conversion instructions for 41*9880d681SAndroid Build Coastguard Worker /// unsigned integers and single-precision outputs. 42*9880d681SAndroid Build Coastguard Worker FCFIDU, FCFIDS, FCFIDUS, 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker /// FCTI[D,W]Z - The FCTIDZ and FCTIWZ instructions, taking an f32 or f64 45*9880d681SAndroid Build Coastguard Worker /// operand, producing an f64 value containing the integer representation 46*9880d681SAndroid Build Coastguard Worker /// of that FP value. 47*9880d681SAndroid Build Coastguard Worker FCTIDZ, FCTIWZ, 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard Worker /// Newer FCTI[D,W]UZ floating-point-to-integer conversion instructions for 50*9880d681SAndroid Build Coastguard Worker /// unsigned integers. 51*9880d681SAndroid Build Coastguard Worker FCTIDUZ, FCTIWUZ, 52*9880d681SAndroid Build Coastguard Worker 53*9880d681SAndroid Build Coastguard Worker /// Reciprocal estimate instructions (unary FP ops). 54*9880d681SAndroid Build Coastguard Worker FRE, FRSQRTE, 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Worker // VMADDFP, VNMSUBFP - The VMADDFP and VNMSUBFP instructions, taking 57*9880d681SAndroid Build Coastguard Worker // three v4f32 operands and producing a v4f32 result. 58*9880d681SAndroid Build Coastguard Worker VMADDFP, VNMSUBFP, 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard Worker /// VPERM - The PPC VPERM Instruction. 61*9880d681SAndroid Build Coastguard Worker /// 62*9880d681SAndroid Build Coastguard Worker VPERM, 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Worker /// XXSPLT - The PPC VSX splat instructions 65*9880d681SAndroid Build Coastguard Worker /// 66*9880d681SAndroid Build Coastguard Worker XXSPLT, 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Worker /// XXINSERT - The PPC VSX insert instruction 69*9880d681SAndroid Build Coastguard Worker /// 70*9880d681SAndroid Build Coastguard Worker XXINSERT, 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard Worker /// VECSHL - The PPC VSX shift left instruction 73*9880d681SAndroid Build Coastguard Worker /// 74*9880d681SAndroid Build Coastguard Worker VECSHL, 75*9880d681SAndroid Build Coastguard Worker 76*9880d681SAndroid Build Coastguard Worker /// The CMPB instruction (takes two operands of i32 or i64). 77*9880d681SAndroid Build Coastguard Worker CMPB, 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker /// Hi/Lo - These represent the high and low 16-bit parts of a global 80*9880d681SAndroid Build Coastguard Worker /// address respectively. These nodes have two operands, the first of 81*9880d681SAndroid Build Coastguard Worker /// which must be a TargetGlobalAddress, and the second of which must be a 82*9880d681SAndroid Build Coastguard Worker /// Constant. Selected naively, these turn into 'lis G+C' and 'li G+C', 83*9880d681SAndroid Build Coastguard Worker /// though these are usually folded into other nodes. 84*9880d681SAndroid Build Coastguard Worker Hi, Lo, 85*9880d681SAndroid Build Coastguard Worker 86*9880d681SAndroid Build Coastguard Worker /// The following two target-specific nodes are used for calls through 87*9880d681SAndroid Build Coastguard Worker /// function pointers in the 64-bit SVR4 ABI. 88*9880d681SAndroid Build Coastguard Worker 89*9880d681SAndroid Build Coastguard Worker /// OPRC, CHAIN = DYNALLOC(CHAIN, NEGSIZE, FRAME_INDEX) 90*9880d681SAndroid Build Coastguard Worker /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to 91*9880d681SAndroid Build Coastguard Worker /// compute an allocation on the stack. 92*9880d681SAndroid Build Coastguard Worker DYNALLOC, 93*9880d681SAndroid Build Coastguard Worker 94*9880d681SAndroid Build Coastguard Worker /// This instruction is lowered in PPCRegisterInfo::eliminateFrameIndex to 95*9880d681SAndroid Build Coastguard Worker /// compute an offset from native SP to the address of the most recent 96*9880d681SAndroid Build Coastguard Worker /// dynamic alloca. 97*9880d681SAndroid Build Coastguard Worker DYNAREAOFFSET, 98*9880d681SAndroid Build Coastguard Worker 99*9880d681SAndroid Build Coastguard Worker /// GlobalBaseReg - On Darwin, this node represents the result of the mflr 100*9880d681SAndroid Build Coastguard Worker /// at function entry, used for PIC code. 101*9880d681SAndroid Build Coastguard Worker GlobalBaseReg, 102*9880d681SAndroid Build Coastguard Worker 103*9880d681SAndroid Build Coastguard Worker /// These nodes represent the 32-bit PPC shifts that operate on 6-bit 104*9880d681SAndroid Build Coastguard Worker /// shift amounts. These nodes are generated by the multi-precision shift 105*9880d681SAndroid Build Coastguard Worker /// code. 106*9880d681SAndroid Build Coastguard Worker SRL, SRA, SHL, 107*9880d681SAndroid Build Coastguard Worker 108*9880d681SAndroid Build Coastguard Worker /// The combination of sra[wd]i and addze used to implemented signed 109*9880d681SAndroid Build Coastguard Worker /// integer division by a power of 2. The first operand is the dividend, 110*9880d681SAndroid Build Coastguard Worker /// and the second is the constant shift amount (representing the 111*9880d681SAndroid Build Coastguard Worker /// divisor). 112*9880d681SAndroid Build Coastguard Worker SRA_ADDZE, 113*9880d681SAndroid Build Coastguard Worker 114*9880d681SAndroid Build Coastguard Worker /// CALL - A direct function call. 115*9880d681SAndroid Build Coastguard Worker /// CALL_NOP is a call with the special NOP which follows 64-bit 116*9880d681SAndroid Build Coastguard Worker /// SVR4 calls. 117*9880d681SAndroid Build Coastguard Worker CALL, CALL_NOP, 118*9880d681SAndroid Build Coastguard Worker 119*9880d681SAndroid Build Coastguard Worker /// CHAIN,FLAG = MTCTR(VAL, CHAIN[, INFLAG]) - Directly corresponds to a 120*9880d681SAndroid Build Coastguard Worker /// MTCTR instruction. 121*9880d681SAndroid Build Coastguard Worker MTCTR, 122*9880d681SAndroid Build Coastguard Worker 123*9880d681SAndroid Build Coastguard Worker /// CHAIN,FLAG = BCTRL(CHAIN, INFLAG) - Directly corresponds to a 124*9880d681SAndroid Build Coastguard Worker /// BCTRL instruction. 125*9880d681SAndroid Build Coastguard Worker BCTRL, 126*9880d681SAndroid Build Coastguard Worker 127*9880d681SAndroid Build Coastguard Worker /// CHAIN,FLAG = BCTRL(CHAIN, ADDR, INFLAG) - The combination of a bctrl 128*9880d681SAndroid Build Coastguard Worker /// instruction and the TOC reload required on SVR4 PPC64. 129*9880d681SAndroid Build Coastguard Worker BCTRL_LOAD_TOC, 130*9880d681SAndroid Build Coastguard Worker 131*9880d681SAndroid Build Coastguard Worker /// Return with a flag operand, matched by 'blr' 132*9880d681SAndroid Build Coastguard Worker RET_FLAG, 133*9880d681SAndroid Build Coastguard Worker 134*9880d681SAndroid Build Coastguard Worker /// R32 = MFOCRF(CRREG, INFLAG) - Represents the MFOCRF instruction. 135*9880d681SAndroid Build Coastguard Worker /// This copies the bits corresponding to the specified CRREG into the 136*9880d681SAndroid Build Coastguard Worker /// resultant GPR. Bits corresponding to other CR regs are undefined. 137*9880d681SAndroid Build Coastguard Worker MFOCRF, 138*9880d681SAndroid Build Coastguard Worker 139*9880d681SAndroid Build Coastguard Worker /// Direct move from a VSX register to a GPR 140*9880d681SAndroid Build Coastguard Worker MFVSR, 141*9880d681SAndroid Build Coastguard Worker 142*9880d681SAndroid Build Coastguard Worker /// Direct move from a GPR to a VSX register (algebraic) 143*9880d681SAndroid Build Coastguard Worker MTVSRA, 144*9880d681SAndroid Build Coastguard Worker 145*9880d681SAndroid Build Coastguard Worker /// Direct move from a GPR to a VSX register (zero) 146*9880d681SAndroid Build Coastguard Worker MTVSRZ, 147*9880d681SAndroid Build Coastguard Worker 148*9880d681SAndroid Build Coastguard Worker /// Extract a subvector from signed integer vector and convert to FP. 149*9880d681SAndroid Build Coastguard Worker /// It is primarily used to convert a (widened) illegal integer vector 150*9880d681SAndroid Build Coastguard Worker /// type to a legal floating point vector type. 151*9880d681SAndroid Build Coastguard Worker /// For example v2i32 -> widened to v4i32 -> v2f64 152*9880d681SAndroid Build Coastguard Worker SINT_VEC_TO_FP, 153*9880d681SAndroid Build Coastguard Worker 154*9880d681SAndroid Build Coastguard Worker /// Extract a subvector from unsigned integer vector and convert to FP. 155*9880d681SAndroid Build Coastguard Worker /// As with SINT_VEC_TO_FP, used for converting illegal types. 156*9880d681SAndroid Build Coastguard Worker UINT_VEC_TO_FP, 157*9880d681SAndroid Build Coastguard Worker 158*9880d681SAndroid Build Coastguard Worker // FIXME: Remove these once the ANDI glue bug is fixed: 159*9880d681SAndroid Build Coastguard Worker /// i1 = ANDIo_1_[EQ|GT]_BIT(i32 or i64 x) - Represents the result of the 160*9880d681SAndroid Build Coastguard Worker /// eq or gt bit of CR0 after executing andi. x, 1. This is used to 161*9880d681SAndroid Build Coastguard Worker /// implement truncation of i32 or i64 to i1. 162*9880d681SAndroid Build Coastguard Worker ANDIo_1_EQ_BIT, ANDIo_1_GT_BIT, 163*9880d681SAndroid Build Coastguard Worker 164*9880d681SAndroid Build Coastguard Worker // READ_TIME_BASE - A read of the 64-bit time-base register on a 32-bit 165*9880d681SAndroid Build Coastguard Worker // target (returns (Lo, Hi)). It takes a chain operand. 166*9880d681SAndroid Build Coastguard Worker READ_TIME_BASE, 167*9880d681SAndroid Build Coastguard Worker 168*9880d681SAndroid Build Coastguard Worker // EH_SJLJ_SETJMP - SjLj exception handling setjmp. 169*9880d681SAndroid Build Coastguard Worker EH_SJLJ_SETJMP, 170*9880d681SAndroid Build Coastguard Worker 171*9880d681SAndroid Build Coastguard Worker // EH_SJLJ_LONGJMP - SjLj exception handling longjmp. 172*9880d681SAndroid Build Coastguard Worker EH_SJLJ_LONGJMP, 173*9880d681SAndroid Build Coastguard Worker 174*9880d681SAndroid Build Coastguard Worker /// RESVEC = VCMP(LHS, RHS, OPC) - Represents one of the altivec VCMP* 175*9880d681SAndroid Build Coastguard Worker /// instructions. For lack of better number, we use the opcode number 176*9880d681SAndroid Build Coastguard Worker /// encoding for the OPC field to identify the compare. For example, 838 177*9880d681SAndroid Build Coastguard Worker /// is VCMPGTSH. 178*9880d681SAndroid Build Coastguard Worker VCMP, 179*9880d681SAndroid Build Coastguard Worker 180*9880d681SAndroid Build Coastguard Worker /// RESVEC, OUTFLAG = VCMPo(LHS, RHS, OPC) - Represents one of the 181*9880d681SAndroid Build Coastguard Worker /// altivec VCMP*o instructions. For lack of better number, we use the 182*9880d681SAndroid Build Coastguard Worker /// opcode number encoding for the OPC field to identify the compare. For 183*9880d681SAndroid Build Coastguard Worker /// example, 838 is VCMPGTSH. 184*9880d681SAndroid Build Coastguard Worker VCMPo, 185*9880d681SAndroid Build Coastguard Worker 186*9880d681SAndroid Build Coastguard Worker /// CHAIN = COND_BRANCH CHAIN, CRRC, OPC, DESTBB [, INFLAG] - This 187*9880d681SAndroid Build Coastguard Worker /// corresponds to the COND_BRANCH pseudo instruction. CRRC is the 188*9880d681SAndroid Build Coastguard Worker /// condition register to branch on, OPC is the branch opcode to use (e.g. 189*9880d681SAndroid Build Coastguard Worker /// PPC::BLE), DESTBB is the destination block to branch to, and INFLAG is 190*9880d681SAndroid Build Coastguard Worker /// an optional input flag argument. 191*9880d681SAndroid Build Coastguard Worker COND_BRANCH, 192*9880d681SAndroid Build Coastguard Worker 193*9880d681SAndroid Build Coastguard Worker /// CHAIN = BDNZ CHAIN, DESTBB - These are used to create counter-based 194*9880d681SAndroid Build Coastguard Worker /// loops. 195*9880d681SAndroid Build Coastguard Worker BDNZ, BDZ, 196*9880d681SAndroid Build Coastguard Worker 197*9880d681SAndroid Build Coastguard Worker /// F8RC = FADDRTZ F8RC, F8RC - This is an FADD done with rounding 198*9880d681SAndroid Build Coastguard Worker /// towards zero. Used only as part of the long double-to-int 199*9880d681SAndroid Build Coastguard Worker /// conversion sequence. 200*9880d681SAndroid Build Coastguard Worker FADDRTZ, 201*9880d681SAndroid Build Coastguard Worker 202*9880d681SAndroid Build Coastguard Worker /// F8RC = MFFS - This moves the FPSCR (not modeled) into the register. 203*9880d681SAndroid Build Coastguard Worker MFFS, 204*9880d681SAndroid Build Coastguard Worker 205*9880d681SAndroid Build Coastguard Worker /// TC_RETURN - A tail call return. 206*9880d681SAndroid Build Coastguard Worker /// operand #0 chain 207*9880d681SAndroid Build Coastguard Worker /// operand #1 callee (register or absolute) 208*9880d681SAndroid Build Coastguard Worker /// operand #2 stack adjustment 209*9880d681SAndroid Build Coastguard Worker /// operand #3 optional in flag 210*9880d681SAndroid Build Coastguard Worker TC_RETURN, 211*9880d681SAndroid Build Coastguard Worker 212*9880d681SAndroid Build Coastguard Worker /// ch, gl = CR6[UN]SET ch, inglue - Toggle CR bit 6 for SVR4 vararg calls 213*9880d681SAndroid Build Coastguard Worker CR6SET, 214*9880d681SAndroid Build Coastguard Worker CR6UNSET, 215*9880d681SAndroid Build Coastguard Worker 216*9880d681SAndroid Build Coastguard Worker /// GPRC = address of _GLOBAL_OFFSET_TABLE_. Used by initial-exec TLS 217*9880d681SAndroid Build Coastguard Worker /// on PPC32. 218*9880d681SAndroid Build Coastguard Worker PPC32_GOT, 219*9880d681SAndroid Build Coastguard Worker 220*9880d681SAndroid Build Coastguard Worker /// GPRC = address of _GLOBAL_OFFSET_TABLE_. Used by general dynamic and 221*9880d681SAndroid Build Coastguard Worker /// local dynamic TLS on PPC32. 222*9880d681SAndroid Build Coastguard Worker PPC32_PICGOT, 223*9880d681SAndroid Build Coastguard Worker 224*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDIS_GOT_TPREL_HA %X2, Symbol - Used by the initial-exec 225*9880d681SAndroid Build Coastguard Worker /// TLS model, produces an ADDIS8 instruction that adds the GOT 226*9880d681SAndroid Build Coastguard Worker /// base to sym\@got\@tprel\@ha. 227*9880d681SAndroid Build Coastguard Worker ADDIS_GOT_TPREL_HA, 228*9880d681SAndroid Build Coastguard Worker 229*9880d681SAndroid Build Coastguard Worker /// G8RC = LD_GOT_TPREL_L Symbol, G8RReg - Used by the initial-exec 230*9880d681SAndroid Build Coastguard Worker /// TLS model, produces a LD instruction with base register G8RReg 231*9880d681SAndroid Build Coastguard Worker /// and offset sym\@got\@tprel\@l. This completes the addition that 232*9880d681SAndroid Build Coastguard Worker /// finds the offset of "sym" relative to the thread pointer. 233*9880d681SAndroid Build Coastguard Worker LD_GOT_TPREL_L, 234*9880d681SAndroid Build Coastguard Worker 235*9880d681SAndroid Build Coastguard Worker /// G8RC = ADD_TLS G8RReg, Symbol - Used by the initial-exec TLS 236*9880d681SAndroid Build Coastguard Worker /// model, produces an ADD instruction that adds the contents of 237*9880d681SAndroid Build Coastguard Worker /// G8RReg to the thread pointer. Symbol contains a relocation 238*9880d681SAndroid Build Coastguard Worker /// sym\@tls which is to be replaced by the thread pointer and 239*9880d681SAndroid Build Coastguard Worker /// identifies to the linker that the instruction is part of a 240*9880d681SAndroid Build Coastguard Worker /// TLS sequence. 241*9880d681SAndroid Build Coastguard Worker ADD_TLS, 242*9880d681SAndroid Build Coastguard Worker 243*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDIS_TLSGD_HA %X2, Symbol - For the general-dynamic TLS 244*9880d681SAndroid Build Coastguard Worker /// model, produces an ADDIS8 instruction that adds the GOT base 245*9880d681SAndroid Build Coastguard Worker /// register to sym\@got\@tlsgd\@ha. 246*9880d681SAndroid Build Coastguard Worker ADDIS_TLSGD_HA, 247*9880d681SAndroid Build Coastguard Worker 248*9880d681SAndroid Build Coastguard Worker /// %X3 = ADDI_TLSGD_L G8RReg, Symbol - For the general-dynamic TLS 249*9880d681SAndroid Build Coastguard Worker /// model, produces an ADDI8 instruction that adds G8RReg to 250*9880d681SAndroid Build Coastguard Worker /// sym\@got\@tlsgd\@l and stores the result in X3. Hidden by 251*9880d681SAndroid Build Coastguard Worker /// ADDIS_TLSGD_L_ADDR until after register assignment. 252*9880d681SAndroid Build Coastguard Worker ADDI_TLSGD_L, 253*9880d681SAndroid Build Coastguard Worker 254*9880d681SAndroid Build Coastguard Worker /// %X3 = GET_TLS_ADDR %X3, Symbol - For the general-dynamic TLS 255*9880d681SAndroid Build Coastguard Worker /// model, produces a call to __tls_get_addr(sym\@tlsgd). Hidden by 256*9880d681SAndroid Build Coastguard Worker /// ADDIS_TLSGD_L_ADDR until after register assignment. 257*9880d681SAndroid Build Coastguard Worker GET_TLS_ADDR, 258*9880d681SAndroid Build Coastguard Worker 259*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDI_TLSGD_L_ADDR G8RReg, Symbol, Symbol - Op that 260*9880d681SAndroid Build Coastguard Worker /// combines ADDI_TLSGD_L and GET_TLS_ADDR until expansion following 261*9880d681SAndroid Build Coastguard Worker /// register assignment. 262*9880d681SAndroid Build Coastguard Worker ADDI_TLSGD_L_ADDR, 263*9880d681SAndroid Build Coastguard Worker 264*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDIS_TLSLD_HA %X2, Symbol - For the local-dynamic TLS 265*9880d681SAndroid Build Coastguard Worker /// model, produces an ADDIS8 instruction that adds the GOT base 266*9880d681SAndroid Build Coastguard Worker /// register to sym\@got\@tlsld\@ha. 267*9880d681SAndroid Build Coastguard Worker ADDIS_TLSLD_HA, 268*9880d681SAndroid Build Coastguard Worker 269*9880d681SAndroid Build Coastguard Worker /// %X3 = ADDI_TLSLD_L G8RReg, Symbol - For the local-dynamic TLS 270*9880d681SAndroid Build Coastguard Worker /// model, produces an ADDI8 instruction that adds G8RReg to 271*9880d681SAndroid Build Coastguard Worker /// sym\@got\@tlsld\@l and stores the result in X3. Hidden by 272*9880d681SAndroid Build Coastguard Worker /// ADDIS_TLSLD_L_ADDR until after register assignment. 273*9880d681SAndroid Build Coastguard Worker ADDI_TLSLD_L, 274*9880d681SAndroid Build Coastguard Worker 275*9880d681SAndroid Build Coastguard Worker /// %X3 = GET_TLSLD_ADDR %X3, Symbol - For the local-dynamic TLS 276*9880d681SAndroid Build Coastguard Worker /// model, produces a call to __tls_get_addr(sym\@tlsld). Hidden by 277*9880d681SAndroid Build Coastguard Worker /// ADDIS_TLSLD_L_ADDR until after register assignment. 278*9880d681SAndroid Build Coastguard Worker GET_TLSLD_ADDR, 279*9880d681SAndroid Build Coastguard Worker 280*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDI_TLSLD_L_ADDR G8RReg, Symbol, Symbol - Op that 281*9880d681SAndroid Build Coastguard Worker /// combines ADDI_TLSLD_L and GET_TLSLD_ADDR until expansion 282*9880d681SAndroid Build Coastguard Worker /// following register assignment. 283*9880d681SAndroid Build Coastguard Worker ADDI_TLSLD_L_ADDR, 284*9880d681SAndroid Build Coastguard Worker 285*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDIS_DTPREL_HA %X3, Symbol - For the local-dynamic TLS 286*9880d681SAndroid Build Coastguard Worker /// model, produces an ADDIS8 instruction that adds X3 to 287*9880d681SAndroid Build Coastguard Worker /// sym\@dtprel\@ha. 288*9880d681SAndroid Build Coastguard Worker ADDIS_DTPREL_HA, 289*9880d681SAndroid Build Coastguard Worker 290*9880d681SAndroid Build Coastguard Worker /// G8RC = ADDI_DTPREL_L G8RReg, Symbol - For the local-dynamic TLS 291*9880d681SAndroid Build Coastguard Worker /// model, produces an ADDI8 instruction that adds G8RReg to 292*9880d681SAndroid Build Coastguard Worker /// sym\@got\@dtprel\@l. 293*9880d681SAndroid Build Coastguard Worker ADDI_DTPREL_L, 294*9880d681SAndroid Build Coastguard Worker 295*9880d681SAndroid Build Coastguard Worker /// VRRC = VADD_SPLAT Elt, EltSize - Temporary node to be expanded 296*9880d681SAndroid Build Coastguard Worker /// during instruction selection to optimize a BUILD_VECTOR into 297*9880d681SAndroid Build Coastguard Worker /// operations on splats. This is necessary to avoid losing these 298*9880d681SAndroid Build Coastguard Worker /// optimizations due to constant folding. 299*9880d681SAndroid Build Coastguard Worker VADD_SPLAT, 300*9880d681SAndroid Build Coastguard Worker 301*9880d681SAndroid Build Coastguard Worker /// CHAIN = SC CHAIN, Imm128 - System call. The 7-bit unsigned 302*9880d681SAndroid Build Coastguard Worker /// operand identifies the operating system entry point. 303*9880d681SAndroid Build Coastguard Worker SC, 304*9880d681SAndroid Build Coastguard Worker 305*9880d681SAndroid Build Coastguard Worker /// CHAIN = CLRBHRB CHAIN - Clear branch history rolling buffer. 306*9880d681SAndroid Build Coastguard Worker CLRBHRB, 307*9880d681SAndroid Build Coastguard Worker 308*9880d681SAndroid Build Coastguard Worker /// GPRC, CHAIN = MFBHRBE CHAIN, Entry, Dummy - Move from branch 309*9880d681SAndroid Build Coastguard Worker /// history rolling buffer entry. 310*9880d681SAndroid Build Coastguard Worker MFBHRBE, 311*9880d681SAndroid Build Coastguard Worker 312*9880d681SAndroid Build Coastguard Worker /// CHAIN = RFEBB CHAIN, State - Return from event-based branch. 313*9880d681SAndroid Build Coastguard Worker RFEBB, 314*9880d681SAndroid Build Coastguard Worker 315*9880d681SAndroid Build Coastguard Worker /// VSRC, CHAIN = XXSWAPD CHAIN, VSRC - Occurs only for little 316*9880d681SAndroid Build Coastguard Worker /// endian. Maps to an xxswapd instruction that corrects an lxvd2x 317*9880d681SAndroid Build Coastguard Worker /// or stxvd2x instruction. The chain is necessary because the 318*9880d681SAndroid Build Coastguard Worker /// sequence replaces a load and needs to provide the same number 319*9880d681SAndroid Build Coastguard Worker /// of outputs. 320*9880d681SAndroid Build Coastguard Worker XXSWAPD, 321*9880d681SAndroid Build Coastguard Worker 322*9880d681SAndroid Build Coastguard Worker /// An SDNode for swaps that are not associated with any loads/stores 323*9880d681SAndroid Build Coastguard Worker /// and thereby have no chain. 324*9880d681SAndroid Build Coastguard Worker SWAP_NO_CHAIN, 325*9880d681SAndroid Build Coastguard Worker 326*9880d681SAndroid Build Coastguard Worker /// QVFPERM = This corresponds to the QPX qvfperm instruction. 327*9880d681SAndroid Build Coastguard Worker QVFPERM, 328*9880d681SAndroid Build Coastguard Worker 329*9880d681SAndroid Build Coastguard Worker /// QVGPCI = This corresponds to the QPX qvgpci instruction. 330*9880d681SAndroid Build Coastguard Worker QVGPCI, 331*9880d681SAndroid Build Coastguard Worker 332*9880d681SAndroid Build Coastguard Worker /// QVALIGNI = This corresponds to the QPX qvaligni instruction. 333*9880d681SAndroid Build Coastguard Worker QVALIGNI, 334*9880d681SAndroid Build Coastguard Worker 335*9880d681SAndroid Build Coastguard Worker /// QVESPLATI = This corresponds to the QPX qvesplati instruction. 336*9880d681SAndroid Build Coastguard Worker QVESPLATI, 337*9880d681SAndroid Build Coastguard Worker 338*9880d681SAndroid Build Coastguard Worker /// QBFLT = Access the underlying QPX floating-point boolean 339*9880d681SAndroid Build Coastguard Worker /// representation. 340*9880d681SAndroid Build Coastguard Worker QBFLT, 341*9880d681SAndroid Build Coastguard Worker 342*9880d681SAndroid Build Coastguard Worker /// CHAIN = STBRX CHAIN, GPRC, Ptr, Type - This is a 343*9880d681SAndroid Build Coastguard Worker /// byte-swapping store instruction. It byte-swaps the low "Type" bits of 344*9880d681SAndroid Build Coastguard Worker /// the GPRC input, then stores it through Ptr. Type can be either i16 or 345*9880d681SAndroid Build Coastguard Worker /// i32. 346*9880d681SAndroid Build Coastguard Worker STBRX = ISD::FIRST_TARGET_MEMORY_OPCODE, 347*9880d681SAndroid Build Coastguard Worker 348*9880d681SAndroid Build Coastguard Worker /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a 349*9880d681SAndroid Build Coastguard Worker /// byte-swapping load instruction. It loads "Type" bits, byte swaps it, 350*9880d681SAndroid Build Coastguard Worker /// then puts it in the bottom bits of the GPRC. TYPE can be either i16 351*9880d681SAndroid Build Coastguard Worker /// or i32. 352*9880d681SAndroid Build Coastguard Worker LBRX, 353*9880d681SAndroid Build Coastguard Worker 354*9880d681SAndroid Build Coastguard Worker /// STFIWX - The STFIWX instruction. The first operand is an input token 355*9880d681SAndroid Build Coastguard Worker /// chain, then an f64 value to store, then an address to store it to. 356*9880d681SAndroid Build Coastguard Worker STFIWX, 357*9880d681SAndroid Build Coastguard Worker 358*9880d681SAndroid Build Coastguard Worker /// GPRC, CHAIN = LFIWAX CHAIN, Ptr - This is a floating-point 359*9880d681SAndroid Build Coastguard Worker /// load which sign-extends from a 32-bit integer value into the 360*9880d681SAndroid Build Coastguard Worker /// destination 64-bit register. 361*9880d681SAndroid Build Coastguard Worker LFIWAX, 362*9880d681SAndroid Build Coastguard Worker 363*9880d681SAndroid Build Coastguard Worker /// GPRC, CHAIN = LFIWZX CHAIN, Ptr - This is a floating-point 364*9880d681SAndroid Build Coastguard Worker /// load which zero-extends from a 32-bit integer value into the 365*9880d681SAndroid Build Coastguard Worker /// destination 64-bit register. 366*9880d681SAndroid Build Coastguard Worker LFIWZX, 367*9880d681SAndroid Build Coastguard Worker 368*9880d681SAndroid Build Coastguard Worker /// VSRC, CHAIN = LXVD2X_LE CHAIN, Ptr - Occurs only for little endian. 369*9880d681SAndroid Build Coastguard Worker /// Maps directly to an lxvd2x instruction that will be followed by 370*9880d681SAndroid Build Coastguard Worker /// an xxswapd. 371*9880d681SAndroid Build Coastguard Worker LXVD2X, 372*9880d681SAndroid Build Coastguard Worker 373*9880d681SAndroid Build Coastguard Worker /// CHAIN = STXVD2X CHAIN, VSRC, Ptr - Occurs only for little endian. 374*9880d681SAndroid Build Coastguard Worker /// Maps directly to an stxvd2x instruction that will be preceded by 375*9880d681SAndroid Build Coastguard Worker /// an xxswapd. 376*9880d681SAndroid Build Coastguard Worker STXVD2X, 377*9880d681SAndroid Build Coastguard Worker 378*9880d681SAndroid Build Coastguard Worker /// QBRC, CHAIN = QVLFSb CHAIN, Ptr 379*9880d681SAndroid Build Coastguard Worker /// The 4xf32 load used for v4i1 constants. 380*9880d681SAndroid Build Coastguard Worker QVLFSb, 381*9880d681SAndroid Build Coastguard Worker 382*9880d681SAndroid Build Coastguard Worker /// GPRC = TOC_ENTRY GA, TOC 383*9880d681SAndroid Build Coastguard Worker /// Loads the entry for GA from the TOC, where the TOC base is given by 384*9880d681SAndroid Build Coastguard Worker /// the last operand. 385*9880d681SAndroid Build Coastguard Worker TOC_ENTRY 386*9880d681SAndroid Build Coastguard Worker }; 387*9880d681SAndroid Build Coastguard Worker } 388*9880d681SAndroid Build Coastguard Worker 389*9880d681SAndroid Build Coastguard Worker /// Define some predicates that are used for node matching. 390*9880d681SAndroid Build Coastguard Worker namespace PPC { 391*9880d681SAndroid Build Coastguard Worker /// isVPKUHUMShuffleMask - Return true if this is the shuffle mask for a 392*9880d681SAndroid Build Coastguard Worker /// VPKUHUM instruction. 393*9880d681SAndroid Build Coastguard Worker bool isVPKUHUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind, 394*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG); 395*9880d681SAndroid Build Coastguard Worker 396*9880d681SAndroid Build Coastguard Worker /// isVPKUWUMShuffleMask - Return true if this is the shuffle mask for a 397*9880d681SAndroid Build Coastguard Worker /// VPKUWUM instruction. 398*9880d681SAndroid Build Coastguard Worker bool isVPKUWUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind, 399*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG); 400*9880d681SAndroid Build Coastguard Worker 401*9880d681SAndroid Build Coastguard Worker /// isVPKUDUMShuffleMask - Return true if this is the shuffle mask for a 402*9880d681SAndroid Build Coastguard Worker /// VPKUDUM instruction. 403*9880d681SAndroid Build Coastguard Worker bool isVPKUDUMShuffleMask(ShuffleVectorSDNode *N, unsigned ShuffleKind, 404*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG); 405*9880d681SAndroid Build Coastguard Worker 406*9880d681SAndroid Build Coastguard Worker /// isVMRGLShuffleMask - Return true if this is a shuffle mask suitable for 407*9880d681SAndroid Build Coastguard Worker /// a VRGL* instruction with the specified unit size (1,2 or 4 bytes). 408*9880d681SAndroid Build Coastguard Worker bool isVMRGLShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize, 409*9880d681SAndroid Build Coastguard Worker unsigned ShuffleKind, SelectionDAG &DAG); 410*9880d681SAndroid Build Coastguard Worker 411*9880d681SAndroid Build Coastguard Worker /// isVMRGHShuffleMask - Return true if this is a shuffle mask suitable for 412*9880d681SAndroid Build Coastguard Worker /// a VRGH* instruction with the specified unit size (1,2 or 4 bytes). 413*9880d681SAndroid Build Coastguard Worker bool isVMRGHShuffleMask(ShuffleVectorSDNode *N, unsigned UnitSize, 414*9880d681SAndroid Build Coastguard Worker unsigned ShuffleKind, SelectionDAG &DAG); 415*9880d681SAndroid Build Coastguard Worker 416*9880d681SAndroid Build Coastguard Worker /// isVMRGEOShuffleMask - Return true if this is a shuffle mask suitable for 417*9880d681SAndroid Build Coastguard Worker /// a VMRGEW or VMRGOW instruction 418*9880d681SAndroid Build Coastguard Worker bool isVMRGEOShuffleMask(ShuffleVectorSDNode *N, bool CheckEven, 419*9880d681SAndroid Build Coastguard Worker unsigned ShuffleKind, SelectionDAG &DAG); 420*9880d681SAndroid Build Coastguard Worker 421*9880d681SAndroid Build Coastguard Worker /// isVSLDOIShuffleMask - If this is a vsldoi shuffle mask, return the 422*9880d681SAndroid Build Coastguard Worker /// shift amount, otherwise return -1. 423*9880d681SAndroid Build Coastguard Worker int isVSLDOIShuffleMask(SDNode *N, unsigned ShuffleKind, 424*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG); 425*9880d681SAndroid Build Coastguard Worker 426*9880d681SAndroid Build Coastguard Worker /// isSplatShuffleMask - Return true if the specified VECTOR_SHUFFLE operand 427*9880d681SAndroid Build Coastguard Worker /// specifies a splat of a single element that is suitable for input to 428*9880d681SAndroid Build Coastguard Worker /// VSPLTB/VSPLTH/VSPLTW. 429*9880d681SAndroid Build Coastguard Worker bool isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize); 430*9880d681SAndroid Build Coastguard Worker 431*9880d681SAndroid Build Coastguard Worker /// isXXINSERTWMask - Return true if this VECTOR_SHUFFLE can be handled by 432*9880d681SAndroid Build Coastguard Worker /// the XXINSERTW instruction introduced in ISA 3.0. This is essentially any 433*9880d681SAndroid Build Coastguard Worker /// shuffle of v4f32/v4i32 vectors that just inserts one element from one 434*9880d681SAndroid Build Coastguard Worker /// vector into the other. This function will also set a couple of 435*9880d681SAndroid Build Coastguard Worker /// output parameters for how much the source vector needs to be shifted and 436*9880d681SAndroid Build Coastguard Worker /// what byte number needs to be specified for the instruction to put the 437*9880d681SAndroid Build Coastguard Worker /// element in the desired location of the target vector. 438*9880d681SAndroid Build Coastguard Worker bool isXXINSERTWMask(ShuffleVectorSDNode *N, unsigned &ShiftElts, 439*9880d681SAndroid Build Coastguard Worker unsigned &InsertAtByte, bool &Swap, bool IsLE); 440*9880d681SAndroid Build Coastguard Worker 441*9880d681SAndroid Build Coastguard Worker /// getVSPLTImmediate - Return the appropriate VSPLT* immediate to splat the 442*9880d681SAndroid Build Coastguard Worker /// specified isSplatShuffleMask VECTOR_SHUFFLE mask. 443*9880d681SAndroid Build Coastguard Worker unsigned getVSPLTImmediate(SDNode *N, unsigned EltSize, SelectionDAG &DAG); 444*9880d681SAndroid Build Coastguard Worker 445*9880d681SAndroid Build Coastguard Worker /// get_VSPLTI_elt - If this is a build_vector of constants which can be 446*9880d681SAndroid Build Coastguard Worker /// formed by using a vspltis[bhw] instruction of the specified element 447*9880d681SAndroid Build Coastguard Worker /// size, return the constant being splatted. The ByteSize field indicates 448*9880d681SAndroid Build Coastguard Worker /// the number of bytes of each element [124] -> [bhw]. 449*9880d681SAndroid Build Coastguard Worker SDValue get_VSPLTI_elt(SDNode *N, unsigned ByteSize, SelectionDAG &DAG); 450*9880d681SAndroid Build Coastguard Worker 451*9880d681SAndroid Build Coastguard Worker /// If this is a qvaligni shuffle mask, return the shift 452*9880d681SAndroid Build Coastguard Worker /// amount, otherwise return -1. 453*9880d681SAndroid Build Coastguard Worker int isQVALIGNIShuffleMask(SDNode *N); 454*9880d681SAndroid Build Coastguard Worker } 455*9880d681SAndroid Build Coastguard Worker 456*9880d681SAndroid Build Coastguard Worker class PPCTargetLowering : public TargetLowering { 457*9880d681SAndroid Build Coastguard Worker const PPCSubtarget &Subtarget; 458*9880d681SAndroid Build Coastguard Worker 459*9880d681SAndroid Build Coastguard Worker public: 460*9880d681SAndroid Build Coastguard Worker explicit PPCTargetLowering(const PPCTargetMachine &TM, 461*9880d681SAndroid Build Coastguard Worker const PPCSubtarget &STI); 462*9880d681SAndroid Build Coastguard Worker 463*9880d681SAndroid Build Coastguard Worker /// getTargetNodeName() - This method returns the name of a target specific 464*9880d681SAndroid Build Coastguard Worker /// DAG node. 465*9880d681SAndroid Build Coastguard Worker const char *getTargetNodeName(unsigned Opcode) const override; 466*9880d681SAndroid Build Coastguard Worker 467*9880d681SAndroid Build Coastguard Worker /// getPreferredVectorAction - The code we generate when vector types are 468*9880d681SAndroid Build Coastguard Worker /// legalized by promoting the integer element type is often much worse 469*9880d681SAndroid Build Coastguard Worker /// than code we generate if we widen the type for applicable vector types. 470*9880d681SAndroid Build Coastguard Worker /// The issue with promoting is that the vector is scalaraized, individual 471*9880d681SAndroid Build Coastguard Worker /// elements promoted and then the vector is rebuilt. So say we load a pair 472*9880d681SAndroid Build Coastguard Worker /// of v4i8's and shuffle them. This will turn into a mess of 8 extending 473*9880d681SAndroid Build Coastguard Worker /// loads, moves back into VSR's (or memory ops if we don't have moves) and 474*9880d681SAndroid Build Coastguard Worker /// then the VPERM for the shuffle. All in all a very slow sequence. getPreferredVectorAction(EVT VT)475*9880d681SAndroid Build Coastguard Worker TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(EVT VT) 476*9880d681SAndroid Build Coastguard Worker const override { 477*9880d681SAndroid Build Coastguard Worker if (VT.getVectorElementType().getSizeInBits() % 8 == 0) 478*9880d681SAndroid Build Coastguard Worker return TypeWidenVector; 479*9880d681SAndroid Build Coastguard Worker return TargetLoweringBase::getPreferredVectorAction(VT); 480*9880d681SAndroid Build Coastguard Worker } 481*9880d681SAndroid Build Coastguard Worker bool useSoftFloat() const override; 482*9880d681SAndroid Build Coastguard Worker getScalarShiftAmountTy(const DataLayout &,EVT)483*9880d681SAndroid Build Coastguard Worker MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override { 484*9880d681SAndroid Build Coastguard Worker return MVT::i32; 485*9880d681SAndroid Build Coastguard Worker } 486*9880d681SAndroid Build Coastguard Worker isCheapToSpeculateCttz()487*9880d681SAndroid Build Coastguard Worker bool isCheapToSpeculateCttz() const override { 488*9880d681SAndroid Build Coastguard Worker return true; 489*9880d681SAndroid Build Coastguard Worker } 490*9880d681SAndroid Build Coastguard Worker isCheapToSpeculateCtlz()491*9880d681SAndroid Build Coastguard Worker bool isCheapToSpeculateCtlz() const override { 492*9880d681SAndroid Build Coastguard Worker return true; 493*9880d681SAndroid Build Coastguard Worker } 494*9880d681SAndroid Build Coastguard Worker supportSplitCSR(MachineFunction * MF)495*9880d681SAndroid Build Coastguard Worker bool supportSplitCSR(MachineFunction *MF) const override { 496*9880d681SAndroid Build Coastguard Worker return 497*9880d681SAndroid Build Coastguard Worker MF->getFunction()->getCallingConv() == CallingConv::CXX_FAST_TLS && 498*9880d681SAndroid Build Coastguard Worker MF->getFunction()->hasFnAttribute(Attribute::NoUnwind); 499*9880d681SAndroid Build Coastguard Worker } 500*9880d681SAndroid Build Coastguard Worker 501*9880d681SAndroid Build Coastguard Worker void initializeSplitCSR(MachineBasicBlock *Entry) const override; 502*9880d681SAndroid Build Coastguard Worker 503*9880d681SAndroid Build Coastguard Worker void insertCopiesSplitCSR( 504*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *Entry, 505*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<MachineBasicBlock *> &Exits) const override; 506*9880d681SAndroid Build Coastguard Worker 507*9880d681SAndroid Build Coastguard Worker /// getSetCCResultType - Return the ISD::SETCC ValueType 508*9880d681SAndroid Build Coastguard Worker EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, 509*9880d681SAndroid Build Coastguard Worker EVT VT) const override; 510*9880d681SAndroid Build Coastguard Worker 511*9880d681SAndroid Build Coastguard Worker /// Return true if target always beneficiates from combining into FMA for a 512*9880d681SAndroid Build Coastguard Worker /// given value type. This must typically return false on targets where FMA 513*9880d681SAndroid Build Coastguard Worker /// takes more cycles to execute than FADD. 514*9880d681SAndroid Build Coastguard Worker bool enableAggressiveFMAFusion(EVT VT) const override; 515*9880d681SAndroid Build Coastguard Worker 516*9880d681SAndroid Build Coastguard Worker /// getPreIndexedAddressParts - returns true by value, base pointer and 517*9880d681SAndroid Build Coastguard Worker /// offset pointer and addressing mode by reference if the node's address 518*9880d681SAndroid Build Coastguard Worker /// can be legally represented as pre-indexed load / store address. 519*9880d681SAndroid Build Coastguard Worker bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, 520*9880d681SAndroid Build Coastguard Worker SDValue &Offset, 521*9880d681SAndroid Build Coastguard Worker ISD::MemIndexedMode &AM, 522*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 523*9880d681SAndroid Build Coastguard Worker 524*9880d681SAndroid Build Coastguard Worker /// SelectAddressRegReg - Given the specified addressed, check to see if it 525*9880d681SAndroid Build Coastguard Worker /// can be represented as an indexed [r+r] operation. Returns false if it 526*9880d681SAndroid Build Coastguard Worker /// can be more efficiently represented with [r+imm]. 527*9880d681SAndroid Build Coastguard Worker bool SelectAddressRegReg(SDValue N, SDValue &Base, SDValue &Index, 528*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const; 529*9880d681SAndroid Build Coastguard Worker 530*9880d681SAndroid Build Coastguard Worker /// SelectAddressRegImm - Returns true if the address N can be represented 531*9880d681SAndroid Build Coastguard Worker /// by a base register plus a signed 16-bit displacement [r+imm], and if it 532*9880d681SAndroid Build Coastguard Worker /// is not better represented as reg+reg. If Aligned is true, only accept 533*9880d681SAndroid Build Coastguard Worker /// displacements suitable for STD and friends, i.e. multiples of 4. 534*9880d681SAndroid Build Coastguard Worker bool SelectAddressRegImm(SDValue N, SDValue &Disp, SDValue &Base, 535*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, bool Aligned) const; 536*9880d681SAndroid Build Coastguard Worker 537*9880d681SAndroid Build Coastguard Worker /// SelectAddressRegRegOnly - Given the specified addressed, force it to be 538*9880d681SAndroid Build Coastguard Worker /// represented as an indexed [r+r] operation. 539*9880d681SAndroid Build Coastguard Worker bool SelectAddressRegRegOnly(SDValue N, SDValue &Base, SDValue &Index, 540*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const; 541*9880d681SAndroid Build Coastguard Worker 542*9880d681SAndroid Build Coastguard Worker Sched::Preference getSchedulingPreference(SDNode *N) const override; 543*9880d681SAndroid Build Coastguard Worker 544*9880d681SAndroid Build Coastguard Worker /// LowerOperation - Provide custom lowering hooks for some operations. 545*9880d681SAndroid Build Coastguard Worker /// 546*9880d681SAndroid Build Coastguard Worker SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; 547*9880d681SAndroid Build Coastguard Worker 548*9880d681SAndroid Build Coastguard Worker /// ReplaceNodeResults - Replace the results of node with an illegal result 549*9880d681SAndroid Build Coastguard Worker /// type with new values built out of custom code. 550*9880d681SAndroid Build Coastguard Worker /// 551*9880d681SAndroid Build Coastguard Worker void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 552*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 553*9880d681SAndroid Build Coastguard Worker 554*9880d681SAndroid Build Coastguard Worker SDValue expandVSXLoadForLE(SDNode *N, DAGCombinerInfo &DCI) const; 555*9880d681SAndroid Build Coastguard Worker SDValue expandVSXStoreForLE(SDNode *N, DAGCombinerInfo &DCI) const; 556*9880d681SAndroid Build Coastguard Worker 557*9880d681SAndroid Build Coastguard Worker SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; 558*9880d681SAndroid Build Coastguard Worker 559*9880d681SAndroid Build Coastguard Worker SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG, 560*9880d681SAndroid Build Coastguard Worker std::vector<SDNode *> *Created) const override; 561*9880d681SAndroid Build Coastguard Worker 562*9880d681SAndroid Build Coastguard Worker unsigned getRegisterByName(const char* RegName, EVT VT, 563*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 564*9880d681SAndroid Build Coastguard Worker 565*9880d681SAndroid Build Coastguard Worker void computeKnownBitsForTargetNode(const SDValue Op, 566*9880d681SAndroid Build Coastguard Worker APInt &KnownZero, 567*9880d681SAndroid Build Coastguard Worker APInt &KnownOne, 568*9880d681SAndroid Build Coastguard Worker const SelectionDAG &DAG, 569*9880d681SAndroid Build Coastguard Worker unsigned Depth = 0) const override; 570*9880d681SAndroid Build Coastguard Worker 571*9880d681SAndroid Build Coastguard Worker unsigned getPrefLoopAlignment(MachineLoop *ML) const override; 572*9880d681SAndroid Build Coastguard Worker shouldInsertFencesForAtomic(const Instruction * I)573*9880d681SAndroid Build Coastguard Worker bool shouldInsertFencesForAtomic(const Instruction *I) const override { 574*9880d681SAndroid Build Coastguard Worker return true; 575*9880d681SAndroid Build Coastguard Worker } 576*9880d681SAndroid Build Coastguard Worker 577*9880d681SAndroid Build Coastguard Worker Instruction* emitLeadingFence(IRBuilder<> &Builder, AtomicOrdering Ord, 578*9880d681SAndroid Build Coastguard Worker bool IsStore, bool IsLoad) const override; 579*9880d681SAndroid Build Coastguard Worker Instruction* emitTrailingFence(IRBuilder<> &Builder, AtomicOrdering Ord, 580*9880d681SAndroid Build Coastguard Worker bool IsStore, bool IsLoad) const override; 581*9880d681SAndroid Build Coastguard Worker 582*9880d681SAndroid Build Coastguard Worker MachineBasicBlock * 583*9880d681SAndroid Build Coastguard Worker EmitInstrWithCustomInserter(MachineInstr &MI, 584*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const override; 585*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *EmitAtomicBinary(MachineInstr &MI, 586*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB, 587*9880d681SAndroid Build Coastguard Worker unsigned AtomicSize, 588*9880d681SAndroid Build Coastguard Worker unsigned BinOpcode) const; 589*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *EmitPartwordAtomicBinary(MachineInstr &MI, 590*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB, 591*9880d681SAndroid Build Coastguard Worker bool is8bit, 592*9880d681SAndroid Build Coastguard Worker unsigned Opcode) const; 593*9880d681SAndroid Build Coastguard Worker 594*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI, 595*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const; 596*9880d681SAndroid Build Coastguard Worker 597*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *emitEHSjLjLongJmp(MachineInstr &MI, 598*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const; 599*9880d681SAndroid Build Coastguard Worker 600*9880d681SAndroid Build Coastguard Worker ConstraintType getConstraintType(StringRef Constraint) const override; 601*9880d681SAndroid Build Coastguard Worker 602*9880d681SAndroid Build Coastguard Worker /// Examine constraint string and operand type and determine a weight value. 603*9880d681SAndroid Build Coastguard Worker /// The operand object must already have been set up with the operand type. 604*9880d681SAndroid Build Coastguard Worker ConstraintWeight getSingleConstraintMatchWeight( 605*9880d681SAndroid Build Coastguard Worker AsmOperandInfo &info, const char *constraint) const override; 606*9880d681SAndroid Build Coastguard Worker 607*9880d681SAndroid Build Coastguard Worker std::pair<unsigned, const TargetRegisterClass *> 608*9880d681SAndroid Build Coastguard Worker getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, 609*9880d681SAndroid Build Coastguard Worker StringRef Constraint, MVT VT) const override; 610*9880d681SAndroid Build Coastguard Worker 611*9880d681SAndroid Build Coastguard Worker /// getByValTypeAlignment - Return the desired alignment for ByVal aggregate 612*9880d681SAndroid Build Coastguard Worker /// function arguments in the caller parameter area. This is the actual 613*9880d681SAndroid Build Coastguard Worker /// alignment, not its logarithm. 614*9880d681SAndroid Build Coastguard Worker unsigned getByValTypeAlignment(Type *Ty, 615*9880d681SAndroid Build Coastguard Worker const DataLayout &DL) const override; 616*9880d681SAndroid Build Coastguard Worker 617*9880d681SAndroid Build Coastguard Worker /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops 618*9880d681SAndroid Build Coastguard Worker /// vector. If it is invalid, don't add anything to Ops. 619*9880d681SAndroid Build Coastguard Worker void LowerAsmOperandForConstraint(SDValue Op, 620*9880d681SAndroid Build Coastguard Worker std::string &Constraint, 621*9880d681SAndroid Build Coastguard Worker std::vector<SDValue> &Ops, 622*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 623*9880d681SAndroid Build Coastguard Worker 624*9880d681SAndroid Build Coastguard Worker unsigned getInlineAsmMemConstraint(StringRef ConstraintCode)625*9880d681SAndroid Build Coastguard Worker getInlineAsmMemConstraint(StringRef ConstraintCode) const override { 626*9880d681SAndroid Build Coastguard Worker if (ConstraintCode == "es") 627*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_es; 628*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode == "o") 629*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_o; 630*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode == "Q") 631*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Q; 632*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode == "Z") 633*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Z; 634*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode == "Zy") 635*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Zy; 636*9880d681SAndroid Build Coastguard Worker return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); 637*9880d681SAndroid Build Coastguard Worker } 638*9880d681SAndroid Build Coastguard Worker 639*9880d681SAndroid Build Coastguard Worker /// isLegalAddressingMode - Return true if the addressing mode represented 640*9880d681SAndroid Build Coastguard Worker /// by AM is legal for this target, for a load/store of the specified type. 641*9880d681SAndroid Build Coastguard Worker bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, 642*9880d681SAndroid Build Coastguard Worker Type *Ty, unsigned AS) const override; 643*9880d681SAndroid Build Coastguard Worker 644*9880d681SAndroid Build Coastguard Worker /// isLegalICmpImmediate - Return true if the specified immediate is legal 645*9880d681SAndroid Build Coastguard Worker /// icmp immediate, that is the target has icmp instructions which can 646*9880d681SAndroid Build Coastguard Worker /// compare a register against the immediate without having to materialize 647*9880d681SAndroid Build Coastguard Worker /// the immediate into a register. 648*9880d681SAndroid Build Coastguard Worker bool isLegalICmpImmediate(int64_t Imm) const override; 649*9880d681SAndroid Build Coastguard Worker 650*9880d681SAndroid Build Coastguard Worker /// isLegalAddImmediate - Return true if the specified immediate is legal 651*9880d681SAndroid Build Coastguard Worker /// add immediate, that is the target has add instructions which can 652*9880d681SAndroid Build Coastguard Worker /// add a register and the immediate without having to materialize 653*9880d681SAndroid Build Coastguard Worker /// the immediate into a register. 654*9880d681SAndroid Build Coastguard Worker bool isLegalAddImmediate(int64_t Imm) const override; 655*9880d681SAndroid Build Coastguard Worker 656*9880d681SAndroid Build Coastguard Worker /// isTruncateFree - Return true if it's free to truncate a value of 657*9880d681SAndroid Build Coastguard Worker /// type Ty1 to type Ty2. e.g. On PPC it's free to truncate a i64 value in 658*9880d681SAndroid Build Coastguard Worker /// register X1 to i32 by referencing its sub-register R1. 659*9880d681SAndroid Build Coastguard Worker bool isTruncateFree(Type *Ty1, Type *Ty2) const override; 660*9880d681SAndroid Build Coastguard Worker bool isTruncateFree(EVT VT1, EVT VT2) const override; 661*9880d681SAndroid Build Coastguard Worker 662*9880d681SAndroid Build Coastguard Worker bool isZExtFree(SDValue Val, EVT VT2) const override; 663*9880d681SAndroid Build Coastguard Worker 664*9880d681SAndroid Build Coastguard Worker bool isFPExtFree(EVT VT) const override; 665*9880d681SAndroid Build Coastguard Worker 666*9880d681SAndroid Build Coastguard Worker /// \brief Returns true if it is beneficial to convert a load of a constant 667*9880d681SAndroid Build Coastguard Worker /// to just the constant itself. 668*9880d681SAndroid Build Coastguard Worker bool shouldConvertConstantLoadToIntImm(const APInt &Imm, 669*9880d681SAndroid Build Coastguard Worker Type *Ty) const override; 670*9880d681SAndroid Build Coastguard Worker 671*9880d681SAndroid Build Coastguard Worker bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; 672*9880d681SAndroid Build Coastguard Worker 673*9880d681SAndroid Build Coastguard Worker bool getTgtMemIntrinsic(IntrinsicInfo &Info, 674*9880d681SAndroid Build Coastguard Worker const CallInst &I, 675*9880d681SAndroid Build Coastguard Worker unsigned Intrinsic) const override; 676*9880d681SAndroid Build Coastguard Worker 677*9880d681SAndroid Build Coastguard Worker /// getOptimalMemOpType - Returns the target specific optimal type for load 678*9880d681SAndroid Build Coastguard Worker /// and store operations as a result of memset, memcpy, and memmove 679*9880d681SAndroid Build Coastguard Worker /// lowering. If DstAlign is zero that means it's safe to destination 680*9880d681SAndroid Build Coastguard Worker /// alignment can satisfy any constraint. Similarly if SrcAlign is zero it 681*9880d681SAndroid Build Coastguard Worker /// means there isn't a need to check it against alignment requirement, 682*9880d681SAndroid Build Coastguard Worker /// probably because the source does not need to be loaded. If 'IsMemset' is 683*9880d681SAndroid Build Coastguard Worker /// true, that means it's expanding a memset. If 'ZeroMemset' is true, that 684*9880d681SAndroid Build Coastguard Worker /// means it's a memset of zero. 'MemcpyStrSrc' indicates whether the memcpy 685*9880d681SAndroid Build Coastguard Worker /// source is constant so it does not need to be loaded. 686*9880d681SAndroid Build Coastguard Worker /// It returns EVT::Other if the type should be determined using generic 687*9880d681SAndroid Build Coastguard Worker /// target-independent logic. 688*9880d681SAndroid Build Coastguard Worker EVT 689*9880d681SAndroid Build Coastguard Worker getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, 690*9880d681SAndroid Build Coastguard Worker bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, 691*9880d681SAndroid Build Coastguard Worker MachineFunction &MF) const override; 692*9880d681SAndroid Build Coastguard Worker 693*9880d681SAndroid Build Coastguard Worker /// Is unaligned memory access allowed for the given type, and is it fast 694*9880d681SAndroid Build Coastguard Worker /// relative to software emulation. 695*9880d681SAndroid Build Coastguard Worker bool allowsMisalignedMemoryAccesses(EVT VT, 696*9880d681SAndroid Build Coastguard Worker unsigned AddrSpace, 697*9880d681SAndroid Build Coastguard Worker unsigned Align = 1, 698*9880d681SAndroid Build Coastguard Worker bool *Fast = nullptr) const override; 699*9880d681SAndroid Build Coastguard Worker 700*9880d681SAndroid Build Coastguard Worker /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster 701*9880d681SAndroid Build Coastguard Worker /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be 702*9880d681SAndroid Build Coastguard Worker /// expanded to FMAs when this method returns true, otherwise fmuladd is 703*9880d681SAndroid Build Coastguard Worker /// expanded to fmul + fadd. 704*9880d681SAndroid Build Coastguard Worker bool isFMAFasterThanFMulAndFAdd(EVT VT) const override; 705*9880d681SAndroid Build Coastguard Worker 706*9880d681SAndroid Build Coastguard Worker const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override; 707*9880d681SAndroid Build Coastguard Worker 708*9880d681SAndroid Build Coastguard Worker // Should we expand the build vector with shuffles? 709*9880d681SAndroid Build Coastguard Worker bool 710*9880d681SAndroid Build Coastguard Worker shouldExpandBuildVectorWithShuffles(EVT VT, 711*9880d681SAndroid Build Coastguard Worker unsigned DefinedValues) const override; 712*9880d681SAndroid Build Coastguard Worker 713*9880d681SAndroid Build Coastguard Worker /// createFastISel - This method returns a target-specific FastISel object, 714*9880d681SAndroid Build Coastguard Worker /// or null if the target does not support "fast" instruction selection. 715*9880d681SAndroid Build Coastguard Worker FastISel *createFastISel(FunctionLoweringInfo &FuncInfo, 716*9880d681SAndroid Build Coastguard Worker const TargetLibraryInfo *LibInfo) const override; 717*9880d681SAndroid Build Coastguard Worker 718*9880d681SAndroid Build Coastguard Worker /// \brief Returns true if an argument of type Ty needs to be passed in a 719*9880d681SAndroid Build Coastguard Worker /// contiguous block of registers in calling convention CallConv. functionArgumentNeedsConsecutiveRegisters(Type * Ty,CallingConv::ID CallConv,bool isVarArg)720*9880d681SAndroid Build Coastguard Worker bool functionArgumentNeedsConsecutiveRegisters( 721*9880d681SAndroid Build Coastguard Worker Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override { 722*9880d681SAndroid Build Coastguard Worker // We support any array type as "consecutive" block in the parameter 723*9880d681SAndroid Build Coastguard Worker // save area. The element type defines the alignment requirement and 724*9880d681SAndroid Build Coastguard Worker // whether the argument should go in GPRs, FPRs, or VRs if available. 725*9880d681SAndroid Build Coastguard Worker // 726*9880d681SAndroid Build Coastguard Worker // Note that clang uses this capability both to implement the ELFv2 727*9880d681SAndroid Build Coastguard Worker // homogeneous float/vector aggregate ABI, and to avoid having to use 728*9880d681SAndroid Build Coastguard Worker // "byval" when passing aggregates that might fully fit in registers. 729*9880d681SAndroid Build Coastguard Worker return Ty->isArrayTy(); 730*9880d681SAndroid Build Coastguard Worker } 731*9880d681SAndroid Build Coastguard Worker 732*9880d681SAndroid Build Coastguard Worker /// If a physical register, this returns the register that receives the 733*9880d681SAndroid Build Coastguard Worker /// exception address on entry to an EH pad. 734*9880d681SAndroid Build Coastguard Worker unsigned 735*9880d681SAndroid Build Coastguard Worker getExceptionPointerRegister(const Constant *PersonalityFn) const override; 736*9880d681SAndroid Build Coastguard Worker 737*9880d681SAndroid Build Coastguard Worker /// If a physical register, this returns the register that receives the 738*9880d681SAndroid Build Coastguard Worker /// exception typeid on entry to a landing pad. 739*9880d681SAndroid Build Coastguard Worker unsigned 740*9880d681SAndroid Build Coastguard Worker getExceptionSelectorRegister(const Constant *PersonalityFn) const override; 741*9880d681SAndroid Build Coastguard Worker 742*9880d681SAndroid Build Coastguard Worker /// Override to support customized stack guard loading. 743*9880d681SAndroid Build Coastguard Worker bool useLoadStackGuardNode() const override; 744*9880d681SAndroid Build Coastguard Worker void insertSSPDeclarations(Module &M) const override; 745*9880d681SAndroid Build Coastguard Worker 746*9880d681SAndroid Build Coastguard Worker private: 747*9880d681SAndroid Build Coastguard Worker struct ReuseLoadInfo { 748*9880d681SAndroid Build Coastguard Worker SDValue Ptr; 749*9880d681SAndroid Build Coastguard Worker SDValue Chain; 750*9880d681SAndroid Build Coastguard Worker SDValue ResChain; 751*9880d681SAndroid Build Coastguard Worker MachinePointerInfo MPI; 752*9880d681SAndroid Build Coastguard Worker bool IsInvariant; 753*9880d681SAndroid Build Coastguard Worker unsigned Alignment; 754*9880d681SAndroid Build Coastguard Worker AAMDNodes AAInfo; 755*9880d681SAndroid Build Coastguard Worker const MDNode *Ranges; 756*9880d681SAndroid Build Coastguard Worker ReuseLoadInfoReuseLoadInfo757*9880d681SAndroid Build Coastguard Worker ReuseLoadInfo() : IsInvariant(false), Alignment(0), Ranges(nullptr) {} 758*9880d681SAndroid Build Coastguard Worker }; 759*9880d681SAndroid Build Coastguard Worker 760*9880d681SAndroid Build Coastguard Worker bool canReuseLoadAddress(SDValue Op, EVT MemVT, ReuseLoadInfo &RLI, 761*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, 762*9880d681SAndroid Build Coastguard Worker ISD::LoadExtType ET = ISD::NON_EXTLOAD) const; 763*9880d681SAndroid Build Coastguard Worker void spliceIntoChain(SDValue ResChain, SDValue NewResChain, 764*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const; 765*9880d681SAndroid Build Coastguard Worker 766*9880d681SAndroid Build Coastguard Worker void LowerFP_TO_INTForReuse(SDValue Op, ReuseLoadInfo &RLI, 767*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, const SDLoc &dl) const; 768*9880d681SAndroid Build Coastguard Worker SDValue LowerFP_TO_INTDirectMove(SDValue Op, SelectionDAG &DAG, 769*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 770*9880d681SAndroid Build Coastguard Worker SDValue LowerINT_TO_FPDirectMove(SDValue Op, SelectionDAG &DAG, 771*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 772*9880d681SAndroid Build Coastguard Worker 773*9880d681SAndroid Build Coastguard Worker SDValue getFramePointerFrameIndex(SelectionDAG & DAG) const; 774*9880d681SAndroid Build Coastguard Worker SDValue getReturnAddrFrameIndex(SelectionDAG & DAG) const; 775*9880d681SAndroid Build Coastguard Worker 776*9880d681SAndroid Build Coastguard Worker bool 777*9880d681SAndroid Build Coastguard Worker IsEligibleForTailCallOptimization(SDValue Callee, 778*9880d681SAndroid Build Coastguard Worker CallingConv::ID CalleeCC, 779*9880d681SAndroid Build Coastguard Worker bool isVarArg, 780*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 781*9880d681SAndroid Build Coastguard Worker SelectionDAG& DAG) const; 782*9880d681SAndroid Build Coastguard Worker 783*9880d681SAndroid Build Coastguard Worker bool 784*9880d681SAndroid Build Coastguard Worker IsEligibleForTailCallOptimization_64SVR4( 785*9880d681SAndroid Build Coastguard Worker SDValue Callee, 786*9880d681SAndroid Build Coastguard Worker CallingConv::ID CalleeCC, 787*9880d681SAndroid Build Coastguard Worker ImmutableCallSite *CS, 788*9880d681SAndroid Build Coastguard Worker bool isVarArg, 789*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 790*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 791*9880d681SAndroid Build Coastguard Worker SelectionDAG& DAG) const; 792*9880d681SAndroid Build Coastguard Worker 793*9880d681SAndroid Build Coastguard Worker SDValue EmitTailCallLoadFPAndRetAddr(SelectionDAG &DAG, int SPDiff, 794*9880d681SAndroid Build Coastguard Worker SDValue Chain, SDValue &LROpOut, 795*9880d681SAndroid Build Coastguard Worker SDValue &FPOpOut, 796*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 797*9880d681SAndroid Build Coastguard Worker 798*9880d681SAndroid Build Coastguard Worker SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; 799*9880d681SAndroid Build Coastguard Worker SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; 800*9880d681SAndroid Build Coastguard Worker SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const; 801*9880d681SAndroid Build Coastguard Worker SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; 802*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; 803*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; 804*9880d681SAndroid Build Coastguard Worker SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const; 805*9880d681SAndroid Build Coastguard Worker SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const; 806*9880d681SAndroid Build Coastguard Worker SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const; 807*9880d681SAndroid Build Coastguard Worker SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const; 808*9880d681SAndroid Build Coastguard Worker SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const; 809*9880d681SAndroid Build Coastguard Worker SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const; 810*9880d681SAndroid Build Coastguard Worker SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG) const; 811*9880d681SAndroid Build Coastguard Worker SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG) const; 812*9880d681SAndroid Build Coastguard Worker SDValue LowerGET_DYNAMIC_AREA_OFFSET(SDValue Op, SelectionDAG &DAG) const; 813*9880d681SAndroid Build Coastguard Worker SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const; 814*9880d681SAndroid Build Coastguard Worker SDValue LowerLOAD(SDValue Op, SelectionDAG &DAG) const; 815*9880d681SAndroid Build Coastguard Worker SDValue LowerSTORE(SDValue Op, SelectionDAG &DAG) const; 816*9880d681SAndroid Build Coastguard Worker SDValue LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const; 817*9880d681SAndroid Build Coastguard Worker SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; 818*9880d681SAndroid Build Coastguard Worker SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG, 819*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 820*9880d681SAndroid Build Coastguard Worker SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const; 821*9880d681SAndroid Build Coastguard Worker SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const; 822*9880d681SAndroid Build Coastguard Worker SDValue LowerSHL_PARTS(SDValue Op, SelectionDAG &DAG) const; 823*9880d681SAndroid Build Coastguard Worker SDValue LowerSRL_PARTS(SDValue Op, SelectionDAG &DAG) const; 824*9880d681SAndroid Build Coastguard Worker SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const; 825*9880d681SAndroid Build Coastguard Worker SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; 826*9880d681SAndroid Build Coastguard Worker SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; 827*9880d681SAndroid Build Coastguard Worker SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; 828*9880d681SAndroid Build Coastguard Worker SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; 829*9880d681SAndroid Build Coastguard Worker SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const; 830*9880d681SAndroid Build Coastguard Worker SDValue LowerSIGN_EXTEND_INREG(SDValue Op, SelectionDAG &DAG) const; 831*9880d681SAndroid Build Coastguard Worker SDValue LowerMUL(SDValue Op, SelectionDAG &DAG) const; 832*9880d681SAndroid Build Coastguard Worker 833*9880d681SAndroid Build Coastguard Worker SDValue LowerVectorLoad(SDValue Op, SelectionDAG &DAG) const; 834*9880d681SAndroid Build Coastguard Worker SDValue LowerVectorStore(SDValue Op, SelectionDAG &DAG) const; 835*9880d681SAndroid Build Coastguard Worker 836*9880d681SAndroid Build Coastguard Worker SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 837*9880d681SAndroid Build Coastguard Worker CallingConv::ID CallConv, bool isVarArg, 838*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 839*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 840*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const; 841*9880d681SAndroid Build Coastguard Worker SDValue FinishCall(CallingConv::ID CallConv, const SDLoc &dl, 842*9880d681SAndroid Build Coastguard Worker bool isTailCall, bool isVarArg, bool isPatchPoint, 843*9880d681SAndroid Build Coastguard Worker bool hasNest, SelectionDAG &DAG, 844*9880d681SAndroid Build Coastguard Worker SmallVector<std::pair<unsigned, SDValue>, 8> &RegsToPass, 845*9880d681SAndroid Build Coastguard Worker SDValue InFlag, SDValue Chain, SDValue CallSeqStart, 846*9880d681SAndroid Build Coastguard Worker SDValue &Callee, int SPDiff, unsigned NumBytes, 847*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 848*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, 849*9880d681SAndroid Build Coastguard Worker ImmutableCallSite *CS) const; 850*9880d681SAndroid Build Coastguard Worker 851*9880d681SAndroid Build Coastguard Worker SDValue 852*9880d681SAndroid Build Coastguard Worker LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 853*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 854*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 855*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const override; 856*9880d681SAndroid Build Coastguard Worker 857*9880d681SAndroid Build Coastguard Worker SDValue 858*9880d681SAndroid Build Coastguard Worker LowerCall(TargetLowering::CallLoweringInfo &CLI, 859*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const override; 860*9880d681SAndroid Build Coastguard Worker 861*9880d681SAndroid Build Coastguard Worker bool 862*9880d681SAndroid Build Coastguard Worker CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, 863*9880d681SAndroid Build Coastguard Worker bool isVarArg, 864*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 865*9880d681SAndroid Build Coastguard Worker LLVMContext &Context) const override; 866*9880d681SAndroid Build Coastguard Worker 867*9880d681SAndroid Build Coastguard Worker SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 868*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 869*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 870*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG) const override; 871*9880d681SAndroid Build Coastguard Worker 872*9880d681SAndroid Build Coastguard Worker SDValue extendArgForPPC64(ISD::ArgFlagsTy Flags, EVT ObjectVT, 873*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, SDValue ArgVal, 874*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 875*9880d681SAndroid Build Coastguard Worker 876*9880d681SAndroid Build Coastguard Worker SDValue LowerFormalArguments_Darwin( 877*9880d681SAndroid Build Coastguard Worker SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 878*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &dl, 879*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const; 880*9880d681SAndroid Build Coastguard Worker SDValue LowerFormalArguments_64SVR4( 881*9880d681SAndroid Build Coastguard Worker SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 882*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &dl, 883*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const; 884*9880d681SAndroid Build Coastguard Worker SDValue LowerFormalArguments_32SVR4( 885*9880d681SAndroid Build Coastguard Worker SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 886*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &dl, 887*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const; 888*9880d681SAndroid Build Coastguard Worker 889*9880d681SAndroid Build Coastguard Worker SDValue createMemcpyOutsideCallSeq(SDValue Arg, SDValue PtrOff, 890*9880d681SAndroid Build Coastguard Worker SDValue CallSeqStart, 891*9880d681SAndroid Build Coastguard Worker ISD::ArgFlagsTy Flags, SelectionDAG &DAG, 892*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 893*9880d681SAndroid Build Coastguard Worker 894*9880d681SAndroid Build Coastguard Worker SDValue LowerCall_Darwin(SDValue Chain, SDValue Callee, 895*9880d681SAndroid Build Coastguard Worker CallingConv::ID CallConv, bool isVarArg, 896*9880d681SAndroid Build Coastguard Worker bool isTailCall, bool isPatchPoint, 897*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 898*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 899*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 900*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 901*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, 902*9880d681SAndroid Build Coastguard Worker ImmutableCallSite *CS) const; 903*9880d681SAndroid Build Coastguard Worker SDValue LowerCall_64SVR4(SDValue Chain, SDValue Callee, 904*9880d681SAndroid Build Coastguard Worker CallingConv::ID CallConv, bool isVarArg, 905*9880d681SAndroid Build Coastguard Worker bool isTailCall, bool isPatchPoint, 906*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 907*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 908*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 909*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 910*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, 911*9880d681SAndroid Build Coastguard Worker ImmutableCallSite *CS) const; 912*9880d681SAndroid Build Coastguard Worker SDValue LowerCall_32SVR4(SDValue Chain, SDValue Callee, 913*9880d681SAndroid Build Coastguard Worker CallingConv::ID CallConv, bool isVarArg, 914*9880d681SAndroid Build Coastguard Worker bool isTailCall, bool isPatchPoint, 915*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 916*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 917*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 918*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 919*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, 920*9880d681SAndroid Build Coastguard Worker ImmutableCallSite *CS) const; 921*9880d681SAndroid Build Coastguard Worker 922*9880d681SAndroid Build Coastguard Worker SDValue lowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const; 923*9880d681SAndroid Build Coastguard Worker SDValue lowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const; 924*9880d681SAndroid Build Coastguard Worker 925*9880d681SAndroid Build Coastguard Worker SDValue DAGCombineExtBoolTrunc(SDNode *N, DAGCombinerInfo &DCI) const; 926*9880d681SAndroid Build Coastguard Worker SDValue DAGCombineBuildVector(SDNode *N, DAGCombinerInfo &DCI) const; 927*9880d681SAndroid Build Coastguard Worker SDValue DAGCombineTruncBoolExt(SDNode *N, DAGCombinerInfo &DCI) const; 928*9880d681SAndroid Build Coastguard Worker SDValue combineFPToIntToFP(SDNode *N, DAGCombinerInfo &DCI) const; 929*9880d681SAndroid Build Coastguard Worker 930*9880d681SAndroid Build Coastguard Worker SDValue getRsqrtEstimate(SDValue Operand, DAGCombinerInfo &DCI, 931*9880d681SAndroid Build Coastguard Worker unsigned &RefinementSteps, 932*9880d681SAndroid Build Coastguard Worker bool &UseOneConstNR) const override; 933*9880d681SAndroid Build Coastguard Worker SDValue getRecipEstimate(SDValue Operand, DAGCombinerInfo &DCI, 934*9880d681SAndroid Build Coastguard Worker unsigned &RefinementSteps) const override; 935*9880d681SAndroid Build Coastguard Worker unsigned combineRepeatedFPDivisors() const override; 936*9880d681SAndroid Build Coastguard Worker 937*9880d681SAndroid Build Coastguard Worker CCAssignFn *useFastISelCCs(unsigned Flag) const; 938*9880d681SAndroid Build Coastguard Worker }; 939*9880d681SAndroid Build Coastguard Worker 940*9880d681SAndroid Build Coastguard Worker namespace PPC { 941*9880d681SAndroid Build Coastguard Worker FastISel *createFastISel(FunctionLoweringInfo &FuncInfo, 942*9880d681SAndroid Build Coastguard Worker const TargetLibraryInfo *LibInfo); 943*9880d681SAndroid Build Coastguard Worker } 944*9880d681SAndroid Build Coastguard Worker 945*9880d681SAndroid Build Coastguard Worker bool CC_PPC32_SVR4_Custom_Dummy(unsigned &ValNo, MVT &ValVT, MVT &LocVT, 946*9880d681SAndroid Build Coastguard Worker CCValAssign::LocInfo &LocInfo, 947*9880d681SAndroid Build Coastguard Worker ISD::ArgFlagsTy &ArgFlags, 948*9880d681SAndroid Build Coastguard Worker CCState &State); 949*9880d681SAndroid Build Coastguard Worker 950*9880d681SAndroid Build Coastguard Worker bool CC_PPC32_SVR4_Custom_AlignArgRegs(unsigned &ValNo, MVT &ValVT, 951*9880d681SAndroid Build Coastguard Worker MVT &LocVT, 952*9880d681SAndroid Build Coastguard Worker CCValAssign::LocInfo &LocInfo, 953*9880d681SAndroid Build Coastguard Worker ISD::ArgFlagsTy &ArgFlags, 954*9880d681SAndroid Build Coastguard Worker CCState &State); 955*9880d681SAndroid Build Coastguard Worker 956*9880d681SAndroid Build Coastguard Worker bool CC_PPC32_SVR4_Custom_AlignFPArgRegs(unsigned &ValNo, MVT &ValVT, 957*9880d681SAndroid Build Coastguard Worker MVT &LocVT, 958*9880d681SAndroid Build Coastguard Worker CCValAssign::LocInfo &LocInfo, 959*9880d681SAndroid Build Coastguard Worker ISD::ArgFlagsTy &ArgFlags, 960*9880d681SAndroid Build Coastguard Worker CCState &State); 961*9880d681SAndroid Build Coastguard Worker } 962*9880d681SAndroid Build Coastguard Worker 963*9880d681SAndroid Build Coastguard Worker #endif // LLVM_TARGET_POWERPC_PPC32ISELLOWERING_H 964