Files
swift-mirror/include/swift/AST/IRGenOptions.h
Jordan Rose 41700b03da Add a new (hidden) option -autolink-force-load.
This option puts a special symbol into the generated object files that other
object files can reference to force the library to be loaded.

The next commit will modify the way we serialize autolinking information so
that importers of this module will always emit a reference to this symbol.
This means the library will be linked into the final binary even if no other
symbols are used (which happens for some of our overlays that just add
category methods to Objective-C classes).

Part of <rdar://problem/16829587>

Swift SVN r17750
2014-05-09 01:07:07 +00:00

107 lines
3.2 KiB
C++

//===--- IRGenOptions.h - Swift Language IR Generation Options --*- 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 defines the options which control the generation of IR for
// swift files.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_AST_IRGENOPTIONS_H
#define SWIFT_AST_IRGENOPTIONS_H
#include "swift/AST/LinkLibrary.h"
#include <string>
#include <vector>
namespace swift {
enum class IRGenOutputKind : unsigned {
/// Just generate an LLVM module and return it.
Module,
/// Generate an LLVM module and write it out as LLVM assembly.
LLVMAssembly,
/// Generate an LLVM module and write it out as LLVM bitcode.
LLVMBitcode,
/// Generate an LLVM module and compile it to assembly.
NativeAssembly,
/// Generate an LLVM module, compile it, and assemble into an object file.
ObjectFile
};
/// The set of options supported by IR generation.
class IRGenOptions {
public:
/// The name of the first input file, used by the debug info.
std::string MainInputFilename;
std::string OutputFilename;
std::string ModuleName;
std::string Triple;
// The command line string that is to be stored in the DWARF debug info.
std::string DWARFDebugFlags;
// The CPU and features.
std::string TargetCPU;
std::vector<std::string> TargetFeatures;
std::string TargetABI;
/// The libraries and frameworks specified on the command line.
SmallVector<LinkLibrary, 4> LinkLibraries;
/// If non-empty, the (unmangled) name of a dummy symbol to emit that can be
/// used to force-load this module.
std::string ForceLoadSymbolName;
/// The kind of compilation we should do.
IRGenOutputKind OutputKind : 3;
/// Should we spend time verifying that the IR we produce is
/// well-formed?
unsigned Verify : 1;
/// The optimization level, as in -O2.
unsigned OptLevel : 2;
/// Whether we should emit debug info.
unsigned DebugInfo : 1;
/// \brief Whether we're generating IR for the JIT.
unsigned UseJIT : 1;
/// \brief Whether we allow dynamic value type layout.
unsigned EnableDynamicValueTypeLayout : 1;
/// \brief Whether we should run LLVM optimizations after IRGen.
unsigned DisableLLVMOptzns : 1;
/// \brief Whether we should run LLVM ARC optimizations after IRGen.
unsigned DisableLLVMARCOpts : 1;
/// \brief Whether we should omit dynamic safety checks from the emitted IR.
unsigned DisableAllRuntimeChecks : 1;
/// Disable frame pointer elimination?
unsigned DisableFPElim : 1;
IRGenOptions() : OutputKind(IRGenOutputKind::LLVMAssembly), Verify(true),
OptLevel(0), DebugInfo(false), UseJIT(false),
EnableDynamicValueTypeLayout(false),
DisableLLVMOptzns(false), DisableLLVMARCOpts(false),
DisableAllRuntimeChecks(false), DisableFPElim(true) {}
};
} // end namespace swift
#endif