LLVM 22.0.0git
AMDGPUCallLowering.h
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H
15#define LLVM_LIB_TARGET_AMDGPU_AMDGPUCALLLOWERING_H
16
18
19namespace llvm {
20
22class GCNSubtarget;
25
26class AMDGPUCallLowering final : public CallLowering {
27 void lowerParameterPtr(Register DstReg, MachineIRBuilder &B,
28 uint64_t Offset) const;
29
30 void lowerParameter(MachineIRBuilder &B, ArgInfo &AI, uint64_t Offset,
31 Align Alignment) const;
32
33 bool canLowerReturn(MachineFunction &MF, CallingConv::ID CallConv,
35 bool IsVarArg) const override;
36
37 bool lowerReturnVal(MachineIRBuilder &B, const Value *Val,
38 ArrayRef<Register> VRegs, MachineInstrBuilder &Ret) const;
39
40 void addOriginalExecToReturn(MachineFunction &MF,
41 MachineInstrBuilder &Ret) const;
42
43public:
45
46 bool lowerReturn(MachineIRBuilder &B, const Value *Val,
48 FunctionLoweringInfo &FLI) const override;
49
51 ArrayRef<ArrayRef<Register>> VRegs) const;
52
55 FunctionLoweringInfo &FLI) const override;
56
57 bool passSpecialInputs(MachineIRBuilder &MIRBuilder,
58 CCState &CCInfo,
59 SmallVectorImpl<std::pair<MCRegister, Register>> &ArgRegs,
60 CallLoweringInfo &Info) const;
61
62 bool
65 SmallVectorImpl<ArgInfo> &InArgs) const;
66
67 bool
69 SmallVectorImpl<ArgInfo> &OutArgs) const;
70
71 /// Returns true if the call can be lowered as a tail call.
72 bool
76 SmallVectorImpl<ArgInfo> &OutArgs) const;
77
80 const GCNSubtarget &ST, const SIMachineFunctionInfo &MFI,
81 CallingConv::ID CalleeCC,
82 ArrayRef<std::pair<MCRegister, Register>> ImplicitArgRegs) const;
83
85 SmallVectorImpl<ArgInfo> &OutArgs) const;
86 bool lowerChainCall(MachineIRBuilder &MIRBuilder,
87 CallLoweringInfo &Info) const;
88 bool lowerCall(MachineIRBuilder &MIRBuilder,
89 CallLoweringInfo &Info) const override;
90
91 static CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg);
92 static CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg);
93};
94} // End of namespace llvm;
95#endif
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Analysis containing CSE Info
Definition CSEInfo.cpp:27
This file describes how to lower LLVM calls to machine code calls.
#define F(x, y, z)
Definition MD5.cpp:55
bool lowerTailCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info, SmallVectorImpl< ArgInfo > &OutArgs) const
bool isEligibleForTailCallOptimization(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info, SmallVectorImpl< ArgInfo > &InArgs, SmallVectorImpl< ArgInfo > &OutArgs) const
Returns true if the call can be lowered as a tail call.
bool lowerFormalArgumentsKernel(MachineIRBuilder &B, const Function &F, ArrayRef< ArrayRef< Register > > VRegs) const
bool lowerReturn(MachineIRBuilder &B, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI) const override
This hook behaves as the extended lowerReturn function, but for targets that do not support swifterro...
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
void handleImplicitCallArguments(MachineIRBuilder &MIRBuilder, MachineInstrBuilder &CallInst, const GCNSubtarget &ST, const SIMachineFunctionInfo &MFI, CallingConv::ID CalleeCC, ArrayRef< std::pair< MCRegister, Register > > ImplicitArgRegs) const
static CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg)
bool areCalleeOutgoingArgsTailCallable(CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &OutArgs) const
bool lowerChainCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const
Lower a call to the @llvm.amdgcn.cs.chain intrinsic.
AMDGPUCallLowering(const AMDGPUTargetLowering &TLI)
bool passSpecialInputs(MachineIRBuilder &MIRBuilder, CCState &CCInfo, SmallVectorImpl< std::pair< MCRegister, Register > > &ArgRegs, CallLoweringInfo &Info) const
bool lowerFormalArguments(MachineIRBuilder &B, const Function &F, ArrayRef< ArrayRef< Register > > VRegs, FunctionLoweringInfo &FLI) const override
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs,...
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
bool doCallerAndCalleePassArgsTheSameWay(CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &InArgs) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
CCState - This class holds information needed while lowering arguments and return values.
This class represents a function call, abstracting a target machine's calling convention.
CallLowering(const TargetLowering *TLI)
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Helper class to build MachineInstr.
Wrapper class representing virtual and physical registers.
Definition Register.h:19
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LLVM Value Representation.
Definition Value.h:75
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39