1 //===-- PPCCallLowering.h - Call lowering for GlobalISel -------*- 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 describes how to lower LLVM calls to machine code calls.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_POWERPC_GISEL_PPCCALLLOWERING_H
15 #define LLVM_LIB_TARGET_POWERPC_GISEL_PPCCALLLOWERING_H
17 #include "PPCISelLowering.h"
18 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
19 #include "llvm/IR/CallingConv.h"
23 class PPCTargetLowering
;
25 class PPCCallLowering
: public CallLowering
{
27 PPCCallLowering(const PPCTargetLowering
&TLI
);
29 bool lowerReturn(MachineIRBuilder
&MIRBuilder
, const Value
*Val
,
30 ArrayRef
<Register
> VRegs
, FunctionLoweringInfo
&FLI
,
31 Register SwiftErrorVReg
) const override
;
32 bool lowerFormalArguments(MachineIRBuilder
&MIRBuilder
, const Function
&F
,
33 ArrayRef
<ArrayRef
<Register
>> VRegs
,
34 FunctionLoweringInfo
&FLI
) const override
;
35 bool lowerCall(MachineIRBuilder
&MIRBuilder
,
36 CallLoweringInfo
&Info
) const override
;
39 class PPCIncomingValueHandler
: public CallLowering::IncomingValueHandler
{
41 PPCIncomingValueHandler(MachineIRBuilder
&MIRBuilder
,
42 MachineRegisterInfo
&MRI
)
43 : CallLowering::IncomingValueHandler(MIRBuilder
, MRI
) {}
48 void assignValueToReg(Register ValVReg
, Register PhysReg
,
49 const CCValAssign
&VA
) override
;
51 void assignValueToAddress(Register ValVReg
, Register Addr
, LLT MemTy
,
52 const MachinePointerInfo
&MPO
,
53 const CCValAssign
&VA
) override
;
55 Register
getStackAddress(uint64_t Size
, int64_t Offset
,
56 MachinePointerInfo
&MPO
,
57 ISD::ArgFlagsTy Flags
) override
;
59 virtual void markPhysRegUsed(unsigned PhysReg
) = 0;
62 class FormalArgHandler
: public PPCIncomingValueHandler
{
64 void markPhysRegUsed(unsigned PhysReg
) override
;
67 FormalArgHandler(MachineIRBuilder
&MIRBuilder
, MachineRegisterInfo
&MRI
)
68 : PPCIncomingValueHandler(MIRBuilder
, MRI
) {}
71 } // end namespace llvm