diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-06 00:35:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-06 00:35:24 +0000 |
commit | ff7fc5dabef6931e7d23ee0613aa60e1d09dfbb0 (patch) | |
tree | 165c552417676e3b6ad51b6eecb27e089668cfac /lib/Bitcode/Reader | |
parent | abfbf85004b2114ee33e05fc9efe3a7bd044e402 (diff) |
implement the 'string constant' optimization. This shrinks kc.bit from
2878544 to 2815788
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36818 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 5a7c84da93..b1a001e1af 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -642,7 +642,21 @@ bool BitcodeReader::ParseConstants() { } break; } + case bitc::CST_CODE_STRING: { // STRING: [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])); + 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); |