1 //===-- MachineFunctionAnalysis.cpp ---------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the definitions of the MachineFunctionAnalysis members.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
15 #include "llvm/CodeGen/GCMetadata.h"
16 #include "llvm/CodeGen/MachineFunction.h"
17 #include "llvm/CodeGen/MachineModuleInfo.h"
20 char MachineFunctionAnalysis::ID = 0;
22 MachineFunctionAnalysis::MachineFunctionAnalysis(const TargetMachine &tm) :
23 FunctionPass(ID), TM(tm), MF(0) {
24 initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry());
27 MachineFunctionAnalysis::~MachineFunctionAnalysis() {
29 assert(!MF && "MachineFunctionAnalysis left initialized!");
32 void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
34 AU.addRequired<MachineModuleInfo>();
37 bool MachineFunctionAnalysis::doInitialization(Module &M) {
38 MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
39 assert(MMI && "MMI not around yet??");
46 bool MachineFunctionAnalysis::runOnFunction(Function &F) {
47 assert(!MF && "MachineFunctionAnalysis already initialized!");
48 MF = new MachineFunction(&F, TM, NextFnNum++,
49 getAnalysis<MachineModuleInfo>(),
50 getAnalysisIfAvailable<GCModuleInfo>());
54 void MachineFunctionAnalysis::releaseMemory() {