add a new MCInstPrinter class, move the (trivial) MCDisassmbler ctor inline.
[llvm/avr.git] / lib / CodeGen / MachineFunctionPass.cpp
blob09f156a73fcdba49548f9e2bb92f1e20747f71d5
1 //===-- MachineFunctionPass.cpp -------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the definitions of the MachineFunctionPass members.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Analysis/AliasAnalysis.h"
15 #include "llvm/Analysis/ScalarEvolution.h"
16 #include "llvm/Analysis/IVUsers.h"
17 #include "llvm/Analysis/LiveValues.h"
18 #include "llvm/Analysis/LoopDependenceAnalysis.h"
19 #include "llvm/Analysis/MemoryDependenceAnalysis.h"
20 #include "llvm/CodeGen/MachineFunctionAnalysis.h"
21 #include "llvm/CodeGen/MachineFunctionPass.h"
22 using namespace llvm;
24 bool MachineFunctionPass::runOnFunction(Function &F) {
25 // Do not codegen any 'available_externally' functions at all, they have
26 // definitions outside the translation unit.
27 if (F.hasAvailableExternallyLinkage())
28 return false;
30 MachineFunction &MF = getAnalysis<MachineFunctionAnalysis>().getMF();
31 return runOnMachineFunction(MF);
34 void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const {
35 AU.addRequired<MachineFunctionAnalysis>();
36 AU.addPreserved<MachineFunctionAnalysis>();
38 // MachineFunctionPass preserves all LLVM IR passes, but there's no
39 // high-level way to express this. Instead, just list a bunch of
40 // passes explicitly.
41 AU.addPreserved<AliasAnalysis>();
42 AU.addPreserved<ScalarEvolution>();
43 AU.addPreserved<IVUsers>();
44 AU.addPreserved<LoopDependenceAnalysis>();
45 AU.addPreserved<MemoryDependenceAnalysis>();
46 AU.addPreserved<LiveValues>();
47 AU.addPreserved<DominatorTree>();
48 AU.addPreserved<DominanceFrontier>();
49 AU.addPreserved<LoopInfo>();
51 FunctionPass::getAnalysisUsage(AU);