LLVM 22.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
29namespace llvm {
30
31class AnalysisUsage;
32class LostDebugLocObserver;
33class MachineBasicBlock;
34class BlockFrequencyInfo;
35class GISelValueTracking;
36class MachineFunction;
37class MachineInstr;
38class MachineIRBuilder;
39class MachineOperand;
40class MachineOptimizationRemarkEmitter;
41class MachineOptimizationRemarkMissed;
42struct MachinePointerInfo;
43class MachineRegisterInfo;
44class MCInstrDesc;
45class ProfileSummaryInfo;
46class RegisterBankInfo;
47class TargetInstrInfo;
48class TargetLowering;
49class TargetPassConfig;
50class TargetRegisterInfo;
51class TargetRegisterClass;
52class ConstantFP;
53class APFloat;
54
55// Convenience macros for dealing with vector reduction opcodes.
56#define GISEL_VECREDUCE_CASES_ALL \
57 case TargetOpcode::G_VECREDUCE_SEQ_FADD: \
58 case TargetOpcode::G_VECREDUCE_SEQ_FMUL: \
59 case TargetOpcode::G_VECREDUCE_FADD: \
60 case TargetOpcode::G_VECREDUCE_FMUL: \
61 case TargetOpcode::G_VECREDUCE_FMAX: \
62 case TargetOpcode::G_VECREDUCE_FMIN: \
63 case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
64 case TargetOpcode::G_VECREDUCE_FMINIMUM: \
65 case TargetOpcode::G_VECREDUCE_ADD: \
66 case TargetOpcode::G_VECREDUCE_MUL: \
67 case TargetOpcode::G_VECREDUCE_AND: \
68 case TargetOpcode::G_VECREDUCE_OR: \
69 case TargetOpcode::G_VECREDUCE_XOR: \
70 case TargetOpcode::G_VECREDUCE_SMAX: \
71 case TargetOpcode::G_VECREDUCE_SMIN: \
72 case TargetOpcode::G_VECREDUCE_UMAX: \
73 case TargetOpcode::G_VECREDUCE_UMIN:
74
75#define GISEL_VECREDUCE_CASES_NONSEQ \
76 case TargetOpcode::G_VECREDUCE_FADD: \
77 case TargetOpcode::G_VECREDUCE_FMUL: \
78 case TargetOpcode::G_VECREDUCE_FMAX: \
79 case TargetOpcode::G_VECREDUCE_FMIN: \
80 case TargetOpcode::G_VECREDUCE_FMAXIMUM: \
81 case TargetOpcode::G_VECREDUCE_FMINIMUM: \
82 case TargetOpcode::G_VECREDUCE_ADD: \
83 case TargetOpcode::G_VECREDUCE_MUL: \
84 case TargetOpcode::G_VECREDUCE_AND: \
85 case TargetOpcode::G_VECREDUCE_OR: \
86 case TargetOpcode::G_VECREDUCE_XOR: \
87 case TargetOpcode::G_VECREDUCE_SMAX: \
88 case TargetOpcode::G_VECREDUCE_SMIN: \
89 case TargetOpcode::G_VECREDUCE_UMAX: \
90 case TargetOpcode::G_VECREDUCE_UMIN:
91
92/// Try to constrain Reg to the specified register class. If this fails,
93/// create a new virtual register in the correct class.
94///
95/// \return The virtual register constrained to the right register class.
96LLVM_ABI Register constrainRegToClass(MachineRegisterInfo &MRI,
97 const TargetInstrInfo &TII,
98 const RegisterBankInfo &RBI, Register Reg,
99 const TargetRegisterClass &RegClass);
100
101/// Constrain the Register operand OpIdx, so that it is now constrained to the
102/// TargetRegisterClass passed as an argument (RegClass).
103/// If this fails, create a new virtual register in the correct class and insert
104/// a COPY before \p InsertPt if it is a use or after if it is a definition.
105/// In both cases, the function also updates the register of RegMo. The debug
106/// location of \p InsertPt is used for the new copy.
107///
108/// \return The virtual register constrained to the right register class.
110 const MachineFunction &MF, const TargetRegisterInfo &TRI,
111 MachineRegisterInfo &MRI, const TargetInstrInfo &TII,
112 const RegisterBankInfo &RBI, MachineInstr &InsertPt,
113 const TargetRegisterClass &RegClass, MachineOperand &RegMO);
114
115/// Try to constrain Reg so that it is usable by argument OpIdx of the provided
116/// MCInstrDesc \p II. If this fails, create a new virtual register in the
117/// correct class and insert a COPY before \p InsertPt if it is a use or after
118/// if it is a definition. In both cases, the function also updates the register
119/// of RegMo.
120/// This is equivalent to constrainOperandRegClass(..., RegClass, ...)
121/// with RegClass obtained from the MCInstrDesc. The debug location of \p
122/// InsertPt is used for the new copy.
123///
124/// \return The virtual register constrained to the right register class.
126 const MachineFunction &MF, const TargetRegisterInfo &TRI,
127 MachineRegisterInfo &MRI, const TargetInstrInfo &TII,
128 const RegisterBankInfo &RBI, MachineInstr &InsertPt, const MCInstrDesc &II,
129 MachineOperand &RegMO, unsigned OpIdx);
130
131/// Mutate the newly-selected instruction \p I to constrain its (possibly
132/// generic) virtual register operands to the instruction's register class.
133/// This could involve inserting COPYs before (for uses) or after (for defs).
134/// This requires the number of operands to match the instruction description.
135/// \returns whether operand regclass constraining succeeded.
136///
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 const TargetPassConfig &TPC,
159 MachineOptimizationRemarkEmitter &MORE,
160 MachineOptimizationRemarkMissed &R);
161
162LLVM_ABI void reportGISelFailure(MachineFunction &MF,
163 const TargetPassConfig &TPC,
164 MachineOptimizationRemarkEmitter &MORE,
165 const char *PassName, StringRef Msg,
166 const MachineInstr &MI);
167
168/// Report an ISel warning as a missed optimization remark to the LLVMContext's
169/// diagnostic stream.
170LLVM_ABI void reportGISelWarning(MachineFunction &MF,
171 const TargetPassConfig &TPC,
172 MachineOptimizationRemarkEmitter &MORE,
173 MachineOptimizationRemarkMissed &R);
174
175/// Returns the inverse opcode of \p MinMaxOpc, which is a generic min/max
176/// opcode like G_SMIN.
177LLVM_ABI unsigned getInverseGMinMaxOpcode(unsigned MinMaxOpc);
178
179/// If \p VReg is defined by a G_CONSTANT, return the corresponding value.
180LLVM_ABI std::optional<APInt>
181getIConstantVRegVal(Register VReg, const MachineRegisterInfo &MRI);
182
183/// If \p VReg is defined by a G_CONSTANT fits in int64_t returns it.
184LLVM_ABI std::optional<int64_t>
185getIConstantVRegSExtVal(Register VReg, const MachineRegisterInfo &MRI);
186
187/// \p VReg is defined by a G_CONSTANT, return the corresponding value.
188LLVM_ABI const APInt &getIConstantFromReg(Register VReg,
189 const MachineRegisterInfo &MRI);
190
191/// Simple struct used to hold a constant integer value and a virtual
192/// register.
196};
197
198/// If \p VReg is defined by a statically evaluable chain of instructions rooted
199/// on a G_CONSTANT returns its APInt value and def register.
200LLVM_ABI std::optional<ValueAndVReg>
203 bool LookThroughInstrs = true);
204
205/// If \p VReg is defined by a statically evaluable chain of instructions rooted
206/// on a G_CONSTANT or G_FCONSTANT returns its value as APInt and def register.
207LLVM_ABI std::optional<ValueAndVReg> getAnyConstantVRegValWithLookThrough(
208 Register VReg, const MachineRegisterInfo &MRI,
209 bool LookThroughInstrs = true, bool LookThroughAnyExt = false);
210
214};
215
216/// If \p VReg is defined by a statically evaluable chain of instructions rooted
217/// on a G_FCONSTANT returns its APFloat value and def register.
218LLVM_ABI std::optional<FPValueAndVReg>
221 bool LookThroughInstrs = true);
222
224 const MachineRegisterInfo &MRI);
225
226/// See if Reg is defined by an single def instruction that is
227/// Opcode. Also try to do trivial folding if it's a COPY with
228/// same types. Returns null otherwise.
230 const MachineRegisterInfo &MRI);
231
232/// Simple struct used to hold a Register value and the instruction which
233/// defines it.
237};
238
239/// Find the def instruction for \p Reg, and underlying value Register folding
240/// away any copies.
241///
242/// Also walks through hints such as G_ASSERT_ZEXT.
243LLVM_ABI std::optional<DefinitionAndSourceRegister>
245
246/// Find the def instruction for \p Reg, folding away any trivial copies. May
247/// return nullptr if \p Reg is not a generic virtual register.
248///
249/// Also walks through hints such as G_ASSERT_ZEXT.
251 const MachineRegisterInfo &MRI);
252
253/// Find the source register for \p Reg, folding away any trivial copies. It
254/// will be an output register of the instruction that getDefIgnoringCopies
255/// returns. May return an invalid register if \p Reg is not a generic virtual
256/// register.
257///
258/// Also walks through hints such as G_ASSERT_ZEXT.
260 const MachineRegisterInfo &MRI);
261
262/// Helper function to split a wide generic register into bitwise blocks with
263/// the given Type (which implies the number of blocks needed). The generic
264/// registers created are appended to Ops, starting at bit 0 of Reg.
265LLVM_ABI void extractParts(Register Reg, LLT Ty, int NumParts,
267 MachineIRBuilder &MIRBuilder,
269
270/// Version which handles irregular splits.
271LLVM_ABI bool extractParts(Register Reg, LLT RegTy, LLT MainTy, LLT &LeftoverTy,
273 SmallVectorImpl<Register> &LeftoverVRegs,
274 MachineIRBuilder &MIRBuilder,
276
277/// Version which handles irregular sub-vector splits.
278LLVM_ABI void extractVectorParts(Register Reg, unsigned NumElts,
280 MachineIRBuilder &MIRBuilder,
282
283// Templated variant of getOpcodeDef returning a MachineInstr derived T.
284/// See if Reg is defined by an single def instruction of type T
285/// Also try to do trivial folding if it's a COPY with
286/// same types. Returns null otherwise.
287template <class T>
290 return dyn_cast_or_null<T>(DefMI);
291}
292
293/// Returns an APFloat from Val converted to the appropriate size.
294LLVM_ABI APFloat getAPFloatFromSize(double Val, unsigned Size);
295
296/// Modify analysis usage so it preserves passes required for the SelectionDAG
297/// fallback.
298LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU);
299
300LLVM_ABI std::optional<APInt> ConstantFoldBinOp(unsigned Opcode,
301 const Register Op1,
302 const Register Op2,
303 const MachineRegisterInfo &MRI);
304LLVM_ABI std::optional<APFloat>
305ConstantFoldFPBinOp(unsigned Opcode, const Register Op1, const Register Op2,
306 const MachineRegisterInfo &MRI);
307
308/// Tries to constant fold a vector binop with sources \p Op1 and \p Op2.
309/// Returns an empty vector on failure.
310LLVM_ABI SmallVector<APInt>
311ConstantFoldVectorBinop(unsigned Opcode, const Register Op1, const Register Op2,
312 const MachineRegisterInfo &MRI);
313
314LLVM_ABI std::optional<APInt>
315ConstantFoldCastOp(unsigned Opcode, LLT DstTy, const Register Op0,
316 const MachineRegisterInfo &MRI);
317
318LLVM_ABI std::optional<APInt> ConstantFoldExtOp(unsigned Opcode,
319 const Register Op1,
320 uint64_t Imm,
321 const MachineRegisterInfo &MRI);
322
323LLVM_ABI std::optional<APFloat>
324ConstantFoldIntToFloat(unsigned Opcode, LLT DstTy, Register Src,
325 const MachineRegisterInfo &MRI);
326
327/// Tries to constant fold a counting-zero operation (G_CTLZ or G_CTTZ) on \p
328/// Src. If \p Src is a vector then it tries to do an element-wise constant
329/// fold.
330LLVM_ABI std::optional<SmallVector<unsigned>>
331ConstantFoldCountZeros(Register Src, const MachineRegisterInfo &MRI,
332 std::function<unsigned(APInt)> CB);
333
334LLVM_ABI std::optional<SmallVector<APInt>>
335ConstantFoldICmp(unsigned Pred, const Register Op1, const Register Op2,
336 unsigned DstScalarSizeInBits, unsigned ExtOp,
337 const MachineRegisterInfo &MRI);
338
339/// Test if the given value is known to have exactly one bit set. This differs
340/// from computeKnownBits in that it doesn't necessarily determine which bit is
341/// set.
342LLVM_ABI bool
343isKnownToBeAPowerOfTwo(Register Val, const MachineRegisterInfo &MRI,
344 GISelValueTracking *ValueTracking = nullptr);
345
346/// Returns true if \p Val can be assumed to never be a NaN. If \p SNaN is true,
347/// this returns if \p Val can be assumed to never be a signaling NaN.
348LLVM_ABI bool isKnownNeverNaN(Register Val, const MachineRegisterInfo &MRI,
349 bool SNaN = false);
350
351/// Returns true if \p Val can be assumed to never be a signaling NaN.
353 return isKnownNeverNaN(Val, MRI, true);
354}
355
356LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF,
357 const MachinePointerInfo &MPO);
358
359/// Return a virtual register corresponding to the incoming argument register \p
360/// PhysReg. This register is expected to have class \p RC, and optional type \p
361/// RegTy. This assumes all references to the register will use the same type.
362///
363/// If there is an existing live-in argument register, it will be returned.
364/// This will also ensure there is a valid copy
366 MachineFunction &MF, const TargetInstrInfo &TII, MCRegister PhysReg,
367 const TargetRegisterClass &RC, const DebugLoc &DL, LLT RegTy = LLT());
368
369/// Return the least common multiple type of \p OrigTy and \p TargetTy, by
370/// changing the number of vector elements or scalar bitwidth. The intent is a
371/// G_MERGE_VALUES, G_BUILD_VECTOR, or G_CONCAT_VECTORS can be constructed from
372/// \p OrigTy elements, and unmerged into \p TargetTy. It is an error to call
373/// this function where one argument is a fixed vector and the other is a
374/// scalable vector, since it is illegal to build a G_{MERGE|UNMERGE}_VALUES
375/// between fixed and scalable vectors.
376LLVM_ABI LLVM_READNONE LLT getLCMType(LLT OrigTy, LLT TargetTy);
377
379 /// Return smallest type that covers both \p OrigTy and \p TargetTy and is
380 /// multiple of TargetTy.
381 LLT
382 getCoverTy(LLT OrigTy, LLT TargetTy);
383
384/// Return a type where the total size is the greatest common divisor of \p
385/// OrigTy and \p TargetTy. This will try to either change the number of vector
386/// elements, or bitwidth of scalars. The intent is the result type can be used
387/// as the result of a G_UNMERGE_VALUES from \p OrigTy, and then some
388/// combination of G_MERGE_VALUES, G_BUILD_VECTOR and G_CONCAT_VECTORS (possibly
389/// with intermediate casts) can re-form \p TargetTy.
390///
391/// If these are vectors with different element types, this will try to produce
392/// a vector with a compatible total size, but the element type of \p OrigTy. If
393/// this can't be satisfied, this will produce a scalar smaller than the
394/// original vector elements. It is an error to call this function where
395/// one argument is a fixed vector and the other is a scalable vector, since it
396/// is illegal to build a G_{MERGE|UNMERGE}_VALUES between fixed and scalable
397/// vectors.
398///
399/// In the worst case, this returns LLT::scalar(1)
400LLVM_ABI LLVM_READNONE LLT getGCDType(LLT OrigTy, LLT TargetTy);
401
402/// Represents a value which can be a Register or a constant.
403///
404/// This is useful in situations where an instruction may have an interesting
405/// register operand or interesting constant operand. For a concrete example,
406/// \see getVectorSplat.
408 int64_t Cst;
409 Register Reg;
410 bool IsReg;
411
412public:
413 explicit RegOrConstant(Register Reg) : Reg(Reg), IsReg(true) {}
414 explicit RegOrConstant(int64_t Cst) : Cst(Cst), IsReg(false) {}
415 bool isReg() const { return IsReg; }
416 bool isCst() const { return !IsReg; }
417 Register getReg() const {
418 assert(isReg() && "Expected a register!");
419 return Reg;
420 }
421 int64_t getCst() const {
422 assert(isCst() && "Expected a constant!");
423 return Cst;
424 }
425};
426
427/// \returns The splat index of a G_SHUFFLE_VECTOR \p MI when \p MI is a splat.
428/// If \p MI is not a splat, returns std::nullopt.
429LLVM_ABI std::optional<int> getSplatIndex(MachineInstr &MI);
430
431/// \returns the scalar integral splat value of \p Reg if possible.
432LLVM_ABI std::optional<APInt>
433getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI);
434
435/// \returns the scalar integral splat value defined by \p MI if possible.
436LLVM_ABI std::optional<APInt>
437getIConstantSplatVal(const MachineInstr &MI, const MachineRegisterInfo &MRI);
438
439/// \returns the scalar sign extended integral splat value of \p Reg if
440/// possible.
441LLVM_ABI std::optional<int64_t>
442getIConstantSplatSExtVal(const Register Reg, const MachineRegisterInfo &MRI);
443
444/// \returns the scalar sign extended integral splat value defined by \p MI if
445/// possible.
446LLVM_ABI std::optional<int64_t>
447getIConstantSplatSExtVal(const MachineInstr &MI,
448 const MachineRegisterInfo &MRI);
449
450/// Returns a floating point scalar constant of a build vector splat if it
451/// exists. When \p AllowUndef == true some elements can be undef but not all.
452LLVM_ABI std::optional<FPValueAndVReg>
453getFConstantSplat(Register VReg, const MachineRegisterInfo &MRI,
454 bool AllowUndef = true);
455
456/// Return true if the specified register is defined by G_BUILD_VECTOR or
457/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
458LLVM_ABI bool isBuildVectorConstantSplat(const Register Reg,
459 const MachineRegisterInfo &MRI,
460 int64_t SplatValue, bool AllowUndef);
461
462/// Return true if the specified register is defined by G_BUILD_VECTOR or
463/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
464LLVM_ABI bool isBuildVectorConstantSplat(const Register Reg,
465 const MachineRegisterInfo &MRI,
466 APInt SplatValue, bool AllowUndef);
467
468/// Return true if the specified instruction is a G_BUILD_VECTOR or
469/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
470LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
471 const MachineRegisterInfo &MRI,
472 int64_t SplatValue, bool AllowUndef);
473
474/// Return true if the specified instruction is a G_BUILD_VECTOR or
475/// G_BUILD_VECTOR_TRUNC where all of the elements are \p SplatValue or undef.
476LLVM_ABI bool isBuildVectorConstantSplat(const MachineInstr &MI,
477 const MachineRegisterInfo &MRI,
478 APInt SplatValue, bool AllowUndef);
479
480/// Return true if the specified instruction is a G_BUILD_VECTOR or
481/// G_BUILD_VECTOR_TRUNC where all of the elements are 0 or undef.
482LLVM_ABI bool isBuildVectorAllZeros(const MachineInstr &MI,
483 const MachineRegisterInfo &MRI,
484 bool AllowUndef = false);
485
486/// Return true if the specified instruction is a G_BUILD_VECTOR or
487/// G_BUILD_VECTOR_TRUNC where all of the elements are ~0 or undef.
488LLVM_ABI bool isBuildVectorAllOnes(const MachineInstr &MI,
489 const MachineRegisterInfo &MRI,
490 bool AllowUndef = false);
491
492/// Return true if the specified instruction is known to be a constant, or a
493/// vector of constants.
494///
495/// If \p AllowFP is true, this will consider G_FCONSTANT in addition to
496/// G_CONSTANT. If \p AllowOpaqueConstants is true, constant-like instructions
497/// such as G_GLOBAL_VALUE will also be considered.
498LLVM_ABI bool isConstantOrConstantVector(const MachineInstr &MI,
499 const MachineRegisterInfo &MRI,
500 bool AllowFP = true,
501 bool AllowOpaqueConstants = true);
502
503/// Return true if the value is a constant 0 integer or a splatted vector of a
504/// constant 0 integer (with no undefs if \p AllowUndefs is false). This will
505/// handle G_BUILD_VECTOR and G_BUILD_VECTOR_TRUNC as truncation is not an issue
506/// for null values.
507LLVM_ABI bool isNullOrNullSplat(const MachineInstr &MI,
508 const MachineRegisterInfo &MRI,
509 bool AllowUndefs = false);
510
511/// Return true if the value is a constant -1 integer or a splatted vector of a
512/// constant -1 integer (with no undefs if \p AllowUndefs is false).
513LLVM_ABI bool isAllOnesOrAllOnesSplat(const MachineInstr &MI,
514 const MachineRegisterInfo &MRI,
515 bool AllowUndefs = false);
516
517/// \returns a value when \p MI is a vector splat. The splat can be either a
518/// Register or a constant.
519///
520/// Examples:
521///
522/// \code
523/// %reg = COPY $physreg
524/// %reg_splat = G_BUILD_VECTOR %reg, %reg, ..., %reg
525/// \endcode
526///
527/// If called on the G_BUILD_VECTOR above, this will return a RegOrConstant
528/// containing %reg.
529///
530/// \code
531/// %cst = G_CONSTANT iN 4
532/// %constant_splat = G_BUILD_VECTOR %cst, %cst, ..., %cst
533/// \endcode
534///
535/// In the above case, this will return a RegOrConstant containing 4.
536LLVM_ABI std::optional<RegOrConstant>
537getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI);
538
539/// Determines if \p MI defines a constant integer or a build vector of
540/// constant integers. Treats undef values as constants.
541LLVM_ABI bool isConstantOrConstantVector(MachineInstr &MI,
542 const MachineRegisterInfo &MRI);
543
544/// Determines if \p MI defines a constant integer or a splat vector of
545/// constant integers.
546/// \returns the scalar constant or std::nullopt.
547LLVM_ABI std::optional<APInt>
549 const MachineRegisterInfo &MRI);
550
551/// Determines if \p MI defines a float constant integer or a splat vector of
552/// float constant integers.
553/// \returns the float constant or std::nullopt.
554LLVM_ABI std::optional<APFloat>
556 const MachineRegisterInfo &MRI);
557
558/// Attempt to match a unary predicate against a scalar/splat constant or every
559/// element of a constant G_BUILD_VECTOR. If \p ConstVal is null, the source
560/// value was undef.
561LLVM_ABI bool
562matchUnaryPredicate(const MachineRegisterInfo &MRI, Register Reg,
563 std::function<bool(const Constant *ConstVal)> Match,
564 bool AllowUndefs = false);
565
566/// Returns true if given the TargetLowering's boolean contents information,
567/// the value \p Val contains a true value.
568LLVM_ABI bool isConstTrueVal(const TargetLowering &TLI, int64_t Val,
569 bool IsVector, bool IsFP);
570/// \returns true if given the TargetLowering's boolean contents information,
571/// the value \p Val contains a false value.
572LLVM_ABI bool isConstFalseVal(const TargetLowering &TLI, int64_t Val,
573 bool IsVector, bool IsFP);
574
575/// Returns an integer representing true, as defined by the
576/// TargetBooleanContents.
577LLVM_ABI int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector,
578 bool IsFP);
579
582 LostDebugLocObserver *LocObserver,
583 SmallInstListTy &DeadInstChain);
586 LostDebugLocObserver *LocObserver = nullptr);
588 LostDebugLocObserver *LocObserver = nullptr);
589
590/// Assuming the instruction \p MI is going to be deleted, attempt to salvage
591/// debug users of \p MI by writing the effect of \p MI in a DIExpression.
594
595/// Returns whether opcode \p Opc is a pre-isel generic floating-point opcode,
596/// having only floating-point operands.
598
599/// Returns true if \p Reg can create undef or poison from non-undef &
600/// non-poison operands. \p ConsiderFlagsAndMetadata controls whether poison
601/// producing flags and metadata on the instruction are considered. This can be
602/// used to see if the instruction could still introduce undef or poison even
603/// without poison generating flags and metadata which might be on the
604/// instruction.
607 bool ConsiderFlagsAndMetadata = true);
608
609/// Returns true if \p Reg can create poison from non-poison operands.
611 bool ConsiderFlagsAndMetadata = true);
612
613/// Returns true if \p Reg cannot be poison and undef.
616 unsigned Depth = 0);
617
618/// Returns true if \p Reg cannot be poison, but may be undef.
621 unsigned Depth = 0);
622
623/// Returns true if \p Reg cannot be undef, but may be poison.
626 unsigned Depth = 0);
627
628/// Get the type back from LLT. It won't be 100 percent accurate but returns an
629/// estimate of the type.
631
632/// Returns true if the instruction \p MI is one of the assert
633/// instructions.
635
636/// An integer-like constant.
637///
638/// It abstracts over scalar, fixed-length vectors, and scalable vectors.
639/// In the common case, it provides a common API and feels like an APInt,
640/// while still providing low-level access.
641/// It can be used for constant-folding.
642///
643/// bool isZero()
644/// abstracts over the kind.
645///
646/// switch(const.getKind())
647/// {
648/// }
649/// provides low-level access.
651public:
653
654private:
655 GIConstantKind Kind;
656 SmallVector<APInt> Values;
657 APInt Value;
658
659public:
661 : Kind(GIConstantKind::FixedVector), Values(Values) {};
663 : Kind(Kind), Value(Value) {};
664
665 /// Returns the kind of of this constant, e.g, Scalar.
666 GIConstantKind getKind() const { return Kind; }
667
668 /// Returns the value, if this constant is a scalar.
670
671 LLVM_ABI static std::optional<GIConstant>
673};
674
675/// An floating-point-like constant.
676///
677/// It abstracts over scalar, fixed-length vectors, and scalable vectors.
678/// In the common case, it provides a common API and feels like an APFloat,
679/// while still providing low-level access.
680/// It can be used for constant-folding.
681///
682/// bool isZero()
683/// abstracts over the kind.
684///
685/// switch(const.getKind())
686/// {
687/// }
688/// provides low-level access.
692
693public:
695
696private:
697 GFConstantKind Kind;
699
700public:
702 : Kind(GFConstantKind::FixedVector), Values(Values) {};
703 GFConstant(const APFloat &Value, GFConstantKind Kind) : Kind(Kind) {
704 Values.push_back(Value);
705 }
706
707 /// Returns the kind of of this constant, e.g, Scalar.
708 GFConstantKind getKind() const { return Kind; }
709
712 "Expected fixed vector or scalar constant");
713 return Values.begin();
714 }
715
718 "Expected fixed vector or scalar constant");
719 return Values.end();
720 }
721
722 size_t size() const {
723 assert(Kind == GFConstantKind::FixedVector && "Expected fixed vector");
724 return Values.size();
725 }
726
727 /// Returns the value, if this constant is a scalar.
729
730 LLVM_ABI static std::optional<GFConstant>
732};
733
734} // End namespace llvm.
735#endif
unsigned const MachineRegisterInfo * MRI
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
uint64_t Size
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:58
Register Reg
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition: Mem2Reg.cpp:110
MachineInstr unsigned OpIdx
uint64_t IntrinsicInst * II
static const char PassName[]
Class for arbitrary precision integers.
Definition: APInt.h:78
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
ConstantFP - Floating Point Values [float, double].
Definition: Constants.h:277
An floating-point-like constant.
Definition: Utils.h:689
const_iterator begin() const
Definition: Utils.h:710
static LLVM_ABI std::optional< GFConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:2094
GFConstant(const APFloat &Value, GFConstantKind Kind)
Definition: Utils.h:703
GFConstant(ArrayRef< APFloat > Values)
Definition: Utils.h:701
GFConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
Definition: Utils.h:708
LLVM_ABI APFloat getScalarValue() const
Returns the value, if this constant is a scalar.
Definition: Utils.cpp:2087
const_iterator end() const
Definition: Utils.h:716
size_t size() const
Definition: Utils.h:722
An integer-like constant.
Definition: Utils.h:650
LLVM_ABI APInt getScalarValue() const
Returns the value, if this constant is a scalar.
Definition: Utils.cpp:2047
GIConstant(const APInt &Value, GIConstantKind Kind)
Definition: Utils.h:662
static LLVM_ABI std::optional< GIConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:2054
GIConstantKind getKind() const
Returns the kind of of this constant, e.g, Scalar.
Definition: Utils.h:666
GIConstant(ArrayRef< APInt > Values)
Definition: Utils.h:660
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
Helper class to build MachineInstr.
Representation of each machine instruction.
Definition: MachineInstr.h:72
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Represents a value which can be a Register or a constant.
Definition: Utils.h:407
RegOrConstant(Register Reg)
Definition: Utils.h:413
Register getReg() const
Definition: Utils.h:417
bool isCst() const
Definition: Utils.h:416
int64_t getCst() const
Definition: Utils.h:421
RegOrConstant(int64_t Cst)
Definition: Utils.h:414
bool isReg() const
Definition: Utils.h:415
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
size_t size() const
Definition: SmallVector.h:79
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
void push_back(const T &Elt)
Definition: SmallVector.h:414
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:75
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
@ ConstantFP
Definition: ISDOpcodes.h:87
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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:916
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:1035
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:1480
LLVM_ABI Type * getTypeForLLT(LLT Ty, LLVMContext &C)
Get the type back from LLT.
Definition: Utils.cpp:2029
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:56
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:651
LLVM_ABI const ConstantFP * getConstantFPVRegVal(Register VReg, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:459
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:294
LLVM_ABI std::optional< APFloat > ConstantFoldIntToFloat(unsigned Opcode, LLT DstTy, Register Src, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:990
LLVM_ABI std::optional< APInt > getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:1440
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:1605
LLVM_ABI std::optional< APFloat > ConstantFoldFPBinOp(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:739
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:1723
LLVM_ABI bool 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:155
LLVM_ABI std::optional< SmallVector< unsigned > > ConstantFoldCountZeros(Register Src, const MachineRegisterInfo &MRI, std::function< unsigned(APInt)> CB)
Tries to constant fold a counting-zero operation (G_CTLZ or G_CTTZ) on Src.
Definition: Utils.cpp:1003
LLVM_ABI std::optional< APInt > ConstantFoldExtOp(unsigned Opcode, const Register Op1, uint64_t Imm, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:949
LLVM_ABI std::optional< RegOrConstant > getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:1493
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:1563
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:1587
LLVM_ABI MachineInstr * getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)
Find the def instruction for Reg, folding away any trivial copies.
Definition: Utils.cpp:492
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:1620
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:1652
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:1189
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:314
LLVM_ABI std::optional< APInt > ConstantFoldBinOp(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:670
LLVM_ABI const APInt & getIConstantFromReg(Register VReg, const MachineRegisterInfo &MRI)
VReg is defined by a G_CONSTANT, return the corresponding value.
Definition: Utils.cpp:305
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:1543
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:201
LLVM_ABI void saveUsesAndErase(MachineInstr &MI, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver, SmallInstListTy &DeadInstChain)
Definition: Utils.cpp:1689
LLVM_ABI void reportGISelFailure(MachineFunction &MF, const TargetPassConfig &TPC, MachineOptimizationRemarkEmitter &MORE, MachineOptimizationRemarkMissed &R)
Report an ISel error as a missed optimization remark to the LLVMContext's diagnostic stream.
Definition: Utils.cpp:259
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:439
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:1486
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...
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:793
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:1473
LLVM_ABI std::optional< APInt > ConstantFoldCastOp(unsigned Opcode, LLT DstTy, const Register Op0, const MachineRegisterInfo &MRI)
Definition: Utils.cpp:966
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:506
LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)
Modify analysis usage so it preserves passes required for the SelectionDAG fallback.
Definition: Utils.cpp:1185
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:1256
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:279
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:447
LLVM_ABI bool isConstFalseVal(const TargetLowering &TLI, int64_t Val, bool IsVector, bool IsFP)
Definition: Utils.cpp:1665
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:1576
LLVM_ABI APFloat getAPFloatFromSize(double Val, unsigned Size)
Returns an APFloat from Val converted to the appropriate size.
Definition: Utils.cpp:657
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:1401
LLVM_ABI void eraseInstr(MachineInstr &MI, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver=nullptr)
Definition: Utils.cpp:1718
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:46
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:1677
LLVM_ABI bool isKnownNeverNaN(const Value *V, const SimplifyQuery &SQ, unsigned Depth=0)
Return true if the floating-point scalar value is not a NaN or if the floating-point vector value has...
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:433
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:1742
bool isKnownNeverSNaN(Register Val, const MachineRegisterInfo &MRI)
Returns true if Val can be assumed to never be a signaling NaN.
Definition: Utils.h:352
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:467
LLVM_ABI void eraseInstrs(ArrayRef< MachineInstr * > DeadInstrs, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver=nullptr)
Definition: Utils.cpp:1703
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:499
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:1277
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:1458
LLVM_ABI bool isAssertMI(const MachineInstr &MI)
Returns true if the instruction MI is one of the assert instructions.
Definition: Utils.cpp:2036
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:609
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:222
LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF, const MachinePointerInfo &MPO)
Definition: Utils.cpp:899
LLVM_ABI void reportGISelWarning(MachineFunction &MF, const TargetPassConfig &TPC, MachineOptimizationRemarkEmitter &MORE, MachineOptimizationRemarkMissed &R)
Report an ISel warning as a missed optimization remark to the LLVMContext's diagnostic stream.
Definition: Utils.cpp:253
#define MORE()
Definition: regcomp.c:246
Simple struct used to hold a Register value and the instruction which defines it.
Definition: Utils.h:234
Register VReg
Definition: Utils.h:213
Simple struct used to hold a constant integer value and a virtual register.
Definition: Utils.h:193
Register VReg
Definition: Utils.h:195