003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/lib/Transforms/IPO
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
lib
/
Transforms
/
IPO
/
📁
..
📄
AlwaysInliner.cpp
(6.51 KB)
📄
ArgumentPromotion.cpp
(44.76 KB)
📄
Attributor.cpp
(81.04 KB)
📄
AttributorAttributes.cpp
(269.7 KB)
📄
BarrierNoopPass.cpp
(1.67 KB)
📄
BlockExtractor.cpp
(8.17 KB)
📄
CalledValuePropagation.cpp
(17.71 KB)
📄
ConstantMerge.cpp
(9.59 KB)
📄
CrossDSOCFI.cpp
(5.98 KB)
📄
DeadArgumentElimination.cpp
(42.84 KB)
📄
ElimAvailExtern.cpp
(3.14 KB)
📄
ExtractGV.cpp
(5.2 KB)
📄
ForceFunctionAttrs.cpp
(4.79 KB)
📄
FunctionAttrs.cpp
(55.56 KB)
📄
FunctionImport.cpp
(55.28 KB)
📄
GlobalDCE.cpp
(15.55 KB)
📄
GlobalOpt.cpp
(119.78 KB)
📄
GlobalSplit.cpp
(6.92 KB)
📄
HotColdSplitting.cpp
(26.27 KB)
📄
IPConstantPropagation.cpp
(10.68 KB)
📄
IPO.cpp
(4.94 KB)
📄
InferFunctionAttrs.cpp
(2.89 KB)
📄
InlineSimple.cpp
(4.21 KB)
📄
Inliner.cpp
(44.77 KB)
📄
Internalize.cpp
(9.52 KB)
📄
LoopExtractor.cpp
(7.14 KB)
📄
LowerTypeTests.cpp
(83.98 KB)
📄
MergeFunctions.cpp
(34.12 KB)
📄
OpenMPOpt.cpp
(52.75 KB)
📄
PartialInlining.cpp
(55.67 KB)
📄
PassManagerBuilder.cpp
(49.21 KB)
📄
PruneEH.cpp
(9.54 KB)
📄
SCCP.cpp
(3.22 KB)
📄
SampleProfile.cpp
(77.15 KB)
📄
StripDeadPrototypes.cpp
(2.73 KB)
📄
StripSymbols.cpp
(11.7 KB)
📄
SyntheticCountsPropagation.cpp
(5.64 KB)
📄
ThinLTOBitcodeWriter.cpp
(20.16 KB)
📄
WholeProgramDevirt.cpp
(85.02 KB)
Editing: InferFunctionAttrs.cpp
//===- InferFunctionAttrs.cpp - Infer implicit function attributes --------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/Transforms/IPO/InferFunctionAttrs.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/Function.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/InitializePasses.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BuildLibCalls.h" using namespace llvm; #define DEBUG_TYPE "inferattrs" static bool inferAllPrototypeAttributes( Module &M, function_ref<TargetLibraryInfo &(Function &)> GetTLI) { bool Changed = false; for (Function &F : M.functions()) // We only infer things using the prototype and the name; we don't need // definitions. if (F.isDeclaration() && !F.hasOptNone()) Changed |= inferLibFuncAttributes(F, GetTLI(F)); return Changed; } PreservedAnalyses InferFunctionAttrsPass::run(Module &M, ModuleAnalysisManager &AM) { FunctionAnalysisManager &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager(); auto GetTLI = [&FAM](Function &F) -> TargetLibraryInfo & { return FAM.getResult<TargetLibraryAnalysis>(F); }; if (!inferAllPrototypeAttributes(M, GetTLI)) // If we didn't infer anything, preserve all analyses. return PreservedAnalyses::all(); // Otherwise, we may have changed fundamental function attributes, so clear // out all the passes. return PreservedAnalyses::none(); } namespace { struct InferFunctionAttrsLegacyPass : public ModulePass { static char ID; // Pass identification, replacement for typeid InferFunctionAttrsLegacyPass() : ModulePass(ID) { initializeInferFunctionAttrsLegacyPassPass( *PassRegistry::getPassRegistry()); } void getAnalysisUsage(AnalysisUsage &AU) const override { AU.addRequired<TargetLibraryInfoWrapperPass>(); } bool runOnModule(Module &M) override { if (skipModule(M)) return false; auto GetTLI = [this](Function &F) -> TargetLibraryInfo & { return this->getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); }; return inferAllPrototypeAttributes(M, GetTLI); } }; } char InferFunctionAttrsLegacyPass::ID = 0; INITIALIZE_PASS_BEGIN(InferFunctionAttrsLegacyPass, "inferattrs", "Infer set function attributes", false, false) INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) INITIALIZE_PASS_END(InferFunctionAttrsLegacyPass, "inferattrs", "Infer set function attributes", false, false) Pass *llvm::createInferFunctionAttrsLegacyPass() { return new InferFunctionAttrsLegacyPass(); }
Upload File
Create Folder