Commit Graph

501 Commits

Author SHA1 Message Date
Owen Anderson
07000c6f01 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28238 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-12 06:33:49 +00:00
Chris Lattner
a5f0419b4e For extra sanity checking, fill free'd memory with garbage so we know that
people aren't reusing machine code buffers at all.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28228 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-12 00:03:12 +00:00
Chris Lattner
9f3d1ba9ad Fix some bugs in the freelist manipulation code.
Finally, implement ExecutionEngine::freeMachineCodeForFunction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28227 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-11 23:56:57 +00:00
Chris Lattner
e993cc27ad 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! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28225 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-11 23:08:08 +00:00
Chris Lattner
e7fd553b3b Move some methods out of line so that MutexGuard.h isn't needed in a public header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28179 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-08 22:00:52 +00:00
Chris Lattner
b93b0347d8 Adjust to use proper TargetData copy ctor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28112 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-04 21:18:40 +00:00
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
b003d76cb3 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27941 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-22 05:02:46 +00:00
Jeff Cohen
2f51914d82 Get JIT/Interpreter working on Windows again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27037 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-24 02:53:49 +00:00
Chris Lattner
70a7b1b381 prune #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26975 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 05:43:58 +00:00
Chris Lattner
ef98691ca3 remove always-null IntrinsicLowering argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26971 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 05:28:02 +00:00
Chris Lattner
726c1ef2bd remove the intrinsiclowering hook
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26970 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-23 05:22:51 +00:00
Chris Lattner
2fe4bb06c6 Eliminate the dependency of ExecutionEngine on the JIT/Interpreter libraries.
Now you can build a tool with just the JIT or just the interpreter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26946 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-22 06:07:50 +00:00
Reid Spencer
9dce2b3380 Convert llvm.cs.uiuc.edu -> llvm.org
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26748 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-14 05:54:52 +00:00
Chris Lattner
9ca6cdaee9 Add a helper method for running static ctors/dtors in the module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26619 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-08 18:42:46 +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
Jeff Cohen
8c9191c644 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26031 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-07 05:29:44 +00:00
Jeff Cohen
68835dd511 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26030 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-07 05:11:57 +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
Robert Bocchino
7c2b7c7c75 Fixed InitializeMemory to handle ConstantPacked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25481 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-20 18:18:40 +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
Chris Lattner
51e6a38b86 wrap long line
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25139 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-07 06:12:07 +00:00
Chris Lattner
3db4b62c2f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23914 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-23 23:54:56 +00:00
Chris Lattner
667eeca19d Shrinkify to match llc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23912 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-23 22:39:01 +00:00
Jim Laskey
839615a510 Add help support for -mcpu and -mattr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23222 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 19:27:43 +00:00
Jim Laskey
b1e1180ca0 1. Use SubtargetFeatures in llc/lli.
2. Propagate feature "string" to all targets.

3. Implement use of SubtargetFeatures in PowerPCTargetSubtarget.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23192 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 21:38:21 +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