41 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8///9/// This contains common combine transformations that may be used in a combine10/// pass.11///12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H15#define LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H16 17#include "SPIRVSubtarget.h"18#include "llvm/CodeGen/GlobalISel/CombinerHelper.h"19 20namespace llvm {21class SPIRVCombinerHelper : public CombinerHelper {22protected:23 const SPIRVSubtarget &STI;24 25public:26 using CombinerHelper::CombinerHelper;27 SPIRVCombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B,28 bool IsPreLegalize, GISelValueTracking *VT,29 MachineDominatorTree *MDT, const LegalizerInfo *LI,30 const SPIRVSubtarget &STI);31 32 bool matchLengthToDistance(MachineInstr &MI) const;33 void applySPIRVDistance(MachineInstr &MI) const;34 bool matchSelectToFaceForward(MachineInstr &MI) const;35 void applySPIRVFaceForward(MachineInstr &MI) const;36};37 38} // end namespace llvm39 40#endif // LLVM_LIB_TARGET_SPIRV_SPIRVCOMBINERHELPER_H41