aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-17 04:31:29 +0000
committerChris Lattner <sabre@nondot.org>2007-04-17 04:31:29 +0000
commit18feb92e917a029b72a338e91b5b93f74d26f406 (patch)
tree12bcbaace06f3f31a5c5937c57907b39b18f474d
parent15b782300691dab380cd11761c09f48606c0d2b7 (diff)
downloadexternal_llvm-18feb92e917a029b72a338e91b5b93f74d26f406.zip
external_llvm-18feb92e917a029b72a338e91b5b93f74d26f406.tar.gz
external_llvm-18feb92e917a029b72a338e91b5b93f74d26f406.tar.bz2
merge several fields in GlobalValue to use the same word, move CallingConv
field into SubclassData in Value. This shrinks GlobalVAlue from 48->40 bytes, Function from 88->76, and GlobalVariable from 76->68. This trims 4640 bytes off my testcase, reading a bc file without materializing any functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36192 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Function.h9
-rw-r--r--include/llvm/GlobalValue.h14
-rw-r--r--lib/VMCore/Function.cpp1
3 files changed, 13 insertions, 11 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 3fdbd02..594b6ef 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -69,7 +69,10 @@ private:
ArgumentListType ArgumentList; ///< The formal arguments
ValueSymbolTable *SymTab; ///< Symbol table of args/instructions
ParamAttrsList *ParamAttrs; ///< Parameter attributes
- unsigned CallingConvention; ///< Calling convention to use
+
+
+ // The Calling Convention is stored in Value::SubclassData.
+ /*unsigned CallingConvention;*/
friend class SymbolTableListTraits<Function, Module>;
@@ -113,8 +116,8 @@ public:
/// getCallingConv()/setCallingConv(uint) - These method get and set the
/// calling convention of this function. The enum values for the known
/// calling conventions are defined in CallingConv.h.
- unsigned getCallingConv() const { return CallingConvention; }
- void setCallingConv(unsigned CC) { CallingConvention = CC; }
+ unsigned getCallingConv() const { return SubclassData; }
+ void setCallingConv(unsigned CC) { SubclassData = CC; }
/// Obtains a constant pointer to the ParamAttrsList object which holds the
/// parameter attributes information, if any.
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h
index 72a45f4..9dab3f8 100644
--- a/include/llvm/GlobalValue.h
+++ b/include/llvm/GlobalValue.h
@@ -29,7 +29,7 @@ class GlobalValue : public Constant {
public:
/// @brief An enumeration for the kinds of linkage for global values.
enum LinkageTypes {
- ExternalLinkage, ///< Externally visible function
+ ExternalLinkage = 0,///< Externally visible function
LinkOnceLinkage, ///< Keep one copy of function when linking (inline)
WeakLinkage, ///< Keep one copy of named function when linking (weak)
AppendingLinkage, ///< Special purpose, only applies to global arrays
@@ -42,8 +42,8 @@ public:
/// @brief An enumeration for the kinds of visibility of global values.
enum VisibilityTypes {
- DefaultVisibility, ///< The GV is visible
- HiddenVisibility ///< The GV is hidden
+ DefaultVisibility = 0, ///< The GV is visible
+ HiddenVisibility ///< The GV is hidden
};
protected:
@@ -55,10 +55,10 @@ protected:
}
Module *Parent;
- LinkageTypes Linkage; // The linkage of this global
- VisibilityTypes Visibility; // The visibility style of this global
- unsigned Alignment; // Alignment of this symbol, must be power of two
- std::string Section; // Section to emit this into, empty mean default
+ LinkageTypes Linkage : 4; // The linkage of this global
+ VisibilityTypes Visibility : 1; // The visibility style of this global
+ unsigned Alignment : 16; // Alignment of this symbol, must be power of two
+ std::string Section; // Section to emit this into, empty mean default
public:
~GlobalValue() {
removeDeadConstantUsers(); // remove any dead constants using this.
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index e47798e..dbd2148 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -142,7 +142,6 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
const std::string &name, Module *ParentModule)
: GlobalValue(PointerType::get(Ty), Value::FunctionVal, 0, 0, Linkage, name) {
ParamAttrs = 0;
- CallingConvention = 0;
SymTab = new ValueSymbolTable();
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy)