mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-30 09:11:26 +00:00
implement the 'string constant' optimization. This shrinks kc.bit from
2878544 to 2815788 llvm-svn: 36818
This commit is contained in:
1 parent
e9759c29d1
commit
036d1bddf2
4 files changed
+34
-12
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user