1 //===- BitcodeCommon.h - Common code for encode/decode   --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This header defines common code to be used by BitcodeWriter and
10 // BitcodeReader.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_BITCODE_BITCODECOMMON_H
15 #define LLVM_BITCODE_BITCODECOMMON_H
16 
17 #include "llvm/ADT/Bitfields.h"
18 
19 namespace llvm {
20 
21 struct AllocaPackedValues {
22   // We increased the number of bits needed to represent alignment to be more
23   // than 5, but to preserve backward compatibility we store the upper bits
24   // separately.
25   using AlignLower = Bitfield::Element<unsigned, 0, 5>;
26   using UsedWithInAlloca = Bitfield::Element<bool, AlignLower::NextBit, 1>;
27   using ExplicitType = Bitfield::Element<bool, UsedWithInAlloca::NextBit, 1>;
28   using SwiftError = Bitfield::Element<bool, ExplicitType::NextBit, 1>;
29   using AlignUpper = Bitfield::Element<unsigned, SwiftError::NextBit, 3>;
30 };
31 
32 } // namespace llvm
33 
34 #endif // LLVM_BITCODE_BITCODECOMMON_H
35