mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 23:17:16 +00:00
AsmParser: Extend the API to make the global value and metadata node slot mappings publicly accessible.
This commit creates a new structure called 'SlotMapping' in the AsmParser library. This structure can be passed into the public parsing APIs from the AsmParser library in order to extract the data structures that map from slot numbers to unnamed global values and metadata nodes. This change is useful for MIR Serialization, as the MIR Parser has to lookup the unnamed global values and metadata nodes by their slot numbers. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D10551 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240427 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "LLParser.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/AsmParser/SlotMapping.h"
|
||||
#include "llvm/IR/AutoUpgrade.h"
|
||||
#include "llvm/IR/CallingConv.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
@@ -161,6 +162,14 @@ bool LLParser::ValidateEndOfModule() {
|
||||
|
||||
UpgradeDebugInfo(*M);
|
||||
|
||||
if (!Slots)
|
||||
return false;
|
||||
// Initialize the slot mapping.
|
||||
// Because by this point we've parsed and validated everything, we can "steal"
|
||||
// the mapping from LLParser as it doesn't need it anymore.
|
||||
Slots->GlobalValues = std::move(NumberedVals);
|
||||
Slots->MetadataNodes = std::move(NumberedMetadata);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user