mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
Add a flag to disable the code that looks for allocas which escaped the lifetime regions. This is useful for debugging. No testcase because without this check we fail on assertions when finding escaped allocas.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c4f70d437d
commit
d76f6eadc8
@ -59,12 +59,20 @@ using namespace llvm;
|
|||||||
|
|
||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
DisableColoring("no-stack-coloring",
|
DisableColoring("no-stack-coloring",
|
||||||
cl::init(false), cl::Hidden,
|
cl::init(false), cl::Hidden,
|
||||||
cl::desc("Suppress stack coloring"));
|
cl::desc("Disable stack coloring"));
|
||||||
|
|
||||||
STATISTIC(NumMarkerSeen, "Number of life markers found.");
|
static cl::opt<bool>
|
||||||
|
CheckEscapedAllocas("stack-coloring-check-escaped",
|
||||||
|
cl::init(true), cl::Hidden,
|
||||||
|
cl::desc("Look for allocas which escaped the lifetime region"));
|
||||||
|
|
||||||
|
STATISTIC(NumMarkerSeen, "Number of lifetime markers found.");
|
||||||
STATISTIC(StackSpaceSaved, "Number of bytes saved due to merging slots.");
|
STATISTIC(StackSpaceSaved, "Number of bytes saved due to merging slots.");
|
||||||
STATISTIC(StackSlotMerged, "Number of stack slot merged.");
|
STATISTIC(StackSlotMerged, "Number of stack slot merged.");
|
||||||
|
STATISTIC(EscapedAllocas,
|
||||||
|
"Number of allocas that escaped the lifetime region");
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// StackColoring Pass
|
// StackColoring Pass
|
||||||
@ -104,7 +112,7 @@ class StackColoring : public MachineFunctionPass {
|
|||||||
/// VNInfo is used for the construction of LiveIntervals.
|
/// VNInfo is used for the construction of LiveIntervals.
|
||||||
VNInfo::Allocator VNInfoAllocator;
|
VNInfo::Allocator VNInfoAllocator;
|
||||||
/// SlotIndex analysis object.
|
/// SlotIndex analysis object.
|
||||||
SlotIndexes* Indexes;
|
SlotIndexes *Indexes;
|
||||||
|
|
||||||
/// The list of lifetime markers found. These markers are to be removed
|
/// The list of lifetime markers found. These markers are to be removed
|
||||||
/// once the coloring is done.
|
/// once the coloring is done.
|
||||||
@ -533,7 +541,7 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (!I->isDebugValue()) {
|
if (!I->isDebugValue()) {
|
||||||
SlotIndex Index = Indexes->getInstructionIndex(I);
|
SlotIndex Index = Indexes->getInstructionIndex(I);
|
||||||
LiveInterval* Interval = Intervals[FromSlot];
|
LiveInterval *Interval = Intervals[FromSlot];
|
||||||
assert(Interval->find(Index) != Interval->end() &&
|
assert(Interval->find(Index) != Interval->end() &&
|
||||||
"Found instruction usage outside of live range.");
|
"Found instruction usage outside of live range.");
|
||||||
}
|
}
|
||||||
@ -583,6 +591,7 @@ void StackColoring::removeInvalidSlotRanges() {
|
|||||||
if (Interval->find(Index) == Interval->end()) {
|
if (Interval->find(Index) == Interval->end()) {
|
||||||
Intervals[Slot]->clear();
|
Intervals[Slot]->clear();
|
||||||
DEBUG(dbgs()<<"Invalidating range #"<<Slot<<"\n");
|
DEBUG(dbgs()<<"Invalidating range #"<<Slot<<"\n");
|
||||||
|
EscapedAllocas++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -662,7 +671,10 @@ bool StackColoring::runOnMachineFunction(MachineFunction &Func) {
|
|||||||
// Propagate the liveness information.
|
// Propagate the liveness information.
|
||||||
calculateLiveIntervals(NumSlots);
|
calculateLiveIntervals(NumSlots);
|
||||||
|
|
||||||
removeInvalidSlotRanges();
|
// Search for allocas which are used outside of the declared lifetime
|
||||||
|
// markers.
|
||||||
|
if (CheckEscapedAllocas)
|
||||||
|
removeInvalidSlotRanges();
|
||||||
|
|
||||||
// Maps old slots to new slots.
|
// Maps old slots to new slots.
|
||||||
DenseMap<int, int> SlotRemap;
|
DenseMap<int, int> SlotRemap;
|
||||||
|
Loading…
Reference in New Issue
Block a user