1 //===- AMDGPULegalizerInfo ---------------------------------------*- 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 declares the targeting of the Machinelegalizer class for
11 /// \todo This should be generated by TableGen.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINELEGALIZER_H
15 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINELEGALIZER_H
17 #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
18 #include "AMDGPUArgumentUsageInfo.h"
22 class GCNTargetMachine
;
26 /// This class provides the information for the target register banks.
27 class AMDGPULegalizerInfo
: public LegalizerInfo
{
28 const GCNSubtarget
&ST
;
31 AMDGPULegalizerInfo(const GCNSubtarget
&ST
,
32 const GCNTargetMachine
&TM
);
34 bool legalizeCustom(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
36 GISelChangeObserver
&Observer
) const override
;
38 Register
getSegmentAperture(unsigned AddrSpace
,
39 MachineRegisterInfo
&MRI
,
40 MachineIRBuilder
&B
) const;
42 bool legalizeAddrSpaceCast(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
43 MachineIRBuilder
&B
) const;
44 bool legalizeFrint(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
45 MachineIRBuilder
&B
) const;
46 bool legalizeFceil(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
47 MachineIRBuilder
&B
) const;
48 bool legalizeIntrinsicTrunc(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
49 MachineIRBuilder
&B
) const;
50 bool legalizeITOFP(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
51 MachineIRBuilder
&B
, bool Signed
) const;
52 bool legalizeMinNumMaxNum(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
53 MachineIRBuilder
&B
) const;
54 bool legalizeExtractVectorElt(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
55 MachineIRBuilder
&B
) const;
56 bool legalizeInsertVectorElt(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
57 MachineIRBuilder
&B
) const;
58 bool legalizeSinCos(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
59 MachineIRBuilder
&B
) const;
61 bool legalizeGlobalValue(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
62 MachineIRBuilder
&B
) const;
63 bool legalizeLoad(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
65 GISelChangeObserver
&Observer
) const;
67 bool legalizeFMad(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
68 MachineIRBuilder
&B
) const;
70 Register
getLiveInRegister(MachineRegisterInfo
&MRI
,
71 Register Reg
, LLT Ty
) const;
73 bool loadInputValue(Register DstReg
, MachineIRBuilder
&B
,
74 const ArgDescriptor
*Arg
) const;
75 bool legalizePreloadedArgIntrin(
76 MachineInstr
&MI
, MachineRegisterInfo
&MRI
, MachineIRBuilder
&B
,
77 AMDGPUFunctionArgInfo::PreloadedValue ArgType
) const;
79 bool legalizeFDIVFast(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
80 MachineIRBuilder
&B
) const;
82 bool legalizeImplicitArgPtr(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
83 MachineIRBuilder
&B
) const;
84 bool legalizeIsAddrSpace(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
85 MachineIRBuilder
&B
, unsigned AddrSpace
) const;
87 Register
handleD16VData(MachineIRBuilder
&B
, MachineRegisterInfo
&MRI
,
89 bool legalizeRawBufferStore(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
90 MachineIRBuilder
&B
, bool IsFormat
) const;
91 bool legalizeIntrinsic(MachineInstr
&MI
, MachineRegisterInfo
&MRI
,
92 MachineIRBuilder
&B
) const override
;
95 } // End llvm namespace.