2012-02-18 20:03:15 +08:00
|
|
|
//===-- PPCRegisterInfo.h - PowerPC Register Information Impl ---*- C++ -*-===//
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-17 12:55:41 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:30:14 +08:00
|
|
|
//
|
2004-08-17 12:55:41 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-02-11 02:45:23 +08:00
|
|
|
// This file contains the PowerPC implementation of the TargetRegisterInfo
|
|
|
|
// class.
|
2004-08-17 12:55:41 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef POWERPC32_REGISTERINFO_H
|
|
|
|
#define POWERPC32_REGISTERINFO_H
|
|
|
|
|
2013-03-31 22:43:31 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2005-10-15 07:51:18 +08:00
|
|
|
#include "PPC.h"
|
2004-08-17 12:55:41 +08:00
|
|
|
|
2011-06-28 02:32:37 +08:00
|
|
|
#define GET_REGINFO_HEADER
|
|
|
|
#include "PPCGenRegisterInfo.inc"
|
|
|
|
|
2004-08-17 12:55:41 +08:00
|
|
|
namespace llvm {
|
2006-07-11 08:48:23 +08:00
|
|
|
class PPCSubtarget;
|
2006-11-28 07:37:22 +08:00
|
|
|
class TargetInstrInfo;
|
2004-08-17 12:55:41 +08:00
|
|
|
class Type;
|
|
|
|
|
2005-10-16 13:39:50 +08:00
|
|
|
class PPCRegisterInfo : public PPCGenRegisterInfo {
|
2013-03-31 22:43:31 +08:00
|
|
|
DenseMap<unsigned, unsigned> ImmToIdxMap;
|
2006-07-11 08:48:23 +08:00
|
|
|
const PPCSubtarget &Subtarget;
|
2004-08-17 12:55:41 +08:00
|
|
|
public:
|
2013-06-07 15:55:53 +08:00
|
|
|
PPCRegisterInfo(const PPCSubtarget &SubTarget);
|
2006-04-18 05:07:20 +08:00
|
|
|
|
2009-02-07 01:43:24 +08:00
|
|
|
/// getPointerRegClass - Return the register class to use to hold pointers.
|
|
|
|
/// This is used for addressing modes.
|
2012-05-08 06:10:26 +08:00
|
|
|
virtual const TargetRegisterClass *
|
|
|
|
getPointerRegClass(const MachineFunction &MF, unsigned Kind=0) const;
|
2009-02-07 01:43:24 +08:00
|
|
|
|
2011-11-23 00:21:04 +08:00
|
|
|
unsigned getRegPressureLimit(const TargetRegisterClass *RC,
|
|
|
|
MachineFunction &MF) const;
|
|
|
|
|
2004-08-17 12:55:41 +08:00
|
|
|
/// Code Generation virtual methods...
|
2012-03-04 11:33:22 +08:00
|
|
|
const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
2012-09-17 02:10:23 +08:00
|
|
|
const uint32_t *getCallPreservedMask(CallingConv::ID CC) const;
|
2013-03-22 05:37:52 +08:00
|
|
|
const uint32_t *getNoPreservedMask() const;
|
2006-05-18 08:12:58 +08:00
|
|
|
|
2007-02-20 05:49:54 +08:00
|
|
|
BitVector getReservedRegs(const MachineFunction &MF) const;
|
|
|
|
|
2013-03-15 04:21:47 +08:00
|
|
|
/// We require the register scavenger.
|
2013-03-12 22:12:16 +08:00
|
|
|
bool requiresRegisterScavenging(const MachineFunction &MF) const {
|
|
|
|
return true;
|
|
|
|
}
|
2008-03-04 06:19:16 +08:00
|
|
|
|
2013-03-15 04:21:47 +08:00
|
|
|
bool requiresFrameIndexScavenging(const MachineFunction &MF) const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool trackLivenessAfterRegAlloc(const MachineFunction &MF) const {
|
|
|
|
return true;
|
|
|
|
}
|
2012-04-24 05:39:35 +08:00
|
|
|
|
2013-04-10 01:27:09 +08:00
|
|
|
virtual bool requiresVirtualBaseRegisters(const MachineFunction &MF) const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-03-24 03:36:47 +08:00
|
|
|
void lowerDynamicAlloc(MachineBasicBlock::iterator II) const;
|
|
|
|
void lowerCRSpilling(MachineBasicBlock::iterator II,
|
|
|
|
unsigned FrameIndex) const;
|
|
|
|
void lowerCRRestore(MachineBasicBlock::iterator II,
|
|
|
|
unsigned FrameIndex) const;
|
|
|
|
void lowerVRSAVESpilling(MachineBasicBlock::iterator II,
|
|
|
|
unsigned FrameIndex) const;
|
|
|
|
void lowerVRSAVERestore(MachineBasicBlock::iterator II,
|
|
|
|
unsigned FrameIndex) const;
|
2013-03-22 03:03:21 +08:00
|
|
|
|
2012-09-12 22:47:47 +08:00
|
|
|
bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
|
|
|
|
int &FrameIdx) const;
|
2010-08-27 07:32:16 +08:00
|
|
|
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
2013-02-01 04:02:54 +08:00
|
|
|
int SPAdj, unsigned FIOperandNum,
|
|
|
|
RegScavenger *RS = NULL) const;
|
2004-08-17 12:55:41 +08:00
|
|
|
|
2013-04-10 01:27:09 +08:00
|
|
|
// Support for virtual base registers.
|
|
|
|
bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const;
|
|
|
|
void materializeFrameBaseRegister(MachineBasicBlock *MBB,
|
|
|
|
unsigned BaseReg, int FrameIdx,
|
|
|
|
int64_t Offset) const;
|
|
|
|
void resolveFrameIndex(MachineBasicBlock::iterator I,
|
|
|
|
unsigned BaseReg, int64_t Offset) const;
|
|
|
|
bool isFrameOffsetLegal(const MachineInstr *MI, int64_t Offset) const;
|
|
|
|
|
2006-03-28 21:48:33 +08:00
|
|
|
// Debug information queries.
|
2009-11-13 05:00:03 +08:00
|
|
|
unsigned getFrameRegister(const MachineFunction &MF) const;
|
2007-02-22 06:54:50 +08:00
|
|
|
|
2013-07-17 08:45:52 +08:00
|
|
|
// Base pointer (stack realignment) support.
|
|
|
|
unsigned getBaseRegister(const MachineFunction &MF) const;
|
|
|
|
bool hasBasePointer(const MachineFunction &MF) const;
|
|
|
|
bool canRealignStack(const MachineFunction &MF) const;
|
|
|
|
bool needsStackRealignment(const MachineFunction &MF) const;
|
|
|
|
|
2007-02-22 06:54:50 +08:00
|
|
|
// Exception handling queries.
|
|
|
|
unsigned getEHExceptionRegister() const;
|
|
|
|
unsigned getEHHandlerRegister() const;
|
2004-08-17 12:55:41 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|