Commit Graph

538 Commits

Author SHA1 Message Date
Chris Lattner
6943570f3a Fix problems running the HowToUseJIT on powerpc, and probably problems with
ANY program that does not have all functions internalized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20258 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-20 18:43:35 +00:00
Chris Lattner
032ad0848a This is no longer needed. Global variables with undef initializers can be
initialized to anything, including garbage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20010 91177308-0d34-0410-b5e6-96231b3b80d8
2005-02-02 20:50:50 +00:00
Chris Lattner
4e7dd8f7c4 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??


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19729 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-21 19:59:37 +00:00
Chris Lattner
638559aaa3 Improve compatiblity with HPUX on Itanium, patch by Duraid Madina
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19586 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-16 01:31:31 +00:00
Chris Lattner
281a601198 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19434 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-10 18:23:22 +00:00
Chris Lattner
9dacd128b4 Silence warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19392 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 20:13:44 +00:00
Chris Lattner
813c815282 Silence VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 20:13:19 +00:00
Chris Lattner
a8101c163d Silence VS warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19390 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 20:07:03 +00:00
Chris Lattner
d564496b46 Silence VS warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08 20:05:34 +00:00
Reid Spencer
099557b629 Be double sure about including sys/stat.h by wrapping the inclusion in
an "#if defined(HAVE_SYS_STAT_H)".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19069 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-20 06:34:02 +00:00
Reid Spencer
6b4bd6b35c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19022 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-17 19:09:16 +00:00
Reid Spencer
382343d78f Only #include sys/stat.h if we're on linux where we have the PR274 problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19020 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-17 18:56:29 +00:00
Reid Spencer
4af3da6e6b Get rid of some leaks found by VC leak detector.
Patch contributed by Morten Ofsted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18889 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 16:04:04 +00:00
Chris Lattner
e518b7170b Properly implement a fix for PR475
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18537 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-05 07:19:16 +00:00
Chris Lattner
6d316f85ba Revert this patch, it broke a ton of programs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18535 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-05 06:59:59 +00:00
Alkis Evlogimenos
9d272d4953 Fix PR475.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18515 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-05 01:51:20 +00:00
Chris Lattner
b929de2a2c Remove darwin specific majik
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18467 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 23:02:55 +00:00
Chris Lattner
33306c0b8c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18454 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-03 07:16:51 +00:00
Chris Lattner
f71755dc56 Remove unneeded cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18405 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-01 17:13:05 +00:00
Chris Lattner
532343b24e Fix the JIT when being used from llvm-db
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18391 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-30 17:41:49 +00:00
Reid Spencer
df5a37efc9 Use System/DynamicLibrary instead of Support/DynamicLinker
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18357 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-29 14:11:29 +00:00
Chris Lattner
166f2269f5 Rename Emitter.cpp -> JITEmitter.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18132 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 22:00:25 +00:00
Chris Lattner
cf88d324a8 Fix the FIXME, nuke the JIT specific forceCompilationOf method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18131 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 21:54:35 +00:00
Chris Lattner
6f71720be3 These methods are obsolete
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18129 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 21:48:33 +00:00
Chris Lattner
b43dbdcb20 Support targets that require stubs for external functions better
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18098 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 07:24:43 +00:00
Chris Lattner
cb47941556 Clean up DEBUG output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18081 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 03:44:32 +00:00
Chris Lattner
5e22558853 Allow targets to avoid emitting a stub for EVERY lazily resolved call. In
most cases (e.g. direct calls) no stub is needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18080 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-21 03:37:42 +00:00
Chris Lattner
5426652c25 Implement relocation support by adding a target independent resolver interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18069 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 23:57:07 +00:00
Chris Lattner
3c600c8346 This method does not exist any longer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18061 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 23:51:03 +00:00
Chris Lattner
5be478f360 Add getCurrentPCOffset() and addRelocation() methods.
Add stub support for relocations to finishFunction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18035 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 03:46:14 +00:00
Chris Lattner
890b4bd3c0 Add accessor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18030 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 03:11:07 +00:00
Chris Lattner
45730d71b6 Match change in MachineCodeEmitter prototype.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18009 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 20:56:46 +00:00
Chris Lattner
a98c5453b2 This is a horrible hack to work around libstdc++ bugs :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17988 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-19 08:44:07 +00:00
Chris Lattner
02376e3f29 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17864 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 23:20:04 +00:00
Chris Lattner
0050ef8319 There is no reason to try to materialize the function from bytecode if it
already has been.  This may be a small speedup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17863 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-15 23:18:09 +00:00
Misha Brukman
895eddfad4 Implement ExecutionEngine::freeMachineCodeForFunction()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17601 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-07 23:58:46 +00:00
Brian Gaeke
88560c3a42 When emitting debug msgs for function stubs, don't truncate the
printed pointer value if sizeof(unsigned) != pointer size.  Instead,
use uintptr_t.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17338 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-29 18:22:45 +00:00
Reid Spencer
685f86ac0e Fix library name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17307 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-28 05:37:24 +00:00
Reid Spencer
6cb21d443e Change Library Names Not To Conflict With Others When Installed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17286 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-27 23:18:45 +00:00
Reid Spencer
abec8f96e3 Changes to support rand48 tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17284 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-27 23:03:44 +00:00
Chris Lattner
6f335f905c Fix the interpreter crash that Michael McCracken found
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17239 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-26 05:35:14 +00:00
Misha Brukman
ec8430270a Use cleaner quoting and eliminate blank space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17174 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-22 23:35:57 +00:00
Reid Spencer
cac731ecbe We won't use automake
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17155 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-22 03:35:04 +00:00
Reid Spencer
86d341b204 Initial automake generated Makefile template
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17136 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-18 23:55:41 +00:00
Chris Lattner
ec7c1ab1da Add support for unreachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17056 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:21:33 +00:00
Chris Lattner
bd1d382cc4 Add support for undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17055 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-16 18:19:26 +00:00
Reid Spencer
d96cb6eaa0 Update to reflect changes in Makefile rules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16950 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-13 11:46:52 +00:00
Reid Spencer
9f41a5fe85 Initial version of automake Makefile.am file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 20:43:57 +00:00
Reid Spencer
2da5c3dda6 Convert code to compile with vc7.1.
Patch contributed by Paolo Invernizzi. Thanks Paolo!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16368 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-15 17:06:42 +00:00
Reid Spencer
33189e787b Simplify the sys::Memory interface per Chris' request.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16318 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-13 22:38:11 +00:00
Reid Spencer
52b0ba6873 Convert the Emitter to use the lib/System "Memory" interface instead of the
old SystemUtils.h interface to allocate RWX blocks of memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16286 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-11 04:31:03 +00:00
Reid Spencer
551ccae044 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/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-01 22:55:40 +00:00
Chris Lattner
174f226464 Add a special case for argc,argv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15802 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-16 01:07:04 +00:00
Chris Lattner
f24d09933c Don't pass too many arguments into runFunction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15801 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-16 01:05:35 +00:00
Chris Lattner
cc22e9f406 Finally, add support for calling arbitrary non-varargs functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-16 00:14:18 +00:00
Chris Lattner
e5eab142a5 Handle all nullary functions, of any valid return type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15798 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-15 23:53:06 +00:00
Chris Lattner
f7bedf447e Fine, go all of the way and check that the argument types are correct as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15797 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-15 23:39:59 +00:00
Chris Lattner
d297aea5f2 These only really work if returning int or void
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15796 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-15 23:34:48 +00:00
Chris Lattner
7c45d7898b Handle zero arg function case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15794 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-15 23:31:43 +00:00
Chris Lattner
b47130c580 Simplify code a bit, print error message always instead of asserting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15793 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-15 23:29:50 +00:00
Alkis Evlogimenos
15876bb28c Stop using getValues().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15487 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-04 08:44:43 +00:00
Reid Spencer
40cf2f954e bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14951 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:41:27 +00:00
Chris Lattner
ed6c073097 Fixes for PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14848 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:51:32 +00:00
Chris Lattner
0a8e8e1a4e Fixes for PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14847 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:51:31 +00:00
Chris Lattner
beff74f821 The cleanup is done. Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14761 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 08:24:02 +00:00
Chris Lattner
5f90cb8c98 Make add constantexprs work with all types, fixing the regressions from last night
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14760 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 08:01:11 +00:00
Chris Lattner
d5e1d9d5f4 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14750 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 04:02:06 +00:00
Reid Spencer
f86cafdda4 Make error message consistent with the rest of LLVM by saying that bytecode
is read, not parsed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14677 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 21:20:28 +00:00
Reid Spencer
e294753128 Fix for bug 391.
Improve exeception handling around bcreader invocations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14674 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 21:01:38 +00:00
Reid Spencer
954da37bb4 Add #include <iostream> since Value.h does not #include it any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14622 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 12:19:56 +00:00
Chris Lattner
3048373748 Move the IntrinsicLowering header into the CodeGen directory, as per PR346
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14266 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-20 07:49:54 +00:00
Chris Lattner
8f7f71b48a Move the IntrinsicLowering header into the CodeGen directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14265 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-20 07:46:18 +00:00
Chris Lattner
f70c22b019 Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 18:19:28 +00:00
Brian Gaeke
59108d3d40 Add int ferror(FILE *)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14194 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-16 02:56:40 +00:00
Chris Lattner
abf1cd3ada Implement PR315: abort, don't warn, when missing external functions encountered
This fixes some critical problems building libstdc++ on cygwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13934 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-01 21:49:00 +00:00
Chris Lattner
0cb162b3bb Use the SystemUtils.h file to do our dirty work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13868 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-28 00:57:27 +00:00
Chris Lattner
6f05f35a84 Remove long unused #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13857 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 21:25:44 +00:00
Chris Lattner
63e8dfa8a3 These #includes are long dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13856 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 21:24:38 +00:00
Chris Lattner
c52663c4ed 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.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13839 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 18:03:56 +00:00
Reid Spencer
0098bdfb97 Get rid of a wart: useless getFILE function is now a cast macro.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13747 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-25 08:46:15 +00:00
Brian Gaeke
3c66c355b6 Generalize the strlen size_t hack, for the benefit of the other external
functions with wrappers that either take or return size_ts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13296 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-01 06:42:15 +00:00
Brian Gaeke
b440dea57b 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13122 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 18:05:28 +00:00
Brian Gaeke
aea1b58f1e Implement emitWordAt() for the JIT emitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13118 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 17:11:14 +00:00
Chris Lattner
759d34ffb7 Add support for the select instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13076 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 16:43:21 +00:00
Brian Gaeke
50872d5385 Add a TargetData to the PassManager regardless of the TargetMachine.
This should unbreak the Sparc JIT again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12949 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-14 17:45:52 +00:00
Chris Lattner
702a8a070f Adjust to new interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12646 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-04 19:47:06 +00:00
Chris Lattner
c6b0fb39cb Adjust to new gep_type_iterator prototypes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12644 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-04 17:30:06 +00:00
Chris Lattner
7d1bd336ab Fix PR296: [execution engines] Unhandled cast constant expression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12435 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-16 08:38:56 +00:00
Chris Lattner
317201d773 Rename the intrinsic enum values for llvm.va_* from Intrinsic::va_* to
Intrinsic::va*.  This avoid conflicting with macros in the stdlib.h file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12356 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-13 00:24:00 +00:00
Brian Gaeke
d0f3c5e8b1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12269 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-10 17:38:28 +00:00
Brian Gaeke
00f0a29e1c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12256 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-09 05:22:10 +00:00
Chris Lattner
b1dfc70ef1 remove obsolete comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11872 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-26 07:59:22 +00:00
Brian Gaeke
9d20b71eca 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11845 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 23:01:48 +00:00
Brian Gaeke
367b91d1bd Great sparc renaming fallout IV: Sparc --> SparcV9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11844 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 22:09:36 +00:00
Brian Gaeke
150666fd82 Great renaming part II: Sparc --> SparcV9 (also includes command-line options and Makefiles)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11827 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 19:08:12 +00:00
Chris Lattner
dd2c82a427 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11472 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-15 05:54:06 +00:00
Brian Gaeke
e62589058c 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??)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11370 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 06:18:39 +00:00
Brian Gaeke
d8400d86dd The Interpreter was failing the AtExit UnitTest. This fixes it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11367 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-13 05:48:00 +00:00
Chris Lattner
d5d8996720 Start using the new and improve interface to FunctionType arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11224 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 04:14:01 +00:00
Chris Lattner
aeb2a1d708 rename the "exceptional" destination of an invoke instruction to the 'unwind' dest
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11202 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 21:44:31 +00:00
Chris Lattner
23c4724369 Print out all globals as they are emitted, not just those emitted from
emitGlobals


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11191 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 19:33:23 +00:00
Chris Lattner
6c0398ed47 There is no reason to #define fd
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11190 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 19:33:07 +00:00
Chris Lattner
338733fdd2 Print an error message if we can't materialize the bytecode file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11043 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-01 01:07:25 +00:00
Chris Lattner
da79bd2322 Print an error message if there is an error materialize the bc file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11041 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-01 00:32:35 +00:00
Brian Gaeke
34562bab04 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10844 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-14 06:02:53 +00:00
Chris Lattner
55d86482bd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10674 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-31 20:21:04 +00:00
Chris Lattner
f70e0c216c Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10636 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 21:23:38 +00:00
Chris Lattner
7301178aac Pass around IntrinsicLowering instances as appropriate.
Reimplement the Interpreters implementation of va_* to be more direct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10627 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28 09:44:37 +00:00
Chris Lattner
87f03108f2 Factor code out of LLI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10616 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:50:30 +00:00
Chris Lattner
ff0f1bb32a No longer run atExit functions from run()
rename run to runFunction
Genericize the runFunction code a little bit, though it still stinks


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10610 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:13:47 +00:00
Chris Lattner
2cab55d7e1 No longer run atExit functions from run()
rename run to runFunction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10609 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-26 06:13:05 +00:00
Chris Lattner
028565b14b This should not be needed anymore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10558 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 10:19:18 +00:00
Chris Lattner
c07ed13875 Implement PR135, lazy emission of global variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10549 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 03:36:47 +00:00
Chris Lattner
24b0a18c43 Simple refactorings to prepare for lazy global emission
Also, add a stat for the number of globals emitted


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10547 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 02:45:37 +00:00
Chris Lattner
4d326fa9be 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.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10544 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 01:46:27 +00:00
Chris Lattner
61612df9cb Update for changes in the JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10543 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 01:45:17 +00:00
Chris Lattner
1e60a9165d Rip JIT specific stuff out of TargetMachine, as per PR176
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10542 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-20 01:22:19 +00:00
Chris Lattner
f7a743d7ed Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10465 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-14 23:25:48 +00:00
Brian Gaeke
6c9d582738 Dynamically get the right-sized member of a GenericValue to hold a size_t, and
use it to return the result of strlen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10433 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-12 15:38:06 +00:00
Chris Lattner
993bdcec00 Implement the ExecutionEngine::getPointerToFunctionOrStub by forwarding the
request on to the TargetMachine if it supports the getJITStubForFunction method


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10431 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-12 07:12:02 +00:00
Brian Gaeke
2798cd077a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10426 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-12 05:13:05 +00:00
Brian Gaeke
dfa58498ae Fix typo in comment. Add prototype for getConstantExprValue().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10390 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-11 00:23:28 +00:00
Brian Gaeke
63438cc9b0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10389 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-11 00:22:59 +00:00
Chris Lattner
e63fc8b46f implement method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10321 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-08 08:23:04 +00:00
Chris Lattner
38f0ebad9a Use the new method, though noone currently implements it any better than before
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10320 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-08 08:22:48 +00:00
Chris Lattner
c19aadee66 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10318 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-08 08:06:28 +00:00
Chris Lattner
2c0a6a19ef Emit constants to one contiguous block, but this time, respect alignment constraints.
If this doesn't work Misha, feel free to revert it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10267 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-30 04:23:21 +00:00
Misha Brukman
91de352796 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10266 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-30 00:50:53 +00:00
Chris Lattner
4af6de8f0a Do not depend on structure elements being of type UByteTy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10224 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-25 20:44:56 +00:00
Chris Lattner
c2ee9b9c7a Fine grainify namespaceification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10093 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-19 21:08:57 +00:00
Misha Brukman
ef7e57018d Emit the MachineConstantPool constants in one contiguous memory `pool'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10060 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-17 20:40:07 +00:00
Misha Brukman
0ca042db71 * Order #includes as per style guide
* Delete blank comment lines
* Eliminate space between function name and open-paren ( to be consistent


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10059 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-17 20:37:02 +00:00
Brian Gaeke
8da17489aa 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.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9965 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-13 06:06:01 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
Brian Gaeke
0bb3c2b854 Remove #include of PassManager.h which was marked FIXME, and apparently is no
longer used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9823 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-09 03:15:40 +00:00
Brian Gaeke
c1a2be18ea Implement vaarg instruction. This is not quite perfect: 2003-08-11-VaListArg
still causes a crash. But it's better than before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9794 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 21:20:47 +00:00
Brian Gaeke
dbde1ae7a0 popStackAndReturnValueToCaller() must advance instruction pointer to normal
destination, if returning from an invoke.

Implement 'unwind' instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9792 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 20:44:58 +00:00
Misha Brukman
cb93d8d3a9 Remove the *BIG UGLY HACK* from the JIT: PreSelection is now a FunctionPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9790 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 20:32:08 +00:00
Brian Gaeke
9bf06b155c Add stub version of unwind support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9789 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 20:07:06 +00:00
Brian Gaeke
fea483d7c0 visitCallInst --> visitCallSite.
Use visitCallSite to implement both CallInsts and InvokeInsts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9788 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 20:04:22 +00:00
Brian Gaeke
ae2495a921 Make the operation of visitCallInst() only depend on the CallSite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9787 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 19:59:08 +00:00
Brian Gaeke
2cb474c8ad Use CallSites for call sites, instead of CallInsts. A revolutionary concept.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9784 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 19:26:23 +00:00
Brian Gaeke
af955ba503 Refactor the return-from-function code into popStackAndReturnValueToCaller().
Make external function calls slightly less special; now they get a stack frame.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9765 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-07 05:22:49 +00:00
Chris Lattner
502dda001a Be friendly to gcc 3.4... good compiler. Nice compiler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9726 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 06:20:27 +00:00
Brian Gaeke
b56a6bc96a Abort when the user program calls abort, instead of printing a funny message and calling exit(1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9716 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 01:18:49 +00:00
Brian Gaeke
2fa8212a7a Use regular old malloc to emulate malloc/alloca instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9713 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 01:02:14 +00:00
Brian Gaeke
3636f4e0d6 Remove a comment which no longer applies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9712 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-05 00:59:28 +00:00
Brian Gaeke
11911abf5c In VM::create(), comment out almost the whole function if NO_JITS_ENABLED,
because the Arch variable will likely be undefined.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9576 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-29 04:24:09 +00:00
Chris Lattner
b8afbe6139 Unbreak the build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9502 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-25 16:18:03 +00:00
Brian Gaeke
f143d3c284 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9493 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-24 19:59:37 +00:00