summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add blocks to the LiveIntervalAnalysis RegMaskBlocks array when splittingCameron Zwarich2013-02-121-2/+6
| | | | | | a critical edge. llvm-svn: 174936
* Fix the updating of LiveIntervals after splitting a critical edge. PHI operandCameron Zwarich2013-02-121-12/+3
| | | | | | | live ranges should always be extended, and the only successor that should be considered for extension of other ranges is the target of the split edge. llvm-svn: 174935
* Add support for updating LiveIntervals to ↵Cameron Zwarich2013-02-111-0/+68
| | | | | | | | | | | | | | | MachineBasicBlock::SplitCriticalEdge(). This is currently a bit hairier than it needs to be, since depending on where the split block resides the end ListEntry of the split block may be the end ListEntry of the original block or a new entry. Some changes to the SlotIndexes updating should make it possible to eliminate the two cases here. This also isn't as optimized as it could be. In the future Liveinterval should probably get a flag that indicates whether the LiveInterval is within a single basic block. We could ignore all such intervals when splitting an edge. llvm-svn: 174870
* Update SlotIndexes after updateTerminator() possibly removes instructions. I amCameron Zwarich2013-02-111-0/+24
| | | | | | really trying to avoid piping SlotIndexes through to RemoveBranch() and friends. llvm-svn: 174869
* Fix the unused but nearly correct method SlotIndexes::insertMBBInMaps() and addCameron Zwarich2013-02-101-0/+14
| | | | | | | | support for updating SlotIndexes to MachineBasicBlock::SplitCriticalEdge(). This calls renumberIndexes() every time; it should be improved to only renumber locally. llvm-svn: 174851
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-2/+2
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Tighten up the splice() API for bundled instructions.Jakob Stoklund Olesen2012-12-181-13/+0
| | | | | | | | | | | Remove the instr_iterator versions of the splice() functions. It doesn't seem useful to be able to splice sequences of instructions that don't consist of full bundles. The normal splice functions that take MBB::iterator arguments are not changed, and they can move whole bundles around without any problems. llvm-svn: 170456
* Tighten the insert() API for bundled instructions.Jakob Stoklund Olesen2012-12-181-0/+12
| | | | | | | | | | | | | | | | | The normal insert() function takes an MBB::iterator position, and inserts a stand-alone MachineInstr as before. The insert() function that takes an MBB::instr_iterator position can insert instructions inside a bundle, and will now update the bundle flags correctly when that happens. When the insert position is between two bundles, it is unclear whether the instruction should be appended to the previous bundle, prepended to the next bundle, or stand on its own. The MBB::insert() function doesn't bundle the instruction in that case, use the MIBundleBuilder class for that. llvm-svn: 170437
* Tighten up the erase/remove API for bundled instructions.Jakob Stoklund Olesen2012-12-171-18/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most code is oblivious to bundles and uses the MBB::iterator which only visits whole bundles. MBB::erase() operates on whole bundles at a time as before. MBB::remove() now refuses to remove bundled instructions. It is not safe to remove all instructions in a bundle without deleting them since there is no way of returning pointers to all the removed instructions. MBB::remove_instr() and MBB::erase_instr() will now update bundle flags correctly, lifting individual instructions out of bundles while leaving the remaining bundle intact. The MachineInstr convenience functions are updated so eraseFromParent() erases a whole bundle as before eraseFromBundle() erases a single instruction, leaving the rest of its bundle. removeFromParent() refuses to operate on bundled instructions, and removeFromBundle() lifts a single instruction out of its bundle. These functions will no longer accidentally split or coalesce bundles - bundle flags are updated to preserve the existing bundling, and explicit bundleWith* / unbundleFrom* functions should be used to change the instruction bundling. This API update is still a work in progress. I am going to update APIs first so they maintain bundle flags automatically when possible. Then I'll add stricter verification of the bundle flags. llvm-svn: 170384
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-7/+7
| | | | | | | | | | | | | | | | | 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
* Fix physical register liveness calculations:Tim Northover2012-11-201-6/+9
| | | | | | | + Take account of clobbers + Give outputs priority over inputs since they happen later. llvm-svn: 168360
* Make sure I is not the end iterator when isInsideBundle is called. Akira Hatanaka2012-10-261-2/+3
| | | | llvm-svn: 166784
* Move TargetData to DataLayout.Micah Villmow2012-10-081-1/+1
| | | | llvm-svn: 165402
* Add a function computeRegisterLiveness() to MachineBasicBlock. This uses ↵James Molloy2012-09-121-0/+74
| | | | | | | | analyzePhysReg() from r163694 to heuristically try and determine the liveness state of a physical register upon arrival at a particular instruction in a block. The search for liveness is clipped to a specific number of instructions around the target MachineInstr, in order to avoid degenerating into an O(N^2) algorithm. It tries to use various clues about how instructions around (both before and after) a given MachineInstr use that register, to determine its state at the MachineInstr. llvm-svn: 163695
* Release build: guard dump functions withManman Ren2012-09-111-1/+1
| | | | | | | | "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" No functional change. Update r163339. llvm-svn: 163653
* Release build: guard dump functions with "ifndef NDEBUG"Manman Ren2012-09-061-0/+2
| | | | | | No functional change. llvm-svn: 163339
* Add a getName function to MachineFunction. Use it in places that previously ↵Craig Topper2012-08-221-1/+1
| | | | | | did getFunction()->getName(). Remove includes of Function.h that are no longer needed. llvm-svn: 162347
* Fix a quadratic algorithm in MachineBranchProbabilityInfo.Jakob Stoklund Olesen2012-08-201-3/+2
| | | | | | | | | | | | The getSumForBlock function was quadratic in the number of successors because getSuccWeight would perform a linear search for an already known iterator. This patch was originally committed as r161460, but reverted again because of assertion failures. Now that duplicate Machine CFG edges have been eliminated, this works properly. llvm-svn: 162233
* Transfer weights in transferSuccessorsAndUpdatePHIs().Jakob Stoklund Olesen2012-08-131-5/+7
| | | | llvm-svn: 161805
* Print out MachineBasicBlock successor weights when available.Jakob Stoklund Olesen2012-08-131-1/+4
| | | | llvm-svn: 161804
* Update edge weights correctly in replaceSuccessor().Jakob Stoklund Olesen2012-08-101-9/+33
| | | | | | | | When replacing Old with New, it can happen that New is already a successor. Add the old and new edge weights instead of creating a duplicate edge. llvm-svn: 161653
* Move use list management into MachineRegisterInfo.Jakob Stoklund Olesen2012-08-091-1/+2
| | | | | | | | | | | | | | Register MachineOperands are kept in linked lists accessible via MRI's reg_iterator interfaces. The linked list management was handled partly by MachineOperand methods, partly by MRI methods. Move all of the list management into MRI, delete MO::AddRegOperandToRegInfo() and MO::RemoveRegOperandFromRegInfo(). Be more explicit about handling the cases where an MRI pointer isn't available. llvm-svn: 161632
* Revert "Fix a quadratic algorithm in MachineBranchProbabilityInfo."Jakob Stoklund Olesen2012-08-081-2/+3
| | | | | | It caused an assertion failure when compiling consumer-typeset. llvm-svn: 161463
* Fix a quadratic algorithm in MachineBranchProbabilityInfo.Jakob Stoklund Olesen2012-08-081-3/+2
| | | | | | | | The getSumForBlock function was quadratic in the number of successors because getSuccWeight would perform a linear search for an already known iterator. llvm-svn: 161460
* Add MachineBasicBlock::isPredecessor().Jakob Stoklund Olesen2012-07-301-2/+5
| | | | | | | | A->isPredecessor(B) is the same as B->isSuccessor(A), but it can tolerate a B that is null or dangling. This shouldn't happen normally, but it it useful for verification code. llvm-svn: 160968
* Remove tabs.Bill Wendling2012-07-191-1/+1
| | | | llvm-svn: 160475
* Remove assignments which aren't used afterwards.Bill Wendling2012-06-151-3/+1
| | | | llvm-svn: 158535
* MachineBasicBlock::SplitCriticalEdge() should follow LLVM IR variant and ↵Evan Cheng2012-04-241-0/+5
| | | | | | refuse to break edge to EH landing pad. rdar://11300144 llvm-svn: 155470
* Fix updateTerminator to be resiliant to degenerate terminators whereChandler Carruth2012-04-161-7/+29
| | | | | | | | | | | | | | | | | | | | | both fallthrough and a conditional branch target the same successor. Gracefully delete the conditional branch and introduce any unconditional branch needed to reach the actual successor. This fixes memory corruption in 2009-06-15-RegScavengerAssert.ll and possibly other tests. Also, while I'm here fix a latent bug I spotted by inspection. I never applied the same fundamental fix to this fallthrough successor finding logic that I did to the logic used when there are no conditional branches. As a consequence it would have selected landing pads had they be aligned in just the right way here. I don't have a test case as I spotted this by inspection, and the previous time I found this required have of TableGen's source code to produce it. =/ I hate backend bugs. ;] Thanks to Jim Grosbach for helping me reason through this and reviewing the fix. llvm-svn: 154867
* Allow removeLiveIn to be called with a register that isn't live-in.Jakob Stoklund Olesen2012-03-281-2/+2
| | | | | | | | | This avoids the silly double search: if (isLiveIn(Reg)) removeLiveIn(Reg); llvm-svn: 153592
* Added MachineBasicBlock::getFullName() to standardize/factor codegen ↵Andrew Trick2012-03-071-0/+12
| | | | | | diagnostics. llvm-svn: 152176
* Cache iterators. Some of these are expensive to create.Benjamin Kramer2012-02-101-14/+16
| | | | llvm-svn: 150214
* Preserve physreg kills in MachineBasicBlock::SplitCriticalEdge.Lang Hames2012-02-091-4/+7
| | | | | | | Failure to preserve kills was causing LiveIntervals to miss some EFLAGS live ranges. Unfortunately I've been unable to reduce a good test case yet. llvm-svn: 150152
* Update comment for r149070.Chad Rosier2012-01-261-3/+1
| | | | llvm-svn: 149075
* Replace the use of isPredicable() with isPredicated() inChad Rosier2012-01-261-3/+2
| | | | | | | | | MachineBasicBlock::canFallThrough(). We're interested in the state of the instruction (i.e., is this a barrier or not?), not if the instruction is predicable or not. rdar://10501092 llvm-svn: 149070
* Add some constantness to BranchProbabilityInfo and BlockFrequnencyInfo.Jakub Staszak2011-12-201-2/+12
| | | | llvm-svn: 146986
* - Add MachineInstrBundle.h and MachineInstrBundle.cpp. This includes a functionEvan Cheng2011-12-141-20/+58
| | | | | | | | | | to finalize MI bundles (i.e. add BUNDLE instruction and computing register def and use lists of the BUNDLE instruction) and a pass to unpack bundles. - Teach more of MachineBasic and MachineInstr methods to be bundle aware. - Switch Thumb2 IT block to MI bundles and delete the hazard recognizer hack to prevent IT blocks from being broken apart. llvm-svn: 146542
* Add bundle aware API for querying instruction properties and switch the codeEvan Cheng2011-12-071-3/+3
| | | | | | | | | | | | | | generator to it. For non-bundle instructions, these behave exactly the same as the MC layer API. For properties like mayLoad / mayStore, look into the bundle and if any of the bundled instructions has the property it would return true. For properties like isPredicable, only return true if *all* of the bundled instructions have the property. For properties like canFoldAsLoad, isCompare, conservatively return false for bundles. llvm-svn: 146026
* First chunk of MachineInstr bundle support.Evan Cheng2011-12-061-26/+69
| | | | | | | | | 1. Added opcode BUNDLE 2. Taught MachineInstr class to deal with bundled MIs 3. Changed MachineBasicBlock iterator to skip over bundled MIs; added an iterator to walk all the MIs 4. Taught MachineBasicBlock methods about bundled MIs llvm-svn: 145975
* Pretty-print basic block alignment.Jakob Stoklund Olesen2011-12-061-2/+6
| | | | llvm-svn: 145965
* Handle the case of a no-return invoke correctly. It actually still hasChandler Carruth2011-11-231-0/+8
| | | | | | | | | successors, they just are all landing pad successors. We handle this the same way as no successors. Comments attached for the next person to wade through here and another lovely test case courtesy of Benjamin Kramer's bugpoint reduction. llvm-svn: 145098
* Fix a devilish miscompile exposed by block placement. TheChandler Carruth2011-11-221-2/+8
| | | | | | | | | | | | | | | | | | | | | updateTerminator code didn't correctly handle EH terminators in one very specific case. AnalyzeBranch would find no terminator instruction, and so the fallback in updateTerminator is to assume fallthrough. This is correct, but the destination of the fallthrough was assumed to be the first successor. This is *almost always* true, but in certain cases the loop transformations will cause the landing pad to be the first successor! Instead of this brittle logic, actually look through the successors for a non-landing-pad accessor, and to assert if more than one is found. This will hopefully fix some (if not all) of the self host miscompiles with block placement. Thanks to Benjamin Kramer for reporting, Nick Lewycky for an initial stab at a reduction, and Duncan for endless advice on EH (which I know nothing about) as well as reviewing the actual fix. llvm-svn: 145062
* Update live-in lists when splitting critical edges.Jakob Stoklund Olesen2011-10-141-0/+5
| | | | | | Fixes PR10814. Patch by Jan Sjödin! llvm-svn: 141960
* - Rename TargetInstrDesc, TargetOperandInfo to MCInstrDesc and MCOperandInfo andEvan Cheng2011-06-281-1/+0
| | | | | | | | sink them into MC layer. - Added MCInstrInfo, which captures the tablegen generated static data. Chang TargetInstrInfo so it's based off MCInstrInfo. llvm-svn: 134021
* getSuccWeight returns now default 0 if Weights vector is empty.Jakub Staszak2011-06-171-2/+4
| | | | llvm-svn: 133271
* Allow empty Weights vector.Jakub Staszak2011-06-171-1/+2
| | | | llvm-svn: 133265
* Introduce MachineBranchProbabilityInfo class, which has similar API toJakub Staszak2011-06-161-7/+69
| | | | | | | | BranchProbabilityInfo (expect setEdgeWeight which is not available here). Branch Weights are kept in MachineBasicBlocks. To turn off this analysis set -use-mbpi=false. llvm-svn: 133184
* Test commit.Jakub Staszak2011-06-161-7/+7
| | | | llvm-svn: 133174
* Fix PR10046 by updating LiveVariables kill info when splitting live ranges.Jakob Stoklund Olesen2011-05-291-2/+39
| | | | | | | | | | | | | This only affects targets like Mips where branch instructions may kill virtual registers. Most other targets branch on flag values, so virtual registers are not involved. The problem is that MachineBasicBlock::updateTerminator deletes branches and inserts new ones while LiveVariables keeps a list of pointers to instructions that kill virtual registers. That list wasn't properly updated in MBB::SplitCriticalEdge. llvm-svn: 132298
* Simplify declarations slightly by using typedefs.Eli Friedman2011-04-181-4/+2
| | | | llvm-svn: 129720
OpenPOWER on IntegriCloud