diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-04-27 19:58:56 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-04-27 19:58:56 +0000 |
commit | 1a848da518991408d9a3b10fd03dcd63e8185918 (patch) | |
tree | 1a8388d007fd816d45e554835e319a8bf4c4b449 /llvm/lib/Bitcode/Reader | |
parent | fe723b9a6d8100fddc31a07c11cc756ebb2bb3cb (diff) | |
download | bcm5719-llvm-1a848da518991408d9a3b10fd03dcd63e8185918.tar.gz bcm5719-llvm-1a848da518991408d9a3b10fd03dcd63e8185918.zip |
[opaque pointer type] encode the pointee type of global variables
Use a few extra bits in the const field (after widening it from a fixed
single bit) to stash the address space which is no longer provided by
the type (and an extra bit in there to specify that we're using that new
encoding).
llvm-svn: 235911
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index b6528cbbecc..1e9a8eb7fd1 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2876,12 +2876,18 @@ std::error_code BitcodeReader::ParseModule(bool Resume, Type *Ty = getTypeByID(Record[0]); if (!Ty) return Error("Invalid record"); - if (!Ty->isPointerTy()) - return Error("Invalid type for value"); - unsigned AddressSpace = cast<PointerType>(Ty)->getAddressSpace(); - Ty = cast<PointerType>(Ty)->getElementType(); + bool isConstant = Record[1] & 1; + bool explicitType = Record[1] & 2; + unsigned AddressSpace; + if (explicitType) { + AddressSpace = Record[1] >> 2; + } else { + if (!Ty->isPointerTy()) + return Error("Invalid type for value"); + AddressSpace = cast<PointerType>(Ty)->getAddressSpace(); + Ty = cast<PointerType>(Ty)->getElementType(); + } - bool isConstant = Record[1]; uint64_t RawLinkage = Record[3]; GlobalValue::LinkageTypes Linkage = getDecodedLinkage(RawLinkage); unsigned Alignment; |