LLVM  7.0.0svn
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 //===----------------------------------------------------------------------===//
19 #include "llvm/Analysis/IVUsers.h"
20 #include "llvm/Analysis/LoopInfo.h"
26 #include "llvm/CodeGen/Passes.h"
27 #include "llvm/IR/Dominators.h"
28 #include "llvm/IR/Function.h"
30 using namespace llvm;
32 Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O,
33  const std::string &Banner) const {
34  return createMachineFunctionPrinterPass(O, Banner);
35 }
38  // Do not codegen any 'available_externally' functions at all, they have
39  // definitions outside the translation unit.
41  return false;
43  MachineModuleInfo &MMI = getAnalysis<MachineModuleInfo>();
46  MachineFunctionProperties &MFProps = MF.getProperties();
48 #ifndef NDEBUG
49  if (!MFProps.verifyRequiredProperties(RequiredProperties)) {
50  errs() << "MachineFunctionProperties required by " << getPassName()
51  << " pass are not met by function " << F.getName() << ".\n"
52  << "Required properties: ";
53  RequiredProperties.print(errs());
54  errs() << "\nCurrent properties: ";
55  MFProps.print(errs());
56  errs() << "\n";
57  llvm_unreachable("MachineFunctionProperties check failed");
58  }
59 #endif
61  bool RV = runOnMachineFunction(MF);
63  MFProps.set(SetProperties);
64  MFProps.reset(ClearedProperties);
65  return RV;
66 }
72  // MachineFunctionPass preserves all LLVM IR passes, but there's no
73  // high-level way to express this. Instead, just list a bunch of
74  // passes explicitly. This does not include setPreservesCFG,
75  // because CodeGen overloads that to mean preserving the MachineBasicBlock
76  // CFG in addition to the LLVM IR CFG.
89 }
Legacy wrapper pass to provide the GlobalsAAResult object.
Pass interface - Implemented by all &#39;passes&#39;.
Definition: Pass.h:81
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
MachineFunctionProperties & reset(Property P)
This is the interface for a simple mod/ref and alias analysis over globals.
bool hasAvailableExternallyLinkage() const
Definition: GlobalValue.h:422
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Definition: Pass.cpp:75
AnalysisUsage & addRequired()
void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
This is the interface for a SCEV-based alias analysis.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:92
static bool runOnFunction(Function &F, bool PostInlining)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
Represent the analysis usage information of a pass.
MachineFunction & getOrCreateMachineFunction(const Function &F)
Returns the MachineFunction constructed for the IR function F.
A wrapper analysis pass for the legacy pass manager that exposes a MemoryDepnedenceResults instance...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Legacy wrapper pass to provide the SCEVAAResult object.
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...
MachineFunctionProperties & set(Property P)
StringRef getName() const
Return a constant reference to the value&#39;s name.
Definition: Value.cpp:224
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
The legacy pass manager&#39;s analysis pass to compute loop information.
Definition: LoopInfo.h:964
This is the interface for LLVM&#39;s primary stateless and local alias analysis.
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:254
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
Properties which a MachineFunction may have at a given point in time.
This class contains meta information specific to a module.
Legacy wrapper pass to provide the BasicAAResult object.