Evan Cheng
1f6148a84c
- Remove calls to copyKillDeadInfo which is an N^2 function. Instead, propagate kill / dead markers as new instructions are constructed in foldMemoryOperand, convertToThressAddress, etc.
...
- Also remove LiveVariables::instructionChanged, etc. Replace all calls with cheaper calls which update VarInfo kill list.
llvm-svn: 53097
2008-07-03 09:09:37 +00:00
Evan Cheng
7c3920e692
- Add LiveVariables::replaceKillInstruction. This does a subset of instructionChanged. That is, it only update the VarInfo.kills if the new instruction is known to have the correct dead and kill markers.
...
- CommuteInstruction copies kill / dead markers over to new instruction. So use replaceKillInstruction instead.
llvm-svn: 53061
2008-07-03 00:07:19 +00:00
Owen Anderson
604f9f722d
Make LiveVariables even more optional, by making it optional in the call to TargetInstrInfo::convertToThreeAddressInstruction
...
Also, if LV isn't around, then TwoAddr doesn't need to be updating flags, since they won't have been set in the first place.
llvm-svn: 53058
2008-07-02 23:41:07 +00:00
Owen Anderson
a420723feb
TwoAddressInstructionPass doesn't really require LiveVariables, it just needs to update it if it's already around.
...
llvm-svn: 53049
2008-07-02 21:28:58 +00:00
Evan Cheng
a83d69e3b9
Remove unneeded include.
...
llvm-svn: 52920
2008-06-30 20:38:22 +00:00
Evan Cheng
bab5925a0b
Enable two-address remat by default.
...
llvm-svn: 52701
2008-06-25 01:16:38 +00:00
Evan Cheng
b12290e31b
Missed a check.
...
llvm-svn: 52487
2008-06-19 06:17:19 +00:00
Evan Cheng
ad0a4a31f8
Complete support for two-address pass rematerialization. Now *almost* always a win.
...
llvm-svn: 52452
2008-06-18 07:49:14 +00:00
Bill Wendling
edb38e9410
Implement "AsCheapAsAMove" for some obviously cheap instructions: xor and the
...
like.
llvm-svn: 51662
2008-05-29 01:02:09 +00:00
Bill Wendling
5011b8d77d
Check the "isSafeToMove" predicate, which has a series of tests to make sure
...
that it's safe to remat an instruction.
llvm-svn: 51659
2008-05-28 22:52:47 +00:00
Bill Wendling
e5d738e779
Incorporated feedback: Check that the implicitly defined operands aren't used
...
before deleting the instruction.
llvm-svn: 51609
2008-05-27 20:40:52 +00:00
Bill Wendling
87ca2e8a41
The enabling of remat in 2-address conversion breaks this test:
...
Running /Users/void/llvm/llvm.src/test/CodeGen/X86/dg.exp ...
FAIL: /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll
Failed with exit(1) at line 1
while running: llvm-as < /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll | llc -march=x86 -mattr=+sse2 -stats |& grep {1 .*folded into instructions}
child process exited abnormally
Make this conditional for now.
llvm-svn: 51563
2008-05-26 05:49:49 +00:00
Bill Wendling
62fae6aeee
A problem that's exposed when machine LICM is enabled. Consider this code:
...
LBB1_3: # bb
...
xorl %ebp, %ebp
subl (%ebx), %ebp
...
incl %ecx
cmpl %edi, %ecx
jl LBB1_3 # bb
Whe using machine LICM, LLVM converts it into:
xorl %esi, %esi
LBB1_3: # bb
...
movl %esi, %ebp
subl (%ebx), %ebp
...
incl %ecx
cmpl %edi, %ecx
jl LBB1_3 # bb
Two address conversion inserts the copy instruction. However, it's cheaper to
rematerialize it, and remat helps reduce register pressure.
llvm-svn: 51562
2008-05-26 05:18:34 +00:00
Dan Gohman
138a53b303
Change class' public PassInfo variables to by initialized with the
...
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.
Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.
llvm-svn: 51022
2008-05-13 02:05:11 +00:00
Dan Gohman
bab18cae46
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Bill Wendling
89c91f81ae
Cosmetic changes:
...
- Comment fixes.
- Moar whitespace.
- Made ivars "private" by default.
No functionality change.
llvm-svn: 50926
2008-05-10 00:12:52 +00:00
Evan Cheng
6cbce6b602
Fix a memory bug: increment an iterator of a deleted machine instr.
...
llvm-svn: 48853
2008-03-27 01:27:25 +00:00
Evan Cheng
a7c38d1ce9
Typo.
...
llvm-svn: 48337
2008-03-13 08:04:35 +00:00
Evan Cheng
9a7395ba78
Don't try to sink 3-address instruction if convertToThreeAddress created more than one instructions.
...
llvm-svn: 48336
2008-03-13 07:56:58 +00:00
Evan Cheng
38a8da7b16
Remove an unused command line option.
...
llvm-svn: 48334
2008-03-13 06:38:28 +00:00
Evan Cheng
0b8b1647dd
TwoAddressInstructionPass enhancement. After it converts a two address instruction into a 3-address one, sink it past the instruction that kills the read-mod-write register if its definition is used past the kill. This reduces the number of live register by one.
...
llvm-svn: 48333
2008-03-13 06:37:55 +00:00
Evan Cheng
18064ddb5b
Refactor code. Remove duplicated functions that basically do the same thing as
...
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.
llvm-svn: 47927
2008-03-05 00:59:57 +00:00
Dan Gohman
cabaec582f
Rename MRegisterInfo to TargetRegisterInfo.
...
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Owen Anderson
946d55e773
Remove DefInst from LiveVariables::VarInfo. Use the facilities on MachineRegisterInfo instead.
...
llvm-svn: 46016
2008-01-15 22:02:46 +00:00
Chris Lattner
f83aae613c
rename TargetInstrDescriptor -> TargetInstrDesc.
...
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.
llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner
57e851edfe
Rename all the M_* flags to be namespace qualified enums, and switch
...
all clients over to using predicates instead of these flags directly.
These are now private values which are only to be used to statically
initialize the tables.
llvm-svn: 45692
2008-01-07 06:42:05 +00:00
Chris Lattner
c745aa59b3
add more and significantly better comments to the rest of the machineinstr
...
flags that can be set. Add predicates for the ones lacking it, and switch
some clients over to using the predicates instead of Flags directly.
llvm-svn: 45690
2008-01-07 06:21:53 +00:00
Chris Lattner
9d38dfa4a5
Move a bunch more accessors from TargetInstrInfo to TargetInstrDescriptor
...
llvm-svn: 45680
2008-01-07 03:13:06 +00:00
Chris Lattner
f7f96d818f
Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
...
that it is cheap and efficient to get.
Move a variety of predicates from TargetInstrInfo into
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around. Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.
Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.
llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Bill Wendling
93556af6c4
Don't recalculate the loop info and loop dominators analyses if they're
...
preserved.
llvm-svn: 45596
2008-01-04 20:54:55 +00:00
Owen Anderson
ae7e2c1e03
Move copyRegToReg from MRegisterInfo to TargetInstrInfo. This is part of the
...
Machine-level API cleanup instigated by Chris.
llvm-svn: 45470
2007-12-31 06:32:00 +00:00
Chris Lattner
96167aa93c
Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
...
that "machine" classes are used to represent the current state of
the code being compiled. Given this expanded name, we can start
moving other stuff into it. For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.
Update all the clients to match.
This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.
llvm-svn: 45467
2007-12-31 04:13:23 +00:00
Chris Lattner
ad9a6ccb83
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Owen Anderson
40abf86e03
As Chris and Evan pointed out, BreakCriticalMachineEdges doesn't really need
...
to be a pass of its own. Instead, move it out into a helper method.
llvm-svn: 44002
2007-11-12 01:05:09 +00:00
Owen Anderson
17a70ad8c6
This preserves critical edge breaking.
...
llvm-svn: 43911
2007-11-08 22:23:57 +00:00
Owen Anderson
ba84ab5b21
Bring UsedBlocks back. StrongPHIElimination needs this information.
...
llvm-svn: 43866
2007-11-08 01:20:48 +00:00
Evan Cheng
5391d0a39d
It's possible to commute instrctions with more than 3 operands.
...
llvm-svn: 43256
2007-10-23 20:14:40 +00:00
Evan Cheng
7df9c5e089
Added missing curly braces which renders the if clause useless in debug build.
...
llvm-svn: 43196
2007-10-20 04:01:47 +00:00
Evan Cheng
5f9e291240
Allow copyRegToReg to emit cross register classes copies.
...
Tested with "make check"!
llvm-svn: 42346
2007-09-26 06:25:56 +00:00
Nick Lewycky
c2306ff5b4
Fix typo in comment.
...
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Devang Patel
cd45427a87
Drop 'const'
...
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
8ee9065162
Use 'static const char' instead of 'static const int'.
...
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.
llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel
38a66bc82e
Do not use typeinfo to identify pass in pass manager.
...
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Evan Cheng
fbbdb92c9d
VarInfo::UsedBlocks is no longer used. Remove.
...
llvm-svn: 36250
2007-04-18 05:04:38 +00:00
Evan Cheng
76df6abc61
Keep UsedBlocks info accurate.
...
llvm-svn: 35140
2007-03-18 09:02:31 +00:00
Chris Lattner
a975b95adb
Eliminate static ctors from Statistics
...
llvm-svn: 32698
2006-12-19 22:41:21 +00:00
Bill Wendling
4d1444725b
Removed more <iostream> includes
...
llvm-svn: 32321
2006-12-07 20:28:15 +00:00
Chris Lattner
a531ce882e
Detemplatize the Statistic class. The only type it is instantiated with
...
is 'unsigned'.
llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Evan Cheng
bf13611e84
Match TargetInstrInfo changes.
...
llvm-svn: 32098
2006-12-01 21:52:58 +00:00
Bill Wendling
d8c0883f20
Use llvm streams instead of <iostream>
...
llvm-svn: 31985
2006-11-28 22:48:48 +00:00