summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.h
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-08-21 21:32:39 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-08-21 21:32:39 +0000
commit1de2acd3c2d94f424d2e8a1b366159c2578754e1 (patch)
treea15f088b2266db894cdba1fb85b3e62d3dceb24c /llvm/lib/AsmParser/LLParser.h
parent7a1483e7d1dceb9b9b59bc8d26a1418800d08e73 (diff)
downloadbcm5719-llvm-1de2acd3c2d94f424d2e8a1b366159c2578754e1.tar.gz
bcm5719-llvm-1de2acd3c2d94f424d2e8a1b366159c2578754e1.zip
AsmParser: Save and restore the parsing state for types using SlotMapping.
This commit extends the 'SlotMapping' structure and includes mappings for named and numbered types in it. The LLParser is extended accordingly to fill out those mappings at the end of module parsing. This information is useful when we want to parse standalone constant values at a later stage using the 'parseConstantValue' method. The constant values can be constant expressions, which can contain references to types. In order to parse such constant values, we have to restore the internal named and numbered mappings for the types in LLParser, otherwise the parser will report a parsing error. Therefore, this commit also introduces a new method called 'restoreParsingState' to LLParser, which uses the slot mappings to restore some of its internal parsing state. This commit is required to serialize constant value pointers in the machine memory operands for the MIR format. Reviewers: Duncan P. N. Exon Smith llvm-svn: 245740
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.h')
-rw-r--r--llvm/lib/AsmParser/LLParser.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/LLParser.h b/llvm/lib/AsmParser/LLParser.h
index dbbb97ab62a..96fb06a1f29 100644
--- a/llvm/lib/AsmParser/LLParser.h
+++ b/llvm/lib/AsmParser/LLParser.h
@@ -146,7 +146,7 @@ namespace llvm {
Slots(Slots), BlockAddressPFS(nullptr) {}
bool Run();
- bool parseStandaloneConstantValue(Constant *&C);
+ bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots);
LLVMContext &getContext() { return Context; }
@@ -159,6 +159,10 @@ namespace llvm {
return Error(Lex.getLoc(), Msg);
}
+ /// Restore the internal name and slot mappings using the mappings that
+ /// were created at an earlier parsing stage.
+ void restoreParsingState(const SlotMapping *Slots);
+
/// GetGlobalVal - Get a value with the specified name or ID, creating a
/// forward reference record if needed. This can return null if the value
/// exists but does not have the right type.
OpenPOWER on IntegriCloud