summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JIT.h
Commit message (Collapse)AuthorAgeFilesLines
* Make it possible to create multiple JIT instances at the same time, by removingJeffrey Yasskin2010-02-111-0/+4
| | | | | | | | | | the global TheJIT and TheJITResolver variables. Lazy compilation is supported by a global map from a stub address to the JITResolver that knows how to compile it. Patch by Olivier Meurant! llvm-svn: 95837
* Move --march, --mcpu, and --mattr from JIT/TargetSelect.cpp to lli.cpp.Jeffrey Yasskin2010-02-051-3/+10
| | | | | | | | | 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
* Kill ModuleProvider and ghost linkage by inverting the relationship betweenJeffrey Yasskin2010-01-271-25/+12
| | | | | | | | | | | | | | | | | | | | | 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
* Don't codegen available_externally functions. Fixes http://llvm.org/PR5735.Jeffrey Yasskin2009-12-171-0/+6
| | | | llvm-svn: 91626
* Add ability to set code model within the execution engine buildersEric Christopher2009-11-171-3/+6
| | | | | | and creation interfaces. llvm-svn: 89151
* Remove dlsym stubs, with Nate Begeman's permission.Jeffrey Yasskin2009-11-091-1/+0
| | | | llvm-svn: 86606
* Fix MSVC build.Benjamin Kramer2009-10-291-0/+1
| | | | llvm-svn: 85505
* add interpreter support for indirect goto / blockaddress. The interpreterChris Lattner2009-10-291-0/+4
| | | | | | | now correctly runs clang's test/CodeGen/indirect-goto.c. The JIT will abort on it until someone feels compelled to implement this. llvm-svn: 85488
* Automatically do the equivalent of freeMachineCodeForFunction(F) when F isJeffrey Yasskin2009-10-271-1/+1
| | | | | | | | | | | | | being destroyed. This allows users to run global optimizations like globaldce even after some functions have been jitted. This patch also removes the Function* parameter to JITEventListener::NotifyFreeingMachineCode() since it can cause that to be called when the Function is partially destroyed. This change will be even more helpful later when I think we'll want to allow machine code to actually outlive its Function. llvm-svn: 85182
* Keep track of stubs that are created. This fixes PR5162 and probably PR4822 andJeffrey Yasskin2009-10-131-2/+3
| | | | | | 4406. Patch by Nick Lewycky! llvm-svn: 84032
* Implement the JIT side of the GDB JIT debugging interface. To enable thisReid Kleckner2009-09-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | feature, either build the JIT in debug mode to enable it by default or pass -jit-emit-debug to lli. Right now, the only debug information that this communicates to GDB is call frame information, since it's already being generated to support exceptions in the JIT. Eventually, when DWARF generation isn't tied so tightly to AsmPrinter, it will be easy to push that information to GDB through this interface. Here's a step-by-step breakdown of how the feature works: - The JIT generates the machine code and DWARF call frame info (.eh_frame/.debug_frame) for a function into memory. - The JIT copies that info into an in-memory ELF file with a symbol for the function. - The JIT creates a code entry pointing to the ELF buffer and adds it to a linked list hanging off of a global descriptor at a special symbol that GDB knows about. - The JIT calls a function marked noinline that GDB knows about and has put an internal breakpoint in. - GDB catches the breakpoint and reads the global descriptor to look for new code. - When sees there is new code, it reads the ELF from the inferior's memory and adds it to itself as an object file. - The JIT continues, and the next time we stop the program, we are able to produce a proper backtrace. Consider running the following program through the JIT: #include <stdio.h> void baz(short z) { long w = z + 1; printf("%d, %x\n", w, *((int*)NULL)); // SEGFAULT here } void bar(short y) { int z = y + 1; baz(z); } void foo(char x) { short y = x + 1; bar(y); } int main(int argc, char** argv) { char x = 1; foo(x); } Here is a backtrace before this patch: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x2aaaabdfbd10 (LWP 25476)] 0x00002aaaabe7d1a8 in ?? () (gdb) bt #0 0x00002aaaabe7d1a8 in ?? () #1 0x0000000000000003 in ?? () #2 0x0000000000000004 in ?? () #3 0x00032aaaabe7cfd0 in ?? () #4 0x00002aaaabe7d12c in ?? () #5 0x00022aaa00000003 in ?? () #6 0x00002aaaabe7d0aa in ?? () #7 0x01000002abe7cff0 in ?? () #8 0x00002aaaabe7d02c in ?? () #9 0x0100000000000001 in ?? () #10 0x00000000014388e0 in ?? () #11 0x00007fff00000001 in ?? () #12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, F=0x14024e0, ArgValues=@0x7fffffffe050) at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 #13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain (this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 #14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398, envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 And a backtrace after this patch: Program received signal SIGSEGV, Segmentation fault. 0x00002aaaabe7d1a8 in baz () (gdb) bt #0 0x00002aaaabe7d1a8 in baz () #1 0x00002aaaabe7d12c in bar () #2 0x00002aaaabe7d0aa in foo () #3 0x00002aaaabe7d02c in main () #4 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70, F=0x14024e0, ArgValues=...) at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395 #5 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain (this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377 #6 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8, envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208 llvm-svn: 82418
* Add EngineBuilder to ExecutionEngine in favor of the five optional argument ↵Reid Kleckner2009-07-181-9/+15
| | | | | | | | EE::create(). Also a test commit. llvm-svn: 76276
* Match declaration to definition.Daniel Dunbar2009-07-121-1/+1
| | | | llvm-svn: 75440
* Add an option to allocate JITed global data separately from code. ByJeffrey Yasskin2009-07-081-6/+15
| | | | | | | | | | | | | | default, this option is not enabled to support clients who rely on this behavior. Fixes http://llvm.org/PR4483 A patch to allocate additional memory for globals after we run out is forthcoming. Patch by Reid Kleckner! llvm-svn: 75059
* Add a JITEventListener interface that gets called back when a new function isJeffrey Yasskin2009-06-251-3/+14
| | | | | | | | | 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
* Fix new CodeEmitter stuff to follow LLVM codying style. Patch by Aaron GrayBruno Cardoso Lopes2009-06-011-1/+1
| | | | llvm-svn: 72697
* First patch in the direction of splitting MachineCodeEmitter in two subclasses:Bruno Cardoso Lopes2009-05-301-3/+3
| | | | | | JITCodeEmitter and ObjectCodeEmitter. No functional changes yet. Patch by Aaron Gray llvm-svn: 72631
* Allow the JIT ExecutionEngine to report details about the generated machine ↵Argyrios Kyrtzidis2009-05-181-3/+8
| | | | | | | | | | code. Introduce a new class (MachineCodeInfo) that the JIT can fill in with details. Right now, just the address and the size of the machine code are reported. Patch by Evan Phoenix! llvm-svn: 72040
* Instead of passing in an unsigned value for the optimization level, use an enum,Bill Wendling2009-04-291-3/+5
| | | | | | | which better identifies what the optimization is doing. And is more flexible for future uses. llvm-svn: 70440
* The second part of the change from -fast to -O#. This changes the JIT to acceptBill Wendling2009-04-291-4/+4
| | | | | | | an optimization level instead of a simple boolean telling it to generate code "fast" or the other type of "fast". llvm-svn: 70347
* Add support to the JIT for true non-lazy operation. When a call to a functionNate Begeman2009-02-181-11/+18
| | | | | | | | | | | | | | | | | | | | that has not been JIT'd yet, the callee is put on a list of pending functions to JIT. The call is directed through a stub, which is updated with the address of the function after it has been JIT'd. A new interface for allocating and updating empty stubs is provided. Add support for removing the ModuleProvider the JIT was created with, which would otherwise invalidate the JIT's PassManager, which is initialized with the ModuleProvider's Module. Add support under a new ExecutionEngine flag for emitting the infomration necessary to update Function and GlobalVariable stubs after JITing them, by recording the address of the stub and the name of the GlobalValue. This allows code to be copied from one address space to another, where libraries may live at different virtual addresses, and have the stubs updated with their new correct target addresses. llvm-svn: 64906
* Split the locking out of JIT::runJITOnFunction so that callersDan Gohman2009-02-061-2/+3
| | | | | | | that already hold the lock can call an entry point that doesn't re-acquire the lock. llvm-svn: 63965
* Add support for deleting a module provider from a JIT in such a way that it ↵Nate Begeman2009-01-231-0/+9
| | | | | | does not cause the owned module to be fully materialized. llvm-svn: 62864
* Handle weak_extern in the JIT. This fixesDan Gohman2009-01-051-1/+6
| | | | | | | | SingleSource/UnitTests/2007-04-25-weak.c in JIT mode. The test now passes on systems which are able to produce a correct reference output to compare with. llvm-svn: 61674
* Support for allocation of TLS variables in the JIT. Allocation of a globalNicolas Geoffray2008-10-251-0/+6
| | | | | | | | variable is moved to the execution engine. The JIT calls the TargetJITInfo to allocate thread local storage. Currently, only linux/x86 knows how to allocate thread local global variables. llvm-svn: 58142
* Add new parameter Fast to createJIT to enable the fast codegen path.Evan Cheng2008-08-081-4/+5
| | | | llvm-svn: 54523
* Trim #includes.Dan Gohman2008-08-051-1/+0
| | | | llvm-svn: 54350
* Correct a comment.Dan Gohman2008-07-031-1/+1
| | | | llvm-svn: 53064
* Fix a couple issues with the JIT and multiple modules:Nate Begeman2008-05-211-1/+5
| | | | | | | | | | | | 1. The "JITState" object creates a PassManager with the ModuleProvider that the jit is created with. If the ModuleProvider is removed and deleted, the PassManager is invalid. 2. The Global maps in the JIT were not invalidated with a ModuleProvider was removed. This could lead to a case where the Module would be freed, and a new Module with Globals at the same addresses could return invalid results. llvm-svn: 51384
* Add explicit keywords.Dan Gohman2008-03-251-1/+1
| | | | llvm-svn: 48801
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* add a new ExecutionEngine::createJIT which can be used if you only want Chris Lattner2007-12-061-2/+9
| | | | | | | to create a JIT. This lets you specify JIT-specific configuration items like the JITMemoryManager to use. llvm-svn: 44647
* simplify creation of the interpreter, make ExecutionEngine ctor protected,Chris Lattner2007-12-061-1/+1
| | | | | | delete one ExecutionEngine ctor, minor cleanup. llvm-svn: 44646
* fit in 80 colsChris Lattner2007-04-201-2/+2
| | | | llvm-svn: 36288
* rename JIT::state -> JIT::jitstate to avoid shadowing ExecutionEngine::stateChris Lattner2007-04-201-1/+1
| | | | llvm-svn: 36286
* Deal with error handling better.Reid Spencer2007-03-031-1/+1
| | | | llvm-svn: 34887
* Fix PR1216 by cleaning up the ownership of JITResolver.Chris Lattner2007-02-241-0/+2
| | | | llvm-svn: 34552
* remove the intrinsiclowering hookChris Lattner2006-03-231-4/+2
| | | | llvm-svn: 26970
* Eliminate the dependency of ExecutionEngine on the JIT/Interpreter libraries.Chris Lattner2006-03-221-0/+4
| | | | | | Now you can build a tool with just the JIT or just the interpreter. llvm-svn: 26946
* For PR540:Reid Spencer2005-07-121-5/+22
| | | | | | | | | | | | | | | | | | | | | | This patch completes the changes for making lli thread-safe. Here's the list of changes: * The Support/ThreadSupport* files were removed and replaced with the MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard. The implementation of MutexGuard.h is now based on sys::Mutex which hides its implementation and makes it unnecessary to have the -NoSupport.h and -PThreads.h versions of ThreadSupport. * All places in ExecutionEngine that previously referred to "Mutex" now refer to sys::Mutex * All places in ExecutionEngine that previously referred to "MutexLocker" now refer to MutexGuard (this is frivolous but I believe the technically correct name for such a class is "Guard" not a "Locker"). These changes passed all of llvm-test. All we need now are some test cases that actually use multiple threads. llvm-svn: 22404
* Remove trailing whitespaceMisha Brukman2005-04-211-4/+4
| | | | llvm-svn: 21422
* Add accessorChris Lattner2004-11-201-0/+4
| | | | llvm-svn: 18030
* Implement ExecutionEngine::freeMachineCodeForFunction()Misha Brukman2004-11-071-0/+5
| | | | llvm-svn: 17601
* Pass around IntrinsicLowering instances as appropriate.Chris Lattner2003-12-281-2/+4
| | | | | | Reimplement the Interpreters implementation of va_* to be more direct. llvm-svn: 10627
* No longer run atExit functions from run()Chris Lattner2003-12-261-7/+2
| | | | | | | rename run to runFunction Genericize the runFunction code a little bit, though it still stinks llvm-svn: 10610
* Implement PR135, lazy emission of global variablesChris Lattner2003-12-201-0/+10
| | | | llvm-svn: 10549
* Cleanup the JIT as per PR176. This renames the VM class to JIT, and merges theChris Lattner2003-12-201-0/+93
VM.cpp and JIT.cpp files into JIT.cpp. This also splits some nasty code out into TargetSelect.cpp so that people hopefully won't notice it. :) llvm-svn: 10544
OpenPOWER on IntegriCloud