From ceb0c4962ad60f4e106b6e68e8b3f919eb071f95 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Sat, 14 Dec 2013 06:13:44 +0000 Subject: [PATCH] Turn AMDGPUSubtarget::getDataLayout into a static function. No functionality change. llvm-svn: 197310 --- llvm/lib/Target/R600/AMDGPUSubtarget.cpp | 27 -------------------- llvm/lib/Target/R600/AMDGPUSubtarget.h | 1 - llvm/lib/Target/R600/AMDGPUTargetMachine.cpp | 25 +++++++++++++++++- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/llvm/lib/Target/R600/AMDGPUSubtarget.cpp b/llvm/lib/Target/R600/AMDGPUSubtarget.cpp index b892e7e1d108..51d9eadbafe6 100644 --- a/llvm/lib/Target/R600/AMDGPUSubtarget.cpp +++ b/llvm/lib/Target/R600/AMDGPUSubtarget.cpp @@ -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; diff --git a/llvm/lib/Target/R600/AMDGPUSubtarget.h b/llvm/lib/Target/R600/AMDGPUSubtarget.h index 4288d275c99e..060571e26b92 100644 --- a/llvm/lib/Target/R600/AMDGPUSubtarget.h +++ b/llvm/lib/Target/R600/AMDGPUSubtarget.h @@ -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; } diff --git a/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp b/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp index 2d2bed062a51..762a17ae071a 100644 --- a/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/R600/AMDGPUTargetMachine.cpp @@ -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),