mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This adjusts the runtime function declaration handling to track the owning module for the well known functions. This allows us to ensure that we are able to properly identify if the symbol should be imported or not when building the shared libraries. This will require a subsequent tweak to allow for checking for static library linkage to ensure that we do not mark the symbol as DLLImport when doing static linking.
57 lines
2.0 KiB
C++
57 lines
2.0 KiB
C++
//===--- RuntimeFnWrappersGen.h - LLVM IR Generation for runtime functions ===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Helper functions providing the LLVM IR generation for runtime entry points.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef SWIFT_RUNTIME_RUNTIMEFNWRAPPERSGEN_H
|
|
#define SWIFT_RUNTIME_RUNTIMEFNWRAPPERSGEN_H
|
|
|
|
#include "swift/SIL/RuntimeEffect.h"
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include "llvm/IR/Module.h"
|
|
|
|
namespace swift {
|
|
|
|
class AvailabilityRange;
|
|
class ASTContext;
|
|
|
|
namespace irgen {
|
|
class IRGenModule;
|
|
}
|
|
|
|
enum class RuntimeAvailability {
|
|
AlwaysAvailable,
|
|
AvailableByCompatibilityLibrary,
|
|
ConditionallyAvailable
|
|
};
|
|
|
|
/// Generate an llvm declaration for a runtime entry with a
|
|
/// given name, return types, argument types, attributes and
|
|
/// a calling convention.
|
|
llvm::Constant *getRuntimeFn(llvm::Module &Module, llvm::Constant *&cache,
|
|
const char *ModuleName, char const *FunctionName,
|
|
llvm::CallingConv::ID cc,
|
|
RuntimeAvailability availability,
|
|
llvm::ArrayRef<llvm::Type *> retTypes,
|
|
llvm::ArrayRef<llvm::Type *> argTypes,
|
|
llvm::ArrayRef<llvm::Attribute::AttrKind> attrs,
|
|
llvm::ArrayRef<llvm::MemoryEffects> memEffects,
|
|
irgen::IRGenModule *IGM = nullptr);
|
|
|
|
llvm::FunctionType *getRuntimeFnType(llvm::Module &Module,
|
|
llvm::ArrayRef<llvm::Type *> retTypes,
|
|
llvm::ArrayRef<llvm::Type *> argTypes);
|
|
|
|
} // namespace swift
|
|
#endif
|