2012-12-11 21:25:42 +00:00
|
|
|
//===- SIMachineFunctionInfo.h - SIMachineFunctionInfo interface -*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SIMACHINEFUNCTIONINFO_H_
|
|
|
|
#define SIMACHINEFUNCTIONINFO_H_
|
|
|
|
|
2013-04-01 21:47:53 +00:00
|
|
|
#include "AMDGPUMachineFunction.h"
|
2013-11-27 21:23:35 +00:00
|
|
|
#include <map>
|
2012-12-11 21:25:42 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2013-11-27 21:23:35 +00:00
|
|
|
class MachineRegisterInfo;
|
|
|
|
|
2012-12-11 21:25:42 +00:00
|
|
|
/// This class keeps track of the SPI_SP_INPUT_ADDR config register, which
|
|
|
|
/// tells the hardware which interpolation parameters to load.
|
2013-04-01 21:47:53 +00:00
|
|
|
class SIMachineFunctionInfo : public AMDGPUMachineFunction {
|
2014-04-29 07:57:24 +00:00
|
|
|
void anchor() override;
|
2012-12-11 21:25:42 +00:00
|
|
|
public:
|
2013-11-27 21:23:35 +00:00
|
|
|
|
|
|
|
struct SpilledReg {
|
|
|
|
unsigned VGPR;
|
|
|
|
int Lane;
|
|
|
|
SpilledReg(unsigned R, int L) : VGPR (R), Lane (L) { }
|
|
|
|
SpilledReg() : VGPR(0), Lane(-1) { }
|
|
|
|
bool hasLane() { return Lane != -1;}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RegSpillTracker {
|
|
|
|
private:
|
|
|
|
unsigned CurrentLane;
|
|
|
|
std::map<unsigned, SpilledReg> SpilledRegisters;
|
|
|
|
public:
|
|
|
|
unsigned LaneVGPR;
|
|
|
|
RegSpillTracker() : CurrentLane(0), SpilledRegisters(), LaneVGPR(0) { }
|
2014-05-02 15:41:42 +00:00
|
|
|
/// \p NumRegs The number of consecutive registers what need to be spilled.
|
|
|
|
/// This function will ensure that all registers are stored in
|
|
|
|
/// the same VGPR.
|
|
|
|
/// \returns The lane to be used for storing the first register.
|
|
|
|
unsigned reserveLanes(MachineRegisterInfo &MRI, MachineFunction *MF,
|
|
|
|
unsigned NumRegs = 1);
|
2013-11-27 21:23:35 +00:00
|
|
|
void addSpilledReg(unsigned FrameIndex, unsigned Reg, int Lane = -1);
|
|
|
|
const SpilledReg& getSpilledReg(unsigned FrameIndex);
|
|
|
|
bool programSpillsRegisters() { return !SpilledRegisters.empty(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIMachineFunctionInfo definition
|
|
|
|
|
2012-12-11 21:25:42 +00:00
|
|
|
SIMachineFunctionInfo(const MachineFunction &MF);
|
2013-03-07 09:04:14 +00:00
|
|
|
unsigned PSInputAddr;
|
2013-11-27 21:23:35 +00:00
|
|
|
struct RegSpillTracker SpillTracker;
|
2012-12-11 21:25:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End namespace llvm
|
|
|
|
|
|
|
|
|
|
|
|
#endif //_SIMACHINEFUNCTIONINFO_H_
|