xref: /aosp_15_r20/external/llvm/lib/Target/X86/X86MachineFunctionInfo.cpp (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker 
10*9880d681SAndroid Build Coastguard Worker #include "X86MachineFunctionInfo.h"
11*9880d681SAndroid Build Coastguard Worker #include "X86RegisterInfo.h"
12*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetSubtargetInfo.h"
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker using namespace llvm;
15*9880d681SAndroid Build Coastguard Worker 
anchor()16*9880d681SAndroid Build Coastguard Worker void X86MachineFunctionInfo::anchor() { }
17*9880d681SAndroid Build Coastguard Worker 
setRestoreBasePointer(const MachineFunction * MF)18*9880d681SAndroid Build Coastguard Worker void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) {
19*9880d681SAndroid Build Coastguard Worker   if (!RestoreBasePointerOffset) {
20*9880d681SAndroid Build Coastguard Worker     const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>(
21*9880d681SAndroid Build Coastguard Worker       MF->getSubtarget().getRegisterInfo());
22*9880d681SAndroid Build Coastguard Worker     unsigned SlotSize = RegInfo->getSlotSize();
23*9880d681SAndroid Build Coastguard Worker     for (const MCPhysReg *CSR =
24*9880d681SAndroid Build Coastguard Worker       RegInfo->X86RegisterInfo::getCalleeSavedRegs(MF);
25*9880d681SAndroid Build Coastguard Worker       unsigned Reg = *CSR;
26*9880d681SAndroid Build Coastguard Worker        ++CSR)
27*9880d681SAndroid Build Coastguard Worker     {
28*9880d681SAndroid Build Coastguard Worker       if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg))
29*9880d681SAndroid Build Coastguard Worker         RestoreBasePointerOffset -= SlotSize;
30*9880d681SAndroid Build Coastguard Worker     }
31*9880d681SAndroid Build Coastguard Worker   }
32*9880d681SAndroid Build Coastguard Worker }
33*9880d681SAndroid Build Coastguard Worker 
34