Commit Graph

19298 Commits

Author SHA1 Message Date
Reid Spencer
87df3636e1 Add a test that runs the ParallelJIT example program to ensure that the
JIT can run against a multi-threaded program without getting its data
structures messed up. Also had to add the examples directory to the path
for the tests so that ParallelJIT can be found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22415 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-13 00:35:12 +00:00
Reid Spencer
6a60d18018 Correct the file title.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22414 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 22:00:29 +00:00
Reid Spencer
e8cdc8b3a3 For PR418:
Add an example program that utilizes multiple threads in the JIT to process
work. This was used by Evan Jones as the original test case for ensuring
that the ExecutionEngine was thread safe.

Original source by Evan Jones (adapted from other LLVM JIT examples) and
made LLVM style compliant by Reid Spencer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22411 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 21:51:33 +00:00
Nate Begeman
d3a490a08e Check in the last of the darwin-specific code necessary to get shootout
working before modifying the asm printer to use the subtarget info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22408 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:58 +00:00
Nate Begeman
63b3f9acae Remove some code that moved to the generic asm printer a long time ago.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 18:34:15 +00:00
Reid Spencer
fce2ddcefd Update release notes regarding thread-safe JIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22405 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 16:36:24 +00:00
Reid Spencer
ee448630bd For PR540:
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22404 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:51:55 +00:00
Reid Spencer
b2164e5cb5 For PR540:
Add a Mutex class for thread synchronization in a platform-independent way.
The current implementation only supports pthreads. Win32 use of Critical
Sections will be added later. The design permits other threading models to
be used if (and only if) pthreads is not available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:37:43 +00:00
Reid Spencer
22177fe580 For PR540:
* Add check for pthread.h
* Make sure -lpthread gets added to LIBS if its available


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22402 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:24:20 +00:00
Reid Spencer
9e4f701e91 In support of PR418:
Make sure that -lpthread gets added to LIBS variable which puts it at the
end of the tools' link commands, if libpthread.a is found.

Add a test for pthread.h so we can use #ifdef HAVE_PTHREAD_H


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22401 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 07:19:13 +00:00
Chris Lattner
46c53054d0 Add support for 64-bit elf files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22400 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 06:57:52 +00:00
Chris Lattner
39429617e0 Add support for emitting 64-bit integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22399 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 06:57:26 +00:00
Chris Lattner
f5d507e905 Add some apparently undocumented ELF section header flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22398 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 06:40:29 +00:00
Andrew Lenharth
fec0e4024f Fix povray and minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22397 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 04:20:52 +00:00
Nate Begeman
8d2623d49a Clean up and add comments to the newly implemented subtarget code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22396 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 03:04:49 +00:00
Jeff Cohen
d73e4608db Add new files to Visual Studio projects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22395 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 03:00:20 +00:00
Jeff Cohen
74fa8d67e1 I don't know how this ever compiled with gcc, but VC++ correctly rejects it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22394 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:59:38 +00:00
Jeff Cohen
44213c9538 VC++ demands that the function returns a value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:53:33 +00:00
Nate Begeman
0e219eb9b8 Clean up the TargetSubtarget class a bit, removing an unnecessary argument
to the constructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22392 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:41:19 +00:00
Chris Lattner
b151acadc8 Minor changes to improve comments and fix the build on _WIN32 systems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:36:10 +00:00
Chris Lattner
3249bfc828 Add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22390 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 02:35:36 +00:00
Nate Begeman
fb5792f416 Implement Subtarget support
Implement the X86 Subtarget.

This consolidates the checks for target triple, and setting options based
on target triple into one place.  This allows us to convert the asm printer
and isel over from being littered with "forDarwin", "forCygwin", etc. into
just having the appropriate flags for each subtarget feature controlling
the code for that feature.

This patch also implements indirect external and weak references in the
X86 pattern isel, for darwin.  Next up is to convert over the asm printers
to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:41:54 +00:00
Nate Begeman
73213f6c07 Commit some pending darwin changes before subtarget support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:37:28 +00:00
Chris Lattner
a3efca16f2 Fix PR576.
Instead of emitting a JIT stub that looks like this:

internal void %l1_main_entry_2E_ce_wrapper(int) {
header:
        %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) )           ; <sbyte*> [#uses=1]
        %resolverCast = cast sbyte* %resolver to void (int)*            ; <void (int)*> [#uses=1]
        call void %resolverCast( int %0 )
        ret void
}

Emit one that looks like this:

internal void %l1_main_entry_2E_ce_wrapper(int) {
Entry:
	%fpcache = load void (int)** %l1_main_entry_2E_ce.fpcache               ; <void (int)*> [#uses=2]
        %isNull = seteq void (int)* %fpcache, null              ; <bool> [#uses=1]
        br bool %isNull, label %lookupfp, label %usecache

usecache:               ; preds = %lookupfp, %Entry
        %fp = phi void (int)* [ %resolverCast, %lookupfp ], [ %fpcache, %Entry ]            ; <void (int)*> [#uses=1]
        call void %fp( int %0 )
        ret void

lookupfp:               ; preds = %Entry
        %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) )           ; <sbyte*> [#uses=1]
        %resolverCast = cast sbyte* %resolver to void (int)*            ; <void (int)*> [#uses=2]
        store void (int)* %resolverCast, void (int)** %l1_main_entry_2E_ce.fpcache
        br label %usecache
}


This makes the JIT debugger *MUCH* faster on large programs, as
getPointerToNamedFunction takes time linear with the size of the program, and
before we would call it every time a function in the text module was called from
the safe module (ouch!).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22387 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 01:00:32 +00:00
Chris Lattner
9b988be187 add a note so I can remember the common t-t's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22386 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 00:20:49 +00:00
Chris Lattner
df3623e962 fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 22:46:18 +00:00
Andrew Lenharth
d3513e026b Remove glibc specific functions, and mark a couple as C99
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22384 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 20:35:20 +00:00
Andrew Lenharth
d9793e6c0a because on alpha:
#   define errno (*__errno_location ())

*shakes head


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22383 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 17:41:12 +00:00
Chris Lattner
0e18050797 Clean up code, no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22382 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:34:30 +00:00
Chris Lattner
c569d79a2a Output .size directives to tell the assembler the size of each function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22381 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:29:14 +00:00
Chris Lattner
b12c9fa565 Fix crazy indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22380 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:25:47 +00:00
Chris Lattner
a698871367 convert dos newlines to unix. No other changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22379 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:25:34 +00:00
Chris Lattner
5fe7b6e2be Emit a symbol table entry for each function we output to the ELF file. This
allows objdump to know which function we are emitting to:

00000000 <foo>:     <----
   0:   b8 01 00 00 00          mov    $0x1,%eax
   5:   03 44 24 04             add    0x4(%esp,1),%eax
   9:   c3                      ret

... and allows .o files to be useful for linking :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22378 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:17:35 +00:00
Chris Lattner
f0cf1b7e5f The symbol table just needs a const GlobalValue*, not a non-const one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22377 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 06:16:24 +00:00
Chris Lattner
81b6ed7ed1 Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter
after itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22376 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 05:17:48 +00:00
Chris Lattner
aa507db59e add code to emit the .text section to the section header.
Add a *VERY INITIAL* machine code emitter class.  This is enough to take
this C function:
int foo(int X) { return X +1; }

and make objdump produce the following:

$ objdump -d t-llvm.o

t-llvm.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   b8 01 00 00 00          mov    $0x1,%eax
   5:   03 44 24 04             add    0x4(%esp,1),%eax
   9:   c3                      ret


Anything using branches or refering to the constant pool or requiring
relocations will not work yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22375 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 05:17:18 +00:00
Chris Lattner
6871aed032 expose a new code emitter object
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22374 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 05:15:32 +00:00
Chris Lattner
1ed38fb9a7 add a helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22373 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 04:49:33 +00:00
Chris Lattner
efb4bf0de6 Remove prototype for non-existant function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22372 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 04:20:55 +00:00
Chris Lattner
5acd120078 Use a name mangler object to uniquify names and remove nonstandard
characters from them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22371 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 03:11:47 +00:00
Chris Lattner
75bbdff3d3 add a name mangler object
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 03:11:10 +00:00
Chris Lattner
6e6308898a fix long lines
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22369 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-11 02:49:16 +00:00
Chris Lattner
bce81ae51e Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
This is the last MVTSDNode.

This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.

Also, remove some uses of dyn_cast that should really be cast (which is
cheaper in a release build).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22368 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 01:56:13 +00:00
Chris Lattner
5f056bf4b8 Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
This is the last MVTSDNode.

This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22367 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 01:55:33 +00:00
Chris Lattner
9fadb4c1c0 Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22366 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:29:18 +00:00
Chris Lattner
f7db8c69a1 Move TRUNCSTORE to using a VTSDNode operand instead of being a MVTSDNode.
Also update some comments that Andrew forgot to update when he changed
loads/stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22365 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:28:25 +00:00
Chris Lattner
15e4b01920 Introduce a new VTSDNode class with the ultimate goal of eliminating the
MVTSDNode class.  This class is used to provide an operand to operators
that require an extra type.  We start by converting FP_ROUND_INREG and
SIGN_EXTEND_INREG over to using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22364 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-10 00:07:11 +00:00
Jeff Cohen
966fa415d2 Fix bugs also fixed in Unix version, plus other general cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22363 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-09 18:42:49 +00:00
Jeff Cohen
73f36671b2 1. Fix bug in getBaseName where it mishandles suffixes
2. Fix bug in eraseSuffix where it allows /path/.suffix to become /path/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22362 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-09 18:42:02 +00:00
Reid Spencer
8b2d1aa37b Ensure that functions like isDirectory don't fail if the file doesn't
exist but just return false instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22361 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-08 17:46:10 +00:00