[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 17 17:26:20 PST 2004


Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.55 -> 1.56

---
Log message:

Bytecode format for LLVM 1.2 no longer explicitly encodes zeros in primitive
type planes.  This saves about 5k on 176.gcc, and is needed for a subsequent
patch of mine I'm working on.


---
Diffs of the changes:  (+6 -1)

Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.55 llvm/lib/Bytecode/Writer/Writer.cpp:1.56
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.55	Thu Jan 15 15:06:57 2004
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Sat Jan 17 17:25:34 2004
@@ -161,6 +161,11 @@
   }
 }
 
+static inline bool hasNullValue(unsigned TyID) {
+  return TyID != Type::LabelTyID && TyID != Type::TypeTyID &&
+         TyID != Type::VoidTyID;
+}
+
 void BytecodeWriter::outputConstants(bool isFunction) {
   ConstantTotalBytes -= Out.size();
   if (isFunction) FunctionConstantTotalBytes -= Out.size();
@@ -190,7 +195,7 @@
         if (isFunction)                  // Don't re-emit module constants
           ValNo += Table.getModuleLevel(pno);
         
-        if (pno >= Type::FirstDerivedTyID) {
+        if (hasNullValue(pno)) {
           // Skip zero initializer
           if (ValNo == 0)
             ValNo = 1;





More information about the llvm-commits mailing list