2012-12-12 05:25:42 +08: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-02 05:47:53 +08:00
|
|
|
#include "AMDGPUMachineFunction.h"
|
2013-11-28 05:23:35 +08:00
|
|
|
#include <map>
|
2012-12-12 05:25:42 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2013-11-28 05:23:35 +08:00
|
|
|
class MachineRegisterInfo;
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
/// This class keeps track of the SPI_SP_INPUT_ADDR config register, which
|
|
|
|
/// tells the hardware which interpolation parameters to load.
|
2013-04-02 05:47:53 +08:00
|
|
|
class SIMachineFunctionInfo : public AMDGPUMachineFunction {
|
2013-11-19 08:57:56 +08:00
|
|
|
virtual void anchor();
|
2012-12-12 05:25:42 +08:00
|
|
|
public:
|
2013-11-28 05:23:35 +08: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) { }
|
|
|
|
unsigned getNextLane(MachineRegisterInfo &MRI);
|
|
|
|
void addSpilledReg(unsigned FrameIndex, unsigned Reg, int Lane = -1);
|
|
|
|
const SpilledReg& getSpilledReg(unsigned FrameIndex);
|
|
|
|
bool programSpillsRegisters() { return !SpilledRegisters.empty(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
// SIMachineFunctionInfo definition
|
|
|
|
|
2012-12-12 05:25:42 +08:00
|
|
|
SIMachineFunctionInfo(const MachineFunction &MF);
|
2013-03-07 17:04:14 +08:00
|
|
|
unsigned PSInputAddr;
|
2013-11-28 05:23:35 +08:00
|
|
|
struct RegSpillTracker SpillTracker;
|
2012-12-12 05:25:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End namespace llvm
|
|
|
|
|
|
|
|
|
|
|
|
#endif //_SIMACHINEFUNCTIONINFO_H_
|