LLVM 22.0.0git
SPIRVCombinerHelper.h
Go to the documentation of this file.
1//===-- SPIRVCombinerHelper.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/// This contains common combine transformations that may be used in a combine
10/// pass.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H
15#define LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H
16
17#include "SPIRVSubtarget.h"
19
20namespace llvm {
22protected:
24
25public:
30 const SPIRVSubtarget &STI);
31
40
41private:
42 SPIRVType *getDotProductVectorType(Register ResReg, uint32_t K,
43 SPIRVGlobalRegistry *GR) const;
44 SmallVector<Register, 4> extractColumns(Register BReg, uint32_t N,
45 SPIRVType *SpvVecType,
46 SPIRVGlobalRegistry *GR) const;
47 SmallVector<Register, 4> extractRows(Register AReg, uint32_t NumRows,
48 uint32_t NumCols, SPIRVType *SpvRowType,
49 SPIRVGlobalRegistry *GR) const;
51 computeDotProducts(const SmallVector<Register, 4> &RowsA,
52 const SmallVector<Register, 4> &ColsB,
53 SPIRVType *SpvVecType, SPIRVGlobalRegistry *GR) const;
54 Register computeDotProduct(Register RowA, Register ColB,
55 SPIRVType *SpvVecType,
56 SPIRVGlobalRegistry *GR) const;
57};
58
59} // end namespace llvm
60
61#endif // LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H
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...
IRTranslator LLVM IR MI
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
void applyMatrixMultiply(MachineInstr &MI) const
bool matchSelectToFaceForward(MachineInstr &MI) const
This match is part of a combine that rewrites select(fcmp(dot(I, Ng), 0), N, -N) to faceforward(N,...
void applyMatrixTranspose(MachineInstr &MI) const
bool matchMatrixTranspose(MachineInstr &MI) const
CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B, bool IsPreLegalize, GISelValueTracking *VT=nullptr, MachineDominatorTree *MDT=nullptr, const LegalizerInfo *LI=nullptr)
void applySPIRVFaceForward(MachineInstr &MI) const
SPIRVCombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B, bool IsPreLegalize, GISelValueTracking *VT, MachineDominatorTree *MDT, const LegalizerInfo *LI, const SPIRVSubtarget &STI)
bool matchMatrixMultiply(MachineInstr &MI) const
const SPIRVSubtarget & STI
void applySPIRVDistance(MachineInstr &MI) const
bool matchLengthToDistance(MachineInstr &MI) const
This match is part of a combine that rewrites length(X - Y) to distance(X, Y) (f32 (g_intrinsic lengt...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
const MachineInstr SPIRVType
#define N