LLVM  13.0.0git
RISCVCallLowering.cpp
Go to the documentation of this file.
1 //===-- RISCVCallLowering.cpp - Call lowering -------------------*- 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 "RISCVCallLowering.h"
16 #include "RISCVISelLowering.h"
18 
19 using namespace llvm;
20 
22  : CallLowering(&TLI) {}
23 
25  const Value *Val, ArrayRef<Register> VRegs,
26  FunctionLoweringInfo &FLI) const {
27 
28  MachineInstrBuilder Ret = MIRBuilder.buildInstrNoInsert(RISCV::PseudoRET);
29 
30  if (Val != nullptr) {
31  return false;
32  }
33  MIRBuilder.insertInstr(Ret);
34  return true;
35 }
36 
38  const Function &F,
40  FunctionLoweringInfo &FLI) const {
41 
42  if (F.arg_empty())
43  return true;
44 
45  return false;
46 }
47 
49  CallLoweringInfo &Info) const {
50  return false;
51 }
llvm::RISCVCallLowering::lowerReturn
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val, ArrayRef< Register > VRegs, FunctionLoweringInfo &FLI) const override
This hook behaves as the extended lowerReturn function, but for targets that do not support swifterro...
Definition: RISCVCallLowering.cpp:24
llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
llvm::Function
Definition: Function.h:61
llvm::MachineIRBuilder::buildInstrNoInsert
MachineInstrBuilder buildInstrNoInsert(unsigned Opcode)
Build but don't insert <empty> = Opcode <empty>.
Definition: MachineIRBuilder.cpp:40
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
MachineIRBuilder.h
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVCallLowering::lowerFormalArguments
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register >> VRegs, FunctionLoweringInfo &FLI) const override
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs,...
Definition: RISCVCallLowering.cpp:37
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:26
llvm::MachineIRBuilder
Helper class to build MachineInstr.
Definition: MachineIRBuilder.h:220
llvm::MachineInstrBuilder
Definition: MachineInstrBuilder.h:70
RISCVCallLowering.h
llvm::RISCVCallLowering::RISCVCallLowering
RISCVCallLowering(const RISCVTargetLowering &TLI)
Definition: RISCVCallLowering.cpp:21
llvm::FunctionLoweringInfo
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
Definition: FunctionLoweringInfo.h:53
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::MachineIRBuilder::insertInstr
MachineInstrBuilder insertInstr(MachineInstrBuilder MIB)
Insert an existing instruction at the insertion point.
Definition: MachineIRBuilder.cpp:45
RISCVISelLowering.h
llvm::CallLowering::CallLoweringInfo
Definition: CallLowering.h:82
llvm::RISCVTargetLowering
Definition: RISCVISelLowering.h:222
llvm::CallLowering
Definition: CallLowering.h:42
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::RISCVCallLowering::lowerCall
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
Definition: RISCVCallLowering.cpp:48