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 | 036d1bddf29c600eb54e5f127acd9312e3bf444d (patch) | |
tree | b9f7d45df167f9295e4c728d198cae509c291d46 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | e9759c29d1cd47de32b94a02ca065433398cabdb (diff) | |
download | bcm5719-llvm-036d1bddf29c600eb54e5f127acd9312e3bf444d.tar.gz bcm5719-llvm-036d1bddf29c600eb54e5f127acd9312e3bf444d.zip |
implement the 'string constant' optimization. This shrinks kc.bit from
2878544 to 2815788
llvm-svn: 36818
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 5a7c84da931..b1a001e1af4 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/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); |