1*9880d681SAndroid Build Coastguard Worker //===-- ARMISelLowering.h - ARM 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 ARM 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_ARM_ARMISELLOWERING_H 16*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_ARM_ARMISELLOWERING_H 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker #include "MCTargetDesc/ARMBaseInfo.h" 19*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/CallingConvLower.h" 20*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/SelectionDAG.h" 21*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetLowering.h" 22*9880d681SAndroid Build Coastguard Worker #include <vector> 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker namespace llvm { 25*9880d681SAndroid Build Coastguard Worker class ARMConstantPoolValue; 26*9880d681SAndroid Build Coastguard Worker class ARMSubtarget; 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker namespace ARMISD { 29*9880d681SAndroid Build Coastguard Worker // ARM Specific DAG Nodes 30*9880d681SAndroid Build Coastguard Worker enum NodeType : unsigned { 31*9880d681SAndroid Build Coastguard Worker // Start the numbering where the builtin ops and target ops leave off. 32*9880d681SAndroid Build Coastguard Worker FIRST_NUMBER = ISD::BUILTIN_OP_END, 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Worker Wrapper, // Wrapper - A wrapper node for TargetConstantPool, 35*9880d681SAndroid Build Coastguard Worker // TargetExternalSymbol, and TargetGlobalAddress. 36*9880d681SAndroid Build Coastguard Worker WrapperPIC, // WrapperPIC - A wrapper node for TargetGlobalAddress in 37*9880d681SAndroid Build Coastguard Worker // PIC mode. 38*9880d681SAndroid Build Coastguard Worker WrapperJT, // WrapperJT - A wrapper node for TargetJumpTable 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker // Add pseudo op to model memcpy for struct byval. 41*9880d681SAndroid Build Coastguard Worker COPY_STRUCT_BYVAL, 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker CALL, // Function call. 44*9880d681SAndroid Build Coastguard Worker CALL_PRED, // Function call that's predicable. 45*9880d681SAndroid Build Coastguard Worker CALL_NOLINK, // Function call with branch not branch-and-link. 46*9880d681SAndroid Build Coastguard Worker BRCOND, // Conditional branch. 47*9880d681SAndroid Build Coastguard Worker BR_JT, // Jumptable branch. 48*9880d681SAndroid Build Coastguard Worker BR2_JT, // Jumptable branch (2 level - jumptable entry is a jump). 49*9880d681SAndroid Build Coastguard Worker RET_FLAG, // Return with a flag operand. 50*9880d681SAndroid Build Coastguard Worker INTRET_FLAG, // Interrupt return with an LR-offset and a flag operand. 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker PIC_ADD, // Add with a PC operand and a PIC label. 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker CMP, // ARM compare instructions. 55*9880d681SAndroid Build Coastguard Worker CMN, // ARM CMN instructions. 56*9880d681SAndroid Build Coastguard Worker CMPZ, // ARM compare that sets only Z flag. 57*9880d681SAndroid Build Coastguard Worker CMPFP, // ARM VFP compare instruction, sets FPSCR. 58*9880d681SAndroid Build Coastguard Worker CMPFPw0, // ARM VFP compare against zero instruction, sets FPSCR. 59*9880d681SAndroid Build Coastguard Worker FMSTAT, // ARM fmstat instruction. 60*9880d681SAndroid Build Coastguard Worker 61*9880d681SAndroid Build Coastguard Worker CMOV, // ARM conditional move instructions. 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard Worker SSAT, // Signed saturation 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Worker BCC_i64, 66*9880d681SAndroid Build Coastguard Worker 67*9880d681SAndroid Build Coastguard Worker SRL_FLAG, // V,Flag = srl_flag X -> srl X, 1 + save carry out. 68*9880d681SAndroid Build Coastguard Worker SRA_FLAG, // V,Flag = sra_flag X -> sra X, 1 + save carry out. 69*9880d681SAndroid Build Coastguard Worker RRX, // V = RRX X, Flag -> srl X, 1 + shift in carry flag. 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Worker ADDC, // Add with carry 72*9880d681SAndroid Build Coastguard Worker ADDE, // Add using carry 73*9880d681SAndroid Build Coastguard Worker SUBC, // Sub with carry 74*9880d681SAndroid Build Coastguard Worker SUBE, // Sub using carry 75*9880d681SAndroid Build Coastguard Worker 76*9880d681SAndroid Build Coastguard Worker VMOVRRD, // double to two gprs. 77*9880d681SAndroid Build Coastguard Worker VMOVDRR, // Two gprs to double. 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Worker EH_SJLJ_SETJMP, // SjLj exception handling setjmp. 80*9880d681SAndroid Build Coastguard Worker EH_SJLJ_LONGJMP, // SjLj exception handling longjmp. 81*9880d681SAndroid Build Coastguard Worker EH_SJLJ_SETUP_DISPATCH, // SjLj exception handling setup_dispatch. 82*9880d681SAndroid Build Coastguard Worker 83*9880d681SAndroid Build Coastguard Worker TC_RETURN, // Tail call return pseudo. 84*9880d681SAndroid Build Coastguard Worker 85*9880d681SAndroid Build Coastguard Worker THREAD_POINTER, 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Worker DYN_ALLOC, // Dynamic allocation on the stack. 88*9880d681SAndroid Build Coastguard Worker 89*9880d681SAndroid Build Coastguard Worker MEMBARRIER_MCR, // Memory barrier (MCR) 90*9880d681SAndroid Build Coastguard Worker 91*9880d681SAndroid Build Coastguard Worker PRELOAD, // Preload 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Worker WIN__CHKSTK, // Windows' __chkstk call to do stack probing. 94*9880d681SAndroid Build Coastguard Worker WIN__DBZCHK, // Windows' divide by zero check 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker VCEQ, // Vector compare equal. 97*9880d681SAndroid Build Coastguard Worker VCEQZ, // Vector compare equal to zero. 98*9880d681SAndroid Build Coastguard Worker VCGE, // Vector compare greater than or equal. 99*9880d681SAndroid Build Coastguard Worker VCGEZ, // Vector compare greater than or equal to zero. 100*9880d681SAndroid Build Coastguard Worker VCLEZ, // Vector compare less than or equal to zero. 101*9880d681SAndroid Build Coastguard Worker VCGEU, // Vector compare unsigned greater than or equal. 102*9880d681SAndroid Build Coastguard Worker VCGT, // Vector compare greater than. 103*9880d681SAndroid Build Coastguard Worker VCGTZ, // Vector compare greater than zero. 104*9880d681SAndroid Build Coastguard Worker VCLTZ, // Vector compare less than zero. 105*9880d681SAndroid Build Coastguard Worker VCGTU, // Vector compare unsigned greater than. 106*9880d681SAndroid Build Coastguard Worker VTST, // Vector test bits. 107*9880d681SAndroid Build Coastguard Worker 108*9880d681SAndroid Build Coastguard Worker // Vector shift by immediate: 109*9880d681SAndroid Build Coastguard Worker VSHL, // ...left 110*9880d681SAndroid Build Coastguard Worker VSHRs, // ...right (signed) 111*9880d681SAndroid Build Coastguard Worker VSHRu, // ...right (unsigned) 112*9880d681SAndroid Build Coastguard Worker 113*9880d681SAndroid Build Coastguard Worker // Vector rounding shift by immediate: 114*9880d681SAndroid Build Coastguard Worker VRSHRs, // ...right (signed) 115*9880d681SAndroid Build Coastguard Worker VRSHRu, // ...right (unsigned) 116*9880d681SAndroid Build Coastguard Worker VRSHRN, // ...right narrow 117*9880d681SAndroid Build Coastguard Worker 118*9880d681SAndroid Build Coastguard Worker // Vector saturating shift by immediate: 119*9880d681SAndroid Build Coastguard Worker VQSHLs, // ...left (signed) 120*9880d681SAndroid Build Coastguard Worker VQSHLu, // ...left (unsigned) 121*9880d681SAndroid Build Coastguard Worker VQSHLsu, // ...left (signed to unsigned) 122*9880d681SAndroid Build Coastguard Worker VQSHRNs, // ...right narrow (signed) 123*9880d681SAndroid Build Coastguard Worker VQSHRNu, // ...right narrow (unsigned) 124*9880d681SAndroid Build Coastguard Worker VQSHRNsu, // ...right narrow (signed to unsigned) 125*9880d681SAndroid Build Coastguard Worker 126*9880d681SAndroid Build Coastguard Worker // Vector saturating rounding shift by immediate: 127*9880d681SAndroid Build Coastguard Worker VQRSHRNs, // ...right narrow (signed) 128*9880d681SAndroid Build Coastguard Worker VQRSHRNu, // ...right narrow (unsigned) 129*9880d681SAndroid Build Coastguard Worker VQRSHRNsu, // ...right narrow (signed to unsigned) 130*9880d681SAndroid Build Coastguard Worker 131*9880d681SAndroid Build Coastguard Worker // Vector shift and insert: 132*9880d681SAndroid Build Coastguard Worker VSLI, // ...left 133*9880d681SAndroid Build Coastguard Worker VSRI, // ...right 134*9880d681SAndroid Build Coastguard Worker 135*9880d681SAndroid Build Coastguard Worker // Vector get lane (VMOV scalar to ARM core register) 136*9880d681SAndroid Build Coastguard Worker // (These are used for 8- and 16-bit element types only.) 137*9880d681SAndroid Build Coastguard Worker VGETLANEu, // zero-extend vector extract element 138*9880d681SAndroid Build Coastguard Worker VGETLANEs, // sign-extend vector extract element 139*9880d681SAndroid Build Coastguard Worker 140*9880d681SAndroid Build Coastguard Worker // Vector move immediate and move negated immediate: 141*9880d681SAndroid Build Coastguard Worker VMOVIMM, 142*9880d681SAndroid Build Coastguard Worker VMVNIMM, 143*9880d681SAndroid Build Coastguard Worker 144*9880d681SAndroid Build Coastguard Worker // Vector move f32 immediate: 145*9880d681SAndroid Build Coastguard Worker VMOVFPIMM, 146*9880d681SAndroid Build Coastguard Worker 147*9880d681SAndroid Build Coastguard Worker // Vector duplicate: 148*9880d681SAndroid Build Coastguard Worker VDUP, 149*9880d681SAndroid Build Coastguard Worker VDUPLANE, 150*9880d681SAndroid Build Coastguard Worker 151*9880d681SAndroid Build Coastguard Worker // Vector shuffles: 152*9880d681SAndroid Build Coastguard Worker VEXT, // extract 153*9880d681SAndroid Build Coastguard Worker VREV64, // reverse elements within 64-bit doublewords 154*9880d681SAndroid Build Coastguard Worker VREV32, // reverse elements within 32-bit words 155*9880d681SAndroid Build Coastguard Worker VREV16, // reverse elements within 16-bit halfwords 156*9880d681SAndroid Build Coastguard Worker VZIP, // zip (interleave) 157*9880d681SAndroid Build Coastguard Worker VUZP, // unzip (deinterleave) 158*9880d681SAndroid Build Coastguard Worker VTRN, // transpose 159*9880d681SAndroid Build Coastguard Worker VTBL1, // 1-register shuffle with mask 160*9880d681SAndroid Build Coastguard Worker VTBL2, // 2-register shuffle with mask 161*9880d681SAndroid Build Coastguard Worker 162*9880d681SAndroid Build Coastguard Worker // Vector multiply long: 163*9880d681SAndroid Build Coastguard Worker VMULLs, // ...signed 164*9880d681SAndroid Build Coastguard Worker VMULLu, // ...unsigned 165*9880d681SAndroid Build Coastguard Worker 166*9880d681SAndroid Build Coastguard Worker UMLAL, // 64bit Unsigned Accumulate Multiply 167*9880d681SAndroid Build Coastguard Worker SMLAL, // 64bit Signed Accumulate Multiply 168*9880d681SAndroid Build Coastguard Worker UMAAL, // 64-bit Unsigned Accumulate Accumulate Multiply 169*9880d681SAndroid Build Coastguard Worker 170*9880d681SAndroid Build Coastguard Worker // Operands of the standard BUILD_VECTOR node are not legalized, which 171*9880d681SAndroid Build Coastguard Worker // is fine if BUILD_VECTORs are always lowered to shuffles or other 172*9880d681SAndroid Build Coastguard Worker // operations, but for ARM some BUILD_VECTORs are legal as-is and their 173*9880d681SAndroid Build Coastguard Worker // operands need to be legalized. Define an ARM-specific version of 174*9880d681SAndroid Build Coastguard Worker // BUILD_VECTOR for this purpose. 175*9880d681SAndroid Build Coastguard Worker BUILD_VECTOR, 176*9880d681SAndroid Build Coastguard Worker 177*9880d681SAndroid Build Coastguard Worker // Bit-field insert 178*9880d681SAndroid Build Coastguard Worker BFI, 179*9880d681SAndroid Build Coastguard Worker 180*9880d681SAndroid Build Coastguard Worker // Vector OR with immediate 181*9880d681SAndroid Build Coastguard Worker VORRIMM, 182*9880d681SAndroid Build Coastguard Worker // Vector AND with NOT of immediate 183*9880d681SAndroid Build Coastguard Worker VBICIMM, 184*9880d681SAndroid Build Coastguard Worker 185*9880d681SAndroid Build Coastguard Worker // Vector bitwise select 186*9880d681SAndroid Build Coastguard Worker VBSL, 187*9880d681SAndroid Build Coastguard Worker 188*9880d681SAndroid Build Coastguard Worker // Pseudo-instruction representing a memory copy using ldm/stm 189*9880d681SAndroid Build Coastguard Worker // instructions. 190*9880d681SAndroid Build Coastguard Worker MEMCPY, 191*9880d681SAndroid Build Coastguard Worker 192*9880d681SAndroid Build Coastguard Worker // Vector load N-element structure to all lanes: 193*9880d681SAndroid Build Coastguard Worker VLD2DUP = ISD::FIRST_TARGET_MEMORY_OPCODE, 194*9880d681SAndroid Build Coastguard Worker VLD3DUP, 195*9880d681SAndroid Build Coastguard Worker VLD4DUP, 196*9880d681SAndroid Build Coastguard Worker 197*9880d681SAndroid Build Coastguard Worker // NEON loads with post-increment base updates: 198*9880d681SAndroid Build Coastguard Worker VLD1_UPD, 199*9880d681SAndroid Build Coastguard Worker VLD2_UPD, 200*9880d681SAndroid Build Coastguard Worker VLD3_UPD, 201*9880d681SAndroid Build Coastguard Worker VLD4_UPD, 202*9880d681SAndroid Build Coastguard Worker VLD2LN_UPD, 203*9880d681SAndroid Build Coastguard Worker VLD3LN_UPD, 204*9880d681SAndroid Build Coastguard Worker VLD4LN_UPD, 205*9880d681SAndroid Build Coastguard Worker VLD2DUP_UPD, 206*9880d681SAndroid Build Coastguard Worker VLD3DUP_UPD, 207*9880d681SAndroid Build Coastguard Worker VLD4DUP_UPD, 208*9880d681SAndroid Build Coastguard Worker 209*9880d681SAndroid Build Coastguard Worker // NEON stores with post-increment base updates: 210*9880d681SAndroid Build Coastguard Worker VST1_UPD, 211*9880d681SAndroid Build Coastguard Worker VST2_UPD, 212*9880d681SAndroid Build Coastguard Worker VST3_UPD, 213*9880d681SAndroid Build Coastguard Worker VST4_UPD, 214*9880d681SAndroid Build Coastguard Worker VST2LN_UPD, 215*9880d681SAndroid Build Coastguard Worker VST3LN_UPD, 216*9880d681SAndroid Build Coastguard Worker VST4LN_UPD 217*9880d681SAndroid Build Coastguard Worker }; 218*9880d681SAndroid Build Coastguard Worker } 219*9880d681SAndroid Build Coastguard Worker 220*9880d681SAndroid Build Coastguard Worker /// Define some predicates that are used for node matching. 221*9880d681SAndroid Build Coastguard Worker namespace ARM { 222*9880d681SAndroid Build Coastguard Worker bool isBitFieldInvertedMask(unsigned v); 223*9880d681SAndroid Build Coastguard Worker } 224*9880d681SAndroid Build Coastguard Worker 225*9880d681SAndroid Build Coastguard Worker //===--------------------------------------------------------------------===// 226*9880d681SAndroid Build Coastguard Worker // ARMTargetLowering - ARM Implementation of the TargetLowering interface 227*9880d681SAndroid Build Coastguard Worker 228*9880d681SAndroid Build Coastguard Worker class ARMTargetLowering : public TargetLowering { 229*9880d681SAndroid Build Coastguard Worker public: 230*9880d681SAndroid Build Coastguard Worker explicit ARMTargetLowering(const TargetMachine &TM, 231*9880d681SAndroid Build Coastguard Worker const ARMSubtarget &STI); 232*9880d681SAndroid Build Coastguard Worker 233*9880d681SAndroid Build Coastguard Worker unsigned getJumpTableEncoding() const override; 234*9880d681SAndroid Build Coastguard Worker bool useSoftFloat() const override; 235*9880d681SAndroid Build Coastguard Worker 236*9880d681SAndroid Build Coastguard Worker SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; 237*9880d681SAndroid Build Coastguard Worker 238*9880d681SAndroid Build Coastguard Worker /// ReplaceNodeResults - Replace the results of node with an illegal result 239*9880d681SAndroid Build Coastguard Worker /// type with new values built out of custom code. 240*9880d681SAndroid Build Coastguard Worker /// 241*9880d681SAndroid Build Coastguard Worker void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue>&Results, 242*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 243*9880d681SAndroid Build Coastguard Worker 244*9880d681SAndroid Build Coastguard Worker const char *getTargetNodeName(unsigned Opcode) const override; 245*9880d681SAndroid Build Coastguard Worker isSelectSupported(SelectSupportKind Kind)246*9880d681SAndroid Build Coastguard Worker bool isSelectSupported(SelectSupportKind Kind) const override { 247*9880d681SAndroid Build Coastguard Worker // ARM does not support scalar condition selects on vectors. 248*9880d681SAndroid Build Coastguard Worker return (Kind != ScalarCondVectorVal); 249*9880d681SAndroid Build Coastguard Worker } 250*9880d681SAndroid Build Coastguard Worker 251*9880d681SAndroid Build Coastguard Worker /// getSetCCResultType - Return the value type to use for ISD::SETCC. 252*9880d681SAndroid Build Coastguard Worker EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, 253*9880d681SAndroid Build Coastguard Worker EVT VT) const override; 254*9880d681SAndroid Build Coastguard Worker 255*9880d681SAndroid Build Coastguard Worker MachineBasicBlock * 256*9880d681SAndroid Build Coastguard Worker EmitInstrWithCustomInserter(MachineInstr &MI, 257*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const override; 258*9880d681SAndroid Build Coastguard Worker 259*9880d681SAndroid Build Coastguard Worker void AdjustInstrPostInstrSelection(MachineInstr &MI, 260*9880d681SAndroid Build Coastguard Worker SDNode *Node) const override; 261*9880d681SAndroid Build Coastguard Worker 262*9880d681SAndroid Build Coastguard Worker SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG) const; 263*9880d681SAndroid Build Coastguard Worker SDValue PerformBRCONDCombine(SDNode *N, SelectionDAG &DAG) const; 264*9880d681SAndroid Build Coastguard Worker SDValue PerformCMOVToBFICombine(SDNode *N, SelectionDAG &DAG) const; 265*9880d681SAndroid Build Coastguard Worker SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; 266*9880d681SAndroid Build Coastguard Worker 267*9880d681SAndroid Build Coastguard Worker bool isDesirableToTransformToIntegerOp(unsigned Opc, EVT VT) const override; 268*9880d681SAndroid Build Coastguard Worker 269*9880d681SAndroid Build Coastguard Worker /// allowsMisalignedMemoryAccesses - Returns true if the target allows 270*9880d681SAndroid Build Coastguard Worker /// unaligned memory accesses of the specified type. Returns whether it 271*9880d681SAndroid Build Coastguard Worker /// is "fast" by reference in the second argument. 272*9880d681SAndroid Build Coastguard Worker bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace, 273*9880d681SAndroid Build Coastguard Worker unsigned Align, 274*9880d681SAndroid Build Coastguard Worker bool *Fast) const override; 275*9880d681SAndroid Build Coastguard Worker 276*9880d681SAndroid Build Coastguard Worker EVT getOptimalMemOpType(uint64_t Size, 277*9880d681SAndroid Build Coastguard Worker unsigned DstAlign, unsigned SrcAlign, 278*9880d681SAndroid Build Coastguard Worker bool IsMemset, bool ZeroMemset, 279*9880d681SAndroid Build Coastguard Worker bool MemcpyStrSrc, 280*9880d681SAndroid Build Coastguard Worker MachineFunction &MF) const override; 281*9880d681SAndroid Build Coastguard Worker 282*9880d681SAndroid Build Coastguard Worker using TargetLowering::isZExtFree; 283*9880d681SAndroid Build Coastguard Worker bool isZExtFree(SDValue Val, EVT VT2) const override; 284*9880d681SAndroid Build Coastguard Worker 285*9880d681SAndroid Build Coastguard Worker bool isVectorLoadExtDesirable(SDValue ExtVal) const override; 286*9880d681SAndroid Build Coastguard Worker 287*9880d681SAndroid Build Coastguard Worker bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override; 288*9880d681SAndroid Build Coastguard Worker 289*9880d681SAndroid Build Coastguard Worker 290*9880d681SAndroid Build Coastguard Worker /// isLegalAddressingMode - Return true if the addressing mode represented 291*9880d681SAndroid Build Coastguard Worker /// by AM is legal for this target, for a load/store of the specified type. 292*9880d681SAndroid Build Coastguard Worker bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, 293*9880d681SAndroid Build Coastguard Worker Type *Ty, unsigned AS) const override; 294*9880d681SAndroid Build Coastguard Worker bool isLegalT2ScaledAddressingMode(const AddrMode &AM, EVT VT) const; 295*9880d681SAndroid Build Coastguard Worker 296*9880d681SAndroid Build Coastguard Worker /// isLegalICmpImmediate - Return true if the specified immediate is legal 297*9880d681SAndroid Build Coastguard Worker /// icmp immediate, that is the target has icmp instructions which can 298*9880d681SAndroid Build Coastguard Worker /// compare a register against the immediate without having to materialize 299*9880d681SAndroid Build Coastguard Worker /// the immediate into a register. 300*9880d681SAndroid Build Coastguard Worker bool isLegalICmpImmediate(int64_t Imm) const override; 301*9880d681SAndroid Build Coastguard Worker 302*9880d681SAndroid Build Coastguard Worker /// isLegalAddImmediate - Return true if the specified immediate is legal 303*9880d681SAndroid Build Coastguard Worker /// add immediate, that is the target has add instructions which can 304*9880d681SAndroid Build Coastguard Worker /// add a register and the immediate without having to materialize 305*9880d681SAndroid Build Coastguard Worker /// the immediate into a register. 306*9880d681SAndroid Build Coastguard Worker bool isLegalAddImmediate(int64_t Imm) const override; 307*9880d681SAndroid Build Coastguard Worker 308*9880d681SAndroid Build Coastguard Worker /// getPreIndexedAddressParts - returns true by value, base pointer and 309*9880d681SAndroid Build Coastguard Worker /// offset pointer and addressing mode by reference if the node's address 310*9880d681SAndroid Build Coastguard Worker /// can be legally represented as pre-indexed load / store address. 311*9880d681SAndroid Build Coastguard Worker bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset, 312*9880d681SAndroid Build Coastguard Worker ISD::MemIndexedMode &AM, 313*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 314*9880d681SAndroid Build Coastguard Worker 315*9880d681SAndroid Build Coastguard Worker /// getPostIndexedAddressParts - returns true by value, base pointer and 316*9880d681SAndroid Build Coastguard Worker /// offset pointer and addressing mode by reference if this node can be 317*9880d681SAndroid Build Coastguard Worker /// combined with a load / store to form a post-indexed load / store. 318*9880d681SAndroid Build Coastguard Worker bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base, 319*9880d681SAndroid Build Coastguard Worker SDValue &Offset, ISD::MemIndexedMode &AM, 320*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 321*9880d681SAndroid Build Coastguard Worker 322*9880d681SAndroid Build Coastguard Worker void computeKnownBitsForTargetNode(const SDValue Op, APInt &KnownZero, 323*9880d681SAndroid Build Coastguard Worker APInt &KnownOne, 324*9880d681SAndroid Build Coastguard Worker const SelectionDAG &DAG, 325*9880d681SAndroid Build Coastguard Worker unsigned Depth) const override; 326*9880d681SAndroid Build Coastguard Worker 327*9880d681SAndroid Build Coastguard Worker 328*9880d681SAndroid Build Coastguard Worker bool ExpandInlineAsm(CallInst *CI) const override; 329*9880d681SAndroid Build Coastguard Worker 330*9880d681SAndroid Build Coastguard Worker ConstraintType getConstraintType(StringRef Constraint) const override; 331*9880d681SAndroid Build Coastguard Worker 332*9880d681SAndroid Build Coastguard Worker /// Examine constraint string and operand type and determine a weight value. 333*9880d681SAndroid Build Coastguard Worker /// The operand object must already have been set up with the operand type. 334*9880d681SAndroid Build Coastguard Worker ConstraintWeight getSingleConstraintMatchWeight( 335*9880d681SAndroid Build Coastguard Worker AsmOperandInfo &info, const char *constraint) const override; 336*9880d681SAndroid Build Coastguard Worker 337*9880d681SAndroid Build Coastguard Worker std::pair<unsigned, const TargetRegisterClass *> 338*9880d681SAndroid Build Coastguard Worker getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, 339*9880d681SAndroid Build Coastguard Worker StringRef Constraint, MVT VT) const override; 340*9880d681SAndroid Build Coastguard Worker 341*9880d681SAndroid Build Coastguard Worker const char *LowerXConstraint(EVT ConstraintVT) const override; 342*9880d681SAndroid Build Coastguard Worker 343*9880d681SAndroid Build Coastguard Worker /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops 344*9880d681SAndroid Build Coastguard Worker /// vector. If it is invalid, don't add anything to Ops. If hasMemory is 345*9880d681SAndroid Build Coastguard Worker /// true it means one of the asm constraint of the inline asm instruction 346*9880d681SAndroid Build Coastguard Worker /// being processed is 'm'. 347*9880d681SAndroid Build Coastguard Worker void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, 348*9880d681SAndroid Build Coastguard Worker std::vector<SDValue> &Ops, 349*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 350*9880d681SAndroid Build Coastguard Worker 351*9880d681SAndroid Build Coastguard Worker unsigned getInlineAsmMemConstraint(StringRef ConstraintCode)352*9880d681SAndroid Build Coastguard Worker getInlineAsmMemConstraint(StringRef ConstraintCode) const override { 353*9880d681SAndroid Build Coastguard Worker if (ConstraintCode == "Q") 354*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Q; 355*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode == "o") 356*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_o; 357*9880d681SAndroid Build Coastguard Worker else if (ConstraintCode.size() == 2) { 358*9880d681SAndroid Build Coastguard Worker if (ConstraintCode[0] == 'U') { 359*9880d681SAndroid Build Coastguard Worker switch(ConstraintCode[1]) { 360*9880d681SAndroid Build Coastguard Worker default: 361*9880d681SAndroid Build Coastguard Worker break; 362*9880d681SAndroid Build Coastguard Worker case 'm': 363*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Um; 364*9880d681SAndroid Build Coastguard Worker case 'n': 365*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Un; 366*9880d681SAndroid Build Coastguard Worker case 'q': 367*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Uq; 368*9880d681SAndroid Build Coastguard Worker case 's': 369*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Us; 370*9880d681SAndroid Build Coastguard Worker case 't': 371*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Ut; 372*9880d681SAndroid Build Coastguard Worker case 'v': 373*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Uv; 374*9880d681SAndroid Build Coastguard Worker case 'y': 375*9880d681SAndroid Build Coastguard Worker return InlineAsm::Constraint_Uy; 376*9880d681SAndroid Build Coastguard Worker } 377*9880d681SAndroid Build Coastguard Worker } 378*9880d681SAndroid Build Coastguard Worker } 379*9880d681SAndroid Build Coastguard Worker return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); 380*9880d681SAndroid Build Coastguard Worker } 381*9880d681SAndroid Build Coastguard Worker getSubtarget()382*9880d681SAndroid Build Coastguard Worker const ARMSubtarget* getSubtarget() const { 383*9880d681SAndroid Build Coastguard Worker return Subtarget; 384*9880d681SAndroid Build Coastguard Worker } 385*9880d681SAndroid Build Coastguard Worker 386*9880d681SAndroid Build Coastguard Worker /// getRegClassFor - Return the register class that should be used for the 387*9880d681SAndroid Build Coastguard Worker /// specified value type. 388*9880d681SAndroid Build Coastguard Worker const TargetRegisterClass *getRegClassFor(MVT VT) const override; 389*9880d681SAndroid Build Coastguard Worker 390*9880d681SAndroid Build Coastguard Worker /// Returns true if a cast between SrcAS and DestAS is a noop. isNoopAddrSpaceCast(unsigned SrcAS,unsigned DestAS)391*9880d681SAndroid Build Coastguard Worker bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { 392*9880d681SAndroid Build Coastguard Worker // Addrspacecasts are always noops. 393*9880d681SAndroid Build Coastguard Worker return true; 394*9880d681SAndroid Build Coastguard Worker } 395*9880d681SAndroid Build Coastguard Worker 396*9880d681SAndroid Build Coastguard Worker bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize, 397*9880d681SAndroid Build Coastguard Worker unsigned &PrefAlign) const override; 398*9880d681SAndroid Build Coastguard Worker 399*9880d681SAndroid Build Coastguard Worker /// createFastISel - This method returns a target specific FastISel object, 400*9880d681SAndroid Build Coastguard Worker /// or null if the target does not support "fast" ISel. 401*9880d681SAndroid Build Coastguard Worker FastISel *createFastISel(FunctionLoweringInfo &funcInfo, 402*9880d681SAndroid Build Coastguard Worker const TargetLibraryInfo *libInfo) const override; 403*9880d681SAndroid Build Coastguard Worker 404*9880d681SAndroid Build Coastguard Worker Sched::Preference getSchedulingPreference(SDNode *N) const override; 405*9880d681SAndroid Build Coastguard Worker 406*9880d681SAndroid Build Coastguard Worker bool 407*9880d681SAndroid Build Coastguard Worker isShuffleMaskLegal(const SmallVectorImpl<int> &M, EVT VT) const override; 408*9880d681SAndroid Build Coastguard Worker bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; 409*9880d681SAndroid Build Coastguard Worker 410*9880d681SAndroid Build Coastguard Worker /// isFPImmLegal - Returns true if the target can instruction select the 411*9880d681SAndroid Build Coastguard Worker /// specified FP immediate natively. If false, the legalizer will 412*9880d681SAndroid Build Coastguard Worker /// materialize the FP immediate as a load from a constant pool. 413*9880d681SAndroid Build Coastguard Worker bool isFPImmLegal(const APFloat &Imm, EVT VT) const override; 414*9880d681SAndroid Build Coastguard Worker 415*9880d681SAndroid Build Coastguard Worker bool getTgtMemIntrinsic(IntrinsicInfo &Info, 416*9880d681SAndroid Build Coastguard Worker const CallInst &I, 417*9880d681SAndroid Build Coastguard Worker unsigned Intrinsic) const override; 418*9880d681SAndroid Build Coastguard Worker 419*9880d681SAndroid Build Coastguard Worker /// \brief Returns true if it is beneficial to convert a load of a constant 420*9880d681SAndroid Build Coastguard Worker /// to just the constant itself. 421*9880d681SAndroid Build Coastguard Worker bool shouldConvertConstantLoadToIntImm(const APInt &Imm, 422*9880d681SAndroid Build Coastguard Worker Type *Ty) const override; 423*9880d681SAndroid Build Coastguard Worker 424*9880d681SAndroid Build Coastguard Worker /// \brief Returns true if an argument of type Ty needs to be passed in a 425*9880d681SAndroid Build Coastguard Worker /// contiguous block of registers in calling convention CallConv. 426*9880d681SAndroid Build Coastguard Worker bool functionArgumentNeedsConsecutiveRegisters( 427*9880d681SAndroid Build Coastguard Worker Type *Ty, CallingConv::ID CallConv, bool isVarArg) const override; 428*9880d681SAndroid Build Coastguard Worker 429*9880d681SAndroid Build Coastguard Worker /// If a physical register, this returns the register that receives the 430*9880d681SAndroid Build Coastguard Worker /// exception address on entry to an EH pad. 431*9880d681SAndroid Build Coastguard Worker unsigned 432*9880d681SAndroid Build Coastguard Worker getExceptionPointerRegister(const Constant *PersonalityFn) const override; 433*9880d681SAndroid Build Coastguard Worker 434*9880d681SAndroid Build Coastguard Worker /// If a physical register, this returns the register that receives the 435*9880d681SAndroid Build Coastguard Worker /// exception typeid on entry to a landing pad. 436*9880d681SAndroid Build Coastguard Worker unsigned 437*9880d681SAndroid Build Coastguard Worker getExceptionSelectorRegister(const Constant *PersonalityFn) const override; 438*9880d681SAndroid Build Coastguard Worker 439*9880d681SAndroid Build Coastguard Worker Instruction *makeDMB(IRBuilder<> &Builder, ARM_MB::MemBOpt Domain) const; 440*9880d681SAndroid Build Coastguard Worker Value *emitLoadLinked(IRBuilder<> &Builder, Value *Addr, 441*9880d681SAndroid Build Coastguard Worker AtomicOrdering Ord) const override; 442*9880d681SAndroid Build Coastguard Worker Value *emitStoreConditional(IRBuilder<> &Builder, Value *Val, 443*9880d681SAndroid Build Coastguard Worker Value *Addr, AtomicOrdering Ord) const override; 444*9880d681SAndroid Build Coastguard Worker 445*9880d681SAndroid Build Coastguard Worker void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override; 446*9880d681SAndroid Build Coastguard Worker 447*9880d681SAndroid Build Coastguard Worker Instruction* emitLeadingFence(IRBuilder<> &Builder, AtomicOrdering Ord, 448*9880d681SAndroid Build Coastguard Worker bool IsStore, bool IsLoad) const override; 449*9880d681SAndroid Build Coastguard Worker Instruction* emitTrailingFence(IRBuilder<> &Builder, AtomicOrdering Ord, 450*9880d681SAndroid Build Coastguard Worker bool IsStore, bool IsLoad) const override; 451*9880d681SAndroid Build Coastguard Worker getMaxSupportedInterleaveFactor()452*9880d681SAndroid Build Coastguard Worker unsigned getMaxSupportedInterleaveFactor() const override { return 4; } 453*9880d681SAndroid Build Coastguard Worker 454*9880d681SAndroid Build Coastguard Worker bool lowerInterleavedLoad(LoadInst *LI, 455*9880d681SAndroid Build Coastguard Worker ArrayRef<ShuffleVectorInst *> Shuffles, 456*9880d681SAndroid Build Coastguard Worker ArrayRef<unsigned> Indices, 457*9880d681SAndroid Build Coastguard Worker unsigned Factor) const override; 458*9880d681SAndroid Build Coastguard Worker bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI, 459*9880d681SAndroid Build Coastguard Worker unsigned Factor) const override; 460*9880d681SAndroid Build Coastguard Worker 461*9880d681SAndroid Build Coastguard Worker bool shouldInsertFencesForAtomic(const Instruction *I) const override; 462*9880d681SAndroid Build Coastguard Worker TargetLoweringBase::AtomicExpansionKind 463*9880d681SAndroid Build Coastguard Worker shouldExpandAtomicLoadInIR(LoadInst *LI) const override; 464*9880d681SAndroid Build Coastguard Worker bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override; 465*9880d681SAndroid Build Coastguard Worker TargetLoweringBase::AtomicExpansionKind 466*9880d681SAndroid Build Coastguard Worker shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override; 467*9880d681SAndroid Build Coastguard Worker bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override; 468*9880d681SAndroid Build Coastguard Worker 469*9880d681SAndroid Build Coastguard Worker bool useLoadStackGuardNode() const override; 470*9880d681SAndroid Build Coastguard Worker 471*9880d681SAndroid Build Coastguard Worker bool canCombineStoreAndExtract(Type *VectorTy, Value *Idx, 472*9880d681SAndroid Build Coastguard Worker unsigned &Cost) const override; 473*9880d681SAndroid Build Coastguard Worker 474*9880d681SAndroid Build Coastguard Worker bool isCheapToSpeculateCttz() const override; 475*9880d681SAndroid Build Coastguard Worker bool isCheapToSpeculateCtlz() const override; 476*9880d681SAndroid Build Coastguard Worker supportSwiftError()477*9880d681SAndroid Build Coastguard Worker bool supportSwiftError() const override { 478*9880d681SAndroid Build Coastguard Worker return true; 479*9880d681SAndroid Build Coastguard Worker } 480*9880d681SAndroid Build Coastguard Worker 481*9880d681SAndroid Build Coastguard Worker protected: 482*9880d681SAndroid Build Coastguard Worker std::pair<const TargetRegisterClass *, uint8_t> 483*9880d681SAndroid Build Coastguard Worker findRepresentativeClass(const TargetRegisterInfo *TRI, 484*9880d681SAndroid Build Coastguard Worker MVT VT) const override; 485*9880d681SAndroid Build Coastguard Worker 486*9880d681SAndroid Build Coastguard Worker private: 487*9880d681SAndroid Build Coastguard Worker /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can 488*9880d681SAndroid Build Coastguard Worker /// make the right decision when generating code for different targets. 489*9880d681SAndroid Build Coastguard Worker const ARMSubtarget *Subtarget; 490*9880d681SAndroid Build Coastguard Worker 491*9880d681SAndroid Build Coastguard Worker const TargetRegisterInfo *RegInfo; 492*9880d681SAndroid Build Coastguard Worker 493*9880d681SAndroid Build Coastguard Worker const InstrItineraryData *Itins; 494*9880d681SAndroid Build Coastguard Worker 495*9880d681SAndroid Build Coastguard Worker /// ARMPCLabelIndex - Keep track of the number of ARM PC labels created. 496*9880d681SAndroid Build Coastguard Worker /// 497*9880d681SAndroid Build Coastguard Worker unsigned ARMPCLabelIndex; 498*9880d681SAndroid Build Coastguard Worker 499*9880d681SAndroid Build Coastguard Worker // TODO: remove this, and have shouldInsertFencesForAtomic do the proper 500*9880d681SAndroid Build Coastguard Worker // check. 501*9880d681SAndroid Build Coastguard Worker bool InsertFencesForAtomic; 502*9880d681SAndroid Build Coastguard Worker 503*9880d681SAndroid Build Coastguard Worker void addTypeForNEON(MVT VT, MVT PromotedLdStVT, MVT PromotedBitwiseVT); 504*9880d681SAndroid Build Coastguard Worker void addDRTypeForNEON(MVT VT); 505*9880d681SAndroid Build Coastguard Worker void addQRTypeForNEON(MVT VT); 506*9880d681SAndroid Build Coastguard Worker std::pair<SDValue, SDValue> getARMXALUOOp(SDValue Op, SelectionDAG &DAG, SDValue &ARMcc) const; 507*9880d681SAndroid Build Coastguard Worker 508*9880d681SAndroid Build Coastguard Worker typedef SmallVector<std::pair<unsigned, SDValue>, 8> RegsToPassVector; 509*9880d681SAndroid Build Coastguard Worker void PassF64ArgInRegs(const SDLoc &dl, SelectionDAG &DAG, SDValue Chain, 510*9880d681SAndroid Build Coastguard Worker SDValue &Arg, RegsToPassVector &RegsToPass, 511*9880d681SAndroid Build Coastguard Worker CCValAssign &VA, CCValAssign &NextVA, 512*9880d681SAndroid Build Coastguard Worker SDValue &StackPtr, 513*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &MemOpChains, 514*9880d681SAndroid Build Coastguard Worker ISD::ArgFlagsTy Flags) const; 515*9880d681SAndroid Build Coastguard Worker SDValue GetF64FormalArgument(CCValAssign &VA, CCValAssign &NextVA, 516*9880d681SAndroid Build Coastguard Worker SDValue &Root, SelectionDAG &DAG, 517*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 518*9880d681SAndroid Build Coastguard Worker 519*9880d681SAndroid Build Coastguard Worker CallingConv::ID getEffectiveCallingConv(CallingConv::ID CC, 520*9880d681SAndroid Build Coastguard Worker bool isVarArg) const; 521*9880d681SAndroid Build Coastguard Worker CCAssignFn *CCAssignFnForNode(CallingConv::ID CC, bool Return, 522*9880d681SAndroid Build Coastguard Worker bool isVarArg) const; 523*9880d681SAndroid Build Coastguard Worker SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg, 524*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 525*9880d681SAndroid Build Coastguard Worker const CCValAssign &VA, 526*9880d681SAndroid Build Coastguard Worker ISD::ArgFlagsTy Flags) const; 527*9880d681SAndroid Build Coastguard Worker SDValue LowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const; 528*9880d681SAndroid Build Coastguard Worker SDValue LowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const; 529*9880d681SAndroid Build Coastguard Worker SDValue LowerEH_SJLJ_SETUP_DISPATCH(SDValue Op, SelectionDAG &DAG) const; 530*9880d681SAndroid Build Coastguard Worker SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG, 531*9880d681SAndroid Build Coastguard Worker const ARMSubtarget *Subtarget) const; 532*9880d681SAndroid Build Coastguard Worker SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; 533*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalAddressDarwin(SDValue Op, SelectionDAG &DAG) const; 534*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG) const; 535*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalAddressWindows(SDValue Op, SelectionDAG &DAG) const; 536*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; 537*9880d681SAndroid Build Coastguard Worker SDValue LowerToTLSGeneralDynamicModel(GlobalAddressSDNode *GA, 538*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const; 539*9880d681SAndroid Build Coastguard Worker SDValue LowerToTLSExecModels(GlobalAddressSDNode *GA, 540*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG, 541*9880d681SAndroid Build Coastguard Worker TLSModel::Model model) const; 542*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalTLSAddressDarwin(SDValue Op, SelectionDAG &DAG) const; 543*9880d681SAndroid Build Coastguard Worker SDValue LowerGlobalTLSAddressWindows(SDValue Op, SelectionDAG &DAG) const; 544*9880d681SAndroid Build Coastguard Worker SDValue LowerGLOBAL_OFFSET_TABLE(SDValue Op, SelectionDAG &DAG) const; 545*9880d681SAndroid Build Coastguard Worker SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const; 546*9880d681SAndroid Build Coastguard Worker SDValue LowerXALUO(SDValue Op, SelectionDAG &DAG) const; 547*9880d681SAndroid Build Coastguard Worker SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; 548*9880d681SAndroid Build Coastguard Worker SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; 549*9880d681SAndroid Build Coastguard Worker SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const; 550*9880d681SAndroid Build Coastguard Worker SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const; 551*9880d681SAndroid Build Coastguard Worker SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; 552*9880d681SAndroid Build Coastguard Worker SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; 553*9880d681SAndroid Build Coastguard Worker SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG) const; 554*9880d681SAndroid Build Coastguard Worker SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const; 555*9880d681SAndroid Build Coastguard Worker SDValue LowerFLT_ROUNDS_(SDValue Op, SelectionDAG &DAG) const; 556*9880d681SAndroid Build Coastguard Worker SDValue LowerConstantFP(SDValue Op, SelectionDAG &DAG, 557*9880d681SAndroid Build Coastguard Worker const ARMSubtarget *ST) const; 558*9880d681SAndroid Build Coastguard Worker SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG, 559*9880d681SAndroid Build Coastguard Worker const ARMSubtarget *ST) const; 560*9880d681SAndroid Build Coastguard Worker SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const; 561*9880d681SAndroid Build Coastguard Worker SDValue LowerDivRem(SDValue Op, SelectionDAG &DAG) const; 562*9880d681SAndroid Build Coastguard Worker SDValue LowerDIV_Windows(SDValue Op, SelectionDAG &DAG, bool Signed) const; 563*9880d681SAndroid Build Coastguard Worker void ExpandDIV_Windows(SDValue Op, SelectionDAG &DAG, bool Signed, 564*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &Results) const; 565*9880d681SAndroid Build Coastguard Worker SDValue LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG, bool Signed, 566*9880d681SAndroid Build Coastguard Worker SDValue &Chain) const; 567*9880d681SAndroid Build Coastguard Worker SDValue LowerREM(SDNode *N, SelectionDAG &DAG) const; 568*9880d681SAndroid Build Coastguard Worker SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const; 569*9880d681SAndroid Build Coastguard Worker SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const; 570*9880d681SAndroid Build Coastguard Worker SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const; 571*9880d681SAndroid Build Coastguard Worker SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const; 572*9880d681SAndroid Build Coastguard Worker SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const; 573*9880d681SAndroid Build Coastguard Worker 574*9880d681SAndroid Build Coastguard Worker unsigned getRegisterByName(const char* RegName, EVT VT, 575*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const override; 576*9880d681SAndroid Build Coastguard Worker 577*9880d681SAndroid Build Coastguard Worker /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster 578*9880d681SAndroid Build Coastguard Worker /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be 579*9880d681SAndroid Build Coastguard Worker /// expanded to FMAs when this method returns true, otherwise fmuladd is 580*9880d681SAndroid Build Coastguard Worker /// expanded to fmul + fadd. 581*9880d681SAndroid Build Coastguard Worker /// 582*9880d681SAndroid Build Coastguard Worker /// ARM supports both fused and unfused multiply-add operations; we already 583*9880d681SAndroid Build Coastguard Worker /// lower a pair of fmul and fadd to the latter so it's not clear that there 584*9880d681SAndroid Build Coastguard Worker /// would be a gain or that the gain would be worthwhile enough to risk 585*9880d681SAndroid Build Coastguard Worker /// correctness bugs. isFMAFasterThanFMulAndFAdd(EVT VT)586*9880d681SAndroid Build Coastguard Worker bool isFMAFasterThanFMulAndFAdd(EVT VT) const override { return false; } 587*9880d681SAndroid Build Coastguard Worker 588*9880d681SAndroid Build Coastguard Worker SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const; 589*9880d681SAndroid Build Coastguard Worker 590*9880d681SAndroid Build Coastguard Worker SDValue LowerCallResult(SDValue Chain, SDValue InFlag, 591*9880d681SAndroid Build Coastguard Worker CallingConv::ID CallConv, bool isVarArg, 592*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 593*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 594*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals, bool isThisReturn, 595*9880d681SAndroid Build Coastguard Worker SDValue ThisVal) const; 596*9880d681SAndroid Build Coastguard Worker supportSplitCSR(MachineFunction * MF)597*9880d681SAndroid Build Coastguard Worker bool supportSplitCSR(MachineFunction *MF) const override { 598*9880d681SAndroid Build Coastguard Worker return MF->getFunction()->getCallingConv() == CallingConv::CXX_FAST_TLS && 599*9880d681SAndroid Build Coastguard Worker MF->getFunction()->hasFnAttribute(Attribute::NoUnwind); 600*9880d681SAndroid Build Coastguard Worker } 601*9880d681SAndroid Build Coastguard Worker void initializeSplitCSR(MachineBasicBlock *Entry) const override; 602*9880d681SAndroid Build Coastguard Worker void insertCopiesSplitCSR( 603*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *Entry, 604*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<MachineBasicBlock *> &Exits) const override; 605*9880d681SAndroid Build Coastguard Worker 606*9880d681SAndroid Build Coastguard Worker SDValue 607*9880d681SAndroid Build Coastguard Worker LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 608*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 609*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG, 610*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const override; 611*9880d681SAndroid Build Coastguard Worker 612*9880d681SAndroid Build Coastguard Worker int StoreByValRegs(CCState &CCInfo, SelectionDAG &DAG, const SDLoc &dl, 613*9880d681SAndroid Build Coastguard Worker SDValue &Chain, const Value *OrigArg, 614*9880d681SAndroid Build Coastguard Worker unsigned InRegsParamRecordIdx, int ArgOffset, 615*9880d681SAndroid Build Coastguard Worker unsigned ArgSize) const; 616*9880d681SAndroid Build Coastguard Worker 617*9880d681SAndroid Build Coastguard Worker void VarArgStyleRegisters(CCState &CCInfo, SelectionDAG &DAG, 618*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SDValue &Chain, 619*9880d681SAndroid Build Coastguard Worker unsigned ArgOffset, unsigned TotalArgRegsSaveSize, 620*9880d681SAndroid Build Coastguard Worker bool ForceMutable = false) const; 621*9880d681SAndroid Build Coastguard Worker 622*9880d681SAndroid Build Coastguard Worker SDValue 623*9880d681SAndroid Build Coastguard Worker LowerCall(TargetLowering::CallLoweringInfo &CLI, 624*9880d681SAndroid Build Coastguard Worker SmallVectorImpl<SDValue> &InVals) const override; 625*9880d681SAndroid Build Coastguard Worker 626*9880d681SAndroid Build Coastguard Worker /// HandleByVal - Target-specific cleanup for ByVal support. 627*9880d681SAndroid Build Coastguard Worker void HandleByVal(CCState *, unsigned &, unsigned) const override; 628*9880d681SAndroid Build Coastguard Worker 629*9880d681SAndroid Build Coastguard Worker /// IsEligibleForTailCallOptimization - Check whether the call is eligible 630*9880d681SAndroid Build Coastguard Worker /// for tail call optimization. Targets which want to do tail call 631*9880d681SAndroid Build Coastguard Worker /// optimization should implement this function. 632*9880d681SAndroid Build Coastguard Worker bool IsEligibleForTailCallOptimization(SDValue Callee, 633*9880d681SAndroid Build Coastguard Worker CallingConv::ID CalleeCC, 634*9880d681SAndroid Build Coastguard Worker bool isVarArg, 635*9880d681SAndroid Build Coastguard Worker bool isCalleeStructRet, 636*9880d681SAndroid Build Coastguard Worker bool isCallerStructRet, 637*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 638*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 639*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::InputArg> &Ins, 640*9880d681SAndroid Build Coastguard Worker SelectionDAG& DAG) const; 641*9880d681SAndroid Build Coastguard Worker 642*9880d681SAndroid Build Coastguard Worker bool CanLowerReturn(CallingConv::ID CallConv, 643*9880d681SAndroid Build Coastguard Worker MachineFunction &MF, bool isVarArg, 644*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 645*9880d681SAndroid Build Coastguard Worker LLVMContext &Context) const override; 646*9880d681SAndroid Build Coastguard Worker 647*9880d681SAndroid Build Coastguard Worker SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, 648*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<ISD::OutputArg> &Outs, 649*9880d681SAndroid Build Coastguard Worker const SmallVectorImpl<SDValue> &OutVals, 650*9880d681SAndroid Build Coastguard Worker const SDLoc &dl, SelectionDAG &DAG) const override; 651*9880d681SAndroid Build Coastguard Worker 652*9880d681SAndroid Build Coastguard Worker bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override; 653*9880d681SAndroid Build Coastguard Worker 654*9880d681SAndroid Build Coastguard Worker bool mayBeEmittedAsTailCall(CallInst *CI) const override; 655*9880d681SAndroid Build Coastguard Worker 656*9880d681SAndroid Build Coastguard Worker SDValue getCMOV(const SDLoc &dl, EVT VT, SDValue FalseVal, SDValue TrueVal, 657*9880d681SAndroid Build Coastguard Worker SDValue ARMcc, SDValue CCR, SDValue Cmp, 658*9880d681SAndroid Build Coastguard Worker SelectionDAG &DAG) const; 659*9880d681SAndroid Build Coastguard Worker SDValue getARMCmp(SDValue LHS, SDValue RHS, ISD::CondCode CC, 660*9880d681SAndroid Build Coastguard Worker SDValue &ARMcc, SelectionDAG &DAG, const SDLoc &dl) const; 661*9880d681SAndroid Build Coastguard Worker SDValue getVFPCmp(SDValue LHS, SDValue RHS, SelectionDAG &DAG, 662*9880d681SAndroid Build Coastguard Worker const SDLoc &dl) const; 663*9880d681SAndroid Build Coastguard Worker SDValue duplicateCmp(SDValue Cmp, SelectionDAG &DAG) const; 664*9880d681SAndroid Build Coastguard Worker 665*9880d681SAndroid Build Coastguard Worker SDValue OptimizeVFPBrcond(SDValue Op, SelectionDAG &DAG) const; 666*9880d681SAndroid Build Coastguard Worker 667*9880d681SAndroid Build Coastguard Worker void SetupEntryBlockForSjLj(MachineInstr &MI, MachineBasicBlock *MBB, 668*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *DispatchBB, int FI) const; 669*9880d681SAndroid Build Coastguard Worker 670*9880d681SAndroid Build Coastguard Worker void EmitSjLjDispatchBlock(MachineInstr &MI, MachineBasicBlock *MBB) const; 671*9880d681SAndroid Build Coastguard Worker 672*9880d681SAndroid Build Coastguard Worker bool RemapAddSubWithFlags(MachineInstr &MI, MachineBasicBlock *BB) const; 673*9880d681SAndroid Build Coastguard Worker 674*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *EmitStructByval(MachineInstr &MI, 675*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const; 676*9880d681SAndroid Build Coastguard Worker 677*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *EmitLowered__chkstk(MachineInstr &MI, 678*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const; 679*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *EmitLowered__dbzchk(MachineInstr &MI, 680*9880d681SAndroid Build Coastguard Worker MachineBasicBlock *MBB) const; 681*9880d681SAndroid Build Coastguard Worker }; 682*9880d681SAndroid Build Coastguard Worker 683*9880d681SAndroid Build Coastguard Worker enum NEONModImmType { 684*9880d681SAndroid Build Coastguard Worker VMOVModImm, 685*9880d681SAndroid Build Coastguard Worker VMVNModImm, 686*9880d681SAndroid Build Coastguard Worker OtherModImm 687*9880d681SAndroid Build Coastguard Worker }; 688*9880d681SAndroid Build Coastguard Worker 689*9880d681SAndroid Build Coastguard Worker namespace ARM { 690*9880d681SAndroid Build Coastguard Worker FastISel *createFastISel(FunctionLoweringInfo &funcInfo, 691*9880d681SAndroid Build Coastguard Worker const TargetLibraryInfo *libInfo); 692*9880d681SAndroid Build Coastguard Worker } 693*9880d681SAndroid Build Coastguard Worker } 694*9880d681SAndroid Build Coastguard Worker 695*9880d681SAndroid Build Coastguard Worker #endif // ARMISELLOWERING_H 696