diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2020-07-27 08:16:28 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2020-07-27 08:16:45 +0000 |
commit | d9bbe85943f6322e8fa1e85f72e53dd579c14a2f (patch) | |
tree | a89507f550059dc05f741ac002036e55a136249d /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | e1eacf27c6f4ba82b8da34e62f62b44b81ffa316 (diff) | |
download | llvm-d9bbe85943f6322e8fa1e85f72e53dd579c14a2f.zip llvm-d9bbe85943f6322e8fa1e85f72e53dd579c14a2f.tar.gz llvm-d9bbe85943f6322e8fa1e85f72e53dd579c14a2f.tar.bz2 |
[Alignment][NFC] Update Bitcodewriter to use Align
Differential Revision: https://reviews.llvm.org/D83533
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 9632b57..908e70b2 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -20,8 +20,9 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" -#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Bitcode/LLVMBitCodes.h" +#include "llvm/Bitstream/BitcodeCommon.h" +#include "llvm/Bitstream/BitstreamReader.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/Argument.h" #include "llvm/IR/Attributes.h" @@ -4813,17 +4814,13 @@ Error BitcodeReader::parseFunctionBody(Function *F) { case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, opty, op, align] if (Record.size() != 4) return error("Invalid record"); - uint64_t AlignRecord = Record[3]; - const uint64_t InAllocaMask = uint64_t(1) << 5; - const uint64_t ExplicitTypeMask = uint64_t(1) << 6; - const uint64_t SwiftErrorMask = uint64_t(1) << 7; - const uint64_t FlagMask = InAllocaMask | ExplicitTypeMask | - SwiftErrorMask; - bool InAlloca = AlignRecord & InAllocaMask; - bool SwiftError = AlignRecord & SwiftErrorMask; + using APV = AllocaPackedValues; + const uint64_t Rec = Record[3]; + const bool InAlloca = Bitfield::get<APV::UsedWithInAlloca>(Rec); + const bool SwiftError = Bitfield::get<APV::SwiftError>(Rec); FullTy = getFullyStructuredTypeByID(Record[0]); Type *Ty = flattenPointerTypes(FullTy); - if ((AlignRecord & ExplicitTypeMask) == 0) { + if (!Bitfield::get<APV::ExplicitType>(Rec)) { auto *PTy = dyn_cast_or_null<PointerType>(Ty); if (!PTy) return error("Old-style alloca with a non-pointer type"); @@ -4832,7 +4829,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) { Type *OpTy = getTypeByID(Record[1]); Value *Size = getFnValueByID(Record[2], OpTy); MaybeAlign Align; - if (Error Err = parseAlignmentValue(AlignRecord & ~FlagMask, Align)) { + if (Error Err = + parseAlignmentValue(Bitfield::get<APV::Align>(Rec), Align)) { return Err; } if (!Ty || !Size) |