BitCodeEnums.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- BitCodeEnums.h - Core enums for the bitstream format -----*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This header defines "core" bitstream enum values.
  15. // It has been separated from the other header that defines bitstream enum
  16. // values, BitCodes.h, to allow tools to track changes to the various
  17. // bitstream and bitcode enums without needing to fully or partially build
  18. // LLVM itself.
  19. //
  20. // The enum values defined in this file should be considered permanent. If
  21. // new features are added, they should have values added at the end of the
  22. // respective lists.
  23. //
  24. //===----------------------------------------------------------------------===//
  25. #ifndef LLVM_BITSTREAM_BITCODEENUMS_H
  26. #define LLVM_BITSTREAM_BITCODEENUMS_H
  27. namespace llvm {
  28. /// Offsets of the 32-bit fields of bitstream wrapper header.
  29. enum BitstreamWrapperHeader : unsigned {
  30. BWH_MagicField = 0 * 4,
  31. BWH_VersionField = 1 * 4,
  32. BWH_OffsetField = 2 * 4,
  33. BWH_SizeField = 3 * 4,
  34. BWH_CPUTypeField = 4 * 4,
  35. BWH_HeaderSize = 5 * 4
  36. };
  37. namespace bitc {
  38. enum StandardWidths {
  39. BlockIDWidth = 8, // We use VBR-8 for block IDs.
  40. CodeLenWidth = 4, // Codelen are VBR-4.
  41. BlockSizeWidth = 32 // BlockSize up to 2^32 32-bit words = 16GB per block.
  42. };
  43. // The standard abbrev namespace always has a way to exit a block, enter a
  44. // nested block, define abbrevs, and define an unabbreviated record.
  45. enum FixedAbbrevIDs {
  46. END_BLOCK = 0, // Must be zero to guarantee termination for broken bitcode.
  47. ENTER_SUBBLOCK = 1,
  48. /// DEFINE_ABBREV - Defines an abbrev for the current block. It consists
  49. /// of a vbr5 for # operand infos. Each operand info is emitted with a
  50. /// single bit to indicate if it is a literal encoding. If so, the value is
  51. /// emitted with a vbr8. If not, the encoding is emitted as 3 bits followed
  52. /// by the info value as a vbr5 if needed.
  53. DEFINE_ABBREV = 2,
  54. // UNABBREV_RECORDs are emitted with a vbr6 for the record code, followed by
  55. // a vbr6 for the # operands, followed by vbr6's for each operand.
  56. UNABBREV_RECORD = 3,
  57. // This is not a code, this is a marker for the first abbrev assignment.
  58. FIRST_APPLICATION_ABBREV = 4
  59. };
  60. /// StandardBlockIDs - All bitcode files can optionally include a BLOCKINFO
  61. /// block, which contains metadata about other blocks in the file.
  62. enum StandardBlockIDs {
  63. /// BLOCKINFO_BLOCK is used to define metadata about blocks, for example,
  64. /// standard abbrevs that should be available to all blocks of a specified
  65. /// ID.
  66. BLOCKINFO_BLOCK_ID = 0,
  67. // Block IDs 1-7 are reserved for future expansion.
  68. FIRST_APPLICATION_BLOCKID = 8
  69. };
  70. /// BlockInfoCodes - The blockinfo block contains metadata about user-defined
  71. /// blocks.
  72. enum BlockInfoCodes {
  73. // DEFINE_ABBREV has magic semantics here, applying to the current SETBID'd
  74. // block, instead of the BlockInfo block.
  75. BLOCKINFO_CODE_SETBID = 1, // SETBID: [blockid#]
  76. BLOCKINFO_CODE_BLOCKNAME = 2, // BLOCKNAME: [name]
  77. BLOCKINFO_CODE_SETRECORDNAME = 3 // BLOCKINFO_CODE_SETRECORDNAME:
  78. // [id, name]
  79. };
  80. } // namespace bitc
  81. } // namespace llvm
  82. #endif
  83. #ifdef __GNUC__
  84. #pragma GCC diagnostic pop
  85. #endif