Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- X86MachineFuctionInfo.cpp - X86 machine function info -------------===// |
| 2 | // |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 7 | // |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "X86MachineFunctionInfo.h" |
Michael Liao | d8faa61 | 2014-12-04 00:56:38 +0000 | [diff] [blame^] | 11 | #include "X86RegisterInfo.h" |
| 12 | #include "llvm/Target/TargetSubtargetInfo.h" |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 13 | |
| 14 | using namespace llvm; |
| 15 | |
| 16 | void X86MachineFunctionInfo::anchor() { } |
Michael Liao | d8faa61 | 2014-12-04 00:56:38 +0000 | [diff] [blame^] | 17 | |
| 18 | void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) { |
| 19 | if (!RestoreBasePointerOffset) { |
| 20 | const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>( |
| 21 | MF->getSubtarget().getRegisterInfo()); |
| 22 | unsigned SlotSize = RegInfo->getSlotSize(); |
| 23 | for (const MCPhysReg *CSR = |
| 24 | RegInfo->X86RegisterInfo::getCalleeSavedRegs(MF); |
| 25 | unsigned Reg = *CSR; |
| 26 | ++CSR) |
| 27 | { |
| 28 | if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg)) |
| 29 | RestoreBasePointerOffset -= SlotSize; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |