LLVM 19.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
23namespace llvm {
24
25class AArch64TargetLowering;
26class CCValAssign;
27class MachineIRBuilder;
28class Type;
29
31public:
33
34 bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
36 Register SwiftErrorVReg) const override;
37
40 bool IsVarArg) const override;
41
42 bool fallBackToDAGISel(const MachineFunction &MF) const override;
43
44 bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
46 FunctionLoweringInfo &FLI) const override;
47
48 bool lowerCall(MachineIRBuilder &MIRBuilder,
49 CallLoweringInfo &Info) const override;
50
51 /// Returns true if the call can be lowered as a tail call.
52 bool
56 SmallVectorImpl<ArgInfo> &OutArgs) const;
57
58 bool supportSwiftError() const override { return true; }
59
60 bool isTypeIsValidForThisReturn(EVT Ty) const override;
61
62private:
63 using RegHandler = std::function<void(MachineIRBuilder &, Type *, unsigned,
64 CCValAssign &)>;
65
66 using MemHandler =
67 std::function<void(MachineIRBuilder &, int, CCValAssign &)>;
68
69 void saveVarArgRegisters(MachineIRBuilder &MIRBuilder,
71 CCState &CCInfo) const;
72
73 bool lowerTailCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info,
74 SmallVectorImpl<ArgInfo> &OutArgs) const;
75
76 bool
77 doCallerAndCalleePassArgsTheSameWay(CallLoweringInfo &Info,
79 SmallVectorImpl<ArgInfo> &InArgs) const;
80
81 bool
82 areCalleeOutgoingArgsTailCallable(CallLoweringInfo &Info, MachineFunction &MF,
83 SmallVectorImpl<ArgInfo> &OutArgs) const;
84};
85
86} // end namespace llvm
87
88#endif // LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
RelocType Type
Definition: COFFYAML.cpp:391
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 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...
bool canLowerReturn(MachineFunction &MF, CallingConv::ID CallConv, SmallVectorImpl< BaseArgInfo > &Outs, bool IsVarArg) const override
This hook must be implemented to check whether the return values described by Outs can fit into the r...
bool fallBackToDAGISel(const MachineFunction &MF) const override
bool isTypeIsValidForThisReturn(EVT Ty) const override
For targets which support the "returned" parameter attribute, returns true if the given type is a val...
bool supportSwiftError() const override
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 lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
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,...
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.
CCValAssign - Represent assignment of one arg/retval to a location.
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 consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:586
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Base class for ValueHandlers used for arguments coming into the current function, or for return value...
Definition: CallLowering.h:323
Extended Value Type.
Definition: ValueTypes.h:34