Make classes in anonymous namespaces use VISIBILITY_HIDDEN to help reduce

LLVM's footprint and speed up linking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-02-05 23:42:17 +00:00
parent d3874049a5
commit d7d83db5f2
14 changed files with 38 additions and 19 deletions

View File

@ -17,6 +17,7 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Streams.h"
using namespace llvm;
@ -26,7 +27,8 @@ namespace {
cl::opt<bool>
PrintAllFailures("count-aa-print-all-failed-queries", cl::ReallyHidden);
class AliasAnalysisCounter : public ModulePass, public AliasAnalysis {
class VISIBILITY_HIDDEN AliasAnalysisCounter
: public ModulePass, public AliasAnalysis {
unsigned No, May, Must;
unsigned NoMR, JustRef, JustMod, MR;
const char *Name;

View File

@ -28,6 +28,7 @@
#include "llvm/Target/TargetData.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Streams.h"
#include <set>
using namespace llvm;
@ -44,7 +45,7 @@ namespace {
cl::opt<bool> PrintRef("print-ref", cl::ReallyHidden);
cl::opt<bool> PrintModRef("print-modref", cl::ReallyHidden);
class AAEval : public FunctionPass {
class VISIBILITY_HIDDEN AAEval : public FunctionPass {
unsigned NoAlias, MayAlias, MustAlias;
unsigned NoModRef, Mod, Ref, ModRef;

View File

@ -23,12 +23,14 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Support/Compiler.h"
#include <set>
using namespace llvm;
namespace {
class AliasDebugger : public ModulePass, public AliasAnalysis {
class VISIBILITY_HIDDEN AliasDebugger
: public ModulePass, public AliasAnalysis {
//What we do is simple. Keep track of every value the AA could
//know about, and verify that queries are one of those.

View File

@ -18,6 +18,7 @@
#include "llvm/Type.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/Streams.h"
using namespace llvm;
@ -551,7 +552,7 @@ void AliasSetTracker::dump() const { print(cerr); }
//===----------------------------------------------------------------------===//
namespace {
class AliasSetPrinter : public FunctionPass {
class VISIBILITY_HIDDEN AliasSetPrinter : public FunctionPass {
AliasSetTracker *Tracker;
public:
virtual void getAnalysisUsage(AnalysisUsage &AU) const {

View File

@ -745,7 +745,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
}
namespace {
struct StringCompare {
struct VISIBILITY_HIDDEN StringCompare {
bool operator()(const char *LHS, const char *RHS) {
return strcmp(LHS, RHS) < 0;
}

View File

@ -23,6 +23,7 @@
#include "llvm/Analysis/CFGPrinter.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Config/config.h"
#include <iosfwd>
@ -89,7 +90,7 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
}
namespace {
struct CFGPrinter : public FunctionPass {
struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
virtual bool runOnFunction(Function &F) {
std::string Filename = "cfg." + F.getName() + ".dot";
cerr << "Writing '" << Filename << "'...";
@ -113,7 +114,7 @@ namespace {
RegisterPass<CFGPrinter> P1("print-cfg",
"Print CFG of function to 'dot' file");
struct CFGOnlyPrinter : public CFGPrinter {
struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
virtual bool runOnFunction(Function &F) {
bool OldCFGOnly = CFGOnly;
CFGOnly = true;

View File

@ -55,6 +55,7 @@
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Analysis/AliasAnalysis.h"
@ -71,8 +72,8 @@ STATISTIC(NumEscapingFunctions, "Number of internal functions that escape");
STATISTIC(NumIndirectCallees , "Number of indirect callees found");
namespace {
class Andersens : public ModulePass, public AliasAnalysis,
private InstVisitor<Andersens> {
class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis,
private InstVisitor<Andersens> {
/// Node class - This class is used to represent a memory object in the
/// program, and is the primitive used to build the points-to graph.
class Node {

View File

@ -16,6 +16,7 @@
#include "llvm/Module.h"
#include "llvm/Instructions.h"
#include "llvm/Support/CallSite.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Streams.h"
#include <ostream>
using namespace llvm;
@ -35,7 +36,7 @@ namespace {
//===----------------------------------------------------------------------===//
// BasicCallGraph class definition
//
class BasicCallGraph : public CallGraph, public ModulePass {
class VISIBILITY_HIDDEN BasicCallGraph : public CallGraph, public ModulePass {
// Root is root of the call graph, or the external node if a 'main' function
// couldn't be found.
//

View File

@ -23,8 +23,9 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/SCCIterator.h"
#include <set>
@ -42,7 +43,7 @@ namespace {
/// function in the program. Later, the entries for these functions are
/// removed if the function is found to call an external function (in which
/// case we know nothing about it.
struct FunctionRecord {
struct VISIBILITY_HIDDEN FunctionRecord {
/// GlobalInfo - Maintain mod/ref info for all of the globals without
/// addresses taken that are read or written (transitively) by this
/// function.
@ -63,7 +64,8 @@ namespace {
};
/// GlobalsModRef - The actual analysis pass.
class GlobalsModRef : public ModulePass, public AliasAnalysis {
class VISIBILITY_HIDDEN GlobalsModRef
: public ModulePass, public AliasAnalysis {
/// NonAddressTakenGlobals - The globals that do not have their addresses
/// taken.
std::set<GlobalValue*> NonAddressTakenGlobals;

View File

@ -15,6 +15,7 @@
#include "llvm/Analysis/Passes.h"
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/Statistic.h"
@ -33,7 +34,8 @@ STATISTIC(TotalMemInst, "Number of memory instructions");
namespace {
class InstCount : public FunctionPass, public InstVisitor<InstCount> {
class VISIBILITY_HIDDEN InstCount
: public FunctionPass, public InstVisitor<InstCount> {
friend class InstVisitor<InstCount>;
void visitFunction (Function &F) { ++TotalFuncs; }

View File

@ -31,6 +31,7 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Target/TargetData.h"
#include <set>
#include <algorithm>
@ -38,7 +39,7 @@ using namespace llvm;
namespace {
// FIXME: This should not be a FunctionPass.
struct LoadVN : public FunctionPass, public ValueNumbering {
struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering {
/// Pass Implementation stuff. This doesn't do any analysis.
///

View File

@ -16,6 +16,7 @@
#include "llvm/Analysis/ProfileInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
#include <set>
using namespace llvm;
@ -82,7 +83,8 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const {
//
namespace {
struct NoProfileInfo : public ImmutablePass, public ProfileInfo {};
struct VISIBILITY_HIDDEN NoProfileInfo
: public ImmutablePass, public ProfileInfo {};
// Register this pass...
RegisterPass<NoProfileInfo>

View File

@ -19,6 +19,7 @@
#include "llvm/Analysis/ProfileInfo.h"
#include "llvm/Analysis/ProfileInfoLoader.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Streams.h"
using namespace llvm;
@ -28,7 +29,7 @@ namespace {
cl::value_desc("filename"),
cl::desc("Profile file loaded by -profile-loader"));
class LoaderPass : public ModulePass, public ProfileInfo {
class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo {
std::string Filename;
public:
LoaderPass(const std::string &filename = "")

View File

@ -19,6 +19,7 @@
#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/Type.h"
#include "llvm/Support/Compiler.h"
using namespace llvm;
// Register the ValueNumbering interface, providing a nice name to refer to.
@ -48,7 +49,8 @@ namespace {
/// lexically identical expressions. This does not require any ahead of time
/// analysis, so it is a very fast default implementation.
///
struct BasicVN : public ImmutablePass, public ValueNumbering {
struct VISIBILITY_HIDDEN BasicVN
: public ImmutablePass, public ValueNumbering {
/// getEqualNumberNodes - Return nodes with the same value number as the
/// specified Value. This fills in the argument vector with any equal
/// values.
@ -69,7 +71,7 @@ namespace {
/// BVNImpl - Implement BasicVN in terms of a visitor class that
/// handles the different types of instructions as appropriate.
///
struct BVNImpl : public InstVisitor<BVNImpl> {
struct VISIBILITY_HIDDEN BVNImpl : public InstVisitor<BVNImpl> {
std::vector<Value*> &RetVals;
BVNImpl(std::vector<Value*> &RV) : RetVals(RV) {}