LLVM  5.0.0
AArch64ISelLowering.h
Go to the documentation of this file.
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 
15 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H
16 #define LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H
17 
18 #include "AArch64.h"
21 #include "llvm/IR/CallingConv.h"
22 #include "llvm/IR/Instruction.h"
24 
25 namespace llvm {
26 
27 namespace AArch64ISD {
28 
29 enum NodeType : unsigned {
31  WrapperLarge, // 4-instruction MOVZ/MOVK sequence for 64-bit addresses.
32  CALL, // Function call.
33 
34  // Produces the full sequence of instructions for getting the thread pointer
35  // offset of a variable into X0, using the TLSDesc model.
37  ADRP, // Page address of a TargetGlobalAddress operand.
38  ADDlow, // Add the low 12 bits of a TargetGlobalAddress operand.
39  LOADgot, // Load from automatically generated descriptor (e.g. Global
40  // Offset Table, TLS record).
41  RET_FLAG, // Return with a flag operand. Operand 0 is the chain operand.
42  BRCOND, // Conditional branch instruction; "b.cond".
44  FCSEL, // Conditional move instruction.
45  CSINV, // Conditional select invert.
46  CSNEG, // Conditional select negate.
47  CSINC, // Conditional select increment.
48 
49  // Pointer to the thread's local storage area. Materialised from TPIDR_EL0 on
50  // ELF.
52  ADC,
53  SBC, // adc, sbc instructions
54 
55  // Arithmetic instructions which write flags.
61 
62  // Conditional compares. Operands: left,right,falsecc,cc,flags
66 
67  // Floating point comparison
69 
70  // Scalar extract
72 
73  // Scalar-to-vector duplication
74  DUP,
79 
80  // Vector immedate moves
88 
89  // Vector immediate ops
92 
93  // Vector bit select: similar to ISD::VSELECT but not all bits within an
94  // element must be identical.
95  BSL,
96 
97  // Vector arithmetic negation
98  NEG,
99 
100  // Vector shuffles
111 
112  // Vector shift by scalar
116 
117  // Vector shift by scalar (again)
123 
124  // Vector comparisons
133 
134  // Vector zero comparisons
145 
146  // Vector across-lanes addition
147  // Only the lower result lane is defined.
150 
151  // Vector across-lanes min/max
152  // Only the lower result lane is defined.
157 
158  // Vector bitwise negation
160 
161  // Vector bitwise selection
163 
164  // Compare-and-branch
169 
170  // Tail calls
172 
173  // Custom prefetch handling
175 
176  // {s|u}int to FP within a FP register.
179 
180  /// Natural vector cast. ISD::BITCAST is not natural in the big-endian
181  /// world w.r.t vectors; which causes additional REV instructions to be
182  /// generated to compensate for the byte-swapping. But sometimes we do
183  /// need to re-interpret the data in SIMD vector registers in big-endian
184  /// mode without emitting such REV instructions.
186 
189 
190  // Reciprocal estimates and steps.
193 
194  // NEON Load/Store with post-increment base updates
218 };
219 
220 } // end namespace AArch64ISD
221 
222 namespace {
223 
224 // Any instruction that defines a 32-bit result zeros out the high half of the
225 // register. Truncate can be lowered to EXTRACT_SUBREG. CopyFromReg may
226 // be copying from a truncate. But any other 32-bit operation will zero-extend
227 // up to 64 bits.
228 // FIXME: X86 also checks for CMOV here. Do we need something similar?
229 static inline bool isDef32(const SDNode &N) {
230  unsigned Opc = N.getOpcode();
231  return Opc != ISD::TRUNCATE && Opc != TargetOpcode::EXTRACT_SUBREG &&
232  Opc != ISD::CopyFromReg;
233 }
234 
235 } // end anonymous namespace
236 
237 class AArch64Subtarget;
238 class AArch64TargetMachine;
239 
241 public:
242  explicit AArch64TargetLowering(const TargetMachine &TM,
243  const AArch64Subtarget &STI);
244 
245  /// Selects the correct CCAssignFn for a given CallingConvention value.
246  CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const;
247 
248  /// Selects the correct CCAssignFn for a given CallingConvention value.
250 
251  /// Determine which of the bits specified in Mask are known to be either zero
252  /// or one and return them in the KnownZero/KnownOne bitsets.
254  const APInt &DemandedElts,
255  const SelectionDAG &DAG,
256  unsigned Depth = 0) const override;
257 
258  bool targetShrinkDemandedConstant(SDValue Op, const APInt &Demanded,
259  TargetLoweringOpt &TLO) const override;
260 
261  MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override;
262 
263  /// Returns true if the target allows unaligned memory accesses of the
264  /// specified type.
265  bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace = 0,
266  unsigned Align = 1,
267  bool *Fast = nullptr) const override;
268 
269  /// Provide custom lowering hooks for some operations.
270  SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
271 
272  const char *getTargetNodeName(unsigned Opcode) const override;
273 
274  SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
275 
276  /// Returns true if a cast between SrcAS and DestAS is a noop.
277  bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
278  // Addrspacecasts are always noops.
279  return true;
280  }
281 
282  /// This method returns a target specific FastISel object, or null if the
283  /// target does not support "fast" ISel.
285  const TargetLibraryInfo *libInfo) const override;
286 
287  bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
288 
289  bool isFPImmLegal(const APFloat &Imm, EVT VT) const override;
290 
291  /// Return true if the given shuffle mask can be codegen'd directly, or if it
292  /// should be stack expanded.
293  bool isShuffleMaskLegal(const SmallVectorImpl<int> &M, EVT VT) const override;
294 
295  /// Return the ISD::SETCC ValueType.
297  EVT VT) const override;
298 
300 
302  MachineBasicBlock *BB) const;
303 
306  MachineBasicBlock *MBB) const override;
307 
308  bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I,
309  unsigned Intrinsic) const override;
310 
311  bool isTruncateFree(Type *Ty1, Type *Ty2) const override;
312  bool isTruncateFree(EVT VT1, EVT VT2) const override;
313 
314  bool isProfitableToHoist(Instruction *I) const override;
315 
316  bool isZExtFree(Type *Ty1, Type *Ty2) const override;
317  bool isZExtFree(EVT VT1, EVT VT2) const override;
318  bool isZExtFree(SDValue Val, EVT VT2) const override;
319 
320  bool hasPairedLoad(EVT LoadedType, unsigned &RequiredAligment) const override;
321 
322  unsigned getMaxSupportedInterleaveFactor() const override { return 4; }
323 
326  ArrayRef<unsigned> Indices,
327  unsigned Factor) const override;
329  unsigned Factor) const override;
330 
331  bool isLegalAddImmediate(int64_t) const override;
332  bool isLegalICmpImmediate(int64_t) const override;
333 
334  EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign,
335  bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc,
336  MachineFunction &MF) const override;
337 
338  /// Return true if the addressing mode represented by AM is legal for this
339  /// target, for a load/store of the specified type.
340  bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
341  unsigned AS) const override;
342 
343  /// \brief Return the cost of the scaling factor used in the addressing
344  /// mode represented by AM for this target, for a load/store
345  /// of the specified type.
346  /// If the AM is supported, the return value must be >= 0.
347  /// If the AM is not supported, it returns a negative value.
348  int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty,
349  unsigned AS) const override;
350 
351  /// Return true if an FMA operation is faster than a pair of fmul and fadd
352  /// instructions. fmuladd intrinsics will be expanded to FMAs when this method
353  /// returns true, otherwise fmuladd is expanded to fmul + fadd.
354  bool isFMAFasterThanFMulAndFAdd(EVT VT) const override;
355 
356  const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override;
357 
358  /// \brief Returns false if N is a bit extraction pattern of (X >> C) & Mask.
359  bool isDesirableToCommuteWithShift(const SDNode *N) const override;
360 
361  /// \brief Returns true if it is beneficial to convert a load of a constant
362  /// to just the constant itself.
364  Type *Ty) const override;
365 
366  Value *emitLoadLinked(IRBuilder<> &Builder, Value *Addr,
367  AtomicOrdering Ord) const override;
369  Value *Addr, AtomicOrdering Ord) const override;
370 
371  void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override;
372 
374  shouldExpandAtomicLoadInIR(LoadInst *LI) const override;
375  bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override;
377  shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override;
378 
379  bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override;
380 
381  bool useLoadStackGuardNode() const override;
383  getPreferredVectorAction(EVT VT) const override;
384 
385  /// If the target has a standard location for the stack protector cookie,
386  /// returns the address of that location. Otherwise, returns nullptr.
387  Value *getIRStackGuard(IRBuilder<> &IRB) const override;
388 
389  /// If the target has a standard location for the unsafe stack pointer,
390  /// returns the address of that location. Otherwise, returns nullptr.
391  Value *getSafeStackPointerLocation(IRBuilder<> &IRB) const override;
392 
393  /// If a physical register, this returns the register that receives the
394  /// exception address on entry to an EH pad.
395  unsigned
396  getExceptionPointerRegister(const Constant *PersonalityFn) const override {
397  // FIXME: This is a guess. Has this been defined yet?
398  return AArch64::X0;
399  }
400 
401  /// If a physical register, this returns the register that receives the
402  /// exception typeid on entry to a landing pad.
403  unsigned
404  getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
405  // FIXME: This is a guess. Has this been defined yet?
406  return AArch64::X1;
407  }
408 
409  bool isIntDivCheap(EVT VT, AttributeList Attr) const override;
410 
411  bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT,
412  const SelectionDAG &DAG) const override {
413  // Do not merge to float value size (128 bytes) if no implicit
414  // float attribute is set.
415 
416  bool NoFloat = DAG.getMachineFunction().getFunction()->hasFnAttribute(
417  Attribute::NoImplicitFloat);
418 
419  if (NoFloat)
420  return (MemVT.getSizeInBits() <= 64);
421  return true;
422  }
423 
424  bool isCheapToSpeculateCttz() const override {
425  return true;
426  }
427 
428  bool isCheapToSpeculateCtlz() const override {
429  return true;
430  }
431 
432  bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;
433 
434  bool hasAndNotCompare(SDValue) const override {
435  // 'bics'
436  return true;
437  }
438 
439  bool hasBitPreservingFPLogic(EVT VT) const override {
440  // FIXME: Is this always true? It should be true for vectors at least.
441  return VT == MVT::f32 || VT == MVT::f64;
442  }
443 
444  bool supportSplitCSR(MachineFunction *MF) const override {
446  MF->getFunction()->hasFnAttribute(Attribute::NoUnwind);
447  }
448  void initializeSplitCSR(MachineBasicBlock *Entry) const override;
450  MachineBasicBlock *Entry,
451  const SmallVectorImpl<MachineBasicBlock *> &Exits) const override;
452 
453  bool supportSwiftError() const override {
454  return true;
455  }
456 
457  /// Returns the size of the platform's va_list object.
458  unsigned getVaListSizeInBits(const DataLayout &DL) const override;
459 
460  /// Returns true if \p VecTy is a legal interleaved access type. This
461  /// function checks the vector element type and the overall width of the
462  /// vector.
464  const DataLayout &DL) const;
465 
466  /// Returns the number of interleaved accesses that will be generated when
467  /// lowering accesses of the given type.
468  unsigned getNumInterleavedAccesses(VectorType *VecTy,
469  const DataLayout &DL) const;
470 
471  MachineMemOperand::Flags getMMOFlags(const Instruction &I) const override;
472 
473 private:
474  bool isExtFreeImpl(const Instruction *Ext) const override;
475 
476  /// Keep a pointer to the AArch64Subtarget around so that we can
477  /// make the right decision when generating code for different targets.
478  const AArch64Subtarget *Subtarget;
479 
480  void addTypeForNEON(MVT VT, MVT PromotedBitwiseVT);
481  void addDRTypeForNEON(MVT VT);
482  void addQRTypeForNEON(MVT VT);
483 
484  SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv,
485  bool isVarArg,
487  const SDLoc &DL, SelectionDAG &DAG,
488  SmallVectorImpl<SDValue> &InVals) const override;
489 
490  SDValue LowerCall(CallLoweringInfo & /*CLI*/,
491  SmallVectorImpl<SDValue> &InVals) const override;
492 
493  SDValue LowerCallResult(SDValue Chain, SDValue InFlag,
494  CallingConv::ID CallConv, bool isVarArg,
496  const SDLoc &DL, SelectionDAG &DAG,
497  SmallVectorImpl<SDValue> &InVals, bool isThisReturn,
498  SDValue ThisVal) const;
499 
500  SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
501 
502  bool isEligibleForTailCallOptimization(
503  SDValue Callee, CallingConv::ID CalleeCC, bool isVarArg,
505  const SmallVectorImpl<SDValue> &OutVals,
506  const SmallVectorImpl<ISD::InputArg> &Ins, SelectionDAG &DAG) const;
507 
508  /// Finds the incoming stack arguments which overlap the given fixed stack
509  /// object and incorporates their load into the current chain. This prevents
510  /// an upcoming store from clobbering the stack argument before it's used.
511  SDValue addTokenForArgument(SDValue Chain, SelectionDAG &DAG,
512  MachineFrameInfo &MFI, int ClobberedFI) const;
513 
514  bool DoesCalleeRestoreStack(CallingConv::ID CallCC, bool TailCallOpt) const;
515 
516  void saveVarArgRegisters(CCState &CCInfo, SelectionDAG &DAG, const SDLoc &DL,
517  SDValue &Chain) const;
518 
519  bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
520  bool isVarArg,
522  LLVMContext &Context) const override;
523 
524  SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
526  const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
527  SelectionDAG &DAG) const override;
528 
529  SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
530  unsigned Flag) const;
531  SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,
532  unsigned Flag) const;
533  SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,
534  unsigned Flag) const;
535  SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
536  unsigned Flag) const;
537  template <class NodeTy> SDValue getGOT(NodeTy *N, SelectionDAG &DAG) const;
538  template <class NodeTy>
539  SDValue getAddrLarge(NodeTy *N, SelectionDAG &DAG) const;
540  template <class NodeTy> SDValue getAddr(NodeTy *N, SelectionDAG &DAG) const;
541  SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
542  SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
543  SDValue LowerDarwinGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
544  SDValue LowerELFGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
545  SDValue LowerELFTLSDescCallSeq(SDValue SymAddr, const SDLoc &DL,
546  SelectionDAG &DAG) const;
547  SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
548  SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
549  SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
550  SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
551  SDValue LowerSELECT_CC(ISD::CondCode CC, SDValue LHS, SDValue RHS,
552  SDValue TVal, SDValue FVal, const SDLoc &dl,
553  SelectionDAG &DAG) const;
554  SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
555  SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
556  SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
557  SDValue LowerAAPCS_VASTART(SDValue Op, SelectionDAG &DAG) const;
558  SDValue LowerDarwin_VASTART(SDValue Op, SelectionDAG &DAG) const;
559  SDValue LowerWin64_VASTART(SDValue Op, SelectionDAG &DAG) const;
560  SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
561  SDValue LowerVACOPY(SDValue Op, SelectionDAG &DAG) const;
562  SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const;
563  SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
564  SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
565  SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
566  SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
567  SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
568  SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
569  SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const;
570  SDValue LowerEXTRACT_SUBVECTOR(SDValue Op, SelectionDAG &DAG) const;
571  SDValue LowerVectorSRA_SRL_SHL(SDValue Op, SelectionDAG &DAG) const;
572  SDValue LowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const;
573  SDValue LowerShiftRightParts(SDValue Op, SelectionDAG &DAG) const;
574  SDValue LowerVSETCC(SDValue Op, SelectionDAG &DAG) const;
575  SDValue LowerCTPOP(SDValue Op, SelectionDAG &DAG) const;
576  SDValue LowerF128Call(SDValue Op, SelectionDAG &DAG,
577  RTLIB::Libcall Call) const;
578  SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
579  SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;
580  SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;
581  SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
582  SDValue LowerINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
583  SDValue LowerVectorAND(SDValue Op, SelectionDAG &DAG) const;
584  SDValue LowerVectorOR(SDValue Op, SelectionDAG &DAG) const;
585  SDValue LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const;
586  SDValue LowerFSINCOS(SDValue Op, SelectionDAG &DAG) const;
587  SDValue LowerVECREDUCE(SDValue Op, SelectionDAG &DAG) const;
588 
589  SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,
590  std::vector<SDNode *> *Created) const override;
591  SDValue getSqrtEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled,
592  int &ExtraSteps, bool &UseOneConst,
593  bool Reciprocal) const override;
594  SDValue getRecipEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled,
595  int &ExtraSteps) const override;
596  unsigned combineRepeatedFPDivisors() const override;
597 
598  ConstraintType getConstraintType(StringRef Constraint) const override;
599  unsigned getRegisterByName(const char* RegName, EVT VT,
600  SelectionDAG &DAG) const override;
601 
602  /// Examine constraint string and operand type and determine a weight value.
603  /// The operand object must already have been set up with the operand type.
605  getSingleConstraintMatchWeight(AsmOperandInfo &info,
606  const char *constraint) const override;
607 
608  std::pair<unsigned, const TargetRegisterClass *>
609  getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
610  StringRef Constraint, MVT VT) const override;
611 
612  const char *LowerXConstraint(EVT ConstraintVT) const override;
613 
614  void LowerAsmOperandForConstraint(SDValue Op, std::string &Constraint,
615  std::vector<SDValue> &Ops,
616  SelectionDAG &DAG) const override;
617 
618  unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
619  if (ConstraintCode == "Q")
621  // FIXME: clang has code for 'Ump', 'Utf', 'Usa', and 'Ush' but these are
622  // followed by llvm_unreachable so we'll leave them unimplemented in
623  // the backend for now.
624  return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
625  }
626 
627  bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override;
628  bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
629  bool getIndexedAddressParts(SDNode *Op, SDValue &Base, SDValue &Offset,
630  ISD::MemIndexedMode &AM, bool &IsInc,
631  SelectionDAG &DAG) const;
632  bool getPreIndexedAddressParts(SDNode *N, SDValue &Base, SDValue &Offset,
634  SelectionDAG &DAG) const override;
635  bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDValue &Base,
636  SDValue &Offset, ISD::MemIndexedMode &AM,
637  SelectionDAG &DAG) const override;
638 
639  void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results,
640  SelectionDAG &DAG) const override;
641 
642  bool functionArgumentNeedsConsecutiveRegisters(Type *Ty,
643  CallingConv::ID CallConv,
644  bool isVarArg) const override;
645 
646  bool shouldNormalizeToSelectSequence(LLVMContext &, EVT) const override;
647 };
648 
649 namespace AArch64 {
650 FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
651  const TargetLibraryInfo *libInfo);
652 } // end namespace AArch64
653 
654 } // end namespace llvm
655 
656 #endif
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:827
unsigned getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:109
const MCPhysReg * getScratchRegisters(CallingConv::ID CC) const override
Returns a 0 terminated array of registers that can be safely used as scratch registers.
LLVMContext & Context
bool supportSplitCSR(MachineFunction *MF) const override
Return true if the target supports that a subset of CSRs for the given machine function is handled ex...
CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC) const
Selects the correct CCAssignFn for a given CallingConvention value.
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
Definition: Instructions.h:514
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace=0, unsigned Align=1, bool *Fast=nullptr) const override
Returns true if the target allows unaligned memory accesses of the specified type.
TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(EVT VT) const override
Return the preferred vector type legalization action.
bool isIntDivCheap(EVT VT, AttributeList Attr) const override
Return true if integer divide is usually cheaper than a sequence of several shifts, adds, and multiplies for this target.
DataLayout DL
This class represents a function call, abstracting a target machine's calling convention.
Libcall
RTLIB::Libcall enum - This enum defines all of the runtime library calls the backend can emit...
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
int getScalingFactorCost(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override
Return the cost of the scaling factor used in the addressing mode represented by AM for this target...
Function Alias Analysis Results
This instruction constructs a fixed permutation of two input vectors.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
An instruction for reading from memory.
Definition: Instructions.h:164
bool isLegalInterleavedAccessType(VectorType *VecTy, const DataLayout &DL) const
Returns true if VecTy is a legal interleaved access type.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
Definition: Instructions.h:677
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
bool lowerInterleavedLoad(LoadInst *LI, ArrayRef< ShuffleVectorInst * > Shuffles, ArrayRef< unsigned > Indices, unsigned Factor) const override
Lower an interleaved load into a ldN intrinsic.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:186
bool supportSwiftError() const override
Return true if the target supports swifterror attribute.
A convenience struct that encapsulates a DAG, and two SDValues for returning information from TargetL...
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:375
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Definition: IRBuilder.h:664
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the ISD::SETCC ValueType.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast between SrcAS and DestAS is a noop.
AtomicOrdering
Atomic ordering for LLVM's memory model.
Value * getSafeStackPointerLocation(IRBuilder<> &IRB) const override
If the target has a standard location for the unsafe stack pointer, returns the address of that locat...
SDValue ReconstructShuffle(SDValue Op, SelectionDAG &DAG) const
const AMDGPUAS &AS return SrcAS
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Definition: FastISel.h:67
void emitAtomicCmpXchgNoStoreLLBalance(IRBuilder<> &Builder) const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
An instruction for storing to memory.
Definition: Instructions.h:306
Natural vector cast.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out...
Definition: ISDOpcodes.h:909
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:25
bool isFPImmLegal(const APFloat &Imm, EVT VT) const override
Returns true if the target can instruction select the specified FP immediate natively.
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicLoadInIR(LoadInst *LI) const override
Returns how the given (atomic) load should be expanded by the IR-level AtomicExpand pass...
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
void initializeSplitCSR(MachineBasicBlock *Entry) const override
Perform necessary initialization to handle a subset of CSRs explicitly via copies.
unsigned getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:121
bool isLegalICmpImmediate(int64_t) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
bool isTruncateFree(Type *Ty1, Type *Ty2) const override
Return true if it's free to truncate a value of type FromTy to type ToTy.
bool hasAndNotCompare(SDValue) const override
Return true if the target should transform: (X & Y) == Y —> (~X & Y) == 0 (X & Y) != Y —> (~X & Y) !=...
bool shouldExpandAtomicCmpXchgInIR(AtomicCmpXchgInst *AI) const override
Returns true if the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass into a ...
bool isZExtFree(Type *Ty1, Type *Ty2) const override
Return true if any actual instruction that defines a value of type FromTy implicitly zero-extends the...
Machine Value Type.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
This is an important base class in LLVM.
Definition: Constant.h:42
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
MachineBasicBlock * EmitF128CSEL(MachineInstr &MI, MachineBasicBlock *BB) const
bool isDesirableToCommuteWithShift(const SDNode *N) const override
Returns false if N is a bit extraction pattern of (X >> C) & Mask.
bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const override
Returns true if it is beneficial to convert a load of a constant to just the constant itself...
TargetLoweringBase::AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all...
lazy value info
Extended Value Type.
Definition: ValueTypes.h:34
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth=0) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
CCState - This class holds information needed while lowering arguments and return values...
EVT getOptimalMemOpType(uint64_t Size, unsigned DstAlign, unsigned SrcAlign, bool IsMemset, bool ZeroMemset, bool MemcpyStrSrc, MachineFunction &MF) const override
Returns the target specific optimal type for load and store operations as a result of memset...
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:209
MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override
EVT is not used in-tree, but is used by out-of-tree target.
virtual unsigned getInlineAsmMemConstraint(StringRef ConstraintCode) const
AArch64TargetLowering(const TargetMachine &TM, const AArch64Subtarget &STI)
Provides information about what library functions are available for the current target.
AddressSpace
Definition: NVPTXBaseInfo.h:22
const size_t N
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
static const int FIRST_TARGET_MEMORY_OPCODE
FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations which do not reference a specific me...
Definition: ISDOpcodes.h:834
Represents one node in the SelectionDAG.
bool isProfitableToHoist(Instruction *I) const override
Check if it is profitable to hoist instruction in then/else to if.
bool targetShrinkDemandedConstant(SDValue Op, const APInt &Demanded, TargetLoweringOpt &TLO) const override
bool lowerInterleavedStore(StoreInst *SI, ShuffleVectorInst *SVI, unsigned Factor) const override
Lower an interleaved store into a stN intrinsic.
bool hasBitPreservingFPLogic(EVT VT) const override
Return true if it is safe to transform an integer-domain bitwise operation into the equivalent floati...
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const
Selects the correct CCAssignFn for a given CallingConvention value.
Class to represent vector types.
Definition: DerivedTypes.h:393
void insertCopiesSplitCSR(MachineBasicBlock *Entry, const SmallVectorImpl< MachineBasicBlock * > &Exits) const override
Insert explicit copies in entry and exit blocks.
bool shouldExpandAtomicStoreInIR(StoreInst *SI) const override
Returns true if the given (atomic) store should be expanded by the IR-level AtomicExpand pass into an...
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
Class for arbitrary precision integers.
Definition: APInt.h:69
bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT, const SelectionDAG &DAG) const override
Returns if it's reasonable to merge stores to MemVT size.
Value * getIRStackGuard(IRBuilder<> &IRB) const override
If the target has a standard location for the stack protector cookie, returns the address of that loc...
unsigned getNumInterleavedAccesses(VectorType *VecTy, const DataLayout &DL) const
Returns the number of interleaved accesses that will be generated when lowering accesses of the given...
AddrMode
ARM Addressing Modes.
Definition: ARMBaseInfo.h:235
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Flags
Flags values. These may be or'd together.
Representation of each machine instruction.
Definition: MachineInstr.h:59
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.h:254
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const override
This method returns a target specific FastISel object, or null if the target does not support "fast" ...
bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override
Return if the target supports combining a chain like:
unsigned getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:292
#define I(x, y, z)
Definition: MD5.cpp:58
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Value * emitLoadLinked(IRBuilder<> &Builder, Value *Addr, AtomicOrdering Ord) const override
Perform a load-linked operation on Addr, returning a "Value *" with the corresponding pointee type...
bool getTgtMemIntrinsic(IntrinsicInfo &Info, const CallInst &I, unsigned Intrinsic) const override
getTgtMemIntrinsic - Represent NEON load and store intrinsics as MemIntrinsicNodes.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
Definition: CallingConv.h:43
bool useLoadStackGuardNode() const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
Definition: ISDOpcodes.h:175
bool isLegalAddImmediate(int64_t) const override
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
LegalizeTypeAction
This enum indicates whether a types are legal for a target, and if not, what action should be used to...
MachineMemOperand::Flags getMMOFlags(const Instruction &I) const override
This callback is used to inspect load/store instructions and add target-specific MachineMemOperand fl...
unsigned getVaListSizeInBits(const DataLayout &DL) const override
Returns the size of the platform's va_list object.
LLVM Value Representation.
Definition: Value.h:73
Value * emitStoreConditional(IRBuilder<> &Builder, Value *Val, Value *Addr, AtomicOrdering Ord) const override
Perform a store-conditional operation to Addr.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:56
IRTranslator LLVM IR MI
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool hasPairedLoad(EVT LoadedType, unsigned &RequiredAligment) const override
Return true if the target supplies and combines to a paired load two loaded values of type LoadedType...
bool isCheapToSpeculateCttz() const override
Return true if it is cheap to speculate a call to intrinsic cttz.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
Provide custom lowering hooks for some operations.
TRUNCATE - Completely drop the high bits.
Definition: ISDOpcodes.h:450
bool isCheapToSpeculateCtlz() const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
bool isShuffleMaskLegal(const SmallVectorImpl< int > &M, EVT VT) const override
Return true if the given shuffle mask can be codegen'd directly, or if it should be stack expanded...
This file describes how to lower LLVM code to machine code.
bool isFMAFasterThanFMulAndFAdd(EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
MemIndexedMode
MemIndexedMode enum - This enum defines the load / store indexed addressing modes.
Definition: ISDOpcodes.h:864