[llvm-commits] CVS: llvm/include/llvm/Function.h GlobalValue.h

Chris Lattner sabre at nondot.org
Mon Apr 16 21:32:01 PDT 2007



Changes in directory llvm/include/llvm:

Function.h updated: 1.77 -> 1.78
GlobalValue.h updated: 1.35 -> 1.36
---
Log message:

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.


---
Diffs of the changes:  (+13 -10)

 Function.h    |    9 ++++++---
 GlobalValue.h |   14 +++++++-------
 2 files changed, 13 insertions(+), 10 deletions(-)


Index: llvm/include/llvm/Function.h
diff -u llvm/include/llvm/Function.h:1.77 llvm/include/llvm/Function.h:1.78
--- llvm/include/llvm/Function.h:1.77	Mon Apr 16 23:04:14 2007
+++ llvm/include/llvm/Function.h	Mon Apr 16 23:31:29 2007
@@ -69,7 +69,10 @@
   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 @@
   /// 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. 


Index: llvm/include/llvm/GlobalValue.h
diff -u llvm/include/llvm/GlobalValue.h:1.35 llvm/include/llvm/GlobalValue.h:1.36
--- llvm/include/llvm/GlobalValue.h:1.35	Fri Apr 13 13:12:09 2007
+++ llvm/include/llvm/GlobalValue.h	Mon Apr 16 23:31:29 2007
@@ -29,7 +29,7 @@
 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 @@
 
   /// @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 @@
   }
 
   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.






More information about the llvm-commits mailing list