mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +00:00
9b22626068
The register spiller assumes that only one new instruction is created when spilling and restoring registers, so we need to emit pseudo instructions for vector register spills and lower them after register allocation. v2: - Fix calculation of lane index - Extend VGPR liveness to end of program. v3: - Use SIMM16 field of S_NOP to specify multiple NOPs. https://bugs.freedesktop.org/show_bug.cgi?id=75005 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207843 91177308-0d34-0410-b5e6-96231b3b80d8
68 lines
2.0 KiB
C++
68 lines
2.0 KiB
C++
//===- 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_
|
|
|
|
#include "AMDGPUMachineFunction.h"
|
|
#include <map>
|
|
|
|
namespace llvm {
|
|
|
|
class MachineRegisterInfo;
|
|
|
|
/// This class keeps track of the SPI_SP_INPUT_ADDR config register, which
|
|
/// tells the hardware which interpolation parameters to load.
|
|
class SIMachineFunctionInfo : public AMDGPUMachineFunction {
|
|
void anchor() override;
|
|
public:
|
|
|
|
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) { }
|
|
/// \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);
|
|
void addSpilledReg(unsigned FrameIndex, unsigned Reg, int Lane = -1);
|
|
const SpilledReg& getSpilledReg(unsigned FrameIndex);
|
|
bool programSpillsRegisters() { return !SpilledRegisters.empty(); }
|
|
};
|
|
|
|
// SIMachineFunctionInfo definition
|
|
|
|
SIMachineFunctionInfo(const MachineFunction &MF);
|
|
unsigned PSInputAddr;
|
|
struct RegSpillTracker SpillTracker;
|
|
};
|
|
|
|
} // End namespace llvm
|
|
|
|
|
|
#endif //_SIMACHINEFUNCTIONINFO_H_
|