mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
These aren't really orthogonal concerns--you'll never have a @thick @cc(objc_method), or an @objc_block @cc(witness_method)--and we have gross decision trees all over the codebase that try to hopscotch between the subset of combinations that make sense. Stop the madness by eliminating AbstractCC and folding its states into SILFunctionTypeRepresentation. This cleans up a ton of code across the compiler. I couldn't quite eliminate AbstractCC's information from AST function types, since SIL type lowering transiently created AnyFunctionTypes with AbstractCCs set, even though these never occur at the source level. To accommodate type lowering, allow AnyFunctionType::ExtInfo to carry a SILFunctionTypeRepresentation, and arrange for the overlapping representations to share raw values. In order to avoid disturbing test output, AST and SILFunctionTypes are still printed and parsed using the existing @thin/@thick/@objc_block and @cc() attributes, which is kind of gross, but lets me stage in the real source-breaking change separately. Swift SVN r27095
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
//===--- CallingConvention.h - Calling conventions --------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file declares the interfaces for working with abstract and
|
|
// phsyical calling conventions.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_IRGEN_CALLINGCONVENTION_H
|
|
#define SWIFT_IRGEN_CALLINGCONVENTION_H
|
|
|
|
#include "llvm/IR/CallingConv.h"
|
|
|
|
namespace llvm {
|
|
class AttributeSet;
|
|
class Value;
|
|
}
|
|
|
|
namespace swift {
|
|
class ValueDecl;
|
|
enum class SILFunctionTypeRepresentation : uint8_t;
|
|
|
|
namespace irgen {
|
|
class IRGenModule;
|
|
|
|
/// Expand an abstract SIL function type representation into a physical
|
|
/// convention.
|
|
llvm::CallingConv::ID expandCallingConv(IRGenModule &IGM,
|
|
SILFunctionTypeRepresentation convention);
|
|
|
|
} // end namespace irgen
|
|
} // end namespace swift
|
|
|
|
#endif
|