1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
Commit Graph

296 Commits

Author SHA1 Message Date
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
c11eac5284 There is no reason to use a virtual method to store this word.
llvm-svn: 28053
2006-05-02 17:16:20 +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
Evan Cheng
b6c46ed8c9 Add a couple more pseudo instructions.
llvm-svn: 26939
2006-03-22 02:52:03 +00:00
Evan Cheng
40a98fd65d ConstantPoolIndex is now the displacement portion of the address (rather
than base).

llvm-svn: 26382
2006-02-26 09:12:34 +00:00
Evan Cheng
305141c1ba - 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.

llvm-svn: 26315
2006-02-22 20:19:42 +00:00
Evan Cheng
09bd678546 Jit does not support PIC yet.
llvm-svn: 26278
2006-02-18 00:57:10 +00:00
Evan Cheng
be93477b3a Don't special case XS, XD prefixes.
llvm-svn: 26183
2006-02-14 21:52:51 +00:00
Evan Cheng
9fd77e0a2d Bug fix: XS, XD prefixes were being emitted twice.
XMM registers were not being handled.

llvm-svn: 26182
2006-02-14 21:45:24 +00:00
Evan Cheng
ef93bdc0cf - Use xor to clear integer registers (set R, 0).
- Added a new format for instructions where the source register is implied
  and it is same as the destination register. Used for pseudo instructions
  that clear the destination register.

llvm-svn: 25872
2006-02-01 06:13:50 +00:00
Chris Lattner
0256ca3257 Fix a bunch of JIT failures with the new isel
llvm-svn: 25748
2006-01-28 18:19:37 +00:00
Chris Lattner
e1f4b9e384 Unbreak the JIT with SSE
llvm-svn: 25688
2006-01-27 18:27:18 +00:00
Chris Lattner
2873307819 Allow jit-beta to work
llvm-svn: 25578
2006-01-24 04:50:48 +00:00
Chris Lattner
aafc339b4e Add explicit #includes of <iostream>
llvm-svn: 25515
2006-01-22 23:41:00 +00:00
Chris Lattner
a556fc183f Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter
after itself.

llvm-svn: 22376
2005-07-11 05:17:48 +00:00
Nate Begeman
e5314eb2c2 First round of support for doing scalar FP using the SSE2 ISA extension and
XMM registers.  There are many known deficiencies and fixmes, which will be
addressed ASAP.  The major benefit of this work is that it will allow the
LLVM register allocator to allocate FP registers across basic blocks.

The x86 backend will still default to x87 style FP.  To enable this work,
you must pass -enable-sse-scalar-fp and either -sse2 or -sse3 to llc.

An example before and after would be for:
double foo(double *P) { double Sum = 0; int i; for (i = 0; i < 1000; ++i)
                        Sum += P[i]; return Sum; }

The inner loop looks like the following:
x87:
.LBB_foo_1:     # no_exit
        fldl (%esp)
        faddl (%eax,%ecx,8)
        fstpl (%esp)
        incl %ecx
        cmpl $1000, %ecx
        #FP_REG_KILL
        jne .LBB_foo_1  # no_exit

SSE2:
        addsd (%eax,%ecx,8), %xmm0
        incl %ecx
        cmpl $1000, %ecx
        #FP_REG_KILL
        jne .LBB_foo_1  # no_exit

llvm-svn: 22340
2005-07-06 18:59:04 +00:00
Chris Lattner
6dcae1c96e Tailcalls require stubs to be emitted. Otherwise, the compilation callback
doesn't know who 'called' it.

llvm-svn: 22136
2005-05-19 05:54:33 +00:00
Misha Brukman
bf3f6181fd * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21426
2005-04-21 23:38:14 +00:00
Chris Lattner
f4c8575535 There is no reason to emit function stubs for direct calls.
llvm-svn: 18082
2004-11-21 03:46:06 +00:00
Chris Lattner
4a340e281e Remove all JIT specific code and switch the code generator over to emitting
relocations for global references.

llvm-svn: 18068
2004-11-20 23:55:15 +00:00
Chris Lattner
0c79788bc4 Dont' forget to switch back to decimal output
llvm-svn: 18010
2004-11-19 20:57:07 +00:00
Chris Lattner
a7eec14b04 Fix a major bug in the signed shr code, which apparently only breaks 134.perl!
llvm-svn: 17902
2004-11-16 18:40:52 +00:00
Chris Lattner
41d31d7461 Remove a dead function, which died when we got GAS emission working (phwew,
hold your nose!)

llvm-svn: 17869
2004-11-16 04:34:29 +00:00
Chris Lattner
b378786c97 Implement a simple FIXME: if we are emitting a basic block address that has
already been emitted, we don't have to remember it and deal with it later,
just emit it directly.

llvm-svn: 17868
2004-11-16 04:30:51 +00:00
Chris Lattner
3f73c77ace * Merge some win32 ifdefs together
* Get rid of "emitMaybePCRelativeValue", either we want to emit a PC relative
  value or not: drop the maybe BS.  As it turns out, the only places where
  the bool was a variable coming in, the bool was a dynamic constant.

llvm-svn: 17867
2004-11-16 04:21:18 +00:00
Chris Lattner
3ed3e8669f Add debug-only=jit printout, so we see when lazily resolved symbols are
set up.

llvm-svn: 17862
2004-11-15 23:16:55 +00:00
John Criswell
97da76178c Fix compilation problem; make the cast and the LHS be the same type.
llvm-svn: 17488
2004-11-05 16:17:06 +00:00
Chris Lattner
499e1b16a7 Quiet VC++ warnings
llvm-svn: 17484
2004-11-05 04:50:59 +00:00
Chris Lattner
cac643c78f Improve compatibility with VC++, patch contributed by Morten Ofstad!
llvm-svn: 17126
2004-10-18 15:54:17 +00:00
Chris Lattner
bf114f32c0 Unify handling of constant pool indexes with the other code paths, allowing
us to use index registers for CPI's

llvm-svn: 17082
2004-10-17 07:49:45 +00:00
Chris Lattner
38de76365d Give the X86 JIT the ability to encode global+disp constants. Patch
contributed by Jeff Cohen!

llvm-svn: 17010
2004-10-15 04:53:13 +00:00
Misha Brukman
ec87a61944 Fix filename: Printer.cpp has become X86AsmPrinter.cpp
llvm-svn: 16299
2004-09-12 21:26:04 +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
24279a8ac8 Remove dead method
llvm-svn: 15647
2004-08-11 02:26:39 +00:00
Chris Lattner
9bcf258cc3 Make sure to emit the immediate byte for instructions like:
shrd [mem], reg, imm

This fixes the jit-ls failure on 186.crafty.

llvm-svn: 14914
2004-07-17 20:26:14 +00:00
Chris Lattner
5ad9eaab1a Convert to the new TargetMachine interface.
llvm-svn: 13952
2004-06-02 05:55:25 +00:00
Brian Gaeke
e5736bf986 Don't keep track of references to LLVM BasicBlocks while emitting; use
MachineBasicBlocks instead.

llvm-svn: 13568
2004-05-14 06:54:58 +00:00
Brian Gaeke
0db103b4b3 Use emitWordAt() to emit forward-branch fixups.
llvm-svn: 13120
2004-04-23 17:11:16 +00:00
Chris Lattner
ecbade26d5 Add support for new instruction type
llvm-svn: 12894
2004-04-13 17:18:51 +00:00
Alkis Evlogimenos
085957be0b Add emitInstruction() API so that we can get the bytes of a simple instruction
llvm-svn: 12252
2004-03-09 03:34:53 +00:00
Alkis Evlogimenos
813daf05c3 Constify things a bit
llvm-svn: 12251
2004-03-09 03:30:12 +00:00
Alkis Evlogimenos
f208a0fd81 Each instruction now has both an ImmType and a MemType. This describes
the size of the immediate and the memory operand on instructions that
use them. This resolves problems with instructions that take both a
memory and an immediate operand but their sizes differ (i.e. ADDmi32b).

llvm-svn: 11967
2004-02-28 22:02:05 +00:00
Alkis Evlogimenos
56d357aa23 Rename MRMS[0-7]{r,m} to MRM[0-7]{r,m}.
llvm-svn: 11921
2004-02-27 18:55:12 +00:00
Chris Lattner
f58d2dd6cf Add support for GlobalAddress's for alkis
llvm-svn: 11560
2004-02-17 18:23:55 +00:00
Chris Lattner
c4ea4d12bf Expand the repertoire of the forms we can print and encode.
llvm-svn: 11537
2004-02-17 07:40:44 +00:00
Alkis Evlogimenos
84318d7bb6 Make dense maps keyed on physical registers smallerusing
MRegisterInfo::getNumRegs() instead of
MRegisterInfo::FirstVirtualRegister.

Also use MRegisterInfo::is{Physical,Virtual}Register where
appropriate.

llvm-svn: 11477
2004-02-15 21:37:17 +00:00
Alkis Evlogimenos
e8f9647831 Add back machine code deleter pass until we get a MachineCode pass
that will be responsible for the creation of MachineFunctions and will
be required by all MachineFunctionPass passes.

llvm-svn: 11453
2004-02-15 00:03:15 +00:00
Chris Lattner
d1c4f4c833 Add support for the rep movs[bwd] instructions, and emit them when code
generating the llvm.memcpy intrinsic.

llvm-svn: 11351
2004-02-12 17:53:22 +00:00
Alkis Evlogimenos
b755d35fd2 Change MachineBasicBlock's vector of MachineInstr pointers into an
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.

llvm-svn: 11340
2004-02-12 02:27:10 +00:00
Alkis Evlogimenos
676e5b8997 Modify the two address instruction pass to remove the duplicate
operand of the instruction and thus simplify the register allocation.

llvm-svn: 11124
2004-02-04 22:17:40 +00:00
Alkis Evlogimenos
41bd8284e3 Remove floating point killer pass. This is now implemented in the
instruction selector by adding a new pseudo-instruction
FP_REG_KILL. This instruction implicitly defines all x86 fp registers
and is a terminator so that passes which add machine code at the end
of basic blocks (like phi elimination) do not add instructions between
it and the branch or return instruction.

llvm-svn: 10562
2003-12-20 16:22:59 +00:00
Chris Lattner
ef1bfa35d0 Finally, _actually delete the machine code_ for a function, after it has
been emitted.  Also, since the FPK pass is causing memory access violations,
disable it.

llvm-svn: 10559
2003-12-20 10:20:19 +00:00
Chris Lattner
d3676d0774 A minor cleanup for better encapsulation
llvm-svn: 10545
2003-12-20 02:03:14 +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
John Criswell
93c209e4ac Modified cast so that it converts the int to a long before casting to
a pointer.  This evades a warning emitted by GCC when we cast from
unsigned int (32 bit) to void * (64 bit) on SparcV9.

llvm-svn: 10435
2003-12-12 19:57:48 +00:00
Chris Lattner
b750a0cf3a Implement the TargetMachine::getJITStubForFunction method for X86, finegrainify
namespacification.

llvm-svn: 10430
2003-12-12 07:11:18 +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
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
5a577c0b28 * Rename X86::IMULr16 -> X86::IMULrr16
* Implement R1 = R2 * C where R1 and R2 are 32 or 16 bits. This avoids an
  extra copy into a register, reducing register pressure.

llvm-svn: 9278
2003-10-20 03:42:58 +00:00
Brian Gaeke
edea9eca83 Fix typo in comment.
llvm-svn: 9187
2003-10-16 23:45:05 +00:00
Misha Brukman
56f7db4178 Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Brian Gaeke
299cf12f45 addPassesToJITCompile and addPassesToEmitMachineCode now take a
FunctionPassManager, to support function-at-a-time compilation and
 emission of code.

llvm-svn: 7821
2003-08-13 18:17:27 +00:00
Chris Lattner
17fc21b5fa This is the real fix for the previous register allocator problem.
Physical registers should not float around.

llvm-svn: 7587
2003-08-05 00:48:47 +00:00
Chris Lattner
25e28f61ab Set debug types
llvm-svn: 7532
2003-08-03 21:14:38 +00:00
Chris Lattner
1baa706ab7 Move DEBUG to Debug.h
llvm-svn: 7497
2003-08-01 22:21:34 +00:00
Chris Lattner
f0df04752d We don't modify the LLVM rep, remain const correct
llvm-svn: 7345
2003-07-26 23:06:00 +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
4681b27a92 Isolate machine-dependent use of <alloca.h> in "Support/Alloca.h",
so that we can easily change its use to be conditional on the result of
an autoconf test later.

llvm-svn: 6723
2003-06-16 21:54:01 +00:00
Chris Lattner
d4e4130f0a Fix warnings on Sparc
llvm-svn: 6658
2003-06-06 18:25:33 +00:00
Chris Lattner
437985e52c Add statistic for # machine instrs emitted
Add GROSS HACK to get CompilationCallback to work when compiled in release mode

llvm-svn: 6646
2003-06-06 04:00:05 +00:00
Chris Lattner
92fba99afb Add namespace comments for doxygen
llvm-svn: 6581
2003-06-03 15:31:23 +00:00
Misha Brukman
cb7c80a95c Eliminated a compiler warning due to casting to a different-sized datatype.
llvm-svn: 6531
2003-06-02 04:13:58 +00:00
Misha Brukman
8ce9f2956e Renamed MachineCodeEmitter.cpp -> X86CodeEmitter.cpp as it conflicts with the
target-independent lib/CodeGen/MachineCodeEmitter.cpp; preserved CVS history.

llvm-svn: 6528
2003-06-02 03:28:00 +00:00
Chris Lattner
be569e986d Move X86 specific code out of the JIT into the X86 backend
llvm-svn: 6516
2003-06-01 23:23:50 +00:00
Chris Lattner
99520168c9 This blank line has GOT to go.
llvm-svn: 6057
2003-05-09 03:28:13 +00:00
Chris Lattner
59c46ee655 IMPLICIT_DEF was not the beautiful elegant solution I thought it was going
to be.  In fact, it made stuff worse.  :(

llvm-svn: 6013
2003-05-07 19:21:28 +00:00
Chris Lattner
b6fab2a875 Don't have a cow with new pseudo instructions
llvm-svn: 6009
2003-05-06 21:31:47 +00:00
Chris Lattner
b27d60ccf1 Rename MachineInstrInfo -> TargetInstrInfo
llvm-svn: 5272
2003-01-14 22:00:31 +00:00
Chris Lattner
d329d95d7f * Add support for FP registers ST*
* Add support for the constant pool & constant pool indices
* Add support for MRMS?m instructions
* Fix FP Prefix emission
* Add support for global addresses and external symbols

llvm-svn: 5224
2003-01-13 00:33:59 +00:00
Chris Lattner
9f8812ec40 * Convert to a MachineFunctionPass
* ctor doesn't take TM argument
* handle direct ESP references correctly!

llvm-svn: 5179
2002-12-28 20:24:48 +00:00
Chris Lattner
c96e206d58 Add support for FP prefixes
llvm-svn: 5151
2002-12-25 05:09:21 +00:00
Chris Lattner
9e13907a4f Add support for the bswap instruction
llvm-svn: 5114
2002-12-23 23:46:00 +00:00
Chris Lattner
d838414ec1 fix warning
llvm-svn: 5107
2002-12-20 04:12:48 +00:00
Chris Lattner
ea2d8ad746 Give passes nice names!
llvm-svn: 5059
2002-12-15 21:13:40 +00:00
Chris Lattner
534876a78c Use MachineOperand::isFoo methods instead of our own global functions
llvm-svn: 5033
2002-12-15 08:01:39 +00:00
Brian Gaeke
5da234a1d7 InstSelectSimple.cpp: Give promote32 a comment. Add initial
implementation of getReg() for arguments.

MachineCodeEmitter.cpp: Fix using EBP with index, scale and no
 displacement (whew!) due to Chris.

Printer.cpp: Fix printing out index and scale in memory references.

llvm-svn: 4998
2002-12-13 07:56:18 +00:00
Chris Lattner
62454d83f0 Emit the right form of mod/rm mod field
llvm-svn: 4986
2002-12-13 05:05:05 +00:00
Chris Lattner
723ca2522d Rename MemArg* to Arg*
llvm-svn: 4979
2002-12-13 03:51:55 +00:00
Chris Lattner
b698cd8236 Make mem size an assert
Add mem size flags to all instructions using an imm

llvm-svn: 4978
2002-12-13 03:50:13 +00:00
Misha Brukman
6a5788bb6f This is supposed to provide correct size for datatypes. Supposedly.
llvm-svn: 4977
2002-12-13 02:13:15 +00:00
Chris Lattner
96edaabdb2 Fix bogus assertion failures
llvm-svn: 4919
2002-12-04 17:32:52 +00:00
Chris Lattner
73ac28801e Add support for referencing global variables/functions
llvm-svn: 4907
2002-12-04 06:45:19 +00:00
Chris Lattner
5f0614914e Split the machine code emitter completely out of the printer
llvm-svn: 4882
2002-12-03 06:34:06 +00:00
Chris Lattner
e66d3e90ce More support for machine code emission: raw instructions
llvm-svn: 4872
2002-12-02 21:56:18 +00:00
Chris Lattner
f48a330fd8 Start implementing MachineCodeEmitter
llvm-svn: 4870
2002-12-02 21:44:34 +00:00
Chris Lattner
8227eea4fe Initial support for machine code emission
llvm-svn: 4866
2002-12-02 21:24:12 +00:00