[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp ConstantMerge.cpp DeadArgumentElimination.cpp DeadTypeElimination.cpp ExtractFunction.cpp GlobalDCE.cpp GlobalOpt.cpp IPConstantPropagation.cpp IndMemRemoval.cpp InlineSimple.cpp Internalize.cpp LoopExtractor.cpp LowerSetJmp.cpp PruneEH.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp StripSymbols.cpp

Reid Spencer reid at x10sys.com
Mon Feb 5 15:32:26 PST 2007



Changes in directory llvm/lib/Transforms/IPO:

ArgumentPromotion.cpp updated: 1.34 -> 1.35
ConstantMerge.cpp updated: 1.34 -> 1.35
DeadArgumentElimination.cpp updated: 1.36 -> 1.37
DeadTypeElimination.cpp updated: 1.61 -> 1.62
ExtractFunction.cpp updated: 1.18 -> 1.19
GlobalDCE.cpp updated: 1.41 -> 1.42
GlobalOpt.cpp updated: 1.94 -> 1.95
IPConstantPropagation.cpp updated: 1.22 -> 1.23
IndMemRemoval.cpp updated: 1.13 -> 1.14
InlineSimple.cpp updated: 1.77 -> 1.78
Internalize.cpp updated: 1.43 -> 1.44
LoopExtractor.cpp updated: 1.22 -> 1.23
LowerSetJmp.cpp updated: 1.38 -> 1.39
PruneEH.cpp updated: 1.28 -> 1.29
RaiseAllocations.cpp updated: 1.37 -> 1.38
SimplifyLibCalls.cpp updated: 1.91 -> 1.92
StripSymbols.cpp updated: 1.12 -> 1.13
---
Log message:

Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug
binary size by 376 KB, and reduces link time for llvm tools slightly.


---
Diffs of the changes:  (+71 -51)

 ArgumentPromotion.cpp       |    3 +
 ConstantMerge.cpp           |    3 +
 DeadArgumentElimination.cpp |    3 +
 DeadTypeElimination.cpp     |    3 +
 ExtractFunction.cpp         |    4 +-
 GlobalDCE.cpp               |    3 +
 GlobalOpt.cpp               |    5 +--
 IPConstantPropagation.cpp   |    3 +
 IndMemRemoval.cpp           |    3 +
 InlineSimple.cpp            |    7 ++--
 Internalize.cpp             |    3 +
 LoopExtractor.cpp           |    3 +
 LowerSetJmp.cpp             |    3 +
 PruneEH.cpp                 |    3 +
 RaiseAllocations.cpp        |    3 +
 SimplifyLibCalls.cpp        |   67 ++++++++++++++++++++++----------------------
 StripSymbols.cpp            |    3 +
 17 files changed, 71 insertions(+), 51 deletions(-)


Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.34 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.35
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.34	Thu Jan 25 18:47:38 2007
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp	Mon Feb  5 17:32:05 2007
@@ -44,6 +44,7 @@
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 using namespace llvm;
 
@@ -54,7 +55,7 @@
 namespace {
   /// ArgPromotion - The 'by reference' to 'by value' argument promotion pass.
   ///
-  struct ArgPromotion : public CallGraphSCCPass {
+  struct VISIBILITY_HIDDEN ArgPromotion : public CallGraphSCCPass {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<AliasAnalysis>();
       AU.addRequired<TargetData>();


Index: llvm/lib/Transforms/IPO/ConstantMerge.cpp
diff -u llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.34 llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.35
--- llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.34	Tue Dec 19 16:09:18 2006
+++ llvm/lib/Transforms/IPO/ConstantMerge.cpp	Mon Feb  5 17:32:05 2007
@@ -22,12 +22,13 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Compiler.h"
 using namespace llvm;
 
 STATISTIC(NumMerged, "Number of global constants merged");
 
 namespace {
-  struct ConstantMerge : public ModulePass {
+  struct VISIBILITY_HIDDEN ConstantMerge : public ModulePass {
     // run - For this pass, process all of the globals in the module,
     // eliminating duplicate constants.
     //


Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.36 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.37
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.36	Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp	Mon Feb  5 17:32:05 2007
@@ -29,6 +29,7 @@
 #include "llvm/Support/CallSite.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 using namespace llvm;
 
@@ -38,7 +39,7 @@
 namespace {
   /// DAE - The dead argument elimination pass.
   ///
-  class DAE : public ModulePass {
+  class VISIBILITY_HIDDEN DAE : public ModulePass {
     /// Liveness enum - During our initial pass over the program, we determine
     /// that things are either definately alive, definately dead, or in need of
     /// interprocedural analysis (MaybeLive).


Index: llvm/lib/Transforms/IPO/DeadTypeElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.61 llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.62
--- llvm/lib/Transforms/IPO/DeadTypeElimination.cpp:1.61	Sun Jan 14 20:27:26 2007
+++ llvm/lib/Transforms/IPO/DeadTypeElimination.cpp	Mon Feb  5 17:32:05 2007
@@ -19,12 +19,13 @@
 #include "llvm/TypeSymbolTable.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Compiler.h"
 using namespace llvm;
 
 STATISTIC(NumKilled, "Number of unused typenames removed from symtab");
 
 namespace {
-  struct DTE : public ModulePass {
+  struct VISIBILITY_HIDDEN DTE : public ModulePass {
     // doPassInitialization - For this pass, it removes global symbol table
     // entries for primitive types.  These are never used for linking in GCC and
     // they make the output uglier to look at, so we nuke them.


Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp
diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.18 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.19
--- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.18	Mon Feb  5 15:19:13 2007
+++ llvm/lib/Transforms/IPO/ExtractFunction.cpp	Mon Feb  5 17:32:05 2007
@@ -15,10 +15,12 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/Transforms/IPO.h"
+#include "llvm/Support/Compiler.h"
 using namespace llvm;
 
 namespace {
-  class FunctionExtractorPass : public ModulePass {
+  /// @brief A pass to extract specific functions and their dependencies.
+  class VISIBILITY_HIDDEN FunctionExtractorPass : public ModulePass {
     Function *Named;
     bool deleteFunc;
     bool reLink;


Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp
diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.41 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.42
--- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.41	Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/IPO/GlobalDCE.cpp	Mon Feb  5 17:32:05 2007
@@ -21,6 +21,7 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 using namespace llvm;
 
@@ -28,7 +29,7 @@
 STATISTIC(NumVariables, "Number of global variables removed");
 
 namespace {
-  struct GlobalDCE : public ModulePass {
+  struct VISIBILITY_HIDDEN GlobalDCE : public ModulePass {
     // run - Do the GlobalDCE pass on the specified module, optionally updating
     // the specified callgraph to reflect the changes.
     //


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.94 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.95
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.94	Thu Feb  1 20:16:22 2007
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp	Mon Feb  5 17:32:05 2007
@@ -24,6 +24,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
@@ -45,7 +46,7 @@
 STATISTIC(NumCtorsEvaluated, "Number of static ctors evaluated");
 
 namespace {
-  struct GlobalOpt : public ModulePass {
+  struct VISIBILITY_HIDDEN GlobalOpt : public ModulePass {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<TargetData>();
     }
@@ -68,7 +69,7 @@
 /// GlobalStatus - As we analyze each global, keep track of some information
 /// about it.  If we find out that the address of the global is taken, none of
 /// this info will be accurate.
-struct GlobalStatus {
+struct VISIBILITY_HIDDEN GlobalStatus {
   /// isLoaded - True if the global is ever loaded.  If the global isn't ever
   /// loaded it can be deleted.
   bool isLoaded;


Index: llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
diff -u llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.22 llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.23
--- llvm/lib/Transforms/IPO/IPConstantPropagation.cpp:1.22	Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/IPO/IPConstantPropagation.cpp	Mon Feb  5 17:32:05 2007
@@ -22,6 +22,7 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CallSite.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Statistic.h"
 using namespace llvm;
 
@@ -31,7 +32,7 @@
 namespace {
   /// IPCP - The interprocedural constant propagation pass
   ///
-  struct IPCP : public ModulePass {
+  struct VISIBILITY_HIDDEN IPCP : public ModulePass {
     bool runOnModule(Module &M);
   private:
     bool PropagateConstantsIntoArguments(Function &F);


Index: llvm/lib/Transforms/IPO/IndMemRemoval.cpp
diff -u llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.13 llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.14
--- llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.13	Mon Feb  5 15:19:13 2007
+++ llvm/lib/Transforms/IPO/IndMemRemoval.cpp	Mon Feb  5 17:32:05 2007
@@ -23,13 +23,14 @@
 #include "llvm/Type.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/Compiler.h"
 using namespace llvm;
 
 STATISTIC(NumBounceSites, "Number of sites modified");
 STATISTIC(NumBounce     , "Number of bounce functions created");
 
 namespace {
-  class IndMemRemPass : public ModulePass {
+  class VISIBILITY_HIDDEN IndMemRemPass : public ModulePass {
   public:
     virtual bool runOnModule(Module &M);
   };


Index: llvm/lib/Transforms/IPO/InlineSimple.cpp
diff -u llvm/lib/Transforms/IPO/InlineSimple.cpp:1.77 llvm/lib/Transforms/IPO/InlineSimple.cpp:1.78
--- llvm/lib/Transforms/IPO/InlineSimple.cpp:1.77	Thu Jan 25 18:47:38 2007
+++ llvm/lib/Transforms/IPO/InlineSimple.cpp	Mon Feb  5 17:32:05 2007
@@ -18,11 +18,12 @@
 #include "llvm/Function.h"
 #include "llvm/Type.h"
 #include "llvm/Support/CallSite.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/IPO.h"
 using namespace llvm;
 
 namespace {
-  struct ArgInfo {
+  struct VISIBILITY_HIDDEN ArgInfo {
     unsigned ConstantWeight;
     unsigned AllocaWeight;
 
@@ -32,7 +33,7 @@
 
   // FunctionInfo - For each function, calculate the size of it in blocks and
   // instructions.
-  struct FunctionInfo {
+  struct VISIBILITY_HIDDEN FunctionInfo {
     // NumInsts, NumBlocks - Keep track of how large each function is, which is
     // used to estimate the code size cost of inlining it.
     unsigned NumInsts, NumBlocks;
@@ -50,7 +51,7 @@
     void analyzeFunction(Function *F);
   };
 
-  class SimpleInliner : public Inliner {
+  class VISIBILITY_HIDDEN SimpleInliner : public Inliner {
     std::map<const Function*, FunctionInfo> CachedFunctionInfo;
   public:
     int getInlineCost(CallSite CS);


Index: llvm/lib/Transforms/IPO/Internalize.cpp
diff -u llvm/lib/Transforms/IPO/Internalize.cpp:1.43 llvm/lib/Transforms/IPO/Internalize.cpp:1.44
--- llvm/lib/Transforms/IPO/Internalize.cpp:1.43	Mon Feb  5 15:19:13 2007
+++ llvm/lib/Transforms/IPO/Internalize.cpp	Mon Feb  5 17:32:05 2007
@@ -18,6 +18,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Module.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/Statistic.h"
 #include <fstream>
@@ -41,7 +42,7 @@
           cl::desc("A list of symbol names to preserve"),
           cl::CommaSeparated);
 
-  class InternalizePass : public ModulePass {
+  class VISIBILITY_HIDDEN InternalizePass : public ModulePass {
     std::set<std::string> ExternalNames;
     bool DontInternalize;
   public:


Index: llvm/lib/Transforms/IPO/LoopExtractor.cpp
diff -u llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.22 llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.23
--- llvm/lib/Transforms/IPO/LoopExtractor.cpp:1.22	Mon Feb  5 14:47:20 2007
+++ llvm/lib/Transforms/IPO/LoopExtractor.cpp	Mon Feb  5 17:32:05 2007
@@ -21,6 +21,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/FunctionUtils.h"
 #include "llvm/ADT/Statistic.h"
@@ -32,7 +33,7 @@
   // FIXME: This is not a function pass, but the PassManager doesn't allow
   // Module passes to require FunctionPasses, so we can't get loop info if we're
   // not a function pass.
-  struct LoopExtractor : public FunctionPass {
+  struct VISIBILITY_HIDDEN LoopExtractor : public FunctionPass {
     unsigned NumLoops;
 
     LoopExtractor(unsigned numLoops = ~0) : NumLoops(numLoops) {}


Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp
diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.38 llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.39
--- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.38	Mon Feb  5 15:19:13 2007
+++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp	Mon Feb  5 17:32:05 2007
@@ -42,6 +42,7 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/InstVisitor.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/ADT/DepthFirstIterator.h"
@@ -58,7 +59,7 @@
 namespace {
   //===--------------------------------------------------------------------===//
   // LowerSetJmp pass implementation.
-  class LowerSetJmp : public ModulePass,
+  class VISIBILITY_HIDDEN LowerSetJmp : public ModulePass,
                       public InstVisitor<LowerSetJmp> {
     // LLVM library functions...
     Constant *InitSJMap;        // __llvm_sjljeh_init_setjmpmap


Index: llvm/lib/Transforms/IPO/PruneEH.cpp
diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.28 llvm/lib/Transforms/IPO/PruneEH.cpp:1.29
--- llvm/lib/Transforms/IPO/PruneEH.cpp:1.28	Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/IPO/PruneEH.cpp	Mon Feb  5 17:32:05 2007
@@ -24,6 +24,7 @@
 #include "llvm/Analysis/CallGraph.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/Compiler.h"
 #include <set>
 #include <algorithm>
 using namespace llvm;
@@ -32,7 +33,7 @@
 STATISTIC(NumUnreach, "Number of noreturn calls optimized");
 
 namespace {
-  struct PruneEH : public CallGraphSCCPass {
+  struct VISIBILITY_HIDDEN PruneEH : public CallGraphSCCPass {
     /// DoesNotUnwind - This set contains all of the functions which we have
     /// determined cannot unwind.
     std::set<CallGraphNode*> DoesNotUnwind;


Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp
diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.37 llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.38
--- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.37	Mon Feb  5 14:47:20 2007
+++ llvm/lib/Transforms/IPO/RaiseAllocations.cpp	Mon Feb  5 17:32:05 2007
@@ -20,6 +20,7 @@
 #include "llvm/Instructions.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CallSite.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/ADT/Statistic.h"
 using namespace llvm;
 
@@ -29,7 +30,7 @@
   // RaiseAllocations - Turn %malloc and %free calls into the appropriate
   // instruction.
   //
-  class RaiseAllocations : public ModulePass {
+  class VISIBILITY_HIDDEN RaiseAllocations : public ModulePass {
     Function *MallocFunc;   // Functions in the module we are processing
     Function *FreeFunc;     // Initialized by doPassInitializationVirt
   public:


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.91 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.92
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.91	Wed Jan 31 13:59:55 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp	Mon Feb  5 17:32:05 2007
@@ -26,6 +26,7 @@
 #include "llvm/ADT/hash_map"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Config/config.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Transforms/IPO.h"
@@ -62,7 +63,7 @@
 /// generally short-circuit actually calling the function if there's a simpler
 /// way (e.g. strlen(X) can be reduced to a constant if X is a constant global).
 /// @brief Base class for library call optimizations
-class LibCallOptimization {
+class VISIBILITY_HIDDEN LibCallOptimization {
   LibCallOptimization **Prev, *Next;
   const char *FunctionName; ///< Name of the library call we optimize
 #ifndef NDEBUG
@@ -142,7 +143,7 @@
 /// validate the call (ValidateLibraryCall). If it is validated, then
 /// the OptimizeCall method is also called.
 /// @brief A ModulePass for optimizing well-known function calls.
-class SimplifyLibCalls : public ModulePass {
+class VISIBILITY_HIDDEN SimplifyLibCalls : public ModulePass {
 public:
   /// We need some target data for accurate signature details that are
   /// target dependent. So we require target data in our AnalysisUsage.
@@ -383,15 +384,16 @@
 namespace {
 
 // Forward declare utility functions.
-bool getConstantStringLength(Value* V, uint64_t& len, ConstantArray** A = 0 );
-Value *CastToCStr(Value *V, Instruction &IP);
+static bool getConstantStringLength(Value* V, uint64_t& len, 
+                                    ConstantArray** A = 0 );
+static Value *CastToCStr(Value *V, Instruction &IP);
 
 /// This LibCallOptimization will find instances of a call to "exit" that occurs
 /// within the "main" function and change it to a simple "ret" instruction with
 /// the same value passed to the exit function. When this is done, it splits the
 /// basic block at the exit(3) call and deletes the call instruction.
 /// @brief Replace calls to exit in main with a simple return
-struct ExitInMainOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN ExitInMainOptimization : public LibCallOptimization {
   ExitInMainOptimization() : LibCallOptimization("exit",
       "Number of 'exit' calls simplified") {}
 
@@ -447,7 +449,7 @@
 /// of the constant string. Both of these calls are further reduced, if possible
 /// on subsequent passes.
 /// @brief Simplify the strcat library function.
-struct StrCatOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN StrCatOptimization : public LibCallOptimization {
 public:
   /// @brief Default constructor
   StrCatOptimization() : LibCallOptimization("strcat",
@@ -530,7 +532,7 @@
 /// function.  It optimizes out cases where the arguments are both constant
 /// and the result can be determined statically.
 /// @brief Simplify the strcmp library function.
-struct StrChrOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN StrChrOptimization : public LibCallOptimization {
 public:
   StrChrOptimization() : LibCallOptimization("strchr",
       "Number of 'strchr' calls simplified") {}
@@ -611,7 +613,7 @@
 /// function.  It optimizes out cases where one or both arguments are constant
 /// and the result can be determined statically.
 /// @brief Simplify the strcmp library function.
-struct StrCmpOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN StrCmpOptimization : public LibCallOptimization {
 public:
   StrCmpOptimization() : LibCallOptimization("strcmp",
       "Number of 'strcmp' calls simplified") {}
@@ -688,7 +690,7 @@
 /// function.  It optimizes out cases where one or both arguments are constant
 /// and the result can be determined statically.
 /// @brief Simplify the strncmp library function.
-struct StrNCmpOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN StrNCmpOptimization : public LibCallOptimization {
 public:
   StrNCmpOptimization() : LibCallOptimization("strncmp",
       "Number of 'strncmp' calls simplified") {}
@@ -781,7 +783,7 @@
 /// (1) If src and dest are the same and not volatile, just return dest
 /// (2) If the src is a constant then we can convert to llvm.memmove
 /// @brief Simplify the strcpy library function.
-struct StrCpyOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN StrCpyOptimization : public LibCallOptimization {
 public:
   StrCpyOptimization() : LibCallOptimization("strcpy",
       "Number of 'strcpy' calls simplified") {}
@@ -859,7 +861,7 @@
 /// function by replacing it with a constant value if the string provided to
 /// it is a constant array.
 /// @brief Simplify the strlen library function.
-struct StrLenOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN StrLenOptimization : public LibCallOptimization {
   StrLenOptimization() : LibCallOptimization("strlen",
       "Number of 'strlen' calls simplified") {}
 
@@ -947,7 +949,7 @@
 
 /// This memcmpOptimization will simplify a call to the memcmp library
 /// function.
-struct memcmpOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN memcmpOptimization : public LibCallOptimization {
   /// @brief Default Constructor
   memcmpOptimization()
     : LibCallOptimization("memcmp", "Number of 'memcmp' calls simplified") {}
@@ -1052,7 +1054,7 @@
 /// bytes depending on the length of the string and the alignment. Additional
 /// optimizations are possible in code generation (sequence of immediate store)
 /// @brief Simplify the memcpy library function.
-struct LLVMMemCpyMoveOptzn : public LibCallOptimization {
+struct VISIBILITY_HIDDEN LLVMMemCpyMoveOptzn : public LibCallOptimization {
   LLVMMemCpyMoveOptzn(const char* fname, const char* desc)
   : LibCallOptimization(fname, desc) {}
 
@@ -1129,7 +1131,7 @@
 /// This LibCallOptimization will simplify a call to the memset library
 /// function by expanding it out to a single store of size 0, 1, 2, 4, or 8
 /// bytes depending on the length argument.
-struct LLVMMemSetOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN LLVMMemSetOptimization : public LibCallOptimization {
   /// @brief Default Constructor
   LLVMMemSetOptimization(const char *Name) : LibCallOptimization(Name,
       "Number of 'llvm.memset' calls simplified") {}
@@ -1232,7 +1234,7 @@
 /// function. It looks for cases where the result of pow is well known and
 /// substitutes the appropriate value.
 /// @brief Simplify the pow library function.
-struct PowOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN PowOptimization : public LibCallOptimization {
 public:
   /// @brief Default Constructor
   PowOptimization() : LibCallOptimization("pow",
@@ -1293,7 +1295,7 @@
 /// function. It looks for cases where the result of printf is not used and the
 /// operation can be reduced to something simpler.
 /// @brief Simplify the printf library function.
-struct PrintfOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN PrintfOptimization : public LibCallOptimization {
 public:
   /// @brief Default Constructor
   PrintfOptimization() : LibCallOptimization("printf",
@@ -1371,7 +1373,7 @@
 /// function. It looks for cases where the result of fprintf is not used and the
 /// operation can be reduced to something simpler.
 /// @brief Simplify the fprintf library function.
-struct FPrintFOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN FPrintFOptimization : public LibCallOptimization {
 public:
   /// @brief Default Constructor
   FPrintFOptimization() : LibCallOptimization("fprintf",
@@ -1491,7 +1493,7 @@
 /// function. It looks for cases where the result of sprintf is not used and the
 /// operation can be reduced to something simpler.
 /// @brief Simplify the sprintf library function.
-struct SPrintFOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN SPrintFOptimization : public LibCallOptimization {
 public:
   /// @brief Default Constructor
   SPrintFOptimization() : LibCallOptimization("sprintf",
@@ -1614,7 +1616,7 @@
 /// function. It looks for cases where the result of fputs is not used and the
 /// operation can be reduced to something simpler.
 /// @brief Simplify the puts library function.
-struct PutsOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN PutsOptimization : public LibCallOptimization {
 public:
   /// @brief Default Constructor
   PutsOptimization() : LibCallOptimization("fputs",
@@ -1675,7 +1677,7 @@
 /// This LibCallOptimization will simplify calls to the "isdigit" library
 /// function. It simply does range checks the parameter explicitly.
 /// @brief Simplify the isdigit library function.
-struct isdigitOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN isdigitOptimization : public LibCallOptimization {
 public:
   isdigitOptimization() : LibCallOptimization("isdigit",
       "Number of 'isdigit' calls simplified") {}
@@ -1716,7 +1718,7 @@
   }
 } isdigitOptimizer;
 
-struct isasciiOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN isasciiOptimization : public LibCallOptimization {
 public:
   isasciiOptimization()
     : LibCallOptimization("isascii", "Number of 'isascii' calls simplified") {}
@@ -1746,7 +1748,7 @@
 /// function. It simply does the corresponding and operation to restrict the
 /// range of values to the ASCII character set (0-127).
 /// @brief Simplify the toascii library function.
-struct ToAsciiOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN ToAsciiOptimization : public LibCallOptimization {
 public:
   /// @brief Default Constructor
   ToAsciiOptimization() : LibCallOptimization("toascii",
@@ -1775,7 +1777,7 @@
 /// optimization is to compute the result at compile time if the argument is
 /// a constant.
 /// @brief Simplify the ffs library function.
-struct FFSOptimization : public LibCallOptimization {
+struct VISIBILITY_HIDDEN FFSOptimization : public LibCallOptimization {
 protected:
   /// @brief Subclass Constructor
   FFSOptimization(const char* funcName, const char* description)
@@ -1855,7 +1857,7 @@
 /// calls. It simply uses FFSOptimization for which the transformation is
 /// identical.
 /// @brief Simplify the ffsl library function.
-struct FFSLOptimization : public FFSOptimization {
+struct VISIBILITY_HIDDEN FFSLOptimization : public FFSOptimization {
 public:
   /// @brief Default Constructor
   FFSLOptimization() : FFSOptimization("ffsl",
@@ -1867,7 +1869,7 @@
 /// calls. It simply uses FFSOptimization for which the transformation is
 /// identical.
 /// @brief Simplify the ffsl library function.
-struct FFSLLOptimization : public FFSOptimization {
+struct VISIBILITY_HIDDEN FFSLLOptimization : public FFSOptimization {
 public:
   /// @brief Default Constructor
   FFSLLOptimization() : FFSOptimization("ffsll",
@@ -1909,7 +1911,7 @@
 };
 
 
-struct FloorOptimization : public UnaryDoubleFPOptimizer {
+struct VISIBILITY_HIDDEN FloorOptimization : public UnaryDoubleFPOptimizer {
   FloorOptimization()
     : UnaryDoubleFPOptimizer("floor", "Number of 'floor' calls simplified") {}
   
@@ -1923,7 +1925,7 @@
   }
 } FloorOptimizer;
 
-struct CeilOptimization : public UnaryDoubleFPOptimizer {
+struct VISIBILITY_HIDDEN CeilOptimization : public UnaryDoubleFPOptimizer {
   CeilOptimization()
   : UnaryDoubleFPOptimizer("ceil", "Number of 'ceil' calls simplified") {}
   
@@ -1937,7 +1939,7 @@
   }
 } CeilOptimizer;
 
-struct RoundOptimization : public UnaryDoubleFPOptimizer {
+struct VISIBILITY_HIDDEN RoundOptimization : public UnaryDoubleFPOptimizer {
   RoundOptimization()
   : UnaryDoubleFPOptimizer("round", "Number of 'round' calls simplified") {}
   
@@ -1951,7 +1953,7 @@
   }
 } RoundOptimizer;
 
-struct RintOptimization : public UnaryDoubleFPOptimizer {
+struct VISIBILITY_HIDDEN RintOptimization : public UnaryDoubleFPOptimizer {
   RintOptimization()
   : UnaryDoubleFPOptimizer("rint", "Number of 'rint' calls simplified") {}
   
@@ -1965,7 +1967,7 @@
   }
 } RintOptimizer;
 
-struct NearByIntOptimization : public UnaryDoubleFPOptimizer {
+struct VISIBILITY_HIDDEN NearByIntOptimization : public UnaryDoubleFPOptimizer {
   NearByIntOptimization()
   : UnaryDoubleFPOptimizer("nearbyint",
                            "Number of 'nearbyint' calls simplified") {}
@@ -1990,7 +1992,8 @@
 /// of the null-terminated string. If false is returned, the conditions were
 /// not met and len is set to 0.
 /// @brief Get the length of a constant string (null-terminated array).
-bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA) {
+static bool getConstantStringLength(Value *V, uint64_t &len, ConstantArray **CA)
+{
   assert(V != 0 && "Invalid args to getConstantStringLength");
   len = 0; // make sure we initialize this
   User* GEP = 0;
@@ -2079,7 +2082,7 @@
 /// CastToCStr - Return V if it is an sbyte*, otherwise cast it to sbyte*,
 /// inserting the cast before IP, and return the cast.
 /// @brief Cast a value to a "C" string.
-Value *CastToCStr(Value *V, Instruction &IP) {
+static Value *CastToCStr(Value *V, Instruction &IP) {
   assert(isa<PointerType>(V->getType()) && 
          "Can't cast non-pointer type to C string type");
   const Type *SBPTy = PointerType::get(Type::Int8Ty);


Index: llvm/lib/Transforms/IPO/StripSymbols.cpp
diff -u llvm/lib/Transforms/IPO/StripSymbols.cpp:1.12 llvm/lib/Transforms/IPO/StripSymbols.cpp:1.13
--- llvm/lib/Transforms/IPO/StripSymbols.cpp:1.12	Mon Feb  5 15:19:13 2007
+++ llvm/lib/Transforms/IPO/StripSymbols.cpp	Mon Feb  5 17:32:05 2007
@@ -30,10 +30,11 @@
 #include "llvm/Pass.h"
 #include "llvm/ValueSymbolTable.h"
 #include "llvm/TypeSymbolTable.h"
+#include "llvm/Support/Compiler.h"
 using namespace llvm;
 
 namespace {
-  class StripSymbols : public ModulePass {
+  class VISIBILITY_HIDDEN StripSymbols : public ModulePass {
     bool OnlyDebugInfo;
   public:
     StripSymbols(bool ODI = false) : OnlyDebugInfo(ODI) {}






More information about the llvm-commits mailing list