[InstCombine] Signed saturation patterns
[llvm-complete.git] / lib / Target / AMDGPU / AMDGPUCallLowering.h
blob53a562586bc0654e54c6e70212fbe112c241d5b2
1 //===- lib/Target/AMDGPU/AMDGPUCallLowering.h - Call lowering -*- 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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file describes how to lower LLVM calls to machine code calls.
11 ///
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H
15 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H
17 #include "AMDGPU.h"
18 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
20 namespace llvm {
22 class AMDGPUTargetLowering;
23 class MachineInstrBuilder;
25 class AMDGPUCallLowering: public CallLowering {
26 Register lowerParameterPtr(MachineIRBuilder &B, Type *ParamTy,
27 uint64_t Offset) const;
29 void lowerParameter(MachineIRBuilder &B, Type *ParamTy, uint64_t Offset,
30 unsigned Align, Register DstReg) const;
32 /// A function of this type is used to perform value split action.
33 using SplitArgTy = std::function<void(ArrayRef<Register>, LLT, LLT, int)>;
35 void splitToValueTypes(const ArgInfo &OrigArgInfo,
36 SmallVectorImpl<ArgInfo> &SplitArgs,
37 const DataLayout &DL, MachineRegisterInfo &MRI,
38 CallingConv::ID CallConv,
39 SplitArgTy SplitArg) const;
41 bool lowerReturnVal(MachineIRBuilder &B, const Value *Val,
42 ArrayRef<Register> VRegs, MachineInstrBuilder &Ret) const;
44 public:
45 AMDGPUCallLowering(const AMDGPUTargetLowering &TLI);
47 bool lowerReturn(MachineIRBuilder &B, const Value *Val,
48 ArrayRef<Register> VRegs) const override;
50 bool lowerFormalArgumentsKernel(MachineIRBuilder &B, const Function &F,
51 ArrayRef<ArrayRef<Register>> VRegs) const;
53 bool lowerFormalArguments(MachineIRBuilder &B, const Function &F,
54 ArrayRef<ArrayRef<Register>> VRegs) const override;
55 static CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg);
56 static CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg);
58 } // End of namespace llvm;
59 #endif