Make some symbols static, move classes into anonymous namespaces.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 22 Oct 2010 17:35:07 +0000 (17:35 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 22 Oct 2010 17:35:07 +0000 (17:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117111 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/RegionInfo.cpp
lib/MC/MCDisassembler/EDOperand.cpp
lib/Target/PTX/PTXISelLowering.cpp
lib/VMCore/PassRegistry.cpp
lib/VMCore/Verifier.cpp
utils/TableGen/X86DisassemblerTables.cpp

index 2622c8966cd1f2b86a162433306267a2b78c122f..6725cfd28fabbcff550aee75f182793840331a47 100644 (file)
@@ -45,7 +45,7 @@ STATISTIC(numSimpleRegions, "The # of simple regions");
 /// PrintStyle - Print region in difference ways.
 enum PrintStyle { PrintNone, PrintBB, PrintRN  };
 
-cl::opt<enum PrintStyle> printStyle("print-region-style", cl::Hidden,
+static cl::opt<enum PrintStyle> printStyle("print-region-style", cl::Hidden,
   cl::desc("style of printing regions"),
   cl::values(
     clEnumValN(PrintNone, "none",  "print no details"),
index 2aed123368dadcc256fbf9dfce4b46865091b16f..cfeb56fa3dfdc6979401fbb8977d7698ad13a4b0 100644 (file)
@@ -260,23 +260,20 @@ int EDOperand::isMemory() {
 }
 
 #ifdef __BLOCKS__
-struct RegisterReaderWrapper {
-  EDOperand::EDRegisterBlock_t regBlock;
-};
+namespace {
+  struct RegisterReaderWrapper {
+    EDOperand::EDRegisterBlock_t regBlock;
+  };
+}
 
-int readerWrapperCallback(uint64_t *value, 
-                          unsigned regID, 
-                          void *arg) {
-  struct RegisterReaderWrapper *wrapper = (struct RegisterReaderWrapper *)arg;
+static int readerWrapperCallback(uint64_t *value, unsigned regID, void *arg) {
+  RegisterReaderWrapper *wrapper = (RegisterReaderWrapper *)arg;
   return wrapper->regBlock(value, regID);
 }
 
-int EDOperand::evaluate(uint64_t &result,
-                        EDRegisterBlock_t regBlock) {
-  struct RegisterReaderWrapper wrapper;
+int EDOperand::evaluate(uint64_t &result, EDRegisterBlock_t regBlock) {
+  RegisterReaderWrapper wrapper;
   wrapper.regBlock = regBlock;
-  return evaluate(result, 
-                  readerWrapperCallback, 
-                  (void*)&wrapper);
+  return evaluate(result, readerWrapperCallback, (void*)&wrapper);
 }
 #endif
index 6e68c3760187776162ef5a47ea4862a48a314d6f..0ee4bf01ee74316a7a5b174a69785356168b75e8 100644 (file)
@@ -44,7 +44,8 @@ const char *PTXTargetLowering::getTargetNodeName(unsigned Opcode) const {
 //                      Calling Convention Implementation
 //===----------------------------------------------------------------------===//
 
-static struct argmap_entry {
+namespace {
+struct argmap_entry {
   MVT::SimpleValueType VT;
   TargetRegisterClass *RC;
   TargetRegisterClass::iterator loc;
@@ -52,12 +53,13 @@ static struct argmap_entry {
   argmap_entry(MVT::SimpleValueType _VT, TargetRegisterClass *_RC)
     : VT(_VT), RC(_RC), loc(_RC->begin()) {}
 
-  void reset(void) { loc = RC->begin(); }
-  bool operator==(MVT::SimpleValueType _VT) { return VT == _VT; }
+  void reset() { loc = RC->begin(); }
+  bool operator==(MVT::SimpleValueType _VT) const { return VT == _VT; }
 } argmap[] = {
   argmap_entry(MVT::i1,  PTX::PredsRegisterClass),
   argmap_entry(MVT::i32, PTX::RRegs32RegisterClass)
 };
+} // end anonymous namespace
 
 static SDValue lower_kernel_argument(int i,
                                      SDValue Chain,
index 95ca6814094c8190d3f591c7948242bb826675cf..1fc26b0648db9c8f070f807b4c33f83c0e2a5c3a 100644 (file)
@@ -40,6 +40,7 @@ static ManagedStatic<sys::SmartMutex<true> > Lock;
 // PassRegistryImpl
 //
 
+namespace {
 struct PassRegistryImpl {
   /// PassInfoMap - Keep track of the PassInfo object for each registered pass.
   typedef DenseMap<const void*, const PassInfo*> MapType;
@@ -57,6 +58,7 @@ struct PassRegistryImpl {
   std::vector<const PassInfo*> ToFree;
   std::vector<PassRegistrationListener*> Listeners;
 };
+} // end anonymous namespace
 
 void *PassRegistry::getImpl() const {
   if (!pImpl)
index c779578b9b8309e72a040865759b761404943671..2b87619038cd34b475127a6ae1c48fc24fe17415 100644 (file)
@@ -106,7 +106,7 @@ namespace {  // Anonymous namespace for class
 char PreVerifier::ID = 0;
 INITIALIZE_PASS(PreVerifier, "preverify", "Preliminary module verification", 
                 false, false)
-char &PreVerifyID = PreVerifier::ID;
+static char &PreVerifyID = PreVerifier::ID;
 
 namespace {
   class TypeSet : public AbstractTypeUser {
index 2176224523a38cd0ac72d2e55fc8cc9b90b37b1a..8a32f4af66948808fc00a46be34caafb71ff6c29 100644 (file)
@@ -365,7 +365,7 @@ void DisassemblerTables::emitContextDecision(
   uint32_t &i2,
   ContextDecision &decision,
   const char* name) const {
-  o2.indent(i2) << "struct ContextDecision " << name << " = {" << "\n";
+  o2.indent(i2) << "static struct ContextDecision " << name << " = {\n";
   i2++;
   o2.indent(i2) << "{ /* opcodeDecisions */" << "\n";
   i2++;
@@ -392,8 +392,7 @@ void DisassemblerTables::emitContextDecision(
 
 void DisassemblerTables::emitInstructionInfo(raw_ostream &o, uint32_t &i) 
   const {
-  o.indent(i * 2) << "struct InstructionSpecifier ";
-  o << INSTRUCTIONS_STR << "[";
+  o.indent(i * 2) << "static struct InstructionSpecifier " INSTRUCTIONS_STR "[";
   o << InstructionSpecifiers.size();
   o << "] = {" << "\n";
   
@@ -456,8 +455,7 @@ void DisassemblerTables::emitInstructionInfo(raw_ostream &o, uint32_t &i)
 void DisassemblerTables::emitContextTable(raw_ostream &o, uint32_t &i) const {
   uint16_t index;
 
-  o.indent(i * 2) << "InstructionContext ";
-  o << CONTEXTS_STR << "[256] = {" << "\n";
+  o.indent(i * 2) << "static InstructionContext " CONTEXTS_STR "[256] = {\n";
   i++;
 
   for (index = 0; index < 256; ++index) {