From f9ab3ddb8fd01e0e05906c1a7a9a0b28d8a1753d Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 31 Oct 2017 23:21:30 +0000 Subject: [PATCH] [AMDGPU] Clean up symbols in the global namespace. llvm-svn: 317051 --- llvm/lib/Target/AMDGPU/AMDGPU.h | 63 ++++++++++--------- llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp | 2 + .../lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 2 +- .../Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp | 23 ------- 4 files changed, 37 insertions(+), 53 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h index e8f7476dd76e..0ddc43ad5033 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.h +++ b/llvm/lib/Target/AMDGPU/AMDGPU.h @@ -217,39 +217,44 @@ struct AMDGPUAS { unsigned FLAT_ADDRESS; ///< Address space for flat memory. unsigned REGION_ADDRESS; ///< Address space for region memory. - // The maximum value for flat, generic, local, private, constant and region. - const static unsigned MAX_COMMON_ADDRESS = 5; + enum : unsigned { + // The maximum value for flat, generic, local, private, constant and region. + MAX_COMMON_ADDRESS = 5, - const static unsigned GLOBAL_ADDRESS = 1; ///< Address space for global memory (RAT0, VTX0). - const static unsigned CONSTANT_ADDRESS = 2; ///< Address space for constant memory (VTX2) - const static unsigned LOCAL_ADDRESS = 3; ///< Address space for local memory. - const static unsigned PARAM_D_ADDRESS = 6; ///< Address space for direct addressible parameter memory (CONST0) - const static unsigned PARAM_I_ADDRESS = 7; ///< Address space for indirect addressible parameter memory (VTX1) + GLOBAL_ADDRESS = 1, ///< Address space for global memory (RAT0, VTX0). + CONSTANT_ADDRESS = 2, ///< Address space for constant memory (VTX2) + LOCAL_ADDRESS = 3, ///< Address space for local memory. + /// Address space for direct addressible parameter memory (CONST0) + PARAM_D_ADDRESS = 6, + /// Address space for indirect addressible parameter memory (VTX1) + PARAM_I_ADDRESS = 7, - // Do not re-order the CONSTANT_BUFFER_* enums. Several places depend on this - // order to be able to dynamically index a constant buffer, for example: - // - // ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx + // Do not re-order the CONSTANT_BUFFER_* enums. Several places depend on + // this order to be able to dynamically index a constant buffer, for + // example: + // + // ConstantBufferAS = CONSTANT_BUFFER_0 + CBIdx - const static unsigned CONSTANT_BUFFER_0 = 8; - const static unsigned CONSTANT_BUFFER_1 = 9; - const static unsigned CONSTANT_BUFFER_2 = 10; - const static unsigned CONSTANT_BUFFER_3 = 11; - const static unsigned CONSTANT_BUFFER_4 = 12; - const static unsigned CONSTANT_BUFFER_5 = 13; - const static unsigned CONSTANT_BUFFER_6 = 14; - const static unsigned CONSTANT_BUFFER_7 = 15; - const static unsigned CONSTANT_BUFFER_8 = 16; - const static unsigned CONSTANT_BUFFER_9 = 17; - const static unsigned CONSTANT_BUFFER_10 = 18; - const static unsigned CONSTANT_BUFFER_11 = 19; - const static unsigned CONSTANT_BUFFER_12 = 20; - const static unsigned CONSTANT_BUFFER_13 = 21; - const static unsigned CONSTANT_BUFFER_14 = 22; - const static unsigned CONSTANT_BUFFER_15 = 23; + CONSTANT_BUFFER_0 = 8, + CONSTANT_BUFFER_1 = 9, + CONSTANT_BUFFER_2 = 10, + CONSTANT_BUFFER_3 = 11, + CONSTANT_BUFFER_4 = 12, + CONSTANT_BUFFER_5 = 13, + CONSTANT_BUFFER_6 = 14, + CONSTANT_BUFFER_7 = 15, + CONSTANT_BUFFER_8 = 16, + CONSTANT_BUFFER_9 = 17, + CONSTANT_BUFFER_10 = 18, + CONSTANT_BUFFER_11 = 19, + CONSTANT_BUFFER_12 = 20, + CONSTANT_BUFFER_13 = 21, + CONSTANT_BUFFER_14 = 22, + CONSTANT_BUFFER_15 = 23, - // Some places use this if the address space can't be determined. - const static unsigned UNKNOWN_ADDRESS_SPACE = ~0u; + // Some places use this if the address space can't be determined. + UNKNOWN_ADDRESS_SPACE = ~0u, + }; }; namespace llvm { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp index c3789742b84f..9fc9592bdc57 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp @@ -544,6 +544,7 @@ unsigned SISubtarget::getMaxNumVGPRs(const MachineFunction &MF) const { return MaxNumVGPRs - getReservedNumVGPRs(MF); } +namespace { struct MemOpClusterMutation : ScheduleDAGMutation { const SIInstrInfo *TII; @@ -592,6 +593,7 @@ struct MemOpClusterMutation : ScheduleDAGMutation { } } }; +} // namespace void SISubtarget::getPostRAMutations( std::vector> &Mutations) const { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index f20dba844d31..f7ecdea77047 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -324,7 +324,7 @@ static ImmutablePass *createAMDGPUExternalAAWrapperPass() { } /// Predicate for Internalize pass. -bool mustPreserveGV(const GlobalValue &GV) { +static bool mustPreserveGV(const GlobalValue &GV) { if (const Function *F = dyn_cast(&GV)) return F->isDeclaration() || AMDGPU::isEntryFunctionCC(F->getCallingConv()); diff --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp index 018cb5d0c365..ae70dd2893c8 100644 --- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp +++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp @@ -816,29 +816,6 @@ bool isLegalSMRDImmOffset(const MCSubtargetInfo &ST, int64_t ByteOffset) { } // end namespace llvm -const unsigned AMDGPUAS::MAX_COMMON_ADDRESS; -const unsigned AMDGPUAS::GLOBAL_ADDRESS; -const unsigned AMDGPUAS::LOCAL_ADDRESS; -const unsigned AMDGPUAS::PARAM_D_ADDRESS; -const unsigned AMDGPUAS::PARAM_I_ADDRESS; -const unsigned AMDGPUAS::CONSTANT_BUFFER_0; -const unsigned AMDGPUAS::CONSTANT_BUFFER_1; -const unsigned AMDGPUAS::CONSTANT_BUFFER_2; -const unsigned AMDGPUAS::CONSTANT_BUFFER_3; -const unsigned AMDGPUAS::CONSTANT_BUFFER_4; -const unsigned AMDGPUAS::CONSTANT_BUFFER_5; -const unsigned AMDGPUAS::CONSTANT_BUFFER_6; -const unsigned AMDGPUAS::CONSTANT_BUFFER_7; -const unsigned AMDGPUAS::CONSTANT_BUFFER_8; -const unsigned AMDGPUAS::CONSTANT_BUFFER_9; -const unsigned AMDGPUAS::CONSTANT_BUFFER_10; -const unsigned AMDGPUAS::CONSTANT_BUFFER_11; -const unsigned AMDGPUAS::CONSTANT_BUFFER_12; -const unsigned AMDGPUAS::CONSTANT_BUFFER_13; -const unsigned AMDGPUAS::CONSTANT_BUFFER_14; -const unsigned AMDGPUAS::CONSTANT_BUFFER_15; -const unsigned AMDGPUAS::UNKNOWN_ADDRESS_SPACE; - namespace llvm { namespace AMDGPU {