Chris Lattner
b903fc5c1b
Add a couple of more functions that cannot access memory (the intrinsics) and
...
don't write to memory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12808 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-10 06:55:27 +00:00
Chris Lattner
ede6ac60a5
Simplify code a bit, and use alias analysis to allow us to delete unused
...
call and invoke instructions that are known to not write to memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-10 06:53:09 +00:00
Chris Lattner
e576b91948
Implement select.ll:test12*
...
This transforms code like this:
%C = or %A, %B
%D = select %cond, %C, %A
into:
%C = select %cond, %B, 0
%D = or %A, %C
Since B is often a constant, the select can often be eliminated. In any case,
this reduces the usage count of A, allowing subsequent optimizations to happen.
This xform applies when the operator is any of:
add, sub, mul, or, xor, and, shl, shr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12800 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 23:46:01 +00:00
Chris Lattner
570751c2a7
Fold code like:
...
if (C)
V1 |= V2;
into:
Vx = V1 | V2;
V1 = select C, V1, Vx
when the expression can be evaluated unconditionally and is *cheap* to
execute. This limited form of if conversion is quite handy in lots of cases.
For example, it turns this testcase into straight-line code:
int in0 ; int in1 ; int in2 ; int in3 ;
int in4 ; int in5 ; int in6 ; int in7 ;
int in8 ; int in9 ; int in10; int in11;
int in12; int in13; int in14; int in15;
long output;
void mux(void) {
output =
(in0 ? 0x00000001 : 0) | (in1 ? 0x00000002 : 0) |
(in2 ? 0x00000004 : 0) | (in3 ? 0x00000008 : 0) |
(in4 ? 0x00000010 : 0) | (in5 ? 0x00000020 : 0) |
(in6 ? 0x00000040 : 0) | (in7 ? 0x00000080 : 0) |
(in8 ? 0x00000100 : 0) | (in9 ? 0x00000200 : 0) |
(in10 ? 0x00000400 : 0) | (in11 ? 0x00000800 : 0) |
(in12 ? 0x00001000 : 0) | (in13 ? 0x00002000 : 0) |
(in14 ? 0x00004000 : 0) | (in15 ? 0x00008000 : 0) ;
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12798 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 22:50:22 +00:00
John Criswell
6d804f408a
Reversed the order of the llvm.writeport() operands so that the value
...
is listed first and the address is listed second.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 19:09:14 +00:00
Chris Lattner
2eefe518de
Fold binary operators with a constant operand into select instructions
...
that have a constant operand. This implements
add.ll:test19, shift.ll:test15*, and others that are not tested
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12794 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 19:05:30 +00:00
Chris Lattner
82e14fe168
Implement select.ll:test11
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12793 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 18:19:44 +00:00
Alkis Evlogimenos
9a8b490735
Add definition list to each live interval.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12791 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 18:07:57 +00:00
John Criswell
aee0cf3fca
Changed assertions to error messages.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12787 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-09 15:10:15 +00:00
John Criswell
ca6ea0f137
Changes recommended by Chris:
...
InstSelectSimple.cpp:
Change the checks for proper I/O port address size into an exit() instead
of an assertion. Assertions aren't used in Release builds, and handling
this error should be graceful (not that this counts as graceful, but it's
more graceful).
Modified the generation of the IN/OUT instructions to have 0 arguments.
X86InstrInfo.td:
Added the OpSize attribute to the 16 bit IN and OUT instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12786 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 22:39:13 +00:00
Chris Lattner
f499eaca36
Implement InstCombine/cast-propagate.ll
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12784 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 20:39:49 +00:00
John Criswell
4ffff9e2fa
Added the llvm.readport and llvm.writeport intrinsics for x86. These do
...
I/O port instructions on x86. The specific code sequence is tailored to
the parameters and return value of the intrinsic call.
Added the ability for implicit defintions to be printed in the Instruction
Printer.
Added the ability for RawFrm instruction to print implict uses and
defintions with correct comma output. This required adjustment to some
methods so that a leading comma would or would not be printed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12782 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 20:31:47 +00:00
John Criswell
9570301ee8
Added the llvm.readport and llvm.writeport intrinsics.
...
The Verifier ensures that their parameters are of integral types and have
the correct sign, but it does not enforce any size restrictions because
such restrictions are platform dependent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 20:27:38 +00:00
Chris Lattner
8ba725b456
Implement ScalarRepl/select_promote.ll
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12779 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 19:59:34 +00:00
Chris Lattner
775cbdd51a
Remove the "really gross hacks" that are there to deal with recursive functions.
...
Now we collect all of the call sites we are interested in inlining, then inline
them. This entirely avoids issues with trying to inline a call site we got by
inlining another call site. This also eliminates iterator invalidation issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12770 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 06:34:31 +00:00
Chris Lattner
0c199a7628
Implement InstCombine/select.ll:test[7-10]
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12769 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-08 04:43:23 +00:00
Brian Gaeke
8089822a8c
Don't include InstrSelectionSupport.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12766 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 20:55:32 +00:00
Brian Gaeke
1523aac530
Move ChooseRegOrImmed() prototype here, from InstrSelectionSupport.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12765 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 20:38:57 +00:00
Brian Gaeke
92976137df
Don't include InstrSelectionSupport.h.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12764 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 20:38:56 +00:00
Chris Lattner
cb69a4ed64
Implement test/Regression/Transforms/InstCombine/getelementptr_index.ll
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12762 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 18:38:20 +00:00
Brian Gaeke
58fe7695b9
Fix insertion of SelectInsts.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12760 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 18:31:47 +00:00
Brian Gaeke
8005ed3bd7
Don't print [%reg + 0], just print [%reg]
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12759 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 17:33:56 +00:00
Brian Gaeke
f3334ebbe3
First version of code to handle loads. Stub function for handling stores.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12758 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 17:29:37 +00:00
Brian Gaeke
562cb16381
Support loading arguments from %I0...%I5 into virtual registers in
...
function prologues, and fix an off-by-one in visitCallInst that was
putting call args into the wrong registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 17:04:09 +00:00
Brian Gaeke
d54c38b2f4
It's setting up the call args right now, but on the callee side, it's
...
trying to get incoming args off the stack, instead of the %i0...%i6 regs,
which is wrong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 16:41:22 +00:00
Chris Lattner
627018b4b3
Fix a bug Brian found.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12754 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 16:16:11 +00:00
Chris Lattner
4d0cda4d5c
This is a start on handling setcc instructions. As the comment notes, we
...
have no good way of handling this until the code generator is improved.
We should probably just emit V9 instructions in the meantime.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12745 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 05:04:51 +00:00
Chris Lattner
6179047661
andd subcc instructions which is used to create the 'cmp' pseudo instruction
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12744 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 05:04:01 +00:00
Chris Lattner
0d538bbec2
Avoid emitting an extra copy on each 32-bit operation
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12743 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:36:53 +00:00
Brian Gaeke
88ddd4a07d
Make generation of stack-slot loads and copies less ugly.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12742 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:29:14 +00:00
Brian Gaeke
fa4bb09cf0
Fix bug in printing loads.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12741 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:29:03 +00:00
Chris Lattner
4be7ca5721
Add support for shift instructions, wrap some long lines
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12740 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:27:16 +00:00
Chris Lattner
a562efce35
Fix encoding of existing shift instructions, add rr shifts
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12739 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:26:57 +00:00
Chris Lattner
22ede709f6
Add a bunch more instructions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12737 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:06:46 +00:00
Chris Lattner
f97b31e9cf
Merge my changes with brians
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12736 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:05:49 +00:00
Brian Gaeke
0f51cc1759
Add in some things I forgot, which Chris helpfully reminded me of...
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12735 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:05:12 +00:00
Brian Gaeke
59e04e4889
Add support for the "Y" register, used by MUL & DIV.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12734 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:01:11 +00:00
Brian Gaeke
e88c9dc860
Add UDIV, SDIV, and a few variants of WR.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12733 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:01:00 +00:00
Brian Gaeke
2d4fa8faac
Preliminary support for getting 64-bit integer constants into registers.
...
Preliminary support for division. It's gross because you have to initialize
the "Y" register, which is the top 32 bits of the thing you're dividing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12732 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 04:00:49 +00:00
Brian Gaeke
ff8282604a
Prune unnecessary #includes
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12731 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 23:25:07 +00:00
Brian Gaeke
20117102c2
Simple delay slot filler pass.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12730 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 23:21:45 +00:00
Brian Gaeke
86a8790826
Add references to delay slot filler pass.
...
Fill in addPassesToJITCompile method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12729 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 23:21:24 +00:00
Brian Gaeke
3a8ad62d4f
First attempt at handling frame index elimination.
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12728 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 22:10:22 +00:00
Brian Gaeke
1c38175d6b
First attempt at special-casing printing of [%reg + offset] for
...
ld/st instructions - doesn't seem to work yet, but I think it's
just a typo or something somewhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12727 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 22:10:11 +00:00
Brian Gaeke
856e4fc59e
Delete reference to "the Mach-O Runtime ABI".
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12726 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 22:09:59 +00:00
Brian Gaeke
ea8494bb89
Deal with call return values.
...
Don't put NOPs in delay slots at all. We'll have a fix-up pass later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12725 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 22:09:23 +00:00
Jakub Staszak
8ac0009979
file based off InstSelectSimple.cpp, slowly being replaced by generated code from the really simple X86 instruction selector tablegen backend
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12715 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 19:35:17 +00:00
Jakub Staszak
0a8fd30c1b
Tablgen files for really simple instruction selector
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12714 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 19:34:00 +00:00
Chris Lattner
7b92de1e7d
Fix PR313: [x86] JIT miscompiles unsigned short to floating point
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12711 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 19:29:36 +00:00
Chris Lattner
43ab3a8f45
Fix incorrect encoding of some ADC and SBB instuctions
...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12710 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-06 19:20:32 +00:00