LLVM 20.0.0git
LoongArchMachineFunctionInfo.h
Go to the documentation of this file.
1//=- LoongArchMachineFunctionInfo.h - LoongArch machine function info -----===//
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// This file declares LoongArch-specific per-machine-function information.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H
14#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H
15
16#include "LoongArchSubtarget.h"
19
20namespace llvm {
21
22/// LoongArchMachineFunctionInfo - This class is derived from
23/// MachineFunctionInfo and contains private LoongArch-specific information for
24/// each MachineFunction.
26private:
27 /// FrameIndex for start of varargs area
28 int VarArgsFrameIndex = 0;
29 /// Size of the save area used for varargs
30 int VarArgsSaveSize = 0;
31
32 /// Size of stack frame to save callee saved registers
33 unsigned CalleeSavedStackSize = 0;
34
35 /// FrameIndex of the spill slot when there is no scavenged register in
36 /// insertIndirectBranch.
37 int BranchRelaxationSpillFrameIndex = -1;
38
39 /// Registers that have been sign extended from i32.
40 SmallVector<Register, 8> SExt32Registers;
41
42 /// Pairs of `jr` instructions and corresponding JTI operands, used for the
43 /// `annotate-tablejump` option.
45
46public:
48 const TargetSubtargetInfo *STI) {}
49
53 const override {
54 return DestMF.cloneInfo<LoongArchMachineFunctionInfo>(*this);
55 }
56
57 int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
58 void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
59
60 unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
61 void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
62
63 unsigned getCalleeSavedStackSize() const { return CalleeSavedStackSize; }
64 void setCalleeSavedStackSize(unsigned Size) { CalleeSavedStackSize = Size; }
65
67 return BranchRelaxationSpillFrameIndex;
68 }
70 BranchRelaxationSpillFrameIndex = Index;
71 }
72
73 void addSExt32Register(Register Reg) { SExt32Registers.push_back(Reg); }
74
76 return is_contained(SExt32Registers, Reg);
77 }
78
80 JumpInfos.push_back(std::make_pair(JrMI, JTIMO));
81 }
82 unsigned getJumpInfoSize() { return JumpInfos.size(); }
83 MachineInstr *getJumpInfoJrMI(unsigned Idx) { return JumpInfos[Idx].first; }
85 return JumpInfos[Idx].second;
86 }
87};
88
89} // end namespace llvm
90
91#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
uint32_t Index
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
unsigned Reg
Basic Register Allocator
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
LoongArchMachineFunctionInfo - This class is derived from MachineFunctionInfo and contains private Lo...
void setJumpInfo(MachineInstr *JrMI, MachineOperand *JTIMO)
LoongArchMachineFunctionInfo(const Function &F, const TargetSubtargetInfo *STI)
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
MachineInstr * getJumpInfoJrMI(unsigned Idx)
MachineOperand * getJumpInfoJTIMO(unsigned Idx)
Ty * cloneInfo(const Ty &Old)
Representation of each machine instruction.
Definition: MachineInstr.h:69
MachineOperand class - Representation of each machine instruction operand.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
size_t size() const
Definition: SmallVector.h:78
void push_back(const T &Elt)
Definition: SmallVector.h:413
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
TargetSubtargetInfo - Generic base class for all target subtargets.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Definition: STLExtras.h:1903
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...