1 //===-- M68kCallLowering.h - Call lowering ----------------------*- C++ -*-===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 /// \file 10 /// This file implements the lowering of LLVM calls to machine code calls for 11 /// GlobalISel. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H 16 #define LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H 17 18 #include "llvm/CodeGen/CallingConvLower.h" 19 #include "llvm/CodeGen/GlobalISel/CallLowering.h" 20 #include "llvm/CodeGen/ValueTypes.h" 21 22 namespace llvm { 23 24 class M68kTargetLowering; 25 26 class M68kCallLowering : public CallLowering { 27 // TODO: We are only supporting return instruction with no value at this time 28 // point 29 30 public: 31 M68kCallLowering(const M68kTargetLowering &TLI); 32 33 bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, 34 ArrayRef<Register> VRegs, FunctionLoweringInfo &FLI, 35 Register SwiftErrorVReg) const override; 36 37 bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, 38 ArrayRef<ArrayRef<Register>> VRegs, 39 FunctionLoweringInfo &FLI) const override; 40 41 bool lowerCall(MachineIRBuilder &MIRBuilder, 42 CallLoweringInfo &Info) const override; 43 44 bool enableBigEndian() const override; 45 }; 46 struct M68kIncomingValueHandler : public CallLowering::IncomingValueHandler { 47 M68kIncomingValueHandler(MachineIRBuilder &MIRBuilder, 48 MachineRegisterInfo &MRI) 49 : CallLowering::IncomingValueHandler(MIRBuilder, MRI) {} 50 51 uint64_t StackUsed; 52 53 private: 54 void assignValueToReg(Register ValVReg, Register PhysReg, 55 CCValAssign VA) override; 56 57 void assignValueToAddress(Register ValVReg, Register Addr, LLT MemTy, 58 MachinePointerInfo &MPO, CCValAssign &VA) override; 59 60 Register getStackAddress(uint64_t Size, int64_t Offset, 61 MachinePointerInfo &MPO, 62 ISD::ArgFlagsTy Flags) override; 63 }; 64 65 struct FormalArgHandler : public M68kIncomingValueHandler { 66 FormalArgHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI) 67 : M68kIncomingValueHandler(MIRBuilder, MRI) {} 68 }; 69 70 } // end namespace llvm 71 72 #endif // LLVM_LIB_TARGET_M68K_GLSEL_M68KCALLLOWERING_H 73