1 //===- AArch64CallLowering.h - Call lowering --------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 /// This file describes how to lower LLVM calls to machine code calls.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
19 #include "llvm/IR/CallingConv.h"
25 class AArch64TargetLowering
;
28 class MachineIRBuilder
;
29 class MachineRegisterInfo
;
32 class AArch64CallLowering
: public CallLowering
{
34 AArch64CallLowering(const AArch64TargetLowering
&TLI
);
36 bool lowerReturn(MachineIRBuilder
&MIRBuilder
, const Value
*Val
,
37 ArrayRef
<Register
> VRegs
,
38 Register SwiftErrorVReg
) const override
;
40 bool lowerFormalArguments(MachineIRBuilder
&MIRBuilder
, const Function
&F
,
41 ArrayRef
<ArrayRef
<Register
>> VRegs
) const override
;
43 bool lowerCall(MachineIRBuilder
&MIRBuilder
,
44 CallLoweringInfo
&Info
) const override
;
46 /// Returns true if the call can be lowered as a tail call.
47 bool isEligibleForTailCallOptimization(MachineIRBuilder
&MIRBuilder
,
48 CallLoweringInfo
&Info
) const;
50 bool supportSwiftError() const override
{ return true; }
53 using RegHandler
= std::function
<void(MachineIRBuilder
&, Type
*, unsigned,
57 std::function
<void(MachineIRBuilder
&, int, CCValAssign
&)>;
59 void splitToValueTypes(const ArgInfo
&OrigArgInfo
,
60 SmallVectorImpl
<ArgInfo
> &SplitArgs
,
61 const DataLayout
&DL
, MachineRegisterInfo
&MRI
,
62 CallingConv::ID CallConv
) const;
65 } // end namespace llvm
67 #endif // LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H