Path: blob/main/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchMachineFunctionInfo.h
35268 views
//=- LoongArchMachineFunctionInfo.h - LoongArch machine function info -----===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file declares LoongArch-specific per-machine-function information.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H13#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H1415#include "LoongArchSubtarget.h"16#include "llvm/CodeGen/MachineFrameInfo.h"17#include "llvm/CodeGen/MachineFunction.h"1819namespace llvm {2021/// LoongArchMachineFunctionInfo - This class is derived from22/// MachineFunctionInfo and contains private LoongArch-specific information for23/// each MachineFunction.24class LoongArchMachineFunctionInfo : public MachineFunctionInfo {25private:26/// FrameIndex for start of varargs area27int VarArgsFrameIndex = 0;28/// Size of the save area used for varargs29int VarArgsSaveSize = 0;3031/// Size of stack frame to save callee saved registers32unsigned CalleeSavedStackSize = 0;3334/// FrameIndex of the spill slot when there is no scavenged register in35/// insertIndirectBranch.36int BranchRelaxationSpillFrameIndex = -1;3738/// Registers that have been sign extended from i32.39SmallVector<Register, 8> SExt32Registers;4041public:42LoongArchMachineFunctionInfo(const Function &F,43const TargetSubtargetInfo *STI) {}4445MachineFunctionInfo *46clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,47const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)48const override {49return DestMF.cloneInfo<LoongArchMachineFunctionInfo>(*this);50}5152int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }53void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }5455unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }56void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }5758unsigned getCalleeSavedStackSize() const { return CalleeSavedStackSize; }59void setCalleeSavedStackSize(unsigned Size) { CalleeSavedStackSize = Size; }6061int getBranchRelaxationSpillFrameIndex() {62return BranchRelaxationSpillFrameIndex;63}64void setBranchRelaxationSpillFrameIndex(int Index) {65BranchRelaxationSpillFrameIndex = Index;66}6768void addSExt32Register(Register Reg) { SExt32Registers.push_back(Reg); }6970bool isSExt32Register(Register Reg) const {71return is_contained(SExt32Registers, Reg);72}73};7475} // end namespace llvm7677#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H787980