2012-02-18 12:03:15 +00:00
|
|
|
//===-- X86RegisterInfo.h - X86 Register Information Impl -------*- C++ -*-===//
|
2005-04-21 23:38:14 +00:00
|
|
|
//
|
2003-10-21 15:17:13 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:38:14 +00:00
|
|
|
//
|
2003-10-21 15:17:13 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-25 22:55:53 +00:00
|
|
|
//
|
2008-02-10 18:45:23 +00:00
|
|
|
// This file contains the X86 implementation of the TargetRegisterInfo class.
|
2002-10-25 22:55:53 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_TARGET_X86_X86REGISTERINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_X86_X86REGISTERINFO_H
|
2002-10-25 22:55:53 +00:00
|
|
|
|
2008-02-10 18:45:23 +00:00
|
|
|
#include "llvm/Target/TargetRegisterInfo.h"
|
2011-06-27 18:32:37 +00:00
|
|
|
|
|
|
|
#define GET_REGINFO_HEADER
|
|
|
|
#include "X86GenRegisterInfo.inc"
|
2002-12-25 05:06:43 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
2006-09-05 02:12:02 +00:00
|
|
|
class Type;
|
|
|
|
class TargetInstrInfo;
|
2014-06-10 22:34:28 +00:00
|
|
|
class X86Subtarget;
|
2003-11-11 22:41:34 +00:00
|
|
|
|
2014-03-31 06:53:13 +00:00
|
|
|
class X86RegisterInfo final : public X86GenRegisterInfo {
|
2006-11-05 19:31:28 +00:00
|
|
|
public:
|
2014-06-10 22:34:28 +00:00
|
|
|
const X86Subtarget &Subtarget;
|
2006-11-05 19:31:28 +00:00
|
|
|
|
2006-09-08 06:48:29 +00:00
|
|
|
private:
|
|
|
|
/// Is64Bit - Is the target 64-bits.
|
2007-10-01 23:44:33 +00:00
|
|
|
///
|
2006-09-08 06:48:29 +00:00
|
|
|
bool Is64Bit;
|
|
|
|
|
2008-03-22 21:04:01 +00:00
|
|
|
/// IsWin64 - Is the target on of win64 flavours
|
|
|
|
///
|
|
|
|
bool IsWin64;
|
|
|
|
|
2006-09-08 06:48:29 +00:00
|
|
|
/// SlotSize - Stack slot size in bytes.
|
2007-10-01 23:44:33 +00:00
|
|
|
///
|
2006-09-08 06:48:29 +00:00
|
|
|
unsigned SlotSize;
|
|
|
|
|
|
|
|
/// StackPtr - X86 physical register used as stack ptr.
|
2007-10-01 23:44:33 +00:00
|
|
|
///
|
2006-09-08 06:48:29 +00:00
|
|
|
unsigned StackPtr;
|
|
|
|
|
|
|
|
/// FramePtr - X86 physical register used as frame ptr.
|
2007-10-01 23:44:33 +00:00
|
|
|
///
|
2006-09-08 06:48:29 +00:00
|
|
|
unsigned FramePtr;
|
|
|
|
|
2012-07-10 17:45:53 +00:00
|
|
|
/// BasePtr - X86 physical register used as a base ptr in complex stack
|
|
|
|
/// frames. I.e., when we need a 3rd base, not just SP and FP, due to
|
|
|
|
/// variable size stack objects.
|
|
|
|
unsigned BasePtr;
|
|
|
|
|
2006-09-08 06:48:29 +00:00
|
|
|
public:
|
2014-06-10 22:34:28 +00:00
|
|
|
X86RegisterInfo(const X86Subtarget &STI);
|
2002-12-25 05:06:43 +00:00
|
|
|
|
2011-05-24 16:57:53 +00:00
|
|
|
// FIXME: This should be tablegen'd like getDwarfRegNum is
|
|
|
|
int getSEHRegNum(unsigned i) const;
|
|
|
|
|
2002-12-28 20:32:54 +00:00
|
|
|
/// Code Generation virtual methods...
|
2012-04-23 21:39:35 +00:00
|
|
|
///
|
2014-03-09 07:44:38 +00:00
|
|
|
bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const override;
|
2008-10-27 07:14:50 +00:00
|
|
|
|
2009-07-18 02:10:10 +00:00
|
|
|
/// getMatchingSuperRegClass - Return a subclass of the specified register
|
|
|
|
/// class A so that each register in it has a sub-register of the
|
|
|
|
/// specified sub-register index which is in the specified register class B.
|
2014-03-09 07:44:38 +00:00
|
|
|
const TargetRegisterClass *
|
2009-07-18 02:10:10 +00:00
|
|
|
getMatchingSuperRegClass(const TargetRegisterClass *A,
|
2014-03-09 07:44:38 +00:00
|
|
|
const TargetRegisterClass *B,
|
|
|
|
unsigned Idx) const override;
|
2009-07-18 02:10:10 +00:00
|
|
|
|
2014-03-09 07:44:38 +00:00
|
|
|
const TargetRegisterClass *
|
|
|
|
getSubClassWithSubReg(const TargetRegisterClass *RC,
|
|
|
|
unsigned Idx) const override;
|
2011-10-05 20:26:33 +00:00
|
|
|
|
2011-04-26 18:52:33 +00:00
|
|
|
const TargetRegisterClass*
|
2014-03-09 07:44:38 +00:00
|
|
|
getLargestLegalSuperClass(const TargetRegisterClass *RC) const override;
|
2011-04-26 18:52:33 +00:00
|
|
|
|
2009-02-06 17:43:24 +00:00
|
|
|
/// getPointerRegClass - Returns a TargetRegisterClass used for pointer
|
|
|
|
/// values.
|
2012-05-07 22:10:26 +00:00
|
|
|
const TargetRegisterClass *
|
2014-03-09 07:44:38 +00:00
|
|
|
getPointerRegClass(const MachineFunction &MF,
|
|
|
|
unsigned Kind = 0) const override;
|
2009-02-06 17:43:24 +00:00
|
|
|
|
2008-10-27 07:14:50 +00:00
|
|
|
/// getCrossCopyRegClass - Returns a legal register class to copy a register
|
|
|
|
/// in the specified class to or from. Returns NULL if it is possible to copy
|
|
|
|
/// between a two registers of the specified class.
|
2007-09-26 21:31:07 +00:00
|
|
|
const TargetRegisterClass *
|
2014-03-09 07:44:38 +00:00
|
|
|
getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
|
2007-09-26 21:31:07 +00:00
|
|
|
|
2011-03-07 21:56:36 +00:00
|
|
|
unsigned getRegPressureLimit(const TargetRegisterClass *RC,
|
2014-03-09 07:44:38 +00:00
|
|
|
MachineFunction &MF) const override;
|
2011-03-07 21:56:36 +00:00
|
|
|
|
2007-01-02 21:33:40 +00:00
|
|
|
/// getCalleeSavedRegs - Return a null-terminated list of all of the
|
2006-05-18 00:12:58 +00:00
|
|
|
/// callee-save registers on this target.
|
2014-04-04 05:16:06 +00:00
|
|
|
const MCPhysReg *
|
2014-03-14 15:38:12 +00:00
|
|
|
getCalleeSavedRegs(const MachineFunction* MF) const override;
|
2014-03-09 07:44:38 +00:00
|
|
|
const uint32_t *getCallPreservedMask(CallingConv::ID) const override;
|
2012-10-15 22:39:43 +00:00
|
|
|
const uint32_t *getNoPreservedMask() const;
|
2006-05-18 00:12:58 +00:00
|
|
|
|
2007-02-19 21:49:54 +00:00
|
|
|
/// getReservedRegs - Returns a bitset indexed by physical register number
|
|
|
|
/// indicating if a register is a special register that has particular uses and
|
|
|
|
/// should be considered unavailable at all times, e.g. SP, RA. This is used by
|
|
|
|
/// register scavenger to determine what registers are free.
|
2014-03-09 07:44:38 +00:00
|
|
|
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
2007-02-19 21:49:54 +00:00
|
|
|
|
2012-07-10 17:45:53 +00:00
|
|
|
bool hasBasePointer(const MachineFunction &MF) const;
|
|
|
|
|
2010-01-19 18:31:11 +00:00
|
|
|
bool canRealignStack(const MachineFunction &MF) const;
|
|
|
|
|
2014-03-09 07:44:38 +00:00
|
|
|
bool needsStackRealignment(const MachineFunction &MF) const override;
|
2008-04-23 18:15:48 +00:00
|
|
|
|
2010-07-20 06:52:21 +00:00
|
|
|
bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
|
2014-03-09 07:44:38 +00:00
|
|
|
int &FrameIdx) const override;
|
2009-07-09 06:53:48 +00:00
|
|
|
|
2010-08-26 23:32:16 +00:00
|
|
|
void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
2013-01-31 20:02:54 +00:00
|
|
|
int SPAdj, unsigned FIOperandNum,
|
2014-04-28 04:05:08 +00:00
|
|
|
RegScavenger *RS = nullptr) const override;
|
2002-11-20 18:59:43 +00:00
|
|
|
|
2006-03-28 13:48:33 +00:00
|
|
|
// Debug information queries.
|
2014-03-09 07:44:38 +00:00
|
|
|
unsigned getFrameRegister(const MachineFunction &MF) const override;
|
2014-12-05 20:55:53 +00:00
|
|
|
unsigned getPtrSizedFrameRegister(const MachineFunction &MF) const;
|
2010-11-15 00:06:54 +00:00
|
|
|
unsigned getStackRegister() const { return StackPtr; }
|
2012-07-10 17:45:53 +00:00
|
|
|
unsigned getBaseRegister() const { return BasePtr; }
|
2010-11-15 00:06:54 +00:00
|
|
|
// FIXME: Move to FrameInfok
|
|
|
|
unsigned getSlotSize() const { return SlotSize; }
|
2002-10-25 22:55:53 +00:00
|
|
|
};
|
|
|
|
|
2006-05-05 05:40:20 +00:00
|
|
|
// getX86SubSuperRegister - X86 utility function. It returns the sub or super
|
|
|
|
// register of a specific X86 register.
|
2012-09-30 19:49:56 +00:00
|
|
|
// e.g. getX86SubSuperRegister(X86::EAX, MVT::i16) return X86:AX
|
|
|
|
unsigned getX86SubSuperRegister(unsigned, MVT::SimpleValueType, bool High=false);
|
2006-05-05 05:40:20 +00:00
|
|
|
|
2013-07-24 11:02:47 +00:00
|
|
|
//get512BitRegister - X86 utility - returns 512-bit super register
|
|
|
|
unsigned get512BitSuperRegister(unsigned Reg);
|
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2002-10-25 22:55:53 +00:00
|
|
|
#endif
|