Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
//===- AMDGPUGenRegisterBankInfo.def -----------------------------*- C++ -*-==//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// \file
|
|
|
|
/// This file defines all the static objects used by AMDGPURegisterBankInfo.
|
|
|
|
/// \todo This should be generated by TableGen.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace AMDGPU {
|
|
|
|
|
|
|
|
enum PartialMappingIdx {
|
|
|
|
None = - 1,
|
2018-03-01 22:08:51 +01:00
|
|
|
PM_SGPR1 = 0,
|
|
|
|
PM_SGPR16 = 4,
|
|
|
|
PM_SGPR32 = 5,
|
|
|
|
PM_SGPR64 = 6,
|
|
|
|
PM_SGPR128 = 7,
|
|
|
|
PM_SGPR256 = 8,
|
|
|
|
PM_SGPR512 = 9,
|
|
|
|
PM_VGPR1 = 10,
|
|
|
|
PM_VGPR16 = 14,
|
|
|
|
PM_VGPR32 = 15,
|
|
|
|
PM_VGPR64 = 16,
|
|
|
|
PM_VGPR128 = 17,
|
|
|
|
PM_VGPR256 = 18,
|
|
|
|
PM_VGPR512 = 19,
|
|
|
|
PM_SGPR96 = 20,
|
|
|
|
PM_VGPR96 = 21
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const RegisterBankInfo::PartialMapping PartMappings[] {
|
|
|
|
// StartIdx, Length, RegBank
|
2018-03-01 22:08:51 +01:00
|
|
|
{0, 1, SCCRegBank},
|
|
|
|
{0, 16, SGPRRegBank},
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
{0, 32, SGPRRegBank},
|
|
|
|
{0, 64, SGPRRegBank},
|
2018-03-01 22:08:51 +01:00
|
|
|
{0, 128, SGPRRegBank},
|
|
|
|
{0, 256, SGPRRegBank},
|
|
|
|
{0, 512, SGPRRegBank},
|
|
|
|
{0, 1, SGPRRegBank},
|
|
|
|
{0, 16, VGPRRegBank},
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
{0, 32, VGPRRegBank},
|
2018-03-01 20:27:10 +01:00
|
|
|
{0, 64, VGPRRegBank},
|
2018-03-01 22:08:51 +01:00
|
|
|
{0, 128, VGPRRegBank},
|
|
|
|
{0, 256, VGPRRegBank},
|
|
|
|
{0, 512, VGPRRegBank},
|
|
|
|
{0, 96, SGPRRegBank},
|
|
|
|
{0, 96, VGPRRegBank},
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const RegisterBankInfo::ValueMapping ValMappings[] {
|
|
|
|
{&PartMappings[0], 1},
|
2018-03-01 22:08:51 +01:00
|
|
|
{nullptr, 0},
|
|
|
|
{nullptr, 0},
|
|
|
|
{nullptr, 0},
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
{&PartMappings[1], 1},
|
|
|
|
{&PartMappings[2], 1},
|
2018-03-01 20:27:10 +01:00
|
|
|
{&PartMappings[3], 1},
|
|
|
|
{&PartMappings[4], 1},
|
2018-03-01 22:08:51 +01:00
|
|
|
{&PartMappings[5], 1},
|
|
|
|
{&PartMappings[6], 1},
|
|
|
|
{&PartMappings[7], 1},
|
|
|
|
{nullptr, 0},
|
|
|
|
{nullptr, 0},
|
|
|
|
{nullptr, 0},
|
|
|
|
{&PartMappings[8], 1},
|
|
|
|
{&PartMappings[9], 1},
|
|
|
|
{&PartMappings[10], 1},
|
|
|
|
{&PartMappings[11], 1},
|
|
|
|
{&PartMappings[12], 1},
|
|
|
|
{&PartMappings[13], 1},
|
|
|
|
{&PartMappings[14], 1},
|
|
|
|
{&PartMappings[15], 1}
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ValueMappingIdx {
|
|
|
|
SGPRStartIdx = 0,
|
2018-03-01 22:08:51 +01:00
|
|
|
VGPRStartIdx = 10
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const RegisterBankInfo::ValueMapping *getValueMapping(unsigned BankID,
|
|
|
|
unsigned Size) {
|
2018-03-01 20:27:10 +01:00
|
|
|
unsigned Idx;
|
2018-03-01 22:08:51 +01:00
|
|
|
switch (Size) {
|
|
|
|
case 1:
|
2018-03-01 20:27:10 +01:00
|
|
|
Idx = BankID == AMDGPU::SCCRegBankID ? PM_SGPR1 : PM_VGPR1;
|
2018-03-01 22:08:51 +01:00
|
|
|
break;
|
|
|
|
case 96:
|
|
|
|
Idx = BankID == AMDGPU::SGPRRegBankID ? PM_SGPR96 : PM_VGPR96;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Idx = BankID == AMDGPU::VGPRRegBankID ? VGPRStartIdx : SGPRStartIdx;
|
|
|
|
Idx += llvm::countTrailingZeros(Size);
|
|
|
|
break;
|
2018-03-01 20:27:10 +01:00
|
|
|
}
|
Re-commit AMDGPU/GlobalISel: Add support for simple shaders
Fix build when global-isel is disabled and fix a warning.
Summary: We can select constant/global G_LOAD, global G_STORE, and G_GEP.
Reviewers: qcolombet, MatzeB, t.p.northover, ab, arsenm
Subscribers: mehdi_amini, vkalintiris, kzhuravl, wdng, nhaehnle, mgorny, yaxunl, tony-tye, modocache, llvm-commits, dberris
Differential Revision: https://reviews.llvm.org/D26730
llvm-svn: 293551
2017-01-30 22:56:46 +01:00
|
|
|
return &ValMappings[Idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End AMDGPU namespace.
|
|
|
|
} // End llvm namespace.
|