summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-28 21:38:54 +0000
committerChris Lattner <sabre@nondot.org>2006-06-28 21:38:54 +0000
commitf190d3805519beb3ec9afe4adfda30e82dcd2995 (patch)
tree34a1c3e371e24cc48eceb410d06410edd0155d0a /lib
parentc521409d4cf6c8edf4900dda36f6ef9b953f8951 (diff)
downloadllvm-f190d3805519beb3ec9afe4adfda30e82dcd2995.tar.gz
llvm-f190d3805519beb3ec9afe4adfda30e82dcd2995.tar.bz2
llvm-f190d3805519beb3ec9afe4adfda30e82dcd2995.tar.xz
Use hidden visibility to reduce the sizes of some .o files. This chops 60K off a release llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28969 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/ConstantFold.cpp29
-rw-r--r--lib/VMCore/Constants.cpp35
-rw-r--r--lib/VMCore/Type.cpp3
-rw-r--r--lib/VMCore/Verifier.cpp4
4 files changed, 47 insertions, 24 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 8c1398132f..e5ca2b37bc 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -25,12 +25,13 @@
#include "llvm/Function.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Visibility.h"
#include <limits>
#include <cmath>
using namespace llvm;
namespace {
- struct ConstRules {
+ struct VISIBILITY_HIDDEN ConstRules {
ConstRules() {}
virtual ~ConstRules() {}
@@ -88,7 +89,7 @@ namespace {
//
namespace {
template<class ArgType, class SubClassName>
-class TemplateRules : public ConstRules {
+class VISIBILITY_HIDDEN TemplateRules : public ConstRules {
//===--------------------------------------------------------------------===//
@@ -221,7 +222,8 @@ public:
// EmptyRules provides a concrete base class of ConstRules that does nothing
//
namespace {
-struct EmptyRules : public TemplateRules<Constant, EmptyRules> {
+struct VISIBILITY_HIDDEN EmptyRules
+ : public TemplateRules<Constant, EmptyRules> {
static Constant *EqualTo(const Constant *V1, const Constant *V2) {
if (V1 == V2) return ConstantBool::True;
return 0;
@@ -238,7 +240,8 @@ struct EmptyRules : public TemplateRules<Constant, EmptyRules> {
// BoolRules provides a concrete base class of ConstRules for the 'bool' type.
//
namespace {
-struct BoolRules : public TemplateRules<ConstantBool, BoolRules> {
+struct VISIBILITY_HIDDEN BoolRules
+ : public TemplateRules<ConstantBool, BoolRules> {
static Constant *LessThan(const ConstantBool *V1, const ConstantBool *V2) {
return ConstantBool::get(V1->getValue() < V2->getValue());
@@ -290,8 +293,8 @@ struct BoolRules : public TemplateRules<ConstantBool, BoolRules> {
// pointers.
//
namespace {
-struct NullPointerRules : public TemplateRules<ConstantPointerNull,
- NullPointerRules> {
+struct VISIBILITY_HIDDEN NullPointerRules
+ : public TemplateRules<ConstantPointerNull, NullPointerRules> {
static Constant *EqualTo(const Constant *V1, const Constant *V2) {
return ConstantBool::True; // Null pointers are always equal
}
@@ -357,7 +360,7 @@ static Constant *EvalVectorOp(const ConstantPacked *V1,
/// ConstantPacked operands.
///
namespace {
-struct ConstantPackedRules
+struct VISIBILITY_HIDDEN ConstantPackedRules
: public TemplateRules<ConstantPacked, ConstantPackedRules> {
static Constant *Add(const ConstantPacked *V1, const ConstantPacked *V2) {
@@ -417,7 +420,8 @@ struct ConstantPackedRules
/// cause for this is that one operand is a ConstantAggregateZero.
///
namespace {
-struct GeneralPackedRules : public TemplateRules<Constant, GeneralPackedRules> {
+struct VISIBILITY_HIDDEN GeneralPackedRules
+ : public TemplateRules<Constant, GeneralPackedRules> {
};
} // end anonymous namespace
@@ -432,7 +436,8 @@ struct GeneralPackedRules : public TemplateRules<Constant, GeneralPackedRules> {
//
namespace {
template<class ConstantClass, class BuiltinType, Type **Ty, class SuperClass>
-struct DirectRules : public TemplateRules<ConstantClass, SuperClass> {
+struct VISIBILITY_HIDDEN DirectRules
+ : public TemplateRules<ConstantClass, SuperClass> {
static Constant *Add(const ConstantClass *V1, const ConstantClass *V2) {
BuiltinType R = (BuiltinType)V1->getValue() + (BuiltinType)V2->getValue();
return ConstantClass::get(*Ty, R);
@@ -502,7 +507,7 @@ struct DirectRules : public TemplateRules<ConstantClass, SuperClass> {
//
namespace {
template <class ConstantClass, class BuiltinType, Type **Ty>
-struct DirectIntRules
+struct VISIBILITY_HIDDEN DirectIntRules
: public DirectRules<ConstantClass, BuiltinType, Ty,
DirectIntRules<ConstantClass, BuiltinType, Ty> > {
@@ -560,7 +565,7 @@ struct DirectIntRules
///
namespace {
template <class ConstantClass, class BuiltinType, Type **Ty>
-struct DirectFPRules
+struct VISIBILITY_HIDDEN DirectFPRules
: public DirectRules<ConstantClass, BuiltinType, Ty,
DirectFPRules<ConstantClass, BuiltinType, Ty> > {
static Constant *Rem(const ConstantClass *V1, const ConstantClass *V2) {
@@ -1472,7 +1477,7 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
dyn_cast<PointerType>(CE->getOperand(0)->getType()))
if (const ArrayType *SAT = dyn_cast<ArrayType>(SPT->getElementType()))
if (const ArrayType *CAT =
- dyn_cast<ArrayType>(cast<PointerType>(C->getType())->getElementType()))
+ dyn_cast<ArrayType>(cast<PointerType>(C->getType())->getElementType()))
if (CAT->getElementType() == SAT->getElementType())
return ConstantExpr::getGetElementPtr(
(Constant*)CE->getOperand(0), IdxList);
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 3b55b652c0..080ae0d2fa 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -20,6 +20,7 @@
#include "llvm/Module.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Visibility.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
@@ -308,12 +309,14 @@ ConstantPacked::~ConstantPacked() {
/// UnaryConstantExpr - This class is private to Constants.cpp, and is used
/// behind the scenes to implement unary constant exprs.
-class UnaryConstantExpr : public ConstantExpr {
+namespace {
+class VISIBILITY_HIDDEN UnaryConstantExpr : public ConstantExpr {
Use Op;
public:
UnaryConstantExpr(unsigned Opcode, Constant *C, const Type *Ty)
: ConstantExpr(Ty, Opcode, &Op, 1), Op(C, this) {}
};
+}
static bool isSetCC(unsigned Opcode) {
return Opcode == Instruction::SetEQ || Opcode == Instruction::SetNE ||
@@ -323,7 +326,8 @@ static bool isSetCC(unsigned Opcode) {
/// BinaryConstantExpr - This class is private to Constants.cpp, and is used
/// behind the scenes to implement binary constant exprs.
-class BinaryConstantExpr : public ConstantExpr {
+namespace {
+class VISIBILITY_HIDDEN BinaryConstantExpr : public ConstantExpr {
Use Ops[2];
public:
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2)
@@ -333,10 +337,12 @@ public:
Ops[1].init(C2, this);
}
};
+}
/// SelectConstantExpr - This class is private to Constants.cpp, and is used
/// behind the scenes to implement select constant exprs.
-class SelectConstantExpr : public ConstantExpr {
+namespace {
+class VISIBILITY_HIDDEN SelectConstantExpr : public ConstantExpr {
Use Ops[3];
public:
SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3)
@@ -346,11 +352,13 @@ public:
Ops[2].init(C3, this);
}
};
+}
/// ExtractElementConstantExpr - This class is private to
/// Constants.cpp, and is used behind the scenes to implement
/// extractelement constant exprs.
-class ExtractElementConstantExpr : public ConstantExpr {
+namespace {
+class VISIBILITY_HIDDEN ExtractElementConstantExpr : public ConstantExpr {
Use Ops[2];
public:
ExtractElementConstantExpr(Constant *C1, Constant *C2)
@@ -360,11 +368,13 @@ public:
Ops[1].init(C2, this);
}
};
+}
/// InsertElementConstantExpr - This class is private to
/// Constants.cpp, and is used behind the scenes to implement
/// insertelement constant exprs.
-class InsertElementConstantExpr : public ConstantExpr {
+namespace {
+class VISIBILITY_HIDDEN InsertElementConstantExpr : public ConstantExpr {
Use Ops[3];
public:
InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3)
@@ -375,11 +385,13 @@ public:
Ops[2].init(C3, this);
}
};
+}
/// ShuffleVectorConstantExpr - This class is private to
/// Constants.cpp, and is used behind the scenes to implement
/// shufflevector constant exprs.
-class ShuffleVectorConstantExpr : public ConstantExpr {
+namespace {
+class VISIBILITY_HIDDEN ShuffleVectorConstantExpr : public ConstantExpr {
Use Ops[3];
public:
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3)
@@ -390,10 +402,12 @@ public:
Ops[2].init(C3, this);
}
};
+}
/// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is
/// used behind the scenes to implement getelementpr constant exprs.
-struct GetElementPtrConstantExpr : public ConstantExpr {
+namespace {
+struct VISIBILITY_HIDDEN GetElementPtrConstantExpr : public ConstantExpr {
GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
const Type *DestTy)
: ConstantExpr(DestTy, Instruction::GetElementPtr,
@@ -406,6 +420,7 @@ struct GetElementPtrConstantExpr : public ConstantExpr {
delete [] OperandList;
}
};
+}
/// ConstantExpr::get* - Return some common constants without having to
/// specify the full Instruction::OPCODE identifier.
@@ -541,14 +556,14 @@ bool ConstantFP::isValueValidForType(const Type *Ty, double Val) {
//
namespace llvm {
template<class ConstantClass, class TypeClass, class ValType>
- struct ConstantCreator {
+ struct VISIBILITY_HIDDEN ConstantCreator {
static ConstantClass *create(const TypeClass *Ty, const ValType &V) {
return new ConstantClass(Ty, V);
}
};
template<class ConstantClass, class TypeClass>
- struct ConvertConstantType {
+ struct VISIBILITY_HIDDEN ConvertConstantType {
static void convert(ConstantClass *OldC, const TypeClass *NewTy) {
assert(0 && "This type cannot be converted!\n");
abort();
@@ -559,7 +574,7 @@ namespace llvm {
namespace {
template<class ValType, class TypeClass, class ConstantClass,
bool HasLargeKey = false /*true for arrays and structs*/ >
- class ValueMap : public AbstractTypeUser {
+ class VISIBILITY_HIDDEN ValueMap : public AbstractTypeUser {
public:
typedef std::pair<const TypeClass*, ValType> MapKey;
typedef std::map<MapKey, ConstantClass *> MapTy;
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index a96efad744..a393556bc6 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -20,6 +20,7 @@
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Visibility.h"
#include <algorithm>
#include <iostream>
using namespace llvm;
@@ -366,7 +367,7 @@ const Type *StructType::getTypeAtIndex(const Value *V) const {
//===----------------------------------------------------------------------===//
namespace {
- struct PrimType : public Type {
+ struct VISIBILITY_HIDDEN PrimType : public Type {
PrimType(const char *S, TypeID ID) : Type(S, ID) {}
};
}
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 8a4cf2c0d5..d07345e932 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -57,6 +57,7 @@
#include "llvm/Support/InstVisitor.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Visibility.h"
#include <algorithm>
#include <iostream>
#include <sstream>
@@ -65,7 +66,8 @@ using namespace llvm;
namespace { // Anonymous namespace for class
- struct Verifier : public FunctionPass, InstVisitor<Verifier> {
+ struct VISIBILITY_HIDDEN
+ Verifier : public FunctionPass, InstVisitor<Verifier> {
bool Broken; // Is this module found to be broken?
bool RealPass; // Are we not being run by a PassManager?
VerifierFailureAction action;