aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/SPIRV/SPIRVCombinerHelper.h
blob: 0b39d3408aab627ec50b3a2c344a86fa4646a8ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===-- SPIRVCombinerHelper.h -----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// This contains common combine transformations that may be used in a combine
/// pass.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H
#define LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H

#include "SPIRVSubtarget.h"
#include "llvm/CodeGen/GlobalISel/CombinerHelper.h"

namespace llvm {
class SPIRVCombinerHelper : public CombinerHelper {
protected:
  const SPIRVSubtarget &STI;

public:
  using CombinerHelper::CombinerHelper;
  SPIRVCombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B,
                      bool IsPreLegalize, GISelValueTracking *VT,
                      MachineDominatorTree *MDT, const LegalizerInfo *LI,
                      const SPIRVSubtarget &STI);

  bool matchLengthToDistance(MachineInstr &MI) const;
  void applySPIRVDistance(MachineInstr &MI) const;
};

} // end namespace llvm

#endif // LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H