1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

990 Commits

Author SHA1 Message Date
Jeffrey Yasskin
f4d06414ec Don't codegen available_externally functions. Fixes http://llvm.org/PR5735.
llvm-svn: 91626
2009-12-17 21:35:29 +00:00
Jeffrey Yasskin
d50951dc1e 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
587962c667 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
3abcd3f41c Formatting.
llvm-svn: 91377
2009-12-15 00:40:55 +00:00
Jeffrey Yasskin
d06c7e46a2 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
f79c7c85f7 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
b34198b7ff 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
7879b5fae2 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
d9047c44e4 Fix the OProfileJITEventListener for StringRef being returned from debug info.
llvm-svn: 90813
2009-12-07 22:32:38 +00:00
Jeffrey Yasskin
0a0b21f8c5 * 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
ed6d1ce9ae 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
29eef4f15a Try to fix JITTest.FarCallToKnownFunction on ARM and PPC.
llvm-svn: 89410
2009-11-19 23:42:58 +00:00
Nick Lewycky
ac0e7c8aca Fix passing of float arguments through ffi.
llvm-svn: 89198
2009-11-18 05:43:15 +00:00
Eric Christopher
7a90b50fc6 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
f6d8788686 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
0f846dbb3e 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
e9ba686ab8 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
42c58d5ea6 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
1764cc3934 Fix typo, cleanup whitespace.
llvm-svn: 86917
2009-11-12 01:06:08 +00:00
Jeffrey Yasskin
7ad82ff8cf Remove dlsym stubs, with Nate Begeman's permission.
llvm-svn: 86606
2009-11-09 22:34:19 +00:00
Daniel Dunbar
c2a6a7dea5 Remove ByteswapSCANFResults, it is dead.
llvm-svn: 86458
2009-11-08 09:46:57 +00:00
Nick Lewycky
1909b23533 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
21dd3f31b0 Fix the interpreter to not crash due to zeroext/signext
llvm-svn: 86428
2009-11-08 00:45:29 +00:00
Jeffrey Yasskin
502d93267d 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
57d18d0d03 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
c2ed14cdb8 Fix MSVC build.
llvm-svn: 85505
2009-10-29 12:55:32 +00:00
Chris Lattner
9bc4a421e2 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
2d123f7740 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
1f331552d6 Fix OProfileJITEventListener after r85182.
llvm-svn: 85192
2009-10-27 01:06:51 +00:00
Jeffrey Yasskin
42aa2a2692 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
673c036bc7 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
766362c707 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
2f00168ed8 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
8ff8b897a5 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
8428eb5720 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
Benjamin Kramer
13aa437a5e Random include cleanup.
llvm-svn: 84898
2009-10-22 21:49:41 +00:00
Jeffrey Yasskin
7ed6722fc4 Fix OProfileJITEventListener after r84054 renamed CompileUnit to Scope.
llvm-svn: 84895
2009-10-22 20:57:35 +00:00
Nicolas Geoffray
7955fa8d35 Verify that the function and exception table have been allocated
before freeing them.

llvm-svn: 84859
2009-10-22 14:35:57 +00:00
Douglas Gregor
fecaeae94b De-bork CMake build
llvm-svn: 84744
2009-10-21 06:01:54 +00:00
Jeffrey Yasskin
4ea1de7bcf 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
Jeffrey Yasskin
c5bf1f8ad9 Move the Function*->allocated blocks map from the JITMemoryManager to the
JITEmitter.

I'm gradually making Functions auto-remove themselves from the JIT when they're
destroyed. In this case, the Function needs to be removed from the JITEmitter,
but the map recording which Functions need to be removed lived behind the
JITMemoryManager interface, which made things difficult.

This patch replaces the deallocateMemForFunction(Function*) method with a pair
of methods deallocateFunctionBody(void *) and deallocateExceptionTable(void *)
corresponding to the two startFoo/endFoo pairs.

llvm-svn: 84651
2009-10-20 18:13:21 +00:00
Jeffrey Yasskin
fdb36c1a29 Clean up the JITResolver stub/callsite<->function maps.
The JITResolver maps Functions to their canonical stubs and all callsites for
lazily-compiled functions to their target Functions. To make Function
destruction work, I'm going to need to remove all callsites on destruction, so
this patch also adds the reverse mapping for that.

There was an incorrect assumption in here that the only stub for a function
would be the one caused by needing to lazily compile it, while x86-64 far calls
and dlsym-stubs could also cause such stubs, but I didn't look for a test case
that the assumption broke.

This also adds DenseMapInfo<AssertingVH> so I can use DenseMaps instead of
std::maps.

llvm-svn: 84522
2009-10-19 18:49:59 +00:00
Devang Patel
72f708ec2f s/DebugLoc.CompileUnit/DebugLoc.Scope/g
s/DebugLoc.InlinedLoc/DebugLoc.InlinedAtLoc/g

llvm-svn: 84054
2009-10-13 23:28:53 +00:00
Jeffrey Yasskin
8a0bdbb7f3 Keep track of stubs that are created. This fixes PR5162 and probably PR4822 and
4406. Patch by Nick Lewycky!

llvm-svn: 84032
2009-10-13 21:32:57 +00:00
Jeffrey Yasskin
3eacbf419d Make the ExecutionEngine automatically remove global mappings on when their
GlobalValue is destroyed.  Function destruction still leaks machine code and
can crash on leaked stubs, but this is some progress.

llvm-svn: 83987
2009-10-13 17:42:08 +00:00
Jeffrey Yasskin
7edab17bef ExecutionEngine::clearGlobalMappingsFromModule failed to remove reverse
mappings, which could cause errors and assert-failures.  This patch fixes that,
adds a test, and refactors the global-mapping-removal code into a single place.

llvm-svn: 83678
2009-10-09 22:10:27 +00:00
Duncan Sands
2400ad7236 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.

llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Devang Patel
2fb4294e97 Update processDebugLoc() to handle requests to process debug info, before and after emitting instructions.
llvm-svn: 83364
2009-10-06 03:04:58 +00:00
Jeffrey Yasskin
4b011e6a51 Fix http://llvm.org/PR5116 by rolling back r60822. This passes `make unittests
check-lit` on both x86-64 Linux and x86-32 Darwin.

llvm-svn: 83353
2009-10-06 00:35:55 +00:00
Chris Lattner
a3cf123e86 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.

llvm-svn: 83297
2009-10-05 05:54:46 +00:00