diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-06 00:53:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-06 00:53:07 +0000 |
commit | f25f710c4d7fb7a0df8a3c2c3be0ab4d3111e7fc (patch) | |
tree | 5a1adcea254d63f2b98fd339eef0ca52e6cb5fa8 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 4b6ce8fa59ecef965fd6569182d13e4d2752025a (diff) | |
download | bcm5719-llvm-f25f710c4d7fb7a0df8a3c2c3be0ab4d3111e7fc.tar.gz bcm5719-llvm-f25f710c4d7fb7a0df8a3c2c3be0ab4d3111e7fc.zip |
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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index b1a001e1af4..c4e221fd369 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -651,9 +651,23 @@ 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; } |