1 //===-- SPIRVInstrInfo.h - SPIR-V Instruction Information -------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file contains the SPIR-V implementation of the TargetInstrInfo class.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_SPIRV_SPIRVINSTRINFO_H
14 #define LLVM_LIB_TARGET_SPIRV_SPIRVINSTRINFO_H
16 #include "SPIRVRegisterInfo.h"
17 #include "llvm/CodeGen/TargetInstrInfo.h"
19 #define GET_INSTRINFO_HEADER
20 #include "SPIRVGenInstrInfo.inc"
24 class SPIRVInstrInfo
: public SPIRVGenInstrInfo
{
25 const SPIRVRegisterInfo RI
;
30 const SPIRVRegisterInfo
&getRegisterInfo() const { return RI
; }
31 bool isHeaderInstr(const MachineInstr
&MI
) const;
32 bool isConstantInstr(const MachineInstr
&MI
) const;
33 bool isTypeDeclInstr(const MachineInstr
&MI
) const;
34 bool isDecorationInstr(const MachineInstr
&MI
) const;
35 bool canUseFastMathFlags(const MachineInstr
&MI
) const;
36 bool canUseNSW(const MachineInstr
&MI
) const;
37 bool canUseNUW(const MachineInstr
&MI
) const;
39 bool analyzeBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*&TBB
,
40 MachineBasicBlock
*&FBB
,
41 SmallVectorImpl
<MachineOperand
> &Cond
,
42 bool AllowModify
= false) const override
;
44 unsigned removeBranch(MachineBasicBlock
&MBB
,
45 int *BytesRemoved
= nullptr) const override
;
47 unsigned insertBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*TBB
,
48 MachineBasicBlock
*FBB
, ArrayRef
<MachineOperand
> Cond
,
50 int *BytesAdded
= nullptr) const override
;
51 void copyPhysReg(MachineBasicBlock
&MBB
, MachineBasicBlock::iterator I
,
52 const DebugLoc
&DL
, MCRegister DestReg
, MCRegister SrcReg
,
53 bool KillSrc
) const override
;
54 bool expandPostRAPseudo(MachineInstr
&MI
) const override
;
60 ASM_PRINTER_WIDTH16
= MachineInstr::TAsmComments
66 #endif // LLVM_LIB_TARGET_SPIRV_SPIRVINSTRINFO_H