LLVM  3.7.0
MachineFunctionPass.cpp
Go to the documentation of this file.
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.
11 //
12 //===----------------------------------------------------------------------===//
13 
17 #include "llvm/Analysis/IVUsers.h"
18 #include "llvm/Analysis/LoopInfo.h"
22 #include "llvm/CodeGen/Passes.h"
24 #include "llvm/IR/Dominators.h"
25 #include "llvm/IR/Function.h"
26 using namespace llvm;
27 
28 Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O,
29  const std::string &Banner) const {
30  return createMachineFunctionPrinterPass(O, Banner);
31 }
32 
33 bool MachineFunctionPass::runOnFunction(Function &F) {
34  // Do not codegen any 'available_externally' functions at all, they have
35  // definitions outside the translation unit.
37  return false;
38 
39  MachineFunction &MF = getAnalysis<MachineFunctionAnalysis>().getMF();
40  return runOnMachineFunction(MF);
41 }
42 
46 
47  // MachineFunctionPass preserves all LLVM IR passes, but there's no
48  // high-level way to express this. Instead, just list a bunch of
49  // passes explicitly. This does not include setPreservesCFG,
50  // because CodeGen overloads that to mean preserving the MachineBasicBlock
51  // CFG in addition to the LLVM IR CFG.
55  AU.addPreserved<IVUsers>();
60 
62 }
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:82
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
ScalarEvolution - This class is the main scalar evolution driver.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:78
bool hasAvailableExternallyLinkage() const
Definition: GlobalValue.h:261
F(f)
MachineFunctionAnalysis - This class is a Pass that manages a MachineFunction object.
AnalysisUsage & addRequired()
MemoryDependenceAnalysis - This is an analysis that determines, for a given memory operation...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Represent the analysis usage information of a pass.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
MachineFunctionPass * createMachineFunctionPrinterPass(raw_ostream &OS, const std::string &Banner="")
MachineFunctionPrinter pass - This pass prints out the machine function to the given stream as a debu...
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:38
The legacy pass manager's analysis pass to compute loop information.
Definition: LoopInfo.h:737
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:203