LLVM  4.0.0
X86CallLowering.cpp
Go to the documentation of this file.
1 //===-- 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"
20 
21 using namespace llvm;
22 
23 #ifndef LLVM_BUILD_GLOBAL_ISEL
24 #error "This shouldn't be built without GISel"
25 #endif
26 
28  : CallLowering(&TLI) {}
29 
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 
42  const Function &F,
43  ArrayRef<unsigned> VRegs) const {
44  // TODO: handle functions with one or more arguments.
45  return F.arg_empty();
46 }
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< unsigned > VRegs) const override
This hook must be implemented to lower the incoming (formal) arguments, described by Args...
static const MCPhysReg VRegs[32]
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
#define F(x, y, z)
Definition: MD5.cpp:51
bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val, unsigned VReg) const override
This hook must be implemented to lower outgoing return values, described by Val, into the specified v...
MachineInstrBuilder buildInstr(unsigned Opcode)
Build and insert <empty> = Opcode <empty>.
Helper class to build MachineInstr.
This file declares the MachineIRBuilder class.
bool arg_empty() const
Definition: Function.cpp:330
This file describes how to lower LLVM calls to machine code calls.
LLVM Value Representation.
Definition: Value.h:71
X86CallLowering(const X86TargetLowering &TLI)