1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

825 Commits

Author SHA1 Message Date
Chris Lattner
1eabe5fb58 initial changes to support JIT'ing from multiple module providers, implicitly
linking the program on the fly.

llvm-svn: 29721
2006-08-16 01:24:12 +00:00
Chris Lattner
4b861b07a7 Fix handling of asm specifiers for external globals. This unbreaks many programs
on leopard in the jit.

llvm-svn: 29391
2006-07-28 21:11:31 +00:00
Evan Cheng
4ceeac4159 Resolve BB references with relocation.
llvm-svn: 29351
2006-07-27 18:21:10 +00:00
Jim Laskey
17acc47da9 Fixed a typo in Evan's submisson.
llvm-svn: 29345
2006-07-27 13:40:34 +00:00
Evan Cheng
39112023f1 Move synchronizeICache from TargetJITInfo into a static function in JITEmitter.cpp
llvm-svn: 29334
2006-07-27 06:33:55 +00:00
Chris Lattner
d2170e1b17 Fix warning on linux
llvm-svn: 29314
2006-07-27 00:04:14 +00:00
Evan Cheng
beeb4e5c8c - Refactor the code that resolve basic block references to a TargetJITInfo
method.
- Added synchronizeICache() to TargetJITInfo. It is called after each block
  of code is emitted to flush the icache. This ensures correct execution
  on targets that have separate dcache and icache.
- Added PPC / Mac OS X specific code to do icache flushing.

llvm-svn: 29276
2006-07-25 20:40:54 +00:00
Nate Begeman
6ba0156891 Fix the build on my old and busted version of OS X
llvm-svn: 29266
2006-07-22 16:59:38 +00:00
Evan Cheng
09d3be29fa Forgot to #ifdef __APPLE__
llvm-svn: 29264
2006-07-22 00:42:03 +00:00
Evan Cheng
55bff38268 Resolve __dso_handle.
llvm-svn: 29259
2006-07-21 23:06:20 +00:00
Chris Lattner
2d974f5de3 Remove non-portable optimization that isn't worth it
llvm-svn: 29115
2006-07-12 00:31:47 +00:00
Chris Lattner
cad94f6042 Change AllocateRWX/DeallocateRWX do not throw an exception.
llvm-svn: 29057
2006-07-07 17:31:41 +00:00
Chris Lattner
26b53f505e Adapt to new interface function materialization interface
llvm-svn: 29051
2006-07-07 17:18:09 +00:00
Evan Cheng
2db138d4b0 Added jump table address relocation.
llvm-svn: 28908
2006-06-23 01:02:37 +00:00
Chris Lattner
5a1f56fc2a Simplify TargetData ctor call
llvm-svn: 28832
2006-06-16 18:24:38 +00:00
Chris Lattner
4a8f3c456a Only count instructions as code size, not constant pools and other per-function stuff.
llvm-svn: 28827
2006-06-16 18:09:26 +00:00
Chris Lattner
ac373d311b Simplify interpreter construction.
llvm-svn: 28826
2006-06-16 18:08:38 +00:00
Chris Lattner
6838320f46 Fix -pedantic warnings.
llvm-svn: 28636
2006-06-01 17:29:22 +00:00
Chris Lattner
50af98a5f2 Fix -pedantic warnings
llvm-svn: 28635
2006-06-01 17:27:11 +00:00
Chris Lattner
cba966934e Silence some -pedantic warnings.
llvm-svn: 28629
2006-06-01 17:12:14 +00:00
Reid Spencer
574d4e6992 For PR786:
Minor tweaks in public headers and a few .cpp files so that LLVM can build
successfully with -pedantic and projects using LLVM with -pedantic don't
get warnings from LLVM. There's still more -pedantic warnings to fix.

llvm-svn: 28453
2006-05-24 19:21:13 +00:00
Chris Lattner
1024577552 Make this print the right start pointer
llvm-svn: 28321
2006-05-16 06:45:50 +00:00
Chris Lattner
05311325f1 LoadLibraryPermanently can theoretically throw an exception. Do not propagate
it out of 'ExecutionEngine::create'.  This fixes a problem reported by coverity.

llvm-svn: 28293
2006-05-14 19:01:55 +00:00
Chris Lattner
b1ad13a4bc Fix a hypothetical memory leak, identified by Coverity. In practice, this
object is never deleted though.

llvm-svn: 28256
2006-05-12 18:10:12 +00:00
Owen Anderson
29e4d70aed Refactor a bunch of includes so that TargetMachine.h doesn't have to include
TargetData.h.  This should make recompiles a bit faster with my current
TargetData tinkering.

llvm-svn: 28238
2006-05-12 06:33:49 +00:00
Chris Lattner
14cdcc59b8 For extra sanity checking, fill free'd memory with garbage so we know that
people aren't reusing machine code buffers at all.

llvm-svn: 28228
2006-05-12 00:03:12 +00:00
Chris Lattner
ecc6d6f334 Fix some bugs in the freelist manipulation code.
Finally, implement ExecutionEngine::freeMachineCodeForFunction.

llvm-svn: 28227
2006-05-11 23:56:57 +00:00
Chris Lattner
81a3c90080 Significantly revamp allocation of machine code to use free lists, real
allocation policies and much more.  All this complexity, and we have no
functionality change, woo! :)

llvm-svn: 28225
2006-05-11 23:08:08 +00:00
Chris Lattner
6e58d3a317 Move some methods out of line so that MutexGuard.h isn't needed in a public header.
llvm-svn: 28179
2006-05-08 22:00:52 +00:00
Chris Lattner
bf8f91715e Adjust to use proper TargetData copy ctor
llvm-svn: 28112
2006-05-04 21:18:40 +00:00
Chris Lattner
326eedfa77 minor cleanups, no functionality change
llvm-svn: 28087
2006-05-03 18:55:56 +00:00
Chris Lattner
d36b66d6dc Suck block address tracking out of targets into the JIT Emitter. This
simplifies the MachineCodeEmitter interface just a little bit and makes
BasicBlocks work like constant pools and jump tables.

llvm-svn: 28082
2006-05-03 17:10:41 +00:00
Owen Anderson
71bc529dfa Refactor TargetMachine, pushing handling of TargetData into the target-specific subclasses. This has one caller-visible change: getTargetData() now returns a pointer instead of a reference.
This fixes PR 759.

llvm-svn: 28074
2006-05-03 01:29:57 +00:00
Chris Lattner
be9958e6f7 Align function bodies correctly.
llvm-svn: 28073
2006-05-03 01:03:20 +00:00
Chris Lattner
c43d309514 Simplify some code. Don't add memory blocks to the Blocks list twice.
llvm-svn: 28071
2006-05-03 00:54:49 +00:00
Chris Lattner
06ccac43d7 Change the BasicBlockAddrs map to be a vector, indexed by MBB number.
llvm-svn: 28069
2006-05-03 00:32:55 +00:00
Chris Lattner
be23568cea Simplify some code
llvm-svn: 28066
2006-05-03 00:13:06 +00:00
Chris Lattner
2bf37af52d Several related changes:
1. Change several methods in the MachineCodeEmitter class to be pure virtual.
2. Suck emitConstantPool/initJumpTableInfo into startFunction, removing them
   from the MachineCodeEmitter interface, and reducing the amount of target-
   specific code.
3. Change the JITEmitter so that it allocates constantpools and jump tables
   *right* next to the functions that they belong to, instead of in a separate
   pool of memory.  This makes all memory for a function be contiguous, and
   means the JITEmitter only tracks one block of memory now.

llvm-svn: 28065
2006-05-02 23:22:24 +00:00
Chris Lattner
8054cd3830 Do not make the JIT memory manager manage the memory for globals. Instead
just have the JIT malloc them.

llvm-svn: 28062
2006-05-02 21:57:51 +00:00
Chris Lattner
41cc593fc3 Minor cleanups, no functionality change.
llvm-svn: 28061
2006-05-02 21:44:14 +00:00
Chris Lattner
055baf5c7b Refactor the machine code emitter interface to pull the pointers for the current
code emission location into the base class, instead of being in the derived classes.

This change means that low-level methods like emitByte/emitWord now are no longer
virtual (yaay for speed), and we now have a framework to support growable code
segments.  This implements feature request #1 of PR469.

llvm-svn: 28059
2006-05-02 18:27:26 +00:00
Chris Lattner
5c1abc2b94 Remove dead method
llvm-svn: 28055
2006-05-02 17:20:28 +00:00
Nate Begeman
acdefe26fa Fix a warning
llvm-svn: 27967
2006-04-25 17:46:32 +00:00
Nate Begeman
7ed816f900 JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC.
This support will be extended and enhanced in the coming days to support
PIC, and less dense forms of jump tables.

llvm-svn: 27947
2006-04-22 18:53:45 +00:00
Chris Lattner
4f0240b577 Fix JIT support for static ctors, which was apparently completely broken!
This allows Prolangs-C++/city and probably a bunch of other stuff to work
well with the new front-end

llvm-svn: 27941
2006-04-22 05:02:46 +00:00
Jeff Cohen
dab30f45d8 Get JIT/Interpreter working on Windows again.
llvm-svn: 27037
2006-03-24 02:53:49 +00:00
Chris Lattner
56a6600a72 prune #includes
llvm-svn: 26975
2006-03-23 05:43:58 +00:00
Chris Lattner
3d5ca510c9 remove always-null IntrinsicLowering argument.
llvm-svn: 26971
2006-03-23 05:28:02 +00:00
Chris Lattner
2aa3f9a6b5 remove the intrinsiclowering hook
llvm-svn: 26970
2006-03-23 05:22:51 +00:00
Chris Lattner
ab22cd5c33 Eliminate the dependency of ExecutionEngine on the JIT/Interpreter libraries.
Now you can build a tool with just the JIT or just the interpreter.

llvm-svn: 26946
2006-03-22 06:07:50 +00:00
Reid Spencer
728a2e9f62 Convert llvm.cs.uiuc.edu -> llvm.org
llvm-svn: 26748
2006-03-14 05:54:52 +00:00
Chris Lattner
0b736a0d1e Add a helper method for running static ctors/dtors in the module.
llvm-svn: 26619
2006-03-08 18:42:46 +00:00
Chris Lattner
e976315aec simplify this code now that each constant pool entry is not separately allocated
llvm-svn: 26079
2006-02-09 04:49:59 +00:00
Chris Lattner
c81f375f21 Adjust to MachineConstantPool interface change: instead of keeping a
value/alignment pair for each constant, keep a value/offset pair.

llvm-svn: 26078
2006-02-09 04:46:04 +00:00
Chris Lattner
1111a4b76d rename fields of constant pool entries
llvm-svn: 26076
2006-02-09 04:22:52 +00:00
Jeff Cohen
e66383eb06 The interpreter assumes that the caller of runFunction() must be lli, and
therefore the function being called must be a main() returning an int.  The
consequences when these assumptions are false are not good, so don't assume
them.

llvm-svn: 26031
2006-02-07 05:29:44 +00:00
Jeff Cohen
909ee648c7 Teach the interpreter to handle global variables that are added to a module after
interpretation has begun.  The JIT already handles this situation correctly, and
the interpreter can already handle new functions being added.

llvm-svn: 26030
2006-02-07 05:11:57 +00:00
Evan Cheng
f115c17f23 Allow the specification of explicit alignments for constant pool entries.
llvm-svn: 25855
2006-01-31 22:23:14 +00:00
Chris Lattner
201586783d Add #include of <iostream>
llvm-svn: 25516
2006-01-22 23:41:42 +00:00
Robert Bocchino
51e0be55e8 Fixed InitializeMemory to handle ConstantPacked.
llvm-svn: 25481
2006-01-20 18:18:40 +00:00
Chris Lattner
446a1e7a68 Wrap long lines.
llvm-svn: 25140
2006-01-07 06:20:51 +00:00
Chris Lattner
05a3f338cd wrap long line
llvm-svn: 25139
2006-01-07 06:12:07 +00:00
Chris Lattner
5b4d016b3f Fix a nasty bug that was causing miscompilation of global variables
on big endian 32-bit targets in some cases (e.g. PPC).  This fixes several
PPC JIT failures.

llvm-svn: 23914
2005-10-23 23:54:56 +00:00
Chris Lattner
965f10f2f2 Shrinkify to match llc
llvm-svn: 23912
2005-10-23 22:39:01 +00:00
Jim Laskey
1f9c40400c Add help support for -mcpu and -mattr.
llvm-svn: 23222
2005-09-02 19:27:43 +00:00
Jim Laskey
f32ef9a37f 1. Use SubtargetFeatures in llc/lli.
2. Propagate feature "string" to all targets.

3. Implement use of SubtargetFeatures in PowerPCTargetSubtarget.

llvm-svn: 23192
2005-09-01 21:38:21 +00:00
Andrew Lenharth
a48ff3bd21 one cannot allocate a global, until one is done initializing the global pointers
llvm-svn: 22568
2005-08-01 17:35:40 +00:00
Jeff Cohen
019104459d Keep tabs and trailing spaces out.
llvm-svn: 22565
2005-07-30 18:33:25 +00:00
Andrew Lenharth
d8bfbd99e9 support near allocations for the JIT
llvm-svn: 22554
2005-07-29 23:40:16 +00:00
Andrew Lenharth
02e0c80ecb Like constants, globals on some platforms are GOT relative. This means they have to be allocated
near the GOT, which new doesn't do.  So break out the allocate into a new function.

Also move GOT index handling into JITResolver.  This lets it update the mapping when a Lazy
function is JITed.  It doesn't managed the table, just the mapping.  Note that this is
still non-ideal, as any function that takes a function address should also take a GOT
index, but that is a lot of changes.  The relocation resolve process updates any GOT entry
it sees is out of date.

llvm-svn: 22537
2005-07-28 12:44:13 +00:00
Jeff Cohen
bd51ec7461 Eliminate all remaining tabs and trailing spaces.
llvm-svn: 22523
2005-07-27 06:12:32 +00:00
Chris Lattner
dd4417e8f9 fix a warning on 32-bit systems
llvm-svn: 22513
2005-07-25 23:42:58 +00:00
Andrew Lenharth
8a56432457 the JIT memory manager will construct a GOT if you want it too. Also, it places the constants in the allocated memory, rather than a malloc area
llvm-svn: 22497
2005-07-22 20:48:12 +00:00
Chris Lattner
648d6f150e count the number of relocations performed.
llvm-svn: 22480
2005-07-20 16:29:20 +00:00
Reid Spencer
78910545f0 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.

llvm-svn: 22404
2005-07-12 15:51:55 +00:00
Chris Lattner
cd3e31ee5a fix long lines
llvm-svn: 22369
2005-07-11 02:49:16 +00:00
Andrew Lenharth
a9214fec08 core changes for varargs
llvm-svn: 22254
2005-06-18 18:34:52 +00:00
Chris Lattner
5f2a0d17ab Fix a really horrible problem that causes the JIT to miscompile any program
that use 64-bit integers on 32-bit hosts.

llvm-svn: 21886
2005-05-12 06:01:28 +00:00
Chris Lattner
4e9d804f1d Make the stub functions be tail calls
llvm-svn: 21738
2005-05-06 06:48:54 +00:00
Misha Brukman
3ef1d71bfa Convert tabs to spaces
llvm-svn: 21440
2005-04-22 04:08:30 +00:00
Misha Brukman
933cdaf254 Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Misha Brukman
dda9dce10f * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21421
2005-04-21 22:43:08 +00:00
Misha Brukman
774e55c446 Remove trailing whitespace
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Chris Lattner
25a77fc58f Add support for targets that require stubs for external functions.
llvm-svn: 21313
2005-04-18 01:44:27 +00:00
Chris Lattner
c9a3ea81bf Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!

llvm-svn: 20649
2005-03-17 15:38:16 +00:00
Chris Lattner
4b688a1c70 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner
b632a13aa7 Use const iterators where possible. Patch by Evan Jones!
llvm-svn: 20354
2005-02-27 19:06:10 +00:00
Chris Lattner
68c342b28f Fix problems running the HowToUseJIT on powerpc, and probably problems with
ANY program that does not have all functions internalized.

llvm-svn: 20258
2005-02-20 18:43:35 +00:00
Chris Lattner
11f76e4975 This is no longer needed. Global variables with undef initializers can be
initialized to anything, including garbage.

llvm-svn: 20010
2005-02-02 20:50:50 +00:00
Chris Lattner
24bf1ca350 If the interpreter tries to execute an external function, kill it. Of course
since we are dirty, special case __main.  This should fix the infinite loop
horrible stuff that happens on linux-alpha when configuring llvm-gcc.  It
might also help cygwin, who knows??

llvm-svn: 19729
2005-01-21 19:59:37 +00:00
Chris Lattner
605b9a23a2 Improve compatiblity with HPUX on Itanium, patch by Duraid Madina
llvm-svn: 19586
2005-01-16 01:31:31 +00:00
Chris Lattner
b35b30c283 Rework constant pool handling so that function constant pools are no longer
leaked to the system.  Now they are destroyed with the JITMemoryManager is
destroyed.

llvm-svn: 19434
2005-01-10 18:23:22 +00:00
Chris Lattner
7a6914d3fc Silence warnings
llvm-svn: 19392
2005-01-08 20:13:44 +00:00
Chris Lattner
ed92fd75e8 Silence VS warnings.
llvm-svn: 19391
2005-01-08 20:13:19 +00:00
Chris Lattner
f1c684b3a2 Silence VS warnings.
llvm-svn: 19390
2005-01-08 20:07:03 +00:00
Chris Lattner
a4a16f17a3 Silence VS warnings
llvm-svn: 19389
2005-01-08 20:05:34 +00:00
Reid Spencer
5cc7e5cbd5 Be double sure about including sys/stat.h by wrapping the inclusion in
an "#if defined(HAVE_SYS_STAT_H)".

llvm-svn: 19069
2004-12-20 06:34:02 +00:00
Reid Spencer
96bd09da4a Move the #include of sys/stat.h inside the linux "hack" for the stat
family of functions so it gets noticed if we ever remove this.

llvm-svn: 19022
2004-12-17 19:09:16 +00:00
Reid Spencer
bf452c05e9 Only #include sys/stat.h if we're on linux where we have the PR274 problem.
llvm-svn: 19020
2004-12-17 18:56:29 +00:00
Reid Spencer
663dc7fb78 Get rid of some leaks found by VC leak detector.
Patch contributed by Morten Ofsted.

llvm-svn: 18889
2004-12-13 16:04:04 +00:00
Chris Lattner
fd2cb25d5f Properly implement a fix for PR475
llvm-svn: 18537
2004-12-05 07:19:16 +00:00
Chris Lattner
0f2cf7324c Revert this patch, it broke a ton of programs.
llvm-svn: 18535
2004-12-05 06:59:59 +00:00
Alkis Evlogimenos
687155333f Fix PR475.
llvm-svn: 18515
2004-12-05 01:51:20 +00:00
Chris Lattner
cfb8e1d6c8 Remove darwin specific majik
llvm-svn: 18467
2004-12-03 23:02:55 +00:00
Chris Lattner
378036ed74 Do not look here for elegance.
This fixes the ugly darwin "cannot find symbols starting with __" issue.

Thanks for Owen/resistor for testing this out for me.

llvm-svn: 18454
2004-12-03 07:16:51 +00:00
Chris Lattner
e4350af487 Remove unneeded cast.
llvm-svn: 18405
2004-12-01 17:13:05 +00:00
Chris Lattner
1196903800 Fix the JIT when being used from llvm-db
llvm-svn: 18391
2004-11-30 17:41:49 +00:00
Reid Spencer
74b17227a5 Use System/DynamicLibrary instead of Support/DynamicLinker
llvm-svn: 18357
2004-11-29 14:11:29 +00:00
Chris Lattner
76705f0c6b Rename Emitter.cpp -> JITEmitter.cpp
llvm-svn: 18132
2004-11-22 22:00:25 +00:00
Chris Lattner
70c19defde Fix the FIXME, nuke the JIT specific forceCompilationOf method.
llvm-svn: 18131
2004-11-22 21:54:35 +00:00
Chris Lattner
d38029313a These methods are obsolete
llvm-svn: 18129
2004-11-22 21:48:33 +00:00
Chris Lattner
8909e6452a Support targets that require stubs for external functions better
llvm-svn: 18098
2004-11-22 07:24:43 +00:00
Chris Lattner
596d18c8dd Clean up DEBUG output
llvm-svn: 18081
2004-11-21 03:44:32 +00:00
Chris Lattner
ce43d636fe Allow targets to avoid emitting a stub for EVERY lazily resolved call. In
most cases (e.g. direct calls) no stub is needed.

llvm-svn: 18080
2004-11-21 03:37:42 +00:00
Chris Lattner
d8c2739b24 Implement relocation support by adding a target independent resolver interface.
llvm-svn: 18069
2004-11-20 23:57:07 +00:00
Chris Lattner
c6c7f2ac58 This method does not exist any longer.
llvm-svn: 18061
2004-11-20 23:51:03 +00:00
Chris Lattner
d70e6be604 Add getCurrentPCOffset() and addRelocation() methods.
Add stub support for relocations to finishFunction

llvm-svn: 18035
2004-11-20 03:46:14 +00:00
Chris Lattner
5bf6fe1636 Add accessor
llvm-svn: 18030
2004-11-20 03:11:07 +00:00
Chris Lattner
2978400c23 Match change in MachineCodeEmitter prototype.
llvm-svn: 18009
2004-11-19 20:56:46 +00:00
Chris Lattner
0169ce5e9e This is a horrible hack to work around libstdc++ bugs :(
llvm-svn: 17988
2004-11-19 08:44:07 +00:00
Chris Lattner
89536fedee Now that we have ghost linkage, we can force resolution of external symbols
immediately instead of lazily.

In this program, for example:

int main() {
  printf("hello world\n");
  printf("hello world\n");
  printf("hello world\n");
  printf("hello world\n");
}

We used to have to go through compilation callback 4 times (once for each
call to printf), now we don't go to it at all.

Thanks to Misha for noticing this, and for adding the initial ghost linkage
patches.

llvm-svn: 17864
2004-11-15 23:20:04 +00:00
Chris Lattner
583ea4764c There is no reason to try to materialize the function from bytecode if it
already has been.  This may be a small speedup.

llvm-svn: 17863
2004-11-15 23:18:09 +00:00
Misha Brukman
8c397821a5 Implement ExecutionEngine::freeMachineCodeForFunction()
llvm-svn: 17601
2004-11-07 23:58:46 +00:00
Brian Gaeke
a757bae04f When emitting debug msgs for function stubs, don't truncate the
printed pointer value if sizeof(unsigned) != pointer size.  Instead,
use uintptr_t.

llvm-svn: 17338
2004-10-29 18:22:45 +00:00
Reid Spencer
1be896397a Fix library name.
llvm-svn: 17307
2004-10-28 05:37:24 +00:00
Reid Spencer
d3f7233495 Change Library Names Not To Conflict With Others When Installed
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Reid Spencer
1a344dfd95 Changes to support rand48 tests
llvm-svn: 17284
2004-10-27 23:03:44 +00:00
Chris Lattner
0dbd792854 Fix the interpreter crash that Michael McCracken found
llvm-svn: 17239
2004-10-26 05:35:14 +00:00
Misha Brukman
cfd8a7eb53 Use cleaner quoting and eliminate blank space
llvm-svn: 17174
2004-10-22 23:35:57 +00:00
Reid Spencer
e48ba34fd4 We won't use automake
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Reid Spencer
ce514b1c2c Initial automake generated Makefile template
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Chris Lattner
2fae8a1ef9 Add support for unreachable
llvm-svn: 17056
2004-10-16 18:21:33 +00:00
Chris Lattner
8d479b62ad Add support for undef
llvm-svn: 17055
2004-10-16 18:19:26 +00:00
Reid Spencer
e6418ec30f Update to reflect changes in Makefile rules.
llvm-svn: 16950
2004-10-13 11:46:52 +00:00
Reid Spencer
7d9cba7a0f Initial version of automake Makefile.am file.
llvm-svn: 16885
2004-10-10 20:43:57 +00:00
Reid Spencer
c6a8d70cff Convert code to compile with vc7.1.
Patch contributed by Paolo Invernizzi. Thanks Paolo!

llvm-svn: 16368
2004-09-15 17:06:42 +00:00
Reid Spencer
ce7c15737a Simplify the sys::Memory interface per Chris' request.
llvm-svn: 16318
2004-09-13 22:38:11 +00:00
Reid Spencer
b1df891777 Convert the Emitter to use the lib/System "Memory" interface instead of the
old SystemUtils.h interface to allocate RWX blocks of memory.

llvm-svn: 16286
2004-09-11 04:31:03 +00:00
Reid Spencer
c4abcbefb1 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Chris Lattner
ffaad65b22 Add a special case for argc,argv
llvm-svn: 15802
2004-08-16 01:07:04 +00:00
Chris Lattner
923c3d3594 Don't pass too many arguments into runFunction
llvm-svn: 15801
2004-08-16 01:05:35 +00:00
Chris Lattner
9cbc5f306a Finally, add support for calling arbitrary non-varargs functions.
llvm-svn: 15799
2004-08-16 00:14:18 +00:00
Chris Lattner
70ddd561fb Handle all nullary functions, of any valid return type.
llvm-svn: 15798
2004-08-15 23:53:06 +00:00
Chris Lattner
ed3a37a9ed Fine, go all of the way and check that the argument types are correct as well.
llvm-svn: 15797
2004-08-15 23:39:59 +00:00
Chris Lattner
9657e92992 These only really work if returning int or void
llvm-svn: 15796
2004-08-15 23:34:48 +00:00
Chris Lattner
557b356131 Handle zero arg function case
llvm-svn: 15794
2004-08-15 23:31:43 +00:00
Chris Lattner
c5f794403e Simplify code a bit, print error message always instead of asserting.
llvm-svn: 15793
2004-08-15 23:29:50 +00:00
Alkis Evlogimenos
f853362a44 Stop using getValues().
llvm-svn: 15487
2004-08-04 08:44:43 +00:00
Reid Spencer
b6c894409b bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass

llvm-svn: 14951
2004-07-18 00:41:27 +00:00
Chris Lattner
d7870e4b1a Fixes for PR341
llvm-svn: 14848
2004-07-15 02:51:32 +00:00
Chris Lattner
94212f7102 Fixes for PR341
llvm-svn: 14847
2004-07-15 02:51:31 +00:00
Chris Lattner
196b4f394f The cleanup is done. Update comment.
llvm-svn: 14761
2004-07-11 08:24:02 +00:00
Chris Lattner
6029e3234e Make add constantexprs work with all types, fixing the regressions from last night
llvm-svn: 14760
2004-07-11 08:01:11 +00:00
Chris Lattner
6bbbf294d1 Goodbye macro hell, hello nice clean simple extensible code. This change
also gives the JIT the ability to dynamically load targets. e.g.

lli -load libparisc.so -march=parisc foo.bc

llvm-svn: 14750
2004-07-11 04:02:06 +00:00
Reid Spencer
b28dd1ea9f Make error message consistent with the rest of LLVM by saying that bytecode
is read, not parsed.

llvm-svn: 14677
2004-07-07 21:20:28 +00:00
Reid Spencer
ff9f74082f Fix for bug 391.
Improve exeception handling around bcreader invocations.

llvm-svn: 14674
2004-07-07 21:01:38 +00:00
Reid Spencer
50ec3f9325 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Chris Lattner
cc465361d9 Move the IntrinsicLowering header into the CodeGen directory, as per PR346
llvm-svn: 14266
2004-06-20 07:49:54 +00:00
Chris Lattner
8a9f1ebd22 Move the IntrinsicLowering header into the CodeGen directory
llvm-svn: 14265
2004-06-20 07:46:18 +00:00
Chris Lattner
0cd29ae2cd Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Brian Gaeke
19d2a396da Add int ferror(FILE *)
llvm-svn: 14194
2004-06-16 02:56:40 +00:00
Chris Lattner
2ac00d274f Implement PR315: abort, don't warn, when missing external functions encountered
This fixes some critical problems building libstdc++ on cygwin.

llvm-svn: 13934
2004-06-01 21:49:00 +00:00
Chris Lattner
14dedcd354 Use the SystemUtils.h file to do our dirty work.
llvm-svn: 13868
2004-05-28 00:57:27 +00:00
Chris Lattner
d646e15d1a Remove long unused #includes
llvm-svn: 13857
2004-05-27 21:25:44 +00:00
Chris Lattner
8014d498cb These #includes are long dead
llvm-svn: 13856
2004-05-27 21:24:38 +00:00
Chris Lattner
736ca634a7 This code is a real mess, but at least get the JIT *building* on platforms
(such as plan 9) without mmap.  Of course it won't RUN... but that's another
step.  :)

llvm-svn: 13839
2004-05-27 18:03:56 +00:00
Reid Spencer
63530c743e Get rid of a wart: useless getFILE function is now a cast macro.
llvm-svn: 13747
2004-05-25 08:46:15 +00:00
Brian Gaeke
aaeb4c4d23 Generalize the strlen size_t hack, for the benefit of the other external
functions with wrappers that either take or return size_ts.

llvm-svn: 13296
2004-05-01 06:42:15 +00:00
Brian Gaeke
96889991bb Go back to the interpreter main loop after performing intrinsic lowering,
because 1) the first instruction might not be a call site, and
2) CS and SF.Caller were not getting set to point to the new call site
anyway (resulting in a crash on e.g. call %llvm.memset).

llvm-svn: 13122
2004-04-23 18:05:28 +00:00
Brian Gaeke
3cde72d6e2 Implement emitWordAt() for the JIT emitter.
llvm-svn: 13118
2004-04-23 17:11:14 +00:00
Chris Lattner
8b841e0e35 Add support for the select instruction
llvm-svn: 13076
2004-04-20 16:43:21 +00:00
Brian Gaeke
2c02798e86 Add a TargetData to the PassManager regardless of the TargetMachine.
This should unbreak the Sparc JIT again.

llvm-svn: 12949
2004-04-14 17:45:52 +00:00
Chris Lattner
27dff42330 Adjust to new interface
llvm-svn: 12646
2004-04-04 19:47:06 +00:00
Chris Lattner
5c053bfa99 Adjust to new gep_type_iterator prototypes.
llvm-svn: 12644
2004-04-04 17:30:06 +00:00
Chris Lattner
686a74c7ac Fix PR296: [execution engines] Unhandled cast constant expression
llvm-svn: 12435
2004-03-16 08:38:56 +00:00
Chris Lattner
f7bc6fd913 Rename the intrinsic enum values for llvm.va_* from Intrinsic::va_* to
Intrinsic::va*.  This avoid conflicting with macros in the stdlib.h file.

llvm-svn: 12356
2004-03-13 00:24:00 +00:00
Brian Gaeke
c60efbcee1 My fix for PR274 broke the build on Darwin/PPC. As I'm fairly certain this
bug only affects Linux systems that use GLIBC, I'm going to put ifdefs around
the array.

llvm-svn: 12269
2004-03-10 17:38:28 +00:00
Brian Gaeke
acf93be258 Address PR274 - '[JIT] Programs cannot resolve the fstat function'
by trying to get the compiler to generate an undefined reference for it
and related functions which live in libc_nonshared.a on Linux.

Linkers... sigh.

llvm-svn: 12256
2004-03-09 05:22:10 +00:00
Chris Lattner
5924de460e remove obsolete comment
llvm-svn: 11872
2004-02-26 07:59:22 +00:00
Brian Gaeke
aba4159be8 Represent va_list in interpreter as a (ec-stack-depth . var-arg-index)
pair, and look up varargs in the execution stack every time, instead of
just pushing iterators (which can be invalidated during callFunction())
around.  (union GenericValue now has a "pair of uints" member, to support
this mechanism.) Fixes Bug 234.

llvm-svn: 11845
2004-02-25 23:01:48 +00:00
Brian Gaeke
4f0a829a68 Great sparc renaming fallout IV: Sparc --> SparcV9.
llvm-svn: 11844
2004-02-25 22:09:36 +00:00
Brian Gaeke
c6de948cd1 Great renaming part II: Sparc --> SparcV9 (also includes command-line options and Makefiles)
llvm-svn: 11827
2004-02-25 19:08:12 +00:00
Chris Lattner
2679a58a61 Make the JIT zero out globals with memset instead of an element at a time. This
should speed it up a bit on a lot of programs

llvm-svn: 11472
2004-02-15 05:54:06 +00:00
Brian Gaeke
40b9cf9615 Fix off-by-one in Interpreter::getFirstVarArg(), which was punishing
any attempts by LLI to use varargs (possibly left over from the introduction
of IntrinsicLowering??)

llvm-svn: 11370
2004-02-13 06:18:39 +00:00
Brian Gaeke
212ffba663 The Interpreter was failing the AtExit UnitTest. This fixes it.
llvm-svn: 11367
2004-02-13 05:48:00 +00:00
Chris Lattner
a1757d1d91 Start using the new and improve interface to FunctionType arguments
llvm-svn: 11224
2004-02-09 04:14:01 +00:00
Chris Lattner
68fdb35576 rename the "exceptional" destination of an invoke instruction to the 'unwind' dest
llvm-svn: 11202
2004-02-08 21:44:31 +00:00
Chris Lattner
ecaa4c58e2 Print out all globals as they are emitted, not just those emitted from
emitGlobals

llvm-svn: 11191
2004-02-08 19:33:23 +00:00
Chris Lattner
ffd16b0190 There is no reason to #define fd
llvm-svn: 11190
2004-02-08 19:33:07 +00:00
Chris Lattner
becd58c6cb Print an error message if we can't materialize the bytecode file
llvm-svn: 11043
2004-02-01 01:07:25 +00:00
Chris Lattner
c76f82c957 Print an error message if there is an error materialize the bc file.
llvm-svn: 11041
2004-02-01 00:32:35 +00:00
Brian Gaeke
7824ed3d12 Don't pass anything to the IntrinsicLowering class that is not_intrinsic,
because that makes it abort. Also, fix a typo in a comment.

This checkin brought to you by the "It only takes about 30 seconds to run
ENABLE_LLI tests on Shootout on zion, even if they all dump core" fund.

llvm-svn: 10844
2004-01-14 06:02:53 +00:00
Chris Lattner
46fdc8ce43 Add new ExecutionEngine::getGlobalValueAtAddress method, which can efficiently
turn a memory address back into the LLVM global object that starts at that
address.  Note that this won't cause any additional datastructures to be built
for clients of the EE that don't need this information.

Also modified some code to not access the GlobalAddress map directly.

llvm-svn: 10674
2003-12-31 20:21:04 +00:00
Chris Lattner
c37577eb9f Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly.

llvm-svn: 10636
2003-12-28 21:23:38 +00:00
Chris Lattner
44f1ab7c2f Pass around IntrinsicLowering instances as appropriate.
Reimplement the Interpreters implementation of va_* to be more direct.

llvm-svn: 10627
2003-12-28 09:44:37 +00:00
Chris Lattner
3593bb9dd6 Factor code out of LLI
llvm-svn: 10616
2003-12-26 06:50:30 +00:00
Chris Lattner
ddcbddf9e9 No longer run atExit functions from run()
rename run to runFunction
Genericize the runFunction code a little bit, though it still stinks

llvm-svn: 10610
2003-12-26 06:13:47 +00:00
Chris Lattner
d7d8336d73 No longer run atExit functions from run()
rename run to runFunction

llvm-svn: 10609
2003-12-26 06:13:05 +00:00
Chris Lattner
013d4bee41 This should not be needed anymore
llvm-svn: 10558
2003-12-20 10:19:18 +00:00
Chris Lattner
edda0e5d4f Implement PR135, lazy emission of global variables
llvm-svn: 10549
2003-12-20 03:36:47 +00:00
Chris Lattner
214005e5fb Simple refactorings to prepare for lazy global emission
Also, add a stat for the number of globals emitted

llvm-svn: 10547
2003-12-20 02:45:37 +00:00
Chris Lattner
cd8f92bc62 Cleanup the JIT as per PR176. This renames the VM class to JIT, and merges the
VM.cpp and JIT.cpp files into JIT.cpp.  This also splits some nasty code out
into TargetSelect.cpp so that people hopefully won't notice it.  :)

llvm-svn: 10544
2003-12-20 01:46:27 +00:00
Chris Lattner
32658dbaf3 Update for changes in the JIT
llvm-svn: 10543
2003-12-20 01:45:17 +00:00
Chris Lattner
1cb1efedb3 Rip JIT specific stuff out of TargetMachine, as per PR176
llvm-svn: 10542
2003-12-20 01:22:19 +00:00
Chris Lattner
9047cde657 Finegrainify namespacification
llvm-svn: 10465
2003-12-14 23:25:48 +00:00
Brian Gaeke
84101bcdb8 Dynamically get the right-sized member of a GenericValue to hold a size_t, and
use it to return the result of strlen.

llvm-svn: 10433
2003-12-12 15:38:06 +00:00
Chris Lattner
f58e098889 Implement the ExecutionEngine::getPointerToFunctionOrStub by forwarding the
request on to the TargetMachine if it supports the getJITStubForFunction method

llvm-svn: 10431
2003-12-12 07:12:02 +00:00
Brian Gaeke
fb0c4c3d39 Since we are using a gep_type_iterator, we apparently must get the type
index by using I.getOperand() here. This was failing an assertion on
basically every struct access.

llvm-svn: 10426
2003-12-12 05:13:05 +00:00
Brian Gaeke
7fe399f169 Fix typo in comment. Add prototype for getConstantExprValue().
llvm-svn: 10390
2003-12-11 00:23:28 +00:00
Brian Gaeke
e7599245cb Add support for --debug-only=interpreter, to print out instrs before
interpreting them.

Move support for getting the value of a ConstantExpr into
getConstantExprValue(), and add support for the rest of the different
kinds of ConstantExprs.  (I don't think I like ConstantExprs!)
This requires separate procedures executeShlInst() and executeShrInst().

Reduce the number of references to TheEE.

Get rid of an old comment mentioning annotations.

Fix exitCalled(), which was crashing the Interpreter. This was a
leftover from the return-value code refactoring.

llvm-svn: 10389
2003-12-11 00:22:59 +00:00
Chris Lattner
369445aaa6 implement method
llvm-svn: 10321
2003-12-08 08:23:04 +00:00
Chris Lattner
23328c5f69 Use the new method, though noone currently implements it any better than before
llvm-svn: 10320
2003-12-08 08:22:48 +00:00
Chris Lattner
ebd5b871e4 Finegrainify namespacification
llvm-svn: 10318
2003-12-08 08:06:28 +00:00
Chris Lattner
1a513f2b83 Emit constants to one contiguous block, but this time, respect alignment constraints.
If this doesn't work Misha, feel free to revert it.

llvm-svn: 10267
2003-11-30 04:23:21 +00:00
Misha Brukman
acb0d474e9 Go back to allocating memory for each constant separately. Since SPARCs do not
allow unaligned loads, that is probably the problem I've been seeing in numerous
SPARC test cases failing. X86, on the other hand, just slows down unaligned
accesses, since it must make 2 aligned accesses for each unaligned one.

llvm-svn: 10266
2003-11-30 00:50:53 +00:00
Chris Lattner
50a3a40d5f Do not depend on structure elements being of type UByteTy
llvm-svn: 10224
2003-11-25 20:44:56 +00:00
Chris Lattner
8c11d31e35 Fine grainify namespaceification
llvm-svn: 10093
2003-11-19 21:08:57 +00:00
Misha Brukman
0b639e381c Emit the MachineConstantPool constants in one contiguous memory `pool'.
llvm-svn: 10060
2003-11-17 20:40:07 +00:00
Misha Brukman
023ada1793 * Order #includes as per style guide
* Delete blank comment lines
* Eliminate space between function name and open-paren ( to be consistent

llvm-svn: 10059
2003-11-17 20:37:02 +00:00
Brian Gaeke
d966bbe9bf Change LLI's internal representation of va_list to a pointer to the next
argument to be returned by va_arg. This allows va_lists to be passed
between different LLVM procedures (though it is unlikely that an LLI
va_list would make sense to an external function, except by chance.)

llvm-svn: 9965
2003-11-13 06:06:01 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Brian Gaeke
46510fbed5 Remove #include of PassManager.h which was marked FIXME, and apparently is no
longer used.

llvm-svn: 9823
2003-11-09 03:15:40 +00:00
Brian Gaeke
d246e0be30 Implement vaarg instruction. This is not quite perfect: 2003-08-11-VaListArg
still causes a crash. But it's better than before.

llvm-svn: 9794
2003-11-07 21:20:47 +00:00
Brian Gaeke
22bfc41ae1 popStackAndReturnValueToCaller() must advance instruction pointer to normal
destination, if returning from an invoke.

Implement 'unwind' instruction.

llvm-svn: 9792
2003-11-07 20:44:58 +00:00
Misha Brukman
4b82908055 Remove the *BIG UGLY HACK* from the JIT: PreSelection is now a FunctionPass.
llvm-svn: 9790
2003-11-07 20:32:08 +00:00
Brian Gaeke
88a4c1b68b Add stub version of unwind support
llvm-svn: 9789
2003-11-07 20:07:06 +00:00
Brian Gaeke
059af2222a visitCallInst --> visitCallSite.
Use visitCallSite to implement both CallInsts and InvokeInsts.

llvm-svn: 9788
2003-11-07 20:04:22 +00:00
Brian Gaeke
f7f7310b47 Make the operation of visitCallInst() only depend on the CallSite.
llvm-svn: 9787
2003-11-07 19:59:08 +00:00
Brian Gaeke
29d6325ca3 Use CallSites for call sites, instead of CallInsts. A revolutionary concept.
llvm-svn: 9784
2003-11-07 19:26:23 +00:00
Brian Gaeke
252fd99794 Refactor the return-from-function code into popStackAndReturnValueToCaller().
Make external function calls slightly less special; now they get a stack frame.

llvm-svn: 9765
2003-11-07 05:22:49 +00:00
Chris Lattner
3099f615fa Be friendly to gcc 3.4... good compiler. Nice compiler.
llvm-svn: 9726
2003-11-05 06:20:27 +00:00
Brian Gaeke
ee15c93eda Abort when the user program calls abort, instead of printing a funny message and calling exit(1).
llvm-svn: 9716
2003-11-05 01:18:49 +00:00
Brian Gaeke
251ac27789 Use regular old malloc to emulate malloc/alloca instructions.
llvm-svn: 9713
2003-11-05 01:02:14 +00:00
Brian Gaeke
246426591b Remove a comment which no longer applies.
llvm-svn: 9712
2003-11-05 00:59:28 +00:00
Brian Gaeke
d6816f603f In VM::create(), comment out almost the whole function if NO_JITS_ENABLED,
because the Arch variable will likely be undefined.

llvm-svn: 9576
2003-10-29 04:24:09 +00:00
Chris Lattner
4271c6fea0 Unbreak the build
llvm-svn: 9502
2003-10-25 16:18:03 +00:00
Brian Gaeke
1de42e556d ExecutionEngine::create no longer takes a TraceMode argument.
CurFrame, TraceMode, and the CachedWriter are history.
The ExecutionAnnotations (SlotNumber, InstNumber, and FunctionInfo) are history.
ExecutionContext now keeps Values for each stack frame in a std::map.
printValue() and print() are history.
executeInstruction() is now part of run().

llvm-svn: 9493
2003-10-24 19:59:37 +00:00
Brian Gaeke
8abf6d4df3 ExecutionEngine::create no longer takes a TraceMode argument.
CurFrame, TraceMode, and the CachedWriter are history.

llvm-svn: 9492
2003-10-24 19:59:28 +00:00
Brian Gaeke
719a4c165f The ExecutionAnnotations (SlotNumber, InstNumber, and FunctionInfo) are history.
llvm-svn: 9490
2003-10-24 19:59:18 +00:00
Brian Gaeke
032ca42757 Reduce the number of #includes.
CurFrame, TraceMode, and the CachedWriter are history.
ArrayChecksEnabled and non-QuietMode are history.
The ExecutionAnnotations (SlotNumber, InstNumber, and FunctionInfo) are history.
ExecutionContext now keeps Values for each stack frame in a std::map.
Stop pre-initializing Values on the stack to 42.
Remove some dead variables, excess whitespace and commented-out code.
executeInstruction() is now part of run().
printValue() and print() are history.

llvm-svn: 9489
2003-10-24 19:59:01 +00:00
Brian Gaeke
d857892674 ExecutionEngine::create no longer takes a TraceMode argument.
llvm-svn: 9488
2003-10-24 19:58:38 +00:00
Brian Gaeke
a039f6bb07 Destroy MachineFunction for any Function that we are about to
recompile and relink. This keeps it from failing an assertion when
it goes and tries to construct a new MachineFunction for that Function.

llvm-svn: 9459
2003-10-24 03:55:37 +00:00
John Criswell
de34542f41 Added LLVM copyright header.
llvm-svn: 9321
2003-10-21 15:17:13 +00:00
John Criswell
71d2894956 Added LLVM copyright notice to Makefiles.
llvm-svn: 9312
2003-10-20 22:26:57 +00:00
John Criswell
b402729b30 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
bdc522f19d Hrm, a relic from the past. How cute :)
llvm-svn: 9283
2003-10-20 05:45:49 +00:00
Chris Lattner
79135c051e Interpret the new varargs intrinsics correctly
llvm-svn: 9222
2003-10-18 05:55:25 +00:00
Misha Brukman
546d6e6764 Don't release the Module, as that invalidates the Module* within the
ModuleProvider, which has bad consequences in lli::callAsMain() which tries to
access that same Module*.

llvm-svn: 9205
2003-10-17 18:31:59 +00:00
Brian Gaeke
eaf7472fd7 Tidy up doxygen comment for getPointerToFunction().
Add prototypes for recompileAndRelinkFunction() and runJITOnFunction().

llvm-svn: 9200
2003-10-17 18:27:12 +00:00
Brian Gaeke
7b9b6dbd63 Refactor running the JIT passes on a single function into the new method,
runJITOnFunction().

Add new method for recompiling and patching in new versions of functions,
recompileAndRelinkFunction().

llvm-svn: 9199
2003-10-17 18:27:00 +00:00
Brian Gaeke
9b4da738dd Fix a typo in a comment, and zap a blank line.
llvm-svn: 9184
2003-10-16 23:33:38 +00:00
Misha Brukman
d5c9118c89 JIT.cpp:
* #include "llvm/ModuleProvider"
* alphabetize #includes
* omit extraneous parens in pointer expressions

VM.cpp:
* #include "llvm/ModuleProvider"
* alphabetize #includes

llvm-svn: 9182
2003-10-16 21:19:34 +00:00
Misha Brukman
45a9016e1d * Reorder includes as per the style guide
* Move the constructors from .h file here
* Document ExecutionEngine::create()
* Catch exception possibly thrown by ModuleProvider::releaseModule()

llvm-svn: 9181
2003-10-16 21:18:05 +00:00
Misha Brukman
50fa0a7bae Order #includes as per the style guide.
llvm-svn: 9128
2003-10-14 21:42:11 +00:00
Misha Brukman
5252af2728 Enabling incremental bytecode loading in the JIT:
* The VM is now constructed with a ModuleProvider

llvm-svn: 9125
2003-10-14 21:37:41 +00:00
Misha Brukman
cc1cfd01ed Enabling incremental bytecode loading in the JIT:
* ExecutionEngine and VM can be constructed using a ModuleProvider.

llvm-svn: 9124
2003-10-14 21:36:31 +00:00
Brian Gaeke
143f9b5000 Make mmap's fd for anonymous memory acquisition default to -1, except on
Linux. This is consistent with what FreeBSD and Solaris both want.
This makes the JIT work on FreeBSD 5.1-RELEASE. Whee.

llvm-svn: 9045
2003-10-11 03:51:18 +00:00
Brian Gaeke
a3f850a182 Don't include Config/stdio.h or <stdio.h>.
llvm-svn: 9031
2003-10-10 18:46:29 +00:00
Misha Brukman
e7d07e3cf1 * Tabs to spaces
* Doxygenified function comments
* Added FIXMEs to solicit documentation for other functions

llvm-svn: 9022
2003-10-10 17:45:12 +00:00
Misha Brukman
32c5aec6ec Fix spelling.
llvm-svn: 9021
2003-10-10 17:42:19 +00:00
Brian Gaeke
c38ad8b86e Never set any signal handlers.
Never call setjmp(), longjmp() or strsignal().

llvm-svn: 9014
2003-10-10 17:03:22 +00:00
Brian Gaeke
e90a3199eb Rewrite head-of-file comment.
In lookupFunction():
 Change to use "F" for Function argument instead of ancient "M".
 Remove commented-out code.
 Change to use GetAddressOfSymbol instead of dlsym.

llvm-svn: 9013
2003-10-10 17:03:10 +00:00
Brian Gaeke
30e2817dc5 Change to use GetAddressOfSymbol instead of dlsym.
llvm-svn: 9012
2003-10-10 17:02:42 +00:00
Chris Lattner
01d8fd6a3b Do not read past the end of the contained type list
llvm-svn: 8986
2003-10-09 20:31:18 +00:00
Chris Lattner
151444f98f Actually _PASS IN_ NO_RESERVE if we have it.
Thanks to Brian for fixing this obvious oops

llvm-svn: 8899
2003-10-06 19:07:41 +00:00
Chris Lattner
68f6d33416 Squelch warning
llvm-svn: 8659
2003-09-22 20:33:34 +00:00
Chris Lattner
a54026a27b Change FunctionInfo from being an annotation put on Functions to be
something which is mapped from functions.

llvm-svn: 8580
2003-09-17 17:26:22 +00:00
Misha Brukman
262290ec19 * Move include files from middle of file to the top where they belong, moving
the #define up there too
* Since we're including system headers, use the ones in include/llvm/Config
* While we're here, use the canonical LLVM header ordering algorithm

llvm-svn: 8463
2003-09-10 20:52:05 +00:00
Misha Brukman
286f1a0fe8 Fix warning when _POSIX_MAPPED_FILES is already defined in unistd.h
llvm-svn: 8436
2003-09-10 15:09:45 +00:00
Chris Lattner
978ba8d937 Remove a bunch of unneeded stuph
llvm-svn: 8400
2003-09-08 18:19:58 +00:00
Chris Lattner
6c68b828f6 Reorder #includes to follow LLVM conventions
llvm-svn: 8375
2003-09-05 20:08:15 +00:00
Brian Gaeke
ba6d0a6759 ExecutionEngine.h, GenericValue.h --> include/llvm/ExecutionEngine/
Build ExecutionEngine as library.

llvm-svn: 8370
2003-09-05 19:39:22 +00:00
Brian Gaeke
8e1bb0bcb2 Make getOperandValue and executeCastOperation methods of Interpreter.
This lets us protect a few more ExecutionEngine methods.

llvm-svn: 8367
2003-09-05 18:55:03 +00:00
Brian Gaeke
e157a77485 Make CreateArgv part of lli rather than part of ExecutionEngine.
Switch Interpreter and JIT's "run" methods to take a Function and a vector of
 GenericValues.
Move (almost all of) the stuff that constructs a canonical call to main()
 into lli (new methods "callAsMain", "makeStringVector").
Nuke getCurrentExecutablePath(), enableTracing(), getCurrentFunction(),
 isStopped(), and many dead decls from interpreter.
Add linux strdup() support to interpreter.
Make interpreter's atexit handler runner and JIT's runAtExitHandlers() look
 more alike, in preparation for refactoring.
atexit() is spelled "atexit", not "at_exit".

llvm-svn: 8366
2003-09-05 18:42:01 +00:00
Brian Gaeke
7be0ff04e5 Remove printOperandInfo(), and simplify run().
llvm-svn: 8362
2003-09-05 05:22:08 +00:00
Brian Gaeke
b42a2de8a9 Remove support for printing values from a module by name, only used
w/ interactive keyboard entry of names.
With that, Support.cpp is history.

llvm-svn: 8360
2003-09-05 05:04:32 +00:00
Brian Gaeke
edded6bce7 Remove support for interactive (step finish next) instructions.
Remove printCurrentInstruction, printStackFrame and infoValue
 (only used interactively) and other unused methods of Interpreter.
Fold UserInput.cpp containing only callMainFunction() into Interpreter.cpp.
Remove unused Profile flag.

llvm-svn: 8359
2003-09-05 04:46:26 +00:00
Brian Gaeke
5efbdb852a Remove support for breakpoints (not used).
Remove some dead code and whitespace.

llvm-svn: 8346
2003-09-04 23:15:40 +00:00
Brian Gaeke
0fdcd57402 Move EE dtor where it belongs
llvm-svn: 8345
2003-09-04 22:57:27 +00:00
Brian Gaeke
6d7d9f9cd9 Interpreter cleanups:
Get rid of support for DebugMode (make it always off).
Mung some comments.
Get rid of interpreter's PROFILE_STRUCTURE_FIELDS and PerformExitStuff
 which have been disabled forever.
Get rid of -abort-on-exception (make it always on).
Get rid of user interaction stuff (debug mode innards).
Simplify Interpreter's callMainFunction().

llvm-svn: 8344
2003-09-04 22:21:24 +00:00
Brian Gaeke
cec978e0ed ExecutionEngine.cpp: Move execution engine creation stuff into a new
static method here.
 Remove some extra blank lines.
ExecutionEngine.h: Add its prototype.
lli.cpp: Call it.

Make creation method for each type of EE into a static method of its
own subclass.

Interpreter/Interpreter.cpp: ExecutionEngine::createInterpreter -->
 Interpreter::create
Interpreter/Interpreter.h: Likewise.
JIT/JIT.cpp: ExecutionEngine::createJIT --> VM::create
JIT/VM.h: Likewise.

llvm-svn: 8343
2003-09-03 20:34:19 +00:00
Chris Lattner
f2e4f5a388 Preselection is now integrated into the Sparc target library
llvm-svn: 8305
2003-09-01 20:30:17 +00:00
Chris Lattner
25669f3e09 Sparc peephole optimizer moved out of post-opts library into Sparc target library
llvm-svn: 8302
2003-09-01 20:26:14 +00:00
Chris Lattner
94184ddd7b Consult the target data, not the module, about how large the current pointer
size is.  This ensures that if the module has no specified pointer size that
things will work correctly.

llvm-svn: 8136
2003-08-24 19:55:26 +00:00
Chris Lattner
24b58d4b81 Targets now configure themselves based on the source module, not on the
ad-hoc "Config" flags

llvm-svn: 8134
2003-08-24 19:50:53 +00:00
Chris Lattner
688dd40912 Add preliminary support for "any" pointersize/endianness. This will need
to change soon though.

llvm-svn: 8123
2003-08-24 14:02:47 +00:00
Chris Lattner
d9a212abca Minor cleanups: wrap at 80 lines. Convert file comment to doxygen format and
llvm style

llvm-svn: 8024
2003-08-21 21:32:12 +00:00
John Criswell
8bc390da1b The JIT now passes the environment pointer to the main() function when it
starts a program.  This allows the GNU env program to compile and JIT under
LLVM.

llvm-svn: 8022
2003-08-21 21:12:30 +00:00
Chris Lattner
785885a8c0 no really, implement it!
llvm-svn: 7955
2003-08-18 17:33:15 +00:00
Chris Lattner
d737232814 Add support for casting any pointer to any integer type
llvm-svn: 7953
2003-08-18 17:23:40 +00:00
Misha Brukman
56f7db4178 Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner
0427dd4f4f rename selection library to selectiondag
llvm-svn: 7878
2003-08-15 04:56:09 +00:00
Chris Lattner
25f5c7bbb3 Implement a _REAL_ memory manager for the code generated by the JIT. This
speeds up program execution by 15% pretty consistently for large programs

llvm-svn: 7845
2003-08-14 18:35:27 +00:00
Brian Gaeke
2e59087317 Deconstify parameter to getPointerToFunction().
llvm-svn: 7822
2003-08-13 18:17:54 +00:00
Brian Gaeke
39ff839ca3 Deconstify parameter to getPointerToFunction().
Use a FunctionPassManager instead of a PassManager.

llvm-svn: 7820
2003-08-13 18:16:50 +00:00
Brian Gaeke
a6ca67ed4a Deconstify parameter to getPointerToFunction().
Run passes on single function (hey, just-in-time compilation!)
 instead of the entire module that contains it.

llvm-svn: 7819
2003-08-13 18:16:34 +00:00
Brian Gaeke
f162b11e38 In ExecutionEngine::getPointerToGlobal(), throw away const qualifier
on Function * when passing it to getPointerToFunction().

llvm-svn: 7818
2003-08-13 18:16:14 +00:00
Chris Lattner
6cc411cb24 Incorporate mapping library into the sparc library
llvm-svn: 7800
2003-08-13 02:28:20 +00:00
Chris Lattner
a0d327277d Include the new selection library for the X86 target
llvm-svn: 7720
2003-08-11 14:59:53 +00:00
Chris Lattner
7e9e83e817 Specify DEBUG_TYPE's for the JIT debug messages
llvm-svn: 7604
2003-08-05 17:00:32 +00:00
Chris Lattner
64fade1536 DEBUG got moved to Debug.h
llvm-svn: 7491
2003-08-01 22:13:59 +00:00
Misha Brukman
442175ec3b * 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.

llvm-svn: 7381
2003-07-29 16:57:16 +00:00
Misha Brukman
c77e286633 Add rationale for the MAP_ANONYMOUS vs. MAP_ANON flags.
llvm-svn: 7368
2003-07-28 19:26:19 +00:00
Misha Brukman
c0193ca460 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.

llvm-svn: 7363
2003-07-28 19:09:06 +00:00
Misha Brukman
752c6f4548 Clean up code dealing with RTLD_SELF differences on Sparc and X86.
llvm-svn: 7362
2003-07-28 19:07:30 +00:00
Misha Brukman
cd6e03cb52 Fix reference to architecture.
llvm-svn: 7361
2003-07-28 19:06:50 +00:00
Misha Brukman
f4702ed4d1 Add in support to load shared objects (-load is provided by Support library).
llvm-svn: 7360
2003-07-28 19:06:19 +00:00
Chris Lattner
fc4a57d904 Fix space
llvm-svn: 7273
2003-07-23 20:21:06 +00:00
Chris Lattner
dd48c4b1e4 Remove redundant const qualifier
llvm-svn: 7254
2003-07-23 15:30:32 +00:00
Misha Brukman
755aa86ca3 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.

llvm-svn: 7204
2003-07-18 18:33:38 +00:00
Misha Brukman
45dc28808e 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.

llvm-svn: 7177
2003-07-15 15:58:26 +00:00
Misha Brukman
6a087a3a2f 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.

llvm-svn: 7176
2003-07-15 15:55:32 +00:00
Misha Brukman
009e42dd43 * 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.

llvm-svn: 7070
2003-07-02 17:53:19 +00:00
John Criswell
258dfc0319 Merged in autoconf branch. This provides configuration via the autoconf
system.

llvm-svn: 7014
2003-06-30 21:59:07 +00:00
Brian Gaeke
a00e8c6732 Get rid of the duplicate '0x' in debug mode.
llvm-svn: 7012
2003-06-30 18:06:20 +00:00
Brian Gaeke
af128adb0a Include <cmath> instead of <math.h>
Remove isnan; it's too unportable to handle cleanly at this point.

llvm-svn: 6866
2003-06-23 19:41:55 +00:00
Brian Gaeke
04d082abe5 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.)

llvm-svn: 6761
2003-06-17 23:14:06 +00:00
Brian Gaeke
17f041ba98 Use $(PLATFORMLIBDL) to selectively bring in -ldl only on those platforms where
it is needed.

llvm-svn: 6753
2003-06-17 20:09:18 +00:00
Brian Gaeke
db4d9c9bd8 Use std::isnan instead of isnan. Brought back to you from the
future, by the reconciliation of the C++ and C99 standards. Someday.

llvm-svn: 6751
2003-06-17 19:59:17 +00:00
Chris Lattner
6d0553444b Life is too short. Link in too much stuff on Linux to make building on sun easier
llvm-svn: 6748
2003-06-17 19:14:59 +00:00
Chris Lattner
0fc18257a9 The never-ending odyssey trying to get sparc to link
llvm-svn: 6747
2003-06-17 18:19:52 +00:00
Chris Lattner
85f1b38638 Make sure to get the value of ARCH before we use it
llvm-svn: 6746
2003-06-17 17:53:35 +00:00
Chris Lattner
0c7e4fdfa2 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. :(

llvm-svn: 6745
2003-06-17 15:54:52 +00:00
Chris Lattner
0aa503a72d Apparently "sparc" is a macro on sparcs. Ugh. :)
llvm-svn: 6744
2003-06-17 15:54:02 +00:00
Chris Lattner
ed38cd7aa9 Whoops, didn't mean to check that in :(
llvm-svn: 6743
2003-06-17 15:46:34 +00:00
Chris Lattner
1afd194a33 Use more structured command line option processing
llvm-svn: 6742
2003-06-17 15:43:13 +00:00
Chris Lattner
1f384965af #ifdef out code that only applies when the HOSTARCH = sparc
llvm-svn: 6741
2003-06-17 15:32:38 +00:00
Chris Lattner
66f5f27dcb Add #include for older GCC's
llvm-svn: 6670
2003-06-08 06:43:57 +00:00
Misha Brukman
1a3c1a6208 ::: 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 :::

llvm-svn: 6650
2003-06-06 06:59:55 +00:00
Misha Brukman
6762302093 Output function address as hex.
llvm-svn: 6649
2003-06-06 06:52:35 +00:00
Misha Brukman
999c7802ab Removed debug print statement.
llvm-svn: 6641
2003-06-06 00:00:54 +00:00
Misha Brukman
b2cf47cfc1 * 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.

llvm-svn: 6610
2003-06-04 19:45:25 +00:00
Misha Brukman
6e22f0fa52 Sparc's dlsym() requires the special operand RTLD_SELF to find a symbol in the
currently-running process.

llvm-svn: 6592
2003-06-04 01:57:22 +00:00
Misha Brukman
1c70c3f7a3 * 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.

llvm-svn: 6527
2003-06-02 03:23:16 +00:00
Brian Gaeke
bbbe5d71d2 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.

llvm-svn: 6520
2003-06-02 02:10:31 +00:00
Chris Lattner
1136441fcf Remove obsolete code
llvm-svn: 6518
2003-06-02 00:09:00 +00:00
Chris Lattner
a87f53efca Move target specific code to target files. The new MachineCodeEmitter
class is actually target independent!

llvm-svn: 6517
2003-06-01 23:24:36 +00:00
Brian Gaeke
495826a0e5 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.

llvm-svn: 6513
2003-06-01 22:08:29 +00:00
Misha Brukman
afa8e60f9f Fixed rewriting of branches -- they now work forward and backward.
llvm-svn: 6463
2003-05-31 06:26:48 +00:00
Misha Brukman
a9a5c77dd4 Since malloc is no longer used, no need to free() memory.
Fixed BasicBlock patching by supplying correct type for the displacement.

llvm-svn: 6453
2003-05-30 20:39:37 +00:00
Brian Gaeke
ad23dd697f Fix call to mmap, so that it can be used on sparc.
llvm-svn: 6424
2003-05-30 03:37:13 +00:00
Misha Brukman
e1a9c59304 mmap() seems to be failing on Sparc, so just use malloc()/free() .
llvm-svn: 6387
2003-05-28 18:44:38 +00:00
Misha Brukman
4931c59635 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.

llvm-svn: 6361
2003-05-27 21:42:05 +00:00
Misha Brukman
afffd58fe6 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...

llvm-svn: 6360
2003-05-27 21:40:39 +00:00
Chris Lattner
bfb822f655 Fix typeos
llvm-svn: 6204
2003-05-14 17:53:49 +00:00
Chris Lattner
5e5564a8de Add support for more constant expressions
llvm-svn: 6203
2003-05-14 17:51:49 +00:00
Chris Lattner
cbf31910a5 Add support for atexit function, remove support for __main function
llvm-svn: 6194
2003-05-14 14:21:30 +00:00
Chris Lattner
e7f979708b Add support for atexit handlers to the JIT, fixing 2003-05-14-AtExit.c
llvm-svn: 6193
2003-05-14 13:53:40 +00:00
Chris Lattner
6f80e1b3c7 Fix compilation problems with previous checking *blush*
llvm-svn: 6191
2003-05-14 13:27:36 +00:00
Chris Lattner
bda312754a Add a framework for intercepting system calls
llvm-svn: 6190
2003-05-14 13:26:47 +00:00