aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RegAllocBasic.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-10-14Remove unnecessary TargetMachine.h includes.Eric Christopher1-1/+0
llvm-svn: 219672
2014-07-19Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ↵David Blaikie1-1/+1
".reset()" It's also possible to just write "= nullptr", but there's some question of whether that's as readable, so I leave it up to authors to pick which they prefer for now. If we want to discuss standardizing on one or the other, we can do that at some point in the future. llvm-svn: 213438
2014-04-22[Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth1-1/+2
define below all header includes in the lib/CodeGen/... tree. While the current modules implementation doesn't check for this kind of ODR violation yet, it is likely to grow support for it in the future. It also removes one layer of macro pollution across all the included headers. Other sub-trees will follow. llvm-svn: 206837
2014-04-14[C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper1-2/+2
instead of comparing to nullptr. llvm-svn: 206142
2014-03-07Remove unused method.Craig Topper1-2/+0
llvm-svn: 203221
2014-03-07[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-9/+9
class. llvm-svn: 203220
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-1/+1
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
2013-11-11CalcSpillWeights: give a better describing name to calculateSpillWeightsArnaud A. de Grandmaison1-3/+3
Besides, this relates it more obviously to the VirtRegAuxInfo::calculateSpillWeightAndHint. No functionnal change. llvm-svn: 194404
2013-11-10CalculateSpillWeights does not need to be a passArnaud A. de Grandmaison1-2/+5
Based on discussions with Lang Hames and Jakob Stoklund Olesen at the hacker's lab, and in the light of upcoming work on the PBQP register allocator, it was though that CalcSpillWeights does not need to be a pass. This change will enable to customize / tune the spill weight computation depending on the allocator. Update the documentation style while there. No functionnal change. llvm-svn: 194356
2013-11-08Revert "CalculateSpillWeights does not need to be a pass"Arnaud A. de Grandmaison1-0/+2
Temporarily revert my previous commit until I understand why it breaks 3 target tests. llvm-svn: 194272
2013-11-08CalculateSpillWeights does not need to be a passArnaud A. de Grandmaison1-2/+0
Based on discussions with Lang Hames and Jakob Stoklund Olesen at the hacker's lab, and in the light of upcoming work on the PBQP register allocator, it was though that CalcSpillWeights does not need to be a pass. This change will enable to customize / tune the spill weight computation depending on the allocator. Update the documentation style while there. No functionnal change. llvm-svn: 194269
2013-08-14Track new virtual registers by register number.Mark Lacey1-4/+4
Track new virtual registers by register number, rather than by the live interval created for them. This is the first step in separating the creation of new virtual registers and new live intervals. Eventually live intervals will be created and populated on demand after the virtual registers have been created and used in instructions. llvm-svn: 188434
2013-06-17Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo.Benjamin Kramer1-0/+3
The main advantages here are way better heuristics, taking into account not just loop depth but also __builtin_expect and other static heuristics and will eventually learn how to use profile info. Most of the work in this patch is pushing the MachineBlockFrequencyInfo analysis into the right places. This is good for a 5% speedup on zlib's deflate (x86_64), there were some very unfortunate spilling decisions in its hottest loop in longest_match(). Other benchmarks I tried were mostly neutral. This changes register allocation in subtle ways, update the tests for it. 2012-02-20-MachineCPBug.ll was deleted as it's very fragile and the instruction it looked for was gone already (but the FileCheck pattern picked up unrelated stuff). llvm-svn: 184105
2013-04-12Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs1-1/+1
llvm-svn: 179373
2013-03-05Remove unused #includes.Bill Wendling1-1/+0
llvm-svn: 176467
2012-12-03Use the new script to sort the includes of every file under lib.Chandler Carruth1-6/+5
Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
2012-11-28Make the LiveRegMatrix analysis available to targets.Jakob Stoklund Olesen1-2/+2
No functional change, just moved header files. Targets can inject custom passes between register allocation and rewriting. This makes it possible to tweak the register allocation before rewriting, using the full global interference checking available from LiveRegMatrix. llvm-svn: 168806
2012-08-22Tidy up a few more uses of MF.getFunction()->getName().David Blaikie1-2/+1
Based on CR feedback from r162301 and Craig Topper's refactoring in r162347 here are a few other places that could use the same API (& in one instance drop a Function.h dependency). llvm-svn: 162367
2012-06-20Remove the RenderMachineFunction HTML output pass.Jakob Stoklund Olesen1-13/+0
I don't think anyone has been using this functionality for a while, and it is getting in the way of refactoring now. llvm-svn: 158876
2012-06-20Remove LiveIntervalUnions from RegAllocBase.Jakob Stoklund Olesen1-3/+3
They are living in LiveRegMatrix now. llvm-svn: 158868
2012-06-20Convert RABasic to using LiveRegMatrix interference checking.Jakob Stoklund Olesen1-68/+51
Stop using the LiveIntervalUnions provided by RegAllocBase, they will be removed soon. llvm-svn: 158866
2012-06-16Guard private fields that are unused in Release builds with #ifndef NDEBUG.Benjamin Kramer1-0/+2
llvm-svn: 158608
2012-06-15Remove final verification in RABasic.Jakob Stoklund Olesen1-20/+0
We now have a proper machine code verifier pass between register allocation and rewriting. llvm-svn: 158577
2012-06-09Also compute MBB live-in lists in the new rewriter pass.Jakob Stoklund Olesen1-2/+0
This deduplicates some code from the optimizing register allocators, and it means that it is now possible to change the register allocators' solutions simply by editing the VirtRegMap between the register allocator pass and the rewriter. llvm-svn: 158249
2012-06-08Reintroduce VirtRegRewriter.Jakob Stoklund Olesen1-11/+1
OK, not really. We don't want to reintroduce the old rewriter hacks. This patch extracts virtual register rewriting as a separate pass that runs after the register allocator. This is possible now that CodeGen/Passes.cpp can configure the full optimizing register allocator pipeline. The rewriter pass uses register assignments in VirtRegMap to rewrite virtual registers to physical registers, and it inserts kill flags based on live intervals. These finalization steps are the same for the optimizing register allocators: RABasic, RAGreedy, and PBQP. llvm-svn: 158244
2012-06-06Remove unused private fields found by clang's new -Wunused-private-field.Benjamin Kramer1-1/+0
There are some that I didn't remove this round because they looked like obvious stubs. There are dead variables in gtest too, they should be fixed upstream. llvm-svn: 158090
2012-06-01Switch all register list clients to the new MC*Iterator interface.Jakob Stoklund Olesen1-4/+4
No functional change intended. Sorry for the churn. The iterator classes are supposed to help avoid giant commits like this one in the future. The TableGen-produced register lists are getting quite large, and it may be necessary to change the table representation. This makes it possible to do so without changing all clients (again). llvm-svn: 157854
2012-05-19Allow LiveRangeEdit to be created with a NULL parent.Jakob Stoklund Olesen1-2/+2
The dead code elimination with callbacks is still useful. llvm-svn: 157100
2012-04-02Moved LiveRangeEdit.h so that it can be called from other parts of the ↵Pete Cooper1-1/+1
backend, not just libCodeGen llvm-svn: 153906
2012-04-02Refactored the LiveRangeEdit interface so that MachineFunction, ↵Pete Cooper1-2/+2
TargetInstrInfo, MachineRegisterInfo, LiveIntervals, and VirtRegMap are all passed into the constructor and stored as members instead of passed in to each method. llvm-svn: 153903
2012-03-04Use uint16_t to store register overlaps to reduce static data.Craig Topper1-2/+2
llvm-svn: 152001
2012-02-28Kill off LiveRangeEdit::getNewVRegs and LiveRangeEdit::getUselessVRegs. TheseLang Hames1-1/+1
methods are no longer needed now that LinearScan has gone away. (Contains tweaks trivialSpillEverywhere to enable the removal of getNewVRegs). llvm-svn: 151658
2012-02-21Clear virtual registers after they are no longer referenced.Andrew Trick1-1/+4
Passes after RegAlloc should be able to rely on MRI->getNumVirtRegs() == 0. This makes sharing code for pre/postRA passes more robust. Now, to check if a pass is running before the RA pipeline begins, use MRI->isSSA(). To check if a pass is running after the RA pipeline ends, use !MRI->getNumVirtRegs(). PEI resets virtual regs when it's done scavenging. PTX will either have to provide its own PEI pass or assign physregs. llvm-svn: 151032
2012-02-10RegAlloc superpass: includes phi elimination, coalescing, and scheduling.Andrew Trick1-4/+0
Creates a configurable regalloc pipeline. Ensure specific llc options do what they say and nothing more: -reglloc=... has no effect other than selecting the allocator pass itself. This patch introduces a new umbrella flag, "-optimize-regalloc", to enable/disable the optimizing regalloc "superpass". This allows for example testing coalscing and scheduling under -O0 or vice-versa. When a CodeGen pass requires the MachineFunction to have a particular property, we need to explicitly define that property so it can be directly queried rather than naming a specific Pass. For example, to check for SSA, use MRI->isSSA, not addRequired<PHIElimination>. CodeGen transformation passes are never "required" as an analysis ProcessImplicitDefs does not require LiveVariables. We have a plan to massively simplify some of the early passes within the regalloc superpass. llvm-svn: 150226
2012-02-08Add Register mask support to RABasic.Jakob Stoklund Olesen1-0/+14
When a virtual register is live across a call, limit the search space to call-preserved registers. llvm-svn: 150081
2012-01-17Renamed MachineScheduler to ScheduleTopDownLive.Andrew Trick1-1/+1
Responding to code review. llvm-svn: 148290
2012-01-17Moving options declarations around.Andrew Trick1-2/+0
More short term hackery until we have a way to configure passes that work on LiveIntervals. llvm-svn: 148289
2012-01-13Added the MachineSchedulerPass skeleton.Andrew Trick1-0/+3
llvm-svn: 148105
2012-01-11Make data structures private.Jakob Stoklund Olesen1-3/+3
llvm-svn: 147979
2012-01-11Sink spillInterferences into RABasic.Jakob Stoklund Olesen1-0/+62
This helper method is too simplistic for RAGreedy. llvm-svn: 147976
2012-01-11Move RegAllocBase into its own cpp file separate from RABasic.Jakob Stoklund Olesen1-312/+1
No functional change. llvm-svn: 147972
2012-01-05Freeze reserved registers before starting register allocation.Jakob Stoklund Olesen1-0/+1
The register allocators don't currently support adding reserved registers while they are running. Extend the MRI API to keep track of the set of reserved registers when register allocation started. Target hooks like hasFP() and needsStackRealignment() can look at this set to avoid reserving more registers during register allocation. llvm-svn: 147577
2011-08-11Privatize an unused part of the LiveIntervalUnion::Query interface.Jakob Stoklund Olesen1-1/+2
No clients are iterating over interference overlaps. llvm-svn: 137350
2011-08-09Refer to the RegisterCoalescer pass by ID.Jakob Stoklund Olesen1-2/+1
A public interface is no longer needed since RegisterCoalescer is not an analysis any more. llvm-svn: 137082
2011-07-26Print out the MBB live-in registers.Jakob Stoklund Olesen1-0/+4
llvm-svn: 136178
2011-07-02Better diagnostics when inline asm fails to allocate.Jakob Stoklund Olesen1-12/+14
asm.c:2:7: error: ran out of registers during register allocation asm(""::"r"(0), "r"(1), "r"(2), "r"(3), "r"(4), "r"(5), "r"(6), "r"(7), "r"(8), "r"(9)); ^ llvm-svn: 134310
2011-06-26There is only one register coalescer. Merge it into the base class andRafael Espindola1-1/+1
remove the analysis group. llvm-svn: 133899
2011-06-26Move RegisterCoalescer.h to lib/CodeGen.Rafael Espindola1-1/+1
llvm-svn: 133895
2011-06-03Switch AllocationOrder to using RegisterClassInfo instead of a BitVectorJakob Stoklund Olesen1-12/+7
of reserved registers. Use RegisterClassInfo in RABasic as well. This slightly changes som allocation orders because RegisterClassInfo puts CSR aliases last. llvm-svn: 132581
2011-05-10Fix PR9883. Make sure all caches are invalidated when a live range is repaired.Jakob Stoklund Olesen1-1/+1
The previous invalidation missed the alias interference caches. Also add a stats counter for the number of repaired ranges. llvm-svn: 131133