diff options
author | Chris Lattner <sabre@nondot.org> | 2010-08-28 04:09:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-08-28 04:09:24 +0000 |
commit | 61c70e98ac3c7504d31dd9bc81c4e9cb998e9984 (patch) | |
tree | 05263a360b43d09ed99dacdf6d402ce50deb32d7 /lib/Bitcode | |
parent | 5f88af537637831451ff9ffa08c597e05e7dc9fb (diff) | |
download | external_llvm-61c70e98ac3c7504d31dd9bc81c4e9cb998e9984.zip external_llvm-61c70e98ac3c7504d31dd9bc81c4e9cb998e9984.tar.gz external_llvm-61c70e98ac3c7504d31dd9bc81c4e9cb998e9984.tar.bz2 |
remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112356 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 14 | ||||
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 33 |
2 files changed, 0 insertions, 47 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index fd7fe90..cb7f2f4 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -297,8 +297,6 @@ void BitcodeReaderValueList::ResolveConstantForwardRefs() { } else if (ConstantStruct *UserCS = dyn_cast<ConstantStruct>(UserC)) { NewC = ConstantStruct::get(Context, &NewOps[0], NewOps.size(), UserCS->getType()->isPacked()); - } else if (ConstantUnion *UserCU = dyn_cast<ConstantUnion>(UserC)) { - NewC = ConstantUnion::get(UserCU->getType(), NewOps[0]); } else if (isa<ConstantVector>(UserC)) { NewC = ConstantVector::get(&NewOps[0], NewOps.size()); } else { @@ -591,13 +589,6 @@ bool BitcodeReader::ParseTypeTable() { ResultTy = StructType::get(Context, EltTys, Record[0]); break; } - case bitc::TYPE_CODE_UNION: { // UNION: [eltty x N] - SmallVector<const Type*, 8> EltTys; - for (unsigned i = 0, e = Record.size(); i != e; ++i) - EltTys.push_back(getTypeByID(Record[i], true)); - ResultTy = UnionType::get(&EltTys[0], EltTys.size()); - break; - } case bitc::TYPE_CODE_ARRAY: // ARRAY: [numelts, eltty] if (Record.size() < 2) return Error("Invalid ARRAY type record"); @@ -1014,11 +1005,6 @@ bool BitcodeReader::ParseConstants() { Elts.push_back(ValueList.getConstantFwdRef(Record[i], STy->getElementType(i))); V = ConstantStruct::get(STy, Elts); - } else if (const UnionType *UnTy = dyn_cast<UnionType>(CurTy)) { - uint64_t Index = Record[0]; - Constant *Val = ValueList.getConstantFwdRef(Record[1], - UnTy->getElementType(Index)); - V = ConstantUnion::get(UnTy, Val); } else if (const ArrayType *ATy = dyn_cast<ArrayType>(CurTy)) { const Type *EltTy = ATy->getElementType(); for (unsigned i = 0; i != Size; ++i) diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 390e482..07727f3 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -181,14 +181,6 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) { Log2_32_Ceil(VE.getTypes().size()+1))); unsigned StructAbbrev = Stream.EmitAbbrev(Abbv); - // Abbrev for TYPE_CODE_UNION. - Abbv = new BitCodeAbbrev(); - Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_UNION)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array)); - Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, - Log2_32_Ceil(VE.getTypes().size()+1))); - unsigned UnionAbbrev = Stream.EmitAbbrev(Abbv); - // Abbrev for TYPE_CODE_ARRAY. Abbv = new BitCodeAbbrev(); Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_ARRAY)); @@ -258,17 +250,6 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) { AbbrevToUse = StructAbbrev; break; } - case Type::UnionTyID: { - const UnionType *UT = cast<UnionType>(T); - // UNION: [eltty x N] - Code = bitc::TYPE_CODE_UNION; - // Output all of the element types. - for (UnionType::element_iterator I = UT->element_begin(), - E = UT->element_end(); I != E; ++I) - TypeVals.push_back(VE.getTypeID(*I)); - AbbrevToUse = UnionAbbrev; - break; - } case Type::ArrayTyID: { const ArrayType *AT = cast<ArrayType>(T); // ARRAY: [numelts, eltty] @@ -811,20 +792,6 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) Record.push_back(VE.getValueID(C->getOperand(i))); AbbrevToUse = AggregateAbbrev; - } else if (isa<ConstantUnion>(C)) { - Code = bitc::CST_CODE_AGGREGATE; - - // Unions only have one entry but we must send type along with it. - const Type *EntryKind = C->getOperand(0)->getType(); - - const UnionType *UnTy = cast<UnionType>(C->getType()); - int UnionIndex = UnTy->getElementTypeIndex(EntryKind); - assert(UnionIndex != -1 && "Constant union contains invalid entry"); - - Record.push_back(UnionIndex); - Record.push_back(VE.getValueID(C->getOperand(0))); - - AbbrevToUse = AggregateAbbrev; } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { switch (CE->getOpcode()) { default: |