Commit Graph

96 Commits

Author SHA1 Message Date
Chris Lattner
d2d5c76753 minor cleanups, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28087 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 18:55:56 +00:00
Chris Lattner
b4432f3d47 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28082 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 17:10:41 +00:00
Owen Anderson
a69571c799 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28074 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 01:29:57 +00:00
Chris Lattner
0eb4d6b52e Align function bodies correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28073 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 01:03:20 +00:00
Chris Lattner
e6fdcbfc47 Simplify some code. Don't add memory blocks to the Blocks list twice.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28071 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 00:54:49 +00:00
Chris Lattner
af1563fb62 Change the BasicBlockAddrs map to be a vector, indexed by MBB number.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28069 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 00:32:55 +00:00
Chris Lattner
32ca55f3bc Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28066 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 00:13:06 +00:00
Chris Lattner
f75f9be3fb 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28065 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 23:22:24 +00:00
Chris Lattner
f5d438c1f0 Do not make the JIT memory manager manage the memory for globals. Instead
just have the JIT malloc them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28062 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 21:57:51 +00:00
Chris Lattner
a726c7f1fd Minor cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28061 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 21:44:14 +00:00
Chris Lattner
43b429b059 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28059 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 18:27:26 +00:00
Chris Lattner
b0cc79d45b Remove dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28055 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 17:20:28 +00:00
Nate Begeman
c34b22716b Fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27967 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-25 17:46:32 +00:00
Nate Begeman
37efe67645 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27947 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-22 18:53:45 +00:00
Chris Lattner
239862ce99 simplify this code now that each constant pool entry is not separately allocated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26079 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-09 04:49:59 +00:00
Chris Lattner
3029f92051 Adjust to MachineConstantPool interface change: instead of keeping a
value/alignment pair for each constant, keep a value/offset pair.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26078 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-09 04:46:04 +00:00
Chris Lattner
fa77d43ba1 rename fields of constant pool entries
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26076 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-09 04:22:52 +00:00
Evan Cheng
b8973bd8f5 Allow the specification of explicit alignments for constant pool entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25855 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-31 22:23:14 +00:00
Chris Lattner
ca26180d39 Add #include of <iostream>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25516 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-22 23:41:42 +00:00
Chris Lattner
2199877563 Wrap long lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25140 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-07 06:20:51 +00:00
Andrew Lenharth
2b3b89c28e one cannot allocate a global, until one is done initializing the global pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22568 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-01 17:35:40 +00:00
Jeff Cohen
d29b6aa608 Keep tabs and trailing spaces out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22565 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-30 18:33:25 +00:00
Andrew Lenharth
a00269bc3e support near allocations for the JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22554 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-29 23:40:16 +00:00
Andrew Lenharth
6a9746127a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22537 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-28 12:44:13 +00:00
Jeff Cohen
00b16889ab Eliminate all remaining tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Chris Lattner
d6bbac500b fix a warning on 32-bit systems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22513 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-25 23:42:58 +00:00
Andrew Lenharth
16ec33c6ef 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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22497 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-22 20:48:12 +00:00
Chris Lattner
e884dc2c58 count the number of relocations performed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-20 16:29:20 +00:00
Reid Spencer
ee448630bd For PR540:
This patch completes the changes for making lli thread-safe. Here's the list
of changes:
* The Support/ThreadSupport* files were removed and replaced with the
  MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard.
  The implementation of MutexGuard.h is now based on sys::Mutex which hides
  its implementation and makes it unnecessary to have the -NoSupport.h and
  -PThreads.h versions of ThreadSupport.

* All places in ExecutionEngine that previously referred to "Mutex" now
  refer to sys::Mutex

* All places in ExecutionEngine that previously referred to "MutexLocker"
  now refer to MutexGuard (this is frivolous but I believe the technically
  correct name for such a class is "Guard" not a "Locker").

These changes passed all of llvm-test. All we need now are some test cases
that actually use multiple threads.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22404 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-12 15:51:55 +00:00
Misha Brukman
3c94497ec7 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21440 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 04:08:30 +00:00
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Chris Lattner
d91ff7cd3b Add support for targets that require stubs for external functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21313 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 01:44:27 +00:00
Chris Lattner
5b3a4553c1 Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20649 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-17 15:38:16 +00:00
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
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
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
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
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
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
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
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
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