2008-06-04 09:18:41 +00:00
|
|
|
//===-- LiveStackAnalysis.cpp - Live Stack Slot Analysis ------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the live stack slot analysis pass. It is analogous to
|
|
|
|
// live interval analysis except it's analyzing liveness of stack slots rather
|
|
|
|
// than registers.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "livestacks"
|
|
|
|
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
2009-06-02 16:53:25 +00:00
|
|
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
2008-06-04 09:18:41 +00:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
|
|
|
#include "llvm/Target/TargetRegisterInfo.h"
|
|
|
|
#include "llvm/Support/Debug.h"
|
2009-08-23 03:47:42 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2008-06-04 09:18:41 +00:00
|
|
|
#include "llvm/ADT/Statistic.h"
|
2009-06-02 16:53:25 +00:00
|
|
|
#include <limits>
|
2008-06-04 09:18:41 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
char LiveStacks::ID = 0;
|
2010-07-21 22:09:45 +00:00
|
|
|
INITIALIZE_PASS(LiveStacks, "livestacks",
|
2010-10-07 22:25:06 +00:00
|
|
|
"Live Stack Slot Analysis", false, false)
|
2008-06-04 09:18:41 +00:00
|
|
|
|
|
|
|
void LiveStacks::getAnalysisUsage(AnalysisUsage &AU) const {
|
2008-09-22 22:26:15 +00:00
|
|
|
AU.setPreservesAll();
|
2009-11-03 23:52:08 +00:00
|
|
|
AU.addPreserved<SlotIndexes>();
|
|
|
|
AU.addRequiredTransitive<SlotIndexes>();
|
2008-09-22 20:58:04 +00:00
|
|
|
MachineFunctionPass::getAnalysisUsage(AU);
|
2008-06-04 09:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LiveStacks::releaseMemory() {
|
2010-06-26 11:30:59 +00:00
|
|
|
// Release VNInfo memory regions, VNInfo objects don't need to be dtor'd.
|
|
|
|
VNInfoAllocator.Reset();
|
2009-05-03 18:32:42 +00:00
|
|
|
S2IMap.clear();
|
|
|
|
S2RCMap.clear();
|
2008-06-04 09:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool LiveStacks::runOnMachineFunction(MachineFunction &) {
|
|
|
|
// FIXME: No analysis is being done right now. We are relying on the
|
|
|
|
// register allocators to provide the information.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// print - Implement the dump method.
|
2009-08-23 06:03:38 +00:00
|
|
|
void LiveStacks::print(raw_ostream &OS, const Module*) const {
|
2009-08-23 03:47:42 +00:00
|
|
|
|
|
|
|
OS << "********** INTERVALS **********\n";
|
2008-06-04 09:18:41 +00:00
|
|
|
for (const_iterator I = begin(), E = end(); I != E; ++I) {
|
2009-08-23 03:47:42 +00:00
|
|
|
I->second.print(OS);
|
2009-05-03 18:32:42 +00:00
|
|
|
int Slot = I->first;
|
|
|
|
const TargetRegisterClass *RC = getIntervalRegClass(Slot);
|
|
|
|
if (RC)
|
2009-08-23 03:47:42 +00:00
|
|
|
OS << " [" << RC->getName() << "]\n";
|
2009-05-03 18:32:42 +00:00
|
|
|
else
|
2009-08-23 03:47:42 +00:00
|
|
|
OS << " [Unknown]\n";
|
2008-06-04 09:18:41 +00:00
|
|
|
}
|
|
|
|
}
|