• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 implements the lowering of LLVM calls to machine code calls for
11 /// GlobalISel.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #include "PPCCallLowering.h"
16 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
17 #include "llvm/Support/Debug.h"
18 
19 #define DEBUG_TYPE "ppc-call-lowering"
20 
21 using namespace llvm;
22 
PPCCallLowering(const PPCTargetLowering & TLI)23 PPCCallLowering::PPCCallLowering(const PPCTargetLowering &TLI)
24     : CallLowering(&TLI) {}
25 
lowerReturn(MachineIRBuilder & MIRBuilder,const Value * Val,ArrayRef<Register> VRegs,Register SwiftErrorVReg) const26 bool PPCCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
27                                   const Value *Val, ArrayRef<Register> VRegs,
28                                   Register SwiftErrorVReg) const {
29   assert(((Val && !VRegs.empty()) || (!Val && VRegs.empty())) &&
30          "Return value without a vreg");
31   if (VRegs.size() > 0)
32     return false;
33 
34   MIRBuilder.buildInstr(PPC::BLR8);
35   return true;
36 }
37 
lowerFormalArguments(MachineIRBuilder & MIRBuilder,const Function & F,ArrayRef<ArrayRef<Register>> VRegs) const38 bool PPCCallLowering::lowerFormalArguments(
39     MachineIRBuilder &MIRBuilder, const Function &F,
40     ArrayRef<ArrayRef<Register>> VRegs) const {
41 
42   // If VRegs is empty, then there are no formal arguments to lower and thus can
43   // always return true. If there are formal arguments, we currently do not
44   // handle them and thus return false.
45   return VRegs.empty();
46 }
47 
lowerCall(MachineIRBuilder & MIRBuilder,CallLoweringInfo & Info) const48 bool PPCCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
49                                 CallLoweringInfo &Info) const {
50   return false;
51 }
52