Commit Graph

150 Commits

Author SHA1 Message Date
Jeffrey Yasskin
8f6d9a729e Add a --with-oprofile flag to configure, which uses OProfile's agent
library to tell it the addresses of JITted functions.  For a
particular program, this changes the opreport -l output from:

samples %    image name        symbol name
48182  98.9729 anon (tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000) anon (tgid:19412 range:0x7f12ccaab000-0x7f12cdaab000)
11     0.0226  libstdc++.so.6.0.9    /usr/lib/libstdc++.so.6.0.9

to:

samples %    image name        symbol name
24565  60.7308 19814.jo        fib_left
15365  37.9861 19814.jo        fib_right
22     0.0544  ld-2.7.so       do_lookup_x



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-10 21:08:20 +00:00
Chris Lattner
fd15beefee Fix lli to print an error and exit when EE returns null but no string. Patch
by Eric Rannaud!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74930 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:31:09 +00:00
Torok Edwin
db9c028d01 Fix typo: intepreter->interpreter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 12:11:32 +00:00
Owen Anderson
31895e7359 Hold the LLVMContext by reference rather than by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:22:36 +00:00
Owen Anderson
8b477ed579 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:58:40 +00:00
Jeffrey Yasskin
df5a7daff9 Add a JITEventListener interface that gets called back when a new function is
emitted or the machine code for a function is freed.  Chris mentioned that we
may also want a notification when a stub is emitted, but that'll be a future
change.  I intend to use this to tell oprofile where functions are emitted and
what lines correspond to what addresses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 02:04:04 +00:00
Chris Lattner
2deb58f72e switch to using llvm/Target/TargetSelect.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73611 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 16:42:19 +00:00
Chris Lattner
c447ff693e Use Doug's new LLVM_NATIVE_ARCH macro in config.h to link in the native
target so that the JIT works in LLI, not just the interpreter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 02:15:40 +00:00
Evan Cheng
712e80e188 Default llc / lli optimization to "Default", which corresponds to -O1 / -O2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 23:05:19 +00:00
Bill Wendling
98a366d547 Instead of passing in an unsigned value for the optimization level, use an enum,
which better identifies what the optimization is doing. And is more flexible for
future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70440 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 23:29:43 +00:00
Chris Lattner
cc14d25dd9 Change various llvm utilities to use PrettyStackTraceProgram in
their main routines.  This makes the tools print their argc/argv
commands if they crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 05:34:10 +00:00
Evan Cheng
ec740e325c Add command line option -entry-funcion to override entry function (default is main).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 23:21:52 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00
Anton Korobeynikov
3c3bc48d33 Move X86 assembler printers into separate directory. This allows JIT-only users not to link it in (use 'x86codegen' llvm-config arg for this)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 13:53:59 +00:00
Evan Cheng
e1a4eda990 Add -fast command line option to lli. It enables fast codegen path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 08:12:06 +00:00
Evan Cheng
03dace82f4 Rename -no-lazy to -disable-lazy-compilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51386 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 18:20:21 +00:00
Evan Cheng
c290a5b9ff Added command line option -no-lazy to disable JIT lazy compilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 06:51:41 +00:00
Chris Lattner
21c62da287 remove attributions from tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:44:31 +00:00
Chris Lattner
5116784826 remove attributions from tools/utils makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:07:17 +00:00
Dan Gohman
82a13c9c48 Move the space in overview output for commands out of each of the
commands and into the common code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42752 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 15:45:12 +00:00
Gabor Greif
a99be51bf5 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:07:56 +00:00
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
Chris Lattner
279015226e lli uses LinkAllCodegenComponents, so it needs this. Thanks to
Rafael Esp?ndola for pointing this out


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30100 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-04 18:34:16 +00:00
Chris Lattner
a563208898 Use llvm-config instead of magic JIT thing to link in libs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30091 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-04 06:01:43 +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
Chris Lattner
0465fa9cf8 Tools require EH for their top-level try blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29035 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-07 00:46:19 +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