summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineRegisterInfo.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2014-01-02 22:47:22 +0000
committerQuentin Colombet <qcolombet@apple.com>2014-01-02 22:47:22 +0000
commit1fb3362a6ee16954effdc4cd843d7e6449094d48 (patch)
tree097703de851f8d90e4deb8884669ea7c2bf3b641 /llvm/lib/CodeGen/MachineRegisterInfo.cpp
parent34b3475cd318ee3193aea210ad4d88a211106fb8 (diff)
downloadbcm5719-llvm-1fb3362a6ee16954effdc4cd843d7e6449094d48.tar.gz
bcm5719-llvm-1fb3362a6ee16954effdc4cd843d7e6449094d48.zip
[RegAlloc] Make tryInstructionSplit less aggressive.
The greedy register allocator tries to split a live-range around each instruction where it is used or defined to relax the constraints on the entire live-range (this is a last chance split before falling back to spill). The goal is to have a big live-range that is unconstrained (i.e., that can use the largest legal register class) and several small local live-range that carry the constraints implied by each instruction. E.g., Let csti be the constraints on operation i. V1= op1 V1(cst1) op2 V1(cst2) V1 live-range is constrained on the intersection of cst1 and cst2. tryInstructionSplit relaxes those constraints by aggressively splitting each def/use point: V1= V2 = V1 V3 = V2 op1 V3(cst1) V4 = V2 op2 V4(cst2) Because of how the coalescer infrastructure works, each new variable (V3, V4) that is alive at the same time as V1 (or its copy, here V2) interfere with V1. Thus, we end up with an uncoalescable copy for each split point. To make tryInstructionSplit less aggressive, we check if the split point actually relaxes the constraints on the whole live-range. If it does not, we do not insert it. Indeed, it will not help the global allocation problem: - V1 will have the same constraints. - V1 will have the same interference + possibly the newly added split variable VS. - VS will produce an uncoalesceable copy if alive at the same time as V1. <rdar://problem/15570057> llvm-svn: 198369
Diffstat (limited to 'llvm/lib/CodeGen/MachineRegisterInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineRegisterInfo.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
index f8b8796b25f..bf4c23dcf70 100644
--- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
@@ -79,17 +79,9 @@ MachineRegisterInfo::recomputeRegClass(unsigned Reg, const TargetMachine &TM) {
// Accumulate constraints from all uses.
for (reg_nodbg_iterator I = reg_nodbg_begin(Reg), E = reg_nodbg_end(); I != E;
++I) {
- const TargetRegisterClass *OpRC =
- I->getRegClassConstraint(I.getOperandNo(), TII,
- getTargetRegisterInfo());
- if (unsigned SubIdx = I.getOperand().getSubReg()) {
- if (OpRC)
- NewRC = getTargetRegisterInfo()->getMatchingSuperRegClass(NewRC, OpRC,
- SubIdx);
- else
- NewRC = getTargetRegisterInfo()->getSubClassWithSubReg(NewRC, SubIdx);
- } else if (OpRC)
- NewRC = getTargetRegisterInfo()->getCommonSubClass(NewRC, OpRC);
+ // Apply the effect of the given operand to NewRC.
+ NewRC = I->getRegClassConstraintEffect(I.getOperandNo(), NewRC, TII,
+ getTargetRegisterInfo());
if (!NewRC || NewRC == OldRC)
return false;
}
OpenPOWER on IntegriCloud