Petar Jovanovic | fac93e2 | 2018-02-23 11:06:40 +0000 | [diff] [blame^] | 1 | //===- MipsCallLowering.cpp -------------------------------------*- C++ -*-===// |
| 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 "MipsCallLowering.h" |
| 17 | #include "MipsISelLowering.h" |
| 18 | #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h" |
| 19 | |
| 20 | using namespace llvm; |
| 21 | |
| 22 | MipsCallLowering::MipsCallLowering(const MipsTargetLowering &TLI) |
| 23 | : CallLowering(&TLI) {} |
| 24 | |
| 25 | bool MipsCallLowering::lowerReturn(MachineIRBuilder &MIRBuilder, |
| 26 | const Value *Val, unsigned VReg) const { |
| 27 | |
| 28 | MachineInstrBuilder Ret = MIRBuilder.buildInstrNoInsert(Mips::RetRA); |
| 29 | |
| 30 | if (Val != nullptr) { |
| 31 | return false; |
| 32 | } |
| 33 | MIRBuilder.insertInstr(Ret); |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | bool MipsCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder, |
| 38 | const Function &F, |
| 39 | ArrayRef<unsigned> VRegs) const { |
| 40 | |
| 41 | // Quick exit if there aren't any args. |
| 42 | if (F.arg_empty()) |
| 43 | return true; |
| 44 | |
| 45 | // Function had args, but we didn't lower them. |
| 46 | return false; |
| 47 | } |