LLVM  8.0.1
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  bool handle(ArrayRef<CCValAssign> ArgLocs,
36 
37  protected:
39  unsigned Index);
40 
42 
45 
46  private:
47  bool assign(unsigned VReg, const CCValAssign &VA);
48 
49  virtual unsigned getStackAddress(const CCValAssign &VA,
50  MachineMemOperand *&MMO) = 0;
51 
52  virtual void assignValueToReg(unsigned ValVReg, const CCValAssign &VA) = 0;
53 
54  virtual void assignValueToAddress(unsigned ValVReg,
55  const CCValAssign &VA) = 0;
56 
57  virtual bool handleSplit(SmallVectorImpl<unsigned> &VRegs,
58  ArrayRef<CCValAssign> ArgLocs,
59  unsigned ArgLocsStartIndex, unsigned ArgsReg) = 0;
60  };
61 
63 
64  bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
65  ArrayRef<unsigned> VRegs) const override;
66 
68  ArrayRef<unsigned> VRegs) const override;
69 
71  const MachineOperand &Callee, const ArgInfo &OrigRet,
72  ArrayRef<ArgInfo> OrigArgs) const override;
73 
74 private:
75  /// Based on registers available on target machine split or extend
76  /// type if needed, also change pointer type to appropriate integer
77  /// type.
78  template <typename T>
79  void subTargetRegTypeForCallingConv(const Function &F, ArrayRef<ArgInfo> Args,
80  ArrayRef<unsigned> OrigArgIndices,
81  SmallVectorImpl<T> &ISDArgs) const;
82 
83  /// Split structures and arrays, save original argument indices since
84  /// Mips calling convention needs info about original argument type.
85  void splitToValueTypes(const ArgInfo &OrigArg, unsigned OriginalIndex,
86  SmallVectorImpl<ArgInfo> &SplitArgs,
87  SmallVectorImpl<unsigned> &SplitArgsOrigIndices) const;
88 };
89 
90 } // end namespace llvm
91 
92 #endif // LLVM_LIB_TARGET_MIPS_MIPSCALLLOWERING_H
This class represents lattice values for constants.
Definition: AllocatorList.h:24
F(f)
A description of a memory reference used in the backend.
bool assignVRegs(ArrayRef< unsigned > VRegs, ArrayRef< CCValAssign > ArgLocs, unsigned Index)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
MipsCallLowering(const MipsTargetLowering &TLI)
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...
Helper class to build MachineInstr.
void setLeastSignificantFirst(SmallVectorImpl< unsigned > &VRegs)
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 &MIRBuilder, const Value *Val, ArrayRef< unsigned > VRegs) 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...
This file describes how to lower LLVM calls to machine code calls.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool handle(ArrayRef< CCValAssign > ArgLocs, ArrayRef< CallLowering::ArgInfo > Args)