blob: f5a6872336f60f72f840170653784e4f61dba838 [file] [log] [blame]
Diana Picus22274932016-11-11 08:27:37 +00001//===-- llvm/lib/Target/ARM/ARMCallLowering.h - Call lowering -------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9///
10/// \file
11/// This file describes how to lower LLVM calls to machine code calls.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_ARM_ARMCALLLOWERING
16#define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING
17
18#include "llvm/CodeGen/CallingConvLower.h"
19#include "llvm/CodeGen/GlobalISel/CallLowering.h"
20#include "llvm/CodeGen/ValueTypes.h"
21
22namespace llvm {
23
24class ARMTargetLowering;
Diana Picus812caee2016-12-16 12:54:46 +000025class MachineInstrBuilder;
Diana Picus22274932016-11-11 08:27:37 +000026
27class ARMCallLowering : public CallLowering {
28public:
29 ARMCallLowering(const ARMTargetLowering &TLI);
30
31 bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
32 unsigned VReg) const override;
33
34 bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
35 ArrayRef<unsigned> VRegs) const override;
Diana Picus812caee2016-12-16 12:54:46 +000036
Diana Picusd79253a2017-03-20 14:40:18 +000037 bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv,
38 const MachineOperand &Callee, const ArgInfo &OrigRet,
Diana Picus613b6562017-02-21 11:33:59 +000039 ArrayRef<ArgInfo> OrigArgs) const override;
40
Diana Picus812caee2016-12-16 12:54:46 +000041private:
42 bool lowerReturnVal(MachineIRBuilder &MIRBuilder, const Value *Val,
43 unsigned VReg, MachineInstrBuilder &Ret) const;
Diana Picus32cd9b42017-02-02 14:01:00 +000044
Diana Picus8cca8cb2017-05-29 07:01:52 +000045 typedef std::function<void(unsigned Reg, uint64_t Offset)> SplitArgTy;
46
Diana Picus32cd9b42017-02-02 14:01:00 +000047 /// Split an argument into one or more arguments that the CC lowering can cope
48 /// with (e.g. replace pointers with integers).
49 void splitToValueTypes(const ArgInfo &OrigArg,
50 SmallVectorImpl<ArgInfo> &SplitArgs,
Diana Picus8cca8cb2017-05-29 07:01:52 +000051 MachineFunction &MF,
52 const SplitArgTy &PerformArgSplit) const;
Diana Picus22274932016-11-11 08:27:37 +000053};
54} // End of namespace llvm
55#endif