1 //===- llvm/lib/Target/ARM/ARMCallLowering.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_ARM_ARMCALLLOWERING_H
15 #define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
19 #include "llvm/IR/CallingConv.h"
25 class ARMTargetLowering
;
26 class MachineFunction
;
27 class MachineInstrBuilder
;
28 class MachineIRBuilder
;
31 class ARMCallLowering
: public CallLowering
{
33 ARMCallLowering(const ARMTargetLowering
&TLI
);
35 bool lowerReturn(MachineIRBuilder
&MIRBuilder
, const Value
*Val
,
36 ArrayRef
<unsigned> VRegs
) const override
;
38 bool lowerFormalArguments(MachineIRBuilder
&MIRBuilder
, const Function
&F
,
39 ArrayRef
<unsigned> VRegs
) const override
;
41 bool lowerCall(MachineIRBuilder
&MIRBuilder
, CallingConv::ID CallConv
,
42 const MachineOperand
&Callee
, const ArgInfo
&OrigRet
,
43 ArrayRef
<ArgInfo
> OrigArgs
) const override
;
46 bool lowerReturnVal(MachineIRBuilder
&MIRBuilder
, const Value
*Val
,
47 ArrayRef
<unsigned> VRegs
,
48 MachineInstrBuilder
&Ret
) const;
50 using SplitArgTy
= std::function
<void(unsigned Reg
, uint64_t Offset
)>;
52 /// Split an argument into one or more arguments that the CC lowering can cope
53 /// with (e.g. replace pointers with integers).
54 void splitToValueTypes(const ArgInfo
&OrigArg
,
55 SmallVectorImpl
<ArgInfo
> &SplitArgs
,
57 const SplitArgTy
&PerformArgSplit
) const;
60 } // end namespace llvm
62 #endif // LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H