[AMDGPU] Clean up symbols in the global namespace.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 31 Oct 2017 23:21:30 +0000 (23:21 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 31 Oct 2017 23:21:30 +0000 (23:21 +0000)
llvm-svn: 317051

llvm/lib/Target/AMDGPU/AMDGPU.h
llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp

index e8f7476..0ddc43a 100644 (file)
@@ -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;
-
-  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)
-
-  // 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;
-
-  // Some places use this if the address space can't be determined.
-  const static unsigned UNKNOWN_ADDRESS_SPACE = ~0u;
+  enum : unsigned {
+    // The maximum value for flat, generic, local, private, constant and region.
+    MAX_COMMON_ADDRESS = 5,
+
+    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
+
+    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.
+    UNKNOWN_ADDRESS_SPACE = ~0u,
+  };
 };
 
 namespace llvm {
index c378974..9fc9592 100644 (file)
@@ -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<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const {
index f20dba8..f7ecdea 100644 (file)
@@ -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<Function>(&GV))
     return F->isDeclaration() || AMDGPU::isEntryFunctionCC(F->getCallingConv());
 
index 018cb5d..ae70dd2 100644 (file)
@@ -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 {