Commit Graph

1005 Commits

Author SHA1 Message Date
Jay Foad bcbdbfb345 Fix http://llvm.org/PR6028, an assertion failure when an UndefValue of
integer type is used.

llvm-svn: 93509
2010-01-15 08:32:58 +00:00
Chris Lattner 25963c6113 "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!

llvm-svn: 93079
2010-01-09 22:27:07 +00:00
Benjamin Kramer d2564e3afb Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Benjamin Kramer a81a6dff0d Convert a ton of simple integer type equality tests to the new predicate.
llvm-svn: 92760
2010-01-05 20:07:06 +00:00
Benjamin Kramer ccce8bae14 Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
llvm-svn: 92726
2010-01-05 13:12:22 +00:00
David Greene 1df14c41b5 These should probably be errs().
llvm-svn: 92673
2010-01-05 01:53:59 +00:00
David Greene 0967d2df4a Change errs() to dbgs().
llvm-svn: 92621
2010-01-05 01:27:39 +00:00
David Greene 80c1cfb083 Change errs() to dbgs().
llvm-svn: 92618
2010-01-05 01:27:26 +00:00
David Greene 8121a81806 Change errs() to dbgs().
llvm-svn: 92616
2010-01-05 01:27:23 +00:00
David Greene 2baba9643c Change errs() to dbgs().
llvm-svn: 92562
2010-01-05 01:23:38 +00:00
David Greene 85814ac1b7 Change errs() to dbgs().
llvm-svn: 92561
2010-01-05 01:23:36 +00:00
David Greene 1c10c25354 Change errs() to dbgs().
llvm-svn: 92560
2010-01-05 01:23:34 +00:00
Bill Wendling 9bea533c8e Remove dead store and simplify code.
llvm-svn: 92191
2009-12-28 01:53:00 +00:00
Jeffrey Yasskin 6523429779 Partially revert r91626. Materializing extra functions to determine whether
they're available_externally broke VMKit, which was relying on the fact that
functions would only be materialized when they were first called.  We'll have
to wait for http://llvm.org/PR5737 to really fix this.

I also added a test for one of the F->isDeclaration() calls which wasn't
covered by anything else in the test suite.

llvm-svn: 91943
2009-12-22 23:47:23 +00:00
Jeffrey Yasskin ad46e4416b Fix a crash in JIT::recompileAndRelinkFunction(). It doesn't pass the MCI
argument to runJITOnFunction(), which caused a null pointer dereference at
every call.

Patch by Gianluca Guida!

llvm-svn: 91939
2009-12-22 23:18:18 +00:00
Jeffrey Yasskin 2b73a4e90f Don't codegen available_externally functions. Fixes http://llvm.org/PR5735.
llvm-svn: 91626
2009-12-17 21:35:29 +00:00
Jeffrey Yasskin e0d8e14e11 Change indirect-globals to use a dedicated allocIndirectGV. This lets us
remove start/finishGVStub and the BufferState helper class from the
MachineCodeEmitter interface.  It has the side-effect of not setting the
indirect global writable and then executable on ARM, but that shouldn't be
necessary.

llvm-svn: 91464
2009-12-15 22:42:46 +00:00
Chris Lattner 45d040bd85 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Eric Christopher d5218331f7 Formatting.
llvm-svn: 91377
2009-12-15 00:40:55 +00:00
Jeffrey Yasskin 8c17e6de2b Reinstate r91208 to fix available_externally linkage for globals, with
nlewycky's fix to add -rdynamic so the JIT can look symbols up in Linux builds
of the JITTests binary.

llvm-svn: 91250
2009-12-13 20:30:32 +00:00
Jeffrey Yasskin 9ad6ba3766 Revert r91208. Something on Linux prevents the JIT from looking up a symbol
defined in the test, and I don't have time tonight to figure it out.

llvm-svn: 91209
2009-12-12 06:18:46 +00:00
Jeffrey Yasskin 2d2dcdcbf7 Fix available_externally linkage for globals. It's probably still not
supported by emitGlobals, but I don't have a test case for that.

llvm-svn: 91208
2009-12-12 05:58:14 +00:00
Torok Edwin 12b8a63e13 Comparing std::string with NULL is a bad idea, so just check whether its empty.
This code was crashing always with oprofile enabled, since it tried to create a StringRef
out of NULL, which run strlen on NULL.

llvm-svn: 91046
2009-12-10 10:01:47 +00:00
Jeffrey Yasskin fc7384d366 Fix the OProfileJITEventListener for StringRef being returned from debug info.
llvm-svn: 90813
2009-12-07 22:32:38 +00:00
Jeffrey Yasskin f2ad571443 * Move stub allocation inside the JITEmitter, instead of exposing a
way for each TargetJITInfo subclass to allocate its own stubs. This
means stubs aren't as exactly-sized anymore, but it lets us get rid of
TargetJITInfo::emitFunctionStubAtAddr(), which lets ARM and PPC
support the eager JIT, fixing http://llvm.org/PR4816.

* Rename the JITEmitter's stub creation functions to describe the kind
of stub they create. So far, all of them create lazy-compilation
stubs, but they sometimes get used when far-call stubs are needed.
Fixing http://llvm.org/PR5201 will involve fixing this.

llvm-svn: 89715
2009-11-23 23:35:19 +00:00
Jeffrey Yasskin 19b48370fb Allow more than one stub to be being generated at the same time.
It's probably better in the long run to replace the
indirect-GlobalVariable system. That'll be done after a subsequent
patch.

llvm-svn: 89708
2009-11-23 22:49:00 +00:00
Jeffrey Yasskin 34fb6838bc Try to fix JITTest.FarCallToKnownFunction on ARM and PPC.
llvm-svn: 89410
2009-11-19 23:42:58 +00:00
Nick Lewycky 41ee792832 Fix passing of float arguments through ffi.
llvm-svn: 89198
2009-11-18 05:43:15 +00:00
Eric Christopher 700d08e18d Add ability to set code model within the execution engine builders
and creation interfaces.

llvm-svn: 89151
2009-11-17 21:58:16 +00:00
Nick Lewycky 7efd07fd9d Fail less mysteriously; inform the user that their LLVM was not built with
libffi support and that the interpreter can't call external functions without
it. Patch by Timo Juhani Lindfors! Fixes PR5466.

llvm-svn: 89062
2009-11-17 07:52:09 +00:00
Jeffrey Yasskin 10d3604a9e Make X86-64 in the Large model always emit 64-bit calls.
The large code model is documented at
http://www.x86-64.org/documentation/abi.pdf and says that calls should
assume their target doesn't live within the 32-bit pc-relative offset
that fits in the call instruction.

To do this, we turn off the global-address->target-global-address
conversion in X86TargetLowering::LowerCall(). The first attempt at
this broke the lazy JIT because it can separate the movabs(imm->reg)
from the actual call instruction. The lazy JIT receives the address of
the movabs as a relocation and needs to record the return address from
the call; and then when that call happens, it needs to patch the
movabs with the newly-compiled target. We could thread the call
instruction into the relocation and record the movabs<->call mapping
explicitly, but that seems to require at least as much new
complication in the code generator as this change.

To fix this, we make lazy functions _always_ go through a call
stub. You'd think we'd only have to force lazy calls through a stub on
difficult platforms, but that turns out to break indirect calls
through a function pointer. The right fix for that is to distinguish
between calls and address-of operations on uncompiled functions, but
that's complex enough to leave for someone else to do.

Another attempt at this defined a new CALL64i pseudo-instruction,
which expanded to a 2-instruction sequence in the assembly output and
was special-cased in the X86CodeEmitter's emitInstruction()
function. That broke indirect calls in the same way as above.

This patch also removes a hack forcing Darwin to the small code model.
Without far-call-stubs, the small code model requires things of the
JITMemoryManager that the DefaultJITMemoryManager can't provide.

Thanks to echristo for lots of testing!

llvm-svn: 88984
2009-11-16 22:41:33 +00:00
Benjamin Kramer 8c19a8f17b Implement DISABLE_INLINE for MSVC. This required changing the position in all
forward declaration and patching tblgen to emit it right. Patch by Amine Khaldi!

llvm-svn: 88798
2009-11-14 16:37:18 +00:00
Eric Christopher cb5e227373 Use stubs when we have them, otherwise use code we already have,
otherwise create a stub.

Add a test to make sure we don't create extraneous stubs.

llvm-svn: 86941
2009-11-12 03:12:18 +00:00
Eric Christopher ebbfbeef7d Fix typo, cleanup whitespace.
llvm-svn: 86917
2009-11-12 01:06:08 +00:00
Jeffrey Yasskin 8483f12ac5 Remove dlsym stubs, with Nate Begeman's permission.
llvm-svn: 86606
2009-11-09 22:34:19 +00:00
Daniel Dunbar dc3fcfc0d0 Remove ByteswapSCANFResults, it is dead.
llvm-svn: 86458
2009-11-08 09:46:57 +00:00
Nick Lewycky e0e20c2b90 We don't need to byteswap, the interpreter assumes the program is running
native anyways. This fixes a crash using %d and similar in a scanf statement.

llvm-svn: 86440
2009-11-08 05:45:04 +00:00
Nick Lewycky 439fb6fb0e Fix the interpreter to not crash due to zeroext/signext
llvm-svn: 86428
2009-11-08 00:45:29 +00:00
Jeffrey Yasskin db5f24ce77 Make the need-stub variables accurate and consistent. In the case of
MachineRelocations, "stub" always refers to a far-call stub or a
load-a-faraway-global stub, so this patch adds "Far" to the term. (Other stubs
are used for lazy compilation and dlsym address replacement.) The variable was
also inconsistent between the positive and negative sense, and the positive
sense ("NeedStub") was more demanding than is accurate (since a nearby-enough
function can be called directly even if the platform often requires a stub).
Since the negative sense causes double-negatives, I switched to
"MayNeedFarStub" globally.

llvm-svn: 86363
2009-11-07 08:51:52 +00:00
Jeffrey Yasskin ba78dcd90d Give the JITResolver a direct pointer to its JITEmitter, and use that instead
of going through the global TheJIT variable.  This makes it easier to use
features of JITEmitter that aren't in JITCodeEmitter for fixing PR5201.

llvm-svn: 86305
2009-11-07 00:00:10 +00:00
Benjamin Kramer 5e1db97573 Fix MSVC build.
llvm-svn: 85505
2009-10-29 12:55:32 +00:00
Chris Lattner 0c778f70e9 add interpreter support for indirect goto / blockaddress. The interpreter
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
2009-10-29 05:26:09 +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 e3e08e0f90 Fix OProfileJITEventListener after r85182.
llvm-svn: 85192
2009-10-27 01:06:51 +00:00
Jeffrey Yasskin bf43f6543d Automatically do the equivalent of freeMachineCodeForFunction(F) when F is
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
2009-10-27 00:03:05 +00:00
Victor Hernandez de5ad42aa1 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Chandler Carruth 56869f22c4 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.

llvm-svn: 85086
2009-10-26 01:35:46 +00:00
Chris Lattner f4c2a9f02a fix PR5186: the JIT shouldn't try to codegen available_externally
functions it should just look them up like declarations.

llvm-svn: 85077
2009-10-25 23:06:42 +00:00
Jeffrey Yasskin d0fc8f809a Fix http://llvm.org/PR4822: allow module deletion after a function has been
compiled.

When functions are compiled, they accumulate references in the JITResolver's
stub maps. This patch removes those references when the functions are
destroyed.  It's illegal to destroy a Function when any thread may still try to
call its machine code.

This patch also updates r83987 to use ValueMap instead of explicit CallbackVHs
and fixes a couple "do stuff inside assert()" bugs from r84522.

llvm-svn: 84975
2009-10-23 22:37:43 +00:00
Victor Hernandez 8acf2956b8 Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
llvm-svn: 84969
2009-10-23 21:09:37 +00:00