LoongArchMachineFunctionInfo.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H
  13. #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H
  14. #include "LoongArchSubtarget.h"
  15. #include "llvm/CodeGen/MachineFrameInfo.h"
  16. #include "llvm/CodeGen/MachineFunction.h"
  17. namespace llvm {
  18. /// LoongArchMachineFunctionInfo - This class is derived from
  19. /// MachineFunctionInfo and contains private LoongArch-specific information for
  20. /// each MachineFunction.
  21. class LoongArchMachineFunctionInfo : public MachineFunctionInfo {
  22. private:
  23. /// FrameIndex for start of varargs area
  24. int VarArgsFrameIndex = 0;
  25. /// Size of the save area used for varargs
  26. int VarArgsSaveSize = 0;
  27. /// Size of stack frame to save callee saved registers
  28. unsigned CalleeSavedStackSize = 0;
  29. /// FrameIndex of the spill slot when there is no scavenged register in
  30. /// insertIndirectBranch.
  31. int BranchRelaxationSpillFrameIndex = -1;
  32. public:
  33. LoongArchMachineFunctionInfo(const Function &F,
  34. const TargetSubtargetInfo *STI) {}
  35. MachineFunctionInfo *
  36. clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF,
  37. const DenseMap<MachineBasicBlock *, MachineBasicBlock *> &Src2DstMBB)
  38. const override {
  39. return DestMF.cloneInfo<LoongArchMachineFunctionInfo>(*this);
  40. }
  41. int getVarArgsFrameIndex() const { return VarArgsFrameIndex; }
  42. void setVarArgsFrameIndex(int Index) { VarArgsFrameIndex = Index; }
  43. unsigned getVarArgsSaveSize() const { return VarArgsSaveSize; }
  44. void setVarArgsSaveSize(int Size) { VarArgsSaveSize = Size; }
  45. unsigned getCalleeSavedStackSize() const { return CalleeSavedStackSize; }
  46. void setCalleeSavedStackSize(unsigned Size) { CalleeSavedStackSize = Size; }
  47. int getBranchRelaxationSpillFrameIndex() {
  48. return BranchRelaxationSpillFrameIndex;
  49. }
  50. void setBranchRelaxationSpillFrameIndex(int Index) {
  51. BranchRelaxationSpillFrameIndex = Index;
  52. }
  53. };
  54. } // end namespace llvm
  55. #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHMACHINEFUNCTIONINFO_H