mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Markers are always eliminated before -O passes. At -Onone, markers can be enabled via command line for all -Onone passes.
275 lines
12 KiB
C++
275 lines
12 KiB
C++
//===--- Passes.def - Swift SILPass Metaprogramming -------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines macros used for macro-metaprogramming with SILPasses.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// PASS(Id, Tag, Name)
|
|
/// Id is a pass "identifier", used for its enum case, PassKind::Id,
|
|
/// and type name, as returned by the global function swift::create##Id().
|
|
///
|
|
/// Tag identifies the pass as a command-line compatible option string.
|
|
///
|
|
/// Name is the descriptive, human readable pass name.
|
|
///
|
|
/// All three if these fields are unique identifiers which may be used in test
|
|
/// cases and tools to specify a pass by string. Different tools simply prefer
|
|
/// different identifier formats. Changing any of one these strings may change
|
|
/// the functionality of some tests.
|
|
///
|
|
/// This macro must be defined by the includer.
|
|
#ifndef PASS
|
|
#error "Macro must be defined by includer"
|
|
#endif
|
|
|
|
/// IRGEN_PASS(Id, Tag, Name)
|
|
/// This macro follows the same conventions as PASS(Id, Tag, Name),
|
|
/// but is used for IRGen passes which are built outside of the
|
|
/// SILOptimizer library.
|
|
///
|
|
/// An IRGen pass is created by IRGen and needs to be registered with the pass
|
|
/// manager dynamically.
|
|
#ifndef IRGEN_PASS
|
|
#define IRGEN_PASS(Id, Tag, Name) PASS(Id, Tag, Name)
|
|
#endif
|
|
|
|
/// PASS_RANGE(RANGE_ID, START, END)
|
|
/// Pass IDs between PassKind::START and PassKind::END, inclusive,
|
|
/// fall within the set known as
|
|
#ifndef PASS_RANGE
|
|
#define PASS_RANGE(Id, First, Last)
|
|
#endif
|
|
|
|
PASS(AADumper, "aa-dump",
|
|
"Dump Alias Analysis over all Pairs")
|
|
PASS(ABCOpt, "abcopts",
|
|
"Array Bounds Check Optimization")
|
|
PASS(AccessEnforcementSelection, "access-enforcement-selection",
|
|
"Access Enforcement Selection")
|
|
PASS(InactiveAccessMarkerElimination, "inactive-access-marker-elim",
|
|
"Inactive Access Marker Elimination.")
|
|
PASS(FullAccessMarkerElimination, "full-access-marker-elim",
|
|
"Full Access Marker Elimination.")
|
|
PASS(AddressLowering, "address-lowering",
|
|
"SIL Address Lowering")
|
|
PASS(AllocBoxToStack, "allocbox-to-stack",
|
|
"Stack Promotion of Box Objects")
|
|
IRGEN_PASS(AllocStackHoisting, "alloc-stack-hoisting",
|
|
"SIL alloc_stack Hoisting")
|
|
PASS(ArrayCountPropagation, "array-count-propagation",
|
|
"Array Count Propagation")
|
|
PASS(ArrayElementPropagation, "array-element-propagation",
|
|
"Array Element Propagation")
|
|
PASS(AssumeSingleThreaded, "sil-assume-single-threaded",
|
|
"Assume Single-Threaded Environment")
|
|
PASS(BasicInstructionPropertyDumper, "basic-instruction-property-dump",
|
|
"Print SIL Instruction MemBehavior and ReleaseBehavior Information")
|
|
PASS(BasicCalleePrinter, "basic-callee-printer",
|
|
"Print Basic Callee Analysis for Testing")
|
|
PASS(CFGPrinter, "view-cfg",
|
|
"View Function CFGs")
|
|
PASS(COWArrayOpts, "cowarray-opt",
|
|
"COW Array Optimization")
|
|
PASS(CSE, "cse",
|
|
"Common Subexpression Elimination")
|
|
PASS(CallerAnalysisPrinter, "caller-analysis-printer",
|
|
"Print Caller Analysis for Testing")
|
|
PASS(CapturePromotion, "capture-promotion",
|
|
"Capture Promotion to Eliminate Escaping Boxes")
|
|
PASS(CapturePropagation, "capture-prop",
|
|
"Captured Constant Propagation")
|
|
PASS(ClosureSpecializer, "closure-specialize",
|
|
"Closure Specialization on Constant Function Arguments")
|
|
PASS(CodeSinking, "code-sinking",
|
|
"Code Sinking")
|
|
PASS(ComputeDominanceInfo, "compute-dominance-info",
|
|
"Compute Dominance Information for Testing")
|
|
PASS(ComputeLoopInfo, "compute-loop-info",
|
|
"Compute Loop Information for Testing")
|
|
PASS(ConditionForwarding, "condition-forwarding",
|
|
"Conditional Branch Forwarding to Fold SIL switch_enum")
|
|
PASS(CopyForwarding, "copy-forwarding",
|
|
"Copy Forwarding to Remove Redundant Copies")
|
|
PASS(EpilogueARCMatcherDumper, "sil-epilogue-arc-dumper",
|
|
"Print Epilogue retains of Returned Values and Argument releases")
|
|
PASS(EpilogueRetainReleaseMatcherDumper, "sil-epilogue-retain-release-dumper",
|
|
"Print Epilogue retains of Returned Values and Argument releases")
|
|
PASS(RedundantOverflowCheckRemoval, "remove-redundant-overflow-checks",
|
|
"Redundant Overflow Check Removal")
|
|
PASS(DCE, "dce",
|
|
"Dead Code Elimination")
|
|
PASS(DeadArgSignatureOpt, "dead-arg-signature-opt",
|
|
"Dead Argument Elimination via Function Specialization")
|
|
PASS(DeadFunctionElimination, "sil-deadfuncelim",
|
|
"Dead Function Elimination")
|
|
PASS(DeadObjectElimination, "deadobject-elim",
|
|
"Dead Object Elimination for Classes with Trivial Destruction")
|
|
PASS(DefiniteInitialization, "definite-init",
|
|
"Definite Initialization for Diagnostics")
|
|
PASS(Devirtualizer, "devirtualizer",
|
|
"Indirect Call Devirtualization")
|
|
PASS(DiagnoseStaticExclusivity, "diagnose-static-exclusivity",
|
|
"Static Enforcement of Law of Exclusivity")
|
|
PASS(DiagnoseUnreachable, "diagnose-unreachable",
|
|
"Diagnose Unreachable Code")
|
|
PASS(DiagnosticConstantPropagation, "diagnostic-constant-propagation",
|
|
"Constants Propagation for Diagnostics")
|
|
PASS(EagerSpecializer, "eager-specializer",
|
|
"Eager Specialization via @_specialize")
|
|
PASS(EarlyCodeMotion, "early-codemotion",
|
|
"Early Code Motion without Release Hoisting")
|
|
PASS(EarlyInliner, "early-inline",
|
|
"Early Inlining Preserving Semantic Functions")
|
|
PASS(EmitDFDiagnostics, "dataflow-diagnostics",
|
|
"Emit SIL Diagnostics")
|
|
PASS(EscapeAnalysisDumper, "escapes-dump",
|
|
"Dump Escape Analysis Results")
|
|
PASS(ExternalDefsToDecls, "external-defs-to-decls",
|
|
"External Definition To Declaration Conversion")
|
|
PASS(ExternalFunctionDefinitionsElimination, "external-func-definition-elim",
|
|
"External Function Definition Elimination")
|
|
PASS(FunctionOrderPrinter, "function-order-printer",
|
|
"Print Function Order for Testing")
|
|
PASS(FunctionSignatureOpts, "function-signature-opts",
|
|
"Function Signature Optimization")
|
|
PASS(ARCSequenceOpts, "arc-sequence-opts",
|
|
"ARC Sequence Optimization")
|
|
PASS(ARCLoopOpts, "arc-loop-opts",
|
|
"ARC Loop Optimization")
|
|
PASS(RedundantLoadElimination, "redundant-load-elim",
|
|
"Redundant Load Elimination")
|
|
PASS(DeadStoreElimination, "dead-store-elim",
|
|
"Dead Store Elimination")
|
|
PASS(GenericSpecializer, "generic-specializer",
|
|
"Generic Function Specialization on Static Types")
|
|
PASS(GlobalOpt, "global-opt",
|
|
"SIL Global Optimization")
|
|
PASS(GlobalPropertyOpt, "global-property-opt",
|
|
"Global Property Optimization")
|
|
PASS(GuaranteedARCOpts, "guaranteed-arc-opts",
|
|
"Guaranteed ARC Optimization")
|
|
PASS(HighLevelCSE, "high-level-cse",
|
|
"Common Subexpression Elimination on High-Level SIL")
|
|
PASS(HighLevelLICM, "high-level-licm",
|
|
"Loop Invariant Code Motion in High-Level SIL")
|
|
PASS(IVInfoPrinter, "iv-info-printer",
|
|
"Print Induction Variable Information for Testing")
|
|
PASS(InstCount, "inst-count",
|
|
"Record SIL Instruction, Block, and Function Counts as LLVM Statistics")
|
|
PASS(JumpThreadSimplifyCFG, "simplify-cfg",
|
|
"Simplify CFG via Jump Threading")
|
|
PASS(LetPropertiesOpt, "let-properties-opt",
|
|
"Let Property Optimization")
|
|
PASS(LICM, "licm",
|
|
"Loop Invariant Code Motion")
|
|
PASS(LateCodeMotion, "late-codemotion",
|
|
"Late Code Motion with Release Hoisting")
|
|
PASS(LateInliner, "late-inline",
|
|
"Late Function Inlining")
|
|
PASS(LoopCanonicalizer, "loop-canonicalizer",
|
|
"Loop Canonicalization")
|
|
PASS(LoopInfoPrinter, "loop-info-printer",
|
|
"Print Loop Information for Testing")
|
|
PASS(LoopRegionViewText, "loop-region-view-text",
|
|
"Print Loop Region Information for Testing")
|
|
PASS(LoopRegionViewCFG, "loop-region-view-cfg",
|
|
"View Loop Region CFG")
|
|
PASS(LoopRotate, "loop-rotate",
|
|
"Loop Rotation")
|
|
PASS(LoopUnroll, "loop-unroll",
|
|
"Loop Unrolling")
|
|
PASS(LowerAggregateInstrs, "lower-aggregate-instrs",
|
|
"Lower Aggregate SIL Instructions to Multiple Scalar Operations")
|
|
PASS(MandatoryInlining, "mandatory-inlining",
|
|
"Mandatory Inlining of Transparent Functions")
|
|
PASS(Mem2Reg, "mem2reg",
|
|
"Memory to SSA Value Conversion to Remove Stack Allocation")
|
|
PASS(MemBehaviorDumper, "mem-behavior-dump",
|
|
"Print SIL Instruction MemBehavior from Alias Analysis over all Pairs")
|
|
PASS(LSLocationPrinter, "lslocation-dump",
|
|
"Print Load-Store Location Results Covering all Accesses")
|
|
PASS(MergeCondFails, "merge-cond_fails",
|
|
"Merge SIL cond_fail to Eliminate Redundant Overflow Checks")
|
|
PASS(MoveCondFailToPreds, "move-cond-fail-to-preds",
|
|
"Move SIL cond_fail by Hoisting Checks")
|
|
PASS(NoReturnFolding, "noreturn-folding",
|
|
"Prune Control Flow at No-Return Calls Using SIL unreachable")
|
|
PASS(OwnershipModelEliminator, "ownership-model-eliminator",
|
|
"Eliminate Ownership Annotation of SIL")
|
|
PASS(RCIdentityDumper, "rc-id-dumper",
|
|
"Print Reference Count Identities")
|
|
PASS(PerfInliner, "inline",
|
|
"Performance Function Inlining")
|
|
PASS(PerformanceConstantPropagation, "performance-constant-propagation",
|
|
"Constant Propagation for Performance without Diagnostics")
|
|
PASS(PredictableMemoryOptimizations, "predictable-memopt",
|
|
"Predictable Memory Optimization for Diagnostics")
|
|
PASS(ReleaseDevirtualizer, "release-devirtualizer",
|
|
"SIL release Devirtualization")
|
|
PASS(RetainSinking, "retain-sinking",
|
|
"SIL retain Sinking")
|
|
PASS(ReleaseHoisting, "release-hoisting",
|
|
"SIL release Hoisting")
|
|
PASS(LateReleaseHoisting, "late-release-hoisting",
|
|
"Late SIL release Hoisting Preserving Epilogues")
|
|
PASS(RemovePins, "remove-pins",
|
|
"Remove SIL pin/unpin pairs")
|
|
PASS(SideEffectsDumper, "side-effects-dump",
|
|
"Print Side-Effect Information for all Functions")
|
|
PASS(SILCleanup, "cleanup",
|
|
"SIL Cleanup Preparation for IRGen")
|
|
PASS(SILCombine, "sil-combine",
|
|
"Combine SIL Instructions via Peephole Optimization")
|
|
PASS(SILDebugInfoGenerator, "sil-debuginfo-gen",
|
|
"Generate Debug Information with Source Locations into Textual SIL")
|
|
PASS(SILLinker, "linker",
|
|
"Link all SIL Referenced within the Module via Deserialization")
|
|
PASS(SROA, "sroa",
|
|
"Scalar Replacement of Aggregate Stack Objects")
|
|
PASS(SROABBArgs, "sroa-bb-args",
|
|
"Scalar Replacement of Aggregate SIL Block Arguments")
|
|
PASS(SimplifyBBArgs, "simplify-bb-args",
|
|
"SIL Block Argument Simplification")
|
|
// TODO: Rename this command line string.
|
|
PASS(SimplifyCFG, "normal-simplify-cfg",
|
|
"SIL CFG Simplification")
|
|
PASS(SpeculativeDevirtualization, "specdevirt",
|
|
"Speculative Devirtualization via Guarded Calls")
|
|
PASS(SplitAllCriticalEdges, "split-critical-edges",
|
|
"Split all Critical Edges in the SIL CFG")
|
|
PASS(SplitNonCondBrCriticalEdges, "split-non-cond_br-critical-edges",
|
|
"Split all Critical Edges not from SIL cond_br")
|
|
PASS(StackPromotion, "stack-promotion",
|
|
"Stack Promotion of Class Objects")
|
|
PASS(StripDebugInfo, "strip-debug-info",
|
|
"Strip Debug Information")
|
|
PASS(SwiftArrayOpts, "array-specialize",
|
|
"Loop Specialization for Array Properties")
|
|
PASS(UnsafeGuaranteedPeephole, "unsafe-guaranteed-peephole",
|
|
"SIL retain/release Peephole Removal for Builtin.unsafeGuaranteed")
|
|
PASS(UsePrespecialized, "use-prespecialized",
|
|
"Use Pre-Specialized Functions")
|
|
PASS(ValueOwnershipKindDumper, "value-ownership-kind-dumper",
|
|
"Print Value Ownership Kind for Testing")
|
|
PASS(SemanticARCOpts, "semantic-arc-opts",
|
|
"Semantic ARC Optimization")
|
|
PASS(MarkUninitializedFixup, "mark-uninitialized-fixup",
|
|
"Temporary pass for staging in mark_uninitialized changes.")
|
|
PASS(BugReducerTester, "bug-reducer-tester",
|
|
"sil-bug-reducer Tool Testing by Asserting on a Sentinel Function")
|
|
PASS_RANGE(AllPasses, AADumper, BugReducerTester)
|
|
|
|
#undef IRGEN_PASS
|
|
#undef PASS
|
|
#undef PASS_RANGE
|