mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +00:00
Fix some kill info update bugs; add hidden option -disable-rematerialization to turn off remat for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41118 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
af11dc00a0
commit
bc165e436b
@ -36,6 +36,12 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
// Hidden options for help debugging.
|
||||||
|
cl::opt<bool> DisableReMat("disable-rematerialization",
|
||||||
|
cl::init(false), cl::Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
STATISTIC(numIntervals, "Number of original intervals");
|
STATISTIC(numIntervals, "Number of original intervals");
|
||||||
STATISTIC(numIntervalsAfter, "Number of intervals after coalescing");
|
STATISTIC(numIntervalsAfter, "Number of intervals after coalescing");
|
||||||
STATISTIC(numFolded , "Number of loads/stores folded into instructions");
|
STATISTIC(numFolded , "Number of loads/stores folded into instructions");
|
||||||
@ -201,6 +207,9 @@ static bool isReDefinedByTwoAddr(MachineInstr *MI, unsigned Reg,
|
|||||||
/// val# of the specified interval is re-materializable.
|
/// val# of the specified interval is re-materializable.
|
||||||
bool LiveIntervals::isReMaterializable(const LiveInterval &li, unsigned ValNum,
|
bool LiveIntervals::isReMaterializable(const LiveInterval &li, unsigned ValNum,
|
||||||
MachineInstr *MI) {
|
MachineInstr *MI) {
|
||||||
|
if (DisableReMat)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (tii_->isTriviallyReMaterializable(MI))
|
if (tii_->isTriviallyReMaterializable(MI))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -610,7 +619,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
|
|||||||
DOUT << " Removing [" << Start << "," << End << "] from: ";
|
DOUT << " Removing [" << Start << "," << End << "] from: ";
|
||||||
interval.print(DOUT, mri_); DOUT << "\n";
|
interval.print(DOUT, mri_); DOUT << "\n";
|
||||||
interval.removeRange(Start, End);
|
interval.removeRange(Start, End);
|
||||||
interval.addKillForValNum(0, Start-1); // odd # means phi node
|
interval.addKillForValNum(0, Start+1); // odd # means phi node
|
||||||
DOUT << " RESULT: "; interval.print(DOUT, mri_);
|
DOUT << " RESULT: "; interval.print(DOUT, mri_);
|
||||||
|
|
||||||
// Replace the interval with one of a NEW value number. Note that this
|
// Replace the interval with one of a NEW value number. Note that this
|
||||||
|
@ -683,6 +683,8 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH
|
|||||||
RHSValNoAssignments[0] = RHSValID;
|
RHSValNoAssignments[0] = RHSValID;
|
||||||
if (RHSVal0DefinedFromLHS != -1) {
|
if (RHSVal0DefinedFromLHS != -1) {
|
||||||
int LHSValId = LHSValNoAssignments[RHSVal0DefinedFromLHS];
|
int LHSValId = LHSValNoAssignments[RHSVal0DefinedFromLHS];
|
||||||
|
unsigned DefIdx = RHS.getDefForValNum(0);
|
||||||
|
LiveInterval::removeKill(ValueNumberInfo[LHSValId], DefIdx);
|
||||||
LHS.addKills(ValueNumberInfo[LHSValId], RHS.getKillsForValNum(0));
|
LHS.addKills(ValueNumberInfo[LHSValId], RHS.getKillsForValNum(0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -797,6 +799,8 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH
|
|||||||
if (LHSValId == -1)
|
if (LHSValId == -1)
|
||||||
continue;
|
continue;
|
||||||
unsigned RHSValId = RHSValNoAssignments[i];
|
unsigned RHSValId = RHSValNoAssignments[i];
|
||||||
|
unsigned DefIdx = RHS.getDefForValNum(i);
|
||||||
|
LiveInterval::removeKill(ValueNumberInfo[RHSValId], DefIdx);
|
||||||
LHS.addKills(ValueNumberInfo[RHSValId], RHS.getKillsForValNum(i));
|
LHS.addKills(ValueNumberInfo[RHSValId], RHS.getKillsForValNum(i));
|
||||||
}
|
}
|
||||||
for (unsigned i = 0, e = LHSValsDefinedFromRHS.size(); i != e; ++i) {
|
for (unsigned i = 0, e = LHSValsDefinedFromRHS.size(); i != e; ++i) {
|
||||||
@ -804,6 +808,8 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH
|
|||||||
if (RHSValId == -1)
|
if (RHSValId == -1)
|
||||||
continue;
|
continue;
|
||||||
unsigned LHSValId = LHSValNoAssignments[i];
|
unsigned LHSValId = LHSValNoAssignments[i];
|
||||||
|
unsigned DefIdx = LHS.getDefForValNum(i);
|
||||||
|
LiveInterval::removeKill(ValueNumberInfo[LHSValId], DefIdx);
|
||||||
RHS.addKills(ValueNumberInfo[LHSValId], LHS.getKillsForValNum(i));
|
RHS.addKills(ValueNumberInfo[LHSValId], LHS.getKillsForValNum(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user