Commit Graph

224 Commits

Author SHA1 Message Date
Misha Brukman
89e8be00c5 * Stop hard-coding a value for beginning of emitted code on Sparc since we can
now handle far calls (i.e., beyond the 30-bit limit in call instructions).
* As a side-effect, this allows us to unify and clean up the mmap() call and
  code around it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7381 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-29 16:57:16 +00:00
Misha Brukman
fd31a78124 Add rationale for the MAP_ANONYMOUS vs. MAP_ANON flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7368 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-28 19:26:19 +00:00
Misha Brukman
d69c1e6dc2 Add ability for external C code to get pointers to functions given their name.
This us used by bugpoint -- when code is compiled to a shared object to be
JITted, it must use the JIT's lazy resolution method to find function addresses,
because some functions will not be available at .so load time, as they are in
the bytecode file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7363 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-28 19:09:06 +00:00
Misha Brukman
d94a50f99d Clean up code dealing with RTLD_SELF differences on Sparc and X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7362 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-28 19:07:30 +00:00
Misha Brukman
df38dae949 Fix reference to architecture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7361 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-28 19:06:50 +00:00
Misha Brukman
248ea32cc9 Add in support to load shared objects (-load is provided by Support library).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7360 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-28 19:06:19 +00:00
Chris Lattner
a84983ea72 Fix space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7273 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 20:21:06 +00:00
Chris Lattner
832688a6d2 Remove redundant const qualifier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7254 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:30:32 +00:00
Misha Brukman
06dabfaed5 Cleaned up the code which chooses the appropriate value for the file descriptor
to pass to dlsym() -- Linux/x86 wants 0 while Sparc/Solaris wants RTLD_SELF,
which is not zero. Thanks to Chris for the suggestion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7204 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 18:33:38 +00:00
Misha Brukman
859e09f06e Clean up my last checkin: code is easier to read and explains the differences in
usage of the special file handle RTLD_SELF on Sparc/Solaris vs. 0 on Linux/x86.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7177 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 15:58:26 +00:00
Misha Brukman
291c2c59b0 On Sparc/Solaris, the special handle RTLD_SELF is used as a handle referring to
the program's executing image, not 0 as it is on Linux/x86 and possibly other
systems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7176 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-15 15:55:32 +00:00
Misha Brukman
82742916f3 * If compiling on X86 or Sparc, automagically enable the JIT for that arch
* Setting ENABLE_X86_JIT or ENABLE_SPARC_JIT on the `make' command-line will
  force the inclusion of that JIT on a different architecture
* If neither JIT is enabled (e.g., compiling on a different architecture), the
  -march option will not be available to LLI.
* As a side effect of the $ARCH variable, the Sparc LLI can now link just a bit
  faster by not including the x86 library.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7070 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-02 17:53:19 +00:00
John Criswell
7a73b80b90 Merged in autoconf branch. This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 21:59:07 +00:00
Brian Gaeke
02c26b681e Get rid of the duplicate '0x' in debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7012 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 18:06:20 +00:00
Brian Gaeke
703379827f Include <cmath> instead of <math.h>
Remove isnan; it's too unportable to handle cleanly at this point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6866 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 19:41:55 +00:00
Brian Gaeke
4399a4982a Add #ifdef hack for MAP_ANONYMOUS being spelled MAP_ANON on some platforms.
(We're already talking about autoconf'ing this, so I'm assuming this hack
will be short-lived...I just don't want it to get lost in my working files.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6761 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 23:14:06 +00:00
Brian Gaeke
5285270871 Use $(PLATFORMLIBDL) to selectively bring in -ldl only on those platforms where
it is needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6753 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 20:09:18 +00:00
Brian Gaeke
1d0acacc63 Use std::isnan instead of isnan. Brought back to you from the
future, by the reconciliation of the C++ and C99 standards. Someday.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6751 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 19:59:17 +00:00
Chris Lattner
f25b7729c1 Life is too short. Link in too much stuff on Linux to make building on sun easier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6748 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 19:14:59 +00:00
Chris Lattner
da601403d9 The never-ending odyssey trying to get sparc to link
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6747 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 18:19:52 +00:00
Chris Lattner
d562436355 Make sure to get the value of ARCH before we use it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6746 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 17:53:35 +00:00
Chris Lattner
2bf4c61557 Do not link in the Sparc JIT when building on X86. Eventually the sparc will not
link in the X86 JIT either, but this makes testing easier.

For some reason, the sparc JIT was breaking the X86 JIT when it was linked in. :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6745 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 15:54:52 +00:00
Chris Lattner
de3209bfdb Apparently "sparc" is a macro on sparcs. Ugh. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6744 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 15:54:02 +00:00
Chris Lattner
7a5500e2f6 Whoops, didn't mean to check that in :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6743 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 15:46:34 +00:00
Chris Lattner
97ac14f33c Use more structured command line option processing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6742 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 15:43:13 +00:00
Chris Lattner
7aefa966cd #ifdef out code that only applies when the HOSTARCH = sparc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6741 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 15:32:38 +00:00
Chris Lattner
08d5e1f718 Add #include for older GCC's
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6670 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-08 06:43:57 +00:00
Misha Brukman
4e8c999518 ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::
The JIT is designed to code-generate a function at-a-time. That means that any
pass can only make local changes to its function. Period.

Because the Sparc PreSelection pass claims to be a BasicBlock pass while adding
globals to the Module, it cannot be run with the other passes, because by this
time, the globals have been output already by the JIT, and the addresses of any
globals appearing AFTER this point are not recognized.

However, the PreSelection pass is a requirement for correctness in the Sparc
codegen path, so it MUST be run.

::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT ::: HACK ALERT :::


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6650 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-06 06:59:55 +00:00
Misha Brukman
1d4408506b Output function address as hex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6649 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-06 06:52:35 +00:00
Misha Brukman
cf614a32d5 Removed debug print statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6641 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-06 00:00:54 +00:00
Misha Brukman
3a55e8aae4 * Institute a hack for the Sparc call to mmap() to get our generated code to be
laid out closer to the VM so that calls to library functions (e.g. puts()) and
  callback (e.g.  JITResolver::CompilationCallback) fit into 30 bits of the call
  instruction.
* Abort if architecture is not yet supported (not X86 or Sparc) because it
  likely requires a different set of parameters to mmap() .
* Stop using hard-coded values for page size; use sysconf(_SC_PAGESIZE) instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6610 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-04 19:45:25 +00:00
Misha Brukman
88fe358f8a Sparc's dlsym() requires the special operand RTLD_SELF to find a symbol in the
currently-running process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6592 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-04 01:57:22 +00:00
Misha Brukman
906f5fa5c8 * Removed SparcEmitter.cpp; rolled into lib/Target/Sparc/SparcV9CodeEmitter.cpp
* No more createX86Emitter() vs. createSparcEmitter() -- there can be only one
* As a result, the memory management semantics must be handled according to
  platform -- the parameters to mmap() are particularly sensitive to the host
  architecture.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6527 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-02 03:23:16 +00:00
Brian Gaeke
24a26e58ef The flag modifications weren't picking up the old values of the
flags before. Save them in a temporary variable, then restore them from the
temporary after creating the new constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6520 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-02 02:10:31 +00:00
Chris Lattner
d5af63f325 Remove obsolete code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6518 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-02 00:09:00 +00:00
Chris Lattner
bba1b6df9a Move target specific code to target files. The new MachineCodeEmitter
class is actually target independent!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6517 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 23:24:36 +00:00
Brian Gaeke
63b99f91c9 Fix induction variable name clash in for loops, in finishFunction().
Modify new MachineOperand so that its flags match the old MachineOperand's
 flags, for the flags that matter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6513 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 22:08:29 +00:00
Misha Brukman
f86d635e20 Fixed rewriting of branches -- they now work forward and backward.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6463 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-31 06:26:48 +00:00
Misha Brukman
417a7c06e8 Since malloc is no longer used, no need to free() memory.
Fixed BasicBlock patching by supplying correct type for the displacement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6453 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 20:39:37 +00:00
Brian Gaeke
6607fbec94 Fix call to mmap, so that it can be used on sparc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6424 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-30 03:37:13 +00:00
Misha Brukman
8e5bf70dff mmap() seems to be failing on Sparc, so just use malloc()/free() .
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6387 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-28 18:44:38 +00:00
Misha Brukman
1df4d5e668 Link in Sparc libs for the JIT, even on X86 to be able to support debugging
of Sparc JIT (printing out instrs) on X86. Con: this increases linking time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6361 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 21:42:05 +00:00
Misha Brukman
abb027cf41 Allow for specification of which JIT to run on the commandline.
`lli -march=x86' or `lli -march=sparc' will forcefully select the JIT even on a
different platform. Running lli without the -march option will select the JIT
for the platform that it's currently running on.

Pro: can test Sparc JIT (debug printing mode) on X86 -- faster to compile/link
LLVM source base to test changes.
Con: Linking lli on x86 now pulls in all the Sparc libs -> longer link time
(but X86 can bear it, right?)

In the future, perhaps this should be a ./configure option to enable/disable
target JITting...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6360 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 21:40:39 +00:00
Chris Lattner
6b2125c624 Fix typeos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6204 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 17:53:49 +00:00
Chris Lattner
9a23122b6a Add support for more constant expressions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6203 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 17:51:49 +00:00
Chris Lattner
44edb6bdd2 Add support for atexit function, remove support for __main function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6194 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 14:21:30 +00:00
Chris Lattner
22080f9f16 Add support for atexit handlers to the JIT, fixing 2003-05-14-AtExit.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6193 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 13:53:40 +00:00
Chris Lattner
1b72216a71 Fix compilation problems with previous checking *blush*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6191 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 13:27:36 +00:00
Chris Lattner
6701a8603f Add a framework for intercepting system calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6190 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 13:26:47 +00:00
Chris Lattner
7e527424fc Clean up cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6174 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-13 20:29:17 +00:00