LLVM  7.0.0
MipsCallLowering.h
Go to the documentation of this file.
1 //===- MipsCallLowering.h ---------------------------------------*- 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 describes how to lower LLVM calls to machine code calls.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_LIB_TARGET_MIPS_MIPSCALLLOWERING_H
16 #define LLVM_LIB_TARGET_MIPS_MIPSCALLLOWERING_H
17 
19 
20 namespace llvm {
21 
22 class MipsTargetLowering;
23 
25 
26 public:
27  class MipsHandler {
28  public:
30  : MIRBuilder(MIRBuilder), MRI(MRI) {}
31 
32  virtual ~MipsHandler() = default;
33 
34  protected:
35  bool assign(const CCValAssign &VA, unsigned vreg);
36 
39 
40  private:
41  virtual unsigned getStackAddress(uint64_t Size, int64_t Offset,
42  MachinePointerInfo &MPO) = 0;
43 
44  virtual void assignValueToReg(unsigned ValVReg, unsigned PhysReg) = 0;
45 
46  virtual void assignValueToAddress(unsigned ValVReg, unsigned Addr,
47  uint64_t Size,
48  MachinePointerInfo &MPO) = 0;
49  };
50 
52 
53  bool lowerReturn(MachineIRBuilder &MIRBuiler, const Value *Val,
54  unsigned VReg) const override;
55 
57  ArrayRef<unsigned> VRegs) const override;
58 
60  const MachineOperand &Callee, const ArgInfo &OrigRet,
61  ArrayRef<ArgInfo> OrigArgs) const override;
62 
63 private:
64  using FunTy =
65  std::function<void(ISD::ArgFlagsTy flags, EVT vt, EVT argvt, bool used,
66  unsigned origIdx, unsigned partOffs)>;
67 
68  /// Based on registers available on target machine split or extend
69  /// type if needed, also change pointer type to appropriate integer
70  /// type. Lambda will fill some info so we can tell MipsCCState to
71  /// assign physical registers.
72  void subTargetRegTypeForCallingConv(MachineIRBuilder &MIRBuilder,
74  ArrayRef<unsigned> OrigArgIndices,
75  const FunTy &PushBack) const;
76 
77  /// Split structures and arrays, save original argument indices since
78  /// Mips calling conv needs info about original argument type.
79  void splitToValueTypes(const ArgInfo &OrigArg, unsigned OriginalIndex,
80  SmallVectorImpl<ArgInfo> &SplitArgs,
81  SmallVectorImpl<unsigned> &SplitArgsOrigIndices) const;
82 };
83 
84 } // end namespace llvm
85 
86 #endif // LLVM_LIB_TARGET_MIPS_MIPSCALLLOWERING_H
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
static const MCPhysReg VRegs[32]
F(f)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
MipsCallLowering(const MipsTargetLowering &TLI)
amdgpu Simplify well known AMD library false Value * Callee
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...
Extended Value Type.
Definition: ValueTypes.h:34
This class contains a discriminated union of information about pointers in memory operands...
bool assign(const CCValAssign &VA, unsigned vreg)
MipsHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
MachineOperand class - Representation of each machine instruction operand.
CCValAssign - Represent assignment of one arg/retval to a location.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
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...
LLVM Value Representation.
Definition: Value.h:73
bool lowerCall(MachineIRBuilder &MIRBuilder, CallingConv::ID CallConv, const MachineOperand &Callee, const ArgInfo &OrigRet, ArrayRef< ArgInfo > OrigArgs) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
This file describes how to lower LLVM calls to machine code calls.
print Print MemDeps of function
constexpr char Args[]
Key for Kernel::Metadata::mArgs.