Nick Lewycky | c3890d2 | 2015-07-29 22:32:47 +0000 | [diff] [blame] | 1 | //===-- X86MachineFunctionInfo.cpp - X86 machine function info ------------===// |
Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 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" |
Oren Ben Simhon | fe34c5e | 2017-03-14 09:09:26 +0000 | [diff] [blame] | 12 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
David Blaikie | b3bde2e | 2017-11-17 01:07:10 +0000 | [diff] [blame] | 13 | #include "llvm/CodeGen/TargetSubtargetInfo.h" |
David Blaikie | a379b181 | 2011-12-20 02:50:00 +0000 | [diff] [blame] | 14 | |
| 15 | using namespace llvm; |
| 16 | |
| 17 | void X86MachineFunctionInfo::anchor() { } |
Michael Liao | d8faa61 | 2014-12-04 00:56:38 +0000 | [diff] [blame] | 18 | |
| 19 | void X86MachineFunctionInfo::setRestoreBasePointer(const MachineFunction *MF) { |
| 20 | if (!RestoreBasePointerOffset) { |
| 21 | const X86RegisterInfo *RegInfo = static_cast<const X86RegisterInfo *>( |
| 22 | MF->getSubtarget().getRegisterInfo()); |
| 23 | unsigned SlotSize = RegInfo->getSlotSize(); |
Oren Ben Simhon | fe34c5e | 2017-03-14 09:09:26 +0000 | [diff] [blame] | 24 | for (const MCPhysReg *CSR = MF->getRegInfo().getCalleeSavedRegs(); |
| 25 | unsigned Reg = *CSR; ++CSR) { |
Michael Liao | d8faa61 | 2014-12-04 00:56:38 +0000 | [diff] [blame] | 26 | if (X86::GR64RegClass.contains(Reg) || X86::GR32RegClass.contains(Reg)) |
| 27 | RestoreBasePointerOffset -= SlotSize; |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |