LLVM API Documentation
00001 //===-- LiveStackAnalysis.cpp - Live Stack Slot Analysis ------------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements the live stack slot analysis pass. It is analogous to 00011 // live interval analysis except it's analyzing liveness of stack slots rather 00012 // than registers. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #define DEBUG_TYPE "livestacks" 00017 #include "llvm/CodeGen/LiveStackAnalysis.h" 00018 #include "llvm/CodeGen/LiveIntervalAnalysis.h" 00019 #include "llvm/CodeGen/Passes.h" 00020 #include "llvm/Target/TargetRegisterInfo.h" 00021 #include "llvm/Support/Debug.h" 00022 #include "llvm/ADT/Statistic.h" 00023 #include <limits> 00024 using namespace llvm; 00025 00026 char LiveStacks::ID = 0; 00027 static RegisterPass<LiveStacks> X("livestacks", "Live Stack Slot Analysis"); 00028 00029 void LiveStacks::scaleNumbering(int factor) { 00030 // Scale the intervals. 00031 for (iterator LI = begin(), LE = end(); LI != LE; ++LI) { 00032 LI->second.scaleNumbering(factor); 00033 } 00034 } 00035 00036 void LiveStacks::getAnalysisUsage(AnalysisUsage &AU) const { 00037 AU.setPreservesAll(); 00038 MachineFunctionPass::getAnalysisUsage(AU); 00039 } 00040 00041 void LiveStacks::releaseMemory() { 00042 // Release VNInfo memroy regions after all VNInfo objects are dtor'd. 00043 VNInfoAllocator.Reset(); 00044 S2IMap.clear(); 00045 S2RCMap.clear(); 00046 } 00047 00048 bool LiveStacks::runOnMachineFunction(MachineFunction &) { 00049 // FIXME: No analysis is being done right now. We are relying on the 00050 // register allocators to provide the information. 00051 return false; 00052 } 00053 00054 /// print - Implement the dump method. 00055 void LiveStacks::print(std::ostream &O, const Module*) const { 00056 O << "********** INTERVALS **********\n"; 00057 for (const_iterator I = begin(), E = end(); I != E; ++I) { 00058 I->second.print(O); 00059 int Slot = I->first; 00060 const TargetRegisterClass *RC = getIntervalRegClass(Slot); 00061 if (RC) 00062 O << " [" << RC->getName() << "]\n"; 00063 else 00064 O << " [Unknown]\n"; 00065 } 00066 }