Files
swift-mirror/include/swift/SIL/AccessedStorage.def
Michael Gottesman 8f7620f627 [semantic-arc-opts] Implement a simple load [copy] -> load_borrow optimization for arguments to create optimization scaffolding.
This is the first in a sequence of patches that implement various optimizations
to transform load [copy] into load_borrow.

The optimization works by looking for a load [copy] that:

1. Only has destroy_value as consuming users. This implies that we do not need
to pass off the in memory value at +1 and that we can use a +0 value.

2. Is loading from a memory location that is never written to or only written to
after all uses of the load [copy].

and then RAUW the load [copy] with a load_borrow and convertes the destroy_value
to end_borrow.

NOTE: I also a .def file for AccessedStorage so we can do visitors over the
kinds. The reason I want to do this is to ensure that people update these
optimizations if we add new storage kinds.
2018-12-16 12:32:46 -08:00

40 lines
1.2 KiB
C++

//===--- AccessedStorage.def ----------------------------*- c++ -*---------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 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
//
//===----------------------------------------------------------------------===//
///
/// \file
///
/// A file used for metaprogramming with accessed storage. Used to enable
/// easily updateable visitors.
///
//===----------------------------------------------------------------------===//
#ifndef ACCESSED_STORAGE
#error "Must define accesed storage before including this?!"
#endif
#ifndef ACCESSED_STORAGE_RANGE
#define ACCESSED_STORAGE_RANGE(Name, Start, End)
#endif
ACCESSED_STORAGE(Box)
ACCESSED_STORAGE(Stack)
ACCESSED_STORAGE(Global)
ACCESSED_STORAGE(Class)
ACCESSED_STORAGE(Argument)
ACCESSED_STORAGE(Yield)
ACCESSED_STORAGE(Nested)
ACCESSED_STORAGE(Unidentified)
ACCESSED_STORAGE_RANGE(AccessedStorageKind, Box, Unidentified)
#undef ACCESSED_STORAGE_RANGE
#undef ACCESSED_STORAGE