1 //===-- BPFCallLowering.cpp - 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 "BPFCallLowering.h"
16 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
17 #include "llvm/Support/Debug.h"
18
19 #define DEBUG_TYPE "bpf-call-lowering"
20
21 using namespace llvm;
22
BPFCallLowering(const BPFTargetLowering & TLI)23 BPFCallLowering::BPFCallLowering(const BPFTargetLowering &TLI)
24 : CallLowering(&TLI) {}
25
lowerReturn(MachineIRBuilder & MIRBuilder,const Value * Val,ArrayRef<Register> VRegs,FunctionLoweringInfo & FLI,Register SwiftErrorVReg) const26 bool BPFCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
27 const Value *Val, ArrayRef<Register> VRegs,
28 FunctionLoweringInfo &FLI,
29 Register SwiftErrorVReg) const {
30 if (!VRegs.empty())
31 return false;
32 MIRBuilder.buildInstr(BPF::RET);
33 return true;
34 }
35
lowerFormalArguments(MachineIRBuilder & MIRBuilder,const Function & F,ArrayRef<ArrayRef<Register>> VRegs,FunctionLoweringInfo & FLI) const36 bool BPFCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
37 const Function &F,
38 ArrayRef<ArrayRef<Register>> VRegs,
39 FunctionLoweringInfo &FLI) const {
40 return VRegs.empty();
41 }
42
lowerCall(MachineIRBuilder & MIRBuilder,CallLoweringInfo & Info) const43 bool BPFCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
44 CallLoweringInfo &Info) const {
45 return false;
46 }
47