LLVM  14.0.0git
AArch64CallLowering.h
Go to the documentation of this file.
1 //===- AArch64CallLowering.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_AARCH64_AARCH64CALLLOWERING_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
16 
17 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/IR/CallingConv.h"
20 #include <cstdint>
21 #include <functional>
22 
23 namespace llvm {
24 
25 class AArch64TargetLowering;
26 class CCValAssign;
27 class DataLayout;
28 class MachineIRBuilder;
29 class MachineRegisterInfo;
30 class Type;
31 
33 public:
35 
36  bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
38  Register SwiftErrorVReg) const override;
39 
40  bool fallBackToDAGISel(const MachineFunction &MF) const override;
41 
42  bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
44  FunctionLoweringInfo &FLI) const override;
45 
46  bool lowerCall(MachineIRBuilder &MIRBuilder,
47  CallLoweringInfo &Info) const override;
48 
49  /// Returns true if the call can be lowered as a tail call.
50  bool
54  SmallVectorImpl<ArgInfo> &OutArgs) const;
55 
56  bool supportSwiftError() const override { return true; }
57 
58  bool isTypeIsValidForThisReturn(EVT Ty) const override;
59 
60 private:
61  using RegHandler = std::function<void(MachineIRBuilder &, Type *, unsigned,
62  CCValAssign &)>;
63 
64  using MemHandler =
66 
67  bool lowerTailCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info,
68  SmallVectorImpl<ArgInfo> &OutArgs) const;
69 
70  bool
71  doCallerAndCalleePassArgsTheSameWay(CallLoweringInfo &Info,
72  MachineFunction &MF,
73  SmallVectorImpl<ArgInfo> &InArgs) const;
74 
75  bool
76  areCalleeOutgoingArgsTailCallable(CallLoweringInfo &Info, MachineFunction &MF,
77  SmallVectorImpl<ArgInfo> &OutArgs) const;
78 };
79 
80 } // end namespace llvm
81 
82 #endif // LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
llvm::AArch64CallLowering::lowerReturn
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI, Register SwiftErrorVReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
Definition: AArch64CallLowering.cpp:346
llvm::AArch64CallLowering::supportSwiftError
bool supportSwiftError() const override
Definition: AArch64CallLowering.h:56
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::AArch64CallLowering::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: AArch64CallLowering.cpp:1071
CallLowering.h
llvm::AArch64CallLowering::lowerFormalArguments
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, 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: AArch64CallLowering.cpp:525
llvm::Function
Definition: Function.h:62
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::CCValAssign
CCValAssign - Represent assignment of one arg/retval to a location.
Definition: CallingConvLower.h:33
llvm::EVT
Extended Value Type.
Definition: ValueTypes.h:35
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:212
ArrayRef.h
TemplateParamKind::Type
@ Type
llvm::FunctionLoweringInfo
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Definition: FunctionLoweringInfo.h:52
function
print Print MemDeps of function
Definition: MemDepPrinter.cpp:83
llvm::MachineFunction
Definition: MachineFunction.h:234
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
CallingConv.h
llvm::AArch64CallLowering
Definition: AArch64CallLowering.h:32
llvm::CallLowering::CallLoweringInfo
Definition: CallLowering.h:101
llvm::AArch64CallLowering::fallBackToDAGISel
bool fallBackToDAGISel(const MachineFunction &MF) const override
Definition: AArch64CallLowering.cpp:509
llvm::AArch64CallLowering::isTypeIsValidForThisReturn
bool isTypeIsValidForThisReturn(EVT Ty) const override
For targets which support the "returned" parameter attribute, returns true if the given type is a val...
Definition: AArch64CallLowering.cpp:1205
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::AArch64CallLowering::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: AArch64CallLowering.cpp:776
llvm::AArch64TargetLowering
Definition: AArch64ISelLowering.h:488
llvm::AArch64CallLowering::AArch64CallLowering
AArch64CallLowering(const AArch64TargetLowering &TLI)
Definition: AArch64CallLowering.cpp:51
llvm::CallLowering
Definition: CallLowering.h:43
llvm::Value
LLVM Value Representation.
Definition: Value.h:74