Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- SlotMapping.h - Slot number mapping for unnamed values --*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file contains the declaration of the SlotMapping struct. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_ASMPARSER_SLOTMAPPING_H |
| 14 | #define LLVM_ASMPARSER_SLOTMAPPING_H |
| 15 | |
| 16 | #include "llvm/ADT/StringMap.h" |
| 17 | #include "llvm/IR/TrackingMDRef.h" |
| 18 | #include <map> |
| 19 | #include <vector> |
| 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | class GlobalValue; |
| 24 | class Type; |
| 25 | |
| 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 | |
| 39 | } // end namespace llvm |
| 40 | |
| 41 | #endif |