Files
swift-mirror/include/swift/IRGen/Options.h
Michael Gottesman 4dc7cee606 Add in the option -disable-llvm-optzns to swift.
-disable-llvm-optzns in clang tells the frontend to do everything it would
normally do at lets say -O2, except run the actual LLVM IR passes on the
resulting IR. This is useful in the case where one wants to look at the result
of a non gauranteed SIL optimization pass at the IR level without llvm
optimizations applied.

Swift SVN r8594
2013-09-24 16:48:09 +00:00

84 lines
2.4 KiB
C++

//===--- Options.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_IRGEN_OPTIONS_H
#define SWIFT_IRGEN_OPTIONS_H
#include <string>
namespace swift {
namespace irgen {
enum class OutputKind : 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
};
/// irgen::Options - The set of options support by IR generation.
class Options {
public:
/// The name of the first input file, used by the debug info.
std::string MainInputFilename;
std::string OutputFilename;
std::string Triple;
// The command line string that is to be stored in the DWARF debug info.
std::string DWARFDebugFlags;
/// The kind of compilation we should do.
OutputKind 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;
Options() : OutputKind(OutputKind::LLVMAssembly), Verify(true), OptLevel(0),
DebugInfo(false), UseJIT(false),
EnableDynamicValueTypeLayout(false), DisableLLVMOptzns(false) {}
};
} // end namespace irgen
} // end namespace swift
#endif