LLVM  14.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 
19 namespace llvm {
20 
21 class AMDGPUTargetLowering;
22 class GCNSubtarget;
23 class MachineInstrBuilder;
24 class SIMachineFunctionInfo;
25 
26 class 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,
39 
40 public:
42 
43  bool lowerReturn(MachineIRBuilder &B, const Value *Val,
44  ArrayRef<Register> VRegs,
45  FunctionLoweringInfo &FLI) const override;
46 
48  ArrayRef<ArrayRef<Register>> VRegs) const;
49 
52  FunctionLoweringInfo &FLI) const override;
53 
54  bool passSpecialInputs(MachineIRBuilder &MIRBuilder,
55  CCState &CCInfo,
56  SmallVectorImpl<std::pair<MCRegister, Register>> &ArgRegs,
57  CallLoweringInfo &Info) const;
58 
59  bool
61  MachineFunction &MF,
62  SmallVectorImpl<ArgInfo> &InArgs) const;
63 
64  bool
66  SmallVectorImpl<ArgInfo> &OutArgs) const;
67 
68  /// Returns true if the call can be lowered as a tail call.
69  bool
73  SmallVectorImpl<ArgInfo> &OutArgs) const;
74 
77  const GCNSubtarget &ST, const SIMachineFunctionInfo &MFI,
78  ArrayRef<std::pair<MCRegister, Register>> ImplicitArgRegs) const;
79 
81  SmallVectorImpl<ArgInfo> &OutArgs) const;
82  bool lowerCall(MachineIRBuilder &MIRBuilder,
83  CallLoweringInfo &Info) const override;
84 
85  static CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg);
86  static CCAssignFn *CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg);
87 };
88 } // End of namespace llvm;
89 #endif
llvm::AMDGPUCallLowering::handleImplicitCallArguments
void handleImplicitCallArguments(MachineIRBuilder &MIRBuilder, MachineInstrBuilder &CallInst, const GCNSubtarget &ST, const SIMachineFunctionInfo &MFI, ArrayRef< std::pair< MCRegister, Register >> ImplicitArgRegs) const
Definition: AMDGPUCallLowering.cpp:1113
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::AMDGPUTargetLowering
Definition: AMDGPUISelLowering.h:27
CallLowering.h
llvm::CCState
CCState - This class holds information needed while lowering arguments and return values.
Definition: CallingConvLower.h:191
llvm::Function
Definition: Function.h:61
llvm::AMDGPUCallLowering::AMDGPUCallLowering
AMDGPUCallLowering(const AMDGPUTargetLowering &TLI)
Definition: AMDGPUCallLowering.cpp:235
llvm::AMDGPUCallLowering::lowerCall
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
Definition: AMDGPUCallLowering.cpp:1270
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::GCNSubtarget
Definition: GCNSubtarget.h:31
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::AMDGPUCallLowering::isEligibleForTailCallOptimization
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.
Definition: AMDGPUCallLowering.cpp:1058
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::AMDGPUCallLowering::CCAssignFnForCall
static CCAssignFn * CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg)
Definition: AMDGPUISelLowering.cpp:980
llvm::CallLowering::ArgInfo
Definition: CallLowering.h:61
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::AMDGPUCallLowering::lowerFormalArgumentsKernel
bool lowerFormalArgumentsKernel(MachineIRBuilder &B, const Function &F, ArrayRef< ArrayRef< Register >> VRegs) const
Definition: AMDGPUCallLowering.cpp:493
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::AMDGPUCallLowering::passSpecialInputs
bool passSpecialInputs(MachineIRBuilder &MIRBuilder, CCState &CCInfo, SmallVectorImpl< std::pair< MCRegister, Register >> &ArgRegs, CallLoweringInfo &Info) const
Definition: AMDGPUCallLowering.cpp:750
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::AMDGPUCallLowering::lowerTailCall
bool lowerTailCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info, SmallVectorImpl< ArgInfo > &OutArgs) const
Definition: AMDGPUCallLowering.cpp:1132
llvm::CCAssignFn
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
Definition: CallingConvLower.h:177
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:212
llvm::AMDGPUCallLowering::doCallerAndCalleePassArgsTheSameWay
bool doCallerAndCalleePassArgsTheSameWay(CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &InArgs) const
Definition: AMDGPUCallLowering.cpp:959
llvm::MachineInstrBuilder
Definition: MachineInstrBuilder.h:69
uint64_t
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::AMDGPUCallLowering
Definition: AMDGPUCallLowering.h:26
llvm::FunctionLoweringInfo
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Definition: FunctionLoweringInfo.h:53
llvm::MachineFunction
Definition: MachineFunction.h:230
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::Register
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
llvm::CallLowering::CallLoweringInfo
Definition: CallLowering.h:101
llvm::AMDGPUCallLowering::CCAssignFnForReturn
static CCAssignFn * CCAssignFnForReturn(CallingConv::ID CC, bool IsVarArg)
Definition: AMDGPUISelLowering.cpp:1004
llvm::SIMachineFunctionInfo
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
Definition: SIMachineFunctionInfo.h:335
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::AMDGPUCallLowering::lowerFormalArguments
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,...
Definition: AMDGPUCallLowering.cpp:567
llvm::CallInst
This class represents a function call, abstracting a target machine's calling convention.
Definition: Instructions.h:1475
llvm::AMDGPUCallLowering::areCalleeOutgoingArgsTailCallable
bool areCalleeOutgoingArgsTailCallable(CallLoweringInfo &Info, MachineFunction &MF, SmallVectorImpl< ArgInfo > &OutArgs) const
Definition: AMDGPUCallLowering.cpp:1001
llvm::CallLowering
Definition: CallLowering.h:43
llvm::AMDGPUCallLowering::lowerReturn
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...
Definition: AMDGPUCallLowering.cpp:335
llvm::Value
LLVM Value Representation.
Definition: Value.h:75