summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-07-05 00:57:50 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-07-05 00:57:50 +0000
commit02b6708e014e8d9f5b703df1a22d05843e8b1c1a (patch)
tree3af8d0112e06b104b35eae6ec7c6a01106b43088 /llvm/lib/Bytecode/Reader/Reader.cpp
parent21b3a5b0de49bf9fdb8c3e8a74c21b59db875ee4 (diff)
downloadbcm5719-llvm-02b6708e014e8d9f5b703df1a22d05843e8b1c1a.tar.gz
bcm5719-llvm-02b6708e014e8d9f5b703df1a22d05843e8b1c1a.zip
Finalize bytecode dumping. The "handleFinish" method was getting called
too soon so the function data was not getting dumped (it was generated after the call handleFinish). Also cleaned up the output format for proper indentation. llvm-svn: 14627
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 8d0df020ec3..14f6c9f7e27 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -894,7 +894,6 @@ unsigned BytecodeReader::ParseInstructionList(Function* F) {
BB = ParsedBasicBlocks[BlockNo] = new BasicBlock();
else
BB = ParsedBasicBlocks[BlockNo];
- if (Handler) Handler->handleBasicBlockEnd( BlockNo );
++BlockNo;
F->getBasicBlockList().push_back(BB);
@@ -904,6 +903,8 @@ unsigned BytecodeReader::ParseInstructionList(Function* F) {
if (!BB->getTerminator())
throw std::string("Non-terminated basic block found!");
+
+ if (Handler) Handler->handleBasicBlockEnd( BlockNo-1 );
}
return BlockNo;
@@ -1898,7 +1899,8 @@ void BytecodeReader::ParseModule() {
/// and \p Length parameters.
void BytecodeReader::ParseBytecode(
BufPtr Buf, unsigned Length,
- const std::string &ModuleID) {
+ const std::string &ModuleID,
+ bool processFunctions) {
try {
At = MemStart = BlockStart = Buf;
@@ -1934,14 +1936,19 @@ void BytecodeReader::ParseBytecode(
// Parse the module contents
this->ParseModule();
- // Tell the handler we're done
- if (Handler) Handler->handleModuleEnd(ModuleID);
-
// Check for missing functions
if ( hasFunctions() )
throw std::string("Function expected, but bytecode stream ended!");
- // Tell the handler we're
+ // Process all the function bodies now, if requested
+ if ( processFunctions )
+ ParseAllFunctionBodies();
+
+ // Tell the handler we're done with the module
+ if (Handler)
+ Handler->handleModuleEnd(ModuleID);
+
+ // Tell the handler we're finished the parse
if (Handler) Handler->handleFinish();
} catch (std::string& errstr ) {
OpenPOWER on IntegriCloud