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