LLVM 23.0.0git
Utils.h
Go to the documentation of this file.
1//==-- llvm/CodeGen/GlobalISel/Utils.h ---------------------------*- 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/// \file This file declares the API of helper functions used throughout the
10/// GlobalISel pipeline.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_GLOBALISEL_UTILS_H
15#define LLVM_CODEGEN_GLOBALISEL_UTILS_H
16
17#include "GISelWorkList.h"
18#include "llvm/ADT/APFloat.h"
19#include "llvm/ADT/StringRef.h"
22#include "llvm/IR/DebugLoc.h"
26
27#include <cstdint>
28#include <vector>
29
30namespace llvm {
31
32class AnalysisUsage;
37class MachineFunction;
38class MachineInstr;
40class MachineOperand;
45class MCInstrDesc;
48class TargetInstrInfo;
49class TargetLowering;
52class MCRegisterClass;
54class ConstantFP;
55class APFloat;
56
57// Convenience macros for dealing with vector reduction opcodes.
58#define GISEL_VECREDUCE_CASES_ALL \
59 case TargetOpcode::G_VECREDUCE_SEQ_FADD: \
60 case TargetOpcode::G_VECREDUCE_SEQ_FMUL: \
61 case TargetOpcode::G_VECREDUCE_FADD: \
62 case TargetOpcode::G_VECREDUCE_FMUL: \
63 case TargetOpcode::G_VECREDUCE_FMAX: \
64 case TargetOpcode::G_VECREDUCE_FMIN: \
65 case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
66 case TargetOpcode::G_VECREDUCE_FMINIMUM: \
67 case TargetOpcode::G_VECREDUCE_ADD: \
68 case TargetOpcode::G_VECREDUCE_MUL: \
69 case TargetOpcode::G_VECREDUCE_AND: \
70 case TargetOpcode::G_VECREDUCE_OR: \
71 case TargetOpcode::G_VECREDUCE_XOR: \
72 case TargetOpcode::G_VECREDUCE_SMAX: \
73 case TargetOpcode::G_VECREDUCE_SMIN: \
74 case TargetOpcode::G_VECREDUCE_UMAX: \
75 case TargetOpcode::G_VECREDUCE_UMIN:
76
77#define GISEL_VECREDUCE_CASES_NONSEQ \
78 case TargetOpcode::G_VECREDUCE_FADD: \
79 case TargetOpcode::G_VECREDUCE_FMUL: \
80 case TargetOpcode::G_VECREDUCE_FMAX: \
81 case TargetOpcode::G_VECREDUCE_FMIN: \
82 case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
83 case TargetOpcode::G_VECREDUCE_FMINIMUM: \
84 case TargetOpcode::G_VECREDUCE_ADD: \
85 case TargetOpcode::G_VECREDUCE_MUL: \
86 case TargetOpcode::G_VECREDUCE_AND: \
87 case TargetOpcode::G_VECREDUCE_OR: \
88 case TargetOpcode::G_VECREDUCE_XOR: \
89 case TargetOpcode::G_VECREDUCE_SMAX: \
90 case TargetOpcode::G_VECREDUCE_SMIN: \
91 case TargetOpcode::G_VECREDUCE_UMAX: \
92 case TargetOpcode::G_VECREDUCE_UMIN:
93
94/// Try to constrain Reg to the specified register class. If this fails,
95/// create a new virtual register in the correct class.
96///
97/// \return The virtual register constrained to the right register class.
98LLVM_ABI Register constrainRegToClass(MachineRegisterInfo &MRI,
99 const TargetInstrInfo &TII,
100 const RegisterBankInfo &RBI, Register Reg,
101 const TargetRegisterClass &RegClass);
102
103/// Constrain the Register operand OpIdx, so that it is now constrained to the
104/// TargetRegisterClass passed as an argument (RegClass).
105/// If this fails, create a new virtual register in the correct class and insert
106/// a COPY before \p InsertPt if it is a use or after if it is a definition.
107/// In both cases, the function also updates the register of RegMo. The debug
108/// location of \p InsertPt is used for the new copy.
109///
110/// \return The virtual register constrained to the right register class.
112 const MachineFunction &MF, const TargetRegisterInfo &TRI,
113 MachineRegisterInfo &MRI, const TargetInstrInfo &TII,
114 const RegisterBankInfo &RBI, MachineInstr &InsertPt,
115 const TargetRegisterClass &RegClass, MachineOperand &RegMO);
116
117/// Try to constrain Reg so that it is usable by argument OpIdx of the provided
118/// MCInstrDesc \p II. If this fails, create a new virtual register in the
119/// correct class and insert a COPY before \p InsertPt if it is a use or after
120/// if it is a definition. In both cases, the function also updates the register
121/// of RegMo.
122/// This is equivalent to constrainOperandRegClass(..., RegClass, ...)
123/// with RegClass obtained from the MCInstrDesc. The debug location of \p
124/// InsertPt is used for the new copy.
125///
126/// \return The virtual register constrained to the right register class.
128 const MachineFunction &MF, const TargetRegisterInfo &TRI,
129 MachineRegisterInfo &MRI, const TargetInstrInfo &TII,
130 const RegisterBankInfo &RBI, MachineInstr &InsertPt, const MCInstrDesc &II,
131 MachineOperand &RegMO, unsigned OpIdx);
132
133/// Mutate the newly-selected instruction \p I to constrain its (possibly
134/// generic) virtual register operands to the instruction's register class.
135/// This could involve inserting COPYs before (for uses) or after (for defs).
136/// This requires the number of operands to match the instruction description.
137// FIXME: Not all instructions have the same number of operands. We should
138// probably expose a constrain helper per operand and let the target selector
139// constrain individual registers, like fast-isel.
141 const TargetInstrInfo &TII,
142 const TargetRegisterInfo &TRI,
143 const RegisterBankInfo &RBI);
144
145/// Check if DstReg can be replaced with SrcReg depending on the register
146/// constraints.
147LLVM_ABI bool canReplaceReg(Register DstReg, Register SrcReg,
148 MachineRegisterInfo &MRI);
149
150/// Check whether an instruction \p MI is dead: it only defines dead virtual
151/// registers, and doesn't have other side effects.
152LLVM_ABI bool isTriviallyDead(const MachineInstr &MI,
153 const MachineRegisterInfo &MRI);
154
155/// Report an ISel error as a missed optimization remark to the LLVMContext's
156/// diagnostic stream. Set the FailedISel MachineFunction property.
157LLVM_ABI void reportGISelFailure(MachineFunction &MF,
158 MachineOptimizationRemarkEmitter &MORE,
159 MachineOptimizationRemarkMissed &R);
160
161LLVM_ABI void reportGISelFailure(MachineFunction &MF,
162 MachineOptimizationRemarkEmitter &MORE,
163 const char *PassName, StringRef Msg,
164 const MachineInstr &MI);
165
166/// Report an ISel warning as a missed optimization remark to the LLVMContext's
167/// diagnostic stream.
168LLVM_ABI void reportGISelWarning(MachineFunction &MF,
169 MachineOptimizationRemarkEmitter &MORE,
170 MachineOptimizationRemarkMissed &R);
171
172/// Returns the inverse opcode of \p MinMaxOpc, which is a generic min/max
173/// opcode like G_SMIN.
174LLVM_ABI unsigned getInverseGMinMaxOpcode(unsigned MinMaxOpc);
175
176/// If \p VReg is defined by a G_CONSTANT, return the corresponding value.
177LLVM_ABI std::optional<APInt>
178getIConstantVRegVal(Register VReg, const MachineRegisterInfo &MRI);
179
180/// If \p VReg is defined by a G_CONSTANT fits in int64_t returns it.
181LLVM_ABI std::optional<int64_t>
182getIConstantVRegSExtVal(Register VReg, const MachineRegisterInfo &MRI);
183
184/// \p VReg is defined by a G_CONSTANT, return the corresponding value.
185LLVM_ABI const APInt &getIConstantFromReg(Register VReg,
186 const MachineRegisterInfo &MRI);
187
188/// Simple struct used to hold a constant integer value and a virtual
189/// register.
194
195/// If \p VReg is defined by a statically evaluable chain of instructions rooted
196/// on a G_CONSTANT returns its APInt value and def register.
197LLVM_ABI std::optional<ValueAndVReg>
199 const MachineRegisterInfo &MRI,
200 bool LookThroughInstrs = true);
201
202/// If \p VReg is defined by a statically evaluable chain of instructions rooted
203/// on a G_CONSTANT or G_FCONSTANT returns its value as APInt and def register.
204LLVM_ABI std::optional<ValueAndVReg> getAnyConstantVRegValWithLookThrough(
205 Register VReg, const MachineRegisterInfo &MRI,
206 bool LookThroughInstrs = true, bool LookThroughAnyExt = false);
207
209 std::tuple<Register, Register, uint64_t, Align, bool, std::vector<LLT>>;
210
211/// Matcher for memcpy-like instructions. For non-zero lengths, \p MemOps
212/// contains the load/store types to emit.
214 const MachineRegisterInfo &MRI,
215 unsigned MaxLen, Register &Dst,
216 Register &Src, uint64_t &KnownLen,
217 Align &Alignment, bool &DstAlignCanChange,
218 std::vector<LLT> &MemOps);
219
224
225/// If \p VReg is defined by a statically evaluable chain of instructions rooted
226/// on a G_FCONSTANT returns its APFloat value and def register.
227LLVM_ABI std::optional<FPValueAndVReg>
229 const MachineRegisterInfo &MRI,
230 bool LookThroughInstrs = true);
231
233 const MachineRegisterInfo &MRI);
234
235/// See if Reg is defined by an single def instruction that is
236/// Opcode. Also try to do trivial folding if it's a COPY with
237/// same types. Returns null otherwise.
239 const MachineRegisterInfo &MRI);
240
241/// Simple struct used to hold a Register value and the instruction which
242/// defines it.
247
248/// Find the def instruction for \p Reg, and underlying value Register folding
249/// away any copies.
250///
251/// Also walks through hints such as G_ASSERT_ZEXT.
252LLVM_ABI std::optional<DefinitionAndSourceRegister>
254
255/// Find the def instruction for \p Reg, folding away any trivial copies. May
256/// return nullptr if \p Reg is not a generic virtual register.
257///
258/// Also walks through hints such as G_ASSERT_ZEXT.
260 const MachineRegisterInfo &MRI);
261
262/// Find the source register for \p Reg, folding away any trivial copies. It
263/// will be an output register of the instruction that getDefIgnoringCopies
264/// returns. May return an invalid register if \p Reg is not a generic virtual
265/// register.
266///
267/// Also walks through hints such as G_ASSERT_ZEXT.
269 const MachineRegisterInfo &MRI);
270
271/// Helper function to split a wide generic register into bitwise blocks with
272/// the given Type (which implies the number of blocks needed). The generic
273/// registers created are appended to Ops, starting at bit 0 of Reg.
274LLVM_ABI void extractParts(Register Reg, LLT Ty, int NumParts,
276 MachineIRBuilder &MIRBuilder,
278
279/// Version which handles irregular splits.
280LLVM_ABI bool extractParts(Register Reg, LLT RegTy, LLT MainTy, LLT &LeftoverTy,
282 SmallVectorImpl<Register> &LeftoverVRegs,
283 MachineIRBuilder &MIRBuilder,
285
286/// Version which handles irregular sub-vector splits.
287LLVM_ABI void extractVectorParts(Register Reg, unsigned NumElts,
289 MachineIRBuilder &MIRBuilder,
291
292// Templated variant of getOpcodeDef returning a MachineInstr derived T.
293/// See if Reg is defined by an single def instruction of type T
294/// Also try to do trivial folding if it's a COPY with
295/// same types. Returns null otherwise.
296template <class T>
301
302/// Returns an APFloat from Val converted to the appropriate size.
303LLVM_ABI APFloat getAPFloatFromSize(double Val, unsigned Size);
304
305/// Modify analysis usage so it preserves passes required for the SelectionDAG
306/// fallback.
307LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU);
308
309LLVM_ABI std::optional<APInt> ConstantFoldBinOp(unsigned Opcode,
310 const Register Op1,
311 const Register Op2,
312 const MachineRegisterInfo &MRI);
313LLVM_ABI std::optional<APFloat>
314ConstantFoldFPBinOp(unsigned Opcode, const Register Op1, const Register Op2,
315 const MachineRegisterInfo &MRI);
316
317/// Tries to constant fold a vector binop with sources \p Op1 and \p Op2.
318/// Returns an empty vector on failure.
320ConstantFoldVectorBinop(unsigned Opcode, const Register Op1, const Register Op2,
321 const MachineRegisterInfo &MRI);
322
323LLVM_ABI std::optional<APInt>
324ConstantFoldCastOp(unsigned Opcode, LLT DstTy, const Register Op0,
325 const MachineRegisterInfo &MRI);
326
327LLVM_ABI std::optional<APInt> ConstantFoldExtOp(unsigned Opcode,
328 const Register Op1,
329 uint64_t Imm,
330 const MachineRegisterInfo &MRI);
331
332LLVM_ABI std::optional<APFloat>
333ConstantFoldIntToFloat(unsigned Opcode, LLT DstTy, Register Src,
334 const MachineRegisterInfo &MRI);
335
336/// Tries to constant fold a unary integer operation (G_CTLZ, G_CTTZ, G_CTPOP
337/// and their _ZERO_POISON variants, G_ABS, G_BSWAP, G_BITREVERSE) on \p Src.
338/// If \p Src is a vector then it tries to do an element-wise constant fold.
340ConstantFoldUnaryIntOp(unsigned Opcode, LLT DstTy, Register Src,
341 const MachineRegisterInfo &MRI);
342
343LLVM_ABI std::optional<SmallVector<APInt>>
344ConstantFoldICmp(unsigned Pred, const Register Op1, const Register Op2,
345 unsigned DstScalarSizeInBits, unsigned ExtOp,
346 const MachineRegisterInfo &MRI);
347
348/// Test if the given value is known to have exactly one bit set. This differs
349/// from computeKnownBits in that it doesn't necessarily determine which bit is
350/// set. When \p OrNegative is true, the value is also considered a power of two
351/// if its negation is a power of two (i.e. its absolute value is a power of
352/// two).
353LLVM_ABI bool
354isKnownToBeAPowerOfTwo(Register Val, const MachineRegisterInfo &MRI,
355 GISelValueTracking *ValueTracking = nullptr,
356 bool OrNegative = false);
357
358LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF,
359 const MachinePointerInfo &MPO);
360
361/// Return a virtual register corresponding to the incoming argument register \p
362/// PhysReg. This register is expected to have class \p RC, and optional type \p
363/// RegTy. This assumes all references to the register will use the same type.
364///
365/// If there is an existing live-in argument register, it will be returned.
366/// This will also ensure there is a valid copy
368 MachineFunction &MF, const TargetInstrInfo &TII, MCRegister PhysReg,
369 const TargetRegisterClass &RC, const DebugLoc &DL, LLT RegTy = LLT());
370
371/// Return the least common multiple type of \p OrigTy and \p TargetTy, by
372/// changing the number of vector elements or scalar bitwidth. The intent is a
373/// G_MERGE_VALUES, G_BUILD_VECTOR, or G_CONCAT_VECTORS can be constructed from
374/// \p OrigTy elements, and unmerged into \p TargetTy. It is an error to call
375/// this function where one argument is a fixed vector and the other is a
376/// scalable vector, since it is illegal to build a G_{MERGE|UNMERGE}_VALUES
377/// between fixed and scalable vectors.
378LLVM_ABI LLVM_READNONE LLT getLCMType(LLT OrigTy, LLT TargetTy);
379
381 /// Return smallest type that covers both \p OrigTy and \p TargetTy and is
382 /// multiple of TargetTy.
383 LLT
384 getCoverTy(LLT OrigTy, LLT TargetTy);
385
386/// Return a type where the total size is the greatest common divisor of \p
387/// OrigTy and \p TargetTy. This will try to either change the number of vector
388/// elements, or bitwidth of scalars. The intent is the result type can be used
389/// as the result of a G_UNMERGE_VALUES from \p OrigTy, and then some
390/// combination of G_MERGE_VALUES, G_BUILD_VECTOR and G_CONCAT_VECTORS (possibly
391/// with intermediate casts) can re-form \p TargetTy.
392///
393/// If these are vectors with different element types, this will try to produce
394/// a vector with a compatible total size, but the element type of \p OrigTy. If
395/// this can't be satisfied, this will produce a scalar smaller than the
396/// original vector elements. It is an error to call this function where
397/// one argument is a fixed vector and the other is a scalable vector, since it
398/// is illegal to build a G_{MERGE|UNMERGE}_VALUES between fixed and scalable
399/// vectors.
400///
401/// In the worst case, this returns LLT::scalar(1)
402LLVM_ABI LLVM_READNONE LLT getGCDType(LLT OrigTy, LLT TargetTy);
403
404/// Represents a value which can be a Register or a constant.
405///
406/// This is useful in situations where an instruction may have an interesting
407/// register operand or interesting constant operand. For a concrete example,
408/// \see getVectorSplat.
410 int64_t Cst;
411 Register Reg;
412 bool IsReg;
413
414public:
415 explicit RegOrConstant(Register Reg) : Reg(Reg), IsReg(true) {}
416 explicit RegOrConstant(int64_t Cst) : Cst(Cst), IsReg(false) {}
417 bool isReg() const { return IsReg; }
418 bool isCst() const { return !IsReg; }
419 Register getReg() const {
420 assert(isReg() && "Expected a register!");
421 return Reg;
422 }
423 int64_t getCst() const {
424 assert(isCst() && "Expected a constant!");
425 return Cst;
426 }
427};
428
429/// \returns The splat index of a G_SHUFFLE_VECTOR \p MI when \p MI is a splat.
430/// If \p MI is not a splat, returns std::nullopt.
431LLVM_ABI std::optional<int> getSplatIndex(MachineInstr &MI);
432
433/// \returns the scalar integral splat value of \p Reg if possible.
434LLVM_ABI std::optional<APInt>
435getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI);
436
437/// \returns the scalar integral splat value defined by \p MI if possible.
438LLVM_ABI std::optional<APInt>
439getIConstantSplatVal(const MachineInstr &MI, const MachineRegisterInfo &MRI);
440
441/// \returns the scalar sign extended integral splat value of \p Reg if
442/// possible.
443LLVM_ABI std::optional<int64_t>
444getIConstantSplatSExtVal(const Register Reg, const MachineRegisterInfo &MRI);
445
446/// \returns the scalar sign extended integral splat value defined by \p MI if
447/// possible.
448LLVM_ABI std::optional<int64_t>
449getIConstantSplatSExtVal(const MachineInstr &MI,
450 const MachineRegisterInfo &MRI);
451
452/// Returns a floating point scalar constant of a build vector splat if it
453/// exists. When \p AllowUndef == true some elements can be undef but not all.
454LLVM_ABI std::optional<FPValueAndVReg>
455getFConstantSplat(Register VReg, const MachineRegisterInfo &MRI,
456 bool AllowUndef = true);
457
458/// Return true if the specified register is defined by G_BUILD_VECTOR or
459/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
461 const MachineRegisterInfo &MRI,
462 int64_t SplatValue, bool AllowUndef);
463
464/// Return true if the specified register is defined by G_BUILD_VECTOR or
465/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
467 const MachineRegisterInfo &MRI,
468 const APInt &SplatValue,
469 bool AllowUndef);
470
471/// Return true if the specified instruction is a G_BUILD_VECTOR or
472/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
473LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
474 const MachineRegisterInfo &MRI,
475 int64_t SplatValue, bool AllowUndef);
476
477/// Return true if the specified instruction is a G_BUILD_VECTOR or
478/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
479LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
480 const MachineRegisterInfo &MRI,
481 const APInt &SplatValue,
482 bool AllowUndef);
483
484/// Return true if the specified instruction is a G_BUILD_VECTOR or
485/// G_BUILD_VECTOR_TRUNC where all of the elements are 0 or undef.
486LLVM_ABI bool isBuildVectorAllZeros(const MachineInstr &MI,
487 const MachineRegisterInfo &MRI,
488 bool AllowUndef = false);
489
490/// Return true if the specified instruction is a G_BUILD_VECTOR or
491/// G_BUILD_VECTOR_TRUNC where all of the elements are ~0 or undef.
492LLVM_ABI bool isBuildVectorAllOnes(const MachineInstr &MI,
493 const MachineRegisterInfo &MRI,
494 bool AllowUndef = false);
495
496/// Return true if the specified instruction is known to be a constant, or a
497/// vector of constants.
498///
499/// If \p AllowFP is true, this will consider G_FCONSTANT in addition to
500/// G_CONSTANT. If \p AllowOpaqueConstants is true, constant-like instructions
501/// such as G_GLOBAL_VALUE will also be considered.
502LLVM_ABI bool isConstantOrConstantVector(const MachineInstr &MI,
503 const MachineRegisterInfo &MRI,
504 bool AllowFP = true,
505 bool AllowOpaqueConstants = true);
506
507/// Return true if the value is a constant 0 integer or a splatted vector of a
508/// constant 0 integer (with no undefs if \p AllowUndefs is false). This will
509/// handle G_BUILD_VECTOR and G_BUILD_VECTOR_TRUNC as truncation is not an issue
510/// for null values.
511LLVM_ABI bool isNullOrNullSplat(const MachineInstr &MI,
512 const MachineRegisterInfo &MRI,
513 bool AllowUndefs = false);
514
515/// Return true if the value is a constant -1 integer or a splatted vector of a
516/// constant -1 integer (with no undefs if \p AllowUndefs is false).
517LLVM_ABI bool isAllOnesOrAllOnesSplat(const MachineInstr &MI,
518 const MachineRegisterInfo &MRI,
519 bool AllowUndefs = false);
520
521/// \returns a value when \p MI is a vector splat. The splat can be either a
522/// Register or a constant.
523///
524/// Examples:
525///
526/// \code
527/// %reg = COPY $physreg
528/// %reg_splat = G_BUILD_VECTOR %reg, %reg, ..., %reg
529/// \endcode
530///
531/// If called on the G_BUILD_VECTOR above, this will return a RegOrConstant
532/// containing %reg.
533///
534/// \code
535/// %cst = G_CONSTANT iN 4
536/// %constant_splat = G_BUILD_VECTOR %cst, %cst, ..., %cst
537/// \endcode
538///
539/// In the above case, this will return a RegOrConstant containing 4.
540LLVM_ABI std::optional<RegOrConstant>
541getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI);
542
543/// Determines if \p MI defines a constant integer or a build vector of
544/// constant integers. Treats undef values as constants.
545LLVM_ABI bool isConstantOrConstantVector(MachineInstr &MI,
546 const MachineRegisterInfo &MRI);
547
548/// Determines if \p MI defines a constant integer or a splat vector of
549/// constant integers.
550/// \returns the scalar constant or std::nullopt.
551LLVM_ABI std::optional<APInt>
553 const MachineRegisterInfo &MRI);
554
555/// Determines if \p MI defines a float constant integer or a splat vector of
556/// float constant integers.
557/// \returns the float constant or std::nullopt.
558LLVM_ABI std::optional<APFloat>
560 const MachineRegisterInfo &MRI);
561
562/// Attempt to match a unary predicate against a scalar/splat constant or every
563/// element of a constant G_BUILD_VECTOR. If \p ConstVal is null, the source
564/// value was undef.
565LLVM_ABI bool
566matchUnaryPredicate(const MachineRegisterInfo &MRI, Register Reg,
567 std::function<bool(const Constant *ConstVal)> Match,
568 bool AllowUndefs = false);
569
570/// Returns true if given the TargetLowering's boolean contents information,
571/// the value \p Val contains a true value.
572LLVM_ABI bool isConstTrueVal(const TargetLowering &TLI, int64_t Val,
573 bool IsVector, bool IsFP);
574/// \returns true if given the TargetLowering's boolean contents information,
575/// the value \p Val contains a false value.
576LLVM_ABI bool isConstFalseVal(const TargetLowering &TLI, int64_t Val,
577 bool IsVector, bool IsFP);
578
579/// Returns an integer representing true, as defined by the
580/// TargetBooleanContents.
581LLVM_ABI int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector,
582 bool IsFP);
583
586 LostDebugLocObserver *LocObserver,
587 SmallInstListTy &DeadInstChain);
590 LostDebugLocObserver *LocObserver = nullptr);
592 LostDebugLocObserver *LocObserver = nullptr);
593
594/// Assuming the instruction \p MI is going to be deleted, attempt to salvage
595/// debug users of \p MI by writing the effect of \p MI in a DIExpression.
598
599/// Returns whether opcode \p Opc is a pre-isel generic floating-point opcode,
600/// having only floating-point operands.
602
603/// Returns true if \p Reg can create undef or poison from non-undef &
604/// non-poison operands. \p ConsiderFlagsAndMetadata controls whether poison
605/// producing flags and metadata on the instruction are considered. This can be
606/// used to see if the instruction could still introduce undef or poison even
607/// without poison generating flags and metadata which might be on the
608/// instruction.
610 const MachineRegisterInfo &MRI,
611 bool ConsiderFlagsAndMetadata = true);
612
613/// Returns true if \p Reg can create poison from non-poison operands.
615 bool ConsiderFlagsAndMetadata = true);
616
617/// Returns true if \p Reg cannot be poison and undef.
619 const MachineRegisterInfo &MRI,
620 unsigned Depth = 0);
621
622/// Returns true if \p Reg cannot be poison, but may be undef.
624 const MachineRegisterInfo &MRI,
625 unsigned Depth = 0);
626
627/// Returns true if \p Reg cannot be undef, but may be poison.
629 const MachineRegisterInfo &MRI,
630 unsigned Depth = 0);
631
632/// Get the type back from LLT. It won't be 100 percent accurate but returns an
633/// estimate of the type.
635
636/// Returns true if the instruction \p MI is one of the assert
637/// instructions.
639
640/// An integer-like constant.
641///
642/// It abstracts over scalar, fixed-length vectors, and scalable vectors.
643/// In the common case, it provides a common API and feels like an APInt,
644/// while still providing low-level access.
645/// It can be used for constant-folding.
646///
647/// bool isZero()
648/// abstracts over the kind.
649///
650/// switch(const.getKind())
651/// {
652/// }
653/// provides low-level access.
655public:
657
658private:
659 GIConstantKind Kind;
661 APInt Value;
662
663public:
665 : Kind(GIConstantKind::FixedVector), Values(Values) {};
666 GIConstant(const APInt &Value, GIConstantKind Kind)
667 : Kind(Kind), Value(Value) {};
668
669 /// Returns the kind of of this constant, e.g, Scalar.
670 GIConstantKind getKind() const { return Kind; }
671
672 /// Returns the value, if this constant is a scalar.
674
675 LLVM_ABI static std::optional<GIConstant>
676 getConstant(Register Const, const MachineRegisterInfo &MRI);
677};
678
679/// An floating-point-like constant.
680///
681/// It abstracts over scalar, fixed-length vectors, and scalable vectors.
682/// In the common case, it provides a common API and feels like an APFloat,
683/// while still providing low-level access.
684/// It can be used for constant-folding.
685///
686/// bool isZero()
687/// abstracts over the kind.
688///
689/// switch(const.getKind())
690/// {
691/// }
692/// provides low-level access.
694 using VecTy = SmallVector<APFloat>;
695 using const_iterator = VecTy::const_iterator;
696
697public:
699
700private:
701 GFConstantKind Kind;
703
704public:
706 : Kind(GFConstantKind::FixedVector), Values(Values) {};
707 GFConstant(const APFloat &Value, GFConstantKind Kind) : Kind(Kind) {
708 Values.push_back(Value);
709 }
710
711 /// Returns the kind of of this constant, e.g, Scalar.
712 GFConstantKind getKind() const { return Kind; }
713
714 const_iterator begin() const {
716 "Expected fixed vector or scalar constant");
717 return Values.begin();
718 }
719
720 const_iterator end() const {
722 "Expected fixed vector or scalar constant");
723 return Values.end();
724 }
725
726 size_t size() const {
727 assert(Kind == GFConstantKind::FixedVector && "Expected fixed vector");
728 return Values.size();
729 }
730
731 /// Returns the value, if this constant is a scalar.
733
734 LLVM_ABI static std::optional<GFConstant>
735 getConstant(Register Const, const MachineRegisterInfo &MRI);
736};
737
738} // End namespace llvm.
739#endif
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_READNONE
Definition Compiler.h:317
#define LLVM_ABI
Definition Compiler.h:215
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
Implement a low-level type suitable for MachineInstr level instruction selection.
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
#define T
MachineInstr unsigned OpIdx
uint64_t IntrinsicInst * II
static const char PassName[]
Class for arbitrary precision integers.
Definition APInt.h:78
Represent the analysis usage information of a pass.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
ConstantFP - Floating Point Values [float, double].
Definition Constants.h:420
const_iterator begin() const
Definition Utils.h:714
static LLVM_ABI std::optional< GFConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)
Definition Utils.cpp:2052
GFConstant(const APFloat &Value, GFConstantKind Kind)
Definition Utils.h:707
GFConstant(ArrayRef< APFloat > Values)
Definition Utils.h:705
GFConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
Definition Utils.h:712
LLVM_ABI APFloat getScalarValue() const
Returns the value, if this constant is a scalar.
Definition Utils.cpp:2045
const_iterator end() const
Definition Utils.h:720
size_t size() const
Definition Utils.h:726
LLVM_ABI APInt getScalarValue() const
Returns the value, if this constant is a scalar.
Definition Utils.cpp:2005
GIConstant(const APInt &Value, GIConstantKind Kind)
Definition Utils.h:666
static LLVM_ABI std::optional< GIConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)
Definition Utils.cpp:2012
GIConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
Definition Utils.h:670
GIConstant(ArrayRef< APInt > Values)
Definition Utils.h:664
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Describe properties that are true of each instruction in the target description file.
MCRegisterClass - Base class of TargetRegisterClass.
Helper class to build MachineInstr.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
Diagnostic information for missed-optimization remarks.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Analysis providing profile information.
RegOrConstant(Register Reg)
Definition Utils.h:415
Register getReg() const
Definition Utils.h:419
bool isCst() const
Definition Utils.h:418
int64_t getCst() const
Definition Utils.h:423
RegOrConstant(int64_t Cst)
Definition Utils.h:416
bool isReg() const
Definition Utils.h:417
Holds all the information related to register banks.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TargetInstrInfo - Interface to description of machine instruction set.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Target-Independent Code Generator Pass Configuration Options.
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
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI Register getFunctionLiveInPhysReg(MachineFunction &MF, const TargetInstrInfo &TII, MCRegister PhysReg, const TargetRegisterClass &RC, const DebugLoc &DL, LLT RegTy=LLT())
Return a virtual register corresponding to the incoming argument register PhysReg.
Definition Utils.cpp:861
LLVM_ABI std::optional< SmallVector< APInt > > ConstantFoldICmp(unsigned Pred, const Register Op1, const Register Op2, unsigned DstScalarSizeInBits, unsigned ExtOp, const MachineRegisterInfo &MRI)
Definition Utils.cpp:996
LLVM_ABI bool isBuildVectorAllZeros(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndef=false)
Return true if the specified instruction is a G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all of the...
Definition Utils.cpp:1447
LLVM_ABI Type * getTypeForLLT(LLT Ty, LLVMContext &C)
Get the type back from LLT.
Definition Utils.cpp:1987
LLVM_ABI Register constrainOperandRegClass(const MachineFunction &MF, const TargetRegisterInfo &TRI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, MachineInstr &InsertPt, const TargetRegisterClass &RegClass, MachineOperand &RegMO)
Constrain the Register operand OpIdx, so that it is now constrained to the TargetRegisterClass passed...
Definition Utils.cpp:60
LLVM_ABI MachineInstr * getOpcodeDef(unsigned Opcode, Register Reg, const MachineRegisterInfo &MRI)
See if Reg is defined by an single def instruction that is Opcode.
Definition Utils.cpp:656
LLVM_ABI const ConstantFP * getConstantFPVRegVal(Register VReg, const MachineRegisterInfo &MRI)
Definition Utils.cpp:464
LLVM_ABI bool canCreatePoison(const Operator *Op, bool ConsiderFlagsAndMetadata=true)
LLVM_ABI std::optional< APInt > getIConstantVRegVal(Register VReg, const MachineRegisterInfo &MRI)
If VReg is defined by a G_CONSTANT, return the corresponding value.
Definition Utils.cpp:297
RelativeUniformCounterPtr Values
Definition InstrProf.h:91
LLVM_ABI std::optional< APFloat > ConstantFoldIntToFloat(unsigned Opcode, LLT DstTy, Register Src, const MachineRegisterInfo &MRI)
Definition Utils.cpp:935
LLVM_ABI std::optional< APInt > getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI)
Definition Utils.cpp:1407
LLVM_ABI bool isAllOnesOrAllOnesSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndefs=false)
Return true if the value is a constant -1 integer or a splatted vector of a constant -1 integer (with...
Definition Utils.cpp:1572
LLVM_ABI std::optional< APFloat > ConstantFoldFPBinOp(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)
Definition Utils.cpp:744
LLVM_ABI void salvageDebugInfo(const MachineRegisterInfo &MRI, MachineInstr &MI)
Assuming the instruction MI is going to be deleted, attempt to salvage debug users of MI by writing t...
Definition Utils.cpp:1690
LLVM_ABI void constrainSelectedInstRegOperands(MachineInstr &I, const TargetInstrInfo &TII, const TargetRegisterInfo &TRI, const RegisterBankInfo &RBI)
Mutate the newly-selected instruction I to constrain its (possibly generic) virtual register operands...
Definition Utils.cpp:159
LLVM_ABI std::optional< APInt > ConstantFoldExtOp(unsigned Opcode, const Register Op1, uint64_t Imm, const MachineRegisterInfo &MRI)
Definition Utils.cpp:894
LLVM_ABI std::optional< RegOrConstant > getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Definition Utils.cpp:1460
GISelWorkList< 4 > SmallInstListTy
Definition Utils.h:584
LLVM_ABI std::optional< APInt > isConstantOrConstantSplatVector(MachineInstr &MI, const MachineRegisterInfo &MRI)
Determines if MI defines a constant integer or a splat vector of constant integers.
Definition Utils.cpp:1530
LLVM_ABI bool isNullOrNullSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndefs=false)
Return true if the value is a constant 0 integer or a splatted vector of a constant 0 integer (with n...
Definition Utils.cpp:1554
LLVM_ABI MachineInstr * getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the def instruction for Reg, folding away any trivial copies.
Definition Utils.cpp:497
LLVM_ABI bool matchUnaryPredicate(const MachineRegisterInfo &MRI, Register Reg, std::function< bool(const Constant *ConstVal)> Match, bool AllowUndefs=false)
Attempt to match a unary predicate against a scalar/splat constant or every element of a constant G_B...
Definition Utils.cpp:1587
LLVM_ABI void reportGISelWarning(MachineFunction &MF, MachineOptimizationRemarkEmitter &MORE, MachineOptimizationRemarkMissed &R)
Report an ISel warning as a missed optimization remark to the LLVMContext's diagnostic stream.
Definition Utils.cpp:255
LLVM_ABI bool isGuaranteedNotToBeUndef(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Returns true if V cannot be undef, but may be poison.
LLVM_ABI bool isConstTrueVal(const TargetLowering &TLI, int64_t Val, bool IsVector, bool IsFP)
Returns true if given the TargetLowering's boolean contents information, the value Val contains a tru...
Definition Utils.cpp:1619
LLVM_ABI LLVM_READNONE LLT getLCMType(LLT OrigTy, LLT TargetTy)
Return the least common multiple type of OrigTy and TargetTy, by changing the number of vector elemen...
Definition Utils.cpp:1154
LLVM_ABI std::optional< int64_t > getIConstantVRegSExtVal(Register VReg, const MachineRegisterInfo &MRI)
If VReg is defined by a G_CONSTANT fits in int64_t returns it.
Definition Utils.cpp:317
LLVM_ABI std::optional< APInt > ConstantFoldBinOp(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)
Definition Utils.cpp:675
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
LLVM_ABI const APInt & getIConstantFromReg(Register VReg, const MachineRegisterInfo &MRI)
VReg is defined by a G_CONSTANT, return the corresponding value.
Definition Utils.cpp:308
LLVM_ABI bool isConstantOrConstantVector(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowFP=true, bool AllowOpaqueConstants=true)
Return true if the specified instruction is known to be a constant, or a vector of constants.
Definition Utils.cpp:1510
LLVM_ABI bool canReplaceReg(Register DstReg, Register SrcReg, MachineRegisterInfo &MRI)
Check if DstReg can be replaced with SrcReg depending on the register constraints.
Definition Utils.cpp:203
LLVM_ABI void saveUsesAndErase(MachineInstr &MI, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver, SmallInstListTy &DeadInstChain)
Definition Utils.cpp:1656
LLVM_ABI void reportGISelFailure(MachineFunction &MF, MachineOptimizationRemarkEmitter &MORE, MachineOptimizationRemarkMissed &R)
Report an ISel error as a missed optimization remark to the LLVMContext's diagnostic stream.
Definition Utils.cpp:261
std::tuple< Register, Register, uint64_t, Align, bool, std::vector< LLT > > MemCpyFamilyLoweringInfo
Definition Utils.h:208
LLVM_ABI std::optional< ValueAndVReg > getAnyConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true, bool LookThroughAnyExt=false)
If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT or G_FCONST...
Definition Utils.cpp:442
LLVM_ABI bool isBuildVectorAllOnes(const MachineInstr &MI, const MachineRegisterInfo &MRI, bool AllowUndef=false)
Return true if the specified instruction is a G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all of the...
Definition Utils.cpp:1453
LLVM_ABI bool canCreateUndefOrPoison(const Operator *Op, bool ConsiderFlagsAndMetadata=true)
canCreateUndefOrPoison returns true if Op can create undef or poison from non-undef & non-poison oper...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
LLVM_ABI SmallVector< APInt > ConstantFoldVectorBinop(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)
Tries to constant fold a vector binop with sources Op1 and Op2.
Definition Utils.cpp:822
LLVM_ABI std::optional< FPValueAndVReg > getFConstantSplat(Register VReg, const MachineRegisterInfo &MRI, bool AllowUndef=true)
Returns a floating point scalar constant of a build vector splat if it exists.
Definition Utils.cpp:1440
LLVM_ABI std::optional< APInt > ConstantFoldCastOp(unsigned Opcode, LLT DstTy, const Register Op0, const MachineRegisterInfo &MRI)
Definition Utils.cpp:911
LLVM_ABI void extractParts(Register Reg, LLT Ty, int NumParts, SmallVectorImpl< Register > &VRegs, MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
Helper function to split a wide generic register into bitwise blocks with the given Type (which impli...
Definition Utils.cpp:511
LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)
Modify analysis usage so it preserves passes required for the SelectionDAG fallback.
Definition Utils.cpp:1150
LLVM_ABI bool canLowerMemCpyFamily(const MachineInstr &MI, const MachineRegisterInfo &MRI, unsigned MaxLen, Register &Dst, Register &Src, uint64_t &KnownLen, Align &Alignment, bool &DstAlignCanChange, std::vector< LLT > &MemOps)
Matcher for memcpy-like instructions.
Definition Utils.cpp:2153
LLVM_ABI LLVM_READNONE LLT getCoverTy(LLT OrigTy, LLT TargetTy)
Return smallest type that covers both OrigTy and TargetTy and is multiple of TargetTy.
Definition Utils.cpp:1221
LLVM_ABI unsigned getInverseGMinMaxOpcode(unsigned MinMaxOpc)
Returns the inverse opcode of MinMaxOpc, which is a generic min/max opcode like G_SMIN.
Definition Utils.cpp:282
LLVM_ABI bool isGuaranteedNotToBeUndefOrPoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Return true if this function can prove that V does not have undef bits and is never poison.
LLVM_ABI std::optional< FPValueAndVReg > getFConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true)
If VReg is defined by a statically evaluable chain of instructions rooted on a G_FCONSTANT returns it...
Definition Utils.cpp:450
LLVM_ABI bool isConstFalseVal(const TargetLowering &TLI, int64_t Val, bool IsVector, bool IsFP)
Definition Utils.cpp:1632
LLVM_ABI std::optional< APFloat > isConstantOrConstantSplatVectorFP(MachineInstr &MI, const MachineRegisterInfo &MRI)
Determines if MI defines a float constant integer or a splat vector of float constant integers.
Definition Utils.cpp:1543
LLVM_ABI APFloat getAPFloatFromSize(double Val, unsigned Size)
Returns an APFloat from Val converted to the appropriate size.
Definition Utils.cpp:662
LLVM_ABI bool isBuildVectorConstantSplat(const Register Reg, const MachineRegisterInfo &MRI, int64_t SplatValue, bool AllowUndef)
Return true if the specified register is defined by G_BUILD_VECTOR or G_BUILD_VECTOR_TRUNC where all ...
Definition Utils.cpp:1366
LLVM_ABI void eraseInstr(MachineInstr &MI, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver=nullptr)
Definition Utils.cpp:1685
LLVM_ABI Register constrainRegToClass(MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, Register Reg, const TargetRegisterClass &RegClass)
Try to constrain Reg to the specified register class.
Definition Utils.cpp:50
LLVM_ABI int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector, bool IsFP)
Returns an integer representing true, as defined by the TargetBooleanContents.
Definition Utils.cpp:1644
LLVM_ABI std::optional< ValueAndVReg > getIConstantVRegValWithLookThrough(Register VReg, const MachineRegisterInfo &MRI, bool LookThroughInstrs=true)
If VReg is defined by a statically evaluable chain of instructions rooted on a G_CONSTANT returns its...
Definition Utils.cpp:436
LLVM_ABI bool isPreISelGenericFloatingPointOpcode(unsigned Opc)
Returns whether opcode Opc is a pre-isel generic floating-point opcode, having only floating-point op...
Definition Utils.cpp:1709
LLVM_ABI std::optional< DefinitionAndSourceRegister > getDefSrcRegIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the def instruction for Reg, and underlying value Register folding away any copies.
Definition Utils.cpp:472
LLVM_ABI SmallVector< APInt > ConstantFoldUnaryIntOp(unsigned Opcode, LLT DstTy, Register Src, const MachineRegisterInfo &MRI)
Tries to constant fold a unary integer operation (G_CTLZ, G_CTTZ, G_CTPOP and their _ZERO_POISON vari...
Definition Utils.cpp:948
LLVM_ABI void eraseInstrs(ArrayRef< MachineInstr * > DeadInstrs, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver=nullptr)
Definition Utils.cpp:1670
LLVM_ABI bool isKnownToBeAPowerOfTwo(const Value *V, const DataLayout &DL, bool OrZero=false, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, bool UseInstrInfo=true, unsigned Depth=0)
Return true if the given value is known to have exactly one bit set when defined.
LLVM_ABI Register getSrcRegIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the source register for Reg, folding away any trivial copies.
Definition Utils.cpp:504
LLVM_ABI LLVM_READNONE LLT getGCDType(LLT OrigTy, LLT TargetTy)
Return a type where the total size is the greatest common divisor of OrigTy and TargetTy.
Definition Utils.cpp:1242
LLVM_ABI bool isGuaranteedNotToBePoison(const Value *V, AssumptionCache *AC=nullptr, const Instruction *CtxI=nullptr, const DominatorTree *DT=nullptr, unsigned Depth=0)
Returns true if V cannot be poison, but may be undef.
LLVM_ABI std::optional< int64_t > getIConstantSplatSExtVal(const Register Reg, const MachineRegisterInfo &MRI)
Definition Utils.cpp:1425
LLVM_ABI bool isAssertMI(const MachineInstr &MI)
Returns true if the instruction MI is one of the assert instructions.
Definition Utils.cpp:1994
LLVM_ABI void extractVectorParts(Register Reg, unsigned NumElts, SmallVectorImpl< Register > &VRegs, MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
Version which handles irregular sub-vector splits.
Definition Utils.cpp:614
LLVM_ABI int getSplatIndex(ArrayRef< int > Mask)
If all non-negative Mask elements are the same value, return that value.
LLVM_ABI bool isTriviallyDead(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Check whether an instruction MI is dead: it only defines dead virtual registers, and doesn't have oth...
Definition Utils.cpp:224
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF, const MachinePointerInfo &MPO)
Definition Utils.cpp:844
#define MORE()
Definition regcomp.c:246
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Simple struct used to hold a Register value and the instruction which defines it.
Definition Utils.h:243
This class contains a discriminated union of information about pointers in memory operands,...
Simple struct used to hold a constant integer value and a virtual register.
Definition Utils.h:190
Register VReg
Definition Utils.h:192