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
21using namespace llvm;
22
23BPFCallLowering::BPFCallLowering(const BPFTargetLowering &TLI)
24 : CallLowering(&TLI) {}
25
26bool 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(Opcode: BPF::RET);
33 return true;
34}
35
36bool BPFCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
37 const Function &F,
38 ArrayRef<ArrayRef<Register>> VRegs,
39 FunctionLoweringInfo &FLI) const {
40 return VRegs.empty();
41}
42
43bool BPFCallLowering::lowerCall(MachineIRBuilder &MIRBuilder,
44 CallLoweringInfo &Info) const {
45 return false;
46}
47