003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/Transforms/Scalar
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
Transforms
/
Scalar
/
📁
..
📄
ADCE.h
(1.38 KB)
📄
AlignmentFromAssumptions.h
(1.6 KB)
📄
BDCE.h
(1.04 KB)
📄
CallSiteSplitting.h
(810 B)
📄
ConstantHoisting.h
(8.02 KB)
📄
CorrelatedValuePropagation.h
(810 B)
📄
DCE.h
(892 B)
📄
DeadStoreElimination.h
(1.2 KB)
📄
DivRemPairs.h
(1.01 KB)
📄
EarlyCSE.h
(1.41 KB)
📄
Float2Int.h
(1.74 KB)
📄
GVN.h
(12.57 KB)
📄
GVNExpression.h
(20.21 KB)
📄
GuardWidening.h
(1.18 KB)
📄
IVUsersPrinter.h
(960 B)
📄
IndVarSimplify.h
(1.03 KB)
📄
InductiveRangeCheckElimination.h
(950 B)
📄
InstSimplifyPass.h
(1.64 KB)
📄
JumpThreading.h
(6.55 KB)
📄
LICM.h
(2.78 KB)
📄
LoopAccessAnalysisPrinter.h
(999 B)
📄
LoopDataPrefetch.h
(1.06 KB)
📄
LoopDeletion.h
(1.13 KB)
📄
LoopDistribute.h
(1.08 KB)
📄
LoopFuse.h
(876 B)
📄
LoopIdiomRecognize.h
(1.18 KB)
📄
LoopInstSimplify.h
(1.07 KB)
📄
LoopLoadElimination.h
(1.1 KB)
📄
LoopPassManager.h
(15.85 KB)
📄
LoopPredication.h
(1.12 KB)
📄
LoopRotation.h
(1.13 KB)
📄
LoopSimplifyCFG.h
(1.31 KB)
📄
LoopSink.h
(1.54 KB)
📄
LoopStrengthReduce.h
(1.52 KB)
📄
LoopUnrollAndJamPass.h
(921 B)
📄
LoopUnrollPass.h
(4.97 KB)
📄
LowerAtomic.h
(974 B)
📄
LowerConstantIntrinsics.h
(1.4 KB)
📄
LowerExpectIntrinsic.h
(1.25 KB)
📄
LowerGuardIntrinsic.h
(992 B)
📄
LowerMatrixIntrinsics.h
(868 B)
📄
LowerWidenableCondition.h
(937 B)
📄
MakeGuardsExplicit.h
(1.85 KB)
📄
MemCpyOptimizer.h
(2.71 KB)
📄
MergeICmps.h
(714 B)
📄
MergedLoadStoreMotion.h
(2.02 KB)
📄
NaryReassociate.h
(6.98 KB)
📄
NewGVN.h
(935 B)
📄
PartiallyInlineLibCalls.h
(1.04 KB)
📄
Reassociate.h
(4.6 KB)
📄
RewriteStatepointsForGC.h
(1.27 KB)
📄
SCCP.h
(1.81 KB)
📄
SROA.h
(5.29 KB)
📄
Scalarizer.h
(1.18 KB)
📄
SimpleLoopUnswitch.h
(3.35 KB)
📄
SimplifyCFG.h
(2.01 KB)
📄
Sink.h
(998 B)
📄
SpeculateAroundPHIs.h
(3.69 KB)
📄
SpeculativeExecution.h
(3.04 KB)
📄
TailRecursionElimination.h
(3.3 KB)
📄
WarnMissedTransforms.h
(1.19 KB)
Editing: SROA.h
//===- SROA.h - Scalar Replacement Of Aggregates ----------------*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// /// \file /// This file provides the interface for LLVM's Scalar Replacement of /// Aggregates pass. This pass provides both aggregate splitting and the /// primary SSA formation used in the compiler. /// //===----------------------------------------------------------------------===// #ifndef LLVM_TRANSFORMS_SCALAR_SROA_H #define LLVM_TRANSFORMS_SCALAR_SROA_H #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallVector.h" #include "llvm/IR/PassManager.h" #include <vector> namespace llvm { class AllocaInst; class AssumptionCache; class DominatorTree; class Function; class Instruction; class LLVMContext; class PHINode; class SelectInst; class Use; /// A private "module" namespace for types and utilities used by SROA. These /// are implementation details and should not be used by clients. namespace sroa LLVM_LIBRARY_VISIBILITY { class AllocaSliceRewriter; class AllocaSlices; class Partition; class SROALegacyPass; } // end namespace sroa /// An optimization pass providing Scalar Replacement of Aggregates. /// /// This pass takes allocations which can be completely analyzed (that is, they /// don't escape) and tries to turn them into scalar SSA values. There are /// a few steps to this process. /// /// 1) It takes allocations of aggregates and analyzes the ways in which they /// are used to try to split them into smaller allocations, ideally of /// a single scalar data type. It will split up memcpy and memset accesses /// as necessary and try to isolate individual scalar accesses. /// 2) It will transform accesses into forms which are suitable for SSA value /// promotion. This can be replacing a memset with a scalar store of an /// integer value, or it can involve speculating operations on a PHI or /// select to be a PHI or select of the results. /// 3) Finally, this will try to detect a pattern of accesses which map cleanly /// onto insert and extract operations on a vector value, and convert them to /// this form. By doing so, it will enable promotion of vector aggregates to /// SSA vector values. class SROA : public PassInfoMixin<SROA> { LLVMContext *C = nullptr; DominatorTree *DT = nullptr; AssumptionCache *AC = nullptr; /// Worklist of alloca instructions to simplify. /// /// Each alloca in the function is added to this. Each new alloca formed gets /// added to it as well to recursively simplify unless that alloca can be /// directly promoted. Finally, each time we rewrite a use of an alloca other /// the one being actively rewritten, we add it back onto the list if not /// already present to ensure it is re-visited. SetVector<AllocaInst *, SmallVector<AllocaInst *, 16>> Worklist; /// A collection of instructions to delete. /// We try to batch deletions to simplify code and make things a bit more /// efficient. SetVector<Instruction *, SmallVector<Instruction *, 8>> DeadInsts; /// Post-promotion worklist. /// /// Sometimes we discover an alloca which has a high probability of becoming /// viable for SROA after a round of promotion takes place. In those cases, /// the alloca is enqueued here for re-processing. /// /// Note that we have to be very careful to clear allocas out of this list in /// the event they are deleted. SetVector<AllocaInst *, SmallVector<AllocaInst *, 16>> PostPromotionWorklist; /// A collection of alloca instructions we can directly promote. std::vector<AllocaInst *> PromotableAllocas; /// A worklist of PHIs to speculate prior to promoting allocas. /// /// All of these PHIs have been checked for the safety of speculation and by /// being speculated will allow promoting allocas currently in the promotable /// queue. SetVector<PHINode *, SmallVector<PHINode *, 2>> SpeculatablePHIs; /// A worklist of select instructions to speculate prior to promoting /// allocas. /// /// All of these select instructions have been checked for the safety of /// speculation and by being speculated will allow promoting allocas /// currently in the promotable queue. SetVector<SelectInst *, SmallVector<SelectInst *, 2>> SpeculatableSelects; public: SROA() = default; /// Run the pass over the function. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); private: friend class sroa::AllocaSliceRewriter; friend class sroa::SROALegacyPass; /// Helper used by both the public run method and by the legacy pass. PreservedAnalyses runImpl(Function &F, DominatorTree &RunDT, AssumptionCache &RunAC); bool presplitLoadsAndStores(AllocaInst &AI, sroa::AllocaSlices &AS); AllocaInst *rewritePartition(AllocaInst &AI, sroa::AllocaSlices &AS, sroa::Partition &P); bool splitAlloca(AllocaInst &AI, sroa::AllocaSlices &AS); bool runOnAlloca(AllocaInst &AI); void clobberUse(Use &U); bool deleteDeadInstructions(SmallPtrSetImpl<AllocaInst *> &DeletedAllocas); bool promoteAllocas(Function &F); }; } // end namespace llvm #endif // LLVM_TRANSFORMS_SCALAR_SROA_H
Upload File
Create Folder