[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Nov 15 14:40:01 PST 2004
Changes in directory llvm/lib/Bytecode/Writer:
Writer.cpp updated: 1.89 -> 1.90
---
Log message:
Do not emit FunctionBlock blocks for external functions. This shrinks
bytecode files by about 8 bytes per external function
---
Diffs of the changes: (+5 -3)
Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.89 llvm/lib/Bytecode/Writer/Writer.cpp:1.90
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.89 Mon Nov 15 15:56:33 2004
+++ llvm/lib/Bytecode/Writer/Writer.cpp Mon Nov 15 16:39:49 2004
@@ -919,6 +919,8 @@
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::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);
More information about the llvm-commits
mailing list