LLVM 24.0.0git
AMDGPUCombinerHelper.h
Go to the documentation of this file.
1//=== lib/CodeGen/GlobalISel/AMDGPUCombinerHelper.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
10/// This contains common combine transformations that may be used in a combine
11/// pass.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCOMBINERHELPER_H
16#define LLVM_LIB_TARGET_AMDGPU_AMDGPUCOMBINERHELPER_H
17
18#include "GCNSubtarget.h"
21
22namespace llvm {
24protected:
27
28public:
33 const GCNSubtarget &STI);
34
35 bool matchFoldableFneg(MachineInstr &MI, MachineInstr *&MatchInfo) const;
36 void applyFoldableFneg(MachineInstr &MI, MachineInstr *&MatchInfo) const;
37
38 bool matchFoldFAbsFptrunc(MachineInstr &Fabs, MachineInstr &Fptrunc) const;
39 void applyFoldFAbsFptrunc(MachineInstr &Fabs, MachineInstr &Fptrunc) const;
40
42 Register Src1, Register Src2) const;
44 Register Src1, Register Src2) const;
45
48 std::function<void(MachineIRBuilder &)> &MatchInfo) const;
49
51
52 /// Match an s64 and/or where one operand is a 32-bit mask (see
53 /// matchConstantIs32BitMask), used to narrow it into two s32 ops. Bails when
54 /// both operands are constants, since folding the binop to a single constant
55 /// is strictly better than narrowing.
57
58 /// fmin_legacy/fmax_legacy select s1 on NaN, and on a +0.0/-0.0 tie (s1 for
59 /// min, s0 for max). Returns true if that tie cannot be observed: nsz on
60 /// \p MI, or a known non-logical-zero \p LHS or \p RHS.
62 Register RHS) const;
63};
64
65} // namespace llvm
66
67#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPUCOMBINERHELPER_H
#define X(NUM, ENUM, NAME)
Definition ELF.h:857
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This contains common combine transformations that may be used in a combine pass,or by the target else...
This contains the base class for all Combiners generated by TableGen.
AMD GCN specific subclass of TargetSubtarget.
IRTranslator LLVM IR MI
Register Reg
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
Value * RHS
Value * LHS
bool matchFoldFAbsFptrunc(MachineInstr &Fabs, MachineInstr &Fptrunc) const
AMDGPUCombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B, bool IsPreLegalize, GISelValueTracking *VT, MachineDominatorTree *MDT, const LegalizerInfo *LI, const GCNSubtarget &STI)
bool matchConstantIs32BitMask(Register Reg) const
bool matchCombineFmulWithSelectToFldexp(MachineInstr &MI, MachineInstr &Sel, std::function< void(MachineIRBuilder &)> &MatchInfo) const
LLVM_ABI CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B, bool IsPreLegalize, GISelValueTracking *VT=nullptr, MachineDominatorTree *MDT=nullptr, const LegalizerInfo *LI=nullptr)
bool matchExpandPromotedF16FMed3(MachineInstr &MI, Register Src0, Register Src1, Register Src2) const
void applyFoldableFneg(MachineInstr &MI, MachineInstr *&MatchInfo) const
bool matchFoldableFneg(MachineInstr &MI, MachineInstr *&MatchInfo) const
void applyFoldFAbsFptrunc(MachineInstr &Fabs, MachineInstr &Fptrunc) const
bool matchBinopWith32BitMask(Register X, Register Y) const
Match an s64 and/or where one operand is a 32-bit mask (see matchConstantIs32BitMask),...
void applyExpandPromotedF16FMed3(MachineInstr &MI, Register Src0, Register Src1, Register Src2) const
bool canIgnoreLegacyMinMaxTies(const MachineInstr &MI, Register LHS, Register RHS) const
fmin_legacy/fmax_legacy select s1 on NaN, and on a +0.0/-0.0 tie (s1 for min, s0 for max).
LLVM_ABI CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B, bool IsPreLegalize, GISelValueTracking *VT=nullptr, MachineDominatorTree *MDT=nullptr, const LegalizerInfo *LI=nullptr)
const LegalizerInfo * LI
MachineDominatorTree * MDT
GISelValueTracking * VT
GISelChangeObserver & Observer
Abstract class that contains various methods for clients to notify about changes.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Helper class to build MachineInstr.
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
This is an optimization pass for GlobalISel generic memory operations.