2014-05-24 14:50:23 +02:00
|
|
|
//==- AArch64RegisterInfo.h - AArch64 Register Information Impl --*- C++ -*-==//
|
2014-03-29 11:18:08 +01:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2014-05-24 14:50:23 +02:00
|
|
|
// This file contains the AArch64 implementation of the MRegisterInfo class.
|
2014-03-29 11:18:08 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERINFO_H
|
2014-03-29 11:18:08 +01:00
|
|
|
|
|
|
|
#define GET_REGINFO_HEADER
|
2014-05-24 14:50:23 +02:00
|
|
|
#include "AArch64GenRegisterInfo.inc"
|
2014-03-29 11:18:08 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MachineFunction;
|
|
|
|
class RegScavenger;
|
|
|
|
class TargetRegisterClass;
|
2015-03-12 03:04:46 +01:00
|
|
|
class Triple;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
2014-05-24 14:50:23 +02:00
|
|
|
struct AArch64RegisterInfo : public AArch64GenRegisterInfo {
|
2014-03-29 11:18:08 +01:00
|
|
|
private:
|
2015-03-18 21:37:30 +01:00
|
|
|
const Triple &TT;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
|
|
|
public:
|
2015-03-18 21:37:30 +01:00
|
|
|
AArch64RegisterInfo(const Triple &TT);
|
2014-03-29 11:18:08 +01:00
|
|
|
|
|
|
|
bool isReservedReg(const MachineFunction &MF, unsigned Reg) const;
|
2014-03-30 09:25:18 +02:00
|
|
|
|
|
|
|
/// Code Generation virtual methods...
|
2015-03-11 22:41:28 +01:00
|
|
|
const MCPhysReg *getCalleeSavedRegs(const MachineFunction *MF) const override;
|
2015-03-11 23:42:13 +01:00
|
|
|
const uint32_t *getCallPreservedMask(const MachineFunction &MF,
|
|
|
|
CallingConv::ID) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
2014-04-29 09:58:25 +02:00
|
|
|
unsigned getCSRFirstUseCost() const override {
|
2014-03-31 23:06:36 +02:00
|
|
|
// The cost will be compared against BlockFrequency where entry has the
|
|
|
|
// value of 1 << 14. A value of 5 will choose to spill or split really
|
|
|
|
// cold path instead of using a callee-saved register.
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
2014-03-29 11:18:08 +01:00
|
|
|
// Calls involved in thread-local variable lookup save more registers than
|
|
|
|
// normal calls, so they need a different mask to represent this.
|
|
|
|
const uint32_t *getTLSCallPreservedMask() const;
|
|
|
|
|
|
|
|
/// getThisReturnPreservedMask - Returns a call preserved mask specific to the
|
|
|
|
/// case that 'returned' is on an i64 first argument if the calling convention
|
|
|
|
/// is one that can (partially) model this attribute with a preserved mask
|
|
|
|
/// (i.e. it is a calling convention that uses the same register for the first
|
|
|
|
/// i64 argument and an i64 return value)
|
|
|
|
///
|
|
|
|
/// Should return NULL in the case that the calling convention does not have
|
|
|
|
/// this property
|
2015-03-11 23:42:13 +01:00
|
|
|
const uint32_t *getThisReturnPreservedMask(const MachineFunction &MF,
|
|
|
|
CallingConv::ID) const;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
2014-03-30 09:25:18 +02:00
|
|
|
BitVector getReservedRegs(const MachineFunction &MF) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
const TargetRegisterClass *
|
2014-03-30 09:25:18 +02:00
|
|
|
getPointerRegClass(const MachineFunction &MF,
|
|
|
|
unsigned Kind = 0) const override;
|
|
|
|
const TargetRegisterClass *
|
|
|
|
getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
2014-03-30 09:25:18 +02:00
|
|
|
bool requiresRegisterScavenging(const MachineFunction &MF) const override;
|
|
|
|
bool useFPForScavengingIndex(const MachineFunction &MF) const override;
|
|
|
|
bool requiresFrameIndexScavenging(const MachineFunction &MF) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
2014-03-30 09:25:18 +02:00
|
|
|
bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const override;
|
2015-03-20 18:20:07 +01:00
|
|
|
bool isFrameOffsetLegal(const MachineInstr *MI, unsigned BaseReg,
|
2014-03-30 09:25:18 +02:00
|
|
|
int64_t Offset) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
void materializeFrameBaseRegister(MachineBasicBlock *MBB, unsigned BaseReg,
|
2014-03-30 09:25:18 +02:00
|
|
|
int FrameIdx,
|
|
|
|
int64_t Offset) const override;
|
2014-04-02 21:28:18 +02:00
|
|
|
void resolveFrameIndex(MachineInstr &MI, unsigned BaseReg,
|
2014-03-30 09:25:18 +02:00
|
|
|
int64_t Offset) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
|
|
|
unsigned FIOperandNum,
|
2014-04-28 06:05:08 +02:00
|
|
|
RegScavenger *RS = nullptr) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
bool cannotEliminateFrame(const MachineFunction &MF) const;
|
2014-03-30 09:25:18 +02:00
|
|
|
|
|
|
|
bool requiresVirtualBaseRegisters(const MachineFunction &MF) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
bool hasBasePointer(const MachineFunction &MF) const;
|
|
|
|
unsigned getBaseRegister() const;
|
|
|
|
|
|
|
|
// Debug information queries.
|
2014-03-30 09:25:18 +02:00
|
|
|
unsigned getFrameRegister(const MachineFunction &MF) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
|
|
|
|
unsigned getRegPressureLimit(const TargetRegisterClass *RC,
|
2014-03-30 09:25:18 +02:00
|
|
|
MachineFunction &MF) const override;
|
2015-04-09 10:49:47 +02:00
|
|
|
// Base pointer (stack realignment) support.
|
|
|
|
bool canRealignStack(const MachineFunction &MF) const;
|
|
|
|
bool needsStackRealignment(const MachineFunction &MF) const override;
|
2014-03-29 11:18:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#endif
|