xref: /freebsd/contrib/llvm-project/llvm/lib/Target/ARM/ARMCallLowering.h (revision 8bcb0991864975618c09697b1aca10683346d9f0)
1 //===- llvm/lib/Target/ARM/ARMCallLowering.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_ARM_ARMCALLLOWERING_H
15 #define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
19 #include "llvm/IR/CallingConv.h"
20 #include <cstdint>
21 #include <functional>
22 
23 namespace llvm {
24 
25 class ARMTargetLowering;
26 class MachineFunction;
27 class MachineInstrBuilder;
28 class MachineIRBuilder;
29 class Value;
30 
31 class ARMCallLowering : public CallLowering {
32 public:
33   ARMCallLowering(const ARMTargetLowering &TLI);
34 
35   bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
36                    ArrayRef<Register> VRegs) const override;
37 
38   bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
39                             ArrayRef<ArrayRef<Register>> VRegs) const override;
40 
41   bool lowerCall(MachineIRBuilder &MIRBuilder,
42                  CallLoweringInfo &Info) const override;
43 
44 private:
45   bool lowerReturnVal(MachineIRBuilder &MIRBuilder, const Value *Val,
46                       ArrayRef<Register> VRegs,
47                       MachineInstrBuilder &Ret) const;
48 
49   /// Split an argument into one or more arguments that the CC lowering can cope
50   /// with.
51   void splitToValueTypes(const ArgInfo &OrigArg,
52                          SmallVectorImpl<ArgInfo> &SplitArgs,
53                          MachineFunction &MF) const;
54 };
55 
56 } // end namespace llvm
57 
58 #endif // LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H
59