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;
53class ConstantFP;
54class APFloat;
55
56// Convenience macros for dealing with vector reduction opcodes.
57#define GISEL_VECREDUCE_CASES_ALL \
58 case TargetOpcode::G_VECREDUCE_SEQ_FADD: \
59 case TargetOpcode::G_VECREDUCE_SEQ_FMUL: \
60 case TargetOpcode::G_VECREDUCE_FADD: \
61 case TargetOpcode::G_VECREDUCE_FMUL: \
62 case TargetOpcode::G_VECREDUCE_FMAX: \
63 case TargetOpcode::G_VECREDUCE_FMIN: \
64 case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
65 case TargetOpcode::G_VECREDUCE_FMINIMUM: \
66 case TargetOpcode::G_VECREDUCE_ADD: \
67 case TargetOpcode::G_VECREDUCE_MUL: \
68 case TargetOpcode::G_VECREDUCE_AND: \
69 case TargetOpcode::G_VECREDUCE_OR: \
70 case TargetOpcode::G_VECREDUCE_XOR: \
71 case TargetOpcode::G_VECREDUCE_SMAX: \
72 case TargetOpcode::G_VECREDUCE_SMIN: \
73 case TargetOpcode::G_VECREDUCE_UMAX: \
74 case TargetOpcode::G_VECREDUCE_UMIN:
75
76#define GISEL_VECREDUCE_CASES_NONSEQ \
77 case TargetOpcode::G_VECREDUCE_FADD: \
78 case TargetOpcode::G_VECREDUCE_FMUL: \
79 case TargetOpcode::G_VECREDUCE_FMAX: \
80 case TargetOpcode::G_VECREDUCE_FMIN: \
81 case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
82 case TargetOpcode::G_VECREDUCE_FMINIMUM: \
83 case TargetOpcode::G_VECREDUCE_ADD: \
84 case TargetOpcode::G_VECREDUCE_MUL: \
85 case TargetOpcode::G_VECREDUCE_AND: \
86 case TargetOpcode::G_VECREDUCE_OR: \
87 case TargetOpcode::G_VECREDUCE_XOR: \
88 case TargetOpcode::G_VECREDUCE_SMAX: \
89 case TargetOpcode::G_VECREDUCE_SMIN: \
90 case TargetOpcode::G_VECREDUCE_UMAX: \
91 case TargetOpcode::G_VECREDUCE_UMIN:
92
93/// Try to constrain Reg to the specified register class. If this fails,
94/// create a new virtual register in the correct class.
95///
96/// \return The virtual register constrained to the right register class.
97LLVM_ABI Register constrainRegToClass(MachineRegisterInfo &MRI,
98 const TargetInstrInfo &TII,
99 const RegisterBankInfo &RBI, Register Reg,
100 const TargetRegisterClass &RegClass);
101
102/// Constrain the Register operand OpIdx, so that it is now constrained to the
103/// TargetRegisterClass passed as an argument (RegClass).
104/// If this fails, create a new virtual register in the correct class and insert
105/// a COPY before \p InsertPt if it is a use or after if it is a definition.
106/// In both cases, the function also updates the register of RegMo. The debug
107/// location of \p InsertPt is used for the new copy.
108///
109/// \return The virtual register constrained to the right register class.
111 const MachineFunction &MF, const TargetRegisterInfo &TRI,
112 MachineRegisterInfo &MRI, const TargetInstrInfo &TII,
113 const RegisterBankInfo &RBI, MachineInstr &InsertPt,
114 const TargetRegisterClass &RegClass, MachineOperand &RegMO);
115
116/// Try to constrain Reg so that it is usable by argument OpIdx of the provided
117/// MCInstrDesc \p II. If this fails, create a new virtual register in the
118/// correct class and insert a COPY before \p InsertPt if it is a use or after
119/// if it is a definition. In both cases, the function also updates the register
120/// of RegMo.
121/// This is equivalent to constrainOperandRegClass(..., RegClass, ...)
122/// with RegClass obtained from the MCInstrDesc. The debug location of \p
123/// InsertPt is used for the new copy.
124///
125/// \return The virtual register constrained to the right register class.
127 const MachineFunction &MF, const TargetRegisterInfo &TRI,
128 MachineRegisterInfo &MRI, const TargetInstrInfo &TII,
129 const RegisterBankInfo &RBI, MachineInstr &InsertPt, const MCInstrDesc &II,
130 MachineOperand &RegMO, unsigned OpIdx);
131
132/// Mutate the newly-selected instruction \p I to constrain its (possibly
133/// generic) virtual register operands to the instruction's register class.
134/// This could involve inserting COPYs before (for uses) or after (for defs).
135/// This requires the number of operands to match the instruction description.
136// FIXME: Not all instructions have the same number of operands. We should
137// probably expose a constrain helper per operand and let the target selector
138// constrain individual registers, like fast-isel.
140 const TargetInstrInfo &TII,
141 const TargetRegisterInfo &TRI,
142 const RegisterBankInfo &RBI);
143
144/// Check if DstReg can be replaced with SrcReg depending on the register
145/// constraints.
146LLVM_ABI bool canReplaceReg(Register DstReg, Register SrcReg,
147 MachineRegisterInfo &MRI);
148
149/// Check whether an instruction \p MI is dead: it only defines dead virtual
150/// registers, and doesn't have other side effects.
151LLVM_ABI bool isTriviallyDead(const MachineInstr &MI,
152 const MachineRegisterInfo &MRI);
153
154/// Report an ISel error as a missed optimization remark to the LLVMContext's
155/// diagnostic stream. Set the FailedISel MachineFunction property.
156LLVM_ABI void reportGISelFailure(MachineFunction &MF,
157 MachineOptimizationRemarkEmitter &MORE,
158 MachineOptimizationRemarkMissed &R);
159
160LLVM_ABI void reportGISelFailure(MachineFunction &MF,
161 MachineOptimizationRemarkEmitter &MORE,
162 const char *PassName, StringRef Msg,
163 const MachineInstr &MI);
164
165/// Report an ISel warning as a missed optimization remark to the LLVMContext's
166/// diagnostic stream.
167LLVM_ABI void reportGISelWarning(MachineFunction &MF,
168 MachineOptimizationRemarkEmitter &MORE,
169 MachineOptimizationRemarkMissed &R);
170
171/// Returns the inverse opcode of \p MinMaxOpc, which is a generic min/max
172/// opcode like G_SMIN.
173LLVM_ABI unsigned getInverseGMinMaxOpcode(unsigned MinMaxOpc);
174
175/// If \p VReg is defined by a G_CONSTANT, return the corresponding value.
176LLVM_ABI std::optional<APInt>
177getIConstantVRegVal(Register VReg, const MachineRegisterInfo &MRI);
178
179/// If \p VReg is defined by a G_CONSTANT fits in int64_t returns it.
180LLVM_ABI std::optional<int64_t>
181getIConstantVRegSExtVal(Register VReg, const MachineRegisterInfo &MRI);
182
183/// \p VReg is defined by a G_CONSTANT, return the corresponding value.
184LLVM_ABI const APInt &getIConstantFromReg(Register VReg,
185 const MachineRegisterInfo &MRI);
186
187/// Simple struct used to hold a constant integer value and a virtual
188/// register.
193
194/// If \p VReg is defined by a statically evaluable chain of instructions rooted
195/// on a G_CONSTANT returns its APInt value and def register.
196LLVM_ABI std::optional<ValueAndVReg>
198 const MachineRegisterInfo &MRI,
199 bool LookThroughInstrs = true);
200
201/// If \p VReg is defined by a statically evaluable chain of instructions rooted
202/// on a G_CONSTANT or G_FCONSTANT returns its value as APInt and def register.
203LLVM_ABI std::optional<ValueAndVReg> getAnyConstantVRegValWithLookThrough(
204 Register VReg, const MachineRegisterInfo &MRI,
205 bool LookThroughInstrs = true, bool LookThroughAnyExt = false);
206
208 std::tuple<Register, Register, uint64_t, Align, bool, std::vector<LLT>>;
209
210/// Matcher for memcpy-like instructions. For non-zero lengths, \p MemOps
211/// contains the load/store types to emit.
213 const MachineRegisterInfo &MRI,
214 unsigned MaxLen, Register &Dst,
215 Register &Src, uint64_t &KnownLen,
216 Align &Alignment, bool &DstAlignCanChange,
217 std::vector<LLT> &MemOps);
218
223
224/// If \p VReg is defined by a statically evaluable chain of instructions rooted
225/// on a G_FCONSTANT returns its APFloat value and def register.
226LLVM_ABI std::optional<FPValueAndVReg>
228 const MachineRegisterInfo &MRI,
229 bool LookThroughInstrs = true);
230
232 const MachineRegisterInfo &MRI);
233
234/// See if Reg is defined by an single def instruction that is
235/// Opcode. Also try to do trivial folding if it's a COPY with
236/// same types. Returns null otherwise.
238 const MachineRegisterInfo &MRI);
239
240/// Simple struct used to hold a Register value and the instruction which
241/// defines it.
246
247/// Find the def instruction for \p Reg, and underlying value Register folding
248/// away any copies.
249///
250/// Also walks through hints such as G_ASSERT_ZEXT.
251LLVM_ABI std::optional<DefinitionAndSourceRegister>
253
254/// Find the def instruction for \p Reg, folding away any trivial copies. May
255/// return nullptr if \p Reg is not a generic virtual register.
256///
257/// Also walks through hints such as G_ASSERT_ZEXT.
259 const MachineRegisterInfo &MRI);
260
261/// Find the source register for \p Reg, folding away any trivial copies. It
262/// will be an output register of the instruction that getDefIgnoringCopies
263/// returns. May return an invalid register if \p Reg is not a generic virtual
264/// register.
265///
266/// Also walks through hints such as G_ASSERT_ZEXT.
268 const MachineRegisterInfo &MRI);
269
270/// Helper function to split a wide generic register into bitwise blocks with
271/// the given Type (which implies the number of blocks needed). The generic
272/// registers created are appended to Ops, starting at bit 0 of Reg.
273LLVM_ABI void extractParts(Register Reg, LLT Ty, int NumParts,
275 MachineIRBuilder &MIRBuilder,
277
278/// Version which handles irregular splits.
279LLVM_ABI bool extractParts(Register Reg, LLT RegTy, LLT MainTy, LLT &LeftoverTy,
281 SmallVectorImpl<Register> &LeftoverVRegs,
282 MachineIRBuilder &MIRBuilder,
284
285/// Version which handles irregular sub-vector splits.
286LLVM_ABI void extractVectorParts(Register Reg, unsigned NumElts,
288 MachineIRBuilder &MIRBuilder,
290
291// Templated variant of getOpcodeDef returning a MachineInstr derived T.
292/// See if Reg is defined by an single def instruction of type T
293/// Also try to do trivial folding if it's a COPY with
294/// same types. Returns null otherwise.
295template <class T>
300
301/// Returns an APFloat from Val converted to the appropriate size.
302LLVM_ABI APFloat getAPFloatFromSize(double Val, unsigned Size);
303
304/// Modify analysis usage so it preserves passes required for the SelectionDAG
305/// fallback.
306LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU);
307
308LLVM_ABI std::optional<APInt> ConstantFoldBinOp(unsigned Opcode,
309 const Register Op1,
310 const Register Op2,
311 const MachineRegisterInfo &MRI);
312LLVM_ABI std::optional<APFloat>
313ConstantFoldFPBinOp(unsigned Opcode, const Register Op1, const Register Op2,
314 const MachineRegisterInfo &MRI);
315
316/// Tries to constant fold a vector binop with sources \p Op1 and \p Op2.
317/// Returns an empty vector on failure.
319ConstantFoldVectorBinop(unsigned Opcode, const Register Op1, const Register Op2,
320 const MachineRegisterInfo &MRI);
321
322LLVM_ABI std::optional<APInt>
323ConstantFoldCastOp(unsigned Opcode, LLT DstTy, const Register Op0,
324 const MachineRegisterInfo &MRI);
325
326LLVM_ABI std::optional<APInt> ConstantFoldExtOp(unsigned Opcode,
327 const Register Op1,
328 uint64_t Imm,
329 const MachineRegisterInfo &MRI);
330
331LLVM_ABI std::optional<APFloat>
332ConstantFoldIntToFloat(unsigned Opcode, LLT DstTy, Register Src,
333 const MachineRegisterInfo &MRI);
334
335/// Tries to constant fold a unary integer operation (G_CTLZ, G_CTTZ, G_CTPOP
336/// and their _ZERO_POISON variants, G_ABS, G_BSWAP, G_BITREVERSE) on \p Src.
337/// If \p Src is a vector then it tries to do an element-wise constant fold.
339ConstantFoldUnaryIntOp(unsigned Opcode, LLT DstTy, Register Src,
340 const MachineRegisterInfo &MRI);
341
342LLVM_ABI std::optional<SmallVector<APInt>>
343ConstantFoldICmp(unsigned Pred, const Register Op1, const Register Op2,
344 unsigned DstScalarSizeInBits, unsigned ExtOp,
345 const MachineRegisterInfo &MRI);
346
347/// Test if the given value is known to have exactly one bit set. This differs
348/// from computeKnownBits in that it doesn't necessarily determine which bit is
349/// set. When \p OrNegative is true, the value is also considered a power of two
350/// if its negation is a power of two (i.e. its absolute value is a power of
351/// two).
352LLVM_ABI bool
353isKnownToBeAPowerOfTwo(Register Val, const MachineRegisterInfo &MRI,
354 GISelValueTracking *ValueTracking = nullptr,
355 bool OrNegative = false);
356
357LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF,
358 const MachinePointerInfo &MPO);
359
360/// Return a virtual register corresponding to the incoming argument register \p
361/// PhysReg. This register is expected to have class \p RC, and optional type \p
362/// RegTy. This assumes all references to the register will use the same type.
363///
364/// If there is an existing live-in argument register, it will be returned.
365/// This will also ensure there is a valid copy
367 MachineFunction &MF, const TargetInstrInfo &TII, MCRegister PhysReg,
368 const TargetRegisterClass &RC, const DebugLoc &DL, LLT RegTy = LLT());
369
370/// Return the least common multiple type of \p OrigTy and \p TargetTy, by
371/// changing the number of vector elements or scalar bitwidth. The intent is a
372/// G_MERGE_VALUES, G_BUILD_VECTOR, or G_CONCAT_VECTORS can be constructed from
373/// \p OrigTy elements, and unmerged into \p TargetTy. It is an error to call
374/// this function where one argument is a fixed vector and the other is a
375/// scalable vector, since it is illegal to build a G_{MERGE|UNMERGE}_VALUES
376/// between fixed and scalable vectors.
377LLVM_ABI LLVM_READNONE LLT getLCMType(LLT OrigTy, LLT TargetTy);
378
380 /// Return smallest type that covers both \p OrigTy and \p TargetTy and is
381 /// multiple of TargetTy.
382 LLT
383 getCoverTy(LLT OrigTy, LLT TargetTy);
384
385/// Return a type where the total size is the greatest common divisor of \p
386/// OrigTy and \p TargetTy. This will try to either change the number of vector
387/// elements, or bitwidth of scalars. The intent is the result type can be used
388/// as the result of a G_UNMERGE_VALUES from \p OrigTy, and then some
389/// combination of G_MERGE_VALUES, G_BUILD_VECTOR and G_CONCAT_VECTORS (possibly
390/// with intermediate casts) can re-form \p TargetTy.
391///
392/// If these are vectors with different element types, this will try to produce
393/// a vector with a compatible total size, but the element type of \p OrigTy. If
394/// this can't be satisfied, this will produce a scalar smaller than the
395/// original vector elements. It is an error to call this function where
396/// one argument is a fixed vector and the other is a scalable vector, since it
397/// is illegal to build a G_{MERGE|UNMERGE}_VALUES between fixed and scalable
398/// vectors.
399///
400/// In the worst case, this returns LLT::scalar(1)
401LLVM_ABI LLVM_READNONE LLT getGCDType(LLT OrigTy, LLT TargetTy);
402
403/// Represents a value which can be a Register or a constant.
404///
405/// This is useful in situations where an instruction may have an interesting
406/// register operand or interesting constant operand. For a concrete example,
407/// \see getVectorSplat.
409 int64_t Cst;
410 Register Reg;
411 bool IsReg;
412
413public:
414 explicit RegOrConstant(Register Reg) : Reg(Reg), IsReg(true) {}
415 explicit RegOrConstant(int64_t Cst) : Cst(Cst), IsReg(false) {}
416 bool isReg() const { return IsReg; }
417 bool isCst() const { return !IsReg; }
418 Register getReg() const {
419 assert(isReg() && "Expected a register!");
420 return Reg;
421 }
422 int64_t getCst() const {
423 assert(isCst() && "Expected a constant!");
424 return Cst;
425 }
426};
427
428/// \returns The splat index of a G_SHUFFLE_VECTOR \p MI when \p MI is a splat.
429/// If \p MI is not a splat, returns std::nullopt.
430LLVM_ABI std::optional<int> getSplatIndex(MachineInstr &MI);
431
432/// \returns the scalar integral splat value of \p Reg if possible.
433LLVM_ABI std::optional<APInt>
434getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI);
435
436/// \returns the scalar integral splat value defined by \p MI if possible.
437LLVM_ABI std::optional<APInt>
438getIConstantSplatVal(const MachineInstr &MI, const MachineRegisterInfo &MRI);
439
440/// \returns the scalar sign extended integral splat value of \p Reg if
441/// possible.
442LLVM_ABI std::optional<int64_t>
443getIConstantSplatSExtVal(const Register Reg, const MachineRegisterInfo &MRI);
444
445/// \returns the scalar sign extended integral splat value defined by \p MI if
446/// possible.
447LLVM_ABI std::optional<int64_t>
448getIConstantSplatSExtVal(const MachineInstr &MI,
449 const MachineRegisterInfo &MRI);
450
451/// Returns a floating point scalar constant of a build vector splat if it
452/// exists. When \p AllowUndef == true some elements can be undef but not all.
453LLVM_ABI std::optional<FPValueAndVReg>
454getFConstantSplat(Register VReg, const MachineRegisterInfo &MRI,
455 bool AllowUndef = true);
456
457/// Return true if the specified register is defined by G_BUILD_VECTOR or
458/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
460 const MachineRegisterInfo &MRI,
461 int64_t SplatValue, bool AllowUndef);
462
463/// Return true if the specified register is defined by G_BUILD_VECTOR or
464/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
466 const MachineRegisterInfo &MRI,
467 const APInt &SplatValue,
468 bool AllowUndef);
469
470/// Return true if the specified instruction is a G_BUILD_VECTOR or
471/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
472LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
473 const MachineRegisterInfo &MRI,
474 int64_t SplatValue, bool AllowUndef);
475
476/// Return true if the specified instruction is a G_BUILD_VECTOR or
477/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
478LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
479 const MachineRegisterInfo &MRI,
480 const APInt &SplatValue,
481 bool AllowUndef);
482
483/// Return true if the specified instruction is a G_BUILD_VECTOR or
484/// G_BUILD_VECTOR_TRUNC where all of the elements are 0 or undef.
485LLVM_ABI bool isBuildVectorAllZeros(const MachineInstr &MI,
486 const MachineRegisterInfo &MRI,
487 bool AllowUndef = false);
488
489/// Return true if the specified instruction is a G_BUILD_VECTOR or
490/// G_BUILD_VECTOR_TRUNC where all of the elements are ~0 or undef.
491LLVM_ABI bool isBuildVectorAllOnes(const MachineInstr &MI,
492 const MachineRegisterInfo &MRI,
493 bool AllowUndef = false);
494
495/// Return true if the specified instruction is known to be a constant, or a
496/// vector of constants.
497///
498/// If \p AllowFP is true, this will consider G_FCONSTANT in addition to
499/// G_CONSTANT. If \p AllowOpaqueConstants is true, constant-like instructions
500/// such as G_GLOBAL_VALUE will also be considered.
501LLVM_ABI bool isConstantOrConstantVector(const MachineInstr &MI,
502 const MachineRegisterInfo &MRI,
503 bool AllowFP = true,
504 bool AllowOpaqueConstants = true);
505
506/// Return true if the value is a constant 0 integer or a splatted vector of a
507/// constant 0 integer (with no undefs if \p AllowUndefs is false). This will
508/// handle G_BUILD_VECTOR and G_BUILD_VECTOR_TRUNC as truncation is not an issue
509/// for null values.
510LLVM_ABI bool isNullOrNullSplat(const MachineInstr &MI,
511 const MachineRegisterInfo &MRI,
512 bool AllowUndefs = false);
513
514/// Return true if the value is a constant -1 integer or a splatted vector of a
515/// constant -1 integer (with no undefs if \p AllowUndefs is false).
516LLVM_ABI bool isAllOnesOrAllOnesSplat(const MachineInstr &MI,
517 const MachineRegisterInfo &MRI,
518 bool AllowUndefs = false);
519
520/// \returns a value when \p MI is a vector splat. The splat can be either a
521/// Register or a constant.
522///
523/// Examples:
524///
525/// \code
526/// %reg = COPY $physreg
527/// %reg_splat = G_BUILD_VECTOR %reg, %reg, ..., %reg
528/// \endcode
529///
530/// If called on the G_BUILD_VECTOR above, this will return a RegOrConstant
531/// containing %reg.
532///
533/// \code
534/// %cst = G_CONSTANT iN 4
535/// %constant_splat = G_BUILD_VECTOR %cst, %cst, ..., %cst
536/// \endcode
537///
538/// In the above case, this will return a RegOrConstant containing 4.
539LLVM_ABI std::optional<RegOrConstant>
540getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI);
541
542/// Determines if \p MI defines a constant integer or a build vector of
543/// constant integers. Treats undef values as constants.
544LLVM_ABI bool isConstantOrConstantVector(MachineInstr &MI,
545 const MachineRegisterInfo &MRI);
546
547/// Determines if \p MI defines a constant integer or a splat vector of
548/// constant integers.
549/// \returns the scalar constant or std::nullopt.
550LLVM_ABI std::optional<APInt>
552 const MachineRegisterInfo &MRI);
553
554/// Determines if \p MI defines a float constant integer or a splat vector of
555/// float constant integers.
556/// \returns the float constant or std::nullopt.
557LLVM_ABI std::optional<APFloat>
559 const MachineRegisterInfo &MRI);
560
561/// Attempt to match a unary predicate against a scalar/splat constant or every
562/// element of a constant G_BUILD_VECTOR. If \p ConstVal is null, the source
563/// value was undef.
564LLVM_ABI bool
565matchUnaryPredicate(const MachineRegisterInfo &MRI, Register Reg,
566 std::function<bool(const Constant *ConstVal)> Match,
567 bool AllowUndefs = false);
568
569/// Returns true if given the TargetLowering's boolean contents information,
570/// the value \p Val contains a true value.
571LLVM_ABI bool isConstTrueVal(const TargetLowering &TLI, int64_t Val,
572 bool IsVector, bool IsFP);
573/// \returns true if given the TargetLowering's boolean contents information,
574/// the value \p Val contains a false value.
575LLVM_ABI bool isConstFalseVal(const TargetLowering &TLI, int64_t Val,
576 bool IsVector, bool IsFP);
577
578/// Returns an integer representing true, as defined by the
579/// TargetBooleanContents.
580LLVM_ABI int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector,
581 bool IsFP);
582
585 LostDebugLocObserver *LocObserver,
586 SmallInstListTy &DeadInstChain);
589 LostDebugLocObserver *LocObserver = nullptr);
591 LostDebugLocObserver *LocObserver = nullptr);
592
593/// Assuming the instruction \p MI is going to be deleted, attempt to salvage
594/// debug users of \p MI by writing the effect of \p MI in a DIExpression.
597
598/// Returns whether opcode \p Opc is a pre-isel generic floating-point opcode,
599/// having only floating-point operands.
601
602/// Returns true if \p Reg can create undef or poison from non-undef &
603/// non-poison operands. \p ConsiderFlagsAndMetadata controls whether poison
604/// producing flags and metadata on the instruction are considered. This can be
605/// used to see if the instruction could still introduce undef or poison even
606/// without poison generating flags and metadata which might be on the
607/// instruction.
609 const MachineRegisterInfo &MRI,
610 bool ConsiderFlagsAndMetadata = true);
611
612/// Returns true if \p Reg can create poison from non-poison operands.
614 bool ConsiderFlagsAndMetadata = true);
615
616/// Returns true if \p Reg cannot be poison and undef.
618 const MachineRegisterInfo &MRI,
619 unsigned Depth = 0);
620
621/// Returns true if \p Reg cannot be poison, but may be undef.
623 const MachineRegisterInfo &MRI,
624 unsigned Depth = 0);
625
626/// Returns true if \p Reg cannot be undef, but may be poison.
628 const MachineRegisterInfo &MRI,
629 unsigned Depth = 0);
630
631/// Get the type back from LLT. It won't be 100 percent accurate but returns an
632/// estimate of the type.
634
635/// Returns true if the instruction \p MI is one of the assert
636/// instructions.
638
639/// An integer-like constant.
640///
641/// It abstracts over scalar, fixed-length vectors, and scalable vectors.
642/// In the common case, it provides a common API and feels like an APInt,
643/// while still providing low-level access.
644/// It can be used for constant-folding.
645///
646/// bool isZero()
647/// abstracts over the kind.
648///
649/// switch(const.getKind())
650/// {
651/// }
652/// provides low-level access.
654public:
656
657private:
658 GIConstantKind Kind;
659 SmallVector<APInt> Values;
660 APInt Value;
661
662public:
664 : Kind(GIConstantKind::FixedVector), Values(Values) {};
665 GIConstant(const APInt &Value, GIConstantKind Kind)
666 : Kind(Kind), Value(Value) {};
667
668 /// Returns the kind of of this constant, e.g, Scalar.
669 GIConstantKind getKind() const { return Kind; }
670
671 /// Returns the value, if this constant is a scalar.
673
674 LLVM_ABI static std::optional<GIConstant>
675 getConstant(Register Const, const MachineRegisterInfo &MRI);
676};
677
678/// An floating-point-like constant.
679///
680/// It abstracts over scalar, fixed-length vectors, and scalable vectors.
681/// In the common case, it provides a common API and feels like an APFloat,
682/// while still providing low-level access.
683/// It can be used for constant-folding.
684///
685/// bool isZero()
686/// abstracts over the kind.
687///
688/// switch(const.getKind())
689/// {
690/// }
691/// provides low-level access.
693 using VecTy = SmallVector<APFloat>;
694 using const_iterator = VecTy::const_iterator;
695
696public:
698
699private:
700 GFConstantKind Kind;
702
703public:
705 : Kind(GFConstantKind::FixedVector), Values(Values) {};
706 GFConstant(const APFloat &Value, GFConstantKind Kind) : Kind(Kind) {
707 Values.push_back(Value);
708 }
709
710 /// Returns the kind of of this constant, e.g, Scalar.
711 GFConstantKind getKind() const { return Kind; }
712
713 const_iterator begin() const {
715 "Expected fixed vector or scalar constant");
716 return Values.begin();
717 }
718
719 const_iterator end() const {
721 "Expected fixed vector or scalar constant");
722 return Values.end();
723 }
724
725 size_t size() const {
726 assert(Kind == GFConstantKind::FixedVector && "Expected fixed vector");
727 return Values.size();
728 }
729
730 /// Returns the value, if this constant is a scalar.
732
733 LLVM_ABI static std::optional<GFConstant>
734 getConstant(Register Const, const MachineRegisterInfo &MRI);
735};
736
737} // End namespace llvm.
738#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:315
#define LLVM_ABI
Definition Compiler.h:213
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:713
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:706
GFConstant(ArrayRef< APFloat > Values)
Definition Utils.h:704
GFConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
Definition Utils.h:711
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:719
size_t size() const
Definition Utils.h:725
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:665
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:669
GIConstant(ArrayRef< APInt > Values)
Definition Utils.h:663
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.
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:414
Register getReg() const
Definition Utils.h:418
bool isCst() const
Definition Utils.h:417
int64_t getCst() const
Definition Utils.h:422
RegOrConstant(int64_t Cst)
Definition Utils.h:415
bool isReg() const
Definition Utils.h:416
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
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:583
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:207
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
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:242
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:189
Register VReg
Definition Utils.h:191