LLVM 23.0.0git
X86ISelLowering.h
Go to the documentation of this file.
1//===-- X86ISelLowering.h - X86 DAG Lowering Interface ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the interfaces that X86 uses to lower LLVM code into a
10// selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
15#define LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
16
17#include "X86SelectionDAGInfo.h"
20
21namespace llvm {
22 class X86Subtarget;
23 class X86TargetMachine;
24
25 namespace X86 {
26 /// Current rounding mode is represented in bits 11:10 of FPSR. These
27 /// values are same as corresponding constants for rounding mode used
28 /// in glibc.
30 rmInvalid = -1, // For handle Invalid rounding mode
31 rmToNearest = 0, // FE_TONEAREST
32 rmDownward = 1 << 10, // FE_DOWNWARD
33 rmUpward = 2 << 10, // FE_UPWARD
34 rmTowardZero = 3 << 10, // FE_TOWARDZERO
35 rmMask = 3 << 10 // Bit mask selecting rounding mode
36 };
37 }
38
39 /// Define some predicates that are used for node matching.
40 namespace X86 {
41 /// Returns true if Elt is a constant zero or floating point constant +0.0.
42 bool isZeroNode(SDValue Elt);
43
44 /// Returns true of the given offset can be
45 /// fit into displacement field of the instruction.
47 bool hasSymbolicDisplacement);
48
49 /// Determines whether the callee is required to pop its
50 /// own arguments. Callee pop is necessary to support tail calls.
51 bool isCalleePop(CallingConv::ID CallingConv,
52 bool is64Bit, bool IsVarArg, bool GuaranteeTCO);
53
54 /// If Op is a constant whose elements are all the same constant or
55 /// undefined, return true and return the constant value in \p SplatVal.
56 /// If we have undef bits that don't cover an entire element, we treat these
57 /// as zero if AllowPartialUndefs is set, else we fail and return false.
58 bool isConstantSplat(SDValue Op, APInt &SplatVal,
59 bool AllowPartialUndefs = true);
60
61 /// Check if Op is a load operation that could be folded into some other x86
62 /// instruction as a memory operand. Example: vpaddd (%rdi), %xmm0, %xmm0.
63 bool mayFoldLoad(SDValue Op, const X86Subtarget &Subtarget,
64 bool AssumeSingleUse = false,
65 bool IgnoreAlignment = false);
66
67 /// Check if Op is a load operation that could be folded into a vector splat
68 /// instruction as a memory operand. Example: vbroadcastss 16(%rdi), %xmm2.
70 const X86Subtarget &Subtarget,
71 bool AssumeSingleUse = false);
72
73 /// Check if Op is a value that could be used to fold a store into some
74 /// other x86 instruction as a memory operand. Ex: pextrb $0, %xmm0, (%rdi).
76
77 /// Check if Op is an operation that could be folded into a zero extend x86
78 /// instruction.
80
81 /// True if the target supports the extended frame for async Swift
82 /// functions.
83 bool isExtendedSwiftAsyncFrameSupported(const X86Subtarget &Subtarget,
84 const MachineFunction &MF);
85
86 /// Convert LLVM rounding mode to X86 rounding mode.
87 int getRoundingModeX86(unsigned RM);
88
89 } // end namespace X86
90
91 //===--------------------------------------------------------------------===//
92 // X86 Implementation of the TargetLowering interface
93 class X86TargetLowering final : public TargetLowering {
94 // Copying needed for an outgoing byval argument.
95 enum ByValCopyKind {
96 // Argument is already in the correct location, no copy needed.
97 NoCopy,
98 // Argument value is currently in the local stack frame, needs copying to
99 // outgoing arguemnt area.
100 CopyOnce,
101 // Argument value is currently in the outgoing argument area, but not at
102 // the correct offset, so needs copying via a temporary in local stack
103 // space.
104 CopyViaTemp,
105 };
106
107 public:
108 explicit X86TargetLowering(const X86TargetMachine &TM,
109 const X86Subtarget &STI);
110
111 unsigned getJumpTableEncoding() const override;
112 bool useSoftFloat() const override;
113
114 void markLibCallAttributes(MachineFunction *MF, unsigned CC,
115 ArgListTy &Args) const override;
116
117 MVT getScalarShiftAmountTy(const DataLayout &, EVT VT) const override {
118 return MVT::i8;
119 }
120
121 const MCExpr *
123 const MachineBasicBlock *MBB, unsigned uid,
124 MCContext &Ctx) const override;
125
126 /// Returns relocation base for the given PIC jumptable.
128 SelectionDAG &DAG) const override;
129 const MCExpr *
131 unsigned JTI, MCContext &Ctx) const override;
132
133 /// Return the desired alignment for ByVal aggregate
134 /// function arguments in the caller parameter area. For X86, aggregates
135 /// that contains are placed at 16-byte boundaries while the rest are at
136 /// 4-byte boundaries.
137 Align getByValTypeAlignment(Type *Ty, const DataLayout &DL) const override;
138
139 EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
140 const AttributeList &FuncAttributes) const override;
141
142 /// Returns true if it's safe to use load / store of the
143 /// specified type to expand memcpy / memset inline. This is mostly true
144 /// for all types except for some special cases. For example, on X86
145 /// targets without SSE2 f64 load / store are done with fldl / fstpl which
146 /// also does type conversion. Note the specified type doesn't have to be
147 /// legal as the hook is used before type legalization.
148 bool isSafeMemOpType(MVT VT) const override;
149
150 bool isMemoryAccessFast(EVT VT, Align Alignment) const;
151
152 /// Returns true if the target allows unaligned memory accesses of the
153 /// specified type. Returns whether it is "fast" in the last argument.
154 bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, Align Alignment,
156 unsigned *Fast) const override;
157
158 /// This function returns true if the memory access is aligned or if the
159 /// target allows this specific unaligned memory access. If the access is
160 /// allowed, the optional final parameter returns a relative speed of the
161 /// access (as defined by the target).
163 LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace,
164 Align Alignment,
166 unsigned *Fast = nullptr) const override;
167
168 bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT,
169 const MachineMemOperand &MMO,
170 unsigned *Fast) const {
171 return allowsMemoryAccess(Context, DL, VT, MMO.getAddrSpace(),
172 MMO.getAlign(), MMO.getFlags(), Fast);
173 }
174
175 /// Provide custom lowering hooks for some operations.
176 ///
177 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
178
179 /// Replace the results of node with an illegal result
180 /// type with new values built out of custom code.
181 ///
183 SelectionDAG &DAG) const override;
184
185 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
186
187 bool preferABDSToABSWithNSW(EVT VT) const override;
188
189 bool preferSextInRegOfTruncate(EVT TruncVT, EVT VT,
190 EVT ExtVT) const override;
191
193 EVT VT) const override;
194
195 /// Return true if the target has native support for
196 /// the specified value type and it is 'desirable' to use the type for the
197 /// given node type. e.g. On x86 i16 is legal, but undesirable since i16
198 /// instruction encodings are longer and some i16 instructions are slow.
199 bool isTypeDesirableForOp(unsigned Opc, EVT VT) const override;
200
201 /// Return true if the target has native support for the
202 /// specified value type and it is 'desirable' to use the type. e.g. On x86
203 /// i16 is legal, but undesirable since i16 instruction encodings are longer
204 /// and some i16 instructions are slow.
205 bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const override;
206
207 /// Return prefered fold type, Abs if this is a vector, AddAnd if its an
208 /// integer, None otherwise.
211 const SDNode *SETCC0,
212 const SDNode *SETCC1) const override;
213
214 /// Return the newly negated expression if the cost is not expensive and
215 /// set the cost in \p Cost to indicate that if it is cheaper or neutral to
216 /// do the negation.
218 bool LegalOperations, bool ForCodeSize,
220 unsigned Depth) const override;
221
224 MachineBasicBlock *MBB) const override;
225
226 /// Do not merge vector stores after legalization because that may conflict
227 /// with x86-specific store splitting optimizations.
228 bool mergeStoresAfterLegalization(EVT MemVT) const override {
229 return !MemVT.isVector();
230 }
231
232 bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT,
233 const MachineFunction &MF) const override;
234
235 bool isCheapToSpeculateCttz(Type *Ty) const override;
236
237 bool isCheapToSpeculateCtlz(Type *Ty) const override;
238
239 bool isCtlzFast() const override;
240
241 bool isMultiStoresCheaperThanBitsMerge(EVT LTy, EVT HTy) const override {
242 // If the pair to store is a mixture of float and int values, we will
243 // save two bitwise instructions and one float-to-int instruction and
244 // increase one store instruction. There is potentially a more
245 // significant benefit because it avoids the float->int domain switch
246 // for input value. So It is more likely a win.
247 if ((LTy.isFloatingPoint() && HTy.isInteger()) ||
248 (LTy.isInteger() && HTy.isFloatingPoint()))
249 return true;
250 // If the pair only contains int values, we will save two bitwise
251 // instructions and increase one store instruction (costing one more
252 // store buffer). Since the benefit is more blurred so we leave
253 // such pair out until we get testcase to prove it is a win.
254 return false;
255 }
256
257 bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;
258
259 bool hasAndNotCompare(SDValue Y) const override;
260
261 bool hasAndNot(SDValue Y) const override;
262
263 bool hasBitTest(SDValue X, SDValue Y) const override;
264
267 unsigned OldShiftOpcode, unsigned NewShiftOpcode,
268 SelectionDAG &DAG) const override;
269
271 EVT VT, unsigned ShiftOpc, bool MayTransformRotate,
272 const APInt &ShiftOrRotateAmt,
273 const std::optional<APInt> &AndMask) const override;
274
275 bool preferScalarizeSplat(SDNode *N) const override;
276
277 CondMergingParams
279 const Value *Rhs) const override;
280
281 bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override;
282
283 bool shouldFoldMaskToVariableShiftPair(SDValue Y) const override;
284
285 bool
287 unsigned KeptBits) const override {
288 // For vectors, we don't have a preference..
289 if (XVT.isVector())
290 return false;
291
292 auto VTIsOk = [](EVT VT) -> bool {
293 return VT == MVT::i8 || VT == MVT::i16 || VT == MVT::i32 ||
294 VT == MVT::i64;
295 };
296
297 // We are ok with KeptBitsVT being byte/word/dword, what MOVS supports.
298 // XVT will be larger than KeptBitsVT.
299 MVT KeptBitsVT = MVT::getIntegerVT(KeptBits);
300 return VTIsOk(XVT) && VTIsOk(KeptBitsVT);
301 }
302
305 unsigned ExpansionFactor) const override;
306
307 bool shouldSplatInsEltVarIndex(EVT VT) const override;
308
309 bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override {
310 // Converting to sat variants holds little benefit on X86 as we will just
311 // need to saturate the value back using fp arithmatic.
313 }
314
315 bool convertSetCCLogicToBitwiseLogic(EVT VT) const override {
316 return VT.isScalarInteger();
317 }
318
319 /// Vector-sized comparisons are fast using PCMPEQ + PMOVMSK or PTEST.
320 MVT hasFastEqualityCompare(unsigned NumBits) const override;
321
322 /// Return the value type to use for ISD::SETCC.
324 EVT VT) const override;
325
327 const APInt &DemandedElts,
328 TargetLoweringOpt &TLO) const override;
329
330 /// Determine which of the bits specified in Mask are known to be either
331 /// zero or one and return them in the KnownZero/KnownOne bitsets.
333 KnownBits &Known,
334 const APInt &DemandedElts,
335 const SelectionDAG &DAG,
336 unsigned Depth = 0) const override;
337
338 /// Determine the number of bits in the operation that are sign bits.
340 const APInt &DemandedElts,
341 const SelectionDAG &DAG,
342 unsigned Depth) const override;
343
345 const APInt &DemandedElts,
346 APInt &KnownUndef,
347 APInt &KnownZero,
348 TargetLoweringOpt &TLO,
349 unsigned Depth) const override;
350
352 const APInt &DemandedElts,
353 unsigned MaskIndex,
354 TargetLoweringOpt &TLO,
355 unsigned Depth) const;
356
358 const APInt &DemandedBits,
359 const APInt &DemandedElts,
360 KnownBits &Known,
361 TargetLoweringOpt &TLO,
362 unsigned Depth) const override;
363
365 SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts,
366 SelectionDAG &DAG, unsigned Depth) const override;
367
369 SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG,
370 bool PoisonOnly, unsigned Depth) const override;
371
373 SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG,
374 bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const override;
375
376 bool isSplatValueForTargetNode(SDValue Op, const APInt &DemandedElts,
377 APInt &UndefElts, const SelectionDAG &DAG,
378 unsigned Depth) const override;
379
381 // Peek through bitcasts/extracts/inserts to see if we have a vector
382 // load/broadcast from memory.
383 while (Op.getOpcode() == ISD::BITCAST ||
384 Op.getOpcode() == ISD::EXTRACT_SUBVECTOR ||
385 (Op.getOpcode() == ISD::INSERT_SUBVECTOR &&
386 Op.getOperand(0).isUndef()))
387 Op = Op.getOperand(Op.getOpcode() == ISD::INSERT_SUBVECTOR ? 1 : 0);
388
389 return Op.getOpcode() == X86ISD::VBROADCAST_LOAD ||
390 Op.getOpcode() == X86ISD::SUBV_BROADCAST_LOAD ||
391 (Op.getOpcode() == ISD::LOAD &&
394 }
395
396 bool isTargetCanonicalSelect(SDNode *N) const override;
397
398 const Constant *getTargetConstantFromLoad(LoadSDNode *LD) const override;
399
400 SDValue unwrapAddress(SDValue N) const override;
401
403
404 ConstraintType getConstraintType(StringRef Constraint) const override;
405
406 /// Examine constraint string and operand type and determine a weight value.
407 /// The operand object must already have been set up with the operand type.
409 getSingleConstraintMatchWeight(AsmOperandInfo &Info,
410 const char *Constraint) const override;
411
412 const char *LowerXConstraint(EVT ConstraintVT) const override;
413
414 /// Lower the specified operand into the Ops vector. If it is invalid, don't
415 /// add anything to Ops. If hasMemory is true it means one of the asm
416 /// constraint of the inline asm instruction being processed is 'm'.
418 std::vector<SDValue> &Ops,
419 SelectionDAG &DAG) const override;
420
422 getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
423 if (ConstraintCode == "v")
425 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
426 }
427
428 /// Handle Lowering flag assembly outputs.
430 const SDLoc &DL,
431 const AsmOperandInfo &Constraint,
432 SelectionDAG &DAG) const override;
433
434 /// Given a physical register constraint
435 /// (e.g. {edx}), return the register number and the register class for the
436 /// register. This should only be used for C_Register constraints. On
437 /// error, this returns a register number of 0.
438 std::pair<unsigned, const TargetRegisterClass *>
440 StringRef Constraint, MVT VT) const override;
441
442 /// Return true if the addressing mode represented
443 /// by AM is legal for this target, for a load/store of the specified type.
444 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM,
445 Type *Ty, unsigned AS,
446 Instruction *I = nullptr) const override;
447
448 bool addressingModeSupportsTLS(const GlobalValue &GV) const override;
449
450 /// Return true if the specified immediate is legal
451 /// icmp immediate, that is the target has icmp instructions which can
452 /// compare a register against the immediate without having to materialize
453 /// the immediate into a register.
454 bool isLegalICmpImmediate(int64_t Imm) const override;
455
456 /// Return true if the specified immediate is legal
457 /// add immediate, that is the target has add instructions which can
458 /// add a register and the immediate without having to materialize
459 /// the immediate into a register.
460 bool isLegalAddImmediate(int64_t Imm) const override;
461
462 bool isLegalStoreImmediate(int64_t Imm) const override;
463
464 /// Add x86-specific opcodes to the default list.
465 bool isBinOp(unsigned Opcode) const override;
466
467 /// Returns true if the opcode is a commutative binary operation.
468 bool isCommutativeBinOp(unsigned Opcode) const override;
469
470 /// Return true if it's free to truncate a value of
471 /// type Ty1 to type Ty2. e.g. On x86 it's free to truncate a i32 value in
472 /// register EAX to i16 by referencing its sub-register AX.
473 bool isTruncateFree(Type *Ty1, Type *Ty2) const override;
474 bool isTruncateFree(EVT VT1, EVT VT2) const override;
475
476 bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override;
477
478 /// Return true if any actual instruction that defines a
479 /// value of type Ty1 implicit zero-extends the value to Ty2 in the result
480 /// register. This does not necessarily include registers defined in
481 /// unknown ways, such as incoming arguments, or copies from unknown
482 /// virtual registers. Also, if isTruncateFree(Ty2, Ty1) is true, this
483 /// does not necessarily apply to truncate instructions. e.g. on x86-64,
484 /// all instructions that define 32-bit values implicit zero-extend the
485 /// result out to 64 bits.
486 bool isZExtFree(Type *Ty1, Type *Ty2) const override;
487 bool isZExtFree(EVT VT1, EVT VT2) const override;
488 bool isZExtFree(SDValue Val, EVT VT2) const override;
489
490 bool shouldConvertPhiType(Type *From, Type *To) const override;
491
492 /// Return true if folding a vector load into ExtVal (a sign, zero, or any
493 /// extend node) is profitable.
494 bool isVectorLoadExtDesirable(SDValue) const override;
495
496 /// Return true if an FMA operation is faster than a pair of fmul and fadd
497 /// instructions. fmuladd intrinsics will be expanded to FMAs when this
498 /// method returns true, otherwise fmuladd is expanded to fmul + fadd.
500 EVT VT) const override;
501
502 /// Return true if it's profitable to narrow operations of type SrcVT to
503 /// DestVT. e.g. on x86, it's profitable to narrow from i32 to i8 but not
504 /// from i32 to i16.
505 bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override;
506
507 bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode, EVT VT,
508 unsigned SelectOpcode, SDValue X,
509 SDValue Y) const override;
510
511 /// Given an intrinsic, checks if on the target the intrinsic will need to
512 /// map to a MemIntrinsicNode (touches memory). If this is the case, it
513 /// returns true and stores the intrinsic information into the IntrinsicInfo
514 /// that was passed to the function.
516 const CallBase &I, MachineFunction &MF,
517 unsigned Intrinsic) const override;
518
519 /// Returns true if the target can instruction select the
520 /// specified FP immediate natively. If false, the legalizer will
521 /// materialize the FP immediate as a load from a constant pool.
522 bool isFPImmLegal(const APFloat &Imm, EVT VT,
523 bool ForCodeSize) const override;
524
525 /// Targets can use this to indicate that they only support *some*
526 /// VECTOR_SHUFFLE operations, those with specific masks. By default, if a
527 /// target supports the VECTOR_SHUFFLE node, all mask values are assumed to
528 /// be legal.
529 bool isShuffleMaskLegal(ArrayRef<int> Mask, EVT VT) const override;
530
531 /// Similar to isShuffleMaskLegal. Targets can use this to indicate if there
532 /// is a suitable VECTOR_SHUFFLE that can be used to replace a VAND with a
533 /// constant pool entry.
534 bool isVectorClearMaskLegal(ArrayRef<int> Mask, EVT VT) const override;
535
536 /// Returns true if lowering to a jump table is allowed.
537 bool areJTsAllowed(const Function *Fn) const override;
538
540 EVT ConditionVT) const override;
541
542 /// If true, then instruction selection should
543 /// seek to shrink the FP constant of the specified type to a smaller type
544 /// in order to save space and / or reduce runtime.
545 bool ShouldShrinkFPConstant(EVT VT) const override;
546
547 /// Return true if we believe it is correct and profitable to reduce the
548 /// load node to a smaller type.
549 bool
551 std::optional<unsigned> ByteOffset) const override;
552
553 /// Return true if the specified scalar FP type is computed in an SSE
554 /// register, not on the X87 floating point stack.
555 bool isScalarFPTypeInSSEReg(EVT VT) const;
556
557 /// Returns true if it is beneficial to convert a load of a constant
558 /// to just the constant itself.
560 Type *Ty) const override;
561
562 bool reduceSelectOfFPConstantLoads(EVT CmpOpVT) const override;
563
564 bool convertSelectOfConstantsToMath(EVT VT) const override;
565
566 bool decomposeMulByConstant(LLVMContext &Context, EVT VT,
567 SDValue C) const override;
568
569 /// Return true if EXTRACT_SUBVECTOR is cheap for this result type
570 /// with this index.
571 bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
572 unsigned Index) const override;
573
574 /// Scalar ops always have equal or better analysis/performance/power than
575 /// the vector equivalent, so this always makes sense if the scalar op is
576 /// supported.
577 bool shouldScalarizeBinop(SDValue) const override;
578
579 /// Extract of a scalar FP value from index 0 of a vector is free.
580 bool isExtractVecEltCheap(EVT VT, unsigned Index) const override {
581 EVT EltVT = VT.getScalarType();
582 return (EltVT == MVT::f32 || EltVT == MVT::f64) && Index == 0;
583 }
584
585 /// Overflow nodes should get combined/lowered to optimal instructions
586 /// (they should allow eliminating explicit compares by getting flags from
587 /// math ops).
588 bool shouldFormOverflowOp(unsigned Opcode, EVT VT,
589 bool MathUsed) const override;
590
591 bool storeOfVectorConstantIsCheap(bool IsZero, EVT MemVT, unsigned NumElem,
592 unsigned AddrSpace) const override {
593 // If we can replace more than 2 scalar stores, there will be a reduction
594 // in instructions even after we add a vector constant load.
595 return IsZero || NumElem > 2;
596 }
597
598 bool isLoadBitCastBeneficial(EVT LoadVT, EVT BitcastVT,
599 const SelectionDAG &DAG,
600 const MachineMemOperand &MMO) const override;
601
602 Register getRegisterByName(const char* RegName, LLT VT,
603 const MachineFunction &MF) const override;
604
605 /// If a physical register, this returns the register that receives the
606 /// exception address on entry to an EH pad.
608 getExceptionPointerRegister(const Constant *PersonalityFn) const override;
609
610 /// If a physical register, this returns the register that receives the
611 /// exception typeid on entry to a landing pad.
613 getExceptionSelectorRegister(const Constant *PersonalityFn) const override;
614
615 bool needsFixedCatchObjects() const override;
616
617 /// This method returns a target specific FastISel object,
618 /// or null if the target does not support "fast" ISel.
619 FastISel *
621 const TargetLibraryInfo *libInfo,
622 const LibcallLoweringInfo *libcallLowering) const override;
623
624 /// If the target has a standard location for the stack protector cookie,
625 /// returns the address of that location. Otherwise, returns nullptr.
627 const LibcallLoweringInfo &Libcalls) const override;
628
629 bool useLoadStackGuardNode(const Module &M) const override;
630 bool useStackGuardXorFP() const override;
631 void
633 const LibcallLoweringInfo &Libcalls) const override;
635 const SDLoc &DL) const override;
636
637
638 /// Return true if the target stores SafeStack pointer at a fixed offset in
639 /// some non-standard address space, and populates the address space and
640 /// offset as appropriate.
642 IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const override;
643
644 std::pair<SDValue, SDValue> BuildFILD(EVT DstVT, EVT SrcVT, const SDLoc &DL,
645 SDValue Chain, SDValue Pointer,
646 MachinePointerInfo PtrInfo,
647 Align Alignment,
648 SelectionDAG &DAG) const;
649
650 /// Customize the preferred legalization strategy for certain types.
651 LegalizeTypeAction getPreferredVectorAction(MVT VT) const override;
652
654 EVT VT) const override;
655
658 EVT VT) const override;
659
661 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
662 unsigned &NumIntermediates, MVT &RegisterVT) const override;
663
665 Type *Ty, CallingConv::ID CallConv, bool isVarArg,
666 const DataLayout &DL) const override;
667
668 bool isIntDivCheap(EVT VT, AttributeList Attr) const override;
669
670 bool supportSwiftError() const override;
671
672 bool supportKCFIBundles() const override { return true; }
673
676 const TargetInstrInfo *TII) const override;
677
678 bool hasStackProbeSymbol(const MachineFunction &MF) const override;
679 bool hasInlineStackProbe(const MachineFunction &MF) const override;
680 StringRef getStackProbeSymbolName(const MachineFunction &MF) const override;
681
682 unsigned getStackProbeSize(const MachineFunction &MF) const;
683
684 bool hasVectorBlend() const override { return true; }
685
686 unsigned getMaxSupportedInterleaveFactor() const override { return 4; }
687
689 unsigned OpNo) const override;
690
692 MachineMemOperand *MMO, SDValue &NewLoad,
693 SDValue Ptr, SDValue PassThru,
694 SDValue Mask) const override;
696 MachineMemOperand *MMO, SDValue Ptr, SDValue Val,
697 SDValue Mask) const override;
698
699 /// Lower interleaved load(s) into target specific
700 /// instructions/intrinsics.
701 bool lowerInterleavedLoad(Instruction *Load, Value *Mask,
703 ArrayRef<unsigned> Indices, unsigned Factor,
704 const APInt &GapMask) const override;
705
706 /// Lower interleaved store(s) into target specific
707 /// instructions/intrinsics.
708 bool lowerInterleavedStore(Instruction *Store, Value *Mask,
709 ShuffleVectorInst *SVI, unsigned Factor,
710 const APInt &GapMask) const override;
711
713 int JTI, SelectionDAG &DAG) const override;
714
715 Align getPrefLoopAlignment(MachineLoop *ML) const override;
716
717 EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const override {
718 if (VT == MVT::f80)
719 return EVT::getIntegerVT(Context, 96);
721 }
722
723 protected:
724 std::pair<const TargetRegisterClass *, uint8_t>
726 MVT VT) const override;
727
728 private:
729 /// Keep a reference to the X86Subtarget around so that we can
730 /// make the right decision when generating code for different targets.
731 const X86Subtarget &Subtarget;
732
733 /// A list of legal FP immediates.
734 std::vector<APFloat> LegalFPImmediates;
735
736 /// Indicate that this x86 target can instruction
737 /// select the specified FP immediate natively.
738 void addLegalFPImmediate(const APFloat& Imm) {
739 LegalFPImmediates.push_back(Imm);
740 }
741
743 CallingConv::ID CallConv, bool isVarArg,
744 const SmallVectorImpl<ISD::InputArg> &Ins,
745 const SDLoc &dl, SelectionDAG &DAG,
746 SmallVectorImpl<SDValue> &InVals,
747 uint32_t *RegMask) const;
748 SDValue LowerMemArgument(SDValue Chain, CallingConv::ID CallConv,
749 const SmallVectorImpl<ISD::InputArg> &ArgInfo,
750 const SDLoc &dl, SelectionDAG &DAG,
751 const CCValAssign &VA, MachineFrameInfo &MFI,
752 unsigned i) const;
753 SDValue LowerMemOpCallTo(SDValue Chain, SDValue StackPtr, SDValue Arg,
754 const SDLoc &dl, SelectionDAG &DAG,
755 const CCValAssign &VA,
756 ISD::ArgFlagsTy Flags, bool isByval) const;
757
758 // Call lowering helpers.
759
760 /// Check whether the call is eligible for sibling call optimization.
761 bool
762 isEligibleForSiblingCallOpt(TargetLowering::CallLoweringInfo &CLI,
763 CCState &CCInfo,
764 SmallVectorImpl<CCValAssign> &ArgLocs) const;
765 SDValue EmitTailCallLoadRetAddr(SelectionDAG &DAG, SDValue &OutRetAddr,
766 SDValue Chain, bool IsTailCall,
767 bool Is64Bit, int FPDiff,
768 const SDLoc &dl) const;
769
770 unsigned GetAlignedArgumentStackSize(unsigned StackSize,
771 SelectionDAG &DAG) const;
772
773 unsigned getAddressSpace() const;
774
775 SDValue FP_TO_INTHelper(SDValue Op, SelectionDAG &DAG, bool IsSigned,
776 SDValue &Chain) const;
777 SDValue LRINT_LLRINTHelper(SDNode *N, SelectionDAG &DAG) const;
778
779 SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const;
780 SDValue LowerVSELECT(SDValue Op, SelectionDAG &DAG) const;
781 SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
782 SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
783
784 unsigned getGlobalWrapperKind(const GlobalValue *GV,
785 const unsigned char OpFlags) const;
786 SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
787 SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
788 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
789 SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
790 SDValue LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) const;
791
792 /// Creates target global address or external symbol nodes for calls or
793 /// other uses.
794 SDValue LowerGlobalOrExternal(SDValue Op, SelectionDAG &DAG, bool ForCall,
795 bool *IsImpCall) const;
796
797 SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
798 SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
799 SDValue LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const;
800 SDValue LowerFP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
801 SDValue LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG) const;
802 SDValue LowerLRINT_LLRINT(SDValue Op, SelectionDAG &DAG) const;
803 SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
804 SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG) const;
805 SDValue LowerSELECT(SDValue Op, SelectionDAG &DAG) const;
806 SDValue LowerConditionalBranch(SDValue Op, SelectionDAG &DAG) const;
807 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
808 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
809 SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
810 SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const;
811 SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
812 SDValue LowerADDROFRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
813 SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
814 SDValue LowerFRAME_TO_ARGS_OFFSET(SDValue Op, SelectionDAG &DAG) const;
815 ByValCopyKind ByValNeedsCopyForTailCall(SelectionDAG &DAG, SDValue Src,
816 SDValue Dst,
817 ISD::ArgFlagsTy Flags) const;
818 SDValue LowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
819 SDValue lowerEH_SJLJ_SETJMP(SDValue Op, SelectionDAG &DAG) const;
820 SDValue lowerEH_SJLJ_LONGJMP(SDValue Op, SelectionDAG &DAG) const;
821 SDValue lowerEH_SJLJ_SETUP_DISPATCH(SDValue Op, SelectionDAG &DAG) const;
822 SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
823 SDValue LowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
824 SDValue LowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
825 SDValue LowerGET_FPENV_MEM(SDValue Op, SelectionDAG &DAG) const;
826 SDValue LowerSET_FPENV_MEM(SDValue Op, SelectionDAG &DAG) const;
827 SDValue LowerRESET_FPENV(SDValue Op, SelectionDAG &DAG) const;
828 SDValue LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) const;
829 SDValue LowerWin64_FP_TO_INT128(SDValue Op, SelectionDAG &DAG,
830 SDValue &Chain) const;
831 SDValue LowerWin64_INT128_TO_FP(SDValue Op, SelectionDAG &DAG) const;
832 SDValue LowerGC_TRANSITION(SDValue Op, SelectionDAG &DAG) const;
833 SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
834 SDValue lowerFaddFsub(SDValue Op, SelectionDAG &DAG) const;
835 SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;
836 SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;
837 SDValue LowerFP_TO_BF16(SDValue Op, SelectionDAG &DAG) const;
838
839 SDValue
840 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
841 const SmallVectorImpl<ISD::InputArg> &Ins,
842 const SDLoc &dl, SelectionDAG &DAG,
843 SmallVectorImpl<SDValue> &InVals) const override;
844 SDValue LowerCall(CallLoweringInfo &CLI,
845 SmallVectorImpl<SDValue> &InVals) const override;
846
847 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
848 const SmallVectorImpl<ISD::OutputArg> &Outs,
849 const SmallVectorImpl<SDValue> &OutVals,
850 const SDLoc &dl, SelectionDAG &DAG) const override;
851
852 bool supportSplitCSR(MachineFunction *MF) const override {
853 return MF->getFunction().getCallingConv() == CallingConv::CXX_FAST_TLS &&
854 MF->getFunction().hasFnAttribute(Attribute::NoUnwind);
855 }
856 void initializeSplitCSR(MachineBasicBlock *Entry) const override;
857 void insertCopiesSplitCSR(
858 MachineBasicBlock *Entry,
859 const SmallVectorImpl<MachineBasicBlock *> &Exits) const override;
860
861 bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override;
862
863 bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
864
865 EVT getTypeForExtReturn(LLVMContext &Context, EVT VT,
866 ISD::NodeType ExtendKind) const override;
867
868 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
869 bool isVarArg,
870 const SmallVectorImpl<ISD::OutputArg> &Outs,
871 LLVMContext &Context,
872 const Type *RetTy) const override;
873
874 const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override;
876
878 shouldExpandAtomicLoadInIR(LoadInst *LI) const override;
880 shouldExpandAtomicStoreInIR(StoreInst *SI) const override;
882 shouldExpandAtomicRMWInIR(const AtomicRMWInst *AI) const override;
884 shouldExpandLogicAtomicRMWInIR(const AtomicRMWInst *AI) const;
885 void emitBitTestAtomicRMWIntrinsic(AtomicRMWInst *AI) const override;
886 void emitCmpArithAtomicRMWIntrinsic(AtomicRMWInst *AI) const override;
887
888 LoadInst *
889 lowerIdempotentRMWIntoFencedLoad(AtomicRMWInst *AI) const override;
890
891 bool needsCmpXchgNb(Type *MemType) const;
892
893 void SetupEntryBlockForSjLj(MachineInstr &MI, MachineBasicBlock *MBB,
894 MachineBasicBlock *DispatchBB, int FI) const;
895
896 // Utility function to emit the low-level va_arg code for X86-64.
897 MachineBasicBlock *
898 EmitVAARGWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const;
899
900 /// Utility function to emit the xmm reg save portion of va_start.
901 MachineBasicBlock *EmitLoweredCascadedSelect(MachineInstr &MI1,
902 MachineInstr &MI2,
903 MachineBasicBlock *BB) const;
904
905 MachineBasicBlock *EmitLoweredSelect(MachineInstr &I,
906 MachineBasicBlock *BB) const;
907
908 MachineBasicBlock *EmitLoweredCatchRet(MachineInstr &MI,
909 MachineBasicBlock *BB) const;
910
911 MachineBasicBlock *EmitLoweredSegAlloca(MachineInstr &MI,
912 MachineBasicBlock *BB) const;
913
914 MachineBasicBlock *EmitLoweredProbedAlloca(MachineInstr &MI,
915 MachineBasicBlock *BB) const;
916
917 MachineBasicBlock *EmitLoweredTLSCall(MachineInstr &MI,
918 MachineBasicBlock *BB) const;
919
920 MachineBasicBlock *EmitLoweredIndirectThunk(MachineInstr &MI,
921 MachineBasicBlock *BB) const;
922
923 MachineBasicBlock *emitEHSjLjSetJmp(MachineInstr &MI,
924 MachineBasicBlock *MBB) const;
925
926 void emitSetJmpShadowStackFix(MachineInstr &MI,
927 MachineBasicBlock *MBB) const;
928
929 MachineBasicBlock *emitEHSjLjLongJmp(MachineInstr &MI,
930 MachineBasicBlock *MBB) const;
931
932 MachineBasicBlock *emitLongJmpShadowStackFix(MachineInstr &MI,
933 MachineBasicBlock *MBB) const;
934
935 MachineBasicBlock *EmitSjLjDispatchBlock(MachineInstr &MI,
936 MachineBasicBlock *MBB) const;
937
938 MachineBasicBlock *emitPatchableEventCall(MachineInstr &MI,
939 MachineBasicBlock *MBB) const;
940
941 /// Emit flags for the given setcc condition and operands. Also returns the
942 /// corresponding X86 condition code constant in X86CC.
943 SDValue emitFlagsForSetcc(SDValue Op0, SDValue Op1, ISD::CondCode CC,
944 const SDLoc &dl, SelectionDAG &DAG,
945 SDValue &X86CC) const;
946
947 bool optimizeFMulOrFDivAsShiftAddBitcast(SDNode *N, SDValue FPConst,
948 SDValue IntPow2) const override;
949
950 /// Check if replacement of SQRT with RSQRT should be disabled.
951 bool isFsqrtCheap(SDValue Op, SelectionDAG &DAG) const override;
952
953 /// Use rsqrt* to speed up sqrt calculations.
954 SDValue getSqrtEstimate(SDValue Op, SelectionDAG &DAG, int Enabled,
955 int &RefinementSteps, bool &UseOneConstNR,
956 bool Reciprocal) const override;
957
958 /// Use rcp* to speed up fdiv calculations.
959 SDValue getRecipEstimate(SDValue Op, SelectionDAG &DAG, int Enabled,
960 int &RefinementSteps) const override;
961
962 /// Reassociate floating point divisions into multiply by reciprocal.
963 unsigned combineRepeatedFPDivisors() const override;
964
965 SDValue BuildSDIVPow2(SDNode *N, const APInt &Divisor, SelectionDAG &DAG,
966 SmallVectorImpl<SDNode *> &Created) const override;
967
968 SDValue getMOVL(SelectionDAG &DAG, const SDLoc &dl, MVT VT, SDValue V1,
969 SDValue V2) const;
970 };
971
972 namespace X86 {
973 FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
974 const TargetLibraryInfo *libInfo,
975 const LibcallLoweringInfo *libcallLowering);
976 } // end namespace X86
977
978 // X86 specific Gather/Scatter nodes.
979 // The class has the same order of operands as MaskedGatherScatterSDNode for
980 // convenience.
982 public:
983 // This is a intended as a utility and should never be directly created.
986
987 const SDValue &getBasePtr() const { return getOperand(3); }
988 const SDValue &getIndex() const { return getOperand(4); }
989 const SDValue &getMask() const { return getOperand(2); }
990 const SDValue &getScale() const { return getOperand(5); }
991
992 static bool classof(const SDNode *N) {
993 return N->getOpcode() == X86ISD::MGATHER ||
994 N->getOpcode() == X86ISD::MSCATTER;
995 }
996 };
997
999 public:
1000 const SDValue &getPassThru() const { return getOperand(1); }
1001
1002 static bool classof(const SDNode *N) {
1003 return N->getOpcode() == X86ISD::MGATHER;
1004 }
1005 };
1006
1008 public:
1009 const SDValue &getValue() const { return getOperand(1); }
1010
1011 static bool classof(const SDNode *N) {
1012 return N->getOpcode() == X86ISD::MSCATTER;
1013 }
1014 };
1015
1016 /// Generate unpacklo/unpackhi shuffle mask.
1017 void createUnpackShuffleMask(EVT VT, SmallVectorImpl<int> &Mask, bool Lo,
1018 bool Unary);
1019
1020 /// Similar to unpacklo/unpackhi, but without the 128-bit lane limitation
1021 /// imposed by AVX and specific to the unary pattern. Example:
1022 /// v8iX Lo --> <0, 0, 1, 1, 2, 2, 3, 3>
1023 /// v8iX Hi --> <4, 4, 5, 5, 6, 6, 7, 7>
1024 void createSplat2ShuffleMask(MVT VT, SmallVectorImpl<int> &Mask, bool Lo);
1025
1026} // end namespace llvm
1027
1028#endif // LLVM_LIB_TARGET_X86_X86ISELLOWERING_H
return SDValue()
static SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG)
static SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *ST)
static SDValue LowerFP_TO_INT_SAT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget)
static SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG)
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
Function Alias Analysis Results
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define RegName(no)
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
static unsigned getAddressSpace(const Value *V, unsigned MaxLookup)
static void LowerMemOpCallTo(SelectionDAG &DAG, MachineFunction &MF, SDValue Chain, SDValue Arg, SDValue PtrOff, int SPDiff, unsigned ArgOffset, bool isPPC64, bool isTailCall, bool isVector, SmallVectorImpl< SDValue > &MemOpChains, SmallVectorImpl< TailCallArgumentInfo > &TailCallArguments, const SDLoc &dl)
LowerMemOpCallTo - Store the argument to the stack or remember it in case of tail calls.
const SmallVectorImpl< MachineOperand > & Cond
static SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
static SDValue LowerFRAMEADDR(SDValue Op, SelectionDAG &DAG, const SparcSubtarget *Subtarget)
static SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG)
static SDValue LowerRETURNADDR(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, const SparcSubtarget *Subtarget)
static SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG, const SparcTargetLowering &TLI, bool hasHardQuad)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
This file describes how to lower LLVM code to machine code.
static bool is64Bit(const char *name)
static SDValue LowerCallResult(SDValue Chain, SDValue InGlue, const SmallVectorImpl< CCValAssign > &RVLocs, const SDLoc &dl, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals)
LowerCallResult - Lower the result values of a call into the appropriate copies out of appropriate ph...
Class for arbitrary precision integers.
Definition APInt.h:78
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This is an important base class in LLVM.
Definition Constant.h:43
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Definition FastISel.h:66
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Common base class shared among various IRBuilders.
Definition IRBuilder.h:114
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Tracks which library functions to use for a particular subtarget.
This class is used to represent ISD::LOAD nodes.
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Machine Value Type.
static MVT getIntegerVT(unsigned BitWidth)
Instructions::iterator instr_iterator
Representation of each machine instruction.
A description of a memory reference used in the backend.
unsigned getAddrSpace() const
Flags
Flags values. These may be or'd together.
Flags getFlags() const
Return the raw flags of the source value,.
LLVM_ABI Align getAlign() const
Return the minimum known alignment in bytes of the actual memory reference.
MemIntrinsicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, SDVTList VTs, EVT MemoryVT, PointerUnion< MachineMemOperand *, MachineMemOperand ** > MemRefs)
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
const SDValue & getOperand(unsigned Num) const
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This instruction constructs a fixed permutation of two input vectors.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
TargetInstrInfo - Interface to description of machine instruction set.
Provides information about what library functions are available for the current target.
ShiftLegalizationStrategy
Return the preferred strategy to legalize tihs SHIFT instruction, with ExpansionFactor being the recu...
virtual EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const
For types supported by the target, this is an identity function.
bool isOperationLegalOrCustom(unsigned Op, EVT VT, bool LegalOnly=false) const
Return true if the specified operation is legal on this target or can be made legal with custom lower...
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
AndOrSETCCFoldKind
Enum of different potentially desirable ways to fold (and/or (setcc ...), (setcc ....
NegatibleCost
Enum that specifies when a float negation is beneficial.
std::vector< ArgListEntry > ArgListTy
virtual InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const
virtual bool isTargetCanonicalConstantNode(SDValue Op) const
Returns true if the given Opc is considered a canonical constant for the target, which should not be ...
TargetLowering(const TargetLowering &)=delete
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual unsigned combineRepeatedFPDivisors() const
Indicate whether this target prefers to combine FDIVs with the same divisor.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
LLVM Value Representation.
Definition Value.h:75
const SDValue & getPassThru() const
static bool classof(const SDNode *N)
const SDValue & getBasePtr() const
static bool classof(const SDNode *N)
const SDValue & getValue() const
static bool classof(const SDNode *N)
bool shouldFormOverflowOp(unsigned Opcode, EVT VT, bool MathUsed) const override
Overflow nodes should get combined/lowered to optimal instructions (they should allow eliminating exp...
Align getPrefLoopAlignment(MachineLoop *ML) const override
Return the preferred loop alignment.
std::pair< const TargetRegisterClass *, uint8_t > findRepresentativeClass(const TargetRegisterInfo *TRI, MVT VT) const override
Return the largest legal super-reg register class of the register class for the specified type and it...
bool isLegalAddImmediate(int64_t Imm) const override
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
bool preferSextInRegOfTruncate(EVT TruncVT, EVT VT, EVT ExtVT) const override
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...
SDValue getPICJumpTableRelocBase(SDValue Table, SelectionDAG &DAG) const override
Returns relocation base for the given PIC jumptable.
bool preferABDSToABSWithNSW(EVT VT) const override
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
bool isMultiStoresCheaperThanBitsMerge(EVT LTy, EVT HTy) const override
Return true if it is cheaper to split the store of a merged int val from a pair of smaller values int...
unsigned getJumpTableEncoding() const override
Return the entry encoding for a jump table in the current function.
std::pair< SDValue, SDValue > BuildFILD(EVT DstVT, EVT SrcVT, const SDLoc &DL, SDValue Chain, SDValue Pointer, MachinePointerInfo PtrInfo, Align Alignment, SelectionDAG &DAG) const
bool shouldTransformSignedTruncationCheck(EVT XVT, unsigned KeptBits) const override
Should we tranform the IR-optimal check for whether given truncation down into KeptBits would be trun...
bool SimplifyDemandedVectorEltsForTargetNode(SDValue Op, const APInt &DemandedElts, APInt &KnownUndef, APInt &KnownZero, TargetLoweringOpt &TLO, unsigned Depth) const override
Attempt to simplify any target nodes based on the demanded vector elements, returning true on success...
bool isMemoryAccessFast(EVT VT, Align Alignment) const
SDValue LowerAsmOutputForConstraint(SDValue &Chain, SDValue &Flag, const SDLoc &DL, const AsmOperandInfo &Constraint, SelectionDAG &DAG) const override
Handle Lowering flag assembly outputs.
bool supportKCFIBundles() const override
Return true if the target supports kcfi operand bundles.
const char * LowerXConstraint(EVT ConstraintVT) const override
Try to replace an X constraint, which matches anything, with another that has more specific requireme...
SDValue SimplifyMultipleUseDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, SelectionDAG &DAG, unsigned Depth) const override
More limited version of SimplifyDemandedBits that can be used to "lookthrough" ops that don't contrib...
bool useLoadStackGuardNode(const Module &M) const override
If this function returns true, SelectionDAGBuilder emits a LOAD_STACK_GUARD node when it is lowering ...
bool isSplatValueForTargetNode(SDValue Op, const APInt &DemandedElts, APInt &UndefElts, const SelectionDAG &DAG, unsigned Depth) const override
Return true if vector Op has the same value across all DemandedElts, indicating any elements which ma...
bool convertSelectOfConstantsToMath(EVT VT) const override
Return true if a select of constants (select Cond, C1, C2) should be transformed into simple math ops...
ConstraintType getConstraintType(StringRef Constraint) const override
Given a constraint letter, return the type of constraint for this target.
bool hasVectorBlend() const override
Return true if the target has a vector blend instruction.
Value * getIRStackGuard(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const override
If the target has a standard location for the stack protector cookie, returns the address of that loc...
Register getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
bool useSoftFloat() const override
InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const override
ShiftLegalizationStrategy preferredShiftLegalizationStrategy(SelectionDAG &DAG, SDNode *N, unsigned ExpansionFactor) const override
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
Provide custom lowering hooks for some operations.
bool isLegalStoreImmediate(int64_t Imm) const override
Return true if the specified immediate is legal for the value input of a store instruction.
SDValue visitMaskedStore(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, MachineMemOperand *MMO, SDValue Ptr, SDValue Val, SDValue Mask) const override
SDValue getNegatedExpression(SDValue Op, SelectionDAG &DAG, bool LegalOperations, bool ForCodeSize, NegatibleCost &Cost, unsigned Depth) const override
Return the newly negated expression if the cost is not expensive and set the cost in Cost to indicate...
Value * getSafeStackPointerLocation(IRBuilderBase &IRB, const LibcallLoweringInfo &Libcalls) const override
Return true if the target stores SafeStack pointer at a fixed offset in some non-standard address spa...
bool isTypeDesirableForOp(unsigned Opc, EVT VT) const override
Return true if the target has native support for the specified value type and it is 'desirable' to us...
const MCExpr * getPICJumpTableRelocBaseExpr(const MachineFunction *MF, unsigned JTI, MCContext &Ctx) const override
This returns the relocation base for the given PIC jumptable, the same as getPICJumpTableRelocBase,...
bool isCtlzFast() const override
Return true if ctlz instruction is fast.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
bool isSafeMemOpType(MVT VT) const override
Returns true if it's safe to use load / store of the specified type to expand memcpy / memset inline.
bool shouldProduceAndByConstByHoistingConstFromShiftsLHSOfAnd(SDValue X, ConstantSDNode *XC, ConstantSDNode *CC, SDValue Y, unsigned OldShiftOpcode, unsigned NewShiftOpcode, SelectionDAG &DAG) const override
Given the pattern (X & (C l>>/<< Y)) ==/!= 0 return true if it should be transformed into: ((X <</l>>...
bool functionArgumentNeedsConsecutiveRegisters(Type *Ty, CallingConv::ID CallConv, bool isVarArg, const DataLayout &DL) const override
For some targets, an LLVM struct type must be broken down into multiple simple types,...
MVT getScalarShiftAmountTy(const DataLayout &, EVT VT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
bool supportSwiftError() const override
Return true if the target supports swifterror attribute.
bool storeOfVectorConstantIsCheap(bool IsZero, EVT MemVT, unsigned NumElem, unsigned AddrSpace) const override
Return true if it is expected to be cheaper to do a store of vector constant with the given size and ...
Align getByValTypeAlignment(Type *Ty, const DataLayout &DL) const override
Return the desired alignment for ByVal aggregate function arguments in the caller parameter area.
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
bool shouldSplatInsEltVarIndex(EVT VT) const override
Return true if inserting a scalar into a variable element of an undef vector is more efficiently hand...
bool isInlineAsmTargetBranch(const SmallVectorImpl< StringRef > &AsmStrs, unsigned OpNo) const override
On x86, return true if the operand with index OpNo is a CALL or JUMP instruction, which can use eithe...
MVT hasFastEqualityCompare(unsigned NumBits) const override
Vector-sized comparisons are fast using PCMPEQ + PMOVMSK or PTEST.
bool SimplifyDemandedVectorEltsForTargetShuffle(SDValue Op, const APInt &DemandedElts, unsigned MaskIndex, TargetLoweringOpt &TLO, unsigned Depth) const
bool isLegalICmpImmediate(int64_t Imm) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
bool hasInlineStackProbe(const MachineFunction &MF) const override
Returns true if stack probing through inline assembly is requested.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
unsigned preferedOpcodeForCmpEqPiecesOfOperand(EVT VT, unsigned ShiftOpc, bool MayTransformRotate, const APInt &ShiftOrRotateAmt, const std::optional< APInt > &AndMask) const override
bool isXAndYEqZeroPreferableToXAndYEqY(ISD::CondCode Cond, EVT VT) const override
bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT, const MachineFunction &MF) const override
Returns if it's reasonable to merge stores to MemVT size.
bool hasAndNot(SDValue Y) const override
Return true if the target has a bitwise and-not operation: X = ~A & B This can be used to simplify se...
bool SimplifyDemandedBitsForTargetNode(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth) const override
Attempt to simplify any target nodes based on the demanded bits/elts, returning true on success.
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.
bool shouldReduceLoadWidth(SDNode *Load, ISD::LoadExtType ExtTy, EVT NewVT, std::optional< unsigned > ByteOffset) const override
Return true if we believe it is correct and profitable to reduce the load node to a smaller type.
bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, const MachineMemOperand &MMO, unsigned *Fast) const
bool preferScalarizeSplat(SDNode *N) const override
bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override
Should we generate fp_to_si_sat and fp_to_ui_sat from type FPVT to type VT from min(max(fptoi)) satur...
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
bool lowerInterleavedStore(Instruction *Store, Value *Mask, ShuffleVectorInst *SVI, unsigned Factor, const APInt &GapMask) const override
Lower interleaved store(s) into target specific instructions/intrinsics.
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AS, Align Alignment, MachineMemOperand::Flags Flags, unsigned *Fast) const override
Returns true if the target allows unaligned memory accesses of the specified type.
bool isNarrowingProfitable(SDNode *N, EVT SrcVT, EVT DestVT) const override
Return true if it's profitable to narrow operations of type SrcVT to DestVT.
bool isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize) const override
Returns true if the target can instruction select the specified FP immediate natively.
MachineInstr * EmitKCFICheck(MachineBasicBlock &MBB, MachineBasicBlock::instr_iterator &MBBI, const TargetInstrInfo *TII) const override
bool isLoadBitCastBeneficial(EVT LoadVT, EVT BitcastVT, const SelectionDAG &DAG, const MachineMemOperand &MMO) const override
Return true if the following transform is beneficial: fold (conv (load x)) -> (load (conv*)x) On arch...
unsigned getMaxSupportedInterleaveFactor() const override
Get the maximum supported factor for interleaved memory accesses.
bool lowerInterleavedLoad(Instruction *Load, Value *Mask, ArrayRef< ShuffleVectorInst * > Shuffles, ArrayRef< unsigned > Indices, unsigned Factor, const APInt &GapMask) const override
Lower interleaved load(s) into target specific instructions/intrinsics.
bool hasAndNotCompare(SDValue Y) const override
Return true if the target should transform: (X & Y) == Y ---> (~X & Y) == 0 (X & Y) !...
bool reduceSelectOfFPConstantLoads(EVT CmpOpVT) const override
Return true if it is profitable to convert a select of FP constants into a constant pool load whose a...
EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op, const AttributeList &FuncAttributes) const override
It returns EVT::Other if the type should be determined using generic target-independent logic.
StringRef getStackProbeSymbolName(const MachineFunction &MF) const override
Returns the name of the symbol used to emit stack probes or the empty string if not applicable.
bool hasBitTest(SDValue X, SDValue Y) const override
Return true if the target has a bit-test instruction: (X & (1 << Y)) ==/!= 0 This knowledge can be us...
bool allowTruncateForTailCall(Type *Ty1, Type *Ty2) const override
Return true if a truncation from FromTy to ToTy is permitted when deciding whether a call is in tail ...
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Certain targets such as MIPS require that some types such as vectors are always broken down into scal...
bool isShuffleMaskLegal(ArrayRef< int > Mask, EVT VT) const override
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations,...
bool useStackGuardXorFP() const override
If this function returns true, stack protection checks should XOR the frame pointer (or whichever poi...
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
Determine the number of bits in the operation that are sign bits.
bool shouldScalarizeBinop(SDValue) const override
Scalar ops always have equal or better analysis/performance/power than the vector equivalent,...
void markLibCallAttributes(MachineFunction *MF, unsigned CC, ArgListTy &Args) const override
void insertSSPDeclarations(Module &M, const LibcallLoweringInfo &Libcalls) const override
Inserts necessary declarations for SSP (stack protection) purpose.
bool isTruncateFree(Type *Ty1, Type *Ty2) const override
Return true if it's free to truncate a value of type Ty1 to type Ty2.
bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override
Return true if it is profitable to fold a pair of shifts into a mask.
bool decomposeMulByConstant(LLVMContext &Context, EVT VT, SDValue C) const override
Return true if it is profitable to transform an integer multiplication-by-constant into simpler opera...
bool areJTsAllowed(const Function *Fn) const override
Returns true if lowering to a jump table is allowed.
bool isCommutativeBinOp(unsigned Opcode) const override
Returns true if the opcode is a commutative binary operation.
bool isScalarFPTypeInSSEReg(EVT VT) const
Return true if the specified scalar FP type is computed in an SSE register, not on the X87 floating p...
MVT getPreferredSwitchConditionType(LLVMContext &Context, EVT ConditionVT) const override
Returns preferred type for switch condition.
SDValue visitMaskedLoad(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, MachineMemOperand *MMO, SDValue &NewLoad, SDValue Ptr, SDValue PassThru, SDValue Mask) const override
bool isFMAFasterThanFMulAndFAdd(const MachineFunction &MF, EVT VT) const override
Return true if an FMA operation is faster than a pair of fmul and fadd instructions.
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return true if EXTRACT_SUBVECTOR is cheap for this result type with this index.
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Certain targets require unusual breakdowns of certain types.
bool convertSetCCLogicToBitwiseLogic(EVT VT) const override
Use bitwise logic to make pairs of compares more efficient.
bool isVectorClearMaskLegal(ArrayRef< int > Mask, EVT VT) const override
Similar to isShuffleMaskLegal.
ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &Info, const char *Constraint) const override
Examine constraint string and operand type and determine a weight value.
bool isIntDivCheap(EVT VT, AttributeList Attr) const override
Return true if integer divide is usually cheaper than a sequence of several shifts,...
LegalizeTypeAction getPreferredVectorAction(MVT VT) const override
Customize the preferred legalization strategy for certain types.
bool shouldConvertPhiType(Type *From, Type *To) const override
Given a set in interconnected phis of type 'From' that are loaded/stored or bitcast to type 'To',...
bool hasStackProbeSymbol(const MachineFunction &MF) const override
Returns true if stack probing through a function call is requested.
bool isZExtFree(Type *Ty1, Type *Ty2) const override
Return true if any actual instruction that defines a value of type Ty1 implicit zero-extends the valu...
bool allowsMemoryAccess(LLVMContext &Context, const DataLayout &DL, EVT VT, unsigned AddrSpace, Align Alignment, MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *Fast=nullptr) const override
This function returns true if the memory access is aligned or if the target allows this specific unal...
bool isTargetCanonicalConstantNode(SDValue Op) const override
Returns true if the given Opc is considered a canonical constant for the target, which should not be ...
bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I=nullptr) const override
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
SDValue emitStackGuardXorFP(SelectionDAG &DAG, SDValue Val, const SDLoc &DL) const override
bool mergeStoresAfterLegalization(EVT MemVT) const override
Do not merge vector stores after legalization because that may conflict with x86-specific store split...
TargetLowering::AndOrSETCCFoldKind isDesirableToCombineLogicOpOfSETCC(const SDNode *LogicOp, const SDNode *SETCC0, const SDNode *SETCC1) const override
Return prefered fold type, Abs if this is a vector, AddAnd if its an integer, None otherwise.
bool shouldFoldMaskToVariableShiftPair(SDValue Y) const override
There are two ways to clear extreme bits (either low or high): Mask: x & (-1 << y) (the instcombine c...
bool shouldFoldSelectWithIdentityConstant(unsigned BinOpcode, EVT VT, unsigned SelectOpcode, SDValue X, SDValue Y) const override
Return true if pulling a binary operation into a select with an identity constant is profitable.
bool addressingModeSupportsTLS(const GlobalValue &GV) const override
Returns true if the targets addressing mode can target thread local storage (TLS).
SDValue getReturnAddressFrameIndex(SelectionDAG &DAG) const
bool targetShrinkDemandedConstant(SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts, TargetLoweringOpt &TLO) const override
Register getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
void getTgtMemIntrinsic(SmallVectorImpl< IntrinsicInfo > &Infos, const CallBase &I, MachineFunction &MF, unsigned Intrinsic) const override
Given an intrinsic, checks if on the target the intrinsic will need to map to a MemIntrinsicNode (tou...
SDValue expandIndirectJTBranch(const SDLoc &dl, SDValue Value, SDValue Addr, int JTI, SelectionDAG &DAG) const override
Expands target specific indirect branch for the case of JumpTable expansion.
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...
bool isBinOp(unsigned Opcode) const override
Add x86-specific opcodes to the default list.
bool isGuaranteedNotToBeUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, unsigned Depth) const override
Return true if this function can prove that Op is never poison and, if PoisonOnly is false,...
bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const override
Return true if the target has native support for the specified value type and it is 'desirable' to us...
SDValue unwrapAddress(SDValue N) const override
CondMergingParams getJumpConditionMergingParams(Instruction::BinaryOps Opc, const Value *Lhs, const Value *Rhs) const override
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the value type to use for ISD::SETCC.
X86TargetLowering(const X86TargetMachine &TM, const X86Subtarget &STI)
bool isTargetCanonicalSelect(SDNode *N) const override
Return true if the given select/vselect should be considered canonical and not be transformed.
bool isVectorLoadExtDesirable(SDValue) const override
Return true if folding a vector load into ExtVal (a sign, zero, or any extend node) is profitable.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering) const override
This method returns a target specific FastISel object, or null if the target does not support "fast" ...
const Constant * getTargetConstantFromLoad(LoadSDNode *LD) const override
This method returns the constant pool value that will be loaded by LD.
EVT getTypeToTransformTo(LLVMContext &Context, EVT VT) const override
For types supported by the target, this is an identity function.
bool canCreateUndefOrPoisonForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, bool PoisonOnly, bool ConsiderFlags, unsigned Depth) const override
Return true if Op can create undef or poison from non-undef & non-poison operands.
const MCExpr * LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI, const MachineBasicBlock *MBB, unsigned uid, MCContext &Ctx) const override
unsigned getStackProbeSize(const MachineFunction &MF) const
bool ShouldShrinkFPConstant(EVT VT) const override
If true, then instruction selection should seek to shrink the FP constant of the specified type to a ...
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
Replace the results of node with an illegal result type with new values built out of custom code.
bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override
Return if the target supports combining a chain like:
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
bool needsFixedCatchObjects() const override
bool isExtractVecEltCheap(EVT VT, unsigned Index) const override
Extract of a scalar FP value from index 0 of a vector is free.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ CXX_FAST_TLS
Used for access functions.
Definition CallingConv.h:72
@ Fast
Attempts to make calls as fast as possible (e.g.
Definition CallingConv.h:41
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition ISDOpcodes.h:41
@ INSERT_SUBVECTOR
INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector with VECTOR2 inserted into VECTOR1.
Definition ISDOpcodes.h:600
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
Definition ISDOpcodes.h:993
@ EXTRACT_SUBVECTOR
EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR.
Definition ISDOpcodes.h:614
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
LoadExtType
LoadExtType enum - This enum defines the three variants of LOADEXT (load with extension).
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
Define some predicates that are used for node matching.
RoundingMode
Current rounding mode is represented in bits 11:10 of FPSR.
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering)
bool mayFoldLoadIntoBroadcastFromMem(SDValue Op, MVT EltVT, const X86Subtarget &Subtarget, bool AssumeSingleUse=false)
Check if Op is a load operation that could be folded into a vector splat instruction as a memory oper...
bool isZeroNode(SDValue Elt)
Returns true if Elt is a constant zero or floating point constant +0.0.
bool mayFoldIntoZeroExtend(SDValue Op)
Check if Op is an operation that could be folded into a zero extend x86 instruction.
bool mayFoldIntoStore(SDValue Op)
Check if Op is a value that could be used to fold a store into some other x86 instruction as a memory...
bool isExtendedSwiftAsyncFrameSupported(const X86Subtarget &Subtarget, const MachineFunction &MF)
True if the target supports the extended frame for async Swift functions.
int getRoundingModeX86(unsigned RM)
Convert LLVM rounding mode to X86 rounding mode.
bool isCalleePop(CallingConv::ID CallingConv, bool is64Bit, bool IsVarArg, bool GuaranteeTCO)
Determines whether the callee is required to pop its own arguments.
bool mayFoldLoad(SDValue Op, const X86Subtarget &Subtarget, bool AssumeSingleUse=false, bool IgnoreAlignment=false)
Check if Op is a load operation that could be folded into some other x86 instruction as a memory oper...
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M, bool hasSymbolicDisplacement)
Returns true of the given offset can be fit into displacement field of the instruction.
bool isConstantSplat(SDValue Op, APInt &SplatVal, bool AllowPartialUndefs)
If Op is a constant whose elements are all the same constant or undefined, return true and return the...
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
@ Offset
Definition DWP.cpp:532
InstructionCost Cost
void createUnpackShuffleMask(EVT VT, SmallVectorImpl< int > &Mask, bool Lo, bool Unary)
Generate unpacklo/unpackhi shuffle mask.
void createSplat2ShuffleMask(MVT VT, SmallVectorImpl< int > &Mask, bool Lo)
Similar to unpacklo/unpackhi, but without the 128-bit lane limitation imposed by AVX and specific to ...
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Extended Value Type.
Definition ValueTypes.h:35
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Definition ValueTypes.h:155
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
Definition ValueTypes.h:61
bool isVector() const
Return true if this is a vector value type.
Definition ValueTypes.h:176
EVT getScalarType() const
If this is a vector type, return the element type, otherwise return this.
Definition ValueTypes.h:331
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
Definition ValueTypes.h:165
bool isInteger() const
Return true if this is an integer or a vector integer type.
Definition ValueTypes.h:160
This class contains a discriminated union of information about pointers in memory operands,...