1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

1181 Commits

Author SHA1 Message Date
Dylan Noblesmith
93071813a2 ExecutionEngine: add missing file
From revision 131025.

llvm-svn: 131029
2011-05-06 22:20:09 +00:00
Dylan Noblesmith
1560f431cc ExecutionEngine: move createJIT() definition
As an ExecutionEngine class function, its definition
really belongs in ExecutionEngine.cpp, not JIT.cpp.

llvm-svn: 131027
2011-05-06 22:07:14 +00:00
Dylan Noblesmith
a12e687660 ExecutionEngine: push TargetMachine creation into clients
In particular, into EngineBuilder. This should only impact
the private API between the EE and EB classes, not external
clients, since JITCtor and MCJITCtor are both protected members.

llvm-svn: 131026
2011-05-06 22:06:22 +00:00
Dylan Noblesmith
763e1abfba ExecutionEngine: fix JIT/MCJIT selectTarget() duplication
This prepares for making JITCtor/MCJITCtor take a
TargetMachine* directly from clients like EngineBuilder.

llvm-svn: 131025
2011-05-06 22:05:43 +00:00
Douglas Gregor
81608aacfe Fix a C++0x portability issue with std::make_pair. Explicitly providing template arguments no longer works when the call arguments are lvalues.
llvm-svn: 130513
2011-04-29 16:57:12 +00:00
Chandler Carruth
bb0599c1f4 Fix the last -Wnon-pod-memset I'm seeing. This is benign, but appears
a bit more sinister as the memset doesn't do what the constructor does.
There seems to be a cleaner solution than a cast here though, instead we
can point the memset destination into the union its actually trying to
clear.

An alternative is to point to the Untyped member of this union. Review
appreciated, and if that is cleaner I'm happy to switch. All of these
should be functionally equivalent to the original code.

llvm-svn: 130395
2011-04-28 08:37:18 +00:00
Jay Foad
c146569beb Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Eric Christopher
3c8665787d 80-col fix.
llvm-svn: 129973
2011-04-22 03:07:06 +00:00
Chris Lattner
0304b82f80 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00
Jim Grosbach
222045c063 MCJIT relocation resolution.
llvm-svn: 129445
2011-04-13 15:28:10 +00:00
Jay Foad
b215137166 Like the coding standards say, do not use "using namespace std".
llvm-svn: 129435
2011-04-13 12:46:01 +00:00
Jim Grosbach
ae80577a24 MCJIT lazy relocation resolution and symbol address re-assignment.
Add handling for tracking the relocations on symbols and resolving them.
Keep track of the relocations even after they are resolved so that if
the RuntimeDyld client moves the object, it can update the address and any
relocations to that object will be updated.

For our trival object file load/run test harness (llvm-rtdyld), this enables
relocations between functions located in the same object module. It should
be trivially extendable to load multiple objects with mutual references.

As a simple example, the following now works (running on x86_64 Darwin 10.6):


$ cat t.c
int bar() {
  return 65;
}

int main() {
  return bar();
}
$ clang t.c -fno-asynchronous-unwind-tables -o t.o -c
$ otool -vt t.o
t.o:
(__TEXT,__text) section
_bar:
0000000000000000  pushq %rbp
0000000000000001  movq  %rsp,%rbp
0000000000000004  movl  $0x00000041,%eax
0000000000000009  popq  %rbp
000000000000000a  ret
000000000000000b  nopl  0x00(%rax,%rax)
_main:
0000000000000010  pushq %rbp
0000000000000011  movq  %rsp,%rbp
0000000000000014  subq  $0x10,%rsp
0000000000000018  movl  $0x00000000,0xfc(%rbp)
000000000000001f  callq 0x00000024
0000000000000024  addq  $0x10,%rsp
0000000000000028  popq  %rbp
0000000000000029  ret
$ llvm-rtdyld t.o -debug-only=dyld ; echo $?
Function sym: '_bar' @ 0
Function sym: '_main' @ 16
Extracting function: _bar from [0, 15]
    allocated to 0x100153000
Extracting function: _main from [16, 41]
    allocated to 0x100154000
Relocation at '_main' + 16 from '_bar(Word1: 0x2d000000)
Resolving relocation at '_main' + 16 (0x100154010) from '_bar (0x100153000)(pcrel, type: 2, Size: 4).
loaded '_main' at: 0x100154000
65
$

llvm-svn: 129388
2011-04-12 21:20:41 +00:00
Jim Grosbach
17ca2afa04 Tidy up a bit now that we're using the MemoryManager interface.
llvm-svn: 129328
2011-04-12 00:23:32 +00:00
Nick Lewycky
75e67d4dc2 Just because a GlobalVariable's initializer is [N x { i32, void ()* }] doesn't
mean that it has to be ConstantArray of ConstantStruct. We might have
ConstantAggregateZero, at either level, so don't crash on that.

Also, semi-deprecate the sentinal value. The linker isn't aware of sentinals so
we end up with the two lists appended, each with their "sentinals" on them.
Different parts of LLVM treated sentinals differently, so make them all just
ignore the single entry and continue on with the rest of the list.

llvm-svn: 129307
2011-04-11 22:11:20 +00:00
Benjamin Kramer
5cf358f270 Make error message more useful.
llvm-svn: 129209
2011-04-09 10:10:35 +00:00
Jim Grosbach
5eabe82352 Workaround g++ 4.2.1 warning diagnostic false positive.
llvm-svn: 129149
2011-04-08 21:11:20 +00:00
Jim Grosbach
bf66067333 Refactor MCJIT 32-bit section loading.
Teach 32-bit section loading to use the Memory Manager interface, just like
the 64-bit loading does. Tidy up a few other things here and there.

llvm-svn: 129138
2011-04-08 17:31:24 +00:00
Nick Lewycky
ac1fe011df llvm.global_[cd]tor is defined to be either external, or appending with an array
of { i32, void ()* }. Teach the verifier to verify that, deleting copies of
checks strewn about.

llvm-svn: 129128
2011-04-08 07:30:21 +00:00
Jim Grosbach
3b01595efd tidy up.
llvm-svn: 129032
2011-04-06 22:13:52 +00:00
Nick Lewycky
505e20340f Fix comment to use llvm 2.x syntax.
llvm-svn: 129025
2011-04-06 20:38:44 +00:00
Jim Grosbach
8a1f712b53 RuntimeDyld should use the memory manager API.
Start teaching the runtime Dyld interface to use the memory manager API
for allocating space. Rather than mapping directly into the MachO object,
we extract the payload for each object and copy it into a dedicated buffer
allocated via the memory manager. For now, just do Segment64, so this works
on x86_64, but not yet on ARM.

llvm-svn: 128973
2011-04-06 01:11:05 +00:00
Chandler Carruth
4e7b7e7732 Make the virtual destructor out-of-line so we have a key function.
llvm-svn: 128964
2011-04-05 23:54:31 +00:00
Jim Grosbach
5530392fa3 Remove extraneous 'return'.
llvm-svn: 128959
2011-04-05 23:39:08 +00:00
Jim Grosbach
03cd766c1d Add missing file from r128851.
llvm-svn: 128856
2011-04-04 23:20:40 +00:00
Jim Grosbach
b4624c7d62 Layer the memory manager between the JIT and the runtime Dyld.
The JITMemory manager references LLVM IR constructs directly, while the
runtime Dyld works at a lower level and can handle objects which may not
originate from LLVM IR. Introduce a new layer for the memory manager to
handle the interface between them. For the MCJIT, this layer will be almost
entirely simply a call-through w/ translation between the IR objects and
symbol names.

llvm-svn: 128851
2011-04-04 23:04:39 +00:00
Jim Grosbach
30c2338560 Instantiate a JITMemoryManager for MCJIT Dyld
llvm-svn: 128485
2011-03-29 21:03:05 +00:00
Jim Grosbach
f13cc12ddb Runtime dylib simple ARM 24-bit branch relocation support.
llvm-svn: 128184
2011-03-23 23:35:17 +00:00
Jim Grosbach
ef5b20cd6d Split out relocation resolution into target-specific bits.
llvm-svn: 128173
2011-03-23 22:06:06 +00:00
Jim Grosbach
f7d5f8a831 Fix double-free of Module.
The ExecutionEngine constructor already added the module, so there's no
need to call addModule() directly. Doing so causes a double-free of the
Module at program termination.

llvm-svn: 128171
2011-03-23 21:35:02 +00:00
Jim Grosbach
451293fb55 Start of relocation resolution for the runtime dyld library.
llvm-svn: 128161
2011-03-23 19:52:00 +00:00
Jim Grosbach
a64f8bf9d5 Make sure to report any errors from the runtime dyld.
llvm-svn: 128160
2011-03-23 19:51:34 +00:00
Jim Grosbach
c703587869 Tidy up.
llvm-svn: 128096
2011-03-22 18:22:27 +00:00
Jim Grosbach
92735f5775 Add missing file from previous commit.
llvm-svn: 128095
2011-03-22 18:21:14 +00:00
Jim Grosbach
e941bce506 Propogate the error message, not just the error state.
llvm-svn: 128094
2011-03-22 18:19:42 +00:00
Jim Grosbach
c11fb437b2 Add simple arg passing to MC-JIT and support for exit() call.
Support argument passing simple, common, prototypes directly. More
complicated scenarios will require building up a stub function, which the
MC-JIT isn't set up to handle yet.

Add Intercept.cpp, which is just a copy from ExecutionEngine/JIT for now,
to handle looking looking up external symbol names. This probably more
properly belongs as part of RuntimeDyld. It'll migrate there as things
flesh out more fully.

llvm-svn: 128090
2011-03-22 18:05:27 +00:00
Jim Grosbach
07850c57b2 Trailing whitespace.
llvm-svn: 128086
2011-03-22 15:21:58 +00:00
Eric Christopher
7497603688 Fix comment in header.
llvm-svn: 128077
2011-03-22 08:49:56 +00:00
Jim Grosbach
e19f7261d5 Hook up the MCJIT to the RuntimeDyld library.
Lots of cleanup to make the interfaces prettier, use the JITMemoryManager,
handle multiple functions and modules, etc.. This gets far enough that
the MCJIT compiles and runs code, though.

llvm-svn: 128052
2011-03-22 01:06:42 +00:00
Jim Grosbach
454b60d042 Initialize HasError.
llvm-svn: 128049
2011-03-22 00:42:19 +00:00
Oscar Fuentes
a2dca8505f Build the new RuntimeDyld library.
llvm-svn: 128035
2011-03-21 23:07:53 +00:00
Jim Grosbach
9ad8d572e9 Library-ize the dyld components of llvm-rtdyld.
Move the dynamic linking functionality of the llvm-rtdyld program into an
ExecutionEngine support library. Update llvm-rtdyld to just load an object
file into memory, use the library to process it, then run the _main()
function, if one is found.

llvm-svn: 128031
2011-03-21 22:15:52 +00:00
Jim Grosbach
89580295e7 Silence a warning.
llvm-svn: 127918
2011-03-18 22:50:49 +00:00
Jim Grosbach
75deb766b9 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
Jim Grosbach
c68c99f640 Tidy up. Whitespace and 80 column.
llvm-svn: 127721
2011-03-16 01:21:55 +00:00
Jim Grosbach
611d473405 Trailing whitespae.
llvm-svn: 127691
2011-03-15 20:25:54 +00:00
Eric Christopher
d779c4197b Support unregistering exception frames of functions when they are removed.
Patch by Johannes Schaub!

Fixes PR8548

llvm-svn: 127047
2011-03-04 23:37:39 +00:00
Oscar Fuentes
6e5d344a2e Move library stuff out of the toplevel CMakeLists.txt file.
llvm-svn: 125968
2011-02-18 22:06:14 +00:00
Oscar Fuentes
7f369d093e Fix libffi usage when it is on a custom path.
llvm-svn: 124486
2011-01-28 16:49:05 +00:00
Oscar Fuentes
f249fb75f1 Use the paths to libffi's header and library even when no custom
location was stated with FFI_INCLUDE_DIR/FFI_LIBRARY_DIR.

llvm-svn: 124449
2011-01-27 22:58:34 +00:00
Oscar Fuentes
da69ba084d Handles libffi on the CMake build.
Patch by arrowdodger!

llvm-svn: 123976
2011-01-21 15:42:54 +00:00
Anton Korobeynikov
cf5967630b Rename TargetFrameInfo into TargetFrameLowering. Also, put couple of FIXMEs and fixes here and there.
llvm-svn: 123170
2011-01-10 12:39:04 +00:00
Benjamin Kramer
009451fddc Remove unneeded zero arrays.
llvm-svn: 120910
2010-12-04 15:28:22 +00:00
Michael J. Spencer
d5ec932c3a Merge System into Support.
llvm-svn: 120298
2010-11-29 18:16:10 +00:00
Jay Foad
7378352505 PR5207: change APInt::doubleToBits() and APInt::floatToBits() to be
static methods that return a new APInt.

llvm-svn: 120261
2010-11-28 21:04:48 +00:00
Anton Korobeynikov
ce676f96e1 Move getInitialFrameState() to TargetFrameInfo
llvm-svn: 119754
2010-11-18 23:25:52 +00:00
Daniel Dunbar
aff668a681 MCJIT: Stub out MCJIT implementation, still doesn't do anything useful.
llvm-svn: 119509
2010-11-17 16:06:43 +00:00
Daniel Dunbar
7817c0b45f 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
fef193dc12 JIT: More nitty style tweakage, aka territory marking.
llvm-svn: 118973
2010-11-13 02:48:57 +00:00
Daniel Dunbar
a34e9e580c Fix some more 80-col violas.
llvm-svn: 118959
2010-11-13 00:55:45 +00:00
Daniel Dunbar
2b1fd6592e Fix 80-col violation / non-sensicalness.
llvm-svn: 118958
2010-11-13 00:55:42 +00:00
Chandler Carruth
7dd652736f Move the remaining attribute macros to systematic names based on the attribute
name and prefixed with 'LLVM_'.

llvm-svn: 117203
2010-10-23 08:40:19 +00:00
Duncan Sands
acbc34528c Fix the cleanup process of exception information in JIT. Now JIT
deregisters registered by it FDE structures allowing consecutive
JIT runs to succeed.  Patch by Yuri.  Fixes PR8285.

llvm-svn: 117004
2010-10-21 08:57:29 +00:00
Michael J. Spencer
90f807fda5 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

llvm-svn: 113819
2010-09-13 23:59:48 +00:00
Michael J. Spencer
98ad3f2ea7 CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
NAKAMURA Takumi
2c7cfc7bd4 Fix a comment.
llvm-svn: 112535
2010-08-30 21:54:03 +00:00
NAKAMURA Takumi
b5613b9f12 EE/JIT: Do not invoke parent's ctors/dtors from main()! (PR3897)
On Mingw and Cygwin, the symbol __main is resolved to
callee's(eg. tools/lli) one, to invoke wrong duplicated ctors
(and register wrong callee's dtors with atexit(3)).
We expect, by callee, ExecutionEngine::runStaticConstructorsDestructors()
is called before ExecutionEngine::runFunctionAsMain() is called.

llvm-svn: 112474
2010-08-30 14:00:29 +00:00
Chris Lattner
299b129955 remove some dead code.
llvm-svn: 111791
2010-08-23 03:12:06 +00:00
Nick Lewycky
510dd18c6f When creating a JIT, try to load the program so that we can resolve symbols
against it. This affects Windows.

llvm-svn: 111240
2010-08-17 16:19:18 +00:00
Nick Lewycky
fb41984f11 Stop the JIT from refusing to work just because the program it was compiled into
was built with -static.

llvm-svn: 110564
2010-08-09 07:20:20 +00:00
Bob Wilson
73936af25b Don't call __register_frame from the JIT on systems that use setjmp/longjmp
exception handling.  Also fix an extra underscore typo in one instance of
"__ARM_EABI__".  Radar 8236264.

llvm-svn: 109451
2010-07-26 21:58:00 +00:00
Chris Lattner
7c16f1a16e remove the dwarf sizing stuff which is now dead, it was
"yet another" copy of the dwarf EH emission code that was
copied, pasted and slightly hacked up.

llvm-svn: 109169
2010-07-22 21:20:39 +00:00
Chris Lattner
65ad913bec remove the JIT "NeedsExactSize" feature and supporting logic.
llvm-svn: 109167
2010-07-22 21:17:55 +00:00
Duncan Sands
d4fcfc6539 Fix indentation.
llvm-svn: 108691
2010-07-19 09:36:45 +00:00
Duncan Sands
dcdd9f3a78 Expose JIT::recompileAndRelinkFunction for use through the C API.
Patch by Benjamin Saunders.

llvm-svn: 108690
2010-07-19 09:33:13 +00:00
Eli Friedman
a0458f78a8 Get rid of a bunch of duplicated ELF enum values.
llvm-svn: 108520
2010-07-16 07:53:29 +00:00
Duncan Sands
f7b98e2b1e Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Chris Lattner
bb04e40482 first part of JIT support for address of labels, part of PR7264,
patch by Yuri!

llvm-svn: 108107
2010-07-11 23:07:28 +00:00
Dan Gohman
7bd41176cc Handle execution entrypoints with non-integer return types.
Fix from Russel Power in PR7284.

llvm-svn: 106271
2010-06-18 02:01:10 +00:00
Chris Lattner
6e63336eb4 improve portability to systems that don't have powf/modf (e.g. solaris 9)
patch by Evzen Muller!

llvm-svn: 103876
2010-05-15 17:10:24 +00:00
Duncan Sands
153ad3b903 Remove the -enable-sjlj-eh option, which doesn't do anything.
Remove the -enable-eh option which is only used by the JIT,
and replace it with -jit-enable-eh.

llvm-svn: 102865
2010-05-02 15:36:26 +00:00
Dan Gohman
11b3613649 Fix an ancient FIXME.
llvm-svn: 102827
2010-05-01 02:43:10 +00:00
Jeffrey Yasskin
db377e2f86 Fix the OProfileJITEventListener build after r101844 removed
MachineFunction::DefaultDebugLoc.  We now use the same technique as
DwarfDebug::beginFunction to find the starting line number for a
function.

llvm-svn: 102679
2010-04-30 00:16:10 +00:00
Bill Wendling
3592f4fac4 Don't rely upon the MCSymbol "isDefined" method to indicate if a label has been
emitted or not. The JIT doesn't set that. Look it up in the label location table
instead.

llvm-svn: 101686
2010-04-18 00:56:05 +00:00
Bill Wendling
19aefaac85 Formatting changes. No functionality change.
llvm-svn: 101685
2010-04-18 00:52:08 +00:00
Dan Gohman
fba34ef042 Fix -Wcast-qual warnings.
llvm-svn: 101655
2010-04-17 17:42:52 +00:00
Bill Wendling
7ede9396f4 The JIT calls TidyLandingPads to tidy up the landing pads. However, because the
JIT doesn't use the MC back-end asm printer to emit labels that it uses, the
section for the MCSymbol is never set. And thus the MCSymbol for the EH label
isn't marked as "defined". Because of that, TidyLandingPads removes the needed
landing pads from the JIT output. This breaks EH for every JIT program.

This is a work-around for this limitation. We pass in the label locations
map. If the label has a non-zero value, then it was "emitted" by the JIT and
TidyLandingPads shouldn't remove that label.

A nicer solution would be to mark the MCSymbol as "used" by the JIT and not rely
upon the section being set to determine if it's defined or not.

llvm-svn: 101453
2010-04-16 08:46:10 +00:00
Dan Gohman
0e0b8cf9fd Add const qualifiers to CodeGen's use of LLVM IR constructs.
llvm-svn: 101334
2010-04-15 01:51:59 +00:00
Nicolas Geoffray
8e94bbf2e1 Don't use DILocation when processing a DebugLoc.
llvm-svn: 101294
2010-04-14 22:06:37 +00:00
Benjamin Kramer
0fb23008bb Use twines to simplify calls to report_fatal_error. For code size and readability.
llvm-svn: 100756
2010-04-08 10:44:28 +00:00
Chris Lattner
80b41881bc rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Jeffrey Yasskin
39cdeee4c3 Fix OProfileJITEventListener build for new DebugLoc.
llvm-svn: 100461
2010-04-05 21:09:12 +00:00
Nicolas Geoffray
be623e86f8 CurFn is only used for relocations. Use EmissionDetails.MF->getFunction() instead.
llvm-svn: 100328
2010-04-04 10:31:49 +00:00
Chris Lattner
305c84b8ee Switch the code generator (except the JIT) onto the new DebugLoc
representation.  This eliminates the 'DILocation' MDNodes for 
file/line/col tuples from -O0 -g codegen.

This remove the old DebugLoc class, making it a typedef for DebugLoc,
I'll rename NewDebugLoc next.

I didn't update the JIT to use the new apis, so it will continue to
work, but be as slow as before.  Someone should eventually do this
or, better yet, rip out the JIT debug info stuff and build the JIT
on top of MC.

llvm-svn: 100209
2010-04-02 19:42:39 +00:00
Torok Edwin
8b6e668f35 Typo noticed by Duncan.
llvm-svn: 99918
2010-03-30 20:15:13 +00:00
Torok Edwin
b2d59bc592 Don't overwrite previous value, if it succeeded.
llvm-svn: 99886
2010-03-30 12:52:03 +00:00
Torok Edwin
6509d58fd5 Honour addGlobalMapping() in the interpreter, if it was used to add mappings for
external Functions (the JIT does honour this).

llvm-svn: 99885
2010-03-30 12:31:58 +00:00
Jeffrey Yasskin
7378e4ce11 Avoid leaking the memory allocated for GlobalVariables in the interpreter, by
freeing that memory when the GV is destroyed.

llvm-svn: 99706
2010-03-27 04:53:56 +00:00
Jeffrey Yasskin
289846d250 Avoid leaking argv and env arrays from lli.
llvm-svn: 99589
2010-03-26 00:59:12 +00:00
Jeffrey Yasskin
4eb3242b81 Avoid a memory leak in JITDebugRegisterer.
llvm-svn: 98612
2010-03-16 05:54:54 +00:00
Chris Lattner
e939096a3b fix these two get the mcsymbol operand instead of imm operand.
llvm-svn: 98487
2010-03-14 08:28:48 +00:00