Files
swift-mirror/lib/SILOptimizer/SILCombiner/Simplifications.def
Erik Eckstein 844217d58c Optimizer: replace explicit_copy_value and explicit_copy_addr with their non-explicit counterparts
The `explicit_copy_value` and `explicit_copy_addr` instructions are only used for non-copyable diagnostics in the mandatory pipeline.
After that we can replace them by their non-explicit counterparts so that optimizations (which only know of `copy_value` and `copy_addr`) can do their work.

rdar://159039552
2025-09-04 19:40:53 +02:00

66 lines
2.8 KiB
C++

//===--- Simplifications.def ------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2025 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 contains macro-metaprogramming for instruction simplifications
// running in SILCombine.
//
//===----------------------------------------------------------------------===//
/// INSTRUCTION_SIMPLIFICATION(Inst)
/// Defines an instruction simplification which is implemented in swift and is
/// run by the SILCombiner.
/// The \p Inst argument specifies the instruction class.
///
/// No further code is need on the C++ side. On the swift side an instruction
/// simplification must be registered for the instruction class with
/// `registerForSILCombine`.
///
/// INSTRUCTION_SIMPLIFICATION_WITH_LEGACY(Inst)
/// Like INSTRUCTION_SIMPLIFICATION, but also runs the legacy `visitInst`
/// implementation in SILCombine.
INSTRUCTION_SIMPLIFICATION(BeginBorrowInst)
INSTRUCTION_SIMPLIFICATION(BeginCOWMutationInst)
INSTRUCTION_SIMPLIFICATION(ClassifyBridgeObjectInst)
INSTRUCTION_SIMPLIFICATION(ExplicitCopyAddrInst)
INSTRUCTION_SIMPLIFICATION(ExplicitCopyValueInst)
INSTRUCTION_SIMPLIFICATION(FixLifetimeInst)
INSTRUCTION_SIMPLIFICATION(GlobalValueInst)
INSTRUCTION_SIMPLIFICATION(StrongRetainInst)
INSTRUCTION_SIMPLIFICATION(StrongReleaseInst)
INSTRUCTION_SIMPLIFICATION(RetainValueInst)
INSTRUCTION_SIMPLIFICATION(ReleaseValueInst)
INSTRUCTION_SIMPLIFICATION(LoadInst)
INSTRUCTION_SIMPLIFICATION(LoadBorrowInst)
INSTRUCTION_SIMPLIFICATION(CopyValueInst)
INSTRUCTION_SIMPLIFICATION(CopyBlockInst)
INSTRUCTION_SIMPLIFICATION(DestroyValueInst)
INSTRUCTION_SIMPLIFICATION(DestructureStructInst)
INSTRUCTION_SIMPLIFICATION(DestructureTupleInst)
INSTRUCTION_SIMPLIFICATION(MarkDependenceInst)
INSTRUCTION_SIMPLIFICATION(MarkDependenceAddrInst)
INSTRUCTION_SIMPLIFICATION(PointerToAddressInst)
INSTRUCTION_SIMPLIFICATION(TypeValueInst)
INSTRUCTION_SIMPLIFICATION(UncheckedAddrCastInst)
INSTRUCTION_SIMPLIFICATION(UncheckedEnumDataInst)
INSTRUCTION_SIMPLIFICATION(WitnessMethodInst)
INSTRUCTION_SIMPLIFICATION(EndCOWMutationAddrInst)
INSTRUCTION_SIMPLIFICATION_WITH_LEGACY(AllocStackInst)
INSTRUCTION_SIMPLIFICATION_WITH_LEGACY(BuiltinInst)
INSTRUCTION_SIMPLIFICATION_WITH_LEGACY(UnconditionalCheckedCastInst)
INSTRUCTION_SIMPLIFICATION_WITH_LEGACY(ApplyInst)
INSTRUCTION_SIMPLIFICATION_WITH_LEGACY(TryApplyInst)
#undef INSTRUCTION_SIMPLIFICATION
#undef INSTRUCTION_SIMPLIFICATION_WITH_LEGACY