SlotMapping.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===-- SlotMapping.h - Slot number mapping for unnamed values --*- 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 file contains the declaration of the SlotMapping struct.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_ASMPARSER_SLOTMAPPING_H
  13. #define LLVM_ASMPARSER_SLOTMAPPING_H
  14. #include "llvm/ADT/StringMap.h"
  15. #include "llvm/IR/TrackingMDRef.h"
  16. #include <map>
  17. #include <vector>
  18. namespace llvm {
  19. class GlobalValue;
  20. class Type;
  21. /// This struct contains the mappings from the slot numbers to unnamed metadata
  22. /// nodes, global values and types. It also contains the mapping for the named
  23. /// types.
  24. /// It can be used to save the parsing state of an LLVM IR module so that the
  25. /// textual references to the values in the module can be parsed outside of the
  26. /// module's source.
  27. struct SlotMapping {
  28. std::vector<GlobalValue *> GlobalValues;
  29. std::map<unsigned, TrackingMDNodeRef> MetadataNodes;
  30. StringMap<Type *> NamedTypes;
  31. std::map<unsigned, Type *> Types;
  32. };
  33. } // end namespace llvm
  34. #endif