cl::init(false), cl::Hidden,
cl::desc("Surpress slot sharing during stack coloring"));
-static cl::opt<int>
-DeleteLimit("slot-delete-limit", cl::init(-1), cl::Hidden,
- cl::desc("Stack coloring slot deletion limit"));
-
STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring");
namespace {
public:
static char ID; // Pass identification
- StackSlotColoring() : MachineFunctionPass((intptr_t)&ID), NextColor(-1) {}
+ StackSlotColoring() : MachineFunctionPass(&ID), NextColor(-1) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveStacks>();
+ AU.addPreservedID(MachineLoopInfoID);
+ AU.addPreservedID(MachineDominatorsID);
MachineFunctionPass::getAnalysisUsage(AU);
}
int StackSlotColoring::ColorSlot(LiveInterval *li) {
int Color = -1;
bool Share = false;
- if (!DisableSharing &&
- (DeleteLimit == -1 || (int)NumEliminated < DeleteLimit)) {
+ if (!DisableSharing) {
// Check if it's possible to reuse any of the used colors.
Color = UsedColors.find_first();
while (Color != -1) {
// Record the assignment.
Assignments[Color].push_back(li);
int FI = li->getStackSlotIndex();
- DOUT << "Assigning fi #" << FI << " to fi #" << Color << "\n";
+ DOUT << "Assigning fi#" << FI << " to fi#" << Color << "\n";
// Change size and alignment of the allocated slot. If there are multiple
// objects sharing the same slot, then make sure the size and alignment
MachineInstr &MI = *MII;
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI.getOperand(i);
- if (!MO.isFrameIndex())
+ if (!MO.isFI())
continue;
int FI = MO.getIndex();
if (FI < 0)
// Delete unused stack slots.
while (NextColor != -1) {
- DOUT << "Removing unused stack object fi #" << NextColor << "\n";
+ DOUT << "Removing unused stack object fi#" << NextColor << "\n";
MFI->RemoveStackObject(NextColor);
NextColor = AllColors.find_next(NextColor);
}
}
bool StackSlotColoring::runOnMachineFunction(MachineFunction &MF) {
- DOUT << "******** Stack Slot Coloring ********\n";
+ DOUT << "********** Stack Slot Coloring **********\n";
MFI = MF.getFrameInfo();
LS = &getAnalysis<LiveStacks>();