From 496bd3fbf60ae2c1ae25ce831d2545bb7c9ad7dd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 28 Jun 2006 23:17:24 +0000 Subject: [PATCH] Use hidden visibility to make symbols in an anonymous namespace get dropped. This shrinks libllvmgcc.dylib another 67K llvm-svn: 28975 --- lib/Analysis/BasicAliasAnalysis.cpp | 5 +++-- lib/Analysis/ScalarEvolution.cpp | 7 ++++--- lib/CodeGen/PHIElimination.cpp | 3 ++- lib/CodeGen/RegAllocLocal.cpp | 3 ++- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | 6 ++++-- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 3 ++- lib/CodeGen/UnreachableBlockElim.cpp | 3 ++- lib/Target/PowerPC/PPCAsmPrinter.cpp | 6 +++--- lib/Target/PowerPC/PPCBranchSelector.cpp | 3 ++- lib/Target/PowerPC/PPCCodeEmitter.cpp | 3 ++- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 3 ++- lib/Transforms/Scalar/LowerAllocations.cpp | 3 ++- lib/Transforms/Scalar/ScalarReplAggregates.cpp | 5 +++-- lib/Transforms/Utils/BreakCriticalEdges.cpp | 3 ++- lib/Transforms/Utils/LoopSimplify.cpp | 3 ++- lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 3 ++- 16 files changed, 39 insertions(+), 23 deletions(-) diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index fa4a029648f..57eda0fd40e 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -23,6 +23,7 @@ #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/Support/Visibility.h" #include using namespace llvm; @@ -32,7 +33,7 @@ namespace { /// implementations, in that it does not chain to a previous analysis. As /// such it doesn't follow many of the rules that other alias analyses must. /// - struct NoAA : public ImmutablePass, public AliasAnalysis { + struct VISIBILITY_HIDDEN NoAA : public ImmutablePass, public AliasAnalysis { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); } @@ -84,7 +85,7 @@ namespace { /// BasicAliasAnalysis - This is the default alias analysis implementation. /// Because it doesn't chain to a previous alias analysis (like -no-aa), it /// derives from the NoAA class. - struct BasicAliasAnalysis : public NoAA { + struct VISIBILITY_HIDDEN BasicAliasAnalysis : public NoAA { AliasResult alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size); diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index c6e32c53ab7..a83d2ee1c69 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -69,9 +69,10 @@ #include "llvm/Assembly/Writer.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/ConstantRange.h" #include "llvm/Support/InstIterator.h" -#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/Statistic.h" #include #include @@ -393,7 +394,7 @@ namespace { /// SCEVComplexityCompare - Return true if the complexity of the LHS is less /// than the complexity of the RHS. This comparator is used to canonicalize /// expressions. - struct SCEVComplexityCompare { + struct VISIBILITY_HIDDEN SCEVComplexityCompare { bool operator()(SCEV *LHS, SCEV *RHS) { return LHS->getSCEVType() < RHS->getSCEVType(); } @@ -1062,7 +1063,7 @@ SCEVHandle SCEVUnknown::get(Value *V) { /// evolution code. /// namespace { - struct ScalarEvolutionsImpl { + struct VISIBILITY_HIDDEN ScalarEvolutionsImpl { /// F - The function we are analyzing. /// Function &F; diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index 58ab82e0323..5b8798f9829 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -23,6 +23,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Support/Visibility.h" #include #include using namespace llvm; @@ -31,7 +32,7 @@ namespace { Statistic<> NumAtomic("phielim", "Number of atomic phis lowered"); Statistic<> NumSimple("phielim", "Number of simple phis lowered"); - struct PNE : public MachineFunctionPass { + struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { bool Changed = false; diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 55d412960c2..891ee3c0f38 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -23,6 +23,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Statistic.h" #include @@ -34,7 +35,7 @@ namespace { Statistic<> NumLoads ("ra-local", "Number of loads added"); Statistic<> NumFolded("ra-local", "Number of loads/stores folded into " "instructions"); - class RA : public MachineFunctionPass { + class VISIBILITY_HIDDEN RA : public MachineFunctionPass { const TargetMachine *TM; MachineFunction *MF; const MRegisterInfo *RegInfo; diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp index 0ef246b8eba..b6c2d352b35 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp @@ -430,7 +430,8 @@ namespace { namespace { template - class RegReductionPriorityQueue : public SchedulingPriorityQueue { + class VISIBILITY_HIDDEN RegReductionPriorityQueue + : public SchedulingPriorityQueue { std::priority_queue, SF> Queue; public: @@ -463,7 +464,8 @@ namespace { }; template - class BURegReductionPriorityQueue : public RegReductionPriorityQueue { + class VISIBILITY_HIDDEN BURegReductionPriorityQueue + : public RegReductionPriorityQueue { // SUnits - The SUnits for the current graph. const std::vector *SUnits; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index c7e4315bbd6..3968c38fa48 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -42,6 +42,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Visibility.h" #include #include #include @@ -101,7 +102,7 @@ namespace { /// particular value is assigned and the type information about the value. /// This is needed because values can be promoted into larger registers and /// expanded into multiple smaller registers than the value. - struct RegsForValue { + struct VISIBILITY_HIDDEN RegsForValue { /// Regs - This list hold the register (for legal and promoted values) /// or register set (for expanded values) that the value should be assigned /// to. diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp index 1d4e5304f3b..e4fc9f8148d 100644 --- a/lib/CodeGen/UnreachableBlockElim.cpp +++ b/lib/CodeGen/UnreachableBlockElim.cpp @@ -27,11 +27,12 @@ #include "llvm/Pass.h" #include "llvm/Type.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/DepthFirstIterator.h" using namespace llvm; namespace { - class UnreachableBlockElim : public FunctionPass { + class VISIBILITY_HIDDEN UnreachableBlockElim : public FunctionPass { virtual bool runOnFunction(Function &F); }; RegisterOpt diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 2a0104d4770..bb008430946 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -241,7 +241,7 @@ namespace { /// DarwinDwarfWriter - Dwarf debug info writer customized for Darwin/Mac OS X /// - struct DarwinDwarfWriter : public DwarfWriter { + struct VISIBILITY_HIDDEN DarwinDwarfWriter : public DwarfWriter { // Ctor. DarwinDwarfWriter(std::ostream &o, AsmPrinter *ap) : DwarfWriter(o, ap) @@ -265,7 +265,7 @@ namespace { /// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS /// X - struct DarwinAsmPrinter : public PPCAsmPrinter { + struct VISIBILITY_HIDDEN DarwinAsmPrinter : public PPCAsmPrinter { DarwinDwarfWriter DW; @@ -309,7 +309,7 @@ namespace { /// AIXAsmPrinter - PowerPC assembly printer, customized for AIX /// - struct AIXAsmPrinter : public PPCAsmPrinter { + struct VISIBILITY_HIDDEN AIXAsmPrinter : public PPCAsmPrinter { /// Map for labels corresponding to global variables /// std::map GVToLabelMap; diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp index 36f68058f8f..b3d100cf5e5 100644 --- a/lib/Target/PowerPC/PPCBranchSelector.cpp +++ b/lib/Target/PowerPC/PPCBranchSelector.cpp @@ -19,11 +19,12 @@ #include "PPCInstrBuilder.h" #include "PPCInstrInfo.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/Support/Visibility.h" #include using namespace llvm; namespace { - struct PPCBSel : public MachineFunctionPass { + struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass { // OffsetMap - Mapping between BB and byte offset from start of function std::map OffsetMap; diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp index f1c0e07a048..bc0772231f5 100644 --- a/lib/Target/PowerPC/PPCCodeEmitter.cpp +++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp @@ -22,12 +22,13 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Visibility.h" #include "llvm/Target/TargetOptions.h" #include using namespace llvm; namespace { - class PPCCodeEmitter : public MachineFunctionPass { + class VISIBILITY_HIDDEN PPCCodeEmitter : public MachineFunctionPass { TargetMachine &TM; MachineCodeEmitter &MCE; diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 6e4460b509e..ec15b646c73 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -31,6 +31,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Visibility.h" #include "llvm/Target/TargetLowering.h" #include #include @@ -104,7 +105,7 @@ namespace { } }; - class LoopStrengthReduce : public FunctionPass { + class VISIBILITY_HIDDEN LoopStrengthReduce : public FunctionPass { LoopInfo *LI; ETForest *EF; ScalarEvolution *SE; diff --git a/lib/Transforms/Scalar/LowerAllocations.cpp b/lib/Transforms/Scalar/LowerAllocations.cpp index dab8084c4c8..eab64681e57 100644 --- a/lib/Transforms/Scalar/LowerAllocations.cpp +++ b/lib/Transforms/Scalar/LowerAllocations.cpp @@ -21,6 +21,7 @@ #include "llvm/Pass.h" #include "llvm/ADT/Statistic.h" #include "llvm/Target/TargetData.h" +#include "llvm/Support/Visibility.h" using namespace llvm; namespace { @@ -29,7 +30,7 @@ namespace { /// LowerAllocations - Turn malloc and free instructions into %malloc and /// %free calls. /// - class LowerAllocations : public BasicBlockPass { + class VISIBILITY_HIDDEN LowerAllocations : public BasicBlockPass { Function *MallocFunc; // Functions in the module we are processing Function *FreeFunc; // Initialized by doInitialization bool LowerMallocArgToInteger; diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index f5bab8d8520..843c908ba44 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -28,9 +28,10 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/Debug.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include @@ -42,7 +43,7 @@ namespace { Statistic<> NumConverted("scalarrepl", "Number of aggregates converted to scalar"); - struct SROA : public FunctionPass { + struct VISIBILITY_HIDDEN SROA : public FunctionPass { bool runOnFunction(Function &F); bool performScalarRepl(Function &F); diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp index 5bb7d46908c..7b00de6681f 100644 --- a/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -24,13 +24,14 @@ #include "llvm/Instructions.h" #include "llvm/Type.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/Statistic.h" using namespace llvm; namespace { Statistic<> NumBroken("break-crit-edges", "Number of blocks inserted"); - struct BreakCriticalEdges : public FunctionPass { + struct VISIBILITY_HIDDEN BreakCriticalEdges : public FunctionPass { virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index 3188f123b7f..dcad43fc2bf 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -41,6 +41,7 @@ #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/CFG.h" +#include "llvm/Support/Visibility.h" #include "llvm/ADT/SetOperations.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/Statistic.h" @@ -53,7 +54,7 @@ namespace { Statistic<> NumNested("loopsimplify", "Number of nested loops split out"); - struct LoopSimplify : public FunctionPass { + struct VISIBILITY_HIDDEN LoopSimplify : public FunctionPass { // AA - If we have an alias analysis object to update, this is it, otherwise // this is null. AliasAnalysis *AA; diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index e433e6d4a29..f748770f8da 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -26,6 +26,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CFG.h" #include "llvm/Support/StableBasicBlockNumbering.h" +#include "llvm/Support/Visibility.h" #include using namespace llvm; @@ -52,7 +53,7 @@ bool llvm::isAllocaPromotable(const AllocaInst *AI, const TargetData &TD) { } namespace { - struct PromoteMem2Reg { + struct VISIBILITY_HIDDEN PromoteMem2Reg { /// Allocas - The alloca instructions being promoted. /// std::vector Allocas;