aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-05-06Update LiveDebugVariables after live range splitting.Jakob Stoklund Olesen1-1/+146
After a virtual register is split, update any debug user variables that resided in the old register. This ensures that the LiveDebugVariables are still correct after register allocation. This may create DBG_VALUE instructions that place a user variable in a register in parts of the function and in a stack slot in other parts. DwarfDebug currently doesn't support that. llvm-svn: 130998
2011-05-06Use TargetMachine hooks to properly print debug variable locations.Jakob Stoklund Olesen1-6/+7
llvm-svn: 130997
2011-04-15Fix a ton of comment typos found by codespell. Patch byChris Lattner1-1/+1
Luis Felipe Strano Moraes! llvm-svn: 129558
2011-03-22Reapply r128045 and r128051 with fixes.Jakob Stoklund Olesen1-17/+7
This will extend the ranges of debug info variables in registers until they are clobbered. Fix 1: Don't mistake DBG_VALUE instructions referring to incoming arguments on the stack with DBG_VALUE instructions referring to variables in the frame pointer. This fixes the gdb test-suite failure. Fix 2: Don't trace through copies to physical registers setting up call arguments. These registers are call clobbered, and the source register is more likely to be a callee-saved register that can be extended through the call instruction. llvm-svn: 128114
2011-03-22Revert r128045 and r128051, debug info enhancements.Andrew Trick1-0/+17
Temporarily reverting these to see if we can get llvm-objdump to link. Hopefully this is not the problem. llvm-svn: 128097
2011-03-22Dont emit 'DBG_VALUE %noreg, ...' to terminate user variable ranges.Jakob Stoklund Olesen1-17/+0
These ranges get completely jumbled by the post-ra scheduler, and it is not really reasonable to expect it to make sense of them. Instead, teach DwarfDebug to notice when user variables in registers are clobbered, and terminate the ranges there. llvm-svn: 128045
2011-03-18Extend live debug values down the dominator tree by following copies.Jakob Stoklund Olesen1-24/+136
The llvm.dbg.value intrinsic refers to SSA values, not virtual registers, so we should be able to extend the range of a value by tracking that value through register copies. This greatly improves the debug value tracking for function arguments that for some reason are copied to a second virtual register at the end of the entry block. We only extend the debug value range where its register is killed. All original llvm.dbg.value locations are still respected. Copies from physical registers are ignored. That should not be a problem since the entry block already adds DBG_VALUE instructions for the virtual registers holding the function arguments. llvm-svn: 127912
2011-02-04DebugLoc associated with a machine instruction is used to emit location ↵Devang Patel1-20/+29
entries. DebugLoc associated with a DBG_VALUE is used to identify lexical scope of the variable. After register allocation, while inserting DBG_VALUE remember original debug location for the first instruction and reuse it, otherwise dwarf writer may be mislead in identifying the variable's scope. llvm-svn: 124845
2011-01-13Better terminator avoidance.Jakob Stoklund Olesen1-9/+3
This approach also works when the terminator doesn't have a slot index. (Which can happen??) llvm-svn: 123413
2011-01-13Temporary workaround for an i386 crash in LiveDebugVariables.Jakob Stoklund Olesen1-1/+2
llvm-svn: 123400
2011-01-12Try again enabling LiveDebugVariables.Jakob Stoklund Olesen1-1/+1
llvm-svn: 123342
2011-01-12Don't emit a DBG_VALUE for a spill slot that the rewriter decided not to use ↵Jakob Stoklund Olesen1-1/+2
after all. llvm-svn: 123339
2011-01-12Fix braino in dominator tree walk.Jakob Stoklund Olesen1-1/+1
llvm-svn: 123338
2011-01-12Sometimes, old virtual registers can linger on DBG_VALUE instructions.Jakob Stoklund Olesen1-1/+2
Make sure we don't crash in that case, but simply turn them into %noreg instead. llvm-svn: 123335
2011-01-11The world is not ready for LiveDebugVariables yet.Jakob Stoklund Olesen1-1/+1
llvm-svn: 123290
2011-01-11Enable LiveDebugVariables by default.Jakob Stoklund Olesen1-1/+1
llvm-svn: 123282
2011-01-11Don't insert DBG_VALUE instructions after the first terminator.Jakob Stoklund Olesen1-0/+7
For one, MachineBasicBlock::getFirstTerminator() doesn't understand what is happening, and it also makes sense to have all control flow run through the DBG_VALUE. llvm-svn: 123277
2011-01-10Simplify a bunch of isVirtualRegister() and isPhysicalRegister() logic.Jakob Stoklund Olesen1-1/+1
These functions not longer assert when passed 0, but simply return false instead. No functional change intended. llvm-svn: 123155
2011-01-09Simplify LiveDebugVariables by storing MachineOperand copies locations insteadJakob Stoklund Olesen1-169/+48
of using a Location class with the same information. When making a copy of a MachineOperand that was already stored in a MachineInstr, it is necessary to clear the parent pointer on the copy. Otherwise the register use-def lists become inconsistent. Add MachineOperand::clearParent() to do that. An alternative would be a custom MachineOperand copy constructor that cleared ParentMI. I didn't want to do that because of the performance impact. llvm-svn: 123109
2011-01-09Replace TargetRegisterInfo::printReg with a PrintReg class that also works ↵Jakob Stoklund Olesen1-6/+1
without a TRI instance. Print virtual registers numbered from 0 instead of the arbitrary FirstVirtualRegister. The first virtual register is printed as %vreg0. TRI::NoRegister is printed as %noreg. llvm-svn: 123107
2011-01-07Speculatively revert r123032.Devang Patel1-0/+6
llvm-svn: 123039
2011-01-07Appropriately truncate debug info range in dwarf output.Devang Patel1-6/+0
Enable live debug variables pass. llvm-svn: 123032
2010-12-03Rename virtRegMap to avoid confusion with the VirtRegMap that it isn't.Jakob Stoklund Olesen1-5/+5
llvm-svn: 120846
2010-12-03Coalesce debug locations when possible, causing less DBG_VALUE instructions toJakob Stoklund Olesen1-2/+34
be emitted. llvm-svn: 120845
2010-12-03Emit DBG_VALUE instructions from LiveDebugVariables.Jakob Stoklund Olesen1-1/+181
llvm-svn: 120842
2010-12-03Also update virtRegMap when renaming virtual registers.Jakob Stoklund Olesen1-1/+11
llvm-svn: 120841
2010-12-02Update LiveDebugVariables during coalescing.Jakob Stoklund Olesen1-0/+49
llvm-svn: 120720
2010-12-02Implement the first half of LiveDebugVariables.Jakob Stoklund Olesen1-2/+505
Scan the MachineFunction for DBG_VALUE instructions, and replace them with a data structure similar to LiveIntervals. The live range of a DBG_VALUE is determined by propagating it down the dominator tree until a new DBG_VALUE is found. When a DBG_VALUE lives in a register, its live range is confined to the live range of the register's value. LiveDebugVariables runs before coalescing, so DBG_VALUEs are not artificially extended when registers are joined. The missing half will recreate DBG_VALUE instructions from the intervals when register allocation is complete. The pass is disabled by default. It can be enabled with the temporary command line option -live-debug-variables. llvm-svn: 120636
2010-11-30Stub out a new LiveDebugVariables pass.Jakob Stoklund Olesen1-0/+50
This analysis is going to run immediately after LiveIntervals. It will stay alive during register allocation and keep track of user variables mentioned in DBG_VALUE instructions. When the register allocator is moving values between registers and the stack, it is very hard to keep track of DBG_VALUE instructions. We usually get it wrong. This analysis maintains a data structure that makes it easy to update DBG_VALUE instructions. llvm-svn: 120385