mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-12 14:41:05 +00:00
encode and read param attrs along with function type. WE can now roundtrip Olden/voronoi loslessly
llvm-svn: 36735
This commit is contained in:
parent
da3b0264f7
commit
2f3c85827e
@ -313,16 +313,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, #pararms, paramty N]
|
// FUNCTION: [vararg, attrid, retty, #pararms, paramty N]
|
||||||
if (Record.size() < 3 || Record.size() < Record[2]+3)
|
if (Record.size() < 4 || Record.size() < Record[3]+4)
|
||||||
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 = 0, e = Record[2]; i != e; ++i)
|
for (unsigned i = 0, e = Record[3]; i != e; ++i)
|
||||||
ArgTys.push_back(getTypeByID(Record[3+i], true));
|
ArgTys.push_back(getTypeByID(Record[4+i], true));
|
||||||
|
|
||||||
// FIXME: PARAM TYS.
|
ResultTy = FunctionType::get(getTypeByID(Record[2], true), ArgTys,
|
||||||
ResultTy = FunctionType::get(getTypeByID(Record[1], true), ArgTys,
|
Record[0], getParamAttrs(Record[1]));
|
||||||
Record[0]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case bitc::TYPE_CODE_STRUCT: { // STRUCT: [ispacked, #elts, eltty x N]
|
case bitc::TYPE_CODE_STRUCT: { // STRUCT: [ispacked, #elts, eltty x N]
|
||||||
|
@ -145,11 +145,11 @@ 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, #pararms, paramty x N]
|
// FUNCTION: [isvararg, attrid, #pararms, 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(VE.getParamAttrID(FT->getParamAttrs()));
|
||||||
TypeVals.push_back(VE.getTypeID(FT->getReturnType()));
|
TypeVals.push_back(VE.getTypeID(FT->getReturnType()));
|
||||||
// FIXME: PARAM ATTR ID!
|
|
||||||
TypeVals.push_back(FT->getNumParams());
|
TypeVals.push_back(FT->getNumParams());
|
||||||
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…
x
Reference in New Issue
Block a user