LLVM  15.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 MachineIRBuilder;
28 class Type;
29 
31 public:
33 
34  bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
36  Register SwiftErrorVReg) const override;
37 
38  bool fallBackToDAGISel(const MachineFunction &MF) const override;
39 
40  bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
42  FunctionLoweringInfo &FLI) const override;
43 
44  bool lowerCall(MachineIRBuilder &MIRBuilder,
45  CallLoweringInfo &Info) const override;
46 
47  /// Returns true if the call can be lowered as a tail call.
48  bool
52  SmallVectorImpl<ArgInfo> &OutArgs) const;
53 
54  bool supportSwiftError() const override { return true; }
55 
56  bool isTypeIsValidForThisReturn(EVT Ty) const override;
57 
58 private:
59  using RegHandler = std::function<void(MachineIRBuilder &, Type *, unsigned,
60  CCValAssign &)>;
61 
62  using MemHandler =
64 
65  bool lowerTailCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info,
66  SmallVectorImpl<ArgInfo> &OutArgs) const;
67 
68  bool
69  doCallerAndCalleePassArgsTheSameWay(CallLoweringInfo &Info,
70  MachineFunction &MF,
71  SmallVectorImpl<ArgInfo> &InArgs) const;
72 
73  bool
74  areCalleeOutgoingArgsTailCallable(CallLoweringInfo &Info, MachineFunction &MF,
75  SmallVectorImpl<ArgInfo> &OutArgs) const;
76 };
77 
78 } // end namespace llvm
79 
80 #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:347
llvm::AArch64CallLowering::supportSwiftError
bool supportSwiftError() const override
Definition: AArch64CallLowering.h:54
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
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:1072
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:526
llvm::Function
Definition: Function.h:60
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:55
llvm::CCValAssign
CCValAssign - Represent assignment of one arg/retval to a location.
Definition: CallingConvLower.h:31
llvm::EVT
Extended Value Type.
Definition: ValueTypes.h:34
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:219
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:82
llvm::MachineFunction
Definition: MachineFunction.h:241
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:30
llvm::CallLowering::CallLoweringInfo
Definition: CallLowering.h:102
llvm::AArch64CallLowering::fallBackToDAGISel
bool fallBackToDAGISel(const MachineFunction &MF) const override
Definition: AArch64CallLowering.cpp:510
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:1232
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
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:777
llvm::AArch64TargetLowering
Definition: AArch64ISelLowering.h:492
llvm::AArch64CallLowering::AArch64CallLowering
AArch64CallLowering(const AArch64TargetLowering &TLI)
Definition: AArch64CallLowering.cpp:52
llvm::CallLowering
Definition: CallLowering.h:44
llvm::Value
LLVM Value Representation.
Definition: Value.h:74