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