LLVM API Documentation

MachineFunctionAnalysis.cpp

Go to the documentation of this file.
00001 //===-- MachineFunctionAnalysis.cpp ---------------------------------------===//
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 contains the definitions of the MachineFunctionAnalysis members.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
00015 #include "llvm/CodeGen/MachineFunction.h"
00016 using namespace llvm;
00017 
00018 // Register this pass with PassInfo directly to avoid having to define
00019 // a default constructor.
00020 static PassInfo
00021 X("Machine Function Analysis", "machine-function-analysis",
00022   intptr_t(&MachineFunctionAnalysis::ID), 0,
00023   /*CFGOnly=*/false, /*is_analysis=*/true);
00024 
00025 char MachineFunctionAnalysis::ID = 0;
00026 
00027 MachineFunctionAnalysis::MachineFunctionAnalysis(TargetMachine &tm,
00028                                                  CodeGenOpt::Level OL) :
00029   FunctionPass(&ID), TM(tm), OptLevel(OL), MF(0) {
00030 }
00031 
00032 MachineFunctionAnalysis::~MachineFunctionAnalysis() {
00033   assert(!MF && "MachineFunctionAnalysis left initialized!");
00034 }
00035 
00036 bool MachineFunctionAnalysis::runOnFunction(Function &F) {
00037   assert(!MF && "MachineFunctionAnalysis already initialized!");
00038   MF = new MachineFunction(&F, TM);
00039   return false;
00040 }
00041 
00042 void MachineFunctionAnalysis::releaseMemory() {
00043   delete MF;
00044   MF = 0;
00045 }
00046 
00047 void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
00048   AU.setPreservesAll();
00049 }