llvm.org GIT mirror llvm / 7a263ea
add an abbreviation for the type symtab, this shrinks the TST from 175197 bits to 103165 bits: Old: Block ID #13 (TYPE_SYMTAB): Num Instances: 1 Total Size: 175197b/21899.6B/5474.91W Average Size: 175197b/21899.6B/5474.91W % of file: 0.657023 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 0/0 Tot/Avg Records: 255/255 % Abbrev Recs: 0 New: Block ID #13 (TYPE_SYMTAB): Num Instances: 1 Total Size: 103165b/12895.6B/3223.91W Average Size: 103165b/12895.6B/3223.91W % of file: 0.387937 Tot/Avg SubBlocks: 0/0 Tot/Avg Abbrevs: 1/1 Tot/Avg Records: 255/255 % Abbrev Recs: 100 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36769 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 12 years ago
1 changed file(s) with 16 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
797797
798798 Stream.EnterSubblock(bitc::TYPE_SYMTAB_BLOCK_ID, 3);
799799
800 // FIXME: Set up the abbrev, we know how many types there are!
801 // FIXME: We know if the type names can use 7-bit ascii.
800 // 7-bit fixed width VST_CODE_ENTRY strings.
801 BitCodeAbbrev *Abbv = new BitCodeAbbrev();
802 Abbv->Add(BitCodeAbbrevOp(bitc::VST_CODE_ENTRY));
803 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
804 Log2_32_Ceil(VE.getTypes().size()+1)));
805 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
806 Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
807 unsigned V7Abbrev = Stream.EmitAbbrev(Abbv);
802808
803809 SmallVector NameVals;
804810
805811 for (TypeSymbolTable::const_iterator TI = TST.begin(), TE = TST.end();
806812 TI != TE; ++TI) {
807 unsigned AbbrevToUse = 0;
808
809 // TST_ENTRY: [typeid, namelen, namechar x N]
813 // TST_ENTRY: [typeid, namechar x N]
810814 NameVals.push_back(VE.getTypeID(TI->second));
811815
812816 const std::string &Str = TI->first;
813 for (unsigned i = 0, e = Str.size(); i != e; ++i)
814 NameVals.push_back(Str[i]);
817 bool is7Bit = true;
818 for (unsigned i = 0, e = Str.size(); i != e; ++i) {
819 NameVals.push_back((unsigned char)Str[i]);
820 if (Str[i] & 128)
821 is7Bit = false;
822 }
815823
816824 // Emit the finished record.
817 Stream.EmitRecord(bitc::VST_CODE_ENTRY, NameVals, AbbrevToUse);
825 Stream.EmitRecord(bitc::VST_CODE_ENTRY, NameVals, is7Bit ? V7Abbrev : 0);
818826 NameVals.clear();
819827 }
820828