44 lines · c
1//===- SPIRVLegalizerInfo.h --- SPIR-V Legalization Rules --------*- 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 file declares the targeting of the MachineLegalizer class for SPIR-V.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_SPIRV_SPIRVMACHINELEGALIZER_H14#define LLVM_LIB_TARGET_SPIRV_SPIRVMACHINELEGALIZER_H15 16#include "SPIRVGlobalRegistry.h"17#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"18 19namespace llvm {20 21class LLVMContext;22class SPIRVSubtarget;23 24// This class provides the information for legalizing SPIR-V instructions.25class SPIRVLegalizerInfo : public LegalizerInfo {26 const SPIRVSubtarget *ST;27 SPIRVGlobalRegistry *GR;28 29public:30 bool legalizeCustom(LegalizerHelper &Helper, MachineInstr &MI,31 LostDebugLocObserver &LocObserver) const override;32 bool legalizeIntrinsic(LegalizerHelper &Helper,33 MachineInstr &MI) const override;34 35 SPIRVLegalizerInfo(const SPIRVSubtarget &ST);36 37private:38 bool legalizeIsFPClass(LegalizerHelper &Helper, MachineInstr &MI,39 LostDebugLocObserver &LocObserver) const;40 bool legalizeBitcast(LegalizerHelper &Helper, MachineInstr &MI) const;41};42} // namespace llvm43#endif // LLVM_LIB_TARGET_SPIRV_SPIRVMACHINELEGALIZER_H44