Changes in directory llvm/lib/Bytecode/Reader:
Makefile updated: 1.6 -> 1.7 Reader.cpp updated: 1.195 -> 1.196 Reader.h updated: 1.31 -> 1.32 --- Log message: For PR797: http://llvm.org/PR797 : Final commit for this bug. This removes the last EH holdouts in LLVM and turns off exception support by using the -fno-exceptions option. This leads to the following reduction in library and executable sizes: DEBUG BUILD RELEASE BUILD before after delta before after delta lib 162,328K 157,616K 4,712 17,864K 16,416K 1,448K bin 571,444K 557,156K 14,288 63,296K 56,996K 6,300K Debug Improvement: 19,000K (2.59%) Release Improvement: 7,748K (9.55%) --- Diffs of the changes: (+20 -24) Makefile | 1 - Reader.cpp | 16 ++++++++++++---- Reader.h | 27 ++++++++------------------- 3 files changed, 20 insertions(+), 24 deletions(-) Index: llvm/lib/Bytecode/Reader/Makefile diff -u llvm/lib/Bytecode/Reader/Makefile:1.6 llvm/lib/Bytecode/Reader/Makefile:1.7 --- llvm/lib/Bytecode/Reader/Makefile:1.6 Fri Jul 7 11:44:31 2006 +++ llvm/lib/Bytecode/Reader/Makefile Fri Aug 25 14:54:53 2006 @@ -9,7 +9,6 @@ LEVEL = ../../.. LIBRARYNAME = LLVMBCReader BUILD_ARCHIVE = 1 -REQUIRES_EH := 1 include $(LEVEL)/Makefile.common Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.195 llvm/lib/Bytecode/Reader/Reader.cpp:1.196 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.195 Tue Aug 22 11:09:19 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Fri Aug 25 14:54:53 2006 @@ -1943,14 +1943,18 @@ /// ParseAllFunctionBodies. /// @see ParseAllFunctionBodies /// @see ParseBytecode -void BytecodeReader::ParseFunction(Function* Func) { +bool BytecodeReader::ParseFunction(Function* Func, std::string* ErrMsg) { + + if (setjmp(context)) + return true; + // Find {start, end} pointers and slot in the map. If not there, we're done. LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.find(Func); // Make sure we found it if (Fi == LazyFunctionLoadMap.end()) { error("Unrecognized function of type " + Func->getType()->getDescription()); - return; + return true; } BlockStart = At = Fi->second.Buf; @@ -1960,6 +1964,7 @@ LazyFunctionLoadMap.erase(Fi); this->ParseFunctionBody(Func); + return false; } /// The ParseAllFunctionBodies method parses through all the previously @@ -1969,7 +1974,10 @@ /// the function definitions are located. This function uses that information /// to materialize the functions. /// @see ParseBytecode -void BytecodeReader::ParseAllFunctionBodies() { +bool BytecodeReader::ParseAllFunctionBodies(std::string* ErrMsg) { + if (setjmp(context)) + return true; + LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.begin(); LazyFunctionMap::iterator Fe = LazyFunctionLoadMap.end(); @@ -1981,7 +1989,7 @@ ++Fi; } LazyFunctionLoadMap.clear(); - + return false; } /// Parse the global type list Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.31 llvm/lib/Bytecode/Reader/Reader.h:1.32 --- llvm/lib/Bytecode/Reader/Reader.h:1.31 Tue Aug 22 11:09:19 2006 +++ llvm/lib/Bytecode/Reader/Reader.h Fri Aug 25 14:54:53 2006 @@ -147,26 +147,21 @@ ); /// @brief Parse all function bodies - void ParseAllFunctionBodies(); + bool ParseAllFunctionBodies(std::string* ErrMsg); /// @brief Parse the next function of specific type - void ParseFunction(Function* Func) ; + bool ParseFunction(Function* Func, std::string* ErrMsg) ; /// This method is abstract in the parent ModuleProvider class. Its /// implementation is identical to the ParseFunction method. /// @see ParseFunction /// @brief Make a specific function materialize. - virtual bool materializeFunction(Function *F, std::string *ErrInfo = 0) { + virtual bool materializeFunction(Function *F, std::string *ErrMsg = 0) { LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.find(F); - if (Fi == LazyFunctionLoadMap.end()) return false; - try { - ParseFunction(F); - } catch (std::string &ErrStr) { - if (ErrInfo) *ErrInfo = ErrStr; + if (Fi == LazyFunctionLoadMap.end()) + return false; + if (ParseFunction(F,ErrMsg)) return true; - } catch (...) { - return true; - } return false; } @@ -174,15 +169,9 @@ /// implementation is identical to ParseAllFunctionBodies. /// @see ParseAllFunctionBodies /// @brief Make the whole module materialize - virtual Module* materializeModule(std::string *ErrInfo = 0) { - try { - ParseAllFunctionBodies(); - } catch (std::string &ErrStr) { - if (ErrInfo) *ErrInfo = ErrStr; + virtual Module* materializeModule(std::string *ErrMsg = 0) { + if (ParseAllFunctionBodies(ErrMsg)) return 0; - } catch (...) { - return 0; - } return TheModule; } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits