Do not emit FunctionBlock blocks for external functions. This shrinks
authorChris Lattner <sabre@nondot.org>
Mon, 15 Nov 2004 22:39:49 +0000 (22:39 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Nov 2004 22:39:49 +0000 (22:39 +0000)
bytecode files by about 8 bytes per external function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17859 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bytecode/Writer/Writer.cpp

index 7d578f966e10ebac896ba9d20d7d597057118694..ed43bc9e2e8884bf02b5d4ccbbc08c669d80c92e 100644 (file)
@@ -919,6 +919,8 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
     assert(Slot >= Type::FirstDerivedTyID && "Derived type not in range!");
     assert(((Slot << 5) >> 5) == Slot && "Slot # too big!");
     unsigned ID = (Slot << 5) + 1;
+    if (I->isExternal())   // If external, we don't have an FunctionInfo block.
+      ID |= 1 << 4;
     output_vbr(ID);
   }
   output_vbr((unsigned)Table.getSlot(Type::VoidTy) << 5);
@@ -942,12 +944,12 @@ void BytecodeWriter::outputInstructions(const Function *F) {
 }
 
 void BytecodeWriter::outputFunction(const Function *F) {
-  BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this);
-  output_vbr(getEncodedLinkage(F));
-
   // If this is an external function, there is nothing else to emit!
   if (F->isExternal()) return;
 
+  BytecodeBlock FunctionBlock(BytecodeFormat::FunctionBlockID, *this);
+  output_vbr(getEncodedLinkage(F));
+
   // Get slot information about the function...
   Table.incorporateFunction(F);