Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/MachineFunctionPass.cpp
Show All 35 Lines | |||||
} | } | ||||
bool MachineFunctionPass::runOnFunction(Function &F) { | bool MachineFunctionPass::runOnFunction(Function &F) { | ||||
// Do not codegen any 'available_externally' functions at all, they have | // Do not codegen any 'available_externally' functions at all, they have | ||||
// definitions outside the translation unit. | // definitions outside the translation unit. | ||||
if (F.hasAvailableExternallyLinkage()) | if (F.hasAvailableExternallyLinkage()) | ||||
return false; | return false; | ||||
MachineModuleInfo &MMI = getAnalysis<MachineModuleInfo>(); | MachineModuleInfo &MMI = getAnalysis<MachineModuleInfoWrapperPass>().getMMI(); | ||||
MachineFunction &MF = MMI.getOrCreateMachineFunction(F); | MachineFunction &MF = MMI.getOrCreateMachineFunction(F); | ||||
MachineFunctionProperties &MFProps = MF.getProperties(); | MachineFunctionProperties &MFProps = MF.getProperties(); | ||||
#ifndef NDEBUG | #ifndef NDEBUG | ||||
if (!MFProps.verifyRequiredProperties(RequiredProperties)) { | if (!MFProps.verifyRequiredProperties(RequiredProperties)) { | ||||
errs() << "MachineFunctionProperties required by " << getPassName() | errs() << "MachineFunctionProperties required by " << getPassName() | ||||
<< " pass are not met by function " << F.getName() << ".\n" | << " pass are not met by function " << F.getName() << ".\n" | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
MFProps.set(SetProperties); | MFProps.set(SetProperties); | ||||
MFProps.reset(ClearedProperties); | MFProps.reset(ClearedProperties); | ||||
return RV; | return RV; | ||||
} | } | ||||
void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const { | void MachineFunctionPass::getAnalysisUsage(AnalysisUsage &AU) const { | ||||
AU.addRequired<MachineModuleInfo>(); | AU.addRequired<MachineModuleInfoWrapperPass>(); | ||||
AU.addPreserved<MachineModuleInfo>(); | AU.addPreserved<MachineModuleInfoWrapperPass>(); | ||||
// MachineFunctionPass preserves all LLVM IR passes, but there's no | // MachineFunctionPass preserves all LLVM IR passes, but there's no | ||||
// high-level way to express this. Instead, just list a bunch of | // high-level way to express this. Instead, just list a bunch of | ||||
// passes explicitly. This does not include setPreservesCFG, | // passes explicitly. This does not include setPreservesCFG, | ||||
// because CodeGen overloads that to mean preserving the MachineBasicBlock | // because CodeGen overloads that to mean preserving the MachineBasicBlock | ||||
// CFG in addition to the LLVM IR CFG. | // CFG in addition to the LLVM IR CFG. | ||||
AU.addPreserved<BasicAAWrapperPass>(); | AU.addPreserved<BasicAAWrapperPass>(); | ||||
AU.addPreserved<DominanceFrontierWrapperPass>(); | AU.addPreserved<DominanceFrontierWrapperPass>(); | ||||
Show All 11 Lines |