Andrew Lenharth
e831777542
turn on IEEE for compares
...
llvm-svn: 20425
2005-03-03 22:12:11 +00:00
Andrew Lenharth
e6dbf989b3
beter Select on FP
...
llvm-svn: 20424
2005-03-03 21:47:53 +00:00
Chris Lattner
4439f1686f
Print -X like this:
...
double test(double l1_X) {
return (-l1_X);
}
instead of like this:
double test(double l1_X) {
return (-0x0p+0 - l1_X);
}
llvm-svn: 20423
2005-03-03 21:12:04 +00:00
Andrew Lenharth
b5ddbc074d
LSR cleanup patch
...
llvm-svn: 20422
2005-03-03 19:03:21 +00:00
Chris Lattner
8074739aa2
Do not lower malloc's to pass "sizeof" expressions like this:
...
ltmp_0_7 = malloc(((unsigned )(&(((signed char (*)[784])/*NULL*/0)[1u]))));
Instead, just emit the literal constant, like this:
ltmp_0_7 = malloc(784u);
This works around a bug in ICC 8.1 compiling the CBE generated code. :-(
llvm-svn: 20415
2005-03-03 01:04:50 +00:00
Chris Lattner
4814696e7d
Add an optional argument to lower to a specific constant value instead of
...
to a "sizeof" expression.
llvm-svn: 20414
2005-03-03 01:03:43 +00:00
Misha Brukman
5b587350ee
Fix the spelling of the word `the'
...
llvm-svn: 20412
2005-03-02 23:17:31 +00:00
Chris Lattner
f9597dc689
Print the module ID as a comment.
...
llvm-svn: 20411
2005-03-02 23:12:40 +00:00
Chris Lattner
b205d87afe
cleanup the cfg after lsr
...
llvm-svn: 20410
2005-03-02 21:56:00 +00:00
Andrew Lenharth
1e213c7924
remove 32 sign extend after 32 sextload and handle small negative constant
...
llvm-svn: 20408
2005-03-02 17:23:03 +00:00
Andrew Lenharth
8fc5ba2e06
Added LSR as a beta pass for alpha
...
llvm-svn: 20407
2005-03-02 17:21:38 +00:00
Chris Lattner
798b18474c
Add a temporary option for llc-beta: -enable-lsr-for-ppc, which turns on
...
Loop Strength Reduction.
llvm-svn: 20399
2005-03-02 06:19:22 +00:00
Reid Spencer
a5fbf1d659
Be slightly more accurate in an error message.
...
llvm-svn: 20397
2005-03-02 05:45:56 +00:00
Chris Lattner
0bb2828efb
Fix a nasty order of evaluation bug that Gabor Greif ran into. Here's an
...
explanation from IRC:
|sabre| I think it's an order of evaluation thing
|sabre| for me, the RHS of the assignment is evaluated first
|sabre| getTypeDescription checks to see if ConcreteTypeDescription[Ty] contains anything
|sabre| since it doesn't, it computes and returns the value
|sabre| this gets put into the map.
|sabre| For you, the LHS is evaluated first.
|sabre| Map[Ty] (aka ConcreteTypeDescriptions[Ty]) inserts an empty string into the map, returning a reference
|sabre| getTypeDesc then sees the empty string in the map
|sabre| and returns it
|sabre| bork :)
llvm-svn: 20394
2005-03-02 03:54:43 +00:00
Jeff Cohen
6d82d5b23e
Fixed the following LSR bugs:
...
* Loop invariant code does not dominate the loop header, but rather
the end of the loop preheader.
* The base for a reduced GEP isn't a constant unless all of its
operands (preceding the induction variable) are constant.
* Allow induction variable elimination for the simple case after all.
Also made changes recommended by Chris for properly deleting
instructions.
llvm-svn: 20383
2005-03-01 03:46:11 +00:00
Alkis Evlogimenos
422af394b6
Lower llvm.isunordered(a, b) into a != a | b != b.
...
llvm-svn: 20382
2005-03-01 02:07:58 +00:00
Chris Lattner
9d57998cda
Remove tabs from file.
...
llvm-svn: 20380
2005-02-28 19:36:15 +00:00
Chris Lattner
b2720f5b57
Add support to the C backend for llvm.prefetch. Patch contributed by
...
Justin Wick!
llvm-svn: 20378
2005-02-28 19:29:46 +00:00
Chris Lattner
82480f68d7
recognize llvm.prefetch. Patch contributed by Justin Wick!
...
llvm-svn: 20377
2005-02-28 19:28:00 +00:00
Chris Lattner
c4205a6b93
Verify llvm.prefetch.
...
llvm-svn: 20376
2005-02-28 19:27:42 +00:00
Chris Lattner
9ccfcab3db
Lower prefetch to a noop, patch contributed by Justin Wick!
...
llvm-svn: 20375
2005-02-28 19:27:23 +00:00
Andrew Lenharth
7dc9ea9509
fix integer division and stuff
...
llvm-svn: 20372
2005-02-28 17:22:18 +00:00
Jeff Cohen
d5b1827c3f
Fix crash in LSR due to attempt to remove original induction variable. However,
...
for reasons explained in the comments, I also deactivated this code as it needs
more thought.
llvm-svn: 20367
2005-02-28 00:08:56 +00:00
Jeff Cohen
fd9504c7d9
PHI nodes were incorrectly placed when more than one GEP is reduced in a loop.
...
llvm-svn: 20360
2005-02-27 21:08:04 +00:00
Jeff Cohen
6258d4a431
First pass at improved Loop Strength Reduction. Still not yet ready for prime time.
...
llvm-svn: 20358
2005-02-27 19:37:07 +00:00
Chris Lattner
b632a13aa7
Use const iterators where possible. Patch by Evan Jones!
...
llvm-svn: 20354
2005-02-27 19:06:10 +00:00
Chris Lattner
73d4556bb6
Teach globalopt how memset/cpy/move affect memory, to allow better optimization.
...
llvm-svn: 20352
2005-02-27 18:58:52 +00:00
Chris Lattner
a024984017
Fix spelling, patch contributed by Gabor Greif!
...
llvm-svn: 20343
2005-02-27 06:18:25 +00:00
Chris Lattner
cf3862ce8d
Fix spelling, patch contributed by Gabor Greif
...
llvm-svn: 20342
2005-02-27 06:15:51 +00:00
Chris Lattner
a17076b771
Remove some stuff I checked in accidentally
...
llvm-svn: 20340
2005-02-27 04:32:35 +00:00
Chris Lattner
2311dcd08d
DCE a dead function
...
llvm-svn: 20339
2005-02-26 23:36:45 +00:00
Reid Spencer
24b41ba78d
Implement an isBytecodeArchive method to determine if an archive contains
...
bytecode file members or not.
Patch Contributed By Adam Treat
llvm-svn: 20338
2005-02-26 22:00:32 +00:00
Chris Lattner
cf3cda8125
1 + 100 + 51 == 152, not 52.
...
If we fold three constants together (c1+c2+c3), make sure to keep
LHSC updated, instead of reusing (in this case), the 1 instead of the
partial sum.
llvm-svn: 20337
2005-02-26 18:50:19 +00:00
Chris Lattner
14f720d625
remove extraneous cast
...
llvm-svn: 20334
2005-02-26 18:33:28 +00:00
Andrew Lenharth
b5331ffe0f
make BB labels be exported for debuging, add fp negation optimization, further pecimise the FP instructions
...
llvm-svn: 20332
2005-02-25 22:55:15 +00:00
Chris Lattner
9340ba4bf9
Handle null a bit more carefully.
...
Actually teach dsa about select instructions. This doesn't affect the
graph in any way other than not setting a spurious U marker on pointer
nodes that are selected.
llvm-svn: 20324
2005-02-25 01:27:48 +00:00
Chris Lattner
16f321bbe7
This instruction:
...
X = gep null, ...
Used to not create a scalar map entry for X, which caused clients to barf.
This is bad.
llvm-svn: 20316
2005-02-24 19:55:31 +00:00
Chris Lattner
085b39c9e0
Fix a bug introduced by revision 1.187 of this file.
...
llvm-svn: 20308
2005-02-24 18:48:07 +00:00
Andrew Lenharth
ef5f87784b
fix Allocas. Really. I mean it this time.
...
llvm-svn: 20306
2005-02-24 18:36:32 +00:00
Chris Lattner
af54bd6050
Fix some problems where the verifier would crash on invalid input instead of
...
reporting the problem and exiting.
llvm-svn: 20302
2005-02-24 16:58:29 +00:00
Chris Lattner
7a434679c3
Implement Transforms/SimplifyCFG/switch_thread.ll
...
This does a simple form of "jump threading", which eliminates CFG edges that
are provably dead. This triggers 90 times in the external tests, and
eliminating CFG edges is always always a good thing! :)
llvm-svn: 20300
2005-02-24 06:17:52 +00:00
Chris Lattner
902d9dc660
switch instructions only allow constantints for their values, be more specific.
...
llvm-svn: 20298
2005-02-24 05:32:09 +00:00
Chris Lattner
608a8c9f55
use more specific cast.
...
llvm-svn: 20297
2005-02-24 05:26:04 +00:00
Chris Lattner
ce949bdbfc
add more checking
...
llvm-svn: 20296
2005-02-24 05:25:17 +00:00
Chris Lattner
f0863ee08c
Do not read free'd memory when printing an error message.
...
llvm-svn: 20295
2005-02-24 04:59:49 +00:00
Chris Lattner
8044aa8d33
add a new method.
...
llvm-svn: 20293
2005-02-24 02:37:26 +00:00
Tanya Lattner
b640bb0d88
Only print out machine instructions before modulo scheduling if we are actually doing modulo scheduling! :)
...
llvm-svn: 20292
2005-02-24 02:14:44 +00:00
Andrew Lenharth
69a8320c0d
Ah the problems you have to fix when you stray from the One True Way (TM)
...
llvm-svn: 20290
2005-02-23 17:33:42 +00:00
Chris Lattner
bfb6a94126
make this more efficient. Scan up to 16 nodes, not the whole list.
...
llvm-svn: 20289
2005-02-23 16:53:04 +00:00
Chris Lattner
a91c25c69b
new method
...
llvm-svn: 20288
2005-02-23 16:51:11 +00:00
Chris Lattner
0ce5361846
Reduce the amount of searching this assertion does. On a testcase of mine,
...
this reduces the time for -simplifycfg in a debug build from 106s to 14.82s
llvm-svn: 20286
2005-02-23 07:09:08 +00:00
Chris Lattner
9838ab1271
Silence some uninit variable warnings.
...
llvm-svn: 20284
2005-02-23 05:57:21 +00:00
Tanya Lattner
a981a711aa
Fixed bug in findAllcircuits. Fixed branch addition to schedule. Added debug information.
...
llvm-svn: 20280
2005-02-23 02:01:42 +00:00
Andrew Lenharth
889efe4fb3
oops
...
llvm-svn: 20278
2005-02-22 23:29:25 +00:00
Chris Lattner
1969249f13
Remove use of bind_obj, deleter, and finegrainify namespacification.
...
llvm-svn: 20277
2005-02-22 23:27:21 +00:00
Chris Lattner
b5256c157d
Remove use of bind_obj
...
llvm-svn: 20276
2005-02-22 23:22:58 +00:00
Chris Lattner
d888514f0c
C++ is not a functional programming language.
...
llvm-svn: 20274
2005-02-22 23:13:58 +00:00
Andrew Lenharth
d870103306
dynamic stack allocas
...
llvm-svn: 20273
2005-02-22 21:59:48 +00:00
Chris Lattner
4ba91f5168
Fix a bug in the 'store fpimm, ptr' -> 'store intimm, ptr' handling code.
...
Changing 'op' here caused us to not enter the store into a map, causing
reemission of the code!! In practice, a simple loop like this:
no_exit: ; preds = %no_exit, %entry
%indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=3]
%tmp.4 = getelementptr "complex long double"* %P, uint %indvar, uint 0 ; <double*> [#uses=1]
store double 0.000000e+00, double* %tmp.4
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=2]
%exitcond = seteq uint %indvar.next, %N ; <bool> [#uses=1]
br bool %exitcond, label %return, label %no_exit
was being code gen'd to:
.LBBtest_1: # no_exit
movl %edx, %esi
shll $4, %esi
movl $0, 4(%eax,%esi)
movl $0, (%eax,%esi)
incl %edx
movl $0, (%eax,%esi)
movl $0, 4(%eax,%esi)
cmpl %ecx, %edx
jne .LBBtest_1 # no_exit
Note that we are doing 4 32-bit stores instead of 2. Now we generate:
.LBBtest_1: # no_exit
movl %edx, %esi
incl %esi
shll $4, %edx
movl $0, (%eax,%edx)
movl $0, 4(%eax,%edx)
cmpl %ecx, %esi
movl %esi, %edx
jne .LBBtest_1 # no_exit
This is much happier, though it would be even better if the increment of ESI
was scheduled after the compare :-/
llvm-svn: 20265
2005-02-22 07:23:39 +00:00
Andrew Lenharth
8ead0f13d3
no longer build as a shared library
...
llvm-svn: 20264
2005-02-22 04:58:26 +00:00
Chris Lattner
68c342b28f
Fix problems running the HowToUseJIT on powerpc, and probably problems with
...
ANY program that does not have all functions internalized.
llvm-svn: 20258
2005-02-20 18:43:35 +00:00
Jeff Cohen
91e04e17a7
Fix silly mistake.
...
llvm-svn: 20256
2005-02-20 02:48:51 +00:00
Jeff Cohen
96558e2f93
Implement standard I/O redirection in ExecuteAndWait().
...
llvm-svn: 20255
2005-02-20 02:43:04 +00:00
Chris Lattner
15759af51d
Add support for ".so" files compiled with LLVM which contain LLVM bytecode.
...
llvm-svn: 20253
2005-02-19 18:30:29 +00:00
Chris Lattner
042a54de90
Eliminate silly warnings from the linker of the form:
...
WARNING: Type conflict between types named 'union.._604.'.
Src=' %union.._604.'.
Dest=' %union.._604.'
llvm-svn: 20252
2005-02-19 17:52:37 +00:00
Jeff Cohen
b83e650f1f
Change __MINGW to __MINGW32__. Patch submitted by Henrik Bach.
...
llvm-svn: 20243
2005-02-19 03:01:13 +00:00
Jeff Cohen
fa31c775b6
Make PreventCoreFiles() do the right thing on Windows.
...
llvm-svn: 20237
2005-02-18 07:05:18 +00:00
Misha Brukman
ea2c511191
Fix compilation errors with VS 2005, patch contributed by Aaron Gray.
...
llvm-svn: 20232
2005-02-17 21:40:27 +00:00
Misha Brukman
381d248dc6
Fix compilation errors with VS 2005, patch by Aaron Gray.
...
llvm-svn: 20231
2005-02-17 21:39:27 +00:00
Chris Lattner
89105cec43
Don't rely on doubles comparing identical to each other, which doesn't work
...
for 0.0 and -0.0.
llvm-svn: 20230
2005-02-17 20:17:32 +00:00
Chris Lattner
0de03b45ab
Don't sink argument loads into loops or other bad places. This disables folding of argument loads with instructions that are not in the entry block.
...
llvm-svn: 20228
2005-02-17 19:40:32 +00:00
Chris Lattner
29126b65c4
Do not mark obviously unreachable blocks live when processing PHI nodes,
...
and handle incomplete control dependences correctly. This fixes:
Regression/Transforms/ADCE/dead-phi-edge.ll
-> a missed optimization
Regression/Transforms/ADCE/dead-phi-edge.ll
-> a compiler crash distilled from QT4
llvm-svn: 20227
2005-02-17 19:28:49 +00:00
Chris Lattner
2198bb53ee
Scary typo that fixes Regression/Transforms/IndVarsSimplify/2005-02-17-TruncateExprCrash.ll
...
and PR515.
llvm-svn: 20224
2005-02-17 16:54:16 +00:00
Jeff Cohen
72f7799517
Arg list already has program name in it.
...
llvm-svn: 20208
2005-02-16 04:43:45 +00:00
Tanya Lattner
a35f2f428e
Fixed node deletion bug.
...
llvm-svn: 20207
2005-02-16 04:00:59 +00:00
Chris Lattner
6a86178364
Instead of doing a manual comparison loop, just use memcmp, thanks to JohnC
...
for the suggestion! :)
llvm-svn: 20203
2005-02-15 22:12:10 +00:00
Chris Lattner
4139a6ea3d
Make this more efficient now that we know both files are the same length.
...
llvm-svn: 20202
2005-02-15 22:01:43 +00:00
Misha Brukman
5c9328b088
Fix spelling
...
llvm-svn: 20201
2005-02-15 21:59:53 +00:00
Reid Spencer
3c3c05bfbd
Adjust DiffFilesWithTolerance to help poor cygwin's mmap facility by
...
handling zero length files a little more intelligently. If both files are
zero length then we return 0 (true) indicating a match. If only one of the
files is zero length then we return 1 (false) indicating that the files
differ. If the files don't agree in length then they can't match so we
skip the first loop that looks for a quick match.
llvm-svn: 20200
2005-02-15 21:47:02 +00:00
Chris Lattner
5174b9cb60
Fix a problem where the PPC backend lost track of the fact that it had
...
to save and restore the LR register on entry and exit of a leaf function
that needed to access globals or the constant pool. This should hopefully
fix oscar from sending the PPC tester spinning out of control.
llvm-svn: 20197
2005-02-15 20:26:49 +00:00
Chris Lattner
c5646b3a15
Add a sanity check.
...
llvm-svn: 20195
2005-02-15 18:48:48 +00:00
Chris Lattner
e7d2b05fb0
Add a new method to make it easy to update graphs.
...
llvm-svn: 20194
2005-02-15 18:40:55 +00:00
Chris Lattner
bf72146607
Fix volatile load/store of pointers. Consider this testcase:
...
void %test(int** %P) {
%A = volatile load int** %P
ret void
}
void %test2(int*** %Q) {
%P = load int*** %Q
volatile store int** %P, int*** %Q
ret void
}
instead of emitting:
void test(int **l1_P) {
int *l2_A;
l2_A = (int **((volatile int **)l1_P));
return;
}
void test2(int ***l2_Q) {
int **l1_P;
l1_P = *l2_Q;
*((volatile int ***)l2_Q) = l1_P;
return;
}
... which is loading/storing volatile pointers, not through volatile pointers,
emit this (which is right):
void test(int **l1_P) {
int *l3_A;
l3_A = *((int * volatile*)l1_P);
return;
}
void test2(int ***l2_Q) {
int **l1_P;
l1_P = *l2_Q;
*((int ** volatile*)l2_Q) = l1_P;
return;
}
llvm-svn: 20191
2005-02-15 05:52:14 +00:00
Chris Lattner
51c55602c9
Fix a bug in my previous change to this, which broke the build on sparcs.
...
llvm-svn: 20184
2005-02-14 21:42:10 +00:00
Chris Lattner
43b14db4d9
Print GEP offsets as signed values instead of unsigned values. On X86, this
...
prints:
getelementptr (int* %A, int -1)
as: "(A) - 4" instead of "(A) + 18446744073709551612", which makes the
assembler much happier.
This fixes test/Regression/CodeGen/X86/2005-02-14-IllegalAssembler.ll,
and Benchmarks/Prolangs-C/cdecl with LLC on X86.
llvm-svn: 20183
2005-02-14 21:40:26 +00:00
Chris Lattner
0a61115d67
Fix the second bug attached to PR504.
...
llvm-svn: 20181
2005-02-14 20:11:45 +00:00
Chris Lattner
786b30e148
Work around GCC PR19958, which causes programs to sometimes crash after
...
printing help output or version info.
llvm-svn: 20180
2005-02-14 19:17:29 +00:00
Misha Brukman
7b6a863954
Write out single characters as chars, not strings.
...
llvm-svn: 20179
2005-02-14 18:52:35 +00:00
Chris Lattner
ef836a918e
Implement CodeGen/CBackend/2005-02-14-VolatileOperations.ll
...
Volatile loads and stores need to emit volatile pointer operations in C.
llvm-svn: 20177
2005-02-14 16:47:52 +00:00
Andrew Lenharth
f023ce8d97
fix setcc on floats, fixes singlesource:pi, perhaps others
...
llvm-svn: 20172
2005-02-14 05:41:43 +00:00
Chris Lattner
efacfe896c
Fix the llvm bootstrap
...
llvm-svn: 20170
2005-02-13 23:37:09 +00:00
Chris Lattner
405367eb58
Move helper function here.
...
llvm-svn: 20168
2005-02-13 23:13:47 +00:00
Chris Lattner
535796ff26
If errno is zero strerror_r does not modify the buffer, leaving it unterminated.
...
This causes garbage to be printed out after error messages.
llvm-svn: 20165
2005-02-13 22:46:37 +00:00
Reid Spencer
a7a01f13df
Make the check for global variables the same as the one for functions. In
...
both cases they are looking for non-external variables/functions that do
not have internal linkage. Using "!isExternal()" is a little more
understandable than "hasInitializer()"
llvm-svn: 20155
2005-02-13 18:12:20 +00:00
Chris Lattner
0ac02cee3c
Nuke blank line.
...
llvm-svn: 20154
2005-02-13 17:54:21 +00:00
Chris Lattner
1194167daa
Minor cleanup. No need to explicitly tell the compiler the template arguments.
...
llvm-svn: 20153
2005-02-13 17:50:16 +00:00
Chris Lattner
1788cf35ab
Make sure to clear the LazyFunctionLoadMap after we ParseAllFunctionBodies.
...
Otherwise, clients who call ParseAllFunctionBodies will attempt to parse
the function bodies twice, which is (uh) very very bad (tm).
This fixes gccld on python.
llvm-svn: 20152
2005-02-13 17:48:18 +00:00
Chris Lattner
fdc746ac38
Do not put internal symbols into the symbol table. This shrinks the symbol
...
table for archives in common cases, and prevents trying to resolve a
external reference with an internal reference. This shrinks the libpython.a
symbol table from 126302 to 19770 bytes.
llvm-svn: 20151
2005-02-13 17:42:11 +00:00
Chris Lattner
da614a0e0b
Print something useful for gccld -v with an archive.
...
llvm-svn: 20148
2005-02-13 15:26:14 +00:00
Chris Lattner
63d47e902f
Correct the recursive PHI node handling routines in a way that CANNOT induce
...
infinite loops (using the new replaceSymbolicValuesWithConcrete method).
This patch reverts this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050131/023830.html
... which was an attempted fix for this problem. Unfortunately, that patch
caused test/Regression/Transforms/IndVarsSimplify/exit_value_tests.llx to fail
and slightly castrated the entire analysis. This patch fixes it right.
This patch is dedicated to jeffc, for making me deal with this. :)
llvm-svn: 20146
2005-02-13 04:37:18 +00:00
Andrew Lenharth
e398f7797e
try to do better match for i32 adds
...
llvm-svn: 20143
2005-02-12 21:11:17 +00:00
Andrew Lenharth
089b56ae58
make FP conversion more conservative (matches gcc)
...
llvm-svn: 20142
2005-02-12 21:10:58 +00:00
Andrew Lenharth
b9c44170a5
oops, I was sure this had already gond though the nightly tester
...
llvm-svn: 20141
2005-02-12 20:42:09 +00:00
Andrew Lenharth
a12e5330bf
added sign extend for boolean
...
llvm-svn: 20137
2005-02-12 19:35:12 +00:00
Chris Lattner
6e3279c0b4
Allow globals to be of different const'nesses when we link.
...
This finally resolves PR502, PR450,
and test/Regression/Linker/2005-02-12-ConstantGlobals{,-2}.ll correctly
llvm-svn: 20135
2005-02-12 19:20:28 +00:00
Chris Lattner
8f3f72f2bc
Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.ll
...
and PR504.
llvm-svn: 20129
2005-02-12 03:26:49 +00:00
Andrew Lenharth
076faf95a8
fix a bunch of regressions due to call behavior
...
llvm-svn: 20110
2005-02-10 20:10:38 +00:00
Alkis Evlogimenos
82f384712f
Localize globals if they are only used in main(). This replaces the
...
global with an alloca, which eventually gets promoted into a
register. This enables a lot of other optimizations later on.
llvm-svn: 20109
2005-02-10 18:36:30 +00:00
Tanya Lattner
04a78e13df
Added new circuit finding alogrithm.
...
Fixed bug in graph so that phi ite diff edges are added.
llvm-svn: 20108
2005-02-10 17:02:58 +00:00
Tanya Lattner
cd54968a72
Allow modsched and local scheduling to both be run.
...
llvm-svn: 20107
2005-02-10 17:02:06 +00:00
Andrew Lenharth
56c441caf2
so, if you beat on it, you too can talk emacs into having a sane indenting policy... Also, optimize many function calls with pc-relative calls (partial prologue skipping for that case coming soon), try to fix the random jumps to strange places problem by pesimizing div et. al. register usage and fixing up GP before using, some calling convention tweaks, and make frame pointer unallocatable (not strickly necessary, but let's go for correctness first)
...
llvm-svn: 20106
2005-02-10 06:25:22 +00:00
Andrew Lenharth
6c28128e3e
fix fp branch
...
llvm-svn: 20105
2005-02-10 05:17:38 +00:00
Misha Brukman
4bd124492b
* Fix spelling of `volatile'
...
* Align comments with tablegen elements
llvm-svn: 20103
2005-02-10 01:52:22 +00:00
Chris Lattner
f1a9655358
Don't print a 'Total Execution Time' line for the 'Miscellaneous Ungrouped
...
Timers' section. Since these are random timers in the program it doesn't
make sense to sum them up.
llvm-svn: 20090
2005-02-09 18:41:32 +00:00
Chris Lattner
343a831bab
Fix test/Regression/Assembler/2005-02-09-AsmWriterStoreBug.ll
...
llvm-svn: 20089
2005-02-09 17:45:03 +00:00
Chris Lattner
82ef7e89fd
Use new edge iterators to simplify some code.
...
llvm-svn: 20086
2005-02-09 03:20:43 +00:00
Andrew Lenharth
d42ae810cb
BranchCC, nifty
...
llvm-svn: 20067
2005-02-08 00:40:03 +00:00
Andrew Lenharth
71fce71669
fix store issue and an FP conversion (segfault) issue
...
llvm-svn: 20066
2005-02-07 23:02:23 +00:00
Chris Lattner
bfd643f504
IndCallGraphMap is now a pointer to a new'd map.
...
llvm-svn: 20065
2005-02-07 16:09:15 +00:00
Andrew Lenharth
cf4f405e55
copytoreg fix
...
llvm-svn: 20063
2005-02-07 06:31:44 +00:00
Andrew Lenharth
d20853f420
copyfromreg fix
...
llvm-svn: 20062
2005-02-07 06:21:37 +00:00
Andrew Lenharth
80cf648100
fix load bug
...
llvm-svn: 20061
2005-02-07 05:55:55 +00:00
Andrew Lenharth
9f5502e40f
more FP load store fixes and Load store simplifications
...
llvm-svn: 20060
2005-02-07 05:33:15 +00:00
Andrew Lenharth
bc6ddca09c
clean up load and stores alot
...
llvm-svn: 20059
2005-02-07 05:18:02 +00:00
Andrew Lenharth
4416315969
teach all loads and stores about the stack
...
llvm-svn: 20058
2005-02-07 05:07:00 +00:00
Andrew Lenharth
1b8bf311d2
prefer FP scratch registers and more check in LowerArguments
...
llvm-svn: 20057
2005-02-06 21:07:31 +00:00
Andrew Lenharth
23ca0026fa
fix oopso
...
llvm-svn: 20056
2005-02-06 16:22:15 +00:00
Andrew Lenharth
baa723abc0
smarter loads and stores. can now handle base+offset.
...
llvm-svn: 20055
2005-02-06 15:40:40 +00:00
Andrew Lenharth
9a2bc47fba
fix build
...
llvm-svn: 20053
2005-02-05 19:46:51 +00:00
Andrew Lenharth
6bd554a11e
clean up
...
llvm-svn: 20051
2005-02-05 17:41:39 +00:00
Andrew Lenharth
9fd7ce4bca
fix f32 setcc, and fp select
...
llvm-svn: 20050
2005-02-05 16:41:03 +00:00
Andrew Lenharth
5447bb6596
added ugly support for fp compares
...
llvm-svn: 20049
2005-02-05 13:19:12 +00:00
Misha Brukman
75da90f127
Make the rest of file header comments consistent in format and style
...
llvm-svn: 20048
2005-02-05 02:24:26 +00:00
Chris Lattner
ec9411df83
Instead of initializing the volatile field, use accessors to set it.
...
llvm-svn: 20045
2005-02-05 01:38:38 +00:00
Chris Lattner
d73939a8ed
Initialize new field.
...
llvm-svn: 20044
2005-02-05 01:37:58 +00:00
Misha Brukman
74be40e1d2
Make file header comment consistent: extend the whole 80 cols to fill the line
...
llvm-svn: 20039
2005-02-04 20:25:52 +00:00
Chris Lattner
43b0441ccb
If we have an indirect call site that calls N functions, inline the N functions
...
into a temporary graph, remember it for later, then inline the tmp graph into
the call site.
In the case where there are other call sites to the same set of functions, this
permits us to just inline the temporary graph instead of all of the callees.
This turns N*M inlining situations into an N+M inlining situation.
llvm-svn: 20036
2005-02-04 19:59:49 +00:00
Chris Lattner
5f8b7b03b0
Split mergeInGraph into two methods.
...
llvm-svn: 20035
2005-02-04 19:58:28 +00:00
Chris Lattner
48828f062c
Fix the Regression/Transforms/DSAnalysis/recursion.ll regression.
...
llvm-svn: 20031
2005-02-04 18:58:04 +00:00
Chris Lattner
c808a143af
Fix a case where were incorrectly compiled cast from short to int on 64-bit
...
targets.
llvm-svn: 20030
2005-02-04 18:39:19 +00:00
Andrew Lenharth
e081ab1c69
alignment
...
llvm-svn: 20028
2005-02-04 14:09:38 +00:00
Andrew Lenharth
68f8792889
get alignment printing correctly and get rid of __main hack
...
llvm-svn: 20027
2005-02-04 14:01:21 +00:00
Andrew Lenharth
d2d24eee40
fix constant pointer outputing on 64 bit machines
...
llvm-svn: 20026
2005-02-04 13:47:16 +00:00
Andrew Lenharth
fa74ac60e6
FP fixes
...
llvm-svn: 20019
2005-02-03 21:01:15 +00:00
Chris Lattner
15151dbff8
Refactor getFunctionArgumentsForCall out of mergeInGraph.
...
llvm-svn: 20018
2005-02-03 18:40:25 +00:00
Chris Lattner
11f76e4975
This is no longer needed. Global variables with undef initializers can be
...
initialized to anything, including garbage.
llvm-svn: 20010
2005-02-02 20:50:50 +00:00
Andrew Lenharth
d5de7adf26
Store fix
...
llvm-svn: 20004
2005-02-02 17:32:39 +00:00
Andrew Lenharth
fef75b04f1
oops
...
llvm-svn: 20003
2005-02-02 17:01:31 +00:00
Andrew Lenharth
b4bf49a4ae
prevent register allocator from using the stack pointer :)
...
llvm-svn: 20002
2005-02-02 17:00:21 +00:00
Andrew Lenharth
c3e3bd1c22
fix loading of floats
...
llvm-svn: 19997
2005-02-02 15:05:33 +00:00
Andrew Lenharth
2482a0ef99
marked mem* as not supported
...
llvm-svn: 19992
2005-02-02 05:49:42 +00:00
Alkis Evlogimenos
3521fcb18f
Fix crash on MallocInsts of unsized types.
...
llvm-svn: 19988
2005-02-02 04:43:37 +00:00
Andrew Lenharth
a856b4db61
fix Load bug
...
llvm-svn: 19987
2005-02-02 04:35:44 +00:00
Chris Lattner
c3f476e9c2
Fix yet another memset issue.
...
llvm-svn: 19986
2005-02-02 03:44:41 +00:00
Andrew Lenharth
35ae745650
try to make a bug bugpointable, add yet more constant pool stuff, fixup constant loads for FP
...
llvm-svn: 19985
2005-02-02 03:36:35 +00:00
Andrew Lenharth
5a2bb3de8b
better constant handling, should fix many remaining cases
...
llvm-svn: 19984
2005-02-02 00:51:15 +00:00
Chris Lattner
56e08cc9a3
Eliminate some duplicated debug code
...
llvm-svn: 19980
2005-02-01 21:55:40 +00:00
Chris Lattner
57cdba4154
Eliminate self-recursion as a special case.
...
llvm-svn: 19979
2005-02-01 21:49:43 +00:00
Chris Lattner
b35595d4c0
Eliminate use of DSCallSiteIterator in key loop. This is a half step to
...
a tasty speedup.
llvm-svn: 19978
2005-02-01 21:37:27 +00:00
Andrew Lenharth
172fc4b1fd
fix FP arg passing bug, Add unsigned to/from int, fix SELECT, fix Constant pool
...
llvm-svn: 19976
2005-02-01 20:40:27 +00:00
Andrew Lenharth
9086064b72
Print the Constant pool
...
llvm-svn: 19975
2005-02-01 20:38:53 +00:00
Andrew Lenharth
540700124d
Make cmov work right and loads for fp from constant pool
...
llvm-svn: 19974
2005-02-01 20:36:44 +00:00
Andrew Lenharth
bf88e70920
Correct stack stuff for FP
...
llvm-svn: 19973
2005-02-01 20:35:57 +00:00
Andrew Lenharth
810fa6d4f1
try to match alpha pattern
...
llvm-svn: 19972
2005-02-01 20:35:11 +00:00
Andrew Lenharth
b8e15cfe9c
fix register names
...
llvm-svn: 19971
2005-02-01 20:34:29 +00:00
Chris Lattner
028a8a8f56
Signficantly speed up printing by not emitting the same file twice with
...
different names. Large SCC's tend to be big, so this saves a lot of time.
llvm-svn: 19970
2005-02-01 19:10:48 +00:00
Chris Lattner
9cf60e3459
Fix some bugs andrew noticed legalizing memset for alpha
...
llvm-svn: 19969
2005-02-01 18:38:28 +00:00
Chris Lattner
26d4a4b2d2
Do not revisit nodes in the SCC traversal. This speeds up the BU pass a bit.
...
llvm-svn: 19968
2005-02-01 17:35:52 +00:00
Chris Lattner
78e8e86a9e
Fix test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll
...
llvm-svn: 19966
2005-02-01 01:47:42 +00:00
Chris Lattner
2947b1be51
Apparently := confuses makellvm
...
llvm-svn: 19965
2005-02-01 01:47:12 +00:00
Andrew Lenharth
fa52a84802
pecimise loads, put indirect call addr in right register. still doesn't fix methcall
...
llvm-svn: 19963
2005-02-01 01:37:24 +00:00
Chris Lattner
839b0ef616
Updates for new use list changes.
...
llvm-svn: 19961
2005-02-01 01:24:21 +00:00
Chris Lattner
1cbca58b87
Update for API change.
...
llvm-svn: 19960
2005-02-01 01:24:01 +00:00
Chris Lattner
d04865822c
API change.
...
llvm-svn: 19959
2005-02-01 01:23:49 +00:00
Chris Lattner
555ef32a44
Adjust to changes in APIs
...
llvm-svn: 19958
2005-02-01 01:23:31 +00:00
Chris Lattner
849a4118e6
Hacks to make this ugly ugly code work with the new use lists.
...
llvm-svn: 19957
2005-02-01 01:22:56 +00:00
Chris Lattner
d9b3839cec
Fix a problem where we could infinitely recurse on phi nodes.
...
llvm-svn: 19955
2005-02-01 00:18:30 +00:00
Misha Brukman
1e8e58b829
Fix hyphenation in output comment
...
llvm-svn: 19954
2005-01-31 06:19:57 +00:00
Chris Lattner
c4884b553e
Implement InstCombine/cast.ll:test25, a case that occurs many times
...
in spec
llvm-svn: 19953
2005-01-31 05:51:45 +00:00
Chris Lattner
6a431c25d1
Implement the trivial cases in InstCombine/store.ll
...
llvm-svn: 19950
2005-01-31 05:36:43 +00:00
Chris Lattner
a4ba8e9f0d
Implement Transforms/InstCombine/cast-load-gep.ll, which allows us to devirtualize
...
11 indirect calls in perlbmk.
llvm-svn: 19947
2005-01-31 04:50:46 +00:00
Andrew Lenharth
648e85bb8a
indirect call fix
...
llvm-svn: 19945
2005-01-31 03:19:31 +00:00
Andrew Lenharth
401bb5807b
fp to int and back conversion sequences
...
llvm-svn: 19944
2005-01-31 01:44:26 +00:00
Chris Lattner
e4aaa4cf01
Fix the regressions my User changes introduced. Apparently some parts of
...
LLVM make the very reasonable assumption that constant expressions will
have at least one operand! :)
llvm-svn: 19943
2005-01-31 01:11:13 +00:00
Chris Lattner
11a25d99d7
Rename variables to work with VC++'s hokey scoping rules.
...
llvm-svn: 19942
2005-01-31 00:10:58 +00:00
Chris Lattner
86f89c506f
Fix some scary bugs that VC++ detected.
...
llvm-svn: 19941
2005-01-31 00:10:45 +00:00
Chris Lattner
ee6bc42f3e
* Make some methods more const correct.
...
* Change the FunctionCalls and AuxFunctionCalls vectors into std::lists.
This makes many operations on these lists much more natural, and avoids
*exteremely* expensive copying of DSCallSites (e.g. moving nodes around
between lists, erasing a node from not the end of the vector, etc).
With a profile build of analyze, this speeds up BU DS from 25.14s to
12.59s on 176.gcc. I expect that it would help TD even more, but I don't
have data for it.
This effectively eliminates removeIdenticalCalls and children from the
profile, going from 6.53 to 0.27s.
llvm-svn: 19939
2005-01-30 23:51:02 +00:00
Andrew Lenharth
43c294ffc3
added fp extend and removed a forgotten assert in more than 6 arg support (should break somewhere else now :) ) and fix an incorrect asm sequence for indirect calls
...
llvm-svn: 19938
2005-01-30 20:42:36 +00:00
Chris Lattner
c952d46d13
This code is really unreachable.
...
llvm-svn: 19934
2005-01-30 16:33:46 +00:00
Chris Lattner
d27e3639ba
Fix warnings.
...
llvm-svn: 19933
2005-01-30 16:32:48 +00:00
Andrew Lenharth
60966b9bf0
support for larger calls
...
llvm-svn: 19932
2005-01-30 00:35:27 +00:00
Chris Lattner
382abe80a0
Improve conformance with the Misha spelling benchmark suite
...
llvm-svn: 19930
2005-01-30 00:09:23 +00:00
Tanya Lattner
560e1612df
Make this work on systems where size_t == unsigned and where they are not
...
the same.
llvm-svn: 19929
2005-01-29 23:29:55 +00:00
Tanya Lattner
53173dac64
Make this work on systems where size_t is not the same as unsigned.
...
llvm-svn: 19928
2005-01-29 23:08:01 +00:00
Chris Lattner
fc8d0e9460
Unbreak the build :(
...
llvm-svn: 19926
2005-01-29 19:27:28 +00:00
Chris Lattner
8200976176
adjust to ilist changes.
...
llvm-svn: 19924
2005-01-29 18:41:25 +00:00
Chris Lattner
aa4ae8f5b3
Adjust to ilist changes.
...
llvm-svn: 19923
2005-01-29 18:41:12 +00:00
Chris Lattner
68040588d9
This file was schizophrenic when it came to representing sizes. In some
...
cases it represented them as 'unsigned's, which are not enough for 64-bit
hosts. In other cases, it represented them as uint64_t's, which are
inefficient for 32-bit hosts.
This patch unifies all of the sizes to use size_t instead.
llvm-svn: 19918
2005-01-29 17:17:18 +00:00
Chris Lattner
af99e3993c
After reading in a bc file, trim the resultant buffer down to what we
...
really need. This reduces 4M of memory consumption reading 176.gcc.
llvm-svn: 19916
2005-01-29 17:05:56 +00:00
Chris Lattner
6bf1c6c6ae
Finegrainify namespacification
...
llvm-svn: 19915
2005-01-29 16:53:02 +00:00
Andrew Lenharth
f426f1c0c9
first step towards a correct and complete stack. also add some forms for things that were getting stuck in the nightly tester.
...
llvm-svn: 19914
2005-01-29 15:42:07 +00:00
Chris Lattner
703dfdda2a
Due to previous simplifications, we can simplify the data structures being
...
used here.
llvm-svn: 19913
2005-01-29 07:04:10 +00:00
Chris Lattner
0823ac4234
Properly handle volatile.
...
llvm-svn: 19912
2005-01-29 06:42:34 +00:00
Chris Lattner
8df4ba51b4
Remove some useless map operations. Loads/stores that are in the same
...
BB as the load are not included in the Cand* sets at all.
llvm-svn: 19911
2005-01-29 06:39:25 +00:00
Chris Lattner
af286e3600
Before doing expensive global analysis, check to make sure the pointer is
...
not invalidated on entry and on exit of the block. This fixes some N^2
behavior in common cases, and speeds up gcc another 5% to 22.35s.
llvm-svn: 19910
2005-01-29 06:31:53 +00:00
Chris Lattner
43ccc5c945
Minor simplification/speedup. Replaces a set lookup with a pointer comparison.
...
This speeds up 176.gcc from 25.73s to 23.48s, which is 9.5%
llvm-svn: 19907
2005-01-29 06:20:55 +00:00
Chris Lattner
ae8d4bb675
Eliminate generality that is not buying us anything. In particular, this
...
will cause us to miss cases where the input pointer to a load could be value
numbered to another load. Something like this:
%X = load int* %P1
%Y = load int* %P2
Those are obviously the same if P1/P2 are the same. The code this patch
removes attempts to handle that. However, since GCSE iterates, this doesn't
actually buy us anything: GCSE will first replace P1 or P2 with the other
one, then the load can be value numbered as equal.
Removing this code speeds up gcse a lot. On 176.gcc in debug mode, this
speeds up gcse from 29.08s -> 25.73s, a 13% savings.
llvm-svn: 19906
2005-01-29 06:11:16 +00:00
Chris Lattner
68d73bed4a
If we see:
...
%A = alloca int
%V = load int* %A
value number %V to undef, not 0.
llvm-svn: 19905
2005-01-29 05:57:01 +00:00
Chris Lattner
3b3e7f7cc2
Memory used is a delta between memuse at the start of the time and the
...
memuse at the end, thus it is signed.
llvm-svn: 19904
2005-01-29 05:21:16 +00:00
Chris Lattner
35281b677a
Make sure that we always grow a multiple of 2 operands.
...
llvm-svn: 19902
2005-01-29 01:05:12 +00:00
Chris Lattner
c29f25e260
Adjust to changes in instruction interfaces.
...
llvm-svn: 19900
2005-01-29 00:39:08 +00:00
Chris Lattner
7dab604f10
Switchinst takes a hint for the number of cases it will have.
...
llvm-svn: 19899
2005-01-29 00:38:45 +00:00
Chris Lattner
ccc0c99fae
switchinst ctor now takes a hint for the number of cases that it will have.
...
llvm-svn: 19898
2005-01-29 00:38:26 +00:00
Chris Lattner
d87666619f
Adjust Valuehandle to hold its operand directly in it.
...
llvm-svn: 19897
2005-01-29 00:37:36 +00:00
Chris Lattner
774d64469c
Finegrainify namespacification.
...
Adjust TmpInstruction to work with the new User model.
llvm-svn: 19896
2005-01-29 00:36:59 +00:00
Chris Lattner
0b2dec0f59
add namespace qualifier
...
llvm-svn: 19895
2005-01-29 00:36:38 +00:00
Chris Lattner
031d5f649c
Adjust to changes in User class and minor changes in instruction ctors.
...
llvm-svn: 19894
2005-01-29 00:36:19 +00:00
Chris Lattner
e0580122ab
Adjust to slight changes in instruction interfaces.
...
llvm-svn: 19893
2005-01-29 00:35:55 +00:00
Chris Lattner
50d674e9da
Adjust to changes in User class.
...
llvm-svn: 19892
2005-01-29 00:35:33 +00:00
Chris Lattner
12f9442dc3
Merge InstrTypes.cpp into this file
...
Adjust to changes in the User class, operand handling is very different.
PHI node and switch statements must handle explicit resizing of operand
lists.
llvm-svn: 19891
2005-01-29 00:35:16 +00:00
Chris Lattner
5244a770c3
Adjust to changes in User class. Aggregate constants now must explicitly
...
manage their operands.
llvm-svn: 19890
2005-01-29 00:34:39 +00:00
Chris Lattner
a0498b9190
This file is now merged into Instructions.cpp
...
llvm-svn: 19889
2005-01-29 00:33:32 +00:00
Andrew Lenharth
8a3a14d343
fix ExprMap, partially teach about add long
...
llvm-svn: 19882
2005-01-28 23:17:54 +00:00
Chris Lattner
f893f17907
Fix a nasty thinko in my previous commit.
...
llvm-svn: 19881
2005-01-28 23:17:27 +00:00
Chris Lattner
2755fb4171
Alpha doesn't have a native f32 extload instruction.
...
llvm-svn: 19880
2005-01-28 22:58:25 +00:00
Chris Lattner
da7b5277c1
implement legalization of truncates whose results and sources need to be
...
truncated, e.g. (truncate:i8 something:i16) on a 32 or 64-bit RISC.
llvm-svn: 19879
2005-01-28 22:52:50 +00:00
Chris Lattner
89cac82479
Get alpha working with memset/memcpy/memmove
...
llvm-svn: 19878
2005-01-28 22:29:18 +00:00
Chris Lattner
b035ec4a9c
* add some DEBUG statements
...
* Properly compile this:
struct a {};
int test() {
struct a b[2];
if (&b[0] != &b[1])
abort ();
return 0;
}
to 'return 0', not abort().
llvm-svn: 19875
2005-01-28 19:32:01 +00:00
Chris Lattner
f24ea9cf5e
Fix ConstProp/2005-01-28-SetCCGEP.ll: indexing over zero sized elements does
...
not change the address.
llvm-svn: 19874
2005-01-28 19:09:51 +00:00
Andrew Lenharth
9db35b0763
fix ExprMap and constant check in setcc
...
llvm-svn: 19870
2005-01-28 14:06:46 +00:00
Andrew Lenharth
4cfda09ee9
move FP into it's own select
...
llvm-svn: 19867
2005-01-28 06:57:18 +00:00
Chris Lattner
4134789c8f
CopyFromReg produces two values. Make sure that we remember that both are
...
legalized, and actually return the correct result when we legalize the chain first.
llvm-svn: 19866
2005-01-28 06:27:38 +00:00
Chris Lattner
fadcc07232
Remove this code as it is currently completely broken and unmaintained.
...
If needed, this can be resurrected from CVS.
Note that several of the interfaces (e.g. the IPModRef ones) are supersumed
by generic AliasAnalysis interfaces that have been written since this code
was developed (and they are not DSA specific).
llvm-svn: 19864
2005-01-28 06:12:46 +00:00
Jeff Cohen
df055196d4
Properly close mapped files.
...
llvm-svn: 19863
2005-01-28 01:17:07 +00:00
Andrew Lenharth
c0cd77a1a0
stack frame fix and zero FP reg fix
...
llvm-svn: 19857
2005-01-27 08:31:19 +00:00
Andrew Lenharth
55eadc4772
Floating point instructions like Floating point registers
...
llvm-svn: 19856
2005-01-27 07:58:15 +00:00
Andrew Lenharth
67328d7fac
int to float conversion and another setcc
...
llvm-svn: 19855
2005-01-27 07:50:35 +00:00
Misha Brukman
b0fce1668a
Fix grammar
...
llvm-svn: 19854
2005-01-27 06:46:38 +00:00
Andrew Lenharth
4283bf1216
teach isel about comparison with constants and zero extending bits
...
llvm-svn: 19853
2005-01-27 03:49:45 +00:00
Jeff Cohen
1502dd24d9
Fix some Path bugs
...
llvm-svn: 19852
2005-01-27 03:49:03 +00:00
Andrew Lenharth
b539dd2c83
perhaps this will let me have calls again
...
llvm-svn: 19851
2005-01-27 01:22:48 +00:00
Andrew Lenharth
227bc0e21a
minor bug fix
...
llvm-svn: 19850
2005-01-27 00:52:26 +00:00
Andrew Lenharth
ae8ce1856a
minor bug fix
...
llvm-svn: 19849
2005-01-27 00:51:05 +00:00
Andrew Lenharth
11fc660a34
added instructions for fp to int to fp moves
...
llvm-svn: 19848
2005-01-26 23:56:48 +00:00
Andrew Lenharth
1f0b710fb6
initial fp support
...
llvm-svn: 19847
2005-01-26 21:54:09 +00:00
Andrew Lenharth
f9f01c190b
hum, writing on one machine, testing on another...
...
llvm-svn: 19844
2005-01-26 02:53:56 +00:00
Andrew Lenharth
53ad9ac1db
add some operations, fix others. should compile several more tests now
...
llvm-svn: 19843
2005-01-26 01:24:38 +00:00
Chris Lattner
ab92b92bc5
We can fold promoted and non-promoted loads into divs also!
...
llvm-svn: 19835
2005-01-25 20:35:10 +00:00
Chris Lattner
a9a0369879
Fold promoted loads into binary ops for FP, allowing us to generate m32 forms
...
of FP ops.
llvm-svn: 19834
2005-01-25 20:03:11 +00:00
Andrew Lenharth
4e10c17eeb
problems with bools, and their work arounds
...
llvm-svn: 19833
2005-01-25 19:58:40 +00:00
Alkis Evlogimenos
eb6bfe9cee
Add a dependency to the trace library so that it gets pulled in
...
automatically.
llvm-svn: 19828
2005-01-25 16:23:57 +00:00
Andrew Lenharth
3ae267eb3b
more load choices, better add with imm
...
llvm-svn: 19821
2005-01-25 00:35:34 +00:00
Chris Lattner
f03b87704f
Make -ds-aa more useful, allowing it to be updated as xforms hack on the program.
...
llvm-svn: 19818
2005-01-24 20:00:14 +00:00
Andrew Lenharth
3b44cfa26d
Clean ups, and taught the instruction selector about immediate forms
...
llvm-svn: 19816
2005-01-24 19:44:07 +00:00
Andrew Lenharth
3c6e50e63b
Alpha JIT prune
...
llvm-svn: 19815
2005-01-24 18:48:22 +00:00
Andrew Lenharth
ae874f0d85
include prune and JIT prune
...
llvm-svn: 19814
2005-01-24 18:45:41 +00:00
Andrew Lenharth
e3991f8256
Pruned includes
...
llvm-svn: 19813
2005-01-24 18:37:48 +00:00
Chris Lattner
88a4c43e67
Fix a spurious warning.
...
llvm-svn: 19799
2005-01-24 01:40:18 +00:00
Chris Lattner
6ff85c3152
Silence a warning.
...
llvm-svn: 19798
2005-01-23 23:20:06 +00:00
Chris Lattner
849899e193
Silence optimized warnings.
...
llvm-svn: 19797
2005-01-23 23:19:44 +00:00
Chris Lattner
94952e0947
Allow the FP stackifier to completely ignore functions that do not use FP at
...
all. This should speed up the X86 backend fairly significantly on integer
codes. Now if only we didn't have to compute livevar still... ;-)
llvm-svn: 19796
2005-01-23 23:13:59 +00:00
Chris Lattner
65fc8007cd
Simplify/speedup the PEI by not having to scan for uses of the callee saved
...
registers. This information is computed directly by the register allocator
now.
llvm-svn: 19795
2005-01-23 23:13:12 +00:00
Chris Lattner
556679b89d
Update physregsused info.
...
llvm-svn: 19793
2005-01-23 22:55:45 +00:00
Chris Lattner
cc22be2981
Update this pass to set PhysRegsUsed info in MachineFunction.
...
llvm-svn: 19792
2005-01-23 22:51:56 +00:00
Chris Lattner
964297fc32
Update these register allocators to set the PhysRegUsed info in MachineFunction.
...
llvm-svn: 19791
2005-01-23 22:45:13 +00:00
Chris Lattner
6a6d5cf9eb
Add support for the PhysRegsUsed array.
...
llvm-svn: 19789
2005-01-23 22:13:58 +00:00
Chris Lattner
c187b917f2
Speed this up a bit by making ModifiedRegs a vector<char> not vector<bool>
...
llvm-svn: 19787
2005-01-23 21:45:01 +00:00
Chris Lattner
ab2ab313d3
Get rid of a several dozen more and instructions in specint.
...
llvm-svn: 19786
2005-01-23 20:26:55 +00:00
Chris Lattner
ab1804175d
Fix crash comparing empty file against nonempty file.
...
llvm-svn: 19782
2005-01-23 06:02:40 +00:00
Chris Lattner
b3a5fc3ec0
Adjust to changes in SelectionDAG interfaces
...
The first half of correct chain insertion for libcalls. This is not enough
to fix Fhourstones yet though.
llvm-svn: 19781
2005-01-23 04:42:50 +00:00
Chris Lattner
3165569ba9
Remove the 3 HACK HACK HACKs I put in before, fixing them properly with
...
the new TLI that is available.
Implement support for handling out of range shifts. This allows us to
compile this code (a 64-bit rotate):
unsigned long long f3(unsigned long long x) {
return (x << 32) | (x >> (64-32));
}
into this:
f3:
mov %EDX, DWORD PTR [%ESP + 4]
mov %EAX, DWORD PTR [%ESP + 8]
ret
GCC produces this:
$ gcc t.c -masm=intel -O3 -S -o - -fomit-frame-pointer
..
f3:
push %ebx
mov %ebx, DWORD PTR [%esp+12]
mov %ecx, DWORD PTR [%esp+8]
mov %eax, %ebx
mov %edx, %ecx
pop %ebx
ret
The Simple ISEL produces (eww gross):
f3:
sub %ESP, 4
mov DWORD PTR [%ESP], %ESI
mov %EDX, DWORD PTR [%ESP + 8]
mov %ECX, DWORD PTR [%ESP + 12]
mov %EAX, 0
mov %ESI, 0
or %EAX, %ECX
or %EDX, %ESI
mov %ESI, DWORD PTR [%ESP]
add %ESP, 4
ret
llvm-svn: 19780
2005-01-23 04:39:44 +00:00
Chris Lattner
4c997d281c
Adjust to changes in SelectionDAG interface.
...
llvm-svn: 19779
2005-01-23 04:36:26 +00:00
Chris Lattner
680bc75f7f
Build Alpha by default.
...
llvm-svn: 19777
2005-01-23 04:34:46 +00:00
Reid Spencer
e48557f583
Fix alloca support for Cygwin. On cygwin its __alloca not __builtin_alloca
...
llvm-svn: 19776
2005-01-23 04:32:47 +00:00
Reid Spencer
5c7b6e83f0
Support Cygwin assembly generation. The cygwin version of Gnu ASsembler
...
doesn't support certain directives and symbols on cygwin are prefixed with
an underscore. This patch makes the necessary adjustments to the output.
llvm-svn: 19775
2005-01-23 03:52:14 +00:00
Chris Lattner
331670eb3e
Make DiffFilesWithTolerance take sys::Path's instead of std::strings
...
Delete dead functions.
llvm-svn: 19771
2005-01-23 03:31:02 +00:00
Chris Lattner
ea7baf8d9f
Fix a bug in previous checkin
...
llvm-svn: 19769
2005-01-23 03:19:13 +00:00
Chris Lattner
dcf389fb90
Add a new method, refactored out of fpcmp
...
llvm-svn: 19766
2005-01-23 03:13:43 +00:00
Andrew Lenharth
f5b9a8fe57
Let me introduce you to the early stages of the llvm backend for the alpha processor
...
llvm-svn: 19764
2005-01-22 23:41:55 +00:00
Chris Lattner
63ec3c402b
Get this to work for 64-bit systems.
...
llvm-svn: 19763
2005-01-22 23:04:37 +00:00
Jeff Cohen
7311de2af2
Use binary mode for reading/writing bytecode files
...
llvm-svn: 19751
2005-01-22 17:36:17 +00:00
Jeff Cohen
66b5805c50
Fix destroyDirectory bug
...
llvm-svn: 19746
2005-01-22 16:28:33 +00:00
Chris Lattner
29d6389d78
Implicitly defined registers can clobber callee saved registers too!
...
This fixes the return-address-not-being-saved problem in the Alpha backend.
llvm-svn: 19741
2005-01-22 00:49:16 +00:00
Chris Lattner
97f35a7a07
More bugfixes for IA64 shifts.
...
llvm-svn: 19739
2005-01-22 00:33:03 +00:00
Chris Lattner
67deea9d05
Fix problems with non-x86 targets.
...
llvm-svn: 19738
2005-01-22 00:31:52 +00:00
Chris Lattner
42e239ed58
Add a nasty hack to fix Alpha/IA64 multiplies by a power of two.
...
llvm-svn: 19737
2005-01-22 00:20:42 +00:00
Chris Lattner
e724100870
Remove unneeded line.
...
llvm-svn: 19736
2005-01-21 23:43:12 +00:00
Chris Lattner
a974e215a5
test commit
...
llvm-svn: 19735
2005-01-21 23:38:56 +00:00
Chris Lattner
151c8e6390
Handle comparisons of gep instructions that have different typed indices
...
as long as they are the same size.
llvm-svn: 19734
2005-01-21 23:06:49 +00:00
Chris Lattner
b4cf4ffb04
Speed up folding operations into loads.
...
llvm-svn: 19733
2005-01-21 21:43:02 +00:00
Chris Lattner
fd4d7f71ae
The ever-important vanity pass name :)
...
llvm-svn: 19731
2005-01-21 21:35:14 +00:00
Chris Lattner
24bf1ca350
If the interpreter tries to execute an external function, kill it. Of course
...
since we are dirty, special case __main. This should fix the infinite loop
horrible stuff that happens on linux-alpha when configuring llvm-gcc. It
might also help cygwin, who knows??
llvm-svn: 19729
2005-01-21 19:59:37 +00:00
Chris Lattner
5f2fbeaa69
Fix a FIXME: realize that argument stores are all independent (don't alias)
...
llvm-svn: 19728
2005-01-21 19:46:38 +00:00
Chris Lattner
392ddf430b
Unary token factor nodes are unneeded.
...
llvm-svn: 19727
2005-01-21 18:01:22 +00:00
Chris Lattner
07c35617d5
Refactor libcall code a bit. Initial implementation of expanding int -> FP
...
operations for 64-bit integers.
llvm-svn: 19724
2005-01-21 06:05:23 +00:00
Chris Lattner
6258ec2e1d
Simplify the shift-expansion code.
...
llvm-svn: 19721
2005-01-20 20:29:23 +00:00
Chris Lattner
febeb380ae
Implement ADD_PARTS/SUB_PARTS so that 64-bit integer add/sub work. This
...
fixes most of the remaining llc-beta failures.
llvm-svn: 19716
2005-01-20 18:53:00 +00:00
Chris Lattner
c95c7c90c9
Expand add/sub into ADD_PARTS/SUB_PARTS instead of a non-existant libcall.
...
llvm-svn: 19715
2005-01-20 18:52:28 +00:00
Chris Lattner
4086a7a803
implement add_parts/sub_parts.
...
llvm-svn: 19714
2005-01-20 18:50:55 +00:00
Chris Lattner
e7ce5d0e4c
Add missing entry.
...
llvm-svn: 19712
2005-01-20 17:32:28 +00:00
Chris Lattner
8b0a2a3251
Fix a crash compiling 134.perl.
...
llvm-svn: 19711
2005-01-20 16:50:16 +00:00
Chris Lattner
e5212a16a2
Support targets that do not use i8 shift amounts.
...
llvm-svn: 19707
2005-01-19 22:31:21 +00:00
Chris Lattner
5a9660aa71
Add two optimizations. The first folds (X+Y)-X -> Y
...
The second folds operations into selects, e.g. (select C, (X+Y), (Y+Z))
-> (Y+(select C, X, Z)
This occurs a few times across spec, e.g.
select add/sub
mesa: 83 0
povray: 5 2
gcc 4 2
parser 0 22
perlbmk 13 30
twolf 0 3
llvm-svn: 19706
2005-01-19 21:50:18 +00:00
Chris Lattner
0e7435bc5b
Add an assertion that would have made more sense to duraid
...
llvm-svn: 19704
2005-01-19 21:32:07 +00:00
Chris Lattner
c662697319
Add support for targets that pass args in registers to calls.
...
llvm-svn: 19703
2005-01-19 20:24:35 +00:00
Chris Lattner
277ac2be70
Fold single use token factor nodes into other token factor nodes.
...
llvm-svn: 19701
2005-01-19 19:10:54 +00:00
Chris Lattner
85e0771f79
Realize the individual pieces of an expanded copytoreg/store/load are
...
independent of each other.
llvm-svn: 19700
2005-01-19 18:02:17 +00:00
Chris Lattner
027c97e93e
Know some identities about tokenfactor nodes.
...
llvm-svn: 19699
2005-01-19 18:01:40 +00:00
Chris Lattner
7114e8a527
Know some simple identities. This improves codegen for (1LL << N).
...
llvm-svn: 19698
2005-01-19 17:29:49 +00:00
Chris Lattner
6534e1ede3
Fix a problem where were were literally selecting for INCREASED register
...
pressure, not decreases register pressure. Fix problem where we accidentally
swapped the operands of SHLD, which caused fourinarow to fail. This fixes
fourinarow.
llvm-svn: 19697
2005-01-19 17:24:34 +00:00
Chris Lattner
e97ed92617
Just in case, handle something that is both a use and a def.
...
llvm-svn: 19696
2005-01-19 17:11:51 +00:00
Chris Lattner
2cb11bd2b9
When an instruction moves, make sure to update the VarInfo::Kills list as
...
well as all of teh other stuff in livevar. This fixes the compiler crash
on fourinarow last night.
llvm-svn: 19695
2005-01-19 17:09:15 +00:00
Chris Lattner
b75589131d
When commuting these instructions, make sure to actually swap the operands too.
...
llvm-svn: 19694
2005-01-19 16:55:52 +00:00
Chris Lattner
302ea8908d
Fix 'raise' to work with packed types. Patch by Morten Ofstad.
...
llvm-svn: 19693
2005-01-19 16:16:35 +00:00
Chris Lattner
fde1a5688b
Implement Regression/CodeGen/X86/rotate.ll: emit rotate instructions (which
...
typically cost 1 cycle) instead of shld/shrd instruction (which are typically
6 or more cycles). This also saves code space.
For example, instead of emitting:
rotr:
mov %EAX, DWORD PTR [%ESP + 4]
mov %CL, BYTE PTR [%ESP + 8]
shrd %EAX, %EAX, %CL
ret
rotli:
mov %EAX, DWORD PTR [%ESP + 4]
shrd %EAX, %EAX, 27
ret
Emit:
rotr32:
mov %CL, BYTE PTR [%ESP + 8]
mov %EAX, DWORD PTR [%ESP + 4]
ror %EAX, %CL
ret
rotli32:
mov %EAX, DWORD PTR [%ESP + 4]
ror %EAX, 27
ret
We also emit byte rotate instructions which do not have a sh[lr]d counterpart
at all.
llvm-svn: 19692
2005-01-19 08:07:05 +00:00
Chris Lattner
34757ff939
Add rotate instructions.
...
llvm-svn: 19690
2005-01-19 07:50:03 +00:00
Chris Lattner
e539ce8223
Match 16-bit shld/shrd instructions as well, implementing shift-double.llx:test5
...
llvm-svn: 19689
2005-01-19 07:37:26 +00:00
Chris Lattner
9d5ee289d7
Improve coverage of the X86 instruction set by adding 16-bit shift doubles.
...
llvm-svn: 19687
2005-01-19 07:31:24 +00:00
Chris Lattner
c03f360215
Teach the code generator that shrd/shld is commutable if it has an immediate.
...
This allows us to generate this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EDX, DWORD PTR [%ESP + 8]
shld %EDX, %EDX, 2
shl %EAX, 2
ret
instead of this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
mov %EDX, %EAX
shrd %EDX, %ECX, 30
shl %EAX, 2
ret
Note the magically transmogrifying immediate.
llvm-svn: 19686
2005-01-19 07:11:01 +00:00
Chris Lattner
408325ffdf
Use the TargetInstrInfo::commuteInstruction method to commute instructions
...
instead of doing it manually.
llvm-svn: 19685
2005-01-19 07:08:42 +00:00
Chris Lattner
33efebcdc8
Finegrainify namespacification
...
Add default impl of commuteInstruction
Add notes about ugly V9 code.
llvm-svn: 19684
2005-01-19 06:53:34 +00:00
Chris Lattner
575e912fcf
Codegen long >> 2 to this:
...
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EDX, DWORD PTR [%ESP + 8]
shrd %EAX, %EDX, 2
sar %EDX, 2
ret
instead of this:
test1:
mov %ECX, DWORD PTR [%ESP + 4]
shr %ECX, 2
mov %EDX, DWORD PTR [%ESP + 8]
mov %EAX, %EDX
shl %EAX, 30
or %EAX, %ECX
sar %EDX, 2
ret
and long << 2 to this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
*** mov %EDX, %EAX
shrd %EDX, %ECX, 30
shl %EAX, 2
ret
instead of this:
foo:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, %EAX
shr %ECX, 30
mov %EDX, DWORD PTR [%ESP + 8]
shl %EDX, 2
or %EDX, %ECX
shl %EAX, 2
ret
The extra copy (marked ***) can be eliminated when I teach the code generator
that shrd32rri8 is really commutative.
llvm-svn: 19681
2005-01-19 06:18:43 +00:00
Chris Lattner
743a36c818
Implement a way of expanding shifts. This applies to targets that offer
...
select operations or to shifts that are by a constant. This automatically
implements (with no special code) all of the special cases for shift by 32,
shift by < 32 and shift by > 32.
llvm-svn: 19679
2005-01-19 04:19:40 +00:00
Chris Lattner
419a5d213b
X86 shifts mask the amount.
...
llvm-svn: 19678
2005-01-19 03:36:30 +00:00
Chris Lattner
fbd1f8e4fd
Add a hook to find out how the target handles shift amounts that are out of
...
range. Either they are undefined (the default), they mask the shift amount
to the size of the register (X86, Alpha, etc), or they extend the shift (PPC).
This defaults to undefined, which is conservatively correct.
llvm-svn: 19677
2005-01-19 03:36:14 +00:00
Chris Lattner
0df1935505
Zero is cheaper than sign extend.
...
llvm-svn: 19675
2005-01-18 21:57:59 +00:00
Chris Lattner
6dec8cb829
Code to handle FP_EXTEND is dead now. X86 doesn't support any data types to
...
FP_EXTEND from!
llvm-svn: 19674
2005-01-18 20:05:56 +00:00
Chris Lattner
798e9c85d6
Remove more dead code.
...
llvm-svn: 19673
2005-01-18 19:50:08 +00:00
Chris Lattner
401814508f
The selection dag code handles the promotions from F32 to F64 for us, so we
...
don't need to even think about F32 in the X86 code anymore.
llvm-svn: 19672
2005-01-18 19:46:54 +00:00
Chris Lattner
4360871e16
Fix some fixmes (promoting bools for select and brcond), fix promotion
...
of zero and sign extends.
llvm-svn: 19671
2005-01-18 19:27:06 +00:00
Chris Lattner
eea485de1f
Keep track of the retval type as well.
...
llvm-svn: 19670
2005-01-18 19:26:36 +00:00
Chris Lattner
ff086f3016
Teach legalize to promote copy(from|to)reg, instead of making the isel pass
...
do it. This results in better code on X86 for floats (because if strict
precision is not required, we can elide some more expensive double -> float
conversions like the old isel did), and allows other targets to emit
CopyFromRegs that are not legal for arguments.
llvm-svn: 19668
2005-01-18 17:54:55 +00:00
Chris Lattner
dc09e52b3e
Fix 124.m88ksim.
...
llvm-svn: 19667
2005-01-18 17:35:28 +00:00
Chris Lattner
a04b1ee7a8
Do not emit loads multiple times, potentially in the wrong places.
...
llvm-svn: 19661
2005-01-18 04:18:32 +00:00
Tanya Lattner
d3459278f2
Minor changes.
...
llvm-svn: 19660
2005-01-18 04:15:41 +00:00
Chris Lattner
722ddeb86e
Eliminate bad assertions.
...
llvm-svn: 19659
2005-01-18 04:00:54 +00:00
Chris Lattner
8f3a8d96e2
* Eliminate the TokenSet and just use the ExprMap for both tokens and values.
...
* Insert some really pedantic assertions that will notice when we emit the
same loads more than one time, exposing bugs. This turns a miscompilation in
bzip2 into a compile-fail. yaay.
llvm-svn: 19658
2005-01-18 03:51:59 +00:00
Chris Lattner
891aa537f7
Teach legalize to promote SetCC results.
...
llvm-svn: 19657
2005-01-18 02:59:52 +00:00
Chris Lattner
95307053ec
Allow setcc operations to have nonbool types.
...
llvm-svn: 19656
2005-01-18 02:52:03 +00:00
Chris Lattner
b3edb09ede
Rely on the code in MatchAddress to do this work. Otherwise we fail to
...
match (X+Y)+(Z << 1), because we match the X+Y first, consuming the index
register, then there is no place to put the Z.
llvm-svn: 19652
2005-01-18 02:25:52 +00:00
Chris Lattner
906541da95
Fix the completely broken FP constant folds for setcc's.
...
llvm-svn: 19651
2005-01-18 02:11:55 +00:00
Chris Lattner
ce2e0125dc
Fix a problem where probing for addressing modes caused expressions to be
...
emitted too early. In particular, this fixes
Regression/CodeGen/X86/regpressure.ll:regpressure3.
This also improves the 2nd basic block in 164.gzip:flush_block, which went from
.LBBflush_block_1: # loopentry.1.i
movzx %EAX, WORD PTR [dyn_ltree + 20]
movzx %ECX, WORD PTR [dyn_ltree + 16]
mov DWORD PTR [%ESP + 32], %ECX
movzx %ECX, WORD PTR [dyn_ltree + 12]
movzx %EDX, WORD PTR [dyn_ltree + 8]
movzx %EBX, WORD PTR [dyn_ltree + 4]
mov DWORD PTR [%ESP + 36], %EBX
movzx %EBX, WORD PTR [dyn_ltree]
add DWORD PTR [%ESP + 36], %EBX
add %EDX, DWORD PTR [%ESP + 36]
add %ECX, %EDX
add DWORD PTR [%ESP + 32], %ECX
add %EAX, DWORD PTR [%ESP + 32]
movzx %ECX, WORD PTR [dyn_ltree + 24]
add %EAX, %ECX
mov %ECX, 0
mov %EDX, %ECX
to
.LBBflush_block_1: # loopentry.1.i
movzx %EAX, WORD PTR [dyn_ltree]
movzx %ECX, WORD PTR [dyn_ltree + 4]
add %ECX, %EAX
movzx %EAX, WORD PTR [dyn_ltree + 8]
add %EAX, %ECX
movzx %ECX, WORD PTR [dyn_ltree + 12]
add %ECX, %EAX
movzx %EAX, WORD PTR [dyn_ltree + 16]
add %EAX, %ECX
movzx %ECX, WORD PTR [dyn_ltree + 20]
add %ECX, %EAX
movzx %EAX, WORD PTR [dyn_ltree + 24]
add %ECX, %EAX
mov %EAX, 0
mov %EDX, %EAX
... which results in less spilling in the function.
This change alone speeds up 164.gzip from 37.23s to 36.24s on apoc. The
default isel takes 37.31s.
llvm-svn: 19650
2005-01-18 01:06:26 +00:00
Chris Lattner
a78f9ced61
Fix indentation.
...
llvm-svn: 19649
2005-01-17 23:25:45 +00:00
Chris Lattner
dff1e3e86f
Don't bother using max here.
...
llvm-svn: 19647
2005-01-17 23:02:13 +00:00
Chris Lattner
2d86b43318
Do not give token factor nodes outrageous weights
...
llvm-svn: 19645
2005-01-17 22:56:09 +00:00
Chris Lattner
c0aca0d13c
Non-volatile loads can be freely reordered against each other. This fixes
...
X86/reg-pressure.ll again, and allows us to do nice things in other cases.
For example, we now codegen this sort of thing:
int %loadload(int *%X, int* %Y) {
%Z = load int* %Y
%Y = load int* %X ;; load between %Z and store
%Q = add int %Z, 1
store int %Q, int* %Y
ret int %Y
}
Into this:
loadload:
mov %EAX, DWORD PTR [%ESP + 4]
mov %EAX, DWORD PTR [%EAX]
mov %ECX, DWORD PTR [%ESP + 8]
inc DWORD PTR [%ECX]
ret
where we weren't able to form the 'inc [mem]' before. This also lets the
instruction selector emit loads in any order it wants to, which can be good
for register pressure as well.
llvm-svn: 19644
2005-01-17 22:19:26 +00:00
Chris Lattner
f2878ce8ba
Two changes:
...
1. Fold [mem] += (1|-1) into inc [mem]/dec [mem] to save some icache space.
2. Do not let token factor nodes prevent forming '[mem] op= val' folds.
llvm-svn: 19643
2005-01-17 22:10:42 +00:00
Chris Lattner
49291c4d96
Don't call SelectionDAG.getRoot() directly, go through a forwarding method.
...
llvm-svn: 19642
2005-01-17 19:43:36 +00:00
Chris Lattner
40c0fca632
Refactor load/op/store folding into it's own method, no functionality changes.
...
llvm-svn: 19641
2005-01-17 19:25:26 +00:00
Chris Lattner
88bbcfc893
Implement a target independent optimization to codegen arguments only into
...
the basic block that uses them if possible. This is a big win on X86, as it
lets us fold the argument loads into instructions and reduce register pressure
(by not loading all of the arguments in the entry block).
For this (contrived to show the optimization) testcase:
int %argtest(int %A, int %B) {
%X = sub int 12345, %A
br label %L
L:
%Y = add int %X, %B
ret int %Y
}
we used to produce:
argtest:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EAX, 12345
sub %EAX, %ECX
mov %EDX, DWORD PTR [%ESP + 8]
.LBBargtest_1: # L
add %EAX, %EDX
ret
now we produce:
argtest:
mov %EAX, 12345
sub %EAX, DWORD PTR [%ESP + 4]
.LBBargtest_1: # L
add %EAX, DWORD PTR [%ESP + 8]
ret
This also fixes the FIXME in the code.
BTW, this occurs in real code. 164.gzip shrinks from 8623 to 8608 lines of
.s file. The stack frame in huft_build shrinks from 1644->1628 bytes,
inflate_codes shrinks from 116->108 bytes, and inflate_block from 2620->2612,
due to fewer spills.
Take that alkis. :-)
llvm-svn: 19639
2005-01-17 17:55:19 +00:00
Chris Lattner
2348abc421
Fix a major regression last night that prevented us from producing [mem] op= reg
...
operations.
The body of the if is less indented but unmodified in this patch.
llvm-svn: 19638
2005-01-17 17:49:14 +00:00
Chris Lattner
49a1f3a109
Refactor code into a new method.
...
llvm-svn: 19635
2005-01-17 17:15:02 +00:00
Chris Lattner
adb669ab1f
Codegen this:
...
int %foo(int %X) {
%T = add int %X, 13
%S = mul int %T, 3
ret int %S
}
as this:
mov %ECX, DWORD PTR [%ESP + 4]
lea %EAX, DWORD PTR [%ECX + 2*%ECX + 39]
ret
instead of this:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EAX, %ECX
add %EAX, 13
imul %EAX, %EAX, 3
ret
llvm-svn: 19633
2005-01-17 06:48:02 +00:00
Tanya Lattner
5a10531cf8
Added tmp instructions to preserve ssa.
...
llvm-svn: 19632
2005-01-17 06:47:26 +00:00
Chris Lattner
51590b615c
Fix test/Regression/CodeGen/X86/2005-01-17-CycleInDAG.ll and 132.ijpeg.
...
Do not fold a load into an operation if it will induce a cycle in the DAG.
Repeat after me: dAg.
llvm-svn: 19631
2005-01-17 06:26:58 +00:00
Chris Lattner
3402945d52
Delete PHI nodes that are not dead but are locked in a cycle of single
...
useness.
llvm-svn: 19629
2005-01-17 05:10:15 +00:00
Chris Lattner
de6b1ca556
Move code out of indentation one level to make it easier to read.
...
Disable the xform for < > cases. It turns out that the following is being
miscompiled:
bool %test(sbyte %S) {
%T = cast sbyte %S to uint
%V = setgt uint %T, 255
ret bool %V
}
llvm-svn: 19628
2005-01-17 03:20:02 +00:00
Chris Lattner
f1e85bec5a
Do not fold a load into a comparison that is used by more than one place.
...
The comparison will probably be folded, so this is not ok to do.
This fixed 197.parser.
llvm-svn: 19624
2005-01-17 01:34:14 +00:00
Chris Lattner
1b8c8fe020
Do not codegen 'xor bool, true' as 'not reg'. not reg inverts the upper bits
...
of the bytereg. This fixes yacr2, 300.twolf and probably others.
llvm-svn: 19622
2005-01-17 00:23:16 +00:00
Chris Lattner
46dac4394c
Set up the shift and setcc types.
...
If we emit a load because we followed a token chain to get to it, try to
fold it into its single user if possible.
llvm-svn: 19620
2005-01-17 00:00:33 +00:00
Chris Lattner
4c88cc95ee
Shift and setcc types default to the pointer type.
...
llvm-svn: 19619
2005-01-16 23:59:48 +00:00
Chris Lattner
ec55e3e529
Implement legalize of call nodes.
...
llvm-svn: 19617
2005-01-16 19:46:48 +00:00
Tanya Lattner
fea188af7e
Added paramters to a few functions in order to allow me to change the functions to preserve SSA
...
llvm-svn: 19615
2005-01-16 08:51:10 +00:00
Chris Lattner
9ffc59287e
* Adjust to changes in TargetLowering interfaces.
...
* Remove custom promotion for bool and byte select ops. Legalize now
promotes them for us.
* Allow folding ConstantPoolIndexes into EXTLOAD's, useful for float immediates.
* Declare which operations are not supported better.
* Add some hacky code for TRUNCSTORE to pretend that we have truncstore
for i16 types. This is useful for testing promotion code because I can
just remove 16-bit registers all together and verify that programs work.
llvm-svn: 19614
2005-01-16 07:34:08 +00:00
Chris Lattner
0eca430af1
Revamp supported ops. Instead of just being supported or not, we now keep
...
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.
Implement custom lowering for a couple of ops, implement promotion for select
operations (which x86 needs).
llvm-svn: 19613
2005-01-16 07:29:19 +00:00
Chris Lattner
835a5efef3
add method stub
...
llvm-svn: 19612
2005-01-16 07:28:41 +00:00
Chris Lattner
907534af24
Don't mash stuff together.
...
llvm-svn: 19611
2005-01-16 07:28:31 +00:00
Chris Lattner
b49d2a7b0f
Use enums, move virtual dtor out of line.
...
llvm-svn: 19610
2005-01-16 07:28:11 +00:00
Chris Lattner
0f4f239899
Implement some more missing promotions.
...
llvm-svn: 19606
2005-01-16 05:06:12 +00:00
Chris Lattner
e88e660817
Fix bugpoint
...
llvm-svn: 19605
2005-01-16 04:23:22 +00:00
Chris Lattner
be2a427f51
cycles_t -> CycleCount_t
...
llvm-svn: 19604
2005-01-16 04:20:30 +00:00
Chris Lattner
742b77f9af
Clarify assertion.
...
llvm-svn: 19597
2005-01-16 02:23:34 +00:00
Chris Lattner
4517b8af97
Add assertions.
...
llvm-svn: 19596
2005-01-16 02:23:22 +00:00
Chris Lattner
9f8589f4b3
Add support for promoted registers being live across blocks.
...
llvm-svn: 19595
2005-01-16 02:23:07 +00:00
Reid Spencer
afa1cb9e11
Rename BUILD_* to PROJ_*
...
llvm-svn: 19592
2005-01-16 02:21:29 +00:00
Tanya Lattner
66cf1a6f82
Fixed a couple of instructions that broke SSA.
...
llvm-svn: 19587
2005-01-16 02:14:17 +00:00
Chris Lattner
605b9a23a2
Improve compatiblity with HPUX on Itanium, patch by Duraid Madina
...
llvm-svn: 19586
2005-01-16 01:31:31 +00:00
Chris Lattner
06c297f8ca
Set up identity transforms.
...
llvm-svn: 19584
2005-01-16 01:20:18 +00:00
Chris Lattner
01e2ce8a4c
Move some information into the TargetLowering object.
...
llvm-svn: 19583
2005-01-16 01:11:45 +00:00
Chris Lattner
9762070e50
Use the new TLI method to get this.
...
llvm-svn: 19582
2005-01-16 01:11:19 +00:00
Chris Lattner
1d0e1ffe02
Move some information out of LegalizeDAG into the generic Target interface.
...
llvm-svn: 19581
2005-01-16 01:10:58 +00:00
Chris Lattner
0777f84d53
legalize a bunch of operations that I missed.
...
llvm-svn: 19580
2005-01-16 00:38:00 +00:00
Chris Lattner
1de18d422e
Add support for targets that require promotions.
...
llvm-svn: 19579
2005-01-16 00:37:38 +00:00
Chris Lattner
8c4c81d6b3
Fix some serious bugs in promotion.
...
llvm-svn: 19578
2005-01-16 00:17:42 +00:00
Chris Lattner
9785def2cd
Eliminate unneeded extensions.
...
llvm-svn: 19577
2005-01-16 00:17:20 +00:00
Chris Lattner
df02c93d90
Implement promotion of a whole bunch more operators. I think that this is
...
basically everything.
llvm-svn: 19576
2005-01-15 22:16:26 +00:00
Chris Lattner
f3fd0c6a93
Print extra type for nodes with extra type info.
...
llvm-svn: 19575
2005-01-15 21:11:37 +00:00
Chris Lattner
1ab9009270
Add support for legalizing FP_ROUND_INREG, SIGN_EXTEND_INREG, and
...
ZERO_EXTEND_INREG for targets that don't support them.
llvm-svn: 19573
2005-01-15 07:15:18 +00:00
Chris Lattner
191ac9c589
Common code factored out.
...
llvm-svn: 19572
2005-01-15 07:14:32 +00:00
Chris Lattner
3b20db54f3
implement these methods.
...
llvm-svn: 19571
2005-01-15 06:52:40 +00:00
Chris Lattner
fdd07b4092
Add support for promoting ADD/MUL.
...
Add support for new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
Realize that if we do any promotions, we need to iterate SelectionDAG
construction.
llvm-svn: 19569
2005-01-15 06:18:18 +00:00
Chris Lattner
2f65e8798f
Add new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
...
llvm-svn: 19568
2005-01-15 06:17:04 +00:00
Chris Lattner
98611ce291
Add a new target-independent code generator flag.
...
llvm-svn: 19567
2005-01-15 06:00:32 +00:00
Chris Lattner
f3d950e816
Add support for truncstore and *extload.
...
llvm-svn: 19566
2005-01-15 05:22:24 +00:00
Chris Lattner
94b8a3e50c
Add intitial support for promoting some operators.
...
llvm-svn: 19565
2005-01-15 05:21:40 +00:00
Reid Spencer
ad96095c97
We don't distribute the operating system specific directories any more.
...
llvm-svn: 19563
2005-01-14 22:43:01 +00:00
Chris Lattner
2dfbc4fddd
Adjust to CopyFromReg changes, implement deletion of truncating/extending
...
stores/loads.
llvm-svn: 19562
2005-01-14 22:38:01 +00:00
Chris Lattner
27c91fac94
Adjust to CopyFromREg changes.
...
llvm-svn: 19561
2005-01-14 22:37:41 +00:00
Chris Lattner
0974002024
Start implementing truncating stores and extending loads.
...
llvm-svn: 19559
2005-01-14 22:08:15 +00:00
Chris Lattner
c032990335
Fix Regression/CodeGen/PowerPC/2005-01-14-UndefLong.ll
...
llvm-svn: 19557
2005-01-14 20:22:02 +00:00
Chris Lattner
b0b49268c4
Fix: Regression/CodeGen/PowerPC/2005-01-14-SetSelectCrash.ll
...
llvm-svn: 19555
2005-01-14 19:31:00 +00:00
Chris Lattner
708ff662ba
Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.
...
llvm-svn: 19553
2005-01-14 17:35:12 +00:00
Chris Lattner
13fd87be57
Fix a compile crash on spiff
...
llvm-svn: 19552
2005-01-14 17:17:59 +00:00
Chris Lattner
2087f3c8e9
Improve compatibility with acc
...
llvm-svn: 19549
2005-01-14 15:54:24 +00:00
Chris Lattner
1e5620dfe1
Make this compatible with the HP/intel compiler. Fix by Duraid, thanks!
...
llvm-svn: 19548
2005-01-14 15:53:26 +00:00
Jeff Cohen
7dfbb46f7f
Fix and improve win32 path validation.
...
llvm-svn: 19545
2005-01-14 04:09:39 +00:00
Reid Spencer
4e90250e81
Make asctime_r work for HP/UX.
...
llvm-svn: 19544
2005-01-14 00:50:50 +00:00
Chris Lattner
6b519e3314
if two gep comparisons only differ by one index, compare that index directly.
...
This allows us to better optimize begin() -> end() comparisons in common cases.
llvm-svn: 19542
2005-01-14 00:20:05 +00:00
Chris Lattner
283b7d9809
Do not overrun iterators. This fixes a 176.gcc crash
...
llvm-svn: 19541
2005-01-13 23:26:48 +00:00
Chris Lattner
b3dfd0aecd
Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs in
...
the 'sim' program and probably elsewhere. In sim, it comes up for cases
like this:
#define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5)
double G;
void T(double X) { G = round(X); }
(it uses the round macro a lot). This changes the LLVM code from:
%tmp.1 = setgt double %X, 0.000000e+00 ; <bool> [#uses=1]
%tmp.4 = add double %X, 5.000000e-01 ; <double> [#uses=1]
%tmp.6 = sub double %X, 5.000000e-01 ; <double> [#uses=1]
%mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6
store double %mem_tmp.0, double* %G
to:
%tmp.1 = setgt double %X, 0.000000e+00 ; <bool> [#uses=1]
%mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01
%mem_tmp.0 = add double %mem_tmp.0.p, %X
store double %mem_tmp.0, double* %G
ret void
llvm-svn: 19537
2005-01-13 22:52:24 +00:00
Chris Lattner
e59c6d1cbe
Implement an optimization for == and != comparisons like this:
...
_Bool test2(int X, int Y) {
return &arr[X][Y] == arr;
}
instead of generating this:
bool %test2(int %X, int %Y) {
%tmp.3.idx = mul int %X, 160 ; <int> [#uses=1]
%tmp.3.idx1 = shl int %Y, ubyte 2 ; <int> [#uses=1]
%tmp.3.offs2 = sub int 0, %tmp.3.idx ; <int> [#uses=1]
%tmp.7 = seteq int %tmp.3.idx1, %tmp.3.offs2 ; <bool> [#uses=1]
ret bool %tmp.7
}
generate this:
bool %test2(int %X, int %Y) {
seteq int %X, 0 ; <bool>:0 [#uses=1]
seteq int %Y, 0 ; <bool>:1 [#uses=1]
%tmp.7 = and bool %0, %1 ; <bool> [#uses=1]
ret bool %tmp.7
}
This idiom occurs in C++ programs when iterating from begin() to end(),
in a vector or array. For example, we now compile this:
void test(int X, int Y) {
for (int *i = arr; i != arr+100; ++i)
foo(*i);
}
to this:
no_exit: ; preds = %entry, %no_exit
...
%exitcond = seteq uint %indvar.next, 100 ; <bool> [#uses=1]
br bool %exitcond, label %return, label %no_exit
instead of this:
no_exit: ; preds = %entry, %no_exit
...
%inc5 = getelementptr [100 x [40 x int]]* %arr, int 0, int 0, int %inc.rec ; <int*> [#uses=1]
%tmp.8 = seteq int* %inc5, getelementptr ([100 x [40 x int]]* %arr, int 0, int 100, int 0) ; <bool> [#uses=1]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
br bool %tmp.8, label %return, label %no_exit
llvm-svn: 19536
2005-01-13 22:25:21 +00:00
Chris Lattner
7a8788c9ac
Add new ImplicitDef node, rename CopyRegSDNode class to RegSDNode.
...
llvm-svn: 19535
2005-01-13 20:50:02 +00:00
Chris Lattner
ee469241c3
Fix some bugs in code I didn't mean to check in.
...
llvm-svn: 19534
2005-01-13 20:40:58 +00:00
Chris Lattner
aebad4db9a
Fix a crash compiling 129.compress
...
llvm-svn: 19533
2005-01-13 20:14:25 +00:00
Chris Lattner
fce6a5439d
Codegen factor nodes more intelligently according to perceived register pressure.
...
llvm-svn: 19532
2005-01-13 19:56:00 +00:00
Chris Lattner
9cc534f2dc
Don't forget the existing root.
...
llvm-svn: 19531
2005-01-13 19:53:14 +00:00
Chris Lattner
cb4359465a
Initial trivial (but stupid) codegen for this node.
...
llvm-svn: 19529
2005-01-13 18:01:36 +00:00
Chris Lattner
160fdb384b
Codegen independent ops as being independent.
...
llvm-svn: 19528
2005-01-13 17:59:43 +00:00
Chris Lattner
37a5de6eb0
Legalize new node, add assertion.
...
llvm-svn: 19527
2005-01-13 17:59:25 +00:00
Chris Lattner
86b19c5605
Print new node.
...
llvm-svn: 19526
2005-01-13 17:59:10 +00:00
Chris Lattner
9a70166615
Add some really pedantic assertions to the load folding code. Fix a bunch
...
of cases where we accidentally emitted a load folded once and unfolded
elsewhere.
llvm-svn: 19522
2005-01-13 05:53:16 +00:00
Chris Lattner
93cb0148f8
Do not fold (zero_ext (sign_ext V)) -> (sign_ext V), they are not the same.
...
This fixes llvm-test/SingleSource/Regression/C/casts.c
llvm-svn: 19519
2005-01-12 18:51:15 +00:00
Chris Lattner
2ab70aafe0
We can only fold a load into an op if there is exactly one use of the value.
...
Checking to see if the load has two uses is not equivalent, as the chain
value may have zero uses.
llvm-svn: 19518
2005-01-12 18:38:26 +00:00
Chris Lattner
e97b0e1358
New method
...
llvm-svn: 19517
2005-01-12 18:37:47 +00:00
Chris Lattner
1b3b24f116
Fix sign extend to long. When coming from sbyte, we used to generate:
...
movsbl 4(%esp), %eax
movl %eax, %edx
sarl $7, %edx
Now we generate:
movsbl 4(%esp), %eax
movl %eax, %edx
sarl $31, %edx
Which is right.
llvm-svn: 19515
2005-01-12 18:19:52 +00:00
Chris Lattner
4b03f0f99e
Try both ways to fold an add together. This allows us to generate this code
...
imul %EAX, %EAX, 400
add %ECX, %EAX
add %ESI, DWORD PTR [%ECX + 4*%EDX]
inc %EDX
cmp %EDX, 100
instead of this:
imul %EAX, %EAX, 400
add %ECX, %EAX
mov %EAX, %EDX
shl %EAX, 2
add %ECX, %EAX
add %ESI, DWORD PTR [%ECX]
inc %EDX
cmp %EDX, 100
llvm-svn: 19513
2005-01-12 18:08:53 +00:00
Reid Spencer
c8c50250a1
Shut up warnings with GCC 3.4.3 about uninitialized variables.
...
llvm-svn: 19512
2005-01-12 14:53:45 +00:00
Chris Lattner
61c572eb7f
Fix a major miscompilation where we were overwriting the scale reg.
...
llvm-svn: 19511
2005-01-12 07:33:20 +00:00
Chris Lattner
5816f1a302
Do not use the type of the RHS constant to determine the type of the operation.
...
This fails for shifts because the constant is always 8 bits.
llvm-svn: 19508
2005-01-12 05:22:07 +00:00
Chris Lattner
89d6b21ae6
Do not lose the offset from teh global when peephole optimizing instructions.
...
This fixes FreeBench/pcompress
llvm-svn: 19507
2005-01-12 05:17:28 +00:00
Chris Lattner
c9b64b9749
Silence VC++ warnings.
...
llvm-svn: 19506
2005-01-12 04:51:37 +00:00
Jeff Cohen
614a5ec22a
Fix C++ more compilatiom errors
...
llvm-svn: 19504
2005-01-12 04:29:05 +00:00
Chris Lattner
5ef92f3a40
Fix a compile error with VC++, which things that static const arrays need
...
to be dynamically initialized. :(
llvm-svn: 19503
2005-01-12 04:23:22 +00:00
Chris Lattner
627c64e5e5
Fix a bug that caused us to crash on povray. We weren't emitting an FP_REG_KILL into a block that had a successor with a FP PHI node.
...
llvm-svn: 19502
2005-01-12 04:21:28 +00:00
Chris Lattner
a5f0ba59a0
Print a load of a null pointer (in intel mode) like this:
...
mov %AX, WORD PTR [0]
instead of like this:
mov %AX, WORD PTR []
llvm-svn: 19501
2005-01-12 04:07:11 +00:00
Chris Lattner
360988bae2
Print a load of a null pointer like this:
...
movw 0, %ax
instead of like this:
movw , %ax
llvm-svn: 19500
2005-01-12 04:05:19 +00:00
Chris Lattner
3c85c67c97
Fix a crash compiling povray on UINT_TO_FP from i16.
...
llvm-svn: 19499
2005-01-12 04:00:00 +00:00
Chris Lattner
e7945a2e2e
Add an option to view the selection dags as they are generated.
...
llvm-svn: 19498
2005-01-12 03:41:21 +00:00
Chris Lattner
4e72a2a000
There are no [mem] op= reg instructions for FP, so remove their entries.
...
llvm-svn: 19496
2005-01-12 03:16:09 +00:00
Chris Lattner
00cb0ace9b
Fix a bug where we didn't insert FP_REG_KILL instructions into MBB's that
...
contain FP PHI nodes but no other FP defining instructions. This fixes
183.equake
llvm-svn: 19495
2005-01-12 02:57:10 +00:00
Chris Lattner
92166ed1df
Fold TRUNCATE (LOAD P) into a smaller load from P.
...
llvm-svn: 19494
2005-01-12 02:19:06 +00:00
Chris Lattner
258b23bd9d
Be more careful about order of arg evalution for CopyToReg nodes. This shrinks
...
256.bzip2 from 7142 to 7103 lines of .s file.
Second, add initial support for folding loads into compares, though this code
is dynamically dead for now. :(
llvm-svn: 19493
2005-01-12 02:02:48 +00:00
Chris Lattner
604416e8f4
Fold some more [mem] op= val operators. This allows us to things like this
...
several times in 256.bzip2:
mov %EAX, DWORD PTR [%ESP + 204]
- mov %EAX, DWORD PTR [%EAX]
- or %EAX, 2097152
- mov %ECX, DWORD PTR [%ESP + 204]
- mov DWORD PTR [%ECX], %EAX
+ or DWORD PTR [%EAX], 2097152
llvm-svn: 19492
2005-01-12 01:28:00 +00:00
Chris Lattner
e83ae1063f
Fold loads into sign/zero extends. instead of:
...
mov %AL, BYTE PTR [%EDX + l18_length_code]
movzx %EAX, %AL
Emit:
movzx %EAX, BYTE PTR [%EDX + l18_length_code]
llvm-svn: 19489
2005-01-11 23:33:00 +00:00
Chris Lattner
87a38bd4a8
Comment out debug code :)
...
Select [mem] += Val operations. For constants, we used to get:
mov %ECX, -32768
add %ECX, DWORD PTR [l4_match_start]
mov DWORD PTR [l4_match_start], %ECX
Now we get:
add DWORD PTR [l4_match_start], -32768
For other values we used to get:
mov %EBP, %EDI ;; because the add destroys the value
add %EBP, DWORD PTR [l4_input_len]
mov DWORD PTR [l4_input_len], %EBP
now we get:
add DWORD PTR [l4_input_len], %EDI
Both of these use less registers than the alternative, are faster and smaller.
llvm-svn: 19488
2005-01-11 23:21:30 +00:00
Chris Lattner
282473a25d
Handle the global address case here, not just the offset case.
...
llvm-svn: 19487
2005-01-11 22:58:43 +00:00
Chris Lattner
9eb2cc700b
Treat int constants as not requiring a register, since they are almost always
...
folded into an instruction.
llvm-svn: 19486
2005-01-11 22:29:12 +00:00
Chris Lattner
74fcfd5148
Print the value types in the nodes of the graph
...
llvm-svn: 19485
2005-01-11 22:21:04 +00:00
Chris Lattner
f588cdd51e
add an assertion, avoid creating copyfromreg/copytoreg pairs that are the
...
same for PHI nodes.
llvm-svn: 19484
2005-01-11 22:03:46 +00:00
Chris Lattner
7cb2220907
* Factor a bunch of binary operator cases into shared code.
...
* Fold loads into Add, sub, and, or, xor and mul when possible.
* Codegen shl X, 1 as add X, X
llvm-svn: 19483
2005-01-11 21:19:59 +00:00
Chris Lattner
b1a72cb39a
Clear the whole array, always.
...
llvm-svn: 19482
2005-01-11 20:25:26 +00:00
Chris Lattner
b838c9748e
Fold multiplies by 3,5,9 into addressing modes when possible.
...
llvm-svn: 19480
2005-01-11 19:37:02 +00:00
Chris Lattner
8de5a27681
Squelch optimized warning.
...
llvm-svn: 19475
2005-01-11 17:46:49 +00:00
Chris Lattner
e7b1130b01
Instead of generating stuff like this:
...
mov %ECX, %EAX
add %ECX, 32768
mov %SI, WORD PTR [2*%ECX + l13_prev]
Generate this:
mov %SI, WORD PTR [2*%ECX + l13_prev + 65536]
This occurs when you have a GEP instruction where an index is
"something + imm".
llvm-svn: 19472
2005-01-11 06:36:20 +00:00
Chris Lattner
bb63a09cd1
Implement MEMCPY natively in terms of rep movs*
...
llvm-svn: 19468
2005-01-11 06:19:26 +00:00
Chris Lattner
b2b08a8bc1
Implement memset -> rep stos*
...
llvm-svn: 19467
2005-01-11 06:14:36 +00:00
Chris Lattner
58816a9e81
Announce that we don't support mem ops yet.
...
llvm-svn: 19466
2005-01-11 05:57:36 +00:00
Chris Lattner
963af6652b
Teach legalize to lower MEMSET/MEMCPY/MEMMOVE operations if the target
...
does not support them.
llvm-svn: 19465
2005-01-11 05:57:22 +00:00
Chris Lattner
6b9082114f
Print new operations.
...
llvm-svn: 19464
2005-01-11 05:57:01 +00:00
Chris Lattner
7cde8a2658
Turn memset/memcpy/memmove into the corresponding operations.
...
llvm-svn: 19463
2005-01-11 05:56:49 +00:00
Chris Lattner
f867443d7e
Teach the address selector to make 'reg+reg' addressing modes.
...
llvm-svn: 19457
2005-01-11 04:40:19 +00:00
Reid Spencer
7e9642515c
Add the LOADABLE_MODULE=1 directive to indicate that this shared library is
...
intended to be a dlopenable module and not a "plain" shared library.
llvm-svn: 19456
2005-01-11 04:33:32 +00:00
Chris Lattner
edf06be50e
Emit NOT instructions.
...
llvm-svn: 19455
2005-01-11 04:31:30 +00:00
Chris Lattner
2eacd11a86
shift X, 0 -> X
...
llvm-svn: 19453
2005-01-11 04:25:13 +00:00
Chris Lattner
4e4bef2d6c
Fix a bug emitting branches that broke a lot of programs.
...
llvm-svn: 19452
2005-01-11 04:06:27 +00:00
Chris Lattner
4b51297a94
Be more careful where we set ContainsFPCode. We were missing a set in the
...
int -> FP casting code. Note that we don't have to set it for FP operations
that take FP values as operands: whatever produces the FP value will set the
flag.
llvm-svn: 19451
2005-01-11 03:50:45 +00:00
Chris Lattner
0c4c4094e3
Fix a major bug in setcc/cmov folding, where we accidentally
...
inverted the sense of the comparison.
llvm-svn: 19450
2005-01-11 03:37:59 +00:00
Chris Lattner
d188e03011
Take register pressure into account when we have to decide whether to
...
evaluate the LHS or the RHS of an operation first. This causes good things
to happen. For example, instead of compiling a loop to this:
.LBBstrength_result7_1: # loopentry
movl 16(%esp), %edi
movl (%edi), %edi ;;; LOAD
movl (%ecx), %ebx
movl $2, (%eax,%ebx,4)
movl (%edx), %ebx
movl %esi, %ebp
addl $21, %ebp
addl $42, %esi
cmpl $0, %edi ;;; USE
cmovne %esi, %ebp
cmpl %ebp, %ebx
movl %ebp, %esi
jg .LBBstrength_result7_1
We now compile it to this:
.LBBstrength_result7_1: # loopentry
movl %edi, %ebx
addl $42, %ebx
addl $21, %edi
movl (%ecx), %ebp ;; LOAD
cmpl $0, %ebp ;; USE
cmovne %ebx, %edi
movl (%edx), %ebx
movl $2, (%eax,%ebx,4)
movl (%esi), %ebx
cmpl %edi, %ebx
jg .LBBstrength_result7_1
Which reduces register pressure enough (in this case) to avoid spilling in the
loop.
As another example, consider the CodeGen/X86/regpressure.ll testcase. We
used to generate this code for both cases:
regpressure1:
subl $32, %esp
movl %esi, 12(%esp)
movl %edi, 8(%esp)
movl %ebx, 4(%esp)
movl %ebp, (%esp)
movl 36(%esp), %ecx
movl (%ecx), %eax
movl 4(%ecx), %edx
movl %edx, 24(%esp)
movl 8(%ecx), %edx
movl %edx, 16(%esp)
movl 12(%ecx), %edx
movl 16(%ecx), %esi
movl 20(%ecx), %edi
movl 24(%ecx), %ebx
movl %ebx, 28(%esp)
movl 28(%ecx), %ebx
movl 32(%ecx), %ebp
movl %ebp, 20(%esp)
movl 36(%ecx), %ecx
imull 24(%esp), %eax
imull 16(%esp), %eax
imull %edx, %eax
imull %esi, %eax
imull %edi, %eax
imull 28(%esp), %eax
imull %ebx, %eax
imull 20(%esp), %eax
imull %ecx, %eax
movl (%esp), %ebp
movl 4(%esp), %ebx
movl 8(%esp), %edi
movl 12(%esp), %esi
addl $32, %esp
ret
This code is basically trying to do all of the loads first, then execute all
of the multiplies. Because we run out of registers, lots of spill code happens.
We now generate this code for both cases:
regpressure1:
movl 4(%esp), %ecx
movl (%ecx), %eax
movl 4(%ecx), %edx
imull %edx, %eax
movl 8(%ecx), %edx
imull %edx, %eax
movl 12(%ecx), %edx
imull %edx, %eax
movl 16(%ecx), %edx
imull %edx, %eax
movl 20(%ecx), %edx
imull %edx, %eax
movl 24(%ecx), %edx
imull %edx, %eax
movl 28(%ecx), %edx
imull %edx, %eax
movl 32(%ecx), %edx
imull %edx, %eax
movl 36(%ecx), %ecx
imull %ecx, %eax
ret
which is much nicer (when we fold loads into the muls it will be even better).
The old instruction selector used to produce the good code for regpressure1
but not for regpressure2, as it depended on the order of operations in the
LLVM code.
llvm-svn: 19449
2005-01-11 03:11:44 +00:00
Chris Lattner
07a3ade230
Print SelectionDAGs bottom up, include extra info in the node labels
...
llvm-svn: 19447
2005-01-11 00:34:33 +00:00
Chris Lattner
1c273d3a14
Add a marker for the graph root.
...
llvm-svn: 19445
2005-01-10 23:52:04 +00:00
Chris Lattner
daa052a97e
Put the operation name in each node, put the function name on the graph.
...
llvm-svn: 19444
2005-01-10 23:26:00 +00:00
Chris Lattner
0307506841
Split out SDNode::getOperationName into its own method.
...
llvm-svn: 19443
2005-01-10 23:25:25 +00:00
Chris Lattner
8c13447254
Implement initial selectiondag printing support. This gets us a nice
...
graph with no labels! :)
llvm-svn: 19441
2005-01-10 23:08:40 +00:00
Chris Lattner
497e24c885
Fold setcc instructions into selects.
...
llvm-svn: 19438
2005-01-10 22:10:13 +00:00
Chris Lattner
65d007ab62
Add conditional moves for the parity flag.
...
llvm-svn: 19437
2005-01-10 22:09:33 +00:00
Chris Lattner
5433d8de29
Lower to the correct functions. This fixes FreeBench/fourinarow
...
llvm-svn: 19436
2005-01-10 21:02:37 +00:00
Chris Lattner
d61491dea2
Implement 8-bit multiply for X86.
...
llvm-svn: 19435
2005-01-10 20:55:48 +00:00
Chris Lattner
b35b30c283
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.
llvm-svn: 19434
2005-01-10 18:23:22 +00:00
Jeff Cohen
8b03a55724
Apply feedback from Chris.
...
llvm-svn: 19432
2005-01-10 04:23:32 +00:00
Jeff Cohen
a7f1ae5dc0
Apply feed back from Chris:
...
1. Rename createLoaderPass to CreateProfileLoaderPass
2. Opt shouldn't use the pass registered in CodeGen.
llvm-svn: 19431
2005-01-10 03:56:27 +00:00
Chris Lattner
02236df007
Implement a couple of more simplifications. This lets us codegen:
...
int test2(int * P, int* Q, int A, int B) {
return P+A == P;
}
into:
test2:
movl 4(%esp), %eax
movl 12(%esp), %eax
shll $2, %eax
cmpl $0, %eax
sete %al
movzbl %al, %eax
ret
instead of:
test2:
movl 4(%esp), %eax
movl 12(%esp), %ecx
leal (%eax,%ecx,4), %ecx
cmpl %eax, %ecx
sete %al
movzbl %al, %eax
ret
ICC is producing worse code:
test2:
movl 4(%esp), %eax #8.5
movl 12(%esp), %edx #8.5
lea (%edx,%edx), %ecx #9.9
addl %ecx, %ecx #9.9
addl %eax, %ecx #9.9
cmpl %eax, %ecx #9.16
movl $0, %eax #9.16
sete %al #9.16
ret #9.16
as is GCC (looks like our old code):
test2:
movl 4(%esp), %edx
movl 12(%esp), %eax
leal (%edx,%eax,4), %ecx
cmpl %edx, %ecx
sete %al
movzbl %al, %eax
ret
llvm-svn: 19430
2005-01-10 02:03:02 +00:00
Chris Lattner
8d09b03ed1
Fix incorrect constant folds, fixing Stepanov after the SHR patch.
...
llvm-svn: 19429
2005-01-10 01:16:03 +00:00
Chris Lattner
9d479d4a34
Constant fold shifts, turning this loop:
...
.LBB_Z5test0PdS__3: # no_exit.1
fldl data(,%eax,8)
fldl 24(%esp)
faddp %st(1)
fstl 24(%esp)
incl %eax
movl $16000, %ecx
sarl $3, %ecx
cmpl %eax, %ecx
fstpl 16(%esp)
#FP_REG_KILL
jg .LBB_Z5test0PdS__3 # no_exit.1
into:
.LBB_Z5test0PdS__3: # no_exit.1
fldl data(,%eax,8)
fldl 24(%esp)
faddp %st(1)
fstl 24(%esp)
incl %eax
cmpl $2000, %eax
fstpl 16(%esp)
#FP_REG_KILL
jl .LBB_Z5test0PdS__3 # no_exit.1
llvm-svn: 19427
2005-01-10 00:07:15 +00:00
Reid Spencer
283688b80d
Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
...
gdb debugger doesn't get confused on which file it is reading (the one in
lib/System or the one in lib/System/{Win32,Unix})
llvm-svn: 19426
2005-01-09 23:29:00 +00:00
Chris Lattner
59d7066da8
Add some folds for == and != comparisons. This allows us to
...
codegen this loop in stepanov:
no_exit.i: ; preds = %entry, %no_exit.i, %then.i, %_Z5checkd.exit
%i.0.0 = phi int [ 0, %entry ], [ %i.0.0, %no_exit.i ], [ %inc.0, %_Z5checkd.exit ], [ %inc.012, %then.i ] ; <int> [#uses=3]
%indvar = phi uint [ %indvar.next, %no_exit.i ], [ 0, %entry ], [ 0, %then.i ], [ 0, %_Z5checkd.exit ] ; <uint> [#uses=3]
%result_addr.i.0 = phi double [ %tmp.4.i.i, %no_exit.i ], [ 0.000000e+00, %entry ], [ 0.000000e+00, %then.i ], [ 0.000000e+00, %_Z5checkd.exit ] ; <double> [#uses=1]
%first_addr.0.i.2.rec = cast uint %indvar to int ; <int> [#uses=1]
%first_addr.0.i.2 = getelementptr [2000 x double]* %data, int 0, uint %indvar ; <double*> [#uses=1]
%inc.i.rec = add int %first_addr.0.i.2.rec, 1 ; <int> [#uses=1]
%inc.i = getelementptr [2000 x double]* %data, int 0, int %inc.i.rec ; <double*> [#uses=1]
%tmp.3.i.i = load double* %first_addr.0.i.2 ; <double> [#uses=1]
%tmp.4.i.i = add double %result_addr.i.0, %tmp.3.i.i ; <double> [#uses=2]
%tmp.2.i = seteq double* %inc.i, getelementptr ([2000 x double]* %data, int 0, int 2000) ; <bool> [#uses=1]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
br bool %tmp.2.i, label %_Z10accumulateIPddET0_T_S2_S1_.exit, label %no_exit.i
To this:
.LBB_Z4testIPddEvT_S1_T0__1: # no_exit.i
fldl data(,%eax,8)
fldl 16(%esp)
faddp %st(1)
fstpl 16(%esp)
incl %eax
movl %eax, %ecx
shll $3, %ecx
cmpl $16000, %ecx
#FP_REG_KILL
jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i
instead of this:
.LBB_Z4testIPddEvT_S1_T0__1: # no_exit.i
fldl data(,%eax,8)
fldl 16(%esp)
faddp %st(1)
fstpl 16(%esp)
incl %eax
leal data(,%eax,8), %ecx
leal data+16000, %edx
cmpl %edx, %ecx
#FP_REG_KILL
jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i
llvm-svn: 19425
2005-01-09 20:52:51 +00:00
Jeff Cohen
f692cd303d
Add last four createXxxPass functions
...
llvm-svn: 19424
2005-01-09 20:42:52 +00:00
Jeff Cohen
91dd6d2d20
Fix VC++ compilation error
...
llvm-svn: 19423
2005-01-09 20:41:56 +00:00
Chris Lattner
fa06762d0e
Print the DAG out more like a DAG in nested format.
...
llvm-svn: 19422
2005-01-09 20:38:33 +00:00
Chris Lattner
e3b9f22967
Print out nodes sorted by their address to make it easier to find them in a list.
...
llvm-svn: 19421
2005-01-09 20:26:36 +00:00
Chris Lattner
fcab5f75c0
Codegen (Reg|imm)+&GV as an LEA, because we cannot put it into the immediate field
...
of an ADDri (due to current restrictions on MachineOperand :( ). This allows
us to generate:
leal Data+16000, %edx
instead of:
movl $Data, %edx
addl $16000, %edx
llvm-svn: 19420
2005-01-09 20:20:29 +00:00
Chris Lattner
82caa0dc2e
Add a simple transformation. This allows us to compile one of the inner
...
loops in stepanov to this:
.LBB_Z5test0PdS__2: # no_exit.1
fldl data(,%eax,8)
fldl 24(%esp)
faddp %st(1)
fstl 24(%esp)
incl %eax
cmpl $2000, %eax
fstpl 16(%esp)
#FP_REG_KILL
jl .LBB_Z5test0PdS__2
instead of this:
.LBB_Z5test0PdS__2: # no_exit.1
fldl data(,%eax,8)
fldl 24(%esp)
faddp %st(1)
fstl 24(%esp)
incl %eax
movl $data, %ecx
movl %ecx, %edx
addl $16000, %edx
subl %ecx, %edx
movl %edx, %ecx
sarl $2, %ecx
shrl $29, %ecx
addl %ecx, %edx
sarl $3, %edx
cmpl %edx, %eax
fstpl 16(%esp)
#FP_REG_KILL
jl .LBB_Z5test0PdS__2
The old instruction selector produced:
.LBB_Z5test0PdS__2: # no_exit.1
fldl 24(%esp)
faddl data(,%eax,8)
fstl 24(%esp)
movl %eax, %ecx
incl %ecx
incl %eax
leal data+16000, %edx
movl $data, %edi
subl %edi, %edx
movl %edx, %edi
sarl $2, %edi
shrl $29, %edi
addl %edi, %edx
sarl $3, %edx
cmpl %edx, %ecx
fstpl 16(%esp)
#FP_REG_KILL
jl .LBB_Z5test0PdS__2 # no_exit.1
Which is even worse!
llvm-svn: 19419
2005-01-09 20:09:57 +00:00
Chris Lattner
35375c11bf
Fix copy and pasto's for FP -> Int. This fixes fldry
...
llvm-svn: 19418
2005-01-09 19:49:59 +00:00
Chris Lattner
d674d08230
Fix a bug legalizing call instructions (make sure to remember all result
...
values), and eliminate some switch statements.
llvm-svn: 19417
2005-01-09 19:43:23 +00:00
Chris Lattner
ac23355362
Fix a minor bug legalizing dynamic_stackalloc. This allows us to compile
...
std::__pad<wchar_t, std::char_traits<wchar_t> >::_S_pad(std::ios_base&, wchar_t, wchar_t*, wchar_t const*, int, int, bool)
from libstdc++
llvm-svn: 19416
2005-01-09 19:07:54 +00:00
Chris Lattner
b3e31c6def
Teach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca)
...
llvm-svn: 19415
2005-01-09 19:03:49 +00:00
Chris Lattner
45155a3dee
Initial implementation of FP->INT and INT->FP casts
...
Also, fix zero_extend from bool to i8, which fixes Shootout/objinst.
llvm-svn: 19414
2005-01-09 18:52:44 +00:00
Jeff Cohen
6827f061cc
Get lib/Analysis/DataStructure to compile with VC++
...
llvm-svn: 19412
2005-01-09 04:18:28 +00:00
Chris Lattner
9ca9b20447
Fix a subtle bug involving constant expr casts from int to fp
...
llvm-svn: 19410
2005-01-09 01:49:29 +00:00
Chris Lattner
cc18c057cf
Handle static alloca arguments to PHI nodes.
...
llvm-svn: 19409
2005-01-09 01:16:24 +00:00
Chris Lattner
c5e53c07fd
Implement varargs and returnaddress/frameaddress intrinsics. With this
...
patch, all of SingleSource/UnitTests passes.
llvm-svn: 19408
2005-01-09 00:01:27 +00:00