Merge pull request #75960 from gottesmm/pr-d0a4bbf70b470c53c7f2435ee53051da8fd643d3

[region-isolation] Move the region isolation logging decls out of PartitionUtils.h -> RegionIsolation.h
This commit is contained in:
Michael Gottesman
2024-08-19 15:06:51 -07:00
committed by GitHub
5 changed files with 99 additions and 54 deletions

View File

@@ -20,6 +20,7 @@
#include "swift/SIL/SILFunction.h"
#include "swift/SIL/SILInstruction.h"
#include "swift/SILOptimizer/Utils/InstOptUtils.h"
#include "swift/SILOptimizer/Utils/RegionIsolation.h"
#include "swift/SILOptimizer/Utils/SILIsolationInfo.h"
#include "llvm/ADT/MapVector.h"
@@ -36,32 +37,6 @@ namespace swift {
namespace PartitionPrimitives {
extern bool REGIONBASEDISOLATION_ENABLE_LOGGING;
#ifdef REGIONBASEDISOLATION_LOG
#error "REGIONBASEDISOLATION_LOG already defined?!"
#endif
#define REGIONBASEDISOLATION_LOG(...) \
do { \
if (PartitionPrimitives::REGIONBASEDISOLATION_ENABLE_LOGGING) { \
__VA_ARGS__; \
} \
} while (0);
extern bool REGIONBASEDISOLATION_ENABLE_VERBOSE_LOGGING;
#ifdef REGIONBASEDISOLATION_VERBOSE_LOG
#error "REGIONBASEDISOLATION_VERBOSE_LOG already defined?!"
#endif
#define REGIONBASEDISOLATION_VERBOSE_LOG(...) \
do { \
if (PartitionPrimitives::REGIONBASEDISOLATION_ENABLE_VERBOSE_LOGGING) { \
__VA_ARGS__; \
} \
} while (0);
struct Element {
unsigned num;

View File

@@ -0,0 +1,61 @@
//===--- RegionIsolation.h ------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2024 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
//
//===----------------------------------------------------------------------===//
///
/// \file This file just declares some command line options that are used for
/// the various parts of region analysis based diagnostics.
///
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SILOPTIMIZER_UTILS_REGIONANALYSIS_H
#define SWIFT_SILOPTIMIZER_UTILS_REGIONANALYSIS_H
namespace swift {
namespace regionisolation {
enum class LoggingFlag {
Off = 0,
Normal = 0x1,
Verbose = 0x3,
};
extern LoggingFlag ENABLE_LOGGING;
#ifdef REGIONBASEDISOLATION_LOG
#error "REGIONBASEDISOLATION_LOG already defined?!"
#endif
#ifdef REGIONBASEDISOLATION_VERBOSE_LOG
#error "REGIONBASEDISOLATION_VERBOSE_LOG already defined?!"
#endif
#define REGIONBASEDISOLATION_LOG(...) \
do { \
if (swift::regionisolation::ENABLE_LOGGING != \
swift::regionisolation::LoggingFlag::Off) { \
__VA_ARGS__; \
} \
} while (0);
#define REGIONBASEDISOLATION_VERBOSE_LOG(...) \
do { \
if (swift::regionisolation::ENABLE_LOGGING == \
swift::regionisolation::LoggingFlag::Verbose) { \
__VA_ARGS__; \
} \
} while (0);
} // namespace regionisolation
} // namespace swift
#endif