Commit Graph

59 Commits

Author SHA1 Message Date
Chris Lattner
5a032de387 Change from using MachineRelocation ctors to using static methods
in MachineRelocation to create Relocations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28088 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-03 20:30:20 +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
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
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
d3f0aefc33 Fix a purely hypothetical problem (for now): emitWord emits in the host
byte format.  This doesn't work when using the code emitter in a cross target
environment.  Since the code emitter is only really used by the JIT, this
isn't a current problem, but if we ever start emitting .o files, it would be.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28060 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 19:14:47 +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
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
ea4a9c575f Teach the JIT how to relocate LI, this fixes the JIT on Prolangs-C/TimberWolfMC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27943 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-22 06:17:56 +00:00
Nate Begeman
6fcbd6961d Change the PPC JIT to use a Static relocation model
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27937 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-21 22:04:15 +00:00
Chris Lattner
369503f841 Move some knowledge about registers out of the code emitter into the register info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27770 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-17 21:07:20 +00:00
Chris Lattner
f3ce43210a Don't emit pseudo instructions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26926 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-21 20:19:37 +00:00
Chris Lattner
e928a72772 teach the JIT to encode vector registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26697 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-10 20:19:50 +00:00
Evan Cheng
4c1aa86657 - Added option -relocation-model to set relocation model. Valid values include static, pic,
dynamic-no-pic, and default.
PPC and x86 default is dynamic-no-pic for Darwin, pic for others.
- Removed options -enable-pic and -ppc-static.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26315 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-22 20:19:42 +00:00
Evan Cheng
d2ee218b49 Moved PICEnabled to include/llvm/Target/TargetOptions.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26272 91177308-0d34-0410-b5e6-96231b3b80d8
2006-02-18 00:08:58 +00:00
Chris Lattner
37dd6f1b79 Functions that are lazily streamed in from the .bc file are *not* external.
This fixes llvm-test/SingleSource/UnitTests/2006-01-29-SimpleIndirectCall.c
and PR704


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25793 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-29 20:49:17 +00:00
Chris Lattner
86a5484079 Add explicit #includes of <iostream>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25509 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-22 22:53:01 +00:00
Chris Lattner
5fe0e28650 Fix the PPC JIT failures last night, which were due to mishandling of linkonce globals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25141 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-07 06:22:16 +00:00
Chris Lattner
e54645a6fb Fix the JIT failures from last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24659 91177308-0d34-0410-b5e6-96231b3b80d8
2005-12-11 07:37:41 +00:00
Nate Begeman
422b0cee7a Patch to clean up function call pseudos and support the BLA instruction,
which branches to an absolute address.  This is required to support objc
direct dispatch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-11-16 00:48:01 +00:00
Nate Begeman
21e463b2bf More PPC32 -> PPC changes, as well as merging some classes that were
redundant after the change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23759 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-16 05:39:50 +00:00
Chris Lattner
de123822e5 prune #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23752 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-15 21:58:54 +00:00
Chris Lattner
16e71f2f70 Rename PPC32*.h to PPC*.h
This completes the grand PPC file renaming


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23745 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 23:59:06 +00:00
Chris Lattner
2668959b88 Rename PowerPC*.h to PPC*.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23743 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 23:51:18 +00:00
Chris Lattner
4c7b43b43f Eliminate PowerPC.td and PPC32.td, consolidating them into PPC.td
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23738 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-14 23:37:35 +00:00
Chris Lattner
919c032fa4 Modify the ppc backend to use two register classes for FP: F8RC and F4RC.
These are used to represent float and double values, and the two regclasses
contain the same physical registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23577 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 01:35:02 +00:00
Chris Lattner
2b54400f08 Split IMPLICIT_DEF into IMPLICIT_DEF_GPR and IMPLICIT_DEF_FP, so that the
instructions take a consistent reg class.  Implement ISD::UNDEF in the dag->dag
selector to generate this, fixing UnitTests/2003-07-06-IntOverflow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23028 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 23:08:16 +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
Nate Begeman
2497e6391f Support building non-PIC
Remove the LoadHiAddr pseudo-instruction.
Optimization of stores to and loads from statics.
Force JIT to use new non-PIC codepaths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22494 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-21 20:44:43 +00:00
Nate Begeman
adeb43ddf4 Generate mfocrf when targeting g5. Generate fsqrt/fsqrts when targetin g5.
8-byte align doubles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22486 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-20 22:42:00 +00:00
Misha Brukman
b5f662fa03 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21425 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:30:14 +00:00
Chris Lattner
f577c6122f Add completely untested support for mtcrf/mfcrf encoding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21353 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:41:52 +00:00
Chris Lattner
477d1de9b2 Handle ExternalSymbol operands in the PPC JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21312 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 00:46:10 +00:00
Nate Begeman
d4c8bea47f Enable optimization suggested by Chris Lattner to not emit reloc stubs for
static global variables whose addresses are taken.  This allows us to
convert the following code for taking the address of a static function foo

        addis r2, r30, ha16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")
        lwz r3, lo16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")(r2)

which also includes linker stub code emitted at the end of the .s file not
shown here, and replace it with this:

        addis r2, r30, ha16(l1__2E_foo_2-"L00001$pb")
        la r3, lo16(l1__2E_foo_2-"L00001$pb")(r2)

which in addition to not needing linker help, also has no load instruction.
For those not up on PowerPC mnemonics, la is shorthand for add immediate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18239 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 07:09:01 +00:00
Chris Lattner
b752a97ca4 There is not a 1-1 mappign between llvm blocks and PPC blocks, do not use
LLVM blocks as the keys for the branch rewriter.  This fixes treeadd and
many other programs with the JIT.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18223 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-25 00:33:57 +00:00
Chris Lattner
5efb75daed * Rename existing relocations to be more specific
* Add relocations for refernces to non-lazy darwin stubs and implement
  them correctly.

With this change, we can correctly references external globals, and now
all but two UnitTests and all but 1 Regression/C tests pass.

More importantly, bugpoint-jit will start giving us useful testcases,
instead of always telling us that references to external globals don't
work :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18222 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 22:30:08 +00:00
Chris Lattner
00a8c01999 Loads are relocatable too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18198 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 02:03:44 +00:00
Chris Lattner
b765ff1219 Calls do not need a MovPCtoLR instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18197 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 02:00:06 +00:00
Chris Lattner
b9f26da5dd Get constant pools working. This fixes even more programs, allowing us to
pass 24/42 in UnitTests (up from 20).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18196 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 01:56:12 +00:00
Chris Lattner
8599d385a2 Rewrite branches more closely to correct. This makes more stuff pass, and
stops the infinite loops!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18194 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-24 01:35:12 +00:00
Chris Lattner
9ba12359e3 Enumerate CR registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18162 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 18:59:59 +00:00
Chris Lattner
d7fa35c6d2 Squelch a bogus warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18156 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 15:56:38 +00:00
Chris Lattner
7598bbac66 Fix a minor bug
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18153 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 06:56:31 +00:00
Chris Lattner
e94c517bb5 Emit relocations for the global variable using instructions. This gets us
LA, LOADHiAddr, CALLpcrel, and MovePCtoLR working, though the constant pool
probably is not right.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18144 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-23 05:59:53 +00:00
Chris Lattner
f2190b39d0 Remove some dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18136 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 23:07:22 +00:00
Chris Lattner
213c969c92 Disable this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18130 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 21:51:40 +00:00
Chris Lattner
99b394db15 This chunk of code needs to be rewritten
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18127 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-22 21:45:54 +00:00
Chris Lattner
a8b0fa5172 getJITStubForFunction is optional and unimplemented, just remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18036 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-20 04:14:44 +00:00
Chris Lattner
eea9b134fc Simplify namespaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17870 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-16 04:47:33 +00:00
Misha Brukman
d4b4a99587 * Correctly handle the MovePCtoLR pseudo-instr with a bl to next instr
* Stop the confusion of using rv and Addr for global addresses: just use rv


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17195 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-23 23:47:34 +00:00
Misha Brukman
a4df350ba1 * Do not emit IMPLICIT_DEF pseudo-instructions
* Convert register numbers from their opcode value to the real value, e.g.
  PPC::R1 => 1 and PPC::F1 => 1
* Add correct handling of loading of global values which are PC-relative --
  implement ha16() and lo16()


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17190 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-23 18:28:01 +00:00