[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-05-06 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.72 -> 1.73
---
Log message:

use the new MemoryBuffer interfaces to simplify error reporting in clients.


---
Diffs of the changes:  (+1 -5)

 lli.cpp |6 +-
 1 files changed, 1 insertion(+), 5 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.72 llvm/tools/lli/lli.cpp:1.73
--- llvm/tools/lli/lli.cpp:1.72 Sun May  6 04:32:02 2007
+++ llvm/tools/lli/lli.cpp  Sun May  6 18:45:48 2007
@@ -77,11 +77,7 @@
   // Load the bytecode...
   std::string ErrorMsg;
   ModuleProvider *MP = 0;
-  MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&InputFile[0],
-  InputFile.size());
-  if (Buffer == 0)
-ErrorMsg = "Error reading file '" + InputFile + "'";
-  else {
+  if (MemoryBuffer *Buffer = 
MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){
 MP = getBitcodeModuleProvider(Buffer, &ErrorMsg);
 if (!MP) delete Buffer;
   }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-04-27 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.69 -> 1.70
---
Log message:

reset errno to zero on entry to the application's main function.  This fixes 
MultiSource/Applications/minisat in the JIT.

Note that the libsystem stuff should ideally never modify errno.  :(



---
Diffs of the changes:  (+5 -1)

 lli.cpp |6 +-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.69 llvm/tools/lli/lli.cpp:1.70
--- llvm/tools/lli/lli.cpp:1.69 Mon Mar  5 21:12:55 2007
+++ llvm/tools/lli/lli.cpp  Fri Apr 27 12:02:33 2007
@@ -28,7 +28,7 @@
 #include "llvm/System/Process.h"
 #include "llvm/System/Signals.h"
 #include 
-
+#include 
 using namespace llvm;
 
 namespace {
@@ -128,6 +128,10 @@
 // function later on to make an explicit call, so get the function now. 
 Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy,
   Type::Int32Ty, NULL);
+
+// Reset errno to zero on entry to main.
+errno = 0;
+   
 // Run static constructors.
 EE->runStaticConstructorsDestructors(false);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-03-05 Thread Reid Spencer


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.68 -> 1.69
---
Log message:

Obtain the exit function before execution just in case the module
disappears before we get to calling the exit function.


---
Diffs of the changes:  (+7 -5)

 lli.cpp |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.68 llvm/tools/lli/lli.cpp:1.69
--- llvm/tools/lli/lli.cpp:1.68 Sat Mar  3 12:21:44 2007
+++ llvm/tools/lli/lli.cpp  Mon Mar  5 21:12:55 2007
@@ -124,6 +124,10 @@
   return -1;
 }
 
+// If the program doesn't explicitly call exit, we will need the Exit 
+// function later on to make an explicit call, so get the function now. 
+Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy,
+  Type::Int32Ty, NULL);
 // Run static constructors.
 EE->runStaticConstructorsDestructors(false);
 
@@ -133,14 +137,12 @@
 // Run static destructors.
 EE->runStaticConstructorsDestructors(true);
 
-// If the program didn't explicitly call exit, call exit now, for the
-// program. This ensures that any atexit handlers get called correctly.
-Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy,
-  Type::Int32Ty, NULL);
+// If the program didn't call exit explicitly, we should call it now. 
+// This ensures that any atexit handlers get called correctly.
 if (Function *ExitF = dyn_cast(Exit)) {
   std::vector Args;
   GenericValue ResultGV;
-  ResultGV.Int32Val = Result;
+  ResultGV.IntVal = APInt(32, Result);
   Args.push_back(ResultGV);
   EE->runFunction(ExitF, Args);
   std::cerr << "ERROR: exit(" << Result << ") returned!\n";



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-03-03 Thread Reid Spencer


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.67 -> 1.68
---
Log message:

1. Handle errors around the ModuleProvider. This is necessary since it is
   reading bytecode. 
2. The interpreter can delete the ModuleProvider and replace it with 
   another so don't depend on it being around after the EE is created.
3. Don't just run llvm_shutdown on exit but actually delete the EE as well.
   This cleans up a vast amount of memory (but not all) that EE retained
   through exit.


---
Diffs of the changes:  (+23 -11)

 lli.cpp |   34 +++---
 1 files changed, 23 insertions(+), 11 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.67 llvm/tools/lli/lli.cpp:1.68
--- llvm/tools/lli/lli.cpp:1.67 Wed Feb  7 15:41:02 2007
+++ llvm/tools/lli/lli.cpp  Sat Mar  3 12:21:44 2007
@@ -54,11 +54,18 @@
cl::desc("Disable emission of core files if possible"));
 }
 
+static ExecutionEngine *EE = 0;
+
+static void do_shutdown() {
+  delete EE;
+  llvm_shutdown();
+}
+
 
//===--===//
 // main Driver function
 //
 int main(int argc, char **argv, char * const *envp) {
-  atexit(llvm_shutdown);  // Call llvm_shutdown() on exit.
+  atexit(do_shutdown);  // Call llvm_shutdown() on exit.
   try {
 cl::ParseCommandLineOptions(argc, argv,
 " llvm interpreter & dynamic compiler\n");
@@ -70,22 +77,27 @@
 
 // Load the bytecode...
 std::string ErrorMsg;
-ModuleProvider *MP = 0;
-MP = getBytecodeModuleProvider(InputFile, 
-   Compressor::decompressToNewBuffer,
-   &ErrorMsg);
+ModuleProvider *MP = getBytecodeModuleProvider(InputFile, 
+  
Compressor::decompressToNewBuffer,
+  &ErrorMsg);
 if (!MP) {
-  std::cerr << "Error loading program '" << InputFile << "': "
+  std::cerr << argv[0] << ": error loading program '" << InputFile << "': "
 << ErrorMsg << "\n";
   exit(1);
 }
 
+// Get the module as the MP could go away once EE takes over.
+Module *Mod = MP->getModule();
+
 // If we are supposed to override the target triple, do so now.
 if (!TargetTriple.empty())
-  MP->getModule()->setTargetTriple(TargetTriple);
+  Mod->setTargetTriple(TargetTriple);
 
-ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter);
-assert(EE &&"Couldn't create an ExecutionEngine, not even an 
interpreter?");
+EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg);
+if (!EE && !ErrorMsg.empty()) {
+  std::cerr << argv[0] << ":error creating EE: " << ErrorMsg << "\n";
+  exit(1);
+}
 
 // If the user specifically requested an argv[0] to pass into the program,
 // do it now.
@@ -106,7 +118,7 @@
 // using the contents of Args to determine argc & argv, and the contents of
 // EnvVars to determine envp.
 //
-Function *Fn = MP->getModule()->getFunction("main");
+Function *Fn = Mod->getFunction("main");
 if (!Fn) {
   std::cerr << "'main' function not found in module.\n";
   return -1;
@@ -123,7 +135,7 @@
 
 // If the program didn't explicitly call exit, call exit now, for the
 // program. This ensures that any atexit handlers get called correctly.
-Constant *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
+Constant *Exit = Mod->getOrInsertFunction("exit", Type::VoidTy,
   Type::Int32Ty, NULL);
 if (Function *ExitF = dyn_cast(Exit)) {
   std::vector Args;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-02-07 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.66 -> 1.67
---
Log message:

push bytecode decompressor out through APIs.  Now the bytecode reader
api's look like this:

ModuleProvider *getBytecodeModuleProvider(
  const std::string &Filename,  ///< Name of file to be read
  BCDecompressor_t *BCDC = Compressor::decompressToNewBuffer,
  std::string* ErrMsg = 0,  ///< Optional error message holder 
  BytecodeHandler* H = 0///< Optional handler for reader events
);

This is ugly, but allows a client to say:

  getBytecodeModuleProvider("foo", 0);

If they do this, there is no dependency on the compression libraries, saving
codesize.




---
Diffs of the changes:  (+4 -1)

 lli.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.66 llvm/tools/lli/lli.cpp:1.67
--- llvm/tools/lli/lli.cpp:1.66 Mon Feb  5 15:19:13 2007
+++ llvm/tools/lli/lli.cpp  Wed Feb  7 15:41:02 2007
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compressor.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PluginLoader.h"
 #include "llvm/System/Process.h"
@@ -70,7 +71,9 @@
 // Load the bytecode...
 std::string ErrorMsg;
 ModuleProvider *MP = 0;
-MP = getBytecodeModuleProvider(InputFile, &ErrorMsg);
+MP = getBytecodeModuleProvider(InputFile, 
+   Compressor::decompressToNewBuffer,
+   &ErrorMsg);
 if (!MP) {
   std::cerr << "Error loading program '" << InputFile << "': "
 << ErrorMsg << "\n";



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-02-05 Thread Reid Spencer


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.65 -> 1.66
---
Log message:

For PR411: http://llvm.org/PR411 :
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)



---
Diffs of the changes:  (+1 -1)

 lli.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.65 llvm/tools/lli/lli.cpp:1.66
--- llvm/tools/lli/lli.cpp:1.65 Mon Jan  8 01:36:34 2007
+++ llvm/tools/lli/lli.cpp  Mon Feb  5 15:19:13 2007
@@ -103,7 +103,7 @@
 // using the contents of Args to determine argc & argv, and the contents of
 // EnvVars to determine envp.
 //
-Function *Fn = MP->getModule()->getMainFunction();
+Function *Fn = MP->getModule()->getFunction("main");
 if (!Fn) {
   std::cerr << "'main' function not found in module.\n";
   return -1;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.64 -> 1.65
---
Log message:

fix atexit.  This is an overcomplex way of calling exit, but it is required,
as the jit intercepts exit calls to implement atexit handlers.  This
fixes SingleSource/UnitTests/2003-05-14-AtExit


---
Diffs of the changes:  (+16 -3)

 lli.cpp |   19 ---
 1 files changed, 16 insertions(+), 3 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.64 llvm/tools/lli/lli.cpp:1.65
--- llvm/tools/lli/lli.cpp:1.64 Sun Jan  7 00:43:08 2007
+++ llvm/tools/lli/lli.cpp  Mon Jan  8 01:36:34 2007
@@ -118,9 +118,22 @@
 // Run static destructors.
 EE->runStaticConstructorsDestructors(true);
 
-exit(Result);
-std::cerr << "ERROR: exit(" << Result << ") returned!\n";
-abort();
+// If the program didn't explicitly call exit, call exit now, for the
+// program. This ensures that any atexit handlers get called correctly.
+Constant *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
+  Type::Int32Ty, NULL);
+if (Function *ExitF = dyn_cast(Exit)) {
+  std::vector Args;
+  GenericValue ResultGV;
+  ResultGV.Int32Val = Result;
+  Args.push_back(ResultGV);
+  EE->runFunction(ExitF, Args);
+  std::cerr << "ERROR: exit(" << Result << ") returned!\n";
+  abort();
+} else {
+  std::cerr << "ERROR: exit defined with wrong prototype!\n";
+  abort();
+}
   } catch (const std::string& msg) {
 std::cerr << argv[0] << ": " << msg << "\n";
   } catch (...) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-01-07 Thread Reid Spencer
Chris,

This patch breaks:
   SingleSource/UnitTests/2003-05-14-AtExit
for sure and possibly:
   External/SPEC/CINT2000/252.eon/252.eon

Please revert or fix.

Reid.

On Sun, 2007-01-07 at 00:43 -0600, Chris Lattner wrote:
> 
> Changes in directory llvm/tools/lli:
> 
> lli.cpp updated: 1.63 -> 1.64
> ---
> Log message:
> 
> this is an overcomplex way to call exit :)
> 
> 
> ---
> Diffs of the changes:  (+1 -12)
> 
>  lli.cpp |   13 +
>  1 files changed, 1 insertion(+), 12 deletions(-)
> 
> 
> Index: llvm/tools/lli/lli.cpp
> diff -u llvm/tools/lli/lli.cpp:1.63 llvm/tools/lli/lli.cpp:1.64
> --- llvm/tools/lli/lli.cpp:1.63   Sun Dec 31 00:02:26 2006
> +++ llvm/tools/lli/lli.cppSun Jan  7 00:43:08 2007
> @@ -118,18 +118,7 @@
>  // Run static destructors.
>  EE->runStaticConstructorsDestructors(true);
>  
> -// If the program didn't explicitly call exit, call exit now, for the
> -// program. This ensures that any atexit handlers get called correctly.
> -Function *Exit = MP->getModule()->getOrInsertFunction("exit", 
> Type::VoidTy,
> -  Type::Int32Ty,
> -  (Type *)0);
> -
> -std::vector Args;
> -GenericValue ResultGV;
> -ResultGV.Int32Val = Result;
> -Args.push_back(ResultGV);
> -EE->runFunction(Exit, Args);
> -
> +exit(Result);
>  std::cerr << "ERROR: exit(" << Result << ") returned!\n";
>  abort();
>} catch (const std::string& msg) {
> 
> 
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.63 -> 1.64
---
Log message:

this is an overcomplex way to call exit :)


---
Diffs of the changes:  (+1 -12)

 lli.cpp |   13 +
 1 files changed, 1 insertion(+), 12 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.63 llvm/tools/lli/lli.cpp:1.64
--- llvm/tools/lli/lli.cpp:1.63 Sun Dec 31 00:02:26 2006
+++ llvm/tools/lli/lli.cpp  Sun Jan  7 00:43:08 2007
@@ -118,18 +118,7 @@
 // Run static destructors.
 EE->runStaticConstructorsDestructors(true);
 
-// If the program didn't explicitly call exit, call exit now, for the
-// program. This ensures that any atexit handlers get called correctly.
-Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
-  Type::Int32Ty,
-  (Type *)0);
-
-std::vector Args;
-GenericValue ResultGV;
-ResultGV.Int32Val = Result;
-Args.push_back(ResultGV);
-EE->runFunction(Exit, Args);
-
+exit(Result);
 std::cerr << "ERROR: exit(" << Result << ") returned!\n";
 abort();
   } catch (const std::string& msg) {



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-12-30 Thread Reid Spencer


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.62 -> 1.63
---
Log message:

For PR950: http://llvm.org/PR950 :
Convert signed integer types to signless.


---
Diffs of the changes:  (+2 -2)

 lli.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.62 llvm/tools/lli/lli.cpp:1.63
--- llvm/tools/lli/lli.cpp:1.62 Sun Dec 10 13:01:52 2006
+++ llvm/tools/lli/lli.cpp  Sun Dec 31 00:02:26 2006
@@ -121,12 +121,12 @@
 // If the program didn't explicitly call exit, call exit now, for the
 // program. This ensures that any atexit handlers get called correctly.
 Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
-  Type::IntTy,
+  Type::Int32Ty,
   (Type *)0);
 
 std::vector Args;
 GenericValue ResultGV;
-ResultGV.IntVal = Result;
+ResultGV.Int32Val = Result;
 Args.push_back(ResultGV);
 EE->runFunction(Exit, Args);
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-12-05 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.60 -> 1.61
---
Log message:

make all llvm tools call llvm_shutdown when they exit, static'ify some stuff.

With this change, I can now move -stats to print when llvm_shutdown is called.


---
Diffs of the changes:  (+2 -0)

 lli.cpp |2 ++
 1 files changed, 2 insertions(+)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.60 llvm/tools/lli/lli.cpp:1.61
--- llvm/tools/lli/lli.cpp:1.60 Thu Sep 14 01:17:09 2006
+++ llvm/tools/lli/lli.cpp  Tue Dec  5 19:18:00 2006
@@ -22,6 +22,7 @@
 #include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/PluginLoader.h"
 #include "llvm/System/Process.h"
 #include "llvm/System/Signals.h"
@@ -56,6 +57,7 @@
 // main Driver function
 //
 int main(int argc, char **argv, char * const *envp) {
+  llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.
   try {
 cl::ParseCommandLineOptions(argc, argv,
 " llvm interpreter & dynamic compiler\n");



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-09-13 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.59 -> 1.60
---
Log message:

add a new (hidden) -disable-core-files option


---
Diffs of the changes:  (+9 -0)

 lli.cpp |9 +
 1 files changed, 9 insertions(+)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.59 llvm/tools/lli/lli.cpp:1.60
--- llvm/tools/lli/lli.cpp:1.59 Fri Aug 25 12:43:11 2006
+++ llvm/tools/lli/lli.cpp  Thu Sep 14 01:17:09 2006
@@ -23,6 +23,7 @@
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/PluginLoader.h"
+#include "llvm/System/Process.h"
 #include "llvm/System/Signals.h"
 #include 
 
@@ -45,6 +46,10 @@
   FakeArgv0("fake-argv0",
 cl::desc("Override the 'argv[0]' value passed into the executing"
  " program"), cl::value_desc("executable"));
+  
+  cl::opt
+  DisableCoreFiles("disable-core-files", cl::Hidden,
+   cl::desc("Disable emission of core files if possible"));
 }
 
 
//===--===//
@@ -56,6 +61,10 @@
 " llvm interpreter & dynamic compiler\n");
 sys::PrintStackTraceOnErrorSignal();
 
+// If the user doesn't want core files, disable them.
+if (DisableCoreFiles)
+  sys::Process::PreventCoreFiles();
+
 // Load the bytecode...
 std::string ErrorMsg;
 ModuleProvider *MP = 0;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-08-25 Thread Reid Spencer


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.58 -> 1.59
---
Log message:

For PR797: http://llvm.org/PR797 :
Remove exception throwing/handling from lib/Bytecode, and adjust its users
to compensate for changes in the interface.


---
Diffs of the changes:  (+3 -4)

 lli.cpp |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.58 llvm/tools/lli/lli.cpp:1.59
--- llvm/tools/lli/lli.cpp:1.58 Tue Aug  1 17:34:35 2006
+++ llvm/tools/lli/lli.cpp  Fri Aug 25 12:43:11 2006
@@ -59,11 +59,10 @@
 // Load the bytecode...
 std::string ErrorMsg;
 ModuleProvider *MP = 0;
-try {
-  MP = getBytecodeModuleProvider(InputFile);
-} catch (std::string &err) {
+MP = getBytecodeModuleProvider(InputFile, &ErrorMsg);
+if (!MP) {
   std::cerr << "Error loading program '" << InputFile << "': "
-<< err << "\n";
+<< ErrorMsg << "\n";
   exit(1);
 }
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-08-01 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.57 -> 1.58
---
Log message:

Fix the build on case-sensitive filesystems :(


---
Diffs of the changes:  (+1 -1)

 lli.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.57 llvm/tools/lli/lli.cpp:1.58
--- llvm/tools/lli/lli.cpp:1.57 Tue Aug  1 09:21:23 2006
+++ llvm/tools/lli/lli.cpp  Tue Aug  1 17:34:35 2006
@@ -17,7 +17,7 @@
 #include "llvm/ModuleProvider.h"
 #include "llvm/Type.h"
 #include "llvm/Bytecode/Reader.h"
-#include "llvm/Codegen/LinkAllCodegenComponents.h"
+#include "llvm/CodeGen/LinkAllCodegenComponents.h"
 #include "llvm/ExecutionEngine/JIT.h"
 #include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-08-01 Thread Jim Laskey


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.56 -> 1.57
---
Log message:

Introducing plugable register allocators and instruction schedulers.


---
Diffs of the changes:  (+1 -0)

 lli.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.56 llvm/tools/lli/lli.cpp:1.57
--- llvm/tools/lli/lli.cpp:1.56 Thu Mar 23 20:53:49 2006
+++ llvm/tools/lli/lli.cpp  Tue Aug  1 09:21:23 2006
@@ -17,6 +17,7 @@
 #include "llvm/ModuleProvider.h"
 #include "llvm/Type.h"
 #include "llvm/Bytecode/Reader.h"
+#include "llvm/Codegen/LinkAllCodegenComponents.h"
 #include "llvm/ExecutionEngine/JIT.h"
 #include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-03-23 Thread Jeff Cohen


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.55 -> 1.56
---
Log message:

Get JIT/Interpreter working on Windows again.

---
Diffs of the changes:  (+2 -1)

 lli.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.55 llvm/tools/lli/lli.cpp:1.56
--- llvm/tools/lli/lli.cpp:1.55 Wed Mar  8 12:43:36 2006
+++ llvm/tools/lli/lli.cpp  Thu Mar 23 20:53:49 2006
@@ -17,7 +17,8 @@
 #include "llvm/ModuleProvider.h"
 #include "llvm/Type.h"
 #include "llvm/Bytecode/Reader.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/JIT.h"
+#include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/PluginLoader.h"



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2006-03-08 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.54 -> 1.55
---
Log message:

Fit to 80 columns.
Add support for running static ctor/dtors that aren't handled by __main.
This fixes programs with the JIT and the new CFE, such as HBD.


---
Diffs of the changes:  (+14 -7)

 lli.cpp |   21 ++---
 1 files changed, 14 insertions(+), 7 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.54 llvm/tools/lli/lli.cpp:1.55
--- llvm/tools/lli/lli.cpp:1.54 Thu Dec 15 23:19:18 2005
+++ llvm/tools/lli/lli.cpp  Wed Mar  8 12:43:36 2006
@@ -60,7 +60,8 @@
 try {
   MP = getBytecodeModuleProvider(InputFile);
 } catch (std::string &err) {
-  std::cerr << "Error loading program '" << InputFile << "': " << err << 
"\n";
+  std::cerr << "Error loading program '" << InputFile << "': "
+<< err << "\n";
   exit(1);
 }
 
@@ -69,10 +70,10 @@
   MP->getModule()->setTargetTriple(TargetTriple);
 
 ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter);
-assert(EE && "Couldn't create an ExecutionEngine, not even an 
interpreter?");
+assert(EE &&"Couldn't create an ExecutionEngine, not even an 
interpreter?");
 
-// If the user specifically requested an argv[0] to pass into the program, 
do
-// it now.
+// If the user specifically requested an argv[0] to pass into the program,
+// do it now.
 if (!FakeArgv0.empty()) {
   InputFile = FakeArgv0;
 } else {
@@ -96,11 +97,17 @@
   return -1;
 }
 
-// Run main...
+// Run static constructors.
+EE->runStaticConstructorsDestructors(false);
+
+// Run main.
 int Result = EE->runFunctionAsMain(Fn, InputArgv, envp);
 
-// If the program didn't explicitly call exit, call exit now, for the 
program.
-// This ensures that any atexit handlers get called correctly.
+// Run static destructors.
+EE->runStaticConstructorsDestructors(true);
+
+// If the program didn't explicitly call exit, call exit now, for the
+// program. This ensures that any atexit handlers get called correctly.
 Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
   Type::IntTy,
   (Type *)0);



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2005-12-15 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.53 -> 1.54
---
Log message:

rename option


---
Diffs of the changes:  (+1 -1)

 lli.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.53 llvm/tools/lli/lli.cpp:1.54
--- llvm/tools/lli/lli.cpp:1.53 Thu Dec 15 23:00:21 2005
+++ llvm/tools/lli/lli.cpp  Thu Dec 15 23:19:18 2005
@@ -37,7 +37,7 @@
  cl::desc("Force interpretation: disable JIT"),
  cl::init(false));
   cl::opt
-  TargetTriple("triple", cl::desc("Override target triple for module"));
+  TargetTriple("mtriple", cl::desc("Override target triple for module"));
   
   cl::opt
   FakeArgv0("fake-argv0",



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2005-12-15 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.52 -> 1.53
---
Log message:

provide an option to override the target triple in a module from the 
commandline.



---
Diffs of the changes:  (+7 -1)

 lli.cpp |8 +++-
 1 files changed, 7 insertions(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.52 llvm/tools/lli/lli.cpp:1.53
--- llvm/tools/lli/lli.cpp:1.52 Fri Dec  2 13:00:22 2005
+++ llvm/tools/lli/lli.cpp  Thu Dec 15 23:00:21 2005
@@ -36,7 +36,9 @@
   cl::opt ForceInterpreter("force-interpreter",
  cl::desc("Force interpretation: disable JIT"),
  cl::init(false));
-
+  cl::opt
+  TargetTriple("triple", cl::desc("Override target triple for module"));
+  
   cl::opt
   FakeArgv0("fake-argv0",
 cl::desc("Override the 'argv[0]' value passed into the executing"
@@ -62,6 +64,10 @@
   exit(1);
 }
 
+// If we are supposed to override the target triple, do so now.
+if (!TargetTriple.empty())
+  MP->getModule()->setTargetTriple(TargetTriple);
+
 ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter);
 assert(EE && "Couldn't create an ExecutionEngine, not even an 
interpreter?");
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2005-12-02 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.51 -> 1.52
---
Log message:

Revert my previous patch which broke due to lazy streaming of functions
from .bc files.


---
Diffs of the changes:  (+1 -1)

 lli.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.51 llvm/tools/lli/lli.cpp:1.52
--- llvm/tools/lli/lli.cpp:1.51 Thu Dec  1 16:48:23 2005
+++ llvm/tools/lli/lli.cpp  Fri Dec  2 13:00:22 2005
@@ -85,7 +85,7 @@
 // EnvVars to determine envp.
 //
 Function *Fn = MP->getModule()->getMainFunction();
-if (!Fn || Fn->isExternal()) {
+if (!Fn) {
   std::cerr << "'main' function not found in module.\n";
   return -1;
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2005-12-01 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.50 -> 1.51
---
Log message:

If a module has a main, but it is defined externally, refuse to run it.

Attempting to run it will find lli's main, which isn't the desired effect.


---
Diffs of the changes:  (+1 -1)

 lli.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.50 llvm/tools/lli/lli.cpp:1.51
--- llvm/tools/lli/lli.cpp:1.50 Sat Oct 22 23:37:20 2005
+++ llvm/tools/lli/lli.cpp  Thu Dec  1 16:48:23 2005
@@ -85,7 +85,7 @@
 // EnvVars to determine envp.
 //
 Function *Fn = MP->getModule()->getMainFunction();
-if (!Fn) {
+if (!Fn || Fn->isExternal()) {
   std::cerr << "'main' function not found in module.\n";
   return -1;
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/tools/lli/lli.cpp

2005-10-22 Thread Jeff Cohen


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.49 -> 1.50
---
Log message:

When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.


---
Diffs of the changes:  (+2 -1)

 lli.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.49 llvm/tools/lli/lli.cpp:1.50
--- llvm/tools/lli/lli.cpp:1.49 Thu Apr 21 18:59:31 2005
+++ llvm/tools/lli/lli.cpp  Sat Oct 22 23:37:20 2005
@@ -96,7 +96,8 @@
 // If the program didn't explicitly call exit, call exit now, for the 
program.
 // This ensures that any atexit handlers get called correctly.
 Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
-  Type::IntTy, 0);
+  Type::IntTy,
+  (Type *)0);
 
 std::vector Args;
 GenericValue ResultGV;



___
llvm-commits mailing list
[EMAIL PROTECTED]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits