X86MachineFunctionInfo.cpp 1.1 KB

123456789101112131415161718192021222324252627282930
  1. //===-- X86MachineFunctionInfo.cpp - X86 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. #include "X86MachineFunctionInfo.h"
  9. #include "X86RegisterInfo.h"
  10. #include "llvm/CodeGen/MachineRegisterInfo.h"
  11. #include "llvm/CodeGen/TargetSubtargetInfo.h"
  12. using namespace llvm;
  13. void X86MachineFunctionInfo::anchor() { }
  14. void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) {
  15. if (!RestoreBasePointerOffset) {
  16. const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
  17. MF->getSubtarget().getRegisterInfo());
  18. unsigned SlotSize = RegInfo->getSlotSize();
  19. for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs();
  20. unsigned Reg = *CSR; ++CSR) {
  21. if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
  22. RestoreBasePointerOffset -= SlotSize;
  23. }
  24. }
  25. }