From: Rafael Espindola Date: Sat, 14 Dec 2013 06:13:44 +0000 (+0000) Subject: Turn AMDGPUSubtarget::getDataLayout into a static function. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ff0b475d921e44d7ce22d3aad926cfd292fcf559;p=oota-llvm.git Turn AMDGPUSubtarget::getDataLayout into a static function. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197310 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/R600/AMDGPUSubtarget.cpp b/lib/Target/R600/AMDGPUSubtarget.cpp index b892e7e1d10..51d9eadbafe 100644 --- a/lib/Target/R600/AMDGPUSubtarget.cpp +++ b/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/lib/Target/R600/AMDGPUSubtarget.h b/lib/Target/R600/AMDGPUSubtarget.h index 4288d275c99..060571e26b9 100644 --- a/lib/Target/R600/AMDGPUSubtarget.h +++ b/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/lib/Target/R600/AMDGPUTargetMachine.cpp b/lib/Target/R600/AMDGPUTargetMachine.cpp index 2d2bed062a5..762a17ae071 100644 --- a/lib/Target/R600/AMDGPUTargetMachine.cpp +++ b/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),