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