LLVM: include/llvm/CodeGen/GlobalISel/Utils.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CODEGEN_GLOBALISEL_UTILS_H

15#define LLVM_CODEGEN_GLOBALISEL_UTILS_H

16

26

27#include

28

29namespace llvm {

30

54

55

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

93

94

95

97 const TargetInstrInfo &TII,

98 const RegisterBankInfo &RBI, Register Reg,

99 const TargetRegisterClass &RegClass);

100

101

102

103

104

105

106

107

108

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

116

117

118

119

120

121

122

123

124

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

132

133

134

135

136

137

138

139

141 const TargetInstrInfo &TII,

142 const TargetRegisterInfo &TRI,

143 const RegisterBankInfo &RBI);

144

145

146

148 MachineRegisterInfo &MRI);

149

150

151

153 const MachineRegisterInfo &MRI);

154

155

156

158 MachineOptimizationRemarkEmitter &MORE,

159 MachineOptimizationRemarkMissed &R);

160

162 MachineOptimizationRemarkEmitter &MORE,

163 const char *PassName, StringRef Msg,

164 const MachineInstr &MI);

165

166

167

169 MachineOptimizationRemarkEmitter &MORE,

170 MachineOptimizationRemarkMissed &R);

171

172

173

175

176

179

180

181LLVM_ABI std::optional<int64_t>

183

184

186 const MachineRegisterInfo &MRI);

187

188

189

194

195

196

197LLVM_ABI std::optional

200 bool LookThroughInstrs = true);

201

202

203

206 bool LookThroughInstrs = true, bool LookThroughAnyExt = false);

207

212

213

214

215LLVM_ABI std::optional

218 bool LookThroughInstrs = true);

219

222

223

224

225

228

229

230

235

236

237

238

239

240LLVM_ABI std::optional

242

243

244

245

246

249

250

251

252

253

254

255

258

259

260

261

266

267

273

274

279

280

281

282

283

284template

289

290

292

293

294

296

300 const MachineRegisterInfo &MRI);

301LLVM_ABI std::optional

303 const MachineRegisterInfo &MRI);

304

305

306

309 const MachineRegisterInfo &MRI);

310

313 const MachineRegisterInfo &MRI);

314

318 const MachineRegisterInfo &MRI);

319

320LLVM_ABI std::optional

322 const MachineRegisterInfo &MRI);

323

324

325

326

327LLVM_ABI std::optional<SmallVector>

329 std::function<unsigned(APInt)> CB);

330

331LLVM_ABI std::optional<SmallVector>

333 unsigned DstScalarSizeInBits, unsigned ExtOp,

334 const MachineRegisterInfo &MRI);

335

336

337

338

341 GISelValueTracking *ValueTracking = nullptr);

342

343

344

346 bool SNaN = false);

347

348

352

354 const MachinePointerInfo &MPO);

355

356

357

358

359

360

361

363 MachineFunction &MF, const TargetInstrInfo &TII, MCRegister PhysReg,

364 const TargetRegisterClass &RC, const DebugLoc &DL, LLT RegTy = LLT());

365

366

367

368

369

370

371

372

374

376

377

378 LLT

379 getCoverTy(LLT OrigTy, LLT TargetTy);

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

398

399

400

401

402

403

405 int64_t Cst;

407 bool IsReg;

408

409public:

412 bool isReg() const { return IsReg; }

413 bool isCst() const { return !IsReg; }

415 assert(isReg() && "Expected a register!");

416 return Reg;

417 }

419 assert(isCst() && "Expected a constant!");

420 return Cst;

421 }

422};

423

424

425

427

428

431

432

435

436

437

438LLVM_ABI std::optional<int64_t>

440

441

442

443LLVM_ABI std::optional<int64_t>

445 const MachineRegisterInfo &MRI);

446

447

448

449LLVM_ABI std::optional

451 bool AllowUndef = true);

452

453

454

456 const MachineRegisterInfo &MRI,

457 int64_t SplatValue, bool AllowUndef);

458

459

460

462 const MachineRegisterInfo &MRI,

463 const APInt &SplatValue,

464 bool AllowUndef);

465

466

467

469 const MachineRegisterInfo &MRI,

470 int64_t SplatValue, bool AllowUndef);

471

472

473

475 const MachineRegisterInfo &MRI,

476 const APInt &SplatValue,

477 bool AllowUndef);

478

479

480

482 const MachineRegisterInfo &MRI,

483 bool AllowUndef = false);

484

485

486

488 const MachineRegisterInfo &MRI,

489 bool AllowUndef = false);

490

491

492

493

494

495

496

498 const MachineRegisterInfo &MRI,

499 bool AllowFP = true,

500 bool AllowOpaqueConstants = true);

501

502

503

504

505

507 const MachineRegisterInfo &MRI,

508 bool AllowUndefs = false);

509

510

511

513 const MachineRegisterInfo &MRI,

514 bool AllowUndefs = false);

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535LLVM_ABI std::optional

537

538

539

541 const MachineRegisterInfo &MRI);

542

543

544

545

548 const MachineRegisterInfo &MRI);

549

550

551

552

553LLVM_ABI std::optional

555 const MachineRegisterInfo &MRI);

556

557

558

559

562 std::function<bool(const Constant *ConstVal)> Match,

563 bool AllowUndefs = false);

564

565

566

568 bool IsVector, bool IsFP);

569

570

572 bool IsVector, bool IsFP);

573

574

575

577 bool IsFP);

578

588

589

590

593

594

595

597

598

599

600

601

602

603

606 bool ConsiderFlagsAndMetadata = true);

607

608

610 bool ConsiderFlagsAndMetadata = true);

611

612

615 unsigned Depth = 0);

616

617

620 unsigned Depth = 0);

621

622

625 unsigned Depth = 0);

626

627

628

630

631

632

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

650public:

652

653private:

654 GIConstantKind Kind;

657

658public:

662 : Kind(Kind), Value(Value) {};

663

664

666

667

669

670 LLVM_ABI static std::optional

672};

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

691

692public:

694

695private:

696 GFConstantKind Kind;

698

699public:

703 Values.push_back(Value);

704 }

705

706

708

709 const_iterator begin() const {

711 "Expected fixed vector or scalar constant");

712 return Values.begin();

713 }

714

715 const_iterator end() const {

717 "Expected fixed vector or scalar constant");

718 return Values.end();

719 }

720

723 return Values.size();

724 }

725

726

728

729 LLVM_ABI static std::optional

731};

732

733}

734#endif

unsigned const MachineRegisterInfo * MRI

MachineInstrBuilder MachineInstrBuilder & DefMI

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

const TargetInstrInfo & TII

This file declares a class to represent arbitrary precision floating point values and provide a varie...

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

Implement a low-level type suitable for MachineInstr level instruction selection.

Register const TargetRegisterInfo * TRI

Promote Memory to Register

MachineInstr unsigned OpIdx

uint64_t IntrinsicInst * II

static const char PassName[]

Class for arbitrary precision integers.

Represent the analysis usage information of a pass.

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...

ConstantFP - Floating Point Values [float, double].

GFConstantKind

Definition Utils.h:693

@ FixedVector

Definition Utils.h:693

@ ScalableVector

Definition Utils.h:693

@ Scalar

Definition Utils.h:693

const_iterator begin() const

Definition Utils.h:709

static LLVM_ABI std::optional< GFConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)

GFConstant(const APFloat &Value, GFConstantKind Kind)

Definition Utils.h:702

GFConstant(ArrayRef< APFloat > Values)

Definition Utils.h:700

GFConstantKind getKind() const

Returns the kind of of this constant, e.g, Scalar.

Definition Utils.h:707

LLVM_ABI APFloat getScalarValue() const

Returns the value, if this constant is a scalar.

const_iterator end() const

Definition Utils.h:715

size_t size() const

Definition Utils.h:721

LLVM_ABI APInt getScalarValue() const

Returns the value, if this constant is a scalar.

GIConstant(const APInt &Value, GIConstantKind Kind)

Definition Utils.h:661

static LLVM_ABI std::optional< GIConstant > getConstant(Register Const, const MachineRegisterInfo &MRI)

GIConstantKind getKind() const

Returns the kind of of this constant, e.g, Scalar.

Definition Utils.h:665

GIConstantKind

Definition Utils.h:651

@ FixedVector

Definition Utils.h:651

@ ScalableVector

Definition Utils.h:651

@ Scalar

Definition Utils.h:651

GIConstant(ArrayRef< APInt > Values)

Definition Utils.h:659

This is an important class for using LLVM in a threaded context.

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.

MachineRegisterInfo - Keep track of information for virtual and physical registers,...

Analysis providing profile information.

RegOrConstant(Register Reg)

Definition Utils.h:410

Register getReg() const

Definition Utils.h:414

bool isCst() const

Definition Utils.h:413

int64_t getCst() const

Definition Utils.h:418

RegOrConstant(int64_t Cst)

Definition Utils.h:411

bool isReg() const

Definition Utils.h:412

Holds all the information related to register banks.

Wrapper class representing virtual and physical registers.

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.

LLVM Value Representation.

@ C

The default llvm calling convention, compatible with C.

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.

LLVM_ABI std::optional< SmallVector< APInt > > ConstantFoldICmp(unsigned Pred, const Register Op1, const Register Op2, unsigned DstScalarSizeInBits, unsigned ExtOp, const MachineRegisterInfo &MRI)

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...

LLVM_ABI Type * getTypeForLLT(LLT Ty, LLVMContext &C)

Get the type back from LLT.

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...

LLVM_ABI MachineInstr * getOpcodeDef(unsigned Opcode, Register Reg, const MachineRegisterInfo &MRI)

See if Reg is defined by an single def instruction that is Opcode.

LLVM_ABI const ConstantFP * getConstantFPVRegVal(Register VReg, const MachineRegisterInfo &MRI)

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.

LLVM_ABI std::optional< APFloat > ConstantFoldIntToFloat(unsigned Opcode, LLT DstTy, Register Src, const MachineRegisterInfo &MRI)

LLVM_ABI std::optional< APInt > getIConstantSplatVal(const Register Reg, const MachineRegisterInfo &MRI)

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...

LLVM_ABI std::optional< APFloat > ConstantFoldFPBinOp(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)

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...

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...

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.

LLVM_ABI std::optional< APInt > ConstantFoldExtOp(unsigned Opcode, const Register Op1, uint64_t Imm, const MachineRegisterInfo &MRI)

LLVM_ABI std::optional< RegOrConstant > getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI)

GISelWorkList< 4 > SmallInstListTy

Definition Utils.h:579

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.

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...

LLVM_ABI MachineInstr * getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI)

Find the def instruction for Reg, folding away any trivial copies.

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...

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.

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...

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...

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.

LLVM_ABI std::optional< APInt > ConstantFoldBinOp(unsigned Opcode, const Register Op1, const Register Op2, const MachineRegisterInfo &MRI)

auto dyn_cast_or_null(const Y &Val)

LLVM_ABI const APInt & getIConstantFromReg(Register VReg, const MachineRegisterInfo &MRI)

VReg is defined by a G_CONSTANT, return the corresponding value.

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.

LLVM_ABI bool canReplaceReg(Register DstReg, Register SrcReg, MachineRegisterInfo &MRI)

Check if DstReg can be replaced with SrcReg depending on the register constraints.

LLVM_ABI void saveUsesAndErase(MachineInstr &MI, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver, SmallInstListTy &DeadInstChain)

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.

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...

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...

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.

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.

LLVM_ABI std::optional< APInt > ConstantFoldCastOp(unsigned Opcode, LLT DstTy, const Register Op0, const MachineRegisterInfo &MRI)

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...

LLVM_ABI void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)

Modify analysis usage so it preserves passes required for the SelectionDAG fallback.

LLVM_ABI LLVM_READNONE LLT getCoverTy(LLT OrigTy, LLT TargetTy)

Return smallest type that covers both OrigTy and TargetTy and is multiple of TargetTy.

LLVM_ABI unsigned getInverseGMinMaxOpcode(unsigned MinMaxOpc)

Returns the inverse opcode of MinMaxOpc, which is a generic min/max opcode like G_SMIN.

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...

LLVM_ABI bool isConstFalseVal(const TargetLowering &TLI, int64_t Val, bool IsVector, bool IsFP)

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.

LLVM_ABI APFloat getAPFloatFromSize(double Val, unsigned Size)

Returns an APFloat from Val converted to the appropriate size.

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 ...

LLVM_ABI void eraseInstr(MachineInstr &MI, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver=nullptr)

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.

LLVM_ABI int64_t getICmpTrueVal(const TargetLowering &TLI, bool IsVector, bool IsFP)

Returns an integer representing true, as defined by the TargetBooleanContents.

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...

LLVM_ABI bool isPreISelGenericFloatingPointOpcode(unsigned Opc)

Returns whether opcode Opc is a pre-isel generic floating-point opcode, having only floating-point op...

bool isKnownNeverSNaN(Register Val, const MachineRegisterInfo &MRI)

Returns true if Val can be assumed to never be a signaling NaN.

Definition Utils.h:349

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.

LLVM_ABI void eraseInstrs(ArrayRef< MachineInstr * > DeadInstrs, MachineRegisterInfo &MRI, LostDebugLocObserver *LocObserver=nullptr)

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.

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.

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)

LLVM_ABI bool isAssertMI(const MachineInstr &MI)

Returns true if the instruction MI is one of the assert instructions.

LLVM_ABI void extractVectorParts(Register Reg, unsigned NumElts, SmallVectorImpl< Register > &VRegs, MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)

Version which handles irregular sub-vector splits.

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...

LLVM_ABI Align inferAlignFromPtrInfo(MachineFunction &MF, const MachinePointerInfo &MPO)

Simple struct used to hold a Register value and the instruction which defines it.

Definition Utils.h:231

Register Reg

Definition Utils.h:233

MachineInstr * MI

Definition Utils.h:232

Register VReg

Definition Utils.h:210

APFloat Value

Definition Utils.h:209

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

APInt Value

Definition Utils.h:191

Register VReg

Definition Utils.h:192