blob: 68c127fc42e56f78c12406d515e41e6a845f77ec [file] [log] [blame]
Eugene Zelenko96d933d2017-07-25 23:51:02 +00001//===- AArch64CallLowering.h - Call lowering --------------------*- C++ -*-===//
Quentin Colombetba2a0162016-02-16 19:26:02 +00002//
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
Eugene Zelenkoc5eb8e22017-02-01 22:56:06 +000015#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
16#define LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H
Quentin Colombetba2a0162016-02-16 19:26:02 +000017
Eugene Zelenkoc5eb8e22017-02-01 22:56:06 +000018#include "llvm/ADT/ArrayRef.h"
Quentin Colombetba2a0162016-02-16 19:26:02 +000019#include "llvm/CodeGen/GlobalISel/CallLowering.h"
Eugene Zelenko96d933d2017-07-25 23:51:02 +000020#include "llvm/IR/CallingConv.h"
Eugene Zelenkoc5eb8e22017-02-01 22:56:06 +000021#include <cstdint>
22#include <functional>
Quentin Colombetba2a0162016-02-16 19:26:02 +000023
24namespace llvm {
25
26class AArch64TargetLowering;
Eugene Zelenko96d933d2017-07-25 23:51:02 +000027class CCValAssign;
28class DataLayout;
29class MachineIRBuilder;
30class MachineRegisterInfo;
31class Type;
Tom Stellardb72a65f2016-04-14 17:23:33 +000032
Quentin Colombetba2a0162016-02-16 19:26:02 +000033class AArch64CallLowering: public CallLowering {
Eugene Zelenkoc5eb8e22017-02-01 22:56:06 +000034public:
Quentin Colombetba2a0162016-02-16 19:26:02 +000035 AArch64CallLowering(const AArch64TargetLowering &TLI);
Tom Stellardb72a65f2016-04-14 17:23:33 +000036
37 bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
Quentin Colombetba2a0162016-02-16 19:26:02 +000038 unsigned VReg) const override;
Tim Northover406024a2016-08-10 21:44:01 +000039
Tim Northover862758ec2016-09-21 12:57:35 +000040 bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F,
Tim Northover406024a2016-08-10 21:44:01 +000041 ArrayRef<unsigned> VRegs) const override;
42
Diana Picusd79253a2017-03-20 14:40:18 +000043 bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv,
44 const MachineOperand &Callee, const ArgInfo &OrigRet,
Tim Northover9a467182016-09-21 12:57:45 +000045 ArrayRef<ArgInfo> OrigArgs) const override;
Tim Northover406024a2016-08-10 21:44:01 +000046
47private:
Eugene Zelenko96d933d2017-07-25 23:51:02 +000048 using RegHandler = std::function<void(MachineIRBuilder &, Type *, unsigned,
49 CCValAssign &)>;
Tim Northovera5e38fa2016-09-22 13:49:25 +000050
Eugene Zelenko96d933d2017-07-25 23:51:02 +000051 using MemHandler =
52 std::function<void(MachineIRBuilder &, int, CCValAssign &)>;
Tim Northover406024a2016-08-10 21:44:01 +000053
Eugene Zelenko96d933d2017-07-25 23:51:02 +000054 using SplitArgTy = std::function<void(unsigned, uint64_t)>;
Tim Northoverb18ea162016-09-20 15:20:36 +000055
Tim Northover9a467182016-09-21 12:57:45 +000056 void splitToValueTypes(const ArgInfo &OrigArgInfo,
57 SmallVectorImpl<ArgInfo> &SplitArgs,
Tim Northoverb18ea162016-09-20 15:20:36 +000058 const DataLayout &DL, MachineRegisterInfo &MRI,
Tim Northoveref1fc5a2017-08-21 21:56:11 +000059 CallingConv::ID CallConv,
Benjamin Kramer061f4a52017-01-13 14:39:03 +000060 const SplitArgTy &SplitArg) const;
Quentin Colombetba2a0162016-02-16 19:26:02 +000061};
Eugene Zelenkoc5eb8e22017-02-01 22:56:06 +000062
63} // end namespace llvm
64
65#endif // LLVM_LIB_TARGET_AARCH64_AARCH64CALLLOWERING_H