mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-01 14:45:53 +01:00
The intent is to add visibility into how the fingerprint is computed, so that fingerprinting issues and mangling collisions can be more readily understood and fixed. Assisted-by: Gemini via Antigravity
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_LOWER_OPTIONS_H_
|
|
#define CARBON_TOOLCHAIN_LOWER_OPTIONS_H_
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
namespace Carbon::Lower {
|
|
|
|
enum class OptimizationLevel {
|
|
// No optimizations beyond necessary ones like inlining always-inline
|
|
// functions. Corresponds to Clang -O0.
|
|
None,
|
|
// Perform optimizations that make the build faster and don't degrade
|
|
// debugging. Corresponds to Clang -O1 or -Og.
|
|
Debug,
|
|
// Optimize for binary size. Corresponds to Clang -Oz.
|
|
Size,
|
|
// Optimize for program execution speed. Corresponds to Clang -O3.
|
|
Speed,
|
|
};
|
|
|
|
struct LowerToLLVMOptions {
|
|
// Options must be set individually, not through initialization.
|
|
explicit LowerToLLVMOptions() = default;
|
|
|
|
// If set, enables LLVM IR verification.
|
|
llvm::raw_ostream* llvm_verifier_stream = nullptr;
|
|
|
|
// Whether to include debug info in lowered output.
|
|
bool want_debug_info = false;
|
|
|
|
// If set, enables verbose output.
|
|
llvm::raw_ostream* vlog_stream = nullptr;
|
|
|
|
// The optimization level to set on lowered functions by default.
|
|
OptimizationLevel opt_level = OptimizationLevel::Debug;
|
|
|
|
// Whether to use the string form of the fingerprint for mangling.
|
|
bool mangle_string_fingerprint = false;
|
|
};
|
|
|
|
} // namespace Carbon::Lower
|
|
|
|
#endif // CARBON_TOOLCHAIN_LOWER_OPTIONS_H_
|