Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 1 | //==-- AArch64ISelLowering.h - AArch64 DAG Lowering Interface ----*- C++ -*-==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the interfaces that AArch64 uses to lower LLVM code into a |
| 11 | // selection DAG. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 15 | #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H |
| 16 | #define LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 17 | |
| 18 | #include "llvm/CodeGen/CallingConvLower.h" |
| 19 | #include "llvm/CodeGen/SelectionDAG.h" |
| 20 | #include "llvm/IR/CallingConv.h" |
Chad Rosier | 5439005 | 2015-02-23 19:15:16 +0000 | [diff] [blame] | 21 | #include "llvm/IR/Instruction.h" |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetLowering.h" |
| 23 | |
| 24 | namespace llvm { |
| 25 | |
| 26 | namespace AArch64ISD { |
| 27 | |
Matthias Braun | d04893f | 2015-05-07 21:33:59 +0000 | [diff] [blame] | 28 | enum NodeType : unsigned { |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 29 | FIRST_NUMBER = ISD::BUILTIN_OP_END, |
| 30 | WrapperLarge, // 4-instruction MOVZ/MOVK sequence for 64-bit addresses. |
| 31 | CALL, // Function call. |
| 32 | |
Kristof Beyls | aea8461 | 2015-03-04 09:12:08 +0000 | [diff] [blame] | 33 | // Produces the full sequence of instructions for getting the thread pointer |
| 34 | // offset of a variable into X0, using the TLSDesc model. |
| 35 | TLSDESC_CALLSEQ, |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 36 | ADRP, // Page address of a TargetGlobalAddress operand. |
| 37 | ADDlow, // Add the low 12 bits of a TargetGlobalAddress operand. |
| 38 | LOADgot, // Load from automatically generated descriptor (e.g. Global |
| 39 | // Offset Table, TLS record). |
| 40 | RET_FLAG, // Return with a flag operand. Operand 0 is the chain operand. |
| 41 | BRCOND, // Conditional branch instruction; "b.cond". |
| 42 | CSEL, |
| 43 | FCSEL, // Conditional move instruction. |
| 44 | CSINV, // Conditional select invert. |
| 45 | CSNEG, // Conditional select negate. |
| 46 | CSINC, // Conditional select increment. |
| 47 | |
| 48 | // Pointer to the thread's local storage area. Materialised from TPIDR_EL0 on |
| 49 | // ELF. |
| 50 | THREAD_POINTER, |
| 51 | ADC, |
| 52 | SBC, // adc, sbc instructions |
| 53 | |
| 54 | // Arithmetic instructions which write flags. |
| 55 | ADDS, |
| 56 | SUBS, |
| 57 | ADCS, |
| 58 | SBCS, |
| 59 | ANDS, |
| 60 | |
Matthias Braun | af7d770 | 2015-07-16 20:02:37 +0000 | [diff] [blame] | 61 | // Conditional compares. Operands: left,right,falsecc,cc,flags |
| 62 | CCMP, |
| 63 | CCMN, |
| 64 | FCCMP, |
| 65 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 66 | // Floating point comparison |
| 67 | FCMP, |
| 68 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 69 | // Scalar extract |
| 70 | EXTR, |
| 71 | |
| 72 | // Scalar-to-vector duplication |
| 73 | DUP, |
| 74 | DUPLANE8, |
| 75 | DUPLANE16, |
| 76 | DUPLANE32, |
| 77 | DUPLANE64, |
| 78 | |
| 79 | // Vector immedate moves |
| 80 | MOVI, |
| 81 | MOVIshift, |
| 82 | MOVIedit, |
| 83 | MOVImsl, |
| 84 | FMOV, |
| 85 | MVNIshift, |
| 86 | MVNImsl, |
| 87 | |
| 88 | // Vector immediate ops |
| 89 | BICi, |
| 90 | ORRi, |
| 91 | |
| 92 | // Vector bit select: similar to ISD::VSELECT but not all bits within an |
| 93 | // element must be identical. |
| 94 | BSL, |
| 95 | |
| 96 | // Vector arithmetic negation |
| 97 | NEG, |
| 98 | |
| 99 | // Vector shuffles |
| 100 | ZIP1, |
| 101 | ZIP2, |
| 102 | UZP1, |
| 103 | UZP2, |
| 104 | TRN1, |
| 105 | TRN2, |
| 106 | REV16, |
| 107 | REV32, |
| 108 | REV64, |
| 109 | EXT, |
| 110 | |
| 111 | // Vector shift by scalar |
| 112 | VSHL, |
| 113 | VLSHR, |
| 114 | VASHR, |
| 115 | |
| 116 | // Vector shift by scalar (again) |
| 117 | SQSHL_I, |
| 118 | UQSHL_I, |
| 119 | SQSHLU_I, |
| 120 | SRSHR_I, |
| 121 | URSHR_I, |
| 122 | |
| 123 | // Vector comparisons |
| 124 | CMEQ, |
| 125 | CMGE, |
| 126 | CMGT, |
| 127 | CMHI, |
| 128 | CMHS, |
| 129 | FCMEQ, |
| 130 | FCMGE, |
| 131 | FCMGT, |
| 132 | |
| 133 | // Vector zero comparisons |
| 134 | CMEQz, |
| 135 | CMGEz, |
| 136 | CMGTz, |
| 137 | CMLEz, |
| 138 | CMLTz, |
| 139 | FCMEQz, |
| 140 | FCMGEz, |
| 141 | FCMGTz, |
| 142 | FCMLEz, |
| 143 | FCMLTz, |
| 144 | |
Ahmed Bougacha | fab5892 | 2015-03-10 20:45:38 +0000 | [diff] [blame] | 145 | // Vector across-lanes addition |
| 146 | // Only the lower result lane is defined. |
| 147 | SADDV, |
| 148 | UADDV, |
| 149 | |
| 150 | // Vector across-lanes min/max |
| 151 | // Only the lower result lane is defined. |
| 152 | SMINV, |
| 153 | UMINV, |
| 154 | SMAXV, |
| 155 | UMAXV, |
| 156 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 157 | // Vector bitwise negation |
| 158 | NOT, |
| 159 | |
| 160 | // Vector bitwise selection |
| 161 | BIT, |
| 162 | |
| 163 | // Compare-and-branch |
| 164 | CBZ, |
| 165 | CBNZ, |
| 166 | TBZ, |
| 167 | TBNZ, |
| 168 | |
| 169 | // Tail calls |
| 170 | TC_RETURN, |
| 171 | |
| 172 | // Custom prefetch handling |
| 173 | PREFETCH, |
| 174 | |
| 175 | // {s|u}int to FP within a FP register. |
| 176 | SITOF, |
| 177 | UITOF, |
| 178 | |
Tim Northover | bb72e6c | 2014-09-04 09:46:14 +0000 | [diff] [blame] | 179 | /// Natural vector cast. ISD::BITCAST is not natural in the big-endian |
| 180 | /// world w.r.t vectors; which causes additional REV instructions to be |
| 181 | /// generated to compensate for the byte-swapping. But sometimes we do |
| 182 | /// need to re-interpret the data in SIMD vector registers in big-endian |
| 183 | /// mode without emitting such REV instructions. |
| 184 | NVCAST, |
| 185 | |
Chad Rosier | d9d0f86 | 2014-10-08 02:31:24 +0000 | [diff] [blame] | 186 | SMULL, |
| 187 | UMULL, |
| 188 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 189 | // NEON Load/Store with post-increment base updates |
| 190 | LD2post = ISD::FIRST_TARGET_MEMORY_OPCODE, |
| 191 | LD3post, |
| 192 | LD4post, |
| 193 | ST2post, |
| 194 | ST3post, |
| 195 | ST4post, |
| 196 | LD1x2post, |
| 197 | LD1x3post, |
| 198 | LD1x4post, |
| 199 | ST1x2post, |
| 200 | ST1x3post, |
| 201 | ST1x4post, |
| 202 | LD1DUPpost, |
| 203 | LD2DUPpost, |
| 204 | LD3DUPpost, |
| 205 | LD4DUPpost, |
| 206 | LD1LANEpost, |
| 207 | LD2LANEpost, |
| 208 | LD3LANEpost, |
| 209 | LD4LANEpost, |
| 210 | ST2LANEpost, |
| 211 | ST3LANEpost, |
| 212 | ST4LANEpost |
| 213 | }; |
| 214 | |
| 215 | } // end namespace AArch64ISD |
| 216 | |
| 217 | class AArch64Subtarget; |
| 218 | class AArch64TargetMachine; |
| 219 | |
| 220 | class AArch64TargetLowering : public TargetLowering { |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 221 | public: |
Eric Christopher | 905f12d | 2015-01-29 00:19:42 +0000 | [diff] [blame] | 222 | explicit AArch64TargetLowering(const TargetMachine &TM, |
| 223 | const AArch64Subtarget &STI); |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 224 | |
Robin Morisset | 039781e | 2014-08-29 21:53:01 +0000 | [diff] [blame] | 225 | /// Selects the correct CCAssignFn for a given CallingConvention value. |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 226 | CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const; |
| 227 | |
| 228 | /// computeKnownBitsForTargetNode - Determine which of the bits specified in |
| 229 | /// Mask are known to be either zero or one and return them in the |
| 230 | /// KnownZero/KnownOne bitsets. |
| 231 | void computeKnownBitsForTargetNode(const SDValue Op, APInt &KnownZero, |
| 232 | APInt &KnownOne, const SelectionDAG &DAG, |
| 233 | unsigned Depth = 0) const override; |
| 234 | |
Mehdi Amini | eaabc51 | 2015-07-09 15:12:23 +0000 | [diff] [blame] | 235 | MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 236 | |
Matt Arsenault | 6f2a526 | 2014-07-27 17:46:40 +0000 | [diff] [blame] | 237 | /// allowsMisalignedMemoryAccesses - Returns true if the target allows |
Sanjay Patel | 08efcd9 | 2015-01-28 22:37:32 +0000 | [diff] [blame] | 238 | /// unaligned memory accesses of the specified type. |
Matt Arsenault | 6f2a526 | 2014-07-27 17:46:40 +0000 | [diff] [blame] | 239 | bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace = 0, |
| 240 | unsigned Align = 1, |
Akira Hatanaka | f53b040 | 2015-07-29 14:17:26 +0000 | [diff] [blame] | 241 | bool *Fast = nullptr) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 242 | |
| 243 | /// LowerOperation - Provide custom lowering hooks for some operations. |
| 244 | SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override; |
| 245 | |
| 246 | const char *getTargetNodeName(unsigned Opcode) const override; |
| 247 | |
| 248 | SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override; |
| 249 | |
| 250 | /// getFunctionAlignment - Return the Log2 alignment of this function. |
| 251 | unsigned getFunctionAlignment(const Function *F) const; |
| 252 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 253 | /// Returns true if a cast between SrcAS and DestAS is a noop. |
| 254 | bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { |
| 255 | // Addrspacecasts are always noops. |
| 256 | return true; |
| 257 | } |
| 258 | |
| 259 | /// createFastISel - This method returns a target specific FastISel object, |
| 260 | /// or null if the target does not support "fast" ISel. |
| 261 | FastISel *createFastISel(FunctionLoweringInfo &funcInfo, |
| 262 | const TargetLibraryInfo *libInfo) const override; |
| 263 | |
| 264 | bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override; |
| 265 | |
| 266 | bool isFPImmLegal(const APFloat &Imm, EVT VT) const override; |
| 267 | |
| 268 | /// isShuffleMaskLegal - Return true if the given shuffle mask can be |
| 269 | /// codegen'd directly, or if it should be stack expanded. |
| 270 | bool isShuffleMaskLegal(const SmallVectorImpl<int> &M, EVT VT) const override; |
| 271 | |
| 272 | /// getSetCCResultType - Return the ISD::SETCC ValueType |
Mehdi Amini | 44ede33 | 2015-07-09 02:09:04 +0000 | [diff] [blame] | 273 | EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, |
| 274 | EVT VT) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 275 | |
| 276 | SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const; |
| 277 | |
| 278 | MachineBasicBlock *EmitF128CSEL(MachineInstr *MI, |
| 279 | MachineBasicBlock *BB) const; |
| 280 | |
| 281 | MachineBasicBlock * |
| 282 | EmitInstrWithCustomInserter(MachineInstr *MI, |
| 283 | MachineBasicBlock *MBB) const override; |
| 284 | |
| 285 | bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I, |
| 286 | unsigned Intrinsic) const override; |
| 287 | |
| 288 | bool isTruncateFree(Type *Ty1, Type *Ty2) const override; |
| 289 | bool isTruncateFree(EVT VT1, EVT VT2) const override; |
| 290 | |
Chad Rosier | 5439005 | 2015-02-23 19:15:16 +0000 | [diff] [blame] | 291 | bool isProfitableToHoist(Instruction *I) const override; |
| 292 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 293 | bool isZExtFree(Type *Ty1, Type *Ty2) const override; |
| 294 | bool isZExtFree(EVT VT1, EVT VT2) const override; |
| 295 | bool isZExtFree(SDValue Val, EVT VT2) const override; |
| 296 | |
| 297 | bool hasPairedLoad(Type *LoadedType, |
| 298 | unsigned &RequiredAligment) const override; |
| 299 | bool hasPairedLoad(EVT LoadedType, unsigned &RequiredAligment) const override; |
| 300 | |
Hao Liu | 7ec8ee3 | 2015-06-26 02:32:07 +0000 | [diff] [blame] | 301 | unsigned getMaxSupportedInterleaveFactor() const override { return 4; } |
| 302 | |
| 303 | bool lowerInterleavedLoad(LoadInst *LI, |
| 304 | ArrayRef<ShuffleVectorInst *> Shuffles, |
| 305 | ArrayRef<unsigned> Indices, |
| 306 | unsigned Factor) const override; |
| 307 | bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI, |
| 308 | unsigned Factor) const override; |
| 309 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 310 | bool isLegalAddImmediate(int64_t) const override; |
| 311 | bool isLegalICmpImmediate(int64_t) const override; |
| 312 | |
| 313 | EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, |
| 314 | bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, |
| 315 | MachineFunction &MF) const override; |
| 316 | |
| 317 | /// isLegalAddressingMode - Return true if the addressing mode represented |
| 318 | /// by AM is legal for this target, for a load/store of the specified type. |
Mehdi Amini | 0cdec1e | 2015-07-09 02:09:40 +0000 | [diff] [blame] | 319 | bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, |
Matt Arsenault | bd7d80a | 2015-06-01 05:31:59 +0000 | [diff] [blame] | 320 | unsigned AS) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 321 | |
| 322 | /// \brief Return the cost of the scaling factor used in the addressing |
| 323 | /// mode represented by AM for this target, for a load/store |
| 324 | /// of the specified type. |
| 325 | /// If the AM is supported, the return value must be >= 0. |
| 326 | /// If the AM is not supported, it returns a negative value. |
Mehdi Amini | 0cdec1e | 2015-07-09 02:09:40 +0000 | [diff] [blame] | 327 | int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, |
Matt Arsenault | bd7d80a | 2015-06-01 05:31:59 +0000 | [diff] [blame] | 328 | unsigned AS) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 329 | |
| 330 | /// isFMAFasterThanFMulAndFAdd - Return true if an FMA operation is faster |
| 331 | /// than a pair of fmul and fadd instructions. fmuladd intrinsics will be |
| 332 | /// expanded to FMAs when this method returns true, otherwise fmuladd is |
| 333 | /// expanded to fmul + fadd. |
| 334 | bool isFMAFasterThanFMulAndFAdd(EVT VT) const override; |
| 335 | |
| 336 | const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override; |
| 337 | |
| 338 | /// \brief Returns false if N is a bit extraction pattern of (X >> C) & Mask. |
| 339 | bool isDesirableToCommuteWithShift(const SDNode *N) const override; |
| 340 | |
| 341 | /// \brief Returns true if it is beneficial to convert a load of a constant |
| 342 | /// to just the constant itself. |
| 343 | bool shouldConvertConstantLoadToIntImm(const APInt &Imm, |
| 344 | Type *Ty) const override; |
| 345 | |
| 346 | Value *emitLoadLinked(IRBuilder<> &Builder, Value *Addr, |
| 347 | AtomicOrdering Ord) const override; |
| 348 | Value *emitStoreConditional(IRBuilder<> &Builder, Value *Val, |
| 349 | Value *Addr, AtomicOrdering Ord) const override; |
| 350 | |
Ahmed Bougacha | 07a844d | 2015-09-22 17:21:44 +0000 | [diff] [blame^] | 351 | void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override; |
| 352 | |
Ahmed Bougacha | 5246867 | 2015-09-11 17:08:28 +0000 | [diff] [blame] | 353 | TargetLoweringBase::AtomicExpansionKind |
| 354 | shouldExpandAtomicLoadInIR(LoadInst *LI) const override; |
Robin Morisset | ed3d48f | 2014-09-03 21:29:59 +0000 | [diff] [blame] | 355 | bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override; |
Ahmed Bougacha | 9d67713 | 2015-09-11 17:08:17 +0000 | [diff] [blame] | 356 | TargetLoweringBase::AtomicExpansionKind |
JF Bastien | f14889e | 2015-03-04 15:47:57 +0000 | [diff] [blame] | 357 | shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 358 | |
Ahmed Bougacha | 5246867 | 2015-09-11 17:08:28 +0000 | [diff] [blame] | 359 | bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override; |
| 360 | |
Akira Hatanaka | e5b6e0d | 2014-07-25 19:31:34 +0000 | [diff] [blame] | 361 | bool useLoadStackGuardNode() const override; |
Chandler Carruth | 9d010ff | 2014-07-03 00:23:43 +0000 | [diff] [blame] | 362 | TargetLoweringBase::LegalizeTypeAction |
| 363 | getPreferredVectorAction(EVT VT) const override; |
| 364 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 365 | private: |
Quentin Colombet | 6843ac4 | 2015-03-31 20:52:32 +0000 | [diff] [blame] | 366 | bool isExtFreeImpl(const Instruction *Ext) const override; |
| 367 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 368 | /// Subtarget - Keep a pointer to the AArch64Subtarget around so that we can |
| 369 | /// make the right decision when generating code for different targets. |
| 370 | const AArch64Subtarget *Subtarget; |
| 371 | |
| 372 | void addTypeForNEON(EVT VT, EVT PromotedBitwiseVT); |
| 373 | void addDRTypeForNEON(MVT VT); |
| 374 | void addQRTypeForNEON(MVT VT); |
| 375 | |
| 376 | SDValue |
| 377 | LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, |
| 378 | const SmallVectorImpl<ISD::InputArg> &Ins, SDLoc DL, |
| 379 | SelectionDAG &DAG, |
| 380 | SmallVectorImpl<SDValue> &InVals) const override; |
| 381 | |
| 382 | SDValue LowerCall(CallLoweringInfo & /*CLI*/, |
| 383 | SmallVectorImpl<SDValue> &InVals) const override; |
| 384 | |
| 385 | SDValue LowerCallResult(SDValue Chain, SDValue InFlag, |
| 386 | CallingConv::ID CallConv, bool isVarArg, |
| 387 | const SmallVectorImpl<ISD::InputArg> &Ins, SDLoc DL, |
| 388 | SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals, |
| 389 | bool isThisReturn, SDValue ThisVal) const; |
| 390 | |
Adhemerval Zanella | 7bc3319 | 2015-07-28 13:03:31 +0000 | [diff] [blame] | 391 | SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; |
| 392 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 393 | bool isEligibleForTailCallOptimization( |
| 394 | SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg, |
| 395 | bool isCalleeStructRet, bool isCallerStructRet, |
| 396 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 397 | const SmallVectorImpl<SDValue> &OutVals, |
| 398 | const SmallVectorImpl<ISD::InputArg> &Ins, SelectionDAG &DAG) const; |
| 399 | |
| 400 | /// Finds the incoming stack arguments which overlap the given fixed stack |
| 401 | /// object and incorporates their load into the current chain. This prevents |
| 402 | /// an upcoming store from clobbering the stack argument before it's used. |
| 403 | SDValue addTokenForArgument(SDValue Chain, SelectionDAG &DAG, |
| 404 | MachineFrameInfo *MFI, int ClobberedFI) const; |
| 405 | |
| 406 | bool DoesCalleeRestoreStack(CallingConv::ID CallCC, bool TailCallOpt) const; |
| 407 | |
| 408 | bool IsTailCallConvention(CallingConv::ID CallCC) const; |
| 409 | |
| 410 | void saveVarArgRegisters(CCState &CCInfo, SelectionDAG &DAG, SDLoc DL, |
| 411 | SDValue &Chain) const; |
| 412 | |
| 413 | bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, |
| 414 | bool isVarArg, |
| 415 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 416 | LLVMContext &Context) const override; |
| 417 | |
| 418 | SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, |
| 419 | const SmallVectorImpl<ISD::OutputArg> &Outs, |
| 420 | const SmallVectorImpl<SDValue> &OutVals, SDLoc DL, |
| 421 | SelectionDAG &DAG) const override; |
| 422 | |
| 423 | SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; |
| 424 | SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; |
| 425 | SDValue LowerDarwinGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; |
| 426 | SDValue LowerELFGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const; |
Kristof Beyls | aea8461 | 2015-03-04 09:12:08 +0000 | [diff] [blame] | 427 | SDValue LowerELFTLSDescCallSeq(SDValue SymAddr, SDLoc DL, |
| 428 | SelectionDAG &DAG) const; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 429 | SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const; |
| 430 | SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const; |
| 431 | SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const; |
| 432 | SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const; |
Matthias Braun | b6ac8fa | 2015-04-07 17:33:05 +0000 | [diff] [blame] | 433 | SDValue LowerSELECT_CC(ISD::CondCode CC, SDValue LHS, SDValue RHS, |
| 434 | SDValue TVal, SDValue FVal, SDLoc dl, |
| 435 | SelectionDAG &DAG) const; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 436 | SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const; |
| 437 | SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const; |
| 438 | SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; |
| 439 | SDValue LowerAAPCS_VASTART(SDValue Op, SelectionDAG &DAG) const; |
| 440 | SDValue LowerDarwin_VASTART(SDValue Op, SelectionDAG &DAG) const; |
| 441 | SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const; |
| 442 | SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG) const; |
| 443 | SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const; |
| 444 | SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const; |
| 445 | SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const; |
| 446 | SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; |
| 447 | SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; |
| 448 | SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const; |
| 449 | SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; |
| 450 | SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; |
| 451 | SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const; |
| 452 | SDValue LowerVectorSRA_SRL_SHL(SDValue Op, SelectionDAG &DAG) const; |
| 453 | SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const; |
| 454 | SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG) const; |
| 455 | SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG) const; |
| 456 | SDValue LowerCTPOP(SDValue Op, SelectionDAG &DAG) const; |
| 457 | SDValue LowerF128Call(SDValue Op, SelectionDAG &DAG, |
| 458 | RTLIB::Libcall Call) const; |
| 459 | SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const; |
| 460 | SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const; |
| 461 | SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const; |
| 462 | SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const; |
| 463 | SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const; |
| 464 | SDValue LowerVectorAND(SDValue Op, SelectionDAG &DAG) const; |
| 465 | SDValue LowerVectorOR(SDValue Op, SelectionDAG &DAG) const; |
| 466 | SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const; |
| 467 | SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const; |
| 468 | |
Chad Rosier | 17020f9 | 2014-07-23 14:57:52 +0000 | [diff] [blame] | 469 | SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG, |
Benjamin Kramer | 8c90fd7 | 2014-09-03 11:41:21 +0000 | [diff] [blame] | 470 | std::vector<SDNode *> *Created) const override; |
Sanjay Patel | 1dd1559 | 2015-07-28 23:05:48 +0000 | [diff] [blame] | 471 | unsigned combineRepeatedFPDivisors() const override; |
Chad Rosier | 17020f9 | 2014-07-23 14:57:52 +0000 | [diff] [blame] | 472 | |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 473 | ConstraintType getConstraintType(StringRef Constraint) const override; |
Pat Gavlin | a717f25 | 2015-07-09 17:40:29 +0000 | [diff] [blame] | 474 | unsigned getRegisterByName(const char* RegName, EVT VT, |
| 475 | SelectionDAG &DAG) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 476 | |
| 477 | /// Examine constraint string and operand type and determine a weight value. |
| 478 | /// The operand object must already have been set up with the operand type. |
| 479 | ConstraintWeight |
| 480 | getSingleConstraintMatchWeight(AsmOperandInfo &info, |
| 481 | const char *constraint) const override; |
| 482 | |
| 483 | std::pair<unsigned, const TargetRegisterClass *> |
Eric Christopher | 11e4df7 | 2015-02-26 22:38:43 +0000 | [diff] [blame] | 484 | getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 485 | StringRef Constraint, MVT VT) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 486 | void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint, |
| 487 | std::vector<SDValue> &Ops, |
| 488 | SelectionDAG &DAG) const override; |
| 489 | |
Benjamin Kramer | 9bfb627 | 2015-07-05 19:29:18 +0000 | [diff] [blame] | 490 | unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const override { |
Daniel Sanders | f731eee | 2015-03-23 11:33:15 +0000 | [diff] [blame] | 491 | if (ConstraintCode == "Q") |
| 492 | return InlineAsm::Constraint_Q; |
| 493 | // FIXME: clang has code for 'Ump', 'Utf', 'Usa', and 'Ush' but these are |
| 494 | // followed by llvm_unreachable so we'll leave them unimplemented in |
| 495 | // the backend for now. |
| 496 | return TargetLowering::getInlineAsmMemConstraint(ConstraintCode); |
Daniel Sanders | bf5b80f | 2015-03-16 13:13:41 +0000 | [diff] [blame] | 497 | } |
| 498 | |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 499 | bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override; |
| 500 | bool mayBeEmittedAsTailCall(CallInst *CI) const override; |
| 501 | bool getIndexedAddressParts(SDNode *Op, SDValue &Base, SDValue &Offset, |
| 502 | ISD::MemIndexedMode &AM, bool &IsInc, |
| 503 | SelectionDAG &DAG) const; |
| 504 | bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset, |
| 505 | ISD::MemIndexedMode &AM, |
| 506 | SelectionDAG &DAG) const override; |
| 507 | bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base, |
| 508 | SDValue &Offset, ISD::MemIndexedMode &AM, |
| 509 | SelectionDAG &DAG) const override; |
| 510 | |
| 511 | void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results, |
| 512 | SelectionDAG &DAG) const override; |
Tim Northover | 3c55cca | 2014-11-27 21:02:42 +0000 | [diff] [blame] | 513 | |
| 514 | bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, |
| 515 | CallingConv::ID CallConv, |
Craig Topper | 44586dc | 2014-11-28 03:58:26 +0000 | [diff] [blame] | 516 | bool isVarArg) const override; |
Matthias Braun | af7d770 | 2015-07-16 20:02:37 +0000 | [diff] [blame] | 517 | |
| 518 | bool shouldNormalizeToSelectSequence(LLVMContext &, EVT) const override; |
Tim Northover | 3b0846e | 2014-05-24 12:50:23 +0000 | [diff] [blame] | 519 | }; |
| 520 | |
| 521 | namespace AArch64 { |
| 522 | FastISel *createFastISel(FunctionLoweringInfo &funcInfo, |
| 523 | const TargetLibraryInfo *libInfo); |
| 524 | } // end namespace AArch64 |
| 525 | |
| 526 | } // end namespace llvm |
| 527 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 528 | #endif |