summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineFunctionAnalysis.h
blob: d020a7b4c73b19873969803199a47634e5671d3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//===-- MachineFunctionAnalysis.h - Owner of MachineFunctions ----*-C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the MachineFunctionAnalysis class.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_MACHINE_FUNCTION_ANALYSIS_H
#define LLVM_CODEGEN_MACHINE_FUNCTION_ANALYSIS_H

#include "llvm/Pass.h"
#include "llvm/Target/TargetMachine.h"

namespace llvm {

class MachineFunction;

/// MachineFunctionAnalysis - This class is a Pass that manages a
/// MachineFunction object.
struct MachineFunctionAnalysis : public FunctionPass {
private:
  const TargetMachine &TM;
  CodeGenOpt::Level OptLevel;
  MachineFunction *MF;

public:
  static char ID;
  explicit MachineFunctionAnalysis(TargetMachine &tm,
                                   CodeGenOpt::Level OL = CodeGenOpt::Default);
  ~MachineFunctionAnalysis();

  MachineFunction &getMF() const { return *MF; }
  CodeGenOpt::Level getOptLevel() const { return OptLevel; }

private:
  virtual bool runOnFunction(Function &F);
  virtual void releaseMemory();
  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
};

} // End llvm namespace

#endif