//===--- InstructionUtils.h - Utilities for SIL instructions ----*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef SWIFT_SIL_INSTRUCTIONUTILS_H #define SWIFT_SIL_INSTRUCTIONUTILS_H #include "swift/SIL/SILInstruction.h" namespace swift { /// Strip off casts/indexing insts/address projections from V until there is /// nothing left to strip. SILValue getUnderlyingObject(SILValue V); SILValue stripSinglePredecessorArgs(SILValue V); /// Return the underlying SILValue after stripping off all casts from the /// current SILValue. SILValue stripCasts(SILValue V); /// Return the underlying SILValue after stripping off all upcasts from the /// current SILValue. SILValue stripUpCasts(SILValue V); /// Return the underlying SILValue after stripping off all /// upcasts and downcasts. SILValue stripClassCasts(SILValue V); /// Return the underlying SILValue after stripping off all address projection /// instructions. SILValue stripAddressProjections(SILValue V); /// Return the underlying SILValue after stripping off all address projection /// instructions which have a single operand. SILValue stripUnaryAddressProjections(SILValue V); /// Return the underlying SILValue after stripping off all aggregate projection /// instructions. /// /// An aggregate projection instruction is either a struct_extract or a /// tuple_extract instruction. SILValue stripValueProjections(SILValue V); /// Return the underlying SILValue after stripping off all indexing /// instructions. /// /// An indexing inst is either index_addr or index_raw_pointer. SILValue stripIndexingInsts(SILValue V); /// Returns the underlying value after stripping off a builtin expect /// intrinsic call. SILValue stripExpectIntrinsic(SILValue V); } // end namespace swift #endif