Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 1 | //===- llvm/lib/Target/ARM/ARMCallLowering.h - Call lowering ----*- C++ -*-===// |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 9 | // |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 10 | /// \file |
| 11 | /// This file describes how to lower LLVM calls to machine code calls. |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 12 | // |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 15 | #ifndef LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H |
| 16 | #define LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 17 | |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 18 | #include "llvm/ADT/ArrayRef.h" |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/GlobalISel/CallLowering.h" |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 20 | #include "llvm/IR/CallingConv.h" |
| 21 | #include <cstdint> |
| 22 | #include <functional> |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 23 | |
| 24 | namespace llvm { |
| 25 | |
| 26 | class ARMTargetLowering; |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 27 | class MachineFunction; |
Diana Picus | 812caee | 2016-12-16 12:54:46 +0000 | [diff] [blame] | 28 | class MachineInstrBuilder; |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 29 | class MachineIRBuilder; |
| 30 | class Value; |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 31 | |
| 32 | class ARMCallLowering : public CallLowering { |
| 33 | public: |
| 34 | ARMCallLowering(const ARMTargetLowering &TLI); |
| 35 | |
| 36 | bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val, |
| 37 | unsigned VReg) const override; |
| 38 | |
| 39 | bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, |
| 40 | ArrayRef<unsigned> VRegs) const override; |
Diana Picus | 812caee | 2016-12-16 12:54:46 +0000 | [diff] [blame] | 41 | |
Diana Picus | d79253a | 2017-03-20 14:40:18 +0000 | [diff] [blame] | 42 | bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv, |
| 43 | const MachineOperand &Callee, const ArgInfo &OrigRet, |
Diana Picus | 613b656 | 2017-02-21 11:33:59 +0000 | [diff] [blame] | 44 | ArrayRef<ArgInfo> OrigArgs) const override; |
| 45 | |
Diana Picus | 812caee | 2016-12-16 12:54:46 +0000 | [diff] [blame] | 46 | private: |
| 47 | bool lowerReturnVal(MachineIRBuilder &MIRBuilder, const Value *Val, |
| 48 | unsigned VReg, MachineInstrBuilder &Ret) const; |
Diana Picus | 32cd9b4 | 2017-02-02 14:01:00 +0000 | [diff] [blame] | 49 | |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 50 | using SplitArgTy = std::function<void(unsigned Reg, uint64_t Offset)>; |
Diana Picus | 8cca8cb | 2017-05-29 07:01:52 +0000 | [diff] [blame] | 51 | |
Diana Picus | 32cd9b4 | 2017-02-02 14:01:00 +0000 | [diff] [blame] | 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, |
Diana Picus | 8cca8cb | 2017-05-29 07:01:52 +0000 | [diff] [blame] | 56 | MachineFunction &MF, |
| 57 | const SplitArgTy &PerformArgSplit) const; |
Diana Picus | 2227493 | 2016-11-11 08:27:37 +0000 | [diff] [blame] | 58 | }; |
Eugene Zelenko | 076468c | 2017-09-20 21:35:51 +0000 | [diff] [blame^] | 59 | |
| 60 | } // end namespace llvm |
| 61 | |
| 62 | #endif // LLVM_LIB_TARGET_ARM_ARMCALLLOWERING_H |