PPCCallLowering.h 2.4 KB

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