mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-04 21:30:49 +00:00
Unbreak backwards compatibility with bytecode format. Regression
introduced by this patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071126/055824.html git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44364 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dc024674ff
commit
a1afde77fa
@ -329,14 +329,15 @@ bool BitcodeReader::ParseTypeTable() {
|
|||||||
ResultTy = PointerType::get(getTypeByID(Record[0], true));
|
ResultTy = PointerType::get(getTypeByID(Record[0], true));
|
||||||
break;
|
break;
|
||||||
case bitc::TYPE_CODE_FUNCTION: {
|
case bitc::TYPE_CODE_FUNCTION: {
|
||||||
// FUNCTION: [vararg, retty, paramty x N]
|
// FIXME: attrid is dead, remove it in LLVM 3.0
|
||||||
if (Record.size() < 2)
|
// FUNCTION: [vararg, attrid, retty, paramty x N]
|
||||||
|
if (Record.size() < 3)
|
||||||
return Error("Invalid FUNCTION type record");
|
return Error("Invalid FUNCTION type record");
|
||||||
std::vector<const Type*> ArgTys;
|
std::vector<const Type*> ArgTys;
|
||||||
for (unsigned i = 2, e = Record.size(); i != e; ++i)
|
for (unsigned i = 3, e = Record.size(); i != e; ++i)
|
||||||
ArgTys.push_back(getTypeByID(Record[i], true));
|
ArgTys.push_back(getTypeByID(Record[i], true));
|
||||||
|
|
||||||
ResultTy = FunctionType::get(getTypeByID(Record[1], true), ArgTys,
|
ResultTy = FunctionType::get(getTypeByID(Record[2], true), ArgTys,
|
||||||
Record[0]);
|
Record[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,7 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
|
|||||||
Abbv = new BitCodeAbbrev();
|
Abbv = new BitCodeAbbrev();
|
||||||
Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_FUNCTION));
|
Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_FUNCTION));
|
||||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isvararg
|
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isvararg
|
||||||
|
Abbv->Add(BitCodeAbbrevOp(0)); // FIXME: DEAD value, remove in LLVM 3.0
|
||||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
|
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
|
||||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
|
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
|
||||||
Log2_32_Ceil(VE.getTypes().size()+1)));
|
Log2_32_Ceil(VE.getTypes().size()+1)));
|
||||||
@ -204,9 +205,10 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
|
|||||||
|
|
||||||
case Type::FunctionTyID: {
|
case Type::FunctionTyID: {
|
||||||
const FunctionType *FT = cast<FunctionType>(T);
|
const FunctionType *FT = cast<FunctionType>(T);
|
||||||
// FUNCTION: [isvararg, retty, paramty x N]
|
// FUNCTION: [isvararg, attrid, retty, paramty x N]
|
||||||
Code = bitc::TYPE_CODE_FUNCTION;
|
Code = bitc::TYPE_CODE_FUNCTION;
|
||||||
TypeVals.push_back(FT->isVarArg());
|
TypeVals.push_back(FT->isVarArg());
|
||||||
|
TypeVals.push_back(0); // FIXME: DEAD: remove in llvm 3.0
|
||||||
TypeVals.push_back(VE.getTypeID(FT->getReturnType()));
|
TypeVals.push_back(VE.getTypeID(FT->getReturnType()));
|
||||||
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i)
|
for (unsigned i = 0, e = FT->getNumParams(); i != e; ++i)
|
||||||
TypeVals.push_back(VE.getTypeID(FT->getParamType(i)));
|
TypeVals.push_back(VE.getTypeID(FT->getParamType(i)));
|
||||||
|
Loading…
Reference in New Issue
Block a user