Turn AMDGPUSubtarget::getDataLayout into a static function.

No functionality change.

llvm-svn: 197310
This commit is contained in:
Rafael Espindola 2013-12-14 06:13:44 +00:00
parent 8562ec0caf
commit ceb0c4962a
3 changed files with 24 additions and 29 deletions

View File

@ -87,33 +87,6 @@ AMDGPUSubtarget::getDefaultSize(uint32_t dim) const {
}
}
std::string
AMDGPUSubtarget::getDataLayout() const {
std::string DataLayout = std::string(
"e"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32: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"
"-n32:64"
);
if (hasHWFP64()) {
DataLayout.append("-f64:64:64");
}
if (is64bit()) {
DataLayout.append("-p:64:64:64");
} else {
DataLayout.append("-p:32:32:32");
}
if (Gen >= AMDGPUSubtarget::SOUTHERN_ISLANDS) {
DataLayout.append("-p3:32:32:32");
}
return DataLayout;
}
std::string
AMDGPUSubtarget::getDeviceName() const {
return DevName;

View File

@ -75,7 +75,6 @@ public:
// Helper functions to simplify if statements
bool isTargetELF() const;
std::string getDataLayout() const;
std::string getDeviceName() const;
virtual size_t getDefaultSize(uint32_t dim) const;
bool dumpCode() const { return DumpCode; }

View File

@ -49,6 +49,29 @@ static MachineSchedRegistry
SchedCustomRegistry("r600", "Run R600's custom scheduler",
createR600MachineScheduler);
static std::string computeDataLayout(const AMDGPUSubtarget &ST) {
std::string DataLayout = std::string(
"e"
"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32: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"
"-n32:64"
);
if (ST.hasHWFP64())
DataLayout.append("-f64:64:64");
if (ST.is64bit())
DataLayout.append("-p:64:64:64");
else
DataLayout.append("-p:32:32:32");
if (ST.getGeneration() >= AMDGPUSubtarget::SOUTHERN_ISLANDS)
DataLayout.append("-p3:32:32:32");
return DataLayout;
}
AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, StringRef TT,
StringRef CPU, StringRef FS,
TargetOptions Options,
@ -58,7 +81,7 @@ AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, StringRef TT,
:
LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OptLevel),
Subtarget(TT, CPU, FS),
Layout(Subtarget.getDataLayout()),
Layout(computeDataLayout(Subtarget)),
FrameLowering(TargetFrameLowering::StackGrowsUp,
64 * 16 // Maximum stack alignment (long16)
, 0),