Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: include/llvm/Bitcode/NaCl/NaClBitcodeParser.h

Issue 1831493003: Add a bitcode parser constructor for parallel parsing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix nits found in review. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
index 5efd7df19d06b394313f0691523ddb20eb477c31..e48aebd5e0123de3b734643f948ae43a4b032a25 100644
--- a/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
+++ b/include/llvm/Bitcode/NaCl/NaClBitcodeParser.h
@@ -597,9 +597,10 @@ protected:
// The error stream to use if non-null (uses errs() if null).
raw_ostream *ErrStream;
- // Creates a block parser to parse the block associated with the
- // bitcode entry that defines the beginning of a block. This
- // instance actually parses the corresponding block.
+ // Creates a block parser to parse the block associated with the bitcode entry
+ // that defines the beginning of a block. This instance actually parses the
+ // corresponding block. Inherits the bitstream cursor from the
+ // EnclosingParser.
NaClBitcodeParser(unsigned BlockID, NaClBitcodeParser *EnclosingParser)
: EnclosingParser(EnclosingParser),
Block(BlockID, EnclosingParser->Record),
@@ -608,6 +609,19 @@ protected:
ErrStream(EnclosingParser->ErrStream)
{}
+ // Same as above, but use the supplied bitstream cursor (instead of
+ // inheriting from the enclosing parser). This constructor allows
+ // parallel parsing of subblocks, by allowing the caller to generate
+ // a different Cursor for each block to be parsed in parallel.
+ NaClBitcodeParser(unsigned BlockID, NaClBitcodeParser *EnclosingParser,
+ NaClBitstreamCursor &Cursor)
+ : EnclosingParser(EnclosingParser),
+ Block(BlockID, Cursor),
+ Record(Block),
+ Listener(EnclosingParser->Listener),
+ ErrStream(EnclosingParser->ErrStream)
+ {}
+
/// Defines the listener for this block, and all enclosing blocks,
/// to be the given listener. Should be set in the constructor.
void SetListener(NaClBitcodeParserListener* UseListener) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698