Path: blob/main/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h
35268 views
//===- lib/Target/AMDGPU/AMDGPUCallLowering.h - Call lowering -*- C++ -*---===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file describes how to lower LLVM calls to machine code calls.10///11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H14#define LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H1516#include "llvm/CodeGen/GlobalISel/CallLowering.h"1718namespace llvm {1920class AMDGPUTargetLowering;21class GCNSubtarget;22class MachineInstrBuilder;23class SIMachineFunctionInfo;2425class AMDGPUCallLowering final : public CallLowering {26void lowerParameterPtr(Register DstReg, MachineIRBuilder &B,27uint64_t Offset) const;2829void lowerParameter(MachineIRBuilder &B, ArgInfo &AI, uint64_t Offset,30Align Alignment) const;3132bool canLowerReturn(MachineFunction &MF, CallingConv::ID CallConv,33SmallVectorImpl<BaseArgInfo> &Outs,34bool IsVarArg) const override;3536bool lowerReturnVal(MachineIRBuilder &B, const Value *Val,37ArrayRef<Register> VRegs, MachineInstrBuilder &Ret) const;3839public:40AMDGPUCallLowering(const AMDGPUTargetLowering &TLI);4142bool lowerReturn(MachineIRBuilder &B, const Value *Val,43ArrayRef<Register> VRegs,44FunctionLoweringInfo &FLI) const override;4546bool lowerFormalArgumentsKernel(MachineIRBuilder &B, const Function &F,47ArrayRef<ArrayRef<Register>> VRegs) const;4849bool lowerFormalArguments(MachineIRBuilder &B, const Function &F,50ArrayRef<ArrayRef<Register>> VRegs,51FunctionLoweringInfo &FLI) const override;5253bool passSpecialInputs(MachineIRBuilder &MIRBuilder,54CCState &CCInfo,55SmallVectorImpl<std::pair<MCRegister, Register>> &ArgRegs,56CallLoweringInfo &Info) const;5758bool59doCallerAndCalleePassArgsTheSameWay(CallLoweringInfo &Info,60MachineFunction &MF,61SmallVectorImpl<ArgInfo> &InArgs) const;6263bool64areCalleeOutgoingArgsTailCallable(CallLoweringInfo &Info, MachineFunction &MF,65SmallVectorImpl<ArgInfo> &OutArgs) const;6667/// Returns true if the call can be lowered as a tail call.68bool69isEligibleForTailCallOptimization(MachineIRBuilder &MIRBuilder,70CallLoweringInfo &Info,71SmallVectorImpl<ArgInfo> &InArgs,72SmallVectorImpl<ArgInfo> &OutArgs) const;7374void handleImplicitCallArguments(75MachineIRBuilder &MIRBuilder, MachineInstrBuilder &CallInst,76const GCNSubtarget &ST, const SIMachineFunctionInfo &MFI,77CallingConv::ID CalleeCC,78ArrayRef<std::pair<MCRegister, Register>> ImplicitArgRegs) const;7980bool lowerTailCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info,81SmallVectorImpl<ArgInfo> &OutArgs) const;82bool lowerChainCall(MachineIRBuilder &MIRBuilder,83CallLoweringInfo &Info) const;84bool lowerCall(MachineIRBuilder &MIRBuilder,85CallLoweringInfo &Info) const override;8687static CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg);88static CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg);89};90} // End of namespace llvm;91#endif929394