Commit Graph

878 Commits

Author SHA1 Message Date
Dan Gohman
a3ac0c105d Reapply r57340. VMKit does not presently rely on materializeFunction
being called with the lock released, and this fixes a race condition
in the JIT as used by lli.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64997 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 02:40:15 +00:00
Nate Begeman
d6b7a242d3 Add support to the JIT for true non-lazy operation. When a call to a function
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 08:31:02 +00:00
Nicolas Geoffray
42cc8f140a On 64bit we may have a personality function which requires 64 bits to
be encoded.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64600 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 20:49:23 +00:00
Dan Gohman
21afcda544 Split the locking out of JIT::runJITOnFunction so that callers
that already hold the lock can call an entry point that doesn't
re-acquire the lock.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63965 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 21:25:08 +00:00
Chris Lattner
45f3683547 allow main to have any integer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 17:48:18 +00:00
Nick Lewycky
f9c5c5c7a2 Reapply patch from r62553, with a fix to avoid looking for an ffi.h that isn't
there.

This changes the interpreter to use libffi. After this patch, the interpreter
will barely be able to call any external functions if built on a system without
libffi installed (just enough to pass 'make check' really). But with libffi,
we can now call any function that isn't variadic or taking a struct or vector
parameter (but pointer to struct is fine). Patch by Alexei Svitkine!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63723 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 06:26:47 +00:00
Evan Cheng
2d5424d76a Fix PR3423: Link llvm on ARM EABI machines. Patch by Robert Schuster.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63489 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-01 06:42:27 +00:00
Nate Begeman
60789e419e Add support for deleting a module provider from a JIT in such a way that it does not cause the owned module to be fully materialized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62864 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 19:27:28 +00:00
Tanya Lattner
32aaee684d Revert r62553 and r62616 due to issues with portability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62777 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 20:09:20 +00:00
Chris Lattner
b67c958342 rename methods in System/Host to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 19:53:00 +00:00
Chris Lattner
1e42c5bdf5 add getPointerToGlobal to the C bindings, patch by Lennart Augustsson!
PR3364


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 18:11:10 +00:00
Duncan Sands
9c70819da0 Fix typo. Patch by Alexei Svitkine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62616 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 21:20:23 +00:00
Nick Lewycky
f514e2d28f Make the Interpreter use libffi if it's available. Patch from Alexei Svitkine!
This requires a rebuild of 'configure' itself. I will be committing that next, but
built with the wrong version of autoconf. Somebody who has the right one, please update
it.

As a side-note, because of the way autoconf works, all built tools will link against
libffi, not just lli. If you know how to fix this, please let me know ...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 00:51:40 +00:00
Chris Lattner
9029cb8363 don't assert and die on out of range (undefined) shifts. This fixes
PR3334.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 20:17:02 +00:00
Evan Cheng
4d544a2c80 Change isGVCompilationDisabled() semantics again. It should abort on any GV that's not constant whether it's "internal" or not. In a server / client environment, GV is returned in the same block of memory as code. However, the memory might not be writable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 19:14:49 +00:00
Mikhail Glushenkov
2388a588bd Registry.h should not depend on CommandLine.h.
Split Support/Registry.h into two files so that we have less to
recompile every time CommandLine.h is changed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62312 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:02:28 +00:00
Mikhail Glushenkov
5c1799b293 Delete trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 06:53:46 +00:00
Rafael Espindola
bb46f52027 Add the private linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 20:18:42 +00:00
Duncan Sands
ceb4d1aecb Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 20:38:59 +00:00
Misha Brukman
9b8f542e27 Removed trailing whitespace from Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 16:44:42 +00:00
Dan Gohman
d68a07650c Tidy up #includes, deleting a bunch of unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:59:02 +00:00
Evan Cheng
5951368409 Fix misplaced right parentheses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:17:04 +00:00
Dan Gohman
69f9378675 Handle weak_extern in the JIT. This fixes
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61674 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 05:32:42 +00:00
Evan Cheng
5788d1a169 Fix MachineCodeEmitter to use uintptr_t instead of intptr_t. This avoids some overflow issues. Patch by Thomas Jablin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 02:32:19 +00:00
Evan Cheng
369e02da1b Fix a bug introduced by r59265. If lazy compilation is disabled, return actual function ptr instead of ptr to stub if function is already compiled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 01:33:59 +00:00
Evan Cheng
77f86ad087 DisableGVCompilation should not abort on internal GlobalValue's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:31:49 +00:00
Chris Lattner
cdfc51ffe3 Make JIT::runFunction handle functions with non-C calling conventions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 08:00:11 +00:00
Nicolas Geoffray
67c8c4caba Implement support for JIT exceptions on X86_64. Relative offsets are
encoded on 32 bytes, and the personality function is not encoded as
relative.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59516 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 10:44:46 +00:00
Evan Cheng
704bff9e6c Always emit a function pointer as a pointer to the function stub (if there is one). This makes it possible to compare function pointer values in lazy compilation mode. This fixes PR3043.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 21:50:50 +00:00
Evan Cheng
e7c3551e6f Change binary dump format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59119 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 08:22:43 +00:00
Evan Cheng
e4d783d584 Comments and indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 23:26:16 +00:00
Evan Cheng
5594f120b8 Forgot these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58952 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 01:52:24 +00:00
Evan Cheng
fff484f192 Remove a InvalidateInstructionCache call with incorrect size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 08:15:39 +00:00
Evan Cheng
ce4a70bd76 Rename startFunctionStub to startGVStub since it's also used for GV non-lazy ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58897 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 08:02:53 +00:00
Evan Cheng
d7398c9b69 Rename isString -> isExternalSymbol; getString -> getExternalSymbol since these work on externsym machine relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 07:37:34 +00:00
Evan Cheng
ca66b08bc6 More debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58894 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 07:22:53 +00:00
Evan Cheng
366cf29ca5 More debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58868 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-07 22:30:29 +00:00
Evan Cheng
47c01a0099 Jump tables may be emitted by target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58835 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-07 09:02:17 +00:00
Evan Cheng
eb5d95a22d Improve JIT debugging outputs format consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-06 17:46:04 +00:00
Evan Cheng
6863fb033a Need a \n.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58788 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-06 01:18:29 +00:00
Evan Cheng
a7916f586d Undo 58778 but makes the binary dump prettier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 23:44:08 +00:00
Evan Cheng
5e136c0f37 Remove debug output that's not really useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 23:21:11 +00:00
Evan Cheng
c96a8e7df1 Rename isGVLazyPtr to isGVNonLazyPtr relocation. This represents Mac OS X
indirect gv reference. Please don't call it lazy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 01:50:32 +00:00
Evan Cheng
4e20c5c30b Debugging output tweak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58737 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 00:22:28 +00:00
Evan Cheng
b0b53491ef For some targets, it's not possible to place GVs in the same memory buffer as the MachineCodeEmitter allocated memory. Code and data has different read / write / execution privilege requirements.
This is a short term workaround. The current solution is for the JIT memory manager to manage code and data memory separately.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 09:30:48 +00:00
Evan Cheng
89687e3e4a 80 col violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 06:10:31 +00:00
Evan Cheng
9200605cd5 Silence a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 07:14:02 +00:00
Jim Grosbach
8fe95356dd Revert errant deletion. The target needs to be able to specify that it doesn't want the generic constant pool to be emitted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 23:44:39 +00:00
Evan Cheng
ef5784ef9b Let target resolve some relocation results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 23:54:46 +00:00
Jim Grosbach
bc6d876adf Support for constant islands in the ARM JIT.
Since the ARM constant pool handling supercedes the standard LLVM constant
pool entirely, the JIT emitter does not allocate space for the constants,
nor initialize the memory. The constant pool is considered part of the 
instruction stream.

Likewise, when resolving relocations into the constant pool, a hook into
the target back end is used to resolve from the constant ID# to the
address where the constant is stored.

For now, the support in the ARM emitter is limited to 32-bit integer. Future
patches will expand this to the full range of constants necessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 18:25:49 +00:00
Nicolas Geoffray
46fa139e26 Support for allocation of TLS variables in the JIT. Allocation of a global
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 15:41:43 +00:00
Oscar Fuentes
5c5b6dfd0e CMake: Turned some libraries into partially linked objects. Corrected
names of LLVMCore and ARMCodeGen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 02:51:53 +00:00
Nuno Lopes
cef7527a85 fix a tricky bug in the JIT global variable emitter, that was triggered when JITing a variable independently of a function. This lead to sharing memory memory between functions and GVs thus changing the value of a GV could change the code in execution. more details on the ML.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 11:42:16 +00:00
Nuno Lopes
c8ed902298 little optimization: reuse getPointerToGlobalIfAvailable(CGV) value in emitGlobals()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 10:04:52 +00:00
Mon P Wang
77fcca845e Revert r57340 move guard mutex in getPointerToFunction as this can cause
deadlock issues with java


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 18:07:10 +00:00
Mon P Wang
1c341c8462 Moved guard mutex upwards to guard materializing a function
in getPointerToFunction



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 01:47:42 +00:00
Dale Johannesen
23a98551ab Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 23:00:39 +00:00
Dale Johannesen
7111b02c73 Rename APFloat::convertToAPInt to bitcastToAPInt to
make it clearer what the function does.  No functional
change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 18:53:47 +00:00
Duncan Sands
4520dd2b7b Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 07:23:46 +00:00
Daniel Dunbar
489032a2b7 Unbreak build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 17:11:57 +00:00
Jim Grosbach
cce6c297c5 On Darwin ARM, memory needs special handling to do JIT. This patch expands
this handling to work properly for modifying stub functions, relocations
back to entry points after JIT compilation, etc..


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 16:17:20 +00:00
Dan Gohman
d735b8019b Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:45:36 +00:00
Nicolas Geoffray
dcb31e1790 Acquire the lock only when necessary. More precisely, do not acquire
the lock when calling a method which may materialize the llvm::Function.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 07:27:08 +00:00
Evan Cheng
18314dc741 Add runStaticConstructorsDestructors which runs ctors / dtors of a single module. Patch by David Chisnall.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 15:51:21 +00:00
Devang Patel
0598866c05 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Evan Cheng
446531e7bb Add DisableGVCompilation which forces the JIT to assert when it tries to allocate space for a GlobalVariable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56557 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 16:25:55 +00:00
Devang Patel
eaf42abab6 s/ParameterAttributes/Attributes/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:03:40 +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
Evan Cheng
bc4707a255 Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56303 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 07:54:21 +00:00
Anton Korobeynikov
19e861a4ff Make safer variant of alias resolution routine to be default
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 20:05:04 +00:00
Evan Cheng
252ddfbdbc MMI may be null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55626 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 08:14:01 +00:00
Nicolas Geoffray
d046fc61ac Add support for JIT exceptions on Darwin. Since we're dealing with libgcc,
whose darwin code was written after the ability to dynamically register frames,
we need to do special hacks to make things work.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 22:34:49 +00:00
Dan Gohman
b6e3d6ce70 Avoid a warning about isTargetNullPtr being unused in release builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 01:38:29 +00:00
Evan Cheng
a044dfcb5a Get rid of a couple of dynamic_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:28:12 +00:00
Nicolas Geoffray
2d450ebe18 Update the JIT exception writer to better mimic the codegen exception writer.
Also skip indirect encoding for platforms that ask for one: we direclty
write an address, not a pointer to the address.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19 14:48:14 +00:00
Nicolas Geoffray
a7ec87cd07 Register the frame register function when allocating the JIT,
so that lli works out of the box with -enable-eh.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 14:53:56 +00:00
Anton Korobeynikov
ffe31d7bf1 Move SLEB/ULEB size calculation routines from AsmPrinter to TargetAsmInfo. This makes JIT asmprinter-free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 12:57:46 +00:00
Dale Johannesen
50dd1d0280 Some fixes for x86-64 JIT. Make it use small code
model, except for external calls; this makes
addressing modes PC-relative.  Incomplete.

The assertion at the top of Emitter::runOnMachineFunction
was obviously bogus (always true) so I removed it.
If someone knows what the correct test should be to cover
all the various targets, please fix.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 23:46:25 +00:00
Gordon Henriksen
c13c4d6a1b Fix the LLVMCreateJITCompiler C binding.
Evan broke it in r54523 by adding a parameter in the implementation without
updating the header correspondingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 20:49:28 +00:00
Evan Cheng
502f20b17e Add new parameter Fast to createJIT to enable the fast codegen path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 08:11:34 +00:00
Dale Johannesen
dd947ea3c5 Rewrite JIT handling of GlobalVariables so they
are allocated in the same buffer as the code,
jump tables, etc.

The default JIT memory manager does not handle buffer
overflow well.  I didn't introduce this and I'm not
attempting to fix it here, but it is more likely to
be hit now since we're putting more stuff in the
buffer.  This affects one test that I know of so far,
MultiSource/Benchmarks/NPB-serial/is.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 01:30:15 +00:00
Dan Gohman
1eac4e0844 Use strcpy instead of sprintf here. This avoids a GCC 4.3 format-string
warning. There wasn't actually a problem here, because the contents of
the string are known.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 23:36:35 +00:00
Dan Gohman
8f613f30a7 Trim #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 15:32:23 +00:00
Evan Cheng
60b75f462e Fix for PR2578. Do not split off a block whose size is less than FreeRangeHeader::getMinBlockSize(). Patch by Damien.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 07:38:32 +00:00
Chris Lattner
663ceeb948 Add a new hidden option to the interpreter to cause it to print
out every volatile load and store.  This is useful for tracking 
down insane volatile memory bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 17:25:49 +00:00
Dan Gohman
eccfb6a165 Use empty() instead of size().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 17:52:43 +00:00
Dan Gohman
ce3c413e07 Correct a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 00:51:05 +00:00
Dan Gohman
2dad0250f6 Prune a few dependencies on MachineFunction.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52976 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 18:15:35 +00:00
Dan Gohman
4406604047 Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating
the need for a flavor operand, and add a new SDNode subclass,
LabelSDNode, for use with them to eliminate the need for a label id
operand.

Change instruction selection to let these label nodes through
unmodified instead of creating copies of them. Teach the MachineInstr
emitter how to emit a MachineInstr directly from an ISD label node.

This avoids the need for allocating SDNodes for the label id and
flavor value, as well as SDNodes for each of the post-isel label,
label id, and label flavor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 00:05:16 +00:00
Chris Lattner
18e0459837 Implement JIT support for global aliases, patch by David Chisnall!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 20:21:35 +00:00
Chris Lattner
bc52cada09 Switch the PPC backend and target-independent JIT to use the libsystem
InvalidateInstructionCache method instead of calling through
a hook on the JIT.  This is a host feature, not a target feature.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 17:18:44 +00:00
Dan Gohman
719de53742 Use back() instead of [size()-1].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:00:54 +00:00
Dan Gohman
933e51c5e3 Use static_cast instead of reinterpret_cast for casting void*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:17:03 +00:00
Gordon Henriksen
54227f6752 Add C binding for ExecutionEngine::addGlobalMapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 02:16:11 +00:00
Anton Korobeynikov
210539ebc4 Provide generic hooks for icache invalidation. Add PPC implementation.
Patch by Gary Benson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:30:05 +00:00
Evan Cheng
1b088f3310 Don't forget to initialize SymbolSearchingDisabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 16:49:02 +00:00
Chris Lattner
e846db6675 Add a new flag that disables symbol lookup with dlsym when set. This allows
a JIT client to completely control symbol lookup with the LazyFunctionCreator
interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 17:44:14 +00:00
Dan Gohman
ee335e35ac Add #includes to make some dependencies explicit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 20:40:06 +00:00
Nate Begeman
f049e07eb8 Fix a couple issues with the JIT and multiple modules:
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 16:34:48 +00:00
Dan Gohman
638e378f2c Fix ExecutionEngine's constant code to work properly when structs and arrays
will become first-class types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51293 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 03:20:09 +00:00