summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2007-12-12 08:44:39 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2007-12-12 08:44:39 +0000
commit25f507661230652b5c277e6461a802fafe984b9a (patch)
tree7de916202c98aac1295a5814c1566fac29dd3ebf /llvm/lib/Bitcode
parent7354e6a50eba11f1c7ff78418fe7bfd55f77e8ec (diff)
downloadbcm5719-llvm-25f507661230652b5c277e6461a802fafe984b9a.tar.gz
bcm5719-llvm-25f507661230652b5c277e6461a802fafe984b9a.zip
Implement part of review feedback for address spaces.
llvm-svn: 44933
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 3abac064683..abe19336d6f 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -141,6 +141,7 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
Log2_32_Ceil(VE.getTypes().size()+1)));
+ Abbv->Add(BitCodeAbbrevOp(0)); // Addrspace = 0
unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);
// Abbrev for TYPE_CODE_FUNCTION.
@@ -198,16 +199,14 @@ static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
break;
case Type::PointerTyID: {
const PointerType *PTy = cast<PointerType>(T);
- // POINTER: [pointee type] or [pointee type, address space]
+ // POINTER: [pointee type, address space]
Code = bitc::TYPE_CODE_POINTER;
TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
- if (unsigned AddressSpace = PTy->getAddressSpace())
- TypeVals.push_back(AddressSpace);
- else
- AbbrevToUse = PtrAbbrev;
+ unsigned AddressSpace = PTy->getAddressSpace();
+ TypeVals.push_back(AddressSpace);
+ if (AddressSpace == 0) AbbrevToUse = PtrAbbrev;
break;
}
-
case Type::FunctionTyID: {
const FunctionType *FT = cast<FunctionType>(T);
// FUNCTION: [isvararg, attrid, retty, paramty x N]
OpenPOWER on IntegriCloud