diff options
author | Chris Lattner <sabre@nondot.org> | 2001-10-27 04:15:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-10-27 04:15:57 +0000 |
commit | 15157b88e9628f962bb2d1d768ef02f0dc8672d1 (patch) | |
tree | 3cd99efb2c6021c5fecfdc8cffb24a04298aa6bc /llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp | |
parent | 0863c161e9431eec93c6c6e318748019dfb4fed2 (diff) | |
download | bcm5719-llvm-15157b88e9628f962bb2d1d768ef02f0dc8672d1.tar.gz bcm5719-llvm-15157b88e9628f962bb2d1d768ef02f0dc8672d1.zip |
* Implement exit() builtin function
* Implement linked in runtime library with puts(char*) in it
* implement builtin putchar(int) function
llvm-svn: 985
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp b/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp index f579ef1a9b4..2989ae95e86 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp @@ -8,6 +8,7 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Assembly/Writer.h" #include "llvm/DerivedTypes.h" +#include "llvm/Transforms/Linker.h" #include <algorithm> enum CommandID { @@ -129,15 +130,25 @@ void Interpreter::handleUserInput() { // loadModule - Load a new module to execute... // void Interpreter::loadModule(const string &Filename) { + string ErrorMsg; if (CurMod && !flushModule()) return; // Kill current execution - CurMod = ParseBytecodeFile(Filename); + CurMod = ParseBytecodeFile(Filename, &ErrorMsg); if (CurMod == 0) { - cout << "Error parsing '" << Filename << "': No module loaded.\n"; + cout << "Error parsing '" << Filename << "': No module loaded: " + << ErrorMsg << "\n"; return; } - // TODO: link in support library... + string RuntimeLib = getCurrentExecutablePath() + "/RuntimeLib.bc"; + if (Module *SupportLib = ParseBytecodeFile(RuntimeLib, &ErrorMsg)) { + if (LinkModules(CurMod, SupportLib, &ErrorMsg)) + cerr << "Error Linking runtime library into current module: " + << ErrorMsg << endl; + } else { + cerr << "Error loading runtime library '"+RuntimeLib+"': " + << ErrorMsg << "\n"; + } } |