Commit Graph

73 Commits

Author SHA1 Message Date
Chris Lattner
065344dfd5 use the new MemoryBuffer interfaces to simplify error reporting in clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36900 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 23:45:49 +00:00
Chris Lattner
744879ea01 switch tools to bitcode from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36872 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 09:32:02 +00:00
Chris Lattner
c1e6d68698 add bitcode reading support, remove eh stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 04:58:26 +00:00
Chris Lattner
020403209a 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.  :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36508 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-27 17:02:33 +00:00
Reid Spencer
124294bc59 Obtain the exit function before execution just in case the module
disappears before we get to calling the exit function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34953 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 03:12:55 +00:00
Reid Spencer
f70d677501 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34888 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-03 18:21:44 +00:00
Chris Lattner
f2e292ce58 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34012 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 21:41:02 +00:00
Reid Spencer
688b0490e2 For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33922 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:19:13 +00:00
Chris Lattner
c0974a1344 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33008 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-08 07:36:34 +00:00
Chris Lattner
f74edf28b6 this is an overcomplex way to call exit :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32978 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 06:43:08 +00:00
Reid Spencer
71d2ec9e6d For PR950:
Convert signed integer types to signless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32790 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 06:02:26 +00:00
Chris Lattner
ca3aa26c20 make statistics and timing info print even if the JIT'd program calls exit
instead of returning from main.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32414 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-10 19:01:52 +00:00
Chris Lattner
c30598bc3a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32250 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 01:18:01 +00:00
Chris Lattner
43f249adb7 add a new (hidden) -disable-core-files option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30318 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-14 06:17:09 +00:00
Reid Spencer
0b5a504d10 For PR797:
Remove exception throwing/handling from lib/Bytecode, and adjust its users
to compensate for changes in the interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29875 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-25 17:43:11 +00:00
Chris Lattner
d3a680ae2c Fix the build on case-sensitive filesystems :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29457 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 22:34:35 +00:00
Jim Laskey
13ec702c43 Introducing plugable register allocators and instruction schedulers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29434 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-01 14:21:23 +00:00
Jeff Cohen
2f51914d82 Get JIT/Interpreter working on Windows again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27037 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 02:53:49 +00:00
Chris Lattner
42d0b455ec 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26620 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-08 18:43:36 +00:00
Chris Lattner
60844d46ce rename option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24732 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-16 05:19:18 +00:00
Chris Lattner
3015e6061c provide an option to override the target triple in a module from the commandline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24730 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-16 05:00:21 +00:00
Chris Lattner
52098898b4 Revert my previous patch which broke due to lazy streaming of functions
from .bc files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24575 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-02 19:00:22 +00:00
Chris Lattner
48ba8221af 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24569 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-01 22:48:23 +00:00
Jeff Cohen
66c5fd6c53 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23888 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-23 04:37:20 +00:00
Misha Brukman
3da94aec4d Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21428 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 00:00:37 +00:00
Reid Spencer
1ef8bdaedb For PR351:
* Place a try/catch block around the entire tool to Make sure std::string
  exceptions are caught and printed before exiting the tool.
* Make sure we catch unhandled exceptions at the top level so that we don't
  abort with a useless message but indicate than an unhandled exception was
  generated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19192 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-30 05:36:08 +00:00
Reid Spencer
551ccae044 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-01 22:55:40 +00:00
Reid Spencer
9de7b334ec The functions in Signal.h are now in the llvm::sys namespace - adjust
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16091 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-29 19:28:55 +00:00
Chris Lattner
a3eb7b3983 Add a -load option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14739 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 01:06:59 +00:00
Reid Spencer
86f42bdad9 Add #include <iostream> since Value.h does not include it any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14623 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 12:20:55 +00:00
Chris Lattner
bed85ff010 Header file moved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13813 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 05:41:36 +00:00
Chris Lattner
364d1203e7 Make sure to print a stack trace whenever an error signal is delivered to
the tool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11633 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-19 20:32:39 +00:00
Chris Lattner
6fb6ce3148 Pass extra arguments around n stuph
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10631 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 09:51:04 +00:00
Chris Lattner
269a42811b Factor out code to ExecutionEngine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10614 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:49:53 +00:00
Chris Lattner
3ef3dd36fe Simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10613 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:36:20 +00:00
Chris Lattner
efec9669d9 * eliminate the -f argument to lli, as it was silly and never useful anyway
* Inline callMain function
* Remove hack from the ExecutionEngines where the 'run' method would automatically
  run atExit functions.  Fixing this requires explicitly calling exit if main returns


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10611 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:14:47 +00:00
Chris Lattner
7efea1dd98 update comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10607 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 05:07:35 +00:00
Brian Gaeke
3f6e798a14 Add an assertion to make sure we are at least getting argv[0] right.
Use a clearer error message when we fail to load a program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10414 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-12 00:47:19 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
Chris Lattner
e69671d65b Add the ability for users to specify a specific argv[0] to pass into the
program


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9565 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-28 22:51:44 +00:00
Brian Gaeke
2f828c343b TraceMode, as you may have heard, is history.
ExecutionEngine::create no longer takes a TraceMode argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9495 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-24 20:00:17 +00:00
John Criswell
1ee1e64293 Removed extraneous comment line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9308 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 20:40:30 +00:00
John Criswell
7c0e022c5c Added copyright header to all C++ source files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9291 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 17:47:21 +00:00
Misha Brukman
c4fb6fdd86 Enabling incremental bytecode loading in the JIT:
* Use the incremental bytecode reader interface to speed up execution


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9127 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-14 21:39:53 +00:00
Misha Brukman
3d8a54d00c To be consistent with the rest of LLVM codebase (and the rest of this file):
* Changed tabs to spaces
* Removed a space between a function call and its arguments (...)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8712 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-25 18:10:34 +00:00
Chris Lattner
fd13129bdf Reorder #includes to follow LLVM conventions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8375 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 20:08:15 +00:00
Brian Gaeke
d1cab3e6ce Interpreter, JIT moved to lib/ExecutionEngine (includes -> llvm/ExecutionEngine)
Build lli using executionengine library


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8372 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 19:42:34 +00:00
Brian Gaeke
70975eef57 Make CreateArgv part of lli rather than part of ExecutionEngine.
Switch Interpreter and JIT's "run" methods to take a Function and a vector of
 GenericValues.
Move (almost all of) the stuff that constructs a canonical call to main()
 into lli (new methods "callAsMain", "makeStringVector").
Nuke getCurrentExecutablePath(), enableTracing(), getCurrentFunction(),
 isStopped(), and many dead decls from interpreter.
Add linux strdup() support to interpreter.
Make interpreter's atexit handler runner and JIT's runAtExitHandlers() look
 more alike, in preparation for refactoring.
atexit() is spelled "atexit", not "at_exit".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8366 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-05 18:42:01 +00:00
Brian Gaeke
8e53948881 Move EE dtor where it belongs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8345 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-04 22:57:27 +00:00
Brian Gaeke
f58815e161 Interpreter cleanups:
Get rid of support for DebugMode (make it always off).
Mung some comments.
Get rid of interpreter's PROFILE_STRUCTURE_FIELDS and PerformExitStuff
 which have been disabled forever.
Get rid of -abort-on-exception (make it always on).
Get rid of user interaction stuff (debug mode innards).
Simplify Interpreter's callMainFunction().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8344 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-04 22:21:24 +00:00