Alkis Evlogimenos
2b94b048a9
Another API change to MRegisterInfo::foldMemoryOperand. Instead of a
...
MachineBasicBlock::iterator take a MachineInstr*.
llvm-svn: 12392
2004-03-14 20:14:27 +00:00
Chris Lattner
95c238ef5b
Split into two passes. Now there is the general loop extractor, usable on
...
the command line, and the single loop extractor, usable by bugpoint
llvm-svn: 12390
2004-03-14 20:01:36 +00:00
Alkis Evlogimenos
ff9482b664
Change MRegisterInfo::foldMemoryOperand to return the folded
...
instruction to make the API more flexible.
llvm-svn: 12386
2004-03-14 07:19:51 +00:00
Chris Lattner
cf5d48e8af
Passes don't print stuff!
...
llvm-svn: 12385
2004-03-14 04:17:53 +00:00
Chris Lattner
7e7c3332b8
Do not create empty basic blocks when the lowerswitch pass expects blocks to
...
be non-empty! This fixes LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll
llvm-svn: 12384
2004-03-14 04:14:31 +00:00
Chris Lattner
e52c176a7c
Minor random cleanups
...
llvm-svn: 12382
2004-03-14 04:01:47 +00:00
Chris Lattner
f3b0377169
FunctionPass's should not define their own 'run' method.
...
Require 'simplified' loops, not just raw natural loops. This fixes
CodeExtractor/2004-03-13-LoopExtractorCrash.ll
llvm-svn: 12381
2004-03-14 04:01:06 +00:00
Chris Lattner
39b3ae34bd
If a block is dead, dominators will not be calculated for it. Because of this
...
loop information won't see it, and we could have unreachable blocks pointing to
the non-header node of blocks in a natural loop. This isn't tidy, so have the
loopsimplify pass clean it up.
llvm-svn: 12380
2004-03-14 03:59:22 +00:00
Chris Lattner
f943b487c5
Catch some more cases of broken code. The loop extractor seems to be creating
...
situations where there is a branch that goes to a block in another function.
llvm-svn: 12379
2004-03-14 03:23:54 +00:00
Chris Lattner
b23b38259a
Verify functions as they are produced if -debug is specified. Reduce
...
curly braceage
llvm-svn: 12378
2004-03-14 03:17:22 +00:00
Chris Lattner
17042ee9ad
verifyFunction has been broken for a long time now. Fix it.
...
llvm-svn: 12377
2004-03-14 03:16:15 +00:00
Chris Lattner
46c006bb19
Move prototype to IPO.h instead of Scalar.h
...
Make sure that the file interface header (IPO.h) is included first
remove dead #incldue
llvm-svn: 12375
2004-03-14 02:37:16 +00:00
Chris Lattner
3d96322890
Indent anon namespace properly, add copyright block
...
llvm-svn: 12373
2004-03-14 02:34:07 +00:00
Chris Lattner
1685a3af78
Move to the IPO library. Utils shouldn't contain passes.
...
llvm-svn: 12372
2004-03-14 02:32:27 +00:00
Chris Lattner
5003f9e473
DemoteRegToStack got moved from DemoteRegToStack.h to Local.h
...
llvm-svn: 12368
2004-03-14 02:13:38 +00:00
Chris Lattner
52ac108b28
Add some debugging output
...
Fix InstCombine/2004-03-13-InstCombineInfLoop.ll which caused an infinite
loop compiling (I think) povray.
llvm-svn: 12365
2004-03-13 23:54:27 +00:00
Chris Lattner
763b6c41d4
This change makes two big adjustments.
...
* Be a lot more accurate about what the effects will be when inlining a call
to a function when an argument is an alloca.
* Dramatically reduce the penalty for inlining a call in a large function.
This heuristic made it almost impossible to inline a function into a large
function, no matter how small the callee is.
llvm-svn: 12363
2004-03-13 23:15:45 +00:00
Chris Lattner
8d45aeaff1
This little patch speeds up the loop used to update the dominator set analysis.
...
On the testcase from GCC PR12440, which has a LOT of loops (1392 of which require
preheaders to be inserted), this speeds up the loopsimplify pass from 1.931s to
0.1875s. The loop in question goes from 1.65s -> 0.0097s, which isn't bad. All of
these times are a debug build.
This adds a dependency on DominatorTree analysis that was not there before, but
we always had dominatortree available anyway, because LICM requires both loop
simplify and DT, so this doesn't add any extra analysis in practice.
llvm-svn: 12362
2004-03-13 22:01:26 +00:00
Chris Lattner
37b7966121
Fix a tiny bug that caused an incorrect assertion failure poolallocating
...
boxed-sim.
llvm-svn: 12358
2004-03-13 01:14:23 +00:00
Chris Lattner
b45245327e
It helps if I save the file. :)
...
llvm-svn: 12357
2004-03-13 00:24:52 +00:00
Chris Lattner
f7bc6fd913
Rename the intrinsic enum values for llvm.va_* from Intrinsic::va_* to
...
Intrinsic::va*. This avoid conflicting with macros in the stdlib.h file.
llvm-svn: 12356
2004-03-13 00:24:00 +00:00
Chris Lattner
e10c6cd509
Implement sub.ll:test14
...
llvm-svn: 12355
2004-03-13 00:11:49 +00:00
Chris Lattner
284e9ab607
Implement InstCombine/sub.ll:test12 & test13
...
llvm-svn: 12353
2004-03-12 23:53:13 +00:00
Chris Lattner
bb08e801d4
Fix a couple of minor problems. Because PHI nodes can use themselves, this
...
could cause infinite loops. Also, getUnderlyingObject can return null
llvm-svn: 12351
2004-03-12 23:12:55 +00:00
Chris Lattner
6bd3783ef8
Implement mod/ref analysis for a trivial case where locals don't escape.
...
This comes up when you have a local array on the stack and you never pass
the address of elements around.
llvm-svn: 12349
2004-03-12 22:39:00 +00:00
Brian Gaeke
5bc633f691
Make -print-machineinstrs show us the code both before and after reg. alloc.
...
llvm-svn: 12344
2004-03-12 21:19:08 +00:00
Alkis Evlogimenos
da990ad8a4
Add support for a wider range of CMOV instructions.
...
llvm-svn: 12336
2004-03-12 17:59:56 +00:00
Misha Brukman
ffcf81a11b
Simplify code to process CallSites (thanks to Chris).
...
llvm-svn: 12334
2004-03-12 16:20:49 +00:00
Misha Brukman
6eb48bab7b
Keep transitively-required passes alive for queries to work after the initial
...
user pass is destroyed.
llvm-svn: 12332
2004-03-12 06:16:28 +00:00
Misha Brukman
b5e89d17c2
Evaluate ModRef information in addition to regular ol' pointer analysis.
...
llvm-svn: 12331
2004-03-12 06:15:08 +00:00
Misha Brukman
ee27e80a0b
Implement getModRefInfo() for DSA to calculate whether a function modifies or
...
references a pointer.
llvm-svn: 12330
2004-03-12 06:14:22 +00:00
Chris Lattner
b53ea9f895
Add support for checking the select instruction
...
llvm-svn: 12325
2004-03-12 05:54:31 +00:00
Chris Lattner
a5cc2410f3
Know the opcode name of the select instruction
...
llvm-svn: 12324
2004-03-12 05:54:20 +00:00
Chris Lattner
c84ec93d3e
Add support for select constant expressions. Use reserve a bit more to avoid
...
memory wasteage.
llvm-svn: 12323
2004-03-12 05:54:04 +00:00
Chris Lattner
9ca4f0776f
Add new function
...
llvm-svn: 12322
2004-03-12 05:53:41 +00:00
Chris Lattner
f0a39f27e0
Teach the constant folder how to do select instructions
...
llvm-svn: 12321
2004-03-12 05:53:32 +00:00
Chris Lattner
aa815619b4
Print select instructions correctly
...
llvm-svn: 12320
2004-03-12 05:53:14 +00:00
Chris Lattner
76457c9c13
Add constant folding wrapper support for select instructions.
...
llvm-svn: 12319
2004-03-12 05:53:03 +00:00
Chris Lattner
6b127ea270
Add sccp support for select instructions
...
llvm-svn: 12318
2004-03-12 05:52:44 +00:00
Chris Lattner
41801f046e
Add trivial optimizations for select instructions
...
llvm-svn: 12317
2004-03-12 05:52:32 +00:00
Chris Lattner
e536e15ce1
ADd support for select instructions
...
llvm-svn: 12316
2004-03-12 05:52:14 +00:00
Chris Lattner
c90b157c66
Write select instructions to bytecode
...
llvm-svn: 12315
2004-03-12 05:52:01 +00:00
Chris Lattner
eb7e5f6d24
Read select instrs from bytecode
...
llvm-svn: 12314
2004-03-12 05:51:49 +00:00
Chris Lattner
81df059f63
Allow parsing select instruction and constant expr
...
llvm-svn: 12313
2004-03-12 05:51:36 +00:00
Misha Brukman
da119ce857
Make code more readable.
...
llvm-svn: 12305
2004-03-12 00:58:41 +00:00
Misha Brukman
8eac0e432a
Fix indentation.
...
llvm-svn: 12298
2004-03-11 23:53:51 +00:00
Misha Brukman
fe8263c956
Move implementations of functions here, which avoids #including <cstdlib> in the
...
header file and all those who #include it.
llvm-svn: 12297
2004-03-11 23:52:43 +00:00
Brian Gaeke
ede938b425
Get rid of the abort in PhyRegAlloc::finishSavingState().
...
Make an explicit call to it from runOnFunction() if we know we're supposed to
write into the global. This is lame (esp. the const_cast), but it solves
the problem.
llvm-svn: 12291
2004-03-11 19:46:30 +00:00
Brian Gaeke
e6916ff3b4
Give pass a name
...
llvm-svn: 12290
2004-03-11 19:23:15 +00:00
Misha Brukman
992e44e3c5
Fix compilation on Sparc: assert(0) => abort()
...
llvm-svn: 12289
2004-03-11 19:08:24 +00:00
Brian Gaeke
b3f9f99ff2
In PhyRegAlloc::saveState(), dump Arguments' saved-state, and try to
...
make the output more compact.
Divorce state-saving from the doFinalization method; for some reason it's not
getting called when I want it to, at Reoptimizer time. Put the guts in
PhyRegAlloc::finishSavingState(). Put an abort() in it so that I can be really
really sure that it's getting called.
Update comments.
llvm-svn: 12286
2004-03-11 06:45:52 +00:00
Brian Gaeke
bb3d010689
Remove ghostly directory from the build
...
llvm-svn: 12285
2004-03-11 04:42:41 +00:00
Brian Gaeke
a3ed4044b0
Move all the SaveState options and stuff inton one spot at the top of the file.
...
De-constify SaveStateToModule; we have to set both it and SaveRegAllocState
explicitly in the reoptimizer.
Make SaveRegAllocState an 'external location' option.
llvm-svn: 12278
2004-03-10 22:21:03 +00:00
Brian Gaeke
8af4555830
Only call verifySavedState if SaveRegAllocState is set AND debugging flag is on.
...
llvm-svn: 12277
2004-03-10 22:01:59 +00:00
Chris Lattner
405790ecae
Fix PR284: [indvars] Induction variable analysis violates LLVM invariants
...
llvm-svn: 12275
2004-03-10 21:42:19 +00:00
Brian Gaeke
c60efbcee1
My fix for PR274 broke the build on Darwin/PPC. As I'm fairly certain this
...
bug only affects Linux systems that use GLIBC, I'm going to put ifdefs around
the array.
llvm-svn: 12269
2004-03-10 17:38:28 +00:00
Chris Lattner
9ce3638433
implement new method
...
llvm-svn: 12264
2004-03-09 19:37:06 +00:00
Alkis Evlogimenos
0e0433a791
Spill explicit physical register defs as well.
...
llvm-svn: 12260
2004-03-09 08:35:13 +00:00
Alkis Evlogimenos
a13672fd71
Check if printing of implicit uses is required for all types of shift
...
instructions.
llvm-svn: 12258
2004-03-09 06:10:15 +00:00
Brian Gaeke
acf93be258
Address PR274 - '[JIT] Programs cannot resolve the fstat function'
...
by trying to get the compiler to generate an undefined reference for it
and related functions which live in libc_nonshared.a on Linux.
Linkers... sigh.
llvm-svn: 12256
2004-03-09 05:22:10 +00:00
Brian Gaeke
de0239b2a6
Hmm, who left this sitting around in my tree
...
llvm-svn: 12255
2004-03-09 04:49:13 +00:00
Alkis Evlogimenos
7c0224327e
Differentiate between extended precision floats (80-bit) and double precision floats (64-bit)
...
llvm-svn: 12254
2004-03-09 03:37:54 +00:00
Alkis Evlogimenos
f86d2df13d
Use newly added API to emit bytes for instructions that gas misassembles
...
llvm-svn: 12253
2004-03-09 03:35:34 +00:00
Alkis Evlogimenos
085957be0b
Add emitInstruction() API so that we can get the bytes of a simple instruction
...
llvm-svn: 12252
2004-03-09 03:34:53 +00:00
Alkis Evlogimenos
813daf05c3
Constify things a bit
...
llvm-svn: 12251
2004-03-09 03:30:12 +00:00
Brian Gaeke
57269b0c32
Change PhyRegAlloc::saveStateForValue()'s arg type to deal with
...
AllocInfo.Instruction becoming an int.
llvm-svn: 12247
2004-03-08 23:22:03 +00:00
Brian Gaeke
ed741b87c2
Save argument list alloc state by recording it as the operands of Instruction
...
#-1. Other minor changes to deal with AllocInfo.Instruction becoming an int.
llvm-svn: 12246
2004-03-08 23:22:02 +00:00
Brian Gaeke
b9b20ad428
Make AllocInfo's Instruction an int, so that we can overload it for arguments.
...
(Instruction #-1's operands = argument list).
llvm-svn: 12245
2004-03-08 23:22:01 +00:00
Chris Lattner
9414c55663
Switch to using edge profiling information as the basic source of profile info
...
from using basic block counts.
llvm-svn: 12242
2004-03-08 22:04:08 +00:00
Chris Lattner
83c62c84d6
Refactor implementations
...
llvm-svn: 12240
2004-03-08 21:30:35 +00:00
Chris Lattner
91ea0d3176
Import the trace class from the reoptimizer
...
llvm-svn: 12236
2004-03-08 20:57:27 +00:00
Chris Lattner
de661f7219
If we have edge counts, we can produce block counts. I've verified that
...
using an edge profile to produce block counts gives the exact same numbers
as using a block count directly.
llvm-svn: 12232
2004-03-08 20:03:52 +00:00
Chris Lattner
94d2b3a524
Adjust to new interface
...
llvm-svn: 12231
2004-03-08 18:51:45 +00:00
Chris Lattner
f3a838662e
Add initial support for reading edge counts. This will be improved to enable
...
translation of edge counts into block/function counts when possible.
llvm-svn: 12229
2004-03-08 18:20:18 +00:00
Chris Lattner
01062fb636
Initial support for edge profiling
...
llvm-svn: 12225
2004-03-08 17:54:34 +00:00
Chris Lattner
d40842737b
Split utility functions out of BlockProfiling.cpp
...
llvm-svn: 12224
2004-03-08 17:06:13 +00:00
Chris Lattner
41c4dc98a7
finegrainify namespacification
...
llvm-svn: 12221
2004-03-08 16:45:53 +00:00
Chris Lattner
e44cc1372e
Insert functions into the module promptly, not lazily. This fixes a bug
...
I introduced last night. Note to self: test the *correct* tree...
llvm-svn: 12220
2004-03-08 16:14:19 +00:00
Chris Lattner
38c2e1d1df
Implement test/Regression/Assembler/2004-03-07-FunctionAddressAlignment.llx
...
llvm-svn: 12218
2004-03-08 06:17:35 +00:00
Chris Lattner
23980d3a7c
Remove Module::mutateConstantPointerRef, which is now thankfully dead!
...
This is one small step towards the complete obliteration of
ConstantPointerRef's entirely!! Woot!
llvm-svn: 12216
2004-03-08 06:16:10 +00:00
Chris Lattner
aa5d8cb72f
Eliminate nightmarish API
...
llvm-svn: 12214
2004-03-08 06:11:10 +00:00
Chris Lattner
df5ebdc8b1
Eliminate a REALLY HORRIBLE API: mutateReferences, which is gross gross gross.
...
llvm-svn: 12212
2004-03-08 06:09:57 +00:00
Chris Lattner
1ae4150e31
Fix a bug handling globals that are constants, but are still external
...
llvm-svn: 12208
2004-03-08 03:52:24 +00:00
Chris Lattner
a7180252e6
Avoid allocating special registers a bit more robustly
...
llvm-svn: 12207
2004-03-08 03:48:07 +00:00
Chris Lattner
a55628694a
Implement folding explicit load instructions into binary operations. For a
...
testcase like this:
int %test(int* %P, int %A) {
%Pv = load int* %P
%B = add int %A, %Pv
ret int %B
}
We now generate:
test:
mov %ECX, DWORD PTR [%ESP + 4]
mov %EAX, DWORD PTR [%ESP + 8]
add %EAX, DWORD PTR [%ECX]
ret
Instead of:
test:
mov %EAX, DWORD PTR [%ESP + 4]
mov %ECX, DWORD PTR [%ESP + 8]
mov %EAX, DWORD PTR [%EAX]
add %EAX, %ECX
ret
... saving one instruction, and often a register. Note that there are a lot
of other instructions that could use this, but they aren't handled. I'm not
really interested in adding them, but mul/div and all of the FP instructions
could be supported as well if someone wanted to add them.
llvm-svn: 12204
2004-03-08 01:58:35 +00:00
Chris Lattner
9a9b1c4822
Rearrange and refactor some code. No functionality changes.
...
llvm-svn: 12203
2004-03-08 01:18:36 +00:00
Chris Lattner
933f605592
Implement ArgumentPromotion/aggregate-promote.ll
...
This allows pointers to aggregate objects, whose elements are only read, to
be promoted and passed in by element instead of by reference. This can
enable a LOT of subsequent optimizations in the caller function.
It's worth pointing out that this stuff happens a LOT of C++ programs, because
objects in templates are generally passed around by reference. When these
templates are instantiated on small aggregate or scalar types, however, it is
more efficient to pass them in by value than by reference.
This transformation triggers most on C++ codes (e.g. 334 times on eon), but
does happen on C codes as well. For example, on mesa it triggers 72 times,
and on gcc it triggers 35 times. this is amazingly good considering that
we are using 'basicaa' so far.
llvm-svn: 12202
2004-03-08 01:04:36 +00:00
Chris Lattner
ebebe8f4a0
Implement: ArgumentPromotion/chained.ll
...
llvm-svn: 12200
2004-03-07 22:52:53 +00:00
Chris Lattner
8494ba277f
Fix another minor bug, exposed by perlbmk
...
llvm-svn: 12198
2004-03-07 22:43:27 +00:00
Chris Lattner
ca3b90f308
Since 'load null' is undefined, we can make it do whatever we want. Returning
...
a zero value is the most likely way to cause further simplification, so we do it.
llvm-svn: 12197
2004-03-07 22:16:24 +00:00
Chris Lattner
45cf084497
Fix a minor bug and turn debug output into, well, debug output.
...
llvm-svn: 12195
2004-03-07 21:54:50 +00:00
Chris Lattner
4415950211
New LLVM pass: argument promotion. This version only handles simple scalar
...
variables.
llvm-svn: 12193
2004-03-07 21:29:54 +00:00
Alkis Evlogimenos
65649a50e9
Add memory operand version of conditional move.
...
llvm-svn: 12190
2004-03-07 03:19:11 +00:00
Alkis Evlogimenos
02e8f14c6a
As I wrote in the docs, simple is the default spiller :-)
...
llvm-svn: 12189
2004-03-06 23:08:44 +00:00
Alkis Evlogimenos
467364b706
Add simple spiller.
...
llvm-svn: 12188
2004-03-06 22:38:29 +00:00
Brian Gaeke
4bb4ec2388
Support return values of basic integer types.
...
Emit RETL instruction to return instead of funny JMPL.
Fix indentation.
llvm-svn: 12186
2004-03-06 05:32:28 +00:00
Brian Gaeke
855518207c
Sort stanzas into Sparc V8 book page number order.
...
Add RET, RETL. Rename SAVE, RESTORE & JMPL for consistency.
llvm-svn: 12185
2004-03-06 05:32:13 +00:00
Brian Gaeke
813f0d8512
Hack it so we do not try to allocate values to G0.
...
llvm-svn: 12184
2004-03-06 05:31:32 +00:00
Brian Gaeke
a265c3c4df
Make prolog align stack properly. Make epilog not touch any registers.
...
llvm-svn: 12183
2004-03-06 05:31:21 +00:00
Brian Gaeke
b4258231ca
Emit register names in lowercase, as required by the assembler.
...
llvm-svn: 12182
2004-03-06 05:30:21 +00:00