Commit Graph

117 Commits

Author SHA1 Message Date
Jim Grosbach 7b162490fd Beginnings of MC-JIT code generation.
Proof-of-concept code that code-gens a module to an in-memory MachO object.
This will be hooked up to a run-time dynamic linker library (see: llvm-rtdyld
for similarly conceptual work for that part) which will take the compiled
object and link it together with the rest of the system, providing back to the
JIT a table of available symbols which will be used to respond to the
getPointerTo*() queries.

llvm-svn: 127916
2011-03-18 22:48:41 +00:00
Michael J. Spencer 447762da85 Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Daniel Dunbar 7e5d8a765f MCJIT: Stub out MCJIT implementation, still doesn't do anything useful.
llvm-svn: 119509
2010-11-17 16:06:43 +00:00
Daniel Dunbar 70ff8b05e3 lli: Add stub -use-mcjit option, which doesn't currently do anything.
llvm-svn: 119508
2010-11-17 16:06:37 +00:00
Daniel Dunbar 9589bf8a86 lli: Switch to using ParseIRFile, for consistency with other LLVM tools.
- Also, switch tests to not using llvm-as. They run 20% faster now, not that it matters.

llvm-svn: 118952
2010-11-13 00:28:01 +00:00
NAKAMURA Takumi 1530487cb1 lli: On Cygwin-1.5, lli crashes at invoking destructors in atexit handler.
llvm-svn: 117095
2010-10-22 14:53:59 +00:00
Duncan Sands 3bd97fec8f Straighten out any triple strings passed on the command line before
they hit the rest of the system.

llvm-svn: 112344
2010-08-28 01:30:02 +00:00
Benjamin Kramer a944a9a902 Simplify ".bc" detection.
llvm-svn: 101365
2010-04-15 11:33:14 +00:00
Chris Lattner 2df4fa5bc8 fix a crash on "lli ex" or any other file whose name is exactly two
characters long.

llvm-svn: 101336
2010-04-15 03:32:19 +00:00
Jeffrey Yasskin 31faefff92 Move --march, --mcpu, and --mattr from JIT/TargetSelect.cpp to lli.cpp.
llc.cpp also defined these flags, meaning that when I linked all of LLVM's
libraries into a single shared library, llc crashed on startup with duplicate
flag definitions.  This patch passes them through the EngineBuilder into
JIT::selectTarget().

llvm-svn: 95390
2010-02-05 16:19:36 +00:00
Jeffrey Yasskin 091217be6f Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Jeffrey Yasskin aa8814a877 Revert the API changes from r85295 to make it easier for people to build
against both 2.6 and HEAD.  The default is still changed to eager jitting.

llvm-svn: 85330
2009-10-27 22:39:42 +00:00
Jeffrey Yasskin 4567db45b8 Change the JIT to compile eagerly by default as agreed in
http://llvm.org/PR5184, and beef up the comments to describe what both options
do and the risks of lazy compilation in the presence of threads.

llvm-svn: 85295
2009-10-27 20:30:28 +00:00
Jeffrey Yasskin 08fa03c740 Delete the MacOSJITEventListener per echristo's request. It was disabled by
default and didn't work anyway.

llvm-svn: 84720
2009-10-21 00:43:48 +00:00
Evan Cheng 5a28638560 Add a CodeGenOpt::Less level to match -O1. It'll be used by clients which do not want post-regalloc scheduling.
llvm-svn: 84272
2009-10-16 21:02:20 +00:00
Chris Lattner c521f54198 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman b880939834 lli doesn't need <iostream> anymore.
llvm-svn: 78133
2009-08-05 00:28:59 +00:00
Reid Kleckner 4b3a356493 Re-committing r76828 with the JIT memory manager changes now that the build
bots like the BumpPtrAllocator changes.

llvm-svn: 76902
2009-07-23 21:46:56 +00:00
Reid Kleckner 921673225c Reverting r76825 and r76828, since they caused clang runtime errors and some build failure involving memset.
llvm-svn: 76838
2009-07-23 01:40:54 +00:00
Reid Kleckner 1a722d9b73 Make the JIT code emitter properly retry and ask for more memory when it runs
out of memory, and also make the default memory manager allocate more memory
when it runs out.

Also, switch function stubs and global data over to using the BumpPtrAllocator.

This makes it so the JIT no longer mmaps (or the equivalent on Windows) 16 MB
of memory, and instead allocates in 512K slabs.  I suspect this size could go
lower, especially on embedded platforms, now that more slabs can be allocated.

llvm-svn: 76828
2009-07-23 00:49:59 +00:00
Daniel Dunbar a78d809abc Switch lli back to using allocate-gvs-with-code behavior.
- Otherwise we get two regressions in llvm-test for applications which run out
   of space.

 - Once the JIT memory manager is improved, this can be switched back.

llvm-svn: 76291
2009-07-18 08:07:13 +00:00
Reid Kleckner fc8a2d5a83 Add EngineBuilder to ExecutionEngine in favor of the five optional argument EE::create().
Also a test commit.

llvm-svn: 76276
2009-07-18 00:42:18 +00:00
Daniel Dunbar 3d92d936b9 Make sure targets are initialized before we do anything, even command line
processing.

llvm-svn: 75888
2009-07-16 02:04:54 +00:00
Owen Anderson 19251ec836 To simplify the upcoming context-on-type change, switch all command line tools to using the default global context for now.
This will let us to hardwire stuff to the global context in the short term while the API is sorted out.

llvm-svn: 75846
2009-07-15 22:16:10 +00:00
Dan Gohman d8db376071 Use errs() instead of std::cerr.
llvm-svn: 75791
2009-07-15 16:35:29 +00:00
Jeffrey Yasskin bf3d6ba557 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

llvm-svn: 75279
2009-07-10 21:08:20 +00:00
Chris Lattner f840ed7ed4 Fix lli to print an error and exit when EE returns null but no string. Patch
by Eric Rannaud!

llvm-svn: 74930
2009-07-07 18:31:09 +00:00
Torok Edwin f011f28767 Fix typo: intepreter->interpreter.
llvm-svn: 74770
2009-07-03 12:11:32 +00:00
Owen Anderson 1cf085d558 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Owen Anderson 6773d388aa 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.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Jeffrey Yasskin 0b08f3d7cc 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.

llvm-svn: 74157
2009-06-25 02:04:04 +00:00
Chris Lattner 5dcc4f6999 switch to using llvm/Target/TargetSelect.h
llvm-svn: 73611
2009-06-17 16:42:19 +00:00
Chris Lattner 4ced3324c5 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.

llvm-svn: 73595
2009-06-17 02:15:40 +00:00
Evan Cheng 09bd0b1bd2 Default llc / lli optimization to "Default", which corresponds to -O1 / -O2.
llvm-svn: 70934
2009-05-04 23:05:19 +00:00
Bill Wendling 026e5d7667 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.

llvm-svn: 70440
2009-04-29 23:29:43 +00:00
Chris Lattner e3fc2d13be Change various llvm utilities to use PrettyStackTraceProgram in
their main routines.  This makes the tools print their argc/argv
commands if they crash.

llvm-svn: 66248
2009-03-06 05:34:10 +00:00
Evan Cheng 6158254d1d Add command line option -entry-funcion to override entry function (default is main).
llvm-svn: 58779
2008-11-05 23:21:52 +00:00
Evan Cheng 06d988eaa3 Add -fast command line option to lli. It enables fast codegen path.
llvm-svn: 54524
2008-08-08 08:12:06 +00:00
Evan Cheng 16f036cbe8 Rename -no-lazy to -disable-lazy-compilation.
llvm-svn: 51386
2008-05-21 18:20:21 +00:00
Evan Cheng 0422bef7ed Added command line option -no-lazy to disable JIT lazy compilation.
llvm-svn: 50095
2008-04-22 06:51:41 +00:00
Chris Lattner 345353d6b4 remove attributions from tools.
llvm-svn: 45421
2007-12-29 20:44:31 +00:00
Dan Gohman 2c6a821fd7 Move the space in overview output for commands out of each of the
commands and into the common code.

llvm-svn: 42752
2007-10-08 15:45:12 +00:00
Gabor Greif e16561cd5d Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Chris Lattner 9e9a34c6bf use the new MemoryBuffer interfaces to simplify error reporting in clients.
llvm-svn: 36900
2007-05-06 23:45:49 +00:00
Chris Lattner f5599efb00 switch tools to bitcode from bytecode
llvm-svn: 36872
2007-05-06 09:32:02 +00:00
Chris Lattner 2785bdbefd add bitcode reading support, remove eh stuff
llvm-svn: 36840
2007-05-06 04:58:26 +00:00
Chris Lattner 4c522b9434 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.  :(

llvm-svn: 36508
2007-04-27 17:02:33 +00:00
Reid Spencer fe5550b2cf Obtain the exit function before execution just in case the module
disappears before we get to calling the exit function.

llvm-svn: 34953
2007-03-06 03:12:55 +00:00
Reid Spencer e586f2e7f7 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.

llvm-svn: 34888
2007-03-03 18:21:44 +00:00