SlotMapping.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- SlotMapping.h - Slot number mapping for unnamed values --*- 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 file contains the declaration of the SlotMapping struct.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_ASMPARSER_SLOTMAPPING_H
  18. #define LLVM_ASMPARSER_SLOTMAPPING_H
  19. #include "llvm/ADT/StringMap.h"
  20. #include "llvm/IR/TrackingMDRef.h"
  21. #include <map>
  22. #include <vector>
  23. namespace llvm {
  24. class GlobalValue;
  25. class Type;
  26. /// This struct contains the mappings from the slot numbers to unnamed metadata
  27. /// nodes, global values and types. It also contains the mapping for the named
  28. /// types.
  29. /// It can be used to save the parsing state of an LLVM IR module so that the
  30. /// textual references to the values in the module can be parsed outside of the
  31. /// module's source.
  32. struct SlotMapping {
  33. std::vector<GlobalValue *> GlobalValues;
  34. std::map<unsigned, TrackingMDNodeRef> MetadataNodes;
  35. StringMap<Type *> NamedTypes;
  36. std::map<unsigned, Type *> Types;
  37. };
  38. } // end namespace llvm
  39. #endif
  40. #ifdef __GNUC__
  41. #pragma GCC diagnostic pop
  42. #endif