1 //===-- M68kCallLowering.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 implements the lowering of LLVM calls to machine code calls for
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H
16 #define LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H
18 #include "llvm/CodeGen/CallingConvLower.h"
19 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
20 #include "llvm/CodeGen/ValueTypes.h"
24 class M68kTargetLowering
;
26 class M68kCallLowering
: public CallLowering
{
27 // TODO: We are only supporting return instruction with no value at this time
31 M68kCallLowering(const M68kTargetLowering
&TLI
);
33 bool lowerReturn(MachineIRBuilder
&MIRBuilder
, const Value
*Val
,
34 ArrayRef
<Register
> VRegs
, FunctionLoweringInfo
&FLI
,
35 Register SwiftErrorVReg
) const override
;
37 bool lowerFormalArguments(MachineIRBuilder
&MIRBuilder
, const Function
&F
,
38 ArrayRef
<ArrayRef
<Register
>> VRegs
,
39 FunctionLoweringInfo
&FLI
) const override
;
41 bool lowerCall(MachineIRBuilder
&MIRBuilder
,
42 CallLoweringInfo
&Info
) const override
;
44 bool enableBigEndian() const override
;
46 struct M68kIncomingValueHandler
: public CallLowering::IncomingValueHandler
{
47 M68kIncomingValueHandler(MachineIRBuilder
&MIRBuilder
,
48 MachineRegisterInfo
&MRI
)
49 : CallLowering::IncomingValueHandler(MIRBuilder
, MRI
) {}
54 void assignValueToReg(Register ValVReg
, Register PhysReg
,
55 CCValAssign
&VA
) override
;
57 void assignValueToAddress(Register ValVReg
, Register Addr
, LLT MemTy
,
58 MachinePointerInfo
&MPO
, CCValAssign
&VA
) override
;
60 Register
getStackAddress(uint64_t Size
, int64_t Offset
,
61 MachinePointerInfo
&MPO
,
62 ISD::ArgFlagsTy Flags
) override
;
65 struct FormalArgHandler
: public M68kIncomingValueHandler
{
66 FormalArgHandler(MachineIRBuilder
&MIRBuilder
, MachineRegisterInfo
&MRI
)
67 : M68kIncomingValueHandler(MIRBuilder
, MRI
) {}
70 } // end namespace llvm
72 #endif // LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H