mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-10 01:10:48 +00:00
19a99df130
The LDS output queue is accessed via the OQAP register. The OQAP register cannot be live across clauses, so if value is written to the output queue, it must be retrieved before the end of the clause. With the machine scheduler, we cannot statisfy this constraint, because it lacks proper alias analysis and it will mark some LDS accesses as having a chain dependency on vertex fetches. Since vertex fetches require a new clauses, the dependency may end up spiltting OQAP uses and defs so the end up in different clauses. See the lds-output-queue.ll test for a more detailed explanation. To work around this issue, we now combine the LDS read and the OQAP copy into one instruction and expand it after register allocation. This patch also adds some checks to the EmitClauseMarker pass, so that it doesn't end a clause with a value still in the output queue and removes AR.X and OQAP handling from the scheduler (AR.X uses and defs were already being expanded post-RA, so the scheduler will never see them). Reviewed-by: Vincent Lejeune <vljn at ovi.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194755 91177308-0d34-0410-b5e6-96231b3b80d8
101 lines
2.8 KiB
C++
101 lines
2.8 KiB
C++
//===-- R600RegisterInfo.cpp - R600 Register Information ------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
/// \file
|
|
/// \brief R600 implementation of the TargetRegisterInfo class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "R600RegisterInfo.h"
|
|
#include "AMDGPUTargetMachine.h"
|
|
#include "R600Defines.h"
|
|
#include "R600InstrInfo.h"
|
|
#include "R600MachineFunctionInfo.h"
|
|
|
|
using namespace llvm;
|
|
|
|
R600RegisterInfo::R600RegisterInfo(AMDGPUTargetMachine &tm)
|
|
: AMDGPURegisterInfo(tm),
|
|
TM(tm)
|
|
{ RCW.RegWeight = 0; RCW.WeightLimit = 0;}
|
|
|
|
BitVector R600RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
|
BitVector Reserved(getNumRegs());
|
|
|
|
const R600InstrInfo *TII = static_cast<const R600InstrInfo*>(TM.getInstrInfo());
|
|
|
|
Reserved.set(AMDGPU::ZERO);
|
|
Reserved.set(AMDGPU::HALF);
|
|
Reserved.set(AMDGPU::ONE);
|
|
Reserved.set(AMDGPU::ONE_INT);
|
|
Reserved.set(AMDGPU::NEG_HALF);
|
|
Reserved.set(AMDGPU::NEG_ONE);
|
|
Reserved.set(AMDGPU::PV_X);
|
|
Reserved.set(AMDGPU::ALU_LITERAL_X);
|
|
Reserved.set(AMDGPU::ALU_CONST);
|
|
Reserved.set(AMDGPU::PREDICATE_BIT);
|
|
Reserved.set(AMDGPU::PRED_SEL_OFF);
|
|
Reserved.set(AMDGPU::PRED_SEL_ZERO);
|
|
Reserved.set(AMDGPU::PRED_SEL_ONE);
|
|
Reserved.set(AMDGPU::INDIRECT_BASE_ADDR);
|
|
|
|
for (TargetRegisterClass::iterator I = AMDGPU::R600_AddrRegClass.begin(),
|
|
E = AMDGPU::R600_AddrRegClass.end(); I != E; ++I) {
|
|
Reserved.set(*I);
|
|
}
|
|
|
|
TII->reserveIndirectRegisters(Reserved, MF);
|
|
|
|
return Reserved;
|
|
}
|
|
|
|
const TargetRegisterClass *
|
|
R600RegisterInfo::getISARegClass(const TargetRegisterClass * rc) const {
|
|
switch (rc->getID()) {
|
|
case AMDGPU::GPRF32RegClassID:
|
|
case AMDGPU::GPRI32RegClassID:
|
|
return &AMDGPU::R600_Reg32RegClass;
|
|
default: return rc;
|
|
}
|
|
}
|
|
|
|
unsigned R600RegisterInfo::getHWRegChan(unsigned reg) const {
|
|
return this->getEncodingValue(reg) >> HW_CHAN_SHIFT;
|
|
}
|
|
|
|
unsigned R600RegisterInfo::getHWRegIndex(unsigned Reg) const {
|
|
return GET_REG_INDEX(getEncodingValue(Reg));
|
|
}
|
|
|
|
const TargetRegisterClass * R600RegisterInfo::getCFGStructurizerRegClass(
|
|
MVT VT) const {
|
|
switch(VT.SimpleTy) {
|
|
default:
|
|
case MVT::i32: return &AMDGPU::R600_TReg32RegClass;
|
|
}
|
|
}
|
|
|
|
const RegClassWeight &R600RegisterInfo::getRegClassWeight(
|
|
const TargetRegisterClass *RC) const {
|
|
return RCW;
|
|
}
|
|
|
|
bool R600RegisterInfo::isPhysRegLiveAcrossClauses(unsigned Reg) const {
|
|
assert(!TargetRegisterInfo::isVirtualRegister(Reg));
|
|
|
|
switch (Reg) {
|
|
case AMDGPU::OQAP:
|
|
case AMDGPU::OQBP:
|
|
case AMDGPU::AR_X:
|
|
return false;
|
|
default:
|
|
return true;
|
|
}
|
|
}
|