forked from OSchip/llvm-project
Move R600 subtarget dependent variables onto the subtarget.
No functional change. llvm-svn: 213982
This commit is contained in:
parent
b2ebf2a08b
commit
ac4b69e40b
|
@ -24,7 +24,7 @@ using namespace llvm;
|
||||||
#include "AMDGPUGenIntrinsics.inc"
|
#include "AMDGPUGenIntrinsics.inc"
|
||||||
#undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
|
#undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
|
||||||
|
|
||||||
AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo(TargetMachine *tm)
|
AMDGPUIntrinsicInfo::AMDGPUIntrinsicInfo()
|
||||||
: TargetIntrinsicInfo() {}
|
: TargetIntrinsicInfo() {}
|
||||||
|
|
||||||
std::string AMDGPUIntrinsicInfo::getName(unsigned IntrID, Type **Tys,
|
std::string AMDGPUIntrinsicInfo::getName(unsigned IntrID, Type **Tys,
|
||||||
|
|
|
@ -33,7 +33,7 @@ enum ID {
|
||||||
|
|
||||||
class AMDGPUIntrinsicInfo : public TargetIntrinsicInfo {
|
class AMDGPUIntrinsicInfo : public TargetIntrinsicInfo {
|
||||||
public:
|
public:
|
||||||
AMDGPUIntrinsicInfo(TargetMachine *tm);
|
AMDGPUIntrinsicInfo();
|
||||||
std::string getName(unsigned IntrId, Type **Tys = nullptr,
|
std::string getName(unsigned IntrId, Type **Tys = nullptr,
|
||||||
unsigned numTys = 0) const override;
|
unsigned numTys = 0) const override;
|
||||||
unsigned lookupName(const char *Name, unsigned Len) const override;
|
unsigned lookupName(const char *Name, unsigned Len) const override;
|
||||||
|
|
|
@ -13,8 +13,11 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "AMDGPUSubtarget.h"
|
#include "AMDGPUSubtarget.h"
|
||||||
|
#include "R600ISelLowering.h"
|
||||||
#include "R600InstrInfo.h"
|
#include "R600InstrInfo.h"
|
||||||
|
#include "R600MachineScheduler.h"
|
||||||
#include "SIInstrInfo.h"
|
#include "SIInstrInfo.h"
|
||||||
|
#include "SIISelLowering.h"
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
|
|
||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
|
@ -28,26 +31,23 @@ using namespace llvm;
|
||||||
#define GET_SUBTARGETINFO_CTOR
|
#define GET_SUBTARGETINFO_CTOR
|
||||||
#include "AMDGPUGenSubtargetInfo.inc"
|
#include "AMDGPUGenSubtargetInfo.inc"
|
||||||
|
|
||||||
AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS) :
|
static std::string computeDataLayout(const AMDGPUSubtarget &ST) {
|
||||||
AMDGPUGenSubtargetInfo(TT, GPU, FS),
|
std::string Ret = "e-p:32:32";
|
||||||
DevName(GPU),
|
|
||||||
Is64bit(false),
|
if (ST.is64bit()) {
|
||||||
DumpCode(false),
|
// 32-bit local, and region pointers. 64-bit private, global, and constant.
|
||||||
R600ALUInst(false),
|
Ret += "-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64";
|
||||||
HasVertexCache(false),
|
}
|
||||||
TexVTXClauseSize(0),
|
|
||||||
Gen(AMDGPUSubtarget::R600),
|
Ret += "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256"
|
||||||
FP64(false),
|
"-v512:512-v1024:1024-v2048:2048-n32:64";
|
||||||
FP64Denormals(false),
|
|
||||||
FP32Denormals(false),
|
return Ret;
|
||||||
CaymanISA(false),
|
}
|
||||||
EnableIRStructurizer(true),
|
|
||||||
EnablePromoteAlloca(false),
|
AMDGPUSubtarget &
|
||||||
EnableIfCvt(true),
|
AMDGPUSubtarget::initializeSubtargetDependencies(StringRef GPU, StringRef FS) {
|
||||||
WavefrontSize(0),
|
// Determine default and user-specified characteristics
|
||||||
CFALUBug(false),
|
|
||||||
LocalMemorySize(0),
|
|
||||||
InstrItins(getInstrItineraryForCPU(GPU)) {
|
|
||||||
// On SI+, we want FP64 denormals to be on by default. FP32 denormals can be
|
// On SI+, we want FP64 denormals to be on by default. FP32 denormals can be
|
||||||
// enabled, but some instructions do not respect them and they run at the
|
// enabled, but some instructions do not respect them and they run at the
|
||||||
// double precision rate, so don't enable by default.
|
// double precision rate, so don't enable by default.
|
||||||
|
@ -61,16 +61,36 @@ AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS) :
|
||||||
|
|
||||||
ParseSubtargetFeatures(GPU, FullFS);
|
ParseSubtargetFeatures(GPU, FullFS);
|
||||||
|
|
||||||
|
// FIXME: I don't think think Evergreen has any useful support for
|
||||||
|
// denormals, but should be checked. Should we issue a warning somewhere
|
||||||
|
// if someone tries to enable these?
|
||||||
if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
|
if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
|
||||||
InstrInfo.reset(new R600InstrInfo(*this));
|
|
||||||
|
|
||||||
// FIXME: I don't think think Evergreen has any useful support for
|
|
||||||
// denormals, but should be checked. Should we issue a warning somewhere if
|
|
||||||
// someone tries to enable these?
|
|
||||||
FP32Denormals = false;
|
FP32Denormals = false;
|
||||||
FP64Denormals = false;
|
FP64Denormals = false;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
AMDGPUSubtarget::AMDGPUSubtarget(StringRef TT, StringRef GPU, StringRef FS,
|
||||||
|
TargetMachine &TM)
|
||||||
|
: AMDGPUGenSubtargetInfo(TT, GPU, FS), DevName(GPU), Is64bit(false),
|
||||||
|
DumpCode(false), R600ALUInst(false), HasVertexCache(false),
|
||||||
|
TexVTXClauseSize(0), Gen(AMDGPUSubtarget::R600), FP64(false),
|
||||||
|
FP64Denormals(false), FP32Denormals(false), CaymanISA(false),
|
||||||
|
EnableIRStructurizer(true), EnablePromoteAlloca(false), EnableIfCvt(true),
|
||||||
|
WavefrontSize(0), CFALUBug(false), LocalMemorySize(0),
|
||||||
|
DL(computeDataLayout(initializeSubtargetDependencies(GPU, FS))),
|
||||||
|
FrameLowering(TargetFrameLowering::StackGrowsUp,
|
||||||
|
64 * 16, // Maximum stack alignment (long16)
|
||||||
|
0),
|
||||||
|
IntrinsicInfo(), InstrItins(getInstrItineraryForCPU(GPU)) {
|
||||||
|
|
||||||
|
if (getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
|
||||||
|
InstrInfo.reset(new R600InstrInfo(*this));
|
||||||
|
TLInfo.reset(new R600TargetLowering(TM));
|
||||||
} else {
|
} else {
|
||||||
InstrInfo.reset(new SIInstrInfo(*this));
|
InstrInfo.reset(new SIInstrInfo(*this));
|
||||||
|
TLInfo.reset(new SITargetLowering(TM));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,12 @@
|
||||||
#ifndef AMDGPUSUBTARGET_H
|
#ifndef AMDGPUSUBTARGET_H
|
||||||
#define AMDGPUSUBTARGET_H
|
#define AMDGPUSUBTARGET_H
|
||||||
#include "AMDGPU.h"
|
#include "AMDGPU.h"
|
||||||
|
#include "AMDGPUFrameLowering.h"
|
||||||
#include "AMDGPUInstrInfo.h"
|
#include "AMDGPUInstrInfo.h"
|
||||||
|
#include "AMDGPUIntrinsicInfo.h"
|
||||||
|
#include "AMDGPUSubtarget.h"
|
||||||
|
#include "R600ISelLowering.h"
|
||||||
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||||
|
@ -29,8 +34,6 @@ namespace llvm {
|
||||||
|
|
||||||
class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
|
class AMDGPUSubtarget : public AMDGPUGenSubtargetInfo {
|
||||||
|
|
||||||
std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Generation {
|
enum Generation {
|
||||||
R600 = 0,
|
R600 = 0,
|
||||||
|
@ -60,18 +63,26 @@ private:
|
||||||
bool CFALUBug;
|
bool CFALUBug;
|
||||||
int LocalMemorySize;
|
int LocalMemorySize;
|
||||||
|
|
||||||
|
const DataLayout DL;
|
||||||
|
AMDGPUFrameLowering FrameLowering;
|
||||||
|
AMDGPUIntrinsicInfo IntrinsicInfo;
|
||||||
|
std::unique_ptr<AMDGPUTargetLowering> TLInfo;
|
||||||
|
std::unique_ptr<AMDGPUInstrInfo> InstrInfo;
|
||||||
InstrItineraryData InstrItins;
|
InstrItineraryData InstrItins;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS);
|
AMDGPUSubtarget(StringRef TT, StringRef CPU, StringRef FS, TargetMachine &TM);
|
||||||
|
AMDGPUSubtarget &initializeSubtargetDependencies(StringRef GPU, StringRef FS);
|
||||||
|
|
||||||
const AMDGPUInstrInfo *getInstrInfo() const {
|
const AMDGPUFrameLowering *getFrameLowering() const { return &FrameLowering; }
|
||||||
return InstrInfo.get();
|
const AMDGPUIntrinsicInfo *getIntrinsicInfo() const { return &IntrinsicInfo; }
|
||||||
}
|
const AMDGPUInstrInfo *getInstrInfo() const { return InstrInfo.get(); }
|
||||||
|
const AMDGPURegisterInfo *getRegisterInfo() const {
|
||||||
const InstrItineraryData &getInstrItineraryData() const {
|
return &InstrInfo->getRegisterInfo();
|
||||||
return InstrItins;
|
|
||||||
}
|
}
|
||||||
|
AMDGPUTargetLowering *getTargetLowering() const { return TLInfo.get(); }
|
||||||
|
const DataLayout *getDataLayout() const { return &DL; }
|
||||||
|
const InstrItineraryData &getInstrItineraryData() const { return InstrItins; }
|
||||||
|
|
||||||
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
||||||
|
|
||||||
|
|
|
@ -48,41 +48,13 @@ static MachineSchedRegistry
|
||||||
SchedCustomRegistry("r600", "Run R600's custom scheduler",
|
SchedCustomRegistry("r600", "Run R600's custom scheduler",
|
||||||
createR600MachineScheduler);
|
createR600MachineScheduler);
|
||||||
|
|
||||||
static std::string computeDataLayout(const AMDGPUSubtarget &ST) {
|
|
||||||
std::string Ret = "e-p:32:32";
|
|
||||||
|
|
||||||
if (ST.is64bit()) {
|
|
||||||
// 32-bit local, and region pointers. 64-bit private, global, and constant.
|
|
||||||
Ret += "-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64";
|
|
||||||
}
|
|
||||||
|
|
||||||
Ret += "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256"
|
|
||||||
"-v512:512-v1024:1024-v2048:2048-n32:64";
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, StringRef TT,
|
AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, StringRef TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
TargetOptions Options,
|
TargetOptions Options, Reloc::Model RM,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OptLevel
|
CodeGenOpt::Level OptLevel)
|
||||||
)
|
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OptLevel),
|
||||||
:
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OptLevel),
|
|
||||||
Subtarget(TT, CPU, FS),
|
|
||||||
Layout(computeDataLayout(Subtarget)),
|
|
||||||
FrameLowering(TargetFrameLowering::StackGrowsUp,
|
|
||||||
64 * 16 // Maximum stack alignment (long16)
|
|
||||||
, 0),
|
|
||||||
IntrinsicInfo(this),
|
|
||||||
InstrItins(&Subtarget.getInstrItineraryData()) {
|
|
||||||
// TLInfo uses InstrInfo so it must be initialized after.
|
|
||||||
if (Subtarget.getGeneration() <= AMDGPUSubtarget::NORTHERN_ISLANDS) {
|
|
||||||
TLInfo.reset(new R600TargetLowering(*this));
|
|
||||||
} else {
|
|
||||||
TLInfo.reset(new SITargetLowering(*this));
|
|
||||||
}
|
|
||||||
setRequiresStructuredCFG(true);
|
setRequiresStructuredCFG(true);
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,6 @@ namespace llvm {
|
||||||
class AMDGPUTargetMachine : public LLVMTargetMachine {
|
class AMDGPUTargetMachine : public LLVMTargetMachine {
|
||||||
|
|
||||||
AMDGPUSubtarget Subtarget;
|
AMDGPUSubtarget Subtarget;
|
||||||
const DataLayout Layout;
|
|
||||||
AMDGPUFrameLowering FrameLowering;
|
|
||||||
AMDGPUIntrinsicInfo IntrinsicInfo;
|
|
||||||
std::unique_ptr<AMDGPUTargetLowering> TLInfo;
|
|
||||||
const InstrItineraryData *InstrItins;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AMDGPUTargetMachine(const Target &T, StringRef TT, StringRef FS,
|
AMDGPUTargetMachine(const Target &T, StringRef TT, StringRef FS,
|
||||||
|
@ -39,10 +34,10 @@ public:
|
||||||
CodeModel::Model CM, CodeGenOpt::Level OL);
|
CodeModel::Model CM, CodeGenOpt::Level OL);
|
||||||
~AMDGPUTargetMachine();
|
~AMDGPUTargetMachine();
|
||||||
const AMDGPUFrameLowering *getFrameLowering() const override {
|
const AMDGPUFrameLowering *getFrameLowering() const override {
|
||||||
return &FrameLowering;
|
return getSubtargetImpl()->getFrameLowering();
|
||||||
}
|
}
|
||||||
const AMDGPUIntrinsicInfo *getIntrinsicInfo() const override {
|
const AMDGPUIntrinsicInfo *getIntrinsicInfo() const override {
|
||||||
return &IntrinsicInfo;
|
return getSubtargetImpl()->getIntrinsicInfo();
|
||||||
}
|
}
|
||||||
const AMDGPUInstrInfo *getInstrInfo() const override {
|
const AMDGPUInstrInfo *getInstrInfo() const override {
|
||||||
return getSubtargetImpl()->getInstrInfo();
|
return getSubtargetImpl()->getInstrInfo();
|
||||||
|
@ -51,15 +46,17 @@ public:
|
||||||
return &Subtarget;
|
return &Subtarget;
|
||||||
}
|
}
|
||||||
const AMDGPURegisterInfo *getRegisterInfo() const override {
|
const AMDGPURegisterInfo *getRegisterInfo() const override {
|
||||||
return &getInstrInfo()->getRegisterInfo();
|
return getSubtargetImpl()->getRegisterInfo();
|
||||||
}
|
}
|
||||||
AMDGPUTargetLowering *getTargetLowering() const override {
|
AMDGPUTargetLowering *getTargetLowering() const override {
|
||||||
return TLInfo.get();
|
return getSubtargetImpl()->getTargetLowering();
|
||||||
}
|
}
|
||||||
const InstrItineraryData *getInstrItineraryData() const override {
|
const InstrItineraryData *getInstrItineraryData() const override {
|
||||||
return InstrItins;
|
return &getSubtargetImpl()->getInstrItineraryData();
|
||||||
|
}
|
||||||
|
const DataLayout *getDataLayout() const override {
|
||||||
|
return getSubtargetImpl()->getDataLayout();
|
||||||
}
|
}
|
||||||
const DataLayout *getDataLayout() const override { return &Layout; }
|
|
||||||
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
||||||
|
|
||||||
/// \brief Register R600 analysis passes with a pass manager.
|
/// \brief Register R600 analysis passes with a pass manager.
|
||||||
|
|
Loading…
Reference in New Issue