add a denser encoding for null terminated strings, add a 6-bit abbrev as

well.  This shrinks kc++ from 2724088 to 2717360 bytes.

llvm-svn: 36821
This commit is contained in:
Chris Lattner
2007-05-06 00:53:07 +00:00
parent 4b6ce8fa59
commit f25f710c4d
4 changed files with 62 additions and 17 deletions

View File

@@ -651,12 +651,26 @@ bool BitcodeReader::ParseConstants() {
unsigned Size = Record.size();
std::vector<Constant*> Elts;
for (unsigned i = 0; i != Size; ++i)
Elts.push_back(ConstantInt::get(EltTy, Record[i]));
V = ConstantArray::get(ATy, Elts);
break;
}
case bitc::CST_CODE_CSTRING: { // CSTRING: [values]
if (Record.empty())
return Error("Invalid CST_AGGREGATE record");
const ArrayType *ATy = cast<ArrayType>(CurTy);
const Type *EltTy = ATy->getElementType();
unsigned Size = Record.size();
std::vector<Constant*> Elts;
for (unsigned i = 0; i != Size; ++i)
Elts.push_back(ConstantInt::get(EltTy, Record[i]));
Elts.push_back(Constant::getNullValue(EltTy));
V = ConstantArray::get(ATy, Elts);
break;
}
case bitc::CST_CODE_CE_BINOP: { // CE_BINOP: [opcode, opval, opval]
if (Record.size() < 3) return Error("Invalid CE_BINOP record");
int Opc = GetDecodedBinaryOpcode(Record[0], CurTy);