diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-20 00:54:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-20 00:54:06 +0000 |
commit | a395324383d9529a9a0ac68b3d2e736ed41a1859 (patch) | |
tree | ffeeb66eab57bcbc63abf13abb51e8773c78f029 /llvm/lib/Bytecode/Writer/Writer.cpp | |
parent | d3de5c6182c479504b3142d263d2428b4b5f18e0 (diff) | |
download | bcm5719-llvm-a395324383d9529a9a0ac68b3d2e736ed41a1859.tar.gz bcm5719-llvm-a395324383d9529a9a0ac68b3d2e736ed41a1859.zip |
Bugfixes for dealing with partially compactified functions
llvm-svn: 10920
Diffstat (limited to 'llvm/lib/Bytecode/Writer/Writer.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Writer/Writer.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp index a55508e6e0a..7cdae163957 100644 --- a/llvm/lib/Bytecode/Writer/Writer.cpp +++ b/llvm/lib/Bytecode/Writer/Writer.cpp @@ -43,7 +43,7 @@ ConstantTotalBytes("bytecodewriter", "Bytes of constants total"); static Statistic<> ConstantPlaneHeaderBytes("bytecodewriter", "Constant plane header bytes"); static Statistic<> -InstructionBytes("bytecodewriter", "Bytes of bytes of instructions"); +InstructionBytes("bytecodewriter", "Bytes of instructions"); static Statistic<> SymTabBytes("bytecodewriter", "Bytes of symbol table"); static Statistic<> @@ -160,7 +160,7 @@ static inline bool hasNullValue(unsigned TyID) { } void BytecodeWriter::outputConstants(bool isFunction) { - ConstantTotalBytes -= Out.size(); + ConstantTotalBytes -= Out.size(); { BytecodeBlock CPool(BytecodeFormat::ConstantPool, Out, true /* Elide block if empty */); @@ -197,7 +197,7 @@ void BytecodeWriter::outputConstants(bool isFunction) { outputConstantsInPlane(Plane, ValNo); } } - ConstantTotalBytes += Out.size(); + }ConstantTotalBytes += Out.size(); } static unsigned getEncodedLinkage(const GlobalValue *GV) { @@ -289,7 +289,7 @@ void BytecodeWriter::outputCompactionTablePlane(unsigned PlaneNo, const std::vector<const Value*> &Plane, unsigned StartNo) { unsigned End = Table.getModuleLevel(PlaneNo); - if (StartNo == End || End == 0) return; // Nothing to emit + if (Plane.empty() || StartNo == End || End == 0) return; // Nothing to emit assert(StartNo < End && "Cannot emit negative range!"); assert(StartNo < Plane.size() && End <= Plane.size()); @@ -316,7 +316,7 @@ void BytecodeWriter::outputCompactionTablePlane(unsigned PlaneNo, } void BytecodeWriter::outputCompactionTable() { - CompactionTableBytes -= Out.size(); + CompactionTableBytes -= Out.size(); { BytecodeBlock CTB(BytecodeFormat::CompactionTable, Out, true/*ElideIfEmpty*/); const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable(); @@ -328,7 +328,7 @@ void BytecodeWriter::outputCompactionTable() { for (unsigned i = 0, e = CT.size(); i != e; ++i) if (i != Type::TypeTyID) outputCompactionTablePlane(i, CT[i], 0); - CompactionTableBytes += Out.size(); + } CompactionTableBytes += Out.size(); } void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { @@ -336,7 +336,7 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { // space! if (MST.begin() == MST.end()) return; - SymTabBytes -= Out.size(); + SymTabBytes -= Out.size(); { BytecodeBlock SymTabBlock(BytecodeFormat::SymbolTable, Out, true/* ElideIfEmpty*/); @@ -357,6 +357,8 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { for (; I != End; ++I) { // Symtab entry: [def slot #][name] + const Value *V = I->second; + Slot = Table.getSlot(I->second); assert(Slot != -1 && "Value in symtab but has no slot number!!"); output_vbr((unsigned)Slot, Out); @@ -364,7 +366,7 @@ void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { } } - SymTabBytes += Out.size(); + }SymTabBytes += Out.size(); } void llvm::WriteBytecodeToFile(const Module *C, std::ostream &Out) { |