mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We want to support three configurations: * Debug (-Onone, -O0): user assertions, library precondition checks, runtime checks enabled and verbose. * Release (-O): library precondition checks, runtime checks enabled but succinct (trap). * Fast (-Ofast): all checks off. The _isFast predicate will allow to write standard library functions to support this plan. This commit changes fatal() to differentiate between the three modes. Support for rdar://16477198 Swift SVN r17697
87 lines
2.4 KiB
C++
87 lines
2.4 KiB
C++
//===--- SILOptions.h - Swift Language SILGen and SIL 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, processing,
|
|
// and optimization of SIL.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_AST_SILOPTIONS_H
|
|
#define SWIFT_AST_SILOPTIONS_H
|
|
|
|
#include <string>
|
|
|
|
namespace swift {
|
|
|
|
class SILOptions {
|
|
public:
|
|
/// Controls the aggressiveness of the performance inliner.
|
|
unsigned InlineThreshold = 50;
|
|
|
|
/// Controls the aggressiveness of devirtualization. 0=disabled.
|
|
unsigned DevirtThreshold = 0;
|
|
|
|
enum LinkingMode {
|
|
/// Skip SIL linking.
|
|
LinkNone,
|
|
|
|
/// Perform normal SIL linking.
|
|
LinkNormal,
|
|
|
|
/// Link all functions during SIL linking.
|
|
LinkAll
|
|
};
|
|
|
|
/// Controls how perform SIL linking.
|
|
LinkingMode LinkMode = LinkNormal;
|
|
|
|
/// Remove all runtime assertions during optimizations.
|
|
bool RemoveRuntimeAsserts = false;
|
|
|
|
/// Controls whether the SIL ARC optimizations are run.
|
|
bool EnableARCOptimizations = true;
|
|
|
|
/// Controls whether or not paranoid verification checks are run.
|
|
bool VerifyAll = false;
|
|
|
|
/// Dump SIL after each transform.
|
|
bool PrintAll = false;
|
|
|
|
/// Time each transform invocation in the pass manager.
|
|
bool TimeTransforms = false;
|
|
|
|
/// Stop optimizing after the Nth pass. For debugging purposes.
|
|
unsigned NumOptPassesToRun = UINT_MAX;
|
|
|
|
/// Are we debugging sil serialization.
|
|
bool DebugSerialization = false;
|
|
|
|
enum AssertConfiguration: unsigned {
|
|
// Used by standard library code to distinguish between a debug and release
|
|
// build.
|
|
Debug = 0, // Enables all asserts.
|
|
Release = 1, // Disables asserts.
|
|
Fast = 2, // Disables asserts, library precondition, and runtime checks.
|
|
|
|
// Leave the assert_configuration instruction around.
|
|
DisableReplacement = UINT_MAX
|
|
};
|
|
|
|
/// The assert configuration controls how assertions behave.
|
|
unsigned AssertConfig = DisableReplacement;
|
|
|
|
};
|
|
|
|
} // end namespace swift
|
|
|
|
#endif
|