LLVM  10.0.0svn
MipsCallLowering.h
Go to the documentation of this file.
1 //===- MipsCallLowering.h ---------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// This file describes how to lower LLVM calls to machine code calls.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_MIPS_MIPSCALLLOWERING_H
15 #define LLVM_LIB_TARGET_MIPS_MIPSCALLLOWERING_H
16 
18 
19 namespace llvm {
20 
21 class MipsTargetLowering;
22 
24 
25 public:
26  class MipsHandler {
27  public:
29  : MIRBuilder(MIRBuilder), MRI(MRI) {}
30 
31  virtual ~MipsHandler() = default;
32 
33  bool handle(ArrayRef<CCValAssign> ArgLocs,
35 
36  protected:
38  unsigned ArgLocsStartIndex, const EVT &VT);
39 
41 
44 
45  private:
46  bool assign(Register VReg, const CCValAssign &VA, const EVT &VT);
47 
48  virtual Register getStackAddress(const CCValAssign &VA,
49  MachineMemOperand *&MMO) = 0;
50 
51  virtual void assignValueToReg(Register ValVReg, const CCValAssign &VA,
52  const EVT &VT) = 0;
53 
54  virtual void assignValueToAddress(Register ValVReg,
55  const CCValAssign &VA) = 0;
56 
57  virtual bool handleSplit(SmallVectorImpl<Register> &VRegs,
58  ArrayRef<CCValAssign> ArgLocs,
59  unsigned ArgLocsStartIndex, Register ArgsReg,
60  const EVT &VT) = 0;
61  };
62 
64 
65  bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
66  ArrayRef<Register> VRegs) const override;
67 
69  ArrayRef<ArrayRef<Register>> VRegs) const override;
70 
72  CallLoweringInfo &Info) 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:23
bool assignVRegs(ArrayRef< Register > VRegs, ArrayRef< CCValAssign > ArgLocs, unsigned ArgLocsStartIndex, const EVT &VT)
F(f)
A description of a memory reference used in the backend.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:41
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
MipsCallLowering(const MipsTargetLowering &TLI)
Analysis containing CSE Info
Definition: CSEInfo.cpp:20
bool lowerFormalArguments(MachineIRBuilder &MIRBuilder, const Function &F, ArrayRef< ArrayRef< Register >> VRegs) const override
This hook must be implemented to lower the incoming (formal) arguments, described by VRegs...
Helper class to build MachineInstr.
Extended Value Type.
Definition: ValueTypes.h:33
bool lowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val, ArrayRef< Register > VRegs) const override
This hook behaves as the extended lowerReturn function, but for targets that do not support swifterro...
MipsHandler(MachineIRBuilder &MIRBuilder, MachineRegisterInfo &MRI)
CCValAssign - Represent assignment of one arg/retval to a location.
void setLeastSignificantFirst(SmallVectorImpl< Register > &VRegs)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
bool lowerCall(MachineIRBuilder &MIRBuilder, CallLoweringInfo &Info) const override
This hook must be implemented to lower the given call instruction, including argument and return valu...
LLVM Value Representation.
Definition: Value.h:73
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)
Wrapper class representing virtual and physical registers.
Definition: Register.h:19