LLVM 24.0.0git
LoongArchISelLowering.h
Go to the documentation of this file.
1//=- LoongArchISelLowering.h - LoongArch 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 LoongArch uses to lower LLVM code into
10// a selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHISELLOWERING_H
15#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHISELLOWERING_H
16
17#include "LoongArch.h"
22
23namespace llvm {
26 const LoongArchSubtarget &Subtarget;
27
28public:
29 explicit LoongArchTargetLowering(const TargetMachine &TM,
30 const LoongArchSubtarget &STI);
31
32 const LoongArchSubtarget &getSubtarget() const { return Subtarget; }
33
34 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
35
36 // Provide custom lowering hooks for some operations.
37 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
39 SelectionDAG &DAG) const override;
40
41 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
42
43 // Lower incoming arguments, copy physregs into vregs.
45 bool IsVarArg,
47 const SDLoc &DL, SelectionDAG &DAG,
48 SmallVectorImpl<SDValue> &InVals) const override;
50 bool IsVarArg,
52 LLVMContext &Context, const Type *RetTy) const override;
53 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
55 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
56 SelectionDAG &DAG) const override;
58 SmallVectorImpl<SDValue> &InVals) const override;
59 bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT,
60 const MachineFunction &MF) const override;
61 bool isCheapToSpeculateCttz(Type *Ty) const override;
62 bool isCheapToSpeculateCtlz(Type *Ty) const override;
63 bool hasAndNot(SDValue Y) const override;
65 shouldExpandAtomicRMWInIR(const AtomicRMWInst *AI) const override;
66 void emitExpandAtomicRMW(AtomicRMWInst *AI) const override;
67
69 Value *AlignedAddr, Value *Incr,
70 Value *Mask, Value *ShiftAmt,
71 AtomicOrdering Ord) const override;
72
74 EVT VT) const override;
76 shouldExpandAtomicCmpXchgInIR(const AtomicCmpXchgInst *CI) const override;
79 Value *AlignedAddr, Value *CmpVal,
80 Value *NewVal, Value *Mask,
81 AtomicOrdering Ord) const override;
82
84 const CallBase &I, MachineFunction &MF,
85 unsigned Intrinsic) const override;
86
88 EVT VT) const override;
89
92 const Constant *PersonalityFn) const override;
93
96 const Constant *PersonalityFn) const override;
97
98 bool isFsqrtCheap(SDValue Operand, SelectionDAG &DAG) const override {
99 return true;
100 }
101
103 int &RefinementSteps, bool &UseOneConstNR,
104 bool Reciprocal) const override;
105
107 int &RefinementSteps) const override;
108
110 return ISD::SIGN_EXTEND;
111 }
112
114
115 Register getRegisterByName(const char *RegName, LLT VT,
116 const MachineFunction &MF) const override;
117 bool mayBeEmittedAsTailCall(const CallInst *CI) const override;
118
119 bool decomposeMulByConstant(LLVMContext &Context, EVT VT,
120 SDValue C) const override;
121
122 bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override;
123
124 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM, Type *Ty,
125 unsigned AS,
126 Instruction *I = nullptr) const override;
127
128 bool isLegalICmpImmediate(int64_t Imm) const override;
129 bool isLegalAddImmediate(int64_t Imm) const override;
130 bool isZExtFree(SDValue Val, EVT VT2) const override;
131 bool isSExtCheaperThanZExt(EVT SrcVT, EVT DstVT) const override;
132 bool signExtendConstant(const ConstantInt *CI) const override;
133
134 bool hasAndNotCompare(SDValue Y) const override;
135
136 bool convertSelectOfConstantsToMath(EVT VT) const override { return true; }
137
139 EVT VT, unsigned AddrSpace = 0, Align Alignment = Align(1),
141 unsigned *Fast = nullptr) const override;
142
143 bool isShuffleMaskLegal(ArrayRef<int> Mask, EVT VT) const override {
144 if (!VT.isSimple())
145 return false;
146
147 // Not for i1 vectors
148 if (VT.getSimpleVT().getScalarType() == MVT::i1)
149 return false;
150
151 return isTypeLegal(VT.getSimpleVT());
152 }
153 bool shouldConsiderGEPOffsetSplit() const override { return true; }
154 bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override;
155 bool shouldExtendTypeInLibCall(EVT Type) const override;
156
157 bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize,
158 Align &PrefAlign) const override;
159
160 bool isFPImmVLDILegal(const APFloat &Imm, EVT VT) const;
161 LegalizeTypeAction getPreferredVectorAction(MVT VT) const override;
162
164 const APInt &DemandedElts,
165 const SelectionDAG &DAG,
166 unsigned Depth) const override;
168 const APInt &DemandedElts,
170 TargetLoweringOpt &TLO,
171 unsigned Depth) const override;
172
173 bool shouldScalarizeBinop(SDValue VecOp) const override;
175 unsigned Index) const override;
176 bool isExtractVecEltCheap(EVT VT, unsigned Index) const override;
177
178 /// Check if a constant splat can be generated using [x]vldi, where imm[12]
179 /// is 1.
180 std::pair<bool, uint64_t>
181 isImmVLDILegalForMode1(const APInt &SplatValue,
182 const unsigned SplatBitSize) const;
183
184 /// True if stack clash protection is enabled for this function.
185 bool hasInlineStackProbe(const MachineFunction &MF) const override;
186
187 unsigned getStackProbeSize(const MachineFunction &MF, Align StackAlign) const;
188
190 MachineBasicBlock *MBB) const;
191
192private:
193 /// Target-specific function used to lower LoongArch calling conventions.
194 typedef bool LoongArchCCAssignFn(const DataLayout &DL, LoongArchABI::ABI ABI,
195 unsigned ValNo, MVT ValVT,
196 CCValAssign::LocInfo LocInfo,
197 ISD::ArgFlagsTy ArgFlags, CCState &State,
198 bool IsRet, Type *OrigTy);
199
200 void analyzeInputArgs(MachineFunction &MF, CCState &CCInfo,
201 const SmallVectorImpl<ISD::InputArg> &Ins, bool IsRet,
202 LoongArchCCAssignFn Fn) const;
203 void analyzeOutputArgs(MachineFunction &MF, CCState &CCInfo,
205 bool IsRet, CallLoweringInfo *CLI,
206 LoongArchCCAssignFn Fn) const;
207
208 template <class NodeTy>
209 SDValue getAddr(NodeTy *N, SelectionDAG &DAG, CodeModel::Model M,
210 bool IsLocal = true) const;
211 SDValue getStaticTLSAddr(GlobalAddressSDNode *N, SelectionDAG &DAG,
212 unsigned Opc, bool UseGOT, bool Large = false) const;
213 SDValue getDynamicTLSAddr(GlobalAddressSDNode *N, SelectionDAG &DAG,
214 unsigned Opc, bool Large = false) const;
215 SDValue getTLSDescAddr(GlobalAddressSDNode *N, SelectionDAG &DAG,
216 unsigned Opc, bool Large = false) const;
217 SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
218 SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
219 SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
220 SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
221 SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG &DAG) const;
222 SDValue lowerShiftRightParts(SDValue Op, SelectionDAG &DAG, bool IsSRA) const;
223
225 EmitInstrWithCustomInserter(MachineInstr &MI,
226 MachineBasicBlock *BB) const override;
227 SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG &DAG) const;
228 SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
229 SDValue lowerEH_DWARF_CFA(SDValue Op, SelectionDAG &DAG) const;
230 SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const;
231 SDValue lowerFP_TO_UINT(SDValue Op, SelectionDAG &DAG) const;
232 SDValue lowerBITCAST(SDValue Op, SelectionDAG &DAG) const;
233 SDValue lowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
234 SDValue lowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG) const;
235 SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
236 SDValue lowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const;
237 SDValue lowerINTRINSIC_W_CHAIN(SDValue Op, SelectionDAG &DAG) const;
238 SDValue lowerINTRINSIC_VOID(SDValue Op, SelectionDAG &DAG) const;
241 SDValue lowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
242 SDValue lowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
243 SDValue lowerWRITE_REGISTER(SDValue Op, SelectionDAG &DAG) const;
244 SDValue lowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
245 SDValue lowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const;
247 SDValue lowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const;
249 SDValue lowerBITREVERSE(SDValue Op, SelectionDAG &DAG) const;
250 SDValue lowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const;
251 SDValue lowerPREFETCH(SDValue Op, SelectionDAG &DAG) const;
253 SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
254 SDValue lowerFP_TO_FP16(SDValue Op, SelectionDAG &DAG) const;
255 SDValue lowerFP16_TO_FP(SDValue Op, SelectionDAG &DAG) const;
256 SDValue lowerFP_TO_BF16(SDValue Op, SelectionDAG &DAG) const;
257 SDValue lowerBF16_TO_FP(SDValue Op, SelectionDAG &DAG) const;
258 SDValue lowerVECREDUCE_ADD(SDValue Op, SelectionDAG &DAG) const;
259 SDValue lowerVECREDUCE(SDValue Op, SelectionDAG &DAG) const;
260 SDValue lowerConstantFP(SDValue Op, SelectionDAG &DAG) const;
261 SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
262 SDValue lowerRotate(SDValue Op, SelectionDAG &DAG) const;
263 SDValue lowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;
264 SDValue lowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;
265 SDValue lowerSIGN_EXTEND_VECTOR_INREG(SDValue Op, SelectionDAG &DAG) const;
266 SDValue lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
267 SDValue lowerANY_EXTEND(SDValue Op, SelectionDAG &DAG) const;
268
269 bool isFPImmLegal(const APFloat &Imm, EVT VT,
270 bool ForCodeSize) const override;
271
272 bool shouldInsertFencesForAtomic(const Instruction *I) const override;
273
274 ConstraintType getConstraintType(StringRef Constraint) const override;
275
277 getInlineAsmMemConstraint(StringRef ConstraintCode) const override;
278
279 std::pair<unsigned, const TargetRegisterClass *>
280 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
281 StringRef Constraint, MVT VT) const override;
282
283 void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,
284 std::vector<SDValue> &Ops,
285 SelectionDAG &DAG) const override;
286
287 bool isEligibleForTailCallOptimization(
288 CCState &CCInfo, CallLoweringInfo &CLI, MachineFunction &MF,
289 const SmallVectorImpl<CCValAssign> &ArgLocs) const;
290
291 bool
292 splitValueIntoRegisterParts(SelectionDAG &DAG, const SDLoc &DL, SDValue Val,
293 SDValue *Parts, unsigned NumParts, MVT PartVT,
294 std::optional<CallingConv::ID> CC) const override;
295
296 SDValue
297 joinRegisterPartsIntoValue(SelectionDAG &DAG, const SDLoc &DL,
298 const SDValue *Parts, unsigned NumParts,
299 MVT PartVT, EVT ValueVT,
300 std::optional<CallingConv::ID> CC) const override;
301
302 /// Return the register type for a given MVT, ensuring vectors are treated
303 /// as a series of gpr sized integers.
304 MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC,
305 EVT VT) const override;
306
307 /// Return the number of registers for a given MVT, ensuring vectors are
308 /// treated as a series of gpr sized integers.
309 unsigned getNumRegistersForCallingConv(LLVMContext &Context,
311 EVT VT) const override;
312};
313
314} // end namespace llvm
315
316#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHISELLOWERING_H
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
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 SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG)
static SDValue lowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG, const RISCVSubtarget &Subtarget)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
This file describes how to lower LLVM code to machine code.
static SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG, const VETargetLowering &TLI, const VESubtarget *Subtarget)
static SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG, const VETargetLowering &TLI, const VESubtarget *Subtarget)
static SDValue lowerVECTOR_SHUFFLE(SDValue Op, const X86Subtarget &Subtarget, SelectionDAG &DAG)
Top-level lowering for x86 vector shuffles.
Class for arbitrary precision integers.
Definition APInt.h:78
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
CCState - This class holds information needed while lowering arguments and return values.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
This is the shared class of boolean and integer constants.
Definition Constants.h:87
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
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
bool isShuffleMaskLegal(ArrayRef< int > Mask, EVT VT) const override
Targets can use this to indicate that they only support some VECTOR_SHUFFLE operations,...
bool isUsedByReturnOnly(SDNode *N, SDValue &Chain) const override
Return true if result of the specified node is used by a return node only.
bool convertSelectOfConstantsToMath(EVT VT) const override
Return true if a select of constants (select Cond, C1, C2) should be transformed into simple math ops...
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...
Register getExceptionPointerRegister(ExceptionHandling EH, const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
const LoongArchSubtarget & getSubtarget() const
SDValue getSqrtEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled, int &RefinementSteps, bool &UseOneConstNR, bool Reciprocal) const override
Hooks for building estimates in place of slower divisions and square roots.
bool isLegalICmpImmediate(int64_t Imm) const override
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
TargetLowering::AtomicExpansionKind shouldExpandAtomicCmpXchgInIR(const AtomicCmpXchgInst *CI) const override
Returns how the given atomic cmpxchg should be expanded by the IR-level AtomicExpand pass.
Value * emitMaskedAtomicCmpXchgIntrinsic(IRBuilderBase &Builder, AtomicCmpXchgInst *CI, Value *AlignedAddr, Value *CmpVal, Value *NewVal, Value *Mask, AtomicOrdering Ord) const override
Perform a masked cmpxchg using a target-specific intrinsic.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
Return the ValueType of the result of SETCC operations.
std::pair< bool, uint64_t > isImmVLDILegalForMode1(const APInt &SplatValue, const unsigned SplatBitSize) const
Check if a constant splat can be generated using [x]vldi, where imm[12] is 1.
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...
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 hasInlineStackProbe(const MachineFunction &MF) const override
True if stack clash protection is enabled for this function.
SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
Register getExceptionSelectorRegister(ExceptionHandling EH, const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
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 isExtractVecEltCheap(EVT VT, unsigned Index) const override
Return true if extraction of a scalar element from the given vector type at the given index is cheap.
LegalizeTypeAction getPreferredVectorAction(MVT VT) const override
Return the preferred vector type legalization action.
bool isSExtCheaperThanZExt(EVT SrcVT, EVT DstVT) const override
Return true if sign-extension from FromTy to ToTy is cheaper than zero-extension.
bool allowsMisalignedMemoryAccesses(EVT VT, unsigned AddrSpace=0, Align Alignment=Align(1), MachineMemOperand::Flags Flags=MachineMemOperand::MONone, unsigned *Fast=nullptr) const override
Determine if the target supports unaligned memory accesses.
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize, Align &PrefAlign) const override
Return true if the pointer arguments to CI should be aligned by aligning the object whose address is ...
Value * emitMaskedAtomicRMWIntrinsic(IRBuilderBase &Builder, AtomicRMWInst *AI, Value *AlignedAddr, Value *Incr, Value *Mask, Value *ShiftAmt, AtomicOrdering Ord) const override
Perform a masked atomicrmw using a target-specific intrinsic.
bool isZExtFree(SDValue Val, EVT VT2) const override
Return true if zero-extending the specific node Val to type VT2 is free (either because it's implicit...
void computeKnownBitsForTargetNode(const SDValue Op, KnownBits &Known, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
Determine which of the bits specified in Mask are known to be either zero or one and return them in t...
bool signExtendConstant(const ConstantInt *CI) const override
Return true if this constant should be sign extended when promoting to a larger type.
ExtractSubvectorCost getExtractSubvectorCost(EVT ResVT, EVT SrcVT, unsigned Index) const override
Return the cost of extracting a subvector of type ResVT from a vector of type SrcVT,...
ISD::NodeType getExtendForAtomicOps() const override
Returns how the platform's atomic operations are extended (ZERO_EXTEND, SIGN_EXTEND,...
TargetLowering::AtomicExpansionKind shouldExpandAtomicRMWInIR(const AtomicRMWInst *AI) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
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 isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
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...
MachineBasicBlock * emitDynamicProbedAlloc(MachineInstr &MI, MachineBasicBlock *MBB) const
bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override
Returns true if arguments should be sign-extended in lib calls.
bool shouldScalarizeBinop(SDValue VecOp) const override
Try to convert an extract element of a vector binary operation into an extract element followed by a ...
bool isFPImmVLDILegal(const APFloat &Imm, EVT VT) const
bool shouldExtendTypeInLibCall(EVT Type) const override
Returns true if arguments should be extended in lib calls.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
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 shouldConsiderGEPOffsetSplit() const override
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
unsigned getStackProbeSize(const MachineFunction &MF, Align StackAlign) const
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
This callback is invoked when a node result type is illegal for the target, and the operation was reg...
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.
void emitExpandAtomicRMW(AtomicRMWInst *AI) const override
Perform a atomicrmw expansion using a target-specific way.
ISD::NodeType getExtendForAtomicCmpSwapArg() const override
Returns how the platform's atomic compare and swap expects its comparison value to be extended (ZERO_...
bool isFsqrtCheap(SDValue Operand, SelectionDAG &DAG) const override
Return true if SQRT(X) shouldn't be replaced with X*RSQRT(X).
LoongArchTargetLowering(const TargetMachine &TM, const LoongArchSubtarget &STI)
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const override
This hook must be implemented to lower outgoing return values, described by the Outs array,...
bool hasAndNotCompare(SDValue Y) const override
Return true if the target should transform: (X & Y) == Y ---> (~X & Y) == 0 (X & Y) !...
SDValue getRecipEstimate(SDValue Operand, SelectionDAG &DAG, int Enabled, int &RefinementSteps) const override
Return a reciprocal estimate value for the input operand.
bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT, const MachineFunction &MF) const override
Returns if it's reasonable to merge stores to MemVT size.
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context, const Type *RetTy) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower the incoming (formal) arguments, described by the Ins array,...
bool mayBeEmittedAsTailCall(const CallInst *CI) const override
Return true if the target may be able emit the call instruction as a tail call.
Machine Value Type.
MVT getScalarType() const
If this is a vector, return the element type, otherwise return this.
Representation of each machine instruction.
Flags
Flags values. These may be or'd together.
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.
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 class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
bool isTypeLegal(EVT VT) const
Return true if the target has native support for the specified value type.
ExtractSubvectorCost
Enum that specifies how expensive lowering an EXTRACT_SUBVECTOR is.
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
TargetLowering(const TargetLowering &)=delete
Primary interface to the complete machine description for the target machine.
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:46
LLVM Value Representation.
Definition Value.h:75
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition ISDOpcodes.h:41
@ SIGN_EXTEND
Conversion operators.
Definition ISDOpcodes.h:854
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
This is an optimization pass for GlobalISel generic memory operations.
@ Known
Known to have no common set bits.
AtomicOrdering
Atomic ordering for LLVM's memory model.
DWARFExpression::Operation Op
ExceptionHandling
Definition CodeGen.h:54
@ Enabled
Convert any .debug_str_offsets tables to DWARF64 if needed.
Definition DWP.h:31
#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 isSimple() const
Test if the given EVT is simple (as opposed to being extended).
Definition ValueTypes.h:145
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
Definition ValueTypes.h:339
This structure contains all information that is necessary for lowering calls.