1 //===-- llvm/lib/Target/ARM/ARMCallLowering.cpp - Call lowering -----------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file implements the lowering of LLVM calls to machine code calls for
12 /// GlobalISel.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #include "ARMCallLowering.h"
17 
18 #include "ARMBaseInstrInfo.h"
19 #include "ARMISelLowering.h"
20 
21 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
22 
23 using namespace llvm;
24 
25 #ifndef LLVM_BUILD_GLOBAL_ISEL
26 #error "This shouldn't be built without GISel"
27 #endif
28 
29 ARMCallLowering::ARMCallLowering(const ARMTargetLowering &TLI)
30     : CallLowering(&TLI) {}
31 
32 bool ARMCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
33                                   const Value *Val, unsigned VReg) const {
34   // We're currently only handling void returns
35   if (Val != nullptr)
36     return false;
37 
38   AddDefaultPred(MIRBuilder.buildInstr(ARM::BX_RET));
39 
40   return true;
41 }
42 
43 bool ARMCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
44                                            const Function &F,
45                                            ArrayRef<unsigned> VRegs) const {
46   return F.arg_empty();
47 }
48