blob: 5ae4962378d341650c42fa895b0814c003eb4d09 [file] [log] [blame]
Zvi Rackover76dbf262016-11-15 06:34:33 +00001//===-- llvm/lib/Target/X86/X86CallLowering.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 "X86CallLowering.h"
17#include "X86ISelLowering.h"
18#include "X86InstrInfo.h"
19#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
20
21using namespace llvm;
22
23#ifndef LLVM_BUILD_GLOBAL_ISEL
24#error "This shouldn't be built without GISel"
25#endif
26
27X86CallLowering::X86CallLowering(const X86TargetLowering &TLI)
28 : CallLowering(&TLI) {}
29
30bool X86CallLowering::lowerReturn(MachineIRBuilder &MIRBuilder,
31 const Value *Val, unsigned VReg) const {
32 // TODO: handle functions returning non-void values.
33 if (Val)
34 return false;
35
36 MIRBuilder.buildInstr(X86::RET).addImm(0);
37
38 return true;
39}
40
41bool X86CallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
42 const Function &F,
43 ArrayRef<unsigned> VRegs) const {
44 // TODO: handle functions with one or more arguments.
45 return F.arg_empty();
46}