LLVM 24.0.0git
LoongArchISelDAGToDAG.cpp
Go to the documentation of this file.
1//=- LoongArchISelDAGToDAG.cpp - A dag to dag inst selector for LoongArch -===//
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 an instruction selector for the LoongArch target.
10//
11//===----------------------------------------------------------------------===//
12
19
20using namespace llvm;
21
22#define DEBUG_TYPE "loongarch-isel"
23#define PASS_NAME "LoongArch DAG->DAG Pattern Instruction Selection"
24
26
31
33 false)
34
36 // If we have a custom node, we have already selected.
37 if (Node->isMachineOpcode()) {
38 LLVM_DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << "\n");
39 Node->setNodeId(-1);
40 return;
41 }
42
43 // Instruction Selection not handled by the auto-generated tablegen selection
44 // should be handled here.
45 unsigned Opcode = Node->getOpcode();
46 MVT GRLenVT = Subtarget->getGRLenVT();
47 SDLoc DL(Node);
48 MVT VT = Node->getSimpleValueType(0);
49
50 switch (Opcode) {
51 default:
52 break;
53 case ISD::Constant: {
54 int64_t Imm = cast<ConstantSDNode>(Node)->getSExtValue();
55 if (Imm == 0 && VT == GRLenVT) {
56 SDValue New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), DL,
57 LoongArch::R0, GRLenVT);
58 ReplaceNode(Node, New.getNode());
59 return;
60 }
61 SDNode *Result = nullptr;
62 SDValue SrcReg = CurDAG->getRegister(LoongArch::R0, GRLenVT);
63 // The instructions in the sequence are handled here.
65 SDValue SDImm = CurDAG->getSignedTargetConstant(Inst.Imm, DL, GRLenVT);
66 switch (Inst.Opc) {
67 case LoongArch::LU12I_W:
68 Result = CurDAG->getMachineNode(Inst.Opc, DL, GRLenVT, SDImm);
69 break;
70 case LoongArch::ADDI_W:
71 case LoongArch::ORI:
72 case LoongArch::LU32I_D:
73 case LoongArch::LU52I_D:
74 case LoongArch::SLLI_D:
75 Result = CurDAG->getMachineNode(Inst.Opc, DL, GRLenVT, SrcReg, SDImm);
76 break;
77 case LoongArch::BSTRINS_D:
78 Result = CurDAG->getMachineNode(
79 Inst.Opc, DL, GRLenVT,
80 {SrcReg, SrcReg,
81 CurDAG->getSignedTargetConstant(Inst.Imm >> 32, DL, GRLenVT),
82 CurDAG->getTargetConstant(Inst.Imm & 0xFF, DL, GRLenVT)});
83 break;
84 default:
85 llvm_unreachable("unexpected opcode generated by LoongArchMatInt");
86 }
87 SrcReg = SDValue(Result, 0);
88 }
89
90 ReplaceNode(Node, Result);
91 return;
92 }
93 case ISD::FrameIndex: {
94 SDValue Imm = CurDAG->getTargetConstant(0, DL, GRLenVT);
95 int FI = cast<FrameIndexSDNode>(Node)->getIndex();
96 SDValue TFI = CurDAG->getTargetFrameIndex(FI, VT);
97 unsigned ADDIOp =
98 Subtarget->is64Bit() ? LoongArch::ADDI_D : LoongArch::ADDI_W;
99 ReplaceNode(Node, CurDAG->getMachineNode(ADDIOp, DL, VT, TFI, Imm));
100 return;
101 }
102 case ISD::BITCAST: {
103 if (VT.is128BitVector() || VT.is256BitVector()) {
104 ReplaceUses(SDValue(Node, 0), Node->getOperand(0));
105 CurDAG->RemoveDeadNode(Node);
106 return;
107 }
108 break;
109 }
110 case ISD::BUILD_VECTOR: {
111 // Select appropriate [x]vrepli.[bhwd] instructions for constant splats of
112 // 128/256-bit when LSX/LASX is enabled.
114 APInt SplatValue, SplatUndef;
115 unsigned SplatBitSize;
116 bool HasAnyUndefs;
117 unsigned Op = 0;
118 EVT ResTy = BVN->getValueType(0);
119 bool Is128Vec = BVN->getValueType(0).is128BitVector();
120 bool Is256Vec = BVN->getValueType(0).is256BitVector();
121 SDNode *Res;
122
123 if (!Subtarget->hasExtLSX() || (!Is128Vec && !Is256Vec))
124 break;
125 if (!BVN->isConstantSplat(SplatValue, SplatUndef, SplatBitSize,
126 HasAnyUndefs, 8))
127 break;
128
129 // If we have a signed 10 bit integer, we can splat it directly.
130 if (SplatValue.isSignedIntN(10)) {
131 switch (SplatBitSize) {
132 default:
133 break;
134 case 8:
135 Op = Is256Vec ? LoongArch::PseudoXVREPLI_B : LoongArch::PseudoVREPLI_B;
136 break;
137 case 16:
138 Op = Is256Vec ? LoongArch::PseudoXVREPLI_H : LoongArch::PseudoVREPLI_H;
139 break;
140 case 32:
141 Op = Is256Vec ? LoongArch::PseudoXVREPLI_W : LoongArch::PseudoVREPLI_W;
142 break;
143 case 64:
144 Op = Is256Vec ? LoongArch::PseudoXVREPLI_D : LoongArch::PseudoVREPLI_D;
145 break;
146 }
147
148 EVT EleType = ResTy.getVectorElementType();
149 APInt Val = SplatValue.sextOrTrunc(EleType.getSizeInBits());
150 SDValue Imm = CurDAG->getTargetConstant(Val, DL, EleType);
151 Res = CurDAG->getMachineNode(Op, DL, ResTy, Imm);
152 ReplaceNode(Node, Res);
153 return;
154 }
155
156 // Select appropriate [x]vldi instructions for some special constant splats,
157 // where the immediate value `imm[12] == 1` for used [x]vldi instructions.
158 const auto &TLI =
159 *static_cast<const LoongArchTargetLowering *>(getTargetLowering());
160 std::pair<bool, uint64_t> ConvertVLDI =
161 TLI.isImmVLDILegalForMode1(SplatValue, SplatBitSize);
162 if (ConvertVLDI.first) {
163 Op = Is256Vec ? LoongArch::XVLDI : LoongArch::VLDI;
164 SDValue Imm = CurDAG->getSignedTargetConstant(
165 SignExtend32<13>(ConvertVLDI.second), DL, MVT::i32);
166 Res = CurDAG->getMachineNode(Op, DL, ResTy, Imm);
167 ReplaceNode(Node, Res);
168 return;
169 }
170 break;
171 }
172 }
173
174 // Select the default instruction.
175 SelectCode(Node);
176}
177
179 const SDValue &Op, InlineAsm::ConstraintCode ConstraintID,
180 std::vector<SDValue> &OutOps) {
181 SDValue Base = Op;
183 CurDAG->getTargetConstant(0, SDLoc(Op), Subtarget->getGRLenVT());
184 switch (ConstraintID) {
185 default:
186 llvm_unreachable("unexpected asm memory constraint");
187 // Reg+Reg addressing.
189 Base = Op.getOperand(0);
190 Offset = Op.getOperand(1);
191 break;
192 // Reg+simm12 addressing.
194 if (CurDAG->isBaseWithConstantOffset(Op)) {
195 ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Op.getOperand(1));
196 if (isIntN(12, CN->getSExtValue())) {
197 Base = Op.getOperand(0);
198 Offset = CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Op),
199 Op.getValueType());
200 }
201 }
202 break;
203 // Reg+0 addressing.
205 break;
206 // Reg+(simm14<<2) addressing.
208 if (CurDAG->isBaseWithConstantOffset(Op)) {
209 ConstantSDNode *CN = dyn_cast<ConstantSDNode>(Op.getOperand(1));
210 if (isIntN(16, CN->getSExtValue()) &&
211 isAligned(Align(4ULL), CN->getZExtValue())) {
212 Base = Op.getOperand(0);
213 Offset = CurDAG->getTargetConstant(CN->getZExtValue(), SDLoc(Op),
214 Op.getValueType());
215 }
216 }
217 break;
218 }
219 OutOps.push_back(Base);
220 OutOps.push_back(Offset);
221 return false;
222}
223
225 // If this is FrameIndex, select it directly. Otherwise just let it get
226 // selected to a register independently.
227 if (auto *FIN = dyn_cast<FrameIndexSDNode>(Addr))
228 Base =
229 CurDAG->getTargetFrameIndex(FIN->getIndex(), Subtarget->getGRLenVT());
230 else
231 Base = Addr;
232 return true;
233}
234
235// Fold constant addresses.
237 SDValue &Offset) {
238 SDLoc DL(Addr);
239 MVT VT = Addr.getSimpleValueType();
240
241 if (!isa<ConstantSDNode>(Addr))
242 return false;
243
244 // If the constant is a simm12, we can fold the whole constant and use R0 as
245 // the base.
246 int64_t CVal = cast<ConstantSDNode>(Addr)->getSExtValue();
247 if (!isInt<12>(CVal))
248 return false;
249 Base = CurDAG->getRegister(LoongArch::R0, VT);
250 Offset = CurDAG->getSignedTargetConstant(SignExtend64<12>(CVal), DL, VT);
251 return true;
252}
253
255 // If this is FrameIndex, don't select it.
256 if (isa<FrameIndexSDNode>(Addr))
257 return false;
258 Base = Addr;
259 return true;
260}
261
263 SDValue &Offset) {
264 SDLoc DL(Addr);
265 MVT VT = Addr.getSimpleValueType();
266
267 // The address is the result of an ADD. Here we only consider reg+simm12.
268 if (CurDAG->isBaseWithConstantOffset(Addr)) {
269 int64_t Imm = cast<ConstantSDNode>(Addr.getOperand(1))->getSExtValue();
270 if (isInt<12>(Imm)) {
271 Base = Addr.getOperand(0);
272 Offset = CurDAG->getSignedTargetConstant(SignExtend64<12>(Imm), DL, VT);
273 return true;
274 }
275 }
276
277 // Otherwise, we assume Addr as the base address and use constant 0 as the
278 // offset.
279 Base = Addr;
280 Offset = CurDAG->getTargetConstant(0, DL, VT);
281 return true;
282}
283
285 SDValue &ShAmt) {
286 // Shift instructions on LoongArch only read the lower 5 or 6 bits of the
287 // shift amount. If there is an AND on the shift amount, we can bypass it if
288 // it doesn't affect any of those bits.
289 if (N.getOpcode() == ISD::AND && isa<ConstantSDNode>(N.getOperand(1))) {
290 const APInt &AndMask = N->getConstantOperandAPInt(1);
291
292 // Since the max shift amount is a power of 2 we can subtract 1 to make a
293 // mask that covers the bits needed to represent all shift amounts.
294 assert(isPowerOf2_32(ShiftWidth) && "Unexpected max shift amount!");
295 APInt ShMask(AndMask.getBitWidth(), ShiftWidth - 1);
296
297 if (ShMask.isSubsetOf(AndMask)) {
298 ShAmt = N.getOperand(0);
299 return true;
300 }
301
302 // SimplifyDemandedBits may have optimized the mask so try restoring any
303 // bits that are known zero.
304 KnownBits Known = CurDAG->computeKnownBits(N->getOperand(0));
305 if (ShMask.isSubsetOf(AndMask | Known.Zero)) {
306 ShAmt = N.getOperand(0);
307 return true;
308 }
309 } else if (N.getOpcode() == LoongArchISD::BSTRPICK) {
310 // Similar to the above AND, if there is a BSTRPICK on the shift amount, we
311 // can bypass it.
312 assert(isPowerOf2_32(ShiftWidth) && "Unexpected max shift amount!");
313 assert(isa<ConstantSDNode>(N.getOperand(1)) && "Illegal msb operand!");
314 assert(isa<ConstantSDNode>(N.getOperand(2)) && "Illegal lsb operand!");
315 uint64_t msb = N.getConstantOperandVal(1), lsb = N.getConstantOperandVal(2);
316 if (lsb == 0 && Log2_32(ShiftWidth) <= msb + 1) {
317 ShAmt = N.getOperand(0);
318 return true;
319 }
320 } else if (N.getOpcode() == ISD::SUB &&
321 isa<ConstantSDNode>(N.getOperand(0))) {
322 uint64_t Imm = N.getConstantOperandVal(0);
323 // If we are shifting by N-X where N == 0 mod Size, then just shift by -X to
324 // generate a NEG instead of a SUB of a constant.
325 if (Imm != 0 && Imm % ShiftWidth == 0) {
326 SDLoc DL(N);
327 EVT VT = N.getValueType();
328 SDValue Zero =
329 CurDAG->getCopyFromReg(CurDAG->getEntryNode(), DL, LoongArch::R0, VT);
330 unsigned NegOpc = VT == MVT::i64 ? LoongArch::SUB_D : LoongArch::SUB_W;
331 MachineSDNode *Neg =
332 CurDAG->getMachineNode(NegOpc, DL, VT, Zero, N.getOperand(1));
333 ShAmt = SDValue(Neg, 0);
334 return true;
335 }
336 }
337
338 ShAmt = N;
339 return true;
340}
341
343 if (N.getOpcode() == ISD::SIGN_EXTEND_INREG &&
344 cast<VTSDNode>(N.getOperand(1))->getVT() == MVT::i32) {
345 Val = N.getOperand(0);
346 return true;
347 }
348 if (N.getOpcode() == LoongArchISD::BSTRPICK &&
349 N.getConstantOperandVal(1) < UINT64_C(0X1F) &&
350 N.getConstantOperandVal(2) == UINT64_C(0)) {
351 Val = N;
352 return true;
353 }
354 MVT VT = N.getSimpleValueType();
355 if (CurDAG->ComputeNumSignBits(N) > (VT.getSizeInBits() - 32)) {
356 Val = N;
357 return true;
358 }
359
360 return false;
361}
362
364 if (N.getOpcode() == ISD::AND) {
365 auto *C = dyn_cast<ConstantSDNode>(N.getOperand(1));
366 if (C && C->getZExtValue() == UINT64_C(0xFFFFFFFF)) {
367 Val = N.getOperand(0);
368 return true;
369 }
370 }
371 MVT VT = N.getSimpleValueType();
373 if (CurDAG->MaskedValueIsZero(N, Mask)) {
374 Val = N;
375 return true;
376 }
377
378 return false;
379}
380
382 unsigned MinSizeInBits) const {
383 if (!Subtarget->hasExtLSX())
384 return false;
385
387
388 if (!Node)
389 return false;
390
391 APInt SplatValue, SplatUndef;
392 unsigned SplatBitSize;
393 bool HasAnyUndefs;
394
395 if (!Node->isConstantSplat(SplatValue, SplatUndef, SplatBitSize, HasAnyUndefs,
396 MinSizeInBits, /*IsBigEndian=*/false))
397 return false;
398
399 Imm = SplatValue;
400
401 return true;
402}
403
404template <unsigned ImmBitSize, unsigned EltBitSize, bool IsSigned>
406 APInt ImmValue;
407 EVT EltTy = N->getValueType(0).getVectorElementType();
408 unsigned EltBitWidth = EltBitSize ? EltBitSize : EltTy.getSizeInBits();
409
410 if (N->getOpcode() == ISD::BITCAST)
411 N = N->getOperand(0);
412
413 if (selectVSplat(N.getNode(), ImmValue, EltBitWidth) &&
414 ImmValue.getBitWidth() == EltBitWidth) {
415 if (IsSigned && ImmValue.isSignedIntN(ImmBitSize)) {
416 SplatVal = CurDAG->getSignedTargetConstant(
417 ImmValue.getSExtValue(), SDLoc(N), Subtarget->getGRLenVT());
418 return true;
419 }
420 if (!IsSigned && ImmValue.isIntN(ImmBitSize)) {
421 SplatVal = CurDAG->getTargetConstant(ImmValue.getZExtValue(), SDLoc(N),
422 Subtarget->getGRLenVT());
423 return true;
424 }
425 }
426
427 return false;
428}
429
430template <unsigned ImmBitSize>
432 SDValue &SplatVal) const {
433 APInt ImmValue;
434 EVT EltTy = N->getValueType(0).getVectorElementType();
435
436 if (N->getOpcode() == ISD::BITCAST)
437 N = N->getOperand(0);
438
439 if (selectVSplat(N.getNode(), ImmValue, EltTy.getSizeInBits()) &&
440 ImmValue.getBitWidth() == EltTy.getSizeInBits()) {
441 if ((-ImmValue).isIntN(ImmBitSize)) {
442 SplatVal = CurDAG->getTargetConstant(-ImmValue.getSExtValue(), SDLoc(N),
443 Subtarget->getGRLenVT());
444 return true;
445 }
446 }
447
448 return false;
449}
450
451template <unsigned EltBitSize>
453 SDValue &SplatImm) const {
454 APInt ImmValue;
455 EVT EltTy = N->getValueType(0).getVectorElementType();
456 unsigned EltBitWidth = EltBitSize ? EltBitSize : EltTy.getSizeInBits();
457
458 if (N->getOpcode() == ISD::BITCAST)
459 N = N->getOperand(0);
460
461 if (selectVSplat(N.getNode(), ImmValue, EltBitWidth) &&
462 ImmValue.getBitWidth() == EltBitWidth) {
463 int32_t Log2 = (~ImmValue).exactLogBase2();
464
465 if (Log2 != -1) {
466 SplatImm = CurDAG->getSignedTargetConstant(Log2, SDLoc(N), EltTy);
467 return true;
468 }
469 }
470
471 return false;
472}
473
474template <unsigned EltBitSize>
476 SDValue &SplatImm) const {
477 APInt ImmValue;
478 EVT EltTy = N->getValueType(0).getVectorElementType();
479 unsigned EltBitWidth = EltBitSize ? EltBitSize : EltTy.getSizeInBits();
480
481 if (N->getOpcode() == ISD::BITCAST)
482 N = N->getOperand(0);
483
484 if (selectVSplat(N.getNode(), ImmValue, EltBitWidth) &&
485 ImmValue.getBitWidth() == EltBitWidth) {
486 int32_t Log2 = ImmValue.exactLogBase2();
487
488 if (Log2 != -1) {
489 SplatImm = CurDAG->getSignedTargetConstant(Log2, SDLoc(N), EltTy);
490 return true;
491 }
492 }
493
494 return false;
495}
496
497// This pass converts a legalized DAG into a LoongArch-specific DAG, ready
498// for instruction scheduling.
return SDValue()
const AArch64Subtarget & Subtarget
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
uint64_t Imm
AMDGPU Register Bank Select
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define DEBUG_TYPE
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
#define PASS_NAME
Class for arbitrary precision integers.
Definition APInt.h:78
uint64_t getZExtValue() const
Get zero extended value.
Definition APInt.h:1560
unsigned getBitWidth() const
Return the number of bits in the APInt.
Definition APInt.h:1508
int32_t exactLogBase2() const
Definition APInt.h:1803
bool isSignedIntN(unsigned N) const
Check if this APInt has an N-bits signed integer value.
Definition APInt.h:431
LLVM_ABI APInt sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
Definition APInt.cpp:1086
bool isSubsetOf(const APInt &RHS) const
This operation checks that all bits set in this APInt are also set in RHS.
Definition APInt.h:1261
static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet)
Constructs an APInt value that has the top hiBitsSet bits set.
Definition APInt.h:292
bool isIntN(unsigned N) const
Check if this APInt has an N-bits unsigned integer value.
Definition APInt.h:428
int64_t getSExtValue() const
Get sign extended value.
Definition APInt.h:1582
A "pseudo-class" with methods for operating on BUILD_VECTORs.
LLVM_ABI bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef, unsigned &SplatBitSize, bool &HasAnyUndefs, unsigned MinSplatBits=0, bool isBigEndian=false) const
Check if this is a constant splat, and if so, find the smallest element size that splats the vector.
uint64_t getZExtValue() const
int64_t getSExtValue() const
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
LoongArchDAGToDAGISelLegacy(LoongArchTargetMachine &TM, CodeGenOptLevel OptLevel)
bool selectNonFIBaseAddr(SDValue Addr, SDValue &Base)
bool selectSExti32(SDValue N, SDValue &Val)
bool SelectInlineAsmMemoryOperand(const SDValue &Op, InlineAsm::ConstraintCode ConstraintID, std::vector< SDValue > &OutOps) override
SelectInlineAsmMemoryOperand - Select the specified address as a target addressing mode,...
bool selectVSplatImm(SDValue N, SDValue &SplatVal)
bool selectShiftMask(SDValue N, unsigned ShiftWidth, SDValue &ShAmt)
bool selectZExti32(SDValue N, SDValue &Val)
bool SelectAddrRegImm12(SDValue Addr, SDValue &Base, SDValue &Offset)
bool selectVSplatImmNeg(SDValue N, SDValue &SplatVal) const
bool SelectAddrConstant(SDValue Addr, SDValue &Base, SDValue &Offset)
bool selectVSplatUimmPow2(SDValue N, SDValue &SplatImm) const
bool selectVSplat(SDNode *N, APInt &Imm, unsigned MinSizeInBits) const
bool selectVSplatUimmInvPow2(SDValue N, SDValue &SplatImm) const
bool SelectBaseAddr(SDValue Addr, SDValue &Base)
Machine Value Type.
bool is128BitVector() const
Return true if this is a 128-bit vector type.
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
bool is256BitVector() const
Return true if this is a 256-bit vector type.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
const SDValue & getOperand(unsigned i) const
MVT getSimpleValueType() const
Return the simple ValueType of the referenced return value.
SelectionDAGISelLegacy(char &ID, std::unique_ptr< SelectionDAGISel > S)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
@ SIGN_EXTEND_INREG
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
Definition ISDOpcodes.h:920
@ AND
Bitwise operators - logical and, logical or, logical xor.
Definition ISDOpcodes.h:763
@ BUILD_VECTOR
BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a fixed-width vector with the specified,...
Definition ISDOpcodes.h:561
InstSeq generateInstSeq(int64_t Val)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
Definition MathExtras.h:166
@ Known
Known to have no common set bits.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
bool isAligned(Align Lhs, uint64_t SizeInBytes)
Checks that SizeInBytes is a multiple of the alignment.
Definition Alignment.h:139
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Definition MathExtras.h:326
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
Definition MathExtras.h:280
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:280
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
FunctionPass * createLoongArchISelDag(LoongArchTargetMachine &TM, CodeGenOptLevel OptLevel)
DWARFExpression::Operation Op
constexpr int32_t SignExtend32(uint32_t X)
Sign-extend the number in the bottom B bits of X to a 32-bit integer.
Definition MathExtras.h:554
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition MathExtras.h:249
constexpr int64_t SignExtend64(uint64_t x)
Sign-extend the number in the bottom B bits of X to a 64-bit integer.
Definition MathExtras.h:572
unsigned Log2(Align A)
Returns the log2 of the alignment.
Definition Alignment.h:202
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:879
#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
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition ValueTypes.h:411
bool is128BitVector() const
Return true if this is a 128-bit vector type.
Definition ValueTypes.h:245
bool is256BitVector() const
Return true if this is a 256-bit vector type.
Definition ValueTypes.h:250
EVT getVectorElementType() const
Given a vector type, return the type of each element.
Definition ValueTypes.h:366