radeon/llvm: Merge AMDILSubtarget into AMDGPUSubtarget
This commit is contained in:
@@ -5,75 +5,78 @@ using namespace llvm;
|
||||
|
||||
#define GET_SUBTARGETINFO_ENUM
|
||||
#define GET_SUBTARGETINFO_TARGET_DESC
|
||||
#define GET_SUBTARGETINFO_CTOR
|
||||
#include "AMDGPUGenSubtargetInfo.inc"
|
||||
|
||||
AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS) :
|
||||
AMDILSubtarget(TT, CPU, FS) {
|
||||
AMDGPUGenSubtargetInfo(TT, CPU, FS), mDumpCode(false) {
|
||||
InstrItins = getInstrItineraryForCPU(CPU);
|
||||
|
||||
memset(CapsOverride, 0, sizeof(*CapsOverride)
|
||||
* AMDILDeviceInfo::MaxNumberCapabilities);
|
||||
// Default card
|
||||
std::string GPU = "rv770";
|
||||
GPU = CPU;
|
||||
StringRef GPU = CPU;
|
||||
mIs64bit = false;
|
||||
mVersion = 0;
|
||||
SmallVector<StringRef, DEFAULT_VEC_SLOTS> Features;
|
||||
SplitString(FS, Features, ",");
|
||||
mDefaultSize[0] = 64;
|
||||
mDefaultSize[1] = 1;
|
||||
mDefaultSize[2] = 1;
|
||||
std::string newFeatures = "";
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
bool useTest = false;
|
||||
#endif
|
||||
for (size_t x = 0; x < Features.size(); ++x) {
|
||||
if (Features[x].startswith("+mwgs")) {
|
||||
SmallVector<StringRef, DEFAULT_VEC_SLOTS> sizes;
|
||||
SplitString(Features[x], sizes, "-");
|
||||
size_t mDim = ::atoi(sizes[1].data());
|
||||
if (mDim > 3) {
|
||||
mDim = 3;
|
||||
}
|
||||
for (size_t y = 0; y < mDim; ++y) {
|
||||
mDefaultSize[y] = ::atoi(sizes[y+2].data());
|
||||
}
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
} else if (!Features[x].compare("test")) {
|
||||
useTest = true;
|
||||
#endif
|
||||
} else if (Features[x].startswith("+cal")) {
|
||||
SmallVector<StringRef, DEFAULT_VEC_SLOTS> version;
|
||||
SplitString(Features[x], version, "=");
|
||||
mVersion = ::atoi(version[1].data());
|
||||
} else {
|
||||
GPU = CPU;
|
||||
if (x > 0) newFeatures += ',';
|
||||
newFeatures += Features[x];
|
||||
}
|
||||
}
|
||||
// If we don't have a version then set it to
|
||||
// -1 which enables everything. This is for
|
||||
// offline devices.
|
||||
if (!mVersion) {
|
||||
mVersion = (uint32_t)-1;
|
||||
}
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
if (!mDefaultSize[x]) {
|
||||
mDefaultSize[x] = 1;
|
||||
}
|
||||
}
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
if (useTest) {
|
||||
GPU = "kauai";
|
||||
}
|
||||
#endif
|
||||
ParseSubtargetFeatures(GPU, newFeatures);
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
if (useTest) {
|
||||
GPU = "test";
|
||||
}
|
||||
#endif
|
||||
ParseSubtargetFeatures(GPU, FS);
|
||||
mDevName = GPU;
|
||||
mDevice = AMDILDeviceInfo::getDeviceFromName(mDevName, this, mIs64bit);
|
||||
}
|
||||
|
||||
AMDGPUSubtarget::~AMDGPUSubtarget()
|
||||
{
|
||||
delete mDevice;
|
||||
}
|
||||
|
||||
bool
|
||||
AMDGPUSubtarget::isOverride(AMDILDeviceInfo::Caps caps) const
|
||||
{
|
||||
assert(caps < AMDILDeviceInfo::MaxNumberCapabilities &&
|
||||
"Caps index is out of bounds!");
|
||||
return CapsOverride[caps];
|
||||
}
|
||||
bool
|
||||
AMDGPUSubtarget::is64bit() const
|
||||
{
|
||||
return mIs64bit;
|
||||
}
|
||||
bool
|
||||
AMDGPUSubtarget::isTargetELF() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
size_t
|
||||
AMDGPUSubtarget::getDefaultSize(uint32_t dim) const
|
||||
{
|
||||
if (dim > 3) {
|
||||
return 1;
|
||||
} else {
|
||||
return mDefaultSize[dim];
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
AMDGPUSubtarget::getDataLayout() const
|
||||
{
|
||||
if (!mDevice) {
|
||||
return std::string("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16"
|
||||
"-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32"
|
||||
"-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64"
|
||||
"-v96:128:128-v128:128:128-v192:256:256-v256:256:256"
|
||||
"-v512:512:512-v1024:1024:1024-v2048:2048:2048-a0:0:64");
|
||||
}
|
||||
return mDevice->getDataLayout();
|
||||
}
|
||||
|
||||
std::string
|
||||
AMDGPUSubtarget::getDeviceName() const
|
||||
{
|
||||
return mDevName;
|
||||
}
|
||||
const AMDILDevice *
|
||||
AMDGPUSubtarget::device() const
|
||||
{
|
||||
return mDevice;
|
||||
}
|
||||
|
||||
@@ -13,22 +13,50 @@
|
||||
|
||||
#ifndef _AMDGPUSUBTARGET_H_
|
||||
#define _AMDGPUSUBTARGET_H_
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDILDevice.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
|
||||
#define GET_SUBTARGETINFO_HEADER
|
||||
#include "AMDGPUGenSubtargetInfo.inc"
|
||||
|
||||
#define MAX_CB_SIZE (1 << 16)
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class AMDGPUSubtarget : public AMDILSubtarget
|
||||
class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo
|
||||
{
|
||||
private:
|
||||
bool CapsOverride[AMDILDeviceInfo::MaxNumberCapabilities];
|
||||
const AMDILDevice *mDevice;
|
||||
size_t mDefaultSize[3];
|
||||
size_t mMinimumSize[3];
|
||||
std::string mDevName;
|
||||
bool mIs64bit;
|
||||
bool mIs32on64bit;
|
||||
bool mDumpCode;
|
||||
|
||||
InstrItineraryData InstrItins;
|
||||
|
||||
public:
|
||||
AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS);
|
||||
virtual ~AMDGPUSubtarget();
|
||||
|
||||
const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
|
||||
virtual void ParseSubtargetFeatures(llvm::StringRef CPU, llvm::StringRef FS);
|
||||
|
||||
bool isOverride(AMDILDeviceInfo::Caps) const;
|
||||
bool is64bit() const;
|
||||
|
||||
// Helper functions to simplify if statements
|
||||
bool isTargetELF() const;
|
||||
const AMDILDevice* device() const;
|
||||
std::string getDataLayout() const;
|
||||
std::string getDeviceName() const;
|
||||
virtual size_t getDefaultSize(uint32_t dim) const;
|
||||
bool dumpCode() const { return mDumpCode; }
|
||||
|
||||
};
|
||||
|
||||
} // End namespace llvm
|
||||
|
||||
@@ -78,7 +78,7 @@ bool AMDGPUTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
DisableVerify);
|
||||
assert(fail);
|
||||
|
||||
const AMDILSubtarget &STM = getSubtarget<AMDILSubtarget>();
|
||||
const AMDGPUSubtarget &STM = getSubtarget<AMDGPUSubtarget>();
|
||||
std::string gpu = STM.getDeviceName();
|
||||
if (gpu == "SI") {
|
||||
PM.add(createSICodeEmitterPass(Out));
|
||||
@@ -119,7 +119,7 @@ TargetPassConfig *AMDGPUTargetMachine::createPassConfig(PassManagerBase &PM) {
|
||||
bool
|
||||
AMDGPUPassConfig::addPreISel()
|
||||
{
|
||||
const AMDILSubtarget &ST = TM->getSubtarget<AMDILSubtarget>();
|
||||
const AMDGPUSubtarget &ST = TM->getSubtarget<AMDGPUSubtarget>();
|
||||
if (ST.device()->getGeneration() <= AMDILDeviceInfo::HD6XXX) {
|
||||
PM->add(createR600KernelParametersPass(
|
||||
getAMDGPUTargetMachine().getTargetData()));
|
||||
@@ -134,7 +134,7 @@ bool AMDGPUPassConfig::addInstSelector() {
|
||||
}
|
||||
|
||||
bool AMDGPUPassConfig::addPreRegAlloc() {
|
||||
const AMDILSubtarget &ST = TM->getSubtarget<AMDILSubtarget>();
|
||||
const AMDGPUSubtarget &ST = TM->getSubtarget<AMDGPUSubtarget>();
|
||||
|
||||
if (ST.device()->getGeneration() > AMDILDeviceInfo::HD6XXX) {
|
||||
PM->add(createSIAssignInterpRegsPass(*TM));
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
//==-----------------------------------------------------------------------===//
|
||||
#include "AMDIL7XXDevice.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
#ifdef UPSTREAM_LLVM
|
||||
#include "AMDIL7XXAsmPrinter.h"
|
||||
#endif
|
||||
@@ -14,7 +15,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
AMDIL7XXDevice::AMDIL7XXDevice(AMDILSubtarget *ST) : AMDILDevice(ST)
|
||||
AMDIL7XXDevice::AMDIL7XXDevice(AMDGPUSubtarget *ST) : AMDILDevice(ST)
|
||||
{
|
||||
setCaps();
|
||||
std::string name = mSTM->getDeviceName();
|
||||
@@ -101,7 +102,7 @@ AMDIL7XXDevice::getAsmPrinter(TargetMachine& TM, MCStreamer &Streamer) const
|
||||
#endif
|
||||
}
|
||||
|
||||
AMDIL770Device::AMDIL770Device(AMDILSubtarget *ST): AMDIL7XXDevice(ST)
|
||||
AMDIL770Device::AMDIL770Device(AMDGPUSubtarget *ST): AMDIL7XXDevice(ST)
|
||||
{
|
||||
setCaps();
|
||||
}
|
||||
@@ -127,7 +128,7 @@ size_t AMDIL770Device::getWavefrontSize() const
|
||||
return AMDILDevice::WavefrontSize;
|
||||
}
|
||||
|
||||
AMDIL710Device::AMDIL710Device(AMDILSubtarget *ST) : AMDIL7XXDevice(ST)
|
||||
AMDIL710Device::AMDIL710Device(AMDGPUSubtarget *ST) : AMDIL7XXDevice(ST)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
#ifndef _AMDIL7XXDEVICEIMPL_H_
|
||||
#define _AMDIL7XXDEVICEIMPL_H_
|
||||
#include "AMDILDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
|
||||
namespace llvm {
|
||||
class AMDILSubtarget;
|
||||
class AMDGPUSubtarget;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 7XX generation of devices and their respective sub classes
|
||||
@@ -32,7 +31,7 @@ class AMDILSubtarget;
|
||||
// compliant and nothing more.
|
||||
class AMDIL7XXDevice : public AMDILDevice {
|
||||
public:
|
||||
AMDIL7XXDevice(AMDILSubtarget *ST);
|
||||
AMDIL7XXDevice(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDIL7XXDevice();
|
||||
virtual size_t getMaxLDSSize() const;
|
||||
virtual size_t getWavefrontSize() const;
|
||||
@@ -52,7 +51,7 @@ protected:
|
||||
// and has a larger wavefront size.
|
||||
class AMDIL770Device : public AMDIL7XXDevice {
|
||||
public:
|
||||
AMDIL770Device(AMDILSubtarget *ST);
|
||||
AMDIL770Device(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDIL770Device();
|
||||
virtual size_t getWavefrontSize() const;
|
||||
private:
|
||||
@@ -64,7 +63,7 @@ private:
|
||||
// functions in order to correctly specify this information.
|
||||
class AMDIL710Device : public AMDIL7XXDevice {
|
||||
public:
|
||||
AMDIL710Device(AMDILSubtarget *ST);
|
||||
AMDIL710Device(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDIL710Device();
|
||||
virtual size_t getWavefrontSize() const;
|
||||
}; // AMDIL710Device
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
//
|
||||
//==-----------------------------------------------------------------------===//
|
||||
#include "AMDILDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
using namespace llvm;
|
||||
// Default implementation for all of the classes.
|
||||
AMDILDevice::AMDILDevice(AMDILSubtarget *ST) : mSTM(ST)
|
||||
AMDILDevice::AMDILDevice(AMDGPUSubtarget *ST) : mSTM(ST)
|
||||
{
|
||||
mHWBits.resize(AMDILDeviceInfo::MaxNumberCapabilities);
|
||||
mSWBits.resize(AMDILDeviceInfo::MaxNumberCapabilities);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
||||
namespace llvm {
|
||||
class AMDILSubtarget;
|
||||
class AMDGPUSubtarget;
|
||||
class AMDILAsmPrinter;
|
||||
class AMDILPointerManager;
|
||||
class AsmPrinter;
|
||||
@@ -30,7 +30,7 @@ namespace llvm {
|
||||
//===----------------------------------------------------------------------===//
|
||||
class AMDILDevice {
|
||||
public:
|
||||
AMDILDevice(AMDILSubtarget *ST);
|
||||
AMDILDevice(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDILDevice();
|
||||
|
||||
// Enum values for the various memory types.
|
||||
@@ -111,7 +111,7 @@ protected:
|
||||
virtual void setCaps();
|
||||
llvm::BitVector mHWBits;
|
||||
llvm::BitVector mSWBits;
|
||||
AMDILSubtarget *mSTM;
|
||||
AMDGPUSubtarget *mSTM;
|
||||
uint32_t mDeviceFlag;
|
||||
private:
|
||||
AMDILDeviceInfo::ExecutionMode
|
||||
|
||||
@@ -11,13 +11,14 @@
|
||||
//
|
||||
//==-----------------------------------------------------------------------===//
|
||||
#include "AMDILDevices.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
using namespace llvm;
|
||||
namespace llvm {
|
||||
namespace AMDILDeviceInfo {
|
||||
AMDILDevice*
|
||||
getDeviceFromName(const std::string &deviceName, AMDILSubtarget *ptr, bool is64bit, bool is64on32bit)
|
||||
getDeviceFromName(const std::string &deviceName, AMDGPUSubtarget *ptr,
|
||||
bool is64bit, bool is64on32bit)
|
||||
{
|
||||
if (deviceName.c_str()[2] == '7') {
|
||||
switch (deviceName.c_str()[3]) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace llvm
|
||||
{
|
||||
class AMDILDevice;
|
||||
class AMDILSubtarget;
|
||||
class AMDGPUSubtarget;
|
||||
namespace AMDILDeviceInfo
|
||||
{
|
||||
// Each Capabilities can be executed using a hardware instruction,
|
||||
@@ -83,7 +83,8 @@ namespace llvm
|
||||
|
||||
|
||||
AMDILDevice*
|
||||
getDeviceFromName(const std::string &name, AMDILSubtarget *ptr, bool is64bit = false, bool is64on32bit = false);
|
||||
getDeviceFromName(const std::string &name, AMDGPUSubtarget *ptr,
|
||||
bool is64bit = false, bool is64on32bit = false);
|
||||
} // namespace AMDILDeviceInfo
|
||||
} // namespace llvm
|
||||
#endif // _AMDILDEVICEINFO_H_
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
AMDILEvergreenDevice::AMDILEvergreenDevice(AMDILSubtarget *ST)
|
||||
AMDILEvergreenDevice::AMDILEvergreenDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILDevice(ST) {
|
||||
setCaps();
|
||||
std::string name = ST->getDeviceName();
|
||||
@@ -56,11 +56,7 @@ uint32_t AMDILEvergreenDevice::getResourceID(uint32_t id) const {
|
||||
break;
|
||||
case CONSTANT_ID:
|
||||
case RAW_UAV_ID:
|
||||
if (mSTM->calVersion() >= CAL_VERSION_GLOBAL_RETURN_BUFFER) {
|
||||
return GLOBAL_RETURN_RAW_UAV_ID;
|
||||
} else {
|
||||
return DEFAULT_RAW_UAV_ID;
|
||||
}
|
||||
return GLOBAL_RETURN_RAW_UAV_ID;
|
||||
case GLOBAL_ID:
|
||||
case ARENA_UAV_ID:
|
||||
return DEFAULT_ARENA_UAV_ID;
|
||||
@@ -97,10 +93,8 @@ uint32_t AMDILEvergreenDevice::getGeneration() const {
|
||||
void AMDILEvergreenDevice::setCaps() {
|
||||
mSWBits.set(AMDILDeviceInfo::ArenaSegment);
|
||||
mHWBits.set(AMDILDeviceInfo::ArenaUAV);
|
||||
if (mSTM->calVersion() >= CAL_VERSION_SC_140) {
|
||||
mHWBits.set(AMDILDeviceInfo::HW64BitDivMod);
|
||||
mSWBits.reset(AMDILDeviceInfo::HW64BitDivMod);
|
||||
}
|
||||
mHWBits.set(AMDILDeviceInfo::HW64BitDivMod);
|
||||
mSWBits.reset(AMDILDeviceInfo::HW64BitDivMod);
|
||||
mSWBits.set(AMDILDeviceInfo::Signed24BitOps);
|
||||
if (mSTM->isOverride(AMDILDeviceInfo::ByteStores)) {
|
||||
mHWBits.set(AMDILDeviceInfo::ByteStores);
|
||||
@@ -116,23 +110,15 @@ void AMDILEvergreenDevice::setCaps() {
|
||||
if (mSTM->isOverride(AMDILDeviceInfo::NoAlias)) {
|
||||
mHWBits.set(AMDILDeviceInfo::NoAlias);
|
||||
}
|
||||
if (mSTM->calVersion() > CAL_VERSION_GLOBAL_RETURN_BUFFER) {
|
||||
mHWBits.set(AMDILDeviceInfo::CachedMem);
|
||||
}
|
||||
mHWBits.set(AMDILDeviceInfo::CachedMem);
|
||||
if (mSTM->isOverride(AMDILDeviceInfo::MultiUAV)) {
|
||||
mHWBits.set(AMDILDeviceInfo::MultiUAV);
|
||||
}
|
||||
if (mSTM->calVersion() > CAL_VERSION_SC_136) {
|
||||
mHWBits.set(AMDILDeviceInfo::ByteLDSOps);
|
||||
mSWBits.reset(AMDILDeviceInfo::ByteLDSOps);
|
||||
mHWBits.set(AMDILDeviceInfo::ArenaVectors);
|
||||
} else {
|
||||
mSWBits.set(AMDILDeviceInfo::ArenaVectors);
|
||||
}
|
||||
if (mSTM->calVersion() > CAL_VERSION_SC_137) {
|
||||
mHWBits.set(AMDILDeviceInfo::LongOps);
|
||||
mSWBits.reset(AMDILDeviceInfo::LongOps);
|
||||
}
|
||||
mHWBits.set(AMDILDeviceInfo::ByteLDSOps);
|
||||
mSWBits.reset(AMDILDeviceInfo::ByteLDSOps);
|
||||
mHWBits.set(AMDILDeviceInfo::ArenaVectors);
|
||||
mHWBits.set(AMDILDeviceInfo::LongOps);
|
||||
mSWBits.reset(AMDILDeviceInfo::LongOps);
|
||||
mHWBits.set(AMDILDeviceInfo::TmrReg);
|
||||
}
|
||||
|
||||
@@ -146,7 +132,7 @@ AMDILEvergreenDevice::getAsmPrinter(TargetMachine& TM, MCStreamer &Streamer) con
|
||||
#endif
|
||||
}
|
||||
|
||||
AMDILCypressDevice::AMDILCypressDevice(AMDILSubtarget *ST)
|
||||
AMDILCypressDevice::AMDILCypressDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILEvergreenDevice(ST) {
|
||||
setCaps();
|
||||
}
|
||||
@@ -162,7 +148,7 @@ void AMDILCypressDevice::setCaps() {
|
||||
}
|
||||
|
||||
|
||||
AMDILCedarDevice::AMDILCedarDevice(AMDILSubtarget *ST)
|
||||
AMDILCedarDevice::AMDILCedarDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILEvergreenDevice(ST) {
|
||||
setCaps();
|
||||
}
|
||||
@@ -178,7 +164,7 @@ size_t AMDILCedarDevice::getWavefrontSize() const {
|
||||
return AMDILDevice::QuarterWavefrontSize;
|
||||
}
|
||||
|
||||
AMDILRedwoodDevice::AMDILRedwoodDevice(AMDILSubtarget *ST)
|
||||
AMDILRedwoodDevice::AMDILRedwoodDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILEvergreenDevice(ST) {
|
||||
setCaps();
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#ifndef _AMDILEVERGREENDEVICE_H_
|
||||
#define _AMDILEVERGREENDEVICE_H_
|
||||
#include "AMDILDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
namespace llvm {
|
||||
class AMDILSubtarget;
|
||||
class AMDGPUSubtarget;
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Evergreen generation of devices and their respective sub classes
|
||||
//===----------------------------------------------------------------------===//
|
||||
@@ -32,7 +32,7 @@ namespace llvm {
|
||||
// that capabilities of the 'Juniper' cards, also known as the HD57XX.
|
||||
class AMDILEvergreenDevice : public AMDILDevice {
|
||||
public:
|
||||
AMDILEvergreenDevice(AMDILSubtarget *ST);
|
||||
AMDILEvergreenDevice(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDILEvergreenDevice();
|
||||
virtual size_t getMaxLDSSize() const;
|
||||
virtual size_t getMaxGDSSize() const;
|
||||
@@ -52,7 +52,7 @@ protected:
|
||||
// and HD59XX cards.
|
||||
class AMDILCypressDevice : public AMDILEvergreenDevice {
|
||||
public:
|
||||
AMDILCypressDevice(AMDILSubtarget *ST);
|
||||
AMDILCypressDevice(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDILCypressDevice();
|
||||
private:
|
||||
virtual void setCaps();
|
||||
@@ -65,7 +65,7 @@ private:
|
||||
// HD54XX and HD53XX series of cards.
|
||||
class AMDILCedarDevice : public AMDILEvergreenDevice {
|
||||
public:
|
||||
AMDILCedarDevice(AMDILSubtarget *ST);
|
||||
AMDILCedarDevice(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDILCedarDevice();
|
||||
virtual size_t getWavefrontSize() const;
|
||||
private:
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
// the HD55XX and HD56XX series of cards.
|
||||
class AMDILRedwoodDevice : public AMDILEvergreenDevice {
|
||||
public:
|
||||
AMDILRedwoodDevice(AMDILSubtarget *ST);
|
||||
AMDILRedwoodDevice(AMDGPUSubtarget *ST);
|
||||
virtual ~AMDILRedwoodDevice();
|
||||
virtual size_t getWavefrontSize() const;
|
||||
private:
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace {
|
||||
class AMDILDAGToDAGISel : public SelectionDAGISel {
|
||||
// Subtarget - Keep a pointer to the AMDIL Subtarget around so that we can
|
||||
// make the right decision when generating code for different targets.
|
||||
const AMDILSubtarget &Subtarget;
|
||||
const AMDGPUSubtarget &Subtarget;
|
||||
public:
|
||||
AMDILDAGToDAGISel(TargetMachine &TM AMDIL_OPT_LEVEL_DECL);
|
||||
virtual ~AMDILDAGToDAGISel();
|
||||
@@ -86,7 +86,7 @@ FunctionPass *llvm::createAMDILISelDag(TargetMachine &TM
|
||||
|
||||
AMDILDAGToDAGISel::AMDILDAGToDAGISel(TargetMachine &TM
|
||||
AMDIL_OPT_LEVEL_DECL)
|
||||
: SelectionDAGISel(TM AMDIL_OPT_LEVEL_VAR), Subtarget(TM.getSubtarget<AMDILSubtarget>())
|
||||
: SelectionDAGISel(TM AMDIL_OPT_LEVEL_VAR), Subtarget(TM.getSubtarget<AMDGPUSubtarget>())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "AMDGPURegisterInfo.h"
|
||||
#include "AMDILDevices.h"
|
||||
#include "AMDILIntrinsicInfo.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
#include "AMDILUtilityFunctions.h"
|
||||
#include "llvm/CallingConv.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@@ -149,7 +149,7 @@ void AMDGPUTargetLowering::InitAMDILLowering()
|
||||
size_t numIntTypes = sizeof(IntTypes) / sizeof(*IntTypes);
|
||||
size_t numVectorTypes = sizeof(VectorTypes) / sizeof(*VectorTypes);
|
||||
|
||||
const AMDILSubtarget &STM = getTargetMachine().getSubtarget<AMDILSubtarget>();
|
||||
const AMDGPUSubtarget &STM = getTargetMachine().getSubtarget<AMDGPUSubtarget>();
|
||||
// These are the current register classes that are
|
||||
// supported
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "AMDILIntrinsicInfo.h"
|
||||
#include "AMDIL.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Intrinsics.h"
|
||||
#include "llvm/Module.h"
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
//==-----------------------------------------------------------------------===//
|
||||
#include "AMDILNIDevice.h"
|
||||
#include "AMDILEvergreenDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
AMDILNIDevice::AMDILNIDevice(AMDILSubtarget *ST)
|
||||
AMDILNIDevice::AMDILNIDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILEvergreenDevice(ST)
|
||||
{
|
||||
std::string name = ST->getDeviceName();
|
||||
@@ -47,7 +47,7 @@ AMDILNIDevice::getGeneration() const
|
||||
}
|
||||
|
||||
|
||||
AMDILCaymanDevice::AMDILCaymanDevice(AMDILSubtarget *ST)
|
||||
AMDILCaymanDevice::AMDILCaymanDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILNIDevice(ST)
|
||||
{
|
||||
setCaps();
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#ifndef _AMDILNIDEVICE_H_
|
||||
#define _AMDILNIDEVICE_H_
|
||||
#include "AMDILEvergreenDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
namespace llvm {
|
||||
class AMDILSubtarget;
|
||||
class AMDGPUSubtarget;
|
||||
//===---------------------------------------------------------------------===//
|
||||
// NI generation of devices and their respective sub classes
|
||||
//===---------------------------------------------------------------------===//
|
||||
@@ -33,7 +33,7 @@ namespace llvm {
|
||||
|
||||
class AMDILNIDevice : public AMDILEvergreenDevice {
|
||||
public:
|
||||
AMDILNIDevice(AMDILSubtarget*);
|
||||
AMDILNIDevice(AMDGPUSubtarget*);
|
||||
virtual ~AMDILNIDevice();
|
||||
virtual size_t getMaxLDSSize() const;
|
||||
virtual uint32_t getGeneration() const;
|
||||
@@ -48,7 +48,7 @@ namespace llvm {
|
||||
|
||||
class AMDILCaymanDevice: public AMDILNIDevice {
|
||||
public:
|
||||
AMDILCaymanDevice(AMDILSubtarget*);
|
||||
AMDILCaymanDevice(AMDGPUSubtarget*);
|
||||
virtual ~AMDILCaymanDevice();
|
||||
private:
|
||||
virtual void setCaps();
|
||||
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
|
||||
LLVMContext *mCTX;
|
||||
Function *mF;
|
||||
const AMDILSubtarget *mSTM;
|
||||
const AMDGPUSubtarget *mSTM;
|
||||
SmallVector< std::pair<CallInst *, Function *>, 16> atomicFuncs;
|
||||
SmallVector<CallInst *, 16> isConstVec;
|
||||
}; // class AMDILPeepholeOpt
|
||||
@@ -275,7 +275,7 @@ AMDILPeepholeOpt::runOnFunction(Function &MF)
|
||||
{
|
||||
mChanged = false;
|
||||
mF = &MF;
|
||||
mSTM = &TM.getSubtarget<AMDILSubtarget>();
|
||||
mSTM = &TM.getSubtarget<AMDGPUSubtarget>();
|
||||
if (mDebug) {
|
||||
MF.dump();
|
||||
}
|
||||
@@ -841,7 +841,7 @@ AMDILPeepholeOpt::optimizeBitExtract(Instruction *inst)
|
||||
bool
|
||||
AMDILPeepholeOpt::expandBFI(CallInst *CI)
|
||||
{
|
||||
if (!CI || mSTM->calVersion() <= CAL_VERSION_SC_150) {
|
||||
if (!CI) {
|
||||
return false;
|
||||
}
|
||||
Value *LHS = CI->getOperand(CI->getNumOperands() - 1);
|
||||
@@ -880,7 +880,7 @@ AMDILPeepholeOpt::expandBFI(CallInst *CI)
|
||||
bool
|
||||
AMDILPeepholeOpt::expandBFM(CallInst *CI)
|
||||
{
|
||||
if (!CI || mSTM->calVersion() <= CAL_VERSION_SC_150) {
|
||||
if (!CI) {
|
||||
return false;
|
||||
}
|
||||
Value *LHS = CI->getOperand(CI->getNumOperands() - 1);
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "AMDILSIDevice.h"
|
||||
#include "AMDILEvergreenDevice.h"
|
||||
#include "AMDILNIDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
AMDILSIDevice::AMDILSIDevice(AMDILSubtarget *ST)
|
||||
AMDILSIDevice::AMDILSIDevice(AMDGPUSubtarget *ST)
|
||||
: AMDILEvergreenDevice(ST)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#ifndef _AMDILSIDEVICE_H_
|
||||
#define _AMDILSIDEVICE_H_
|
||||
#include "AMDILEvergreenDevice.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
|
||||
namespace llvm {
|
||||
class AMDILSubtarget;
|
||||
class AMDGPUSubtarget;
|
||||
//===---------------------------------------------------------------------===//
|
||||
// SI generation of devices and their respective sub classes
|
||||
//===---------------------------------------------------------------------===//
|
||||
@@ -33,7 +33,7 @@ namespace llvm {
|
||||
|
||||
class AMDILSIDevice : public AMDILEvergreenDevice {
|
||||
public:
|
||||
AMDILSIDevice(AMDILSubtarget*);
|
||||
AMDILSIDevice(AMDGPUSubtarget*);
|
||||
virtual ~AMDILSIDevice();
|
||||
virtual size_t getMaxLDSSize() const;
|
||||
virtual uint32_t getGeneration() const;
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
//===- AMDILSubtarget.cpp - AMDIL Subtarget Information -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//==-----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the AMD IL specific subclass of TargetSubtarget.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDIL.h"
|
||||
#include "AMDILDevices.h"
|
||||
#include "AMDILUtilityFunctions.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/MC/SubtargetFeature.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#define GET_SUBTARGETINFO_CTOR
|
||||
#include "AMDGPUGenSubtargetInfo.inc"
|
||||
|
||||
AMDILSubtarget::AMDILSubtarget(llvm::StringRef TT, llvm::StringRef CPU, llvm::StringRef FS) : AMDGPUGenSubtargetInfo( TT, CPU, FS ),
|
||||
mDumpCode(false)
|
||||
{
|
||||
}
|
||||
AMDILSubtarget::~AMDILSubtarget()
|
||||
{
|
||||
delete mDevice;
|
||||
}
|
||||
bool
|
||||
AMDILSubtarget::isOverride(AMDILDeviceInfo::Caps caps) const
|
||||
{
|
||||
assert(caps < AMDILDeviceInfo::MaxNumberCapabilities &&
|
||||
"Caps index is out of bounds!");
|
||||
return CapsOverride[caps];
|
||||
}
|
||||
bool
|
||||
AMDILSubtarget::is64bit() const
|
||||
{
|
||||
return mIs64bit;
|
||||
}
|
||||
bool
|
||||
AMDILSubtarget::isTargetELF() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
size_t
|
||||
AMDILSubtarget::getDefaultSize(uint32_t dim) const
|
||||
{
|
||||
if (dim > 3) {
|
||||
return 1;
|
||||
} else {
|
||||
return mDefaultSize[dim];
|
||||
}
|
||||
}
|
||||
uint32_t
|
||||
AMDILSubtarget::calVersion() const
|
||||
{
|
||||
return mVersion;
|
||||
}
|
||||
|
||||
AMDILGlobalManager*
|
||||
AMDILSubtarget::getGlobalManager() const
|
||||
{
|
||||
return mGM;
|
||||
}
|
||||
void
|
||||
AMDILSubtarget::setGlobalManager(AMDILGlobalManager *gm) const
|
||||
{
|
||||
mGM = gm;
|
||||
}
|
||||
|
||||
AMDILKernelManager*
|
||||
AMDILSubtarget::getKernelManager() const
|
||||
{
|
||||
return mKM;
|
||||
}
|
||||
void
|
||||
AMDILSubtarget::setKernelManager(AMDILKernelManager *km) const
|
||||
{
|
||||
mKM = km;
|
||||
}
|
||||
std::string
|
||||
AMDILSubtarget::getDataLayout() const
|
||||
{
|
||||
if (!mDevice) {
|
||||
return std::string("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16"
|
||||
"-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:32:32"
|
||||
"-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64"
|
||||
"-v96:128:128-v128:128:128-v192:256:256-v256:256:256"
|
||||
"-v512:512:512-v1024:1024:1024-v2048:2048:2048-a0:0:64");
|
||||
}
|
||||
return mDevice->getDataLayout();
|
||||
}
|
||||
|
||||
std::string
|
||||
AMDILSubtarget::getDeviceName() const
|
||||
{
|
||||
return mDevName;
|
||||
}
|
||||
const AMDILDevice *
|
||||
AMDILSubtarget::device() const
|
||||
{
|
||||
return mDevice;
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
//=====-- AMDILSubtarget.h - Define Subtarget for the AMDIL ----*- C++ -*-====//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//==-----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file declares the AMDIL specific subclass of TargetSubtarget.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _AMDILSUBTARGET_H_
|
||||
#define _AMDILSUBTARGET_H_
|
||||
|
||||
#include "AMDILDevice.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#define GET_SUBTARGETINFO_HEADER
|
||||
#include "AMDGPUGenSubtargetInfo.inc"
|
||||
|
||||
#define MAX_CB_SIZE (1 << 16)
|
||||
namespace llvm {
|
||||
class Module;
|
||||
class AMDILKernelManager;
|
||||
class AMDILGlobalManager;
|
||||
class AMDILDevice;
|
||||
class AMDILSubtarget : public AMDGPUGenSubtargetInfo {
|
||||
protected:
|
||||
bool CapsOverride[AMDILDeviceInfo::MaxNumberCapabilities];
|
||||
mutable AMDILGlobalManager *mGM;
|
||||
mutable AMDILKernelManager *mKM;
|
||||
const AMDILDevice *mDevice;
|
||||
size_t mDefaultSize[3];
|
||||
size_t mMinimumSize[3];
|
||||
std::string mDevName;
|
||||
uint32_t mVersion;
|
||||
bool mIs64bit;
|
||||
bool mIs32on64bit;
|
||||
bool mDumpCode;
|
||||
public:
|
||||
AMDILSubtarget(llvm::StringRef TT, llvm::StringRef CPU, llvm::StringRef FS);
|
||||
virtual ~AMDILSubtarget();
|
||||
bool isOverride(AMDILDeviceInfo::Caps) const;
|
||||
bool is64bit() const;
|
||||
|
||||
// Helper functions to simplify if statements
|
||||
bool isTargetELF() const;
|
||||
AMDILGlobalManager* getGlobalManager() const;
|
||||
void setGlobalManager(AMDILGlobalManager *gm) const;
|
||||
AMDILKernelManager* getKernelManager() const;
|
||||
void setKernelManager(AMDILKernelManager *gm) const;
|
||||
const AMDILDevice* device() const;
|
||||
std::string getDataLayout() const;
|
||||
std::string getDeviceName() const;
|
||||
virtual size_t getDefaultSize(uint32_t dim) const;
|
||||
// Return the version of CAL that the backend should target.
|
||||
uint32_t calVersion() const;
|
||||
// ParseSubtargetFeatures - Parses features string setting specified
|
||||
// subtarget options. Definition of function is
|
||||
//auto generated by tblgen.
|
||||
virtual void
|
||||
ParseSubtargetFeatures(
|
||||
llvm::StringRef CPU,
|
||||
llvm::StringRef FS) { assert(!"Unimplemented"); }
|
||||
bool dumpCode() const { return mDumpCode; }
|
||||
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
#endif // AMDILSUBTARGET_H_
|
||||
@@ -28,7 +28,6 @@ CPP_SOURCES := \
|
||||
AMDILNIDevice.cpp \
|
||||
AMDILPeepholeOptimizer.cpp \
|
||||
AMDILSIDevice.cpp \
|
||||
AMDILSubtarget.cpp \
|
||||
AMDGPUSubtarget.cpp \
|
||||
AMDGPUTargetMachine.cpp \
|
||||
AMDGPUISelLowering.cpp \
|
||||
|
||||
@@ -148,7 +148,7 @@ bool R600CodeEmitter::runOnMachineFunction(MachineFunction &MF) {
|
||||
MRI = &MF.getRegInfo();
|
||||
TRI = static_cast<const R600RegisterInfo *>(TM->getRegisterInfo());
|
||||
const R600InstrInfo * TII = static_cast<const R600InstrInfo *>(TM->getInstrInfo());
|
||||
const AMDILSubtarget &STM = TM->getSubtarget<AMDILSubtarget>();
|
||||
const AMDGPUSubtarget &STM = TM->getSubtarget<AMDGPUSubtarget>();
|
||||
std::string gpu = STM.getDeviceName();
|
||||
|
||||
if (STM.dumpCode()) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "R600InstrInfo.h"
|
||||
#include "AMDGPUTargetMachine.h"
|
||||
#include "AMDILSubtarget.h"
|
||||
#include "AMDGPUSubtarget.h"
|
||||
#include "R600RegisterInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
|
||||
@@ -103,5 +103,5 @@ DFAPacketizer *R600InstrInfo::CreateTargetScheduleState(const TargetMachine *TM,
|
||||
const ScheduleDAG *DAG) const
|
||||
{
|
||||
const InstrItineraryData *II = TM->getInstrItineraryData();
|
||||
return TM->getSubtarget<AMDILSubtarget>().createDFAPacketizer(II);
|
||||
return TM->getSubtarget<AMDGPUSubtarget>().createDFAPacketizer(II);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void SICodeEmitter::InitProgramInfo(MachineFunction &MF) {
|
||||
bool SICodeEmitter::runOnMachineFunction(MachineFunction &MF)
|
||||
{
|
||||
TM = &MF.getTarget();
|
||||
const AMDILSubtarget &STM = TM->getSubtarget<AMDILSubtarget>();
|
||||
const AMDGPUSubtarget &STM = TM->getSubtarget<AMDGPUSubtarget>();
|
||||
|
||||
if (STM.dumpCode()) {
|
||||
MF.dump();
|
||||
|
||||
Reference in New Issue
Block a user