mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ConstraintSystem] Add skeleton of constraint optimizer
This commit is contained in:
@@ -13,6 +13,7 @@ add_swift_host_library(swiftSema STATIC
|
||||
CSStep.cpp
|
||||
CSTrail.cpp
|
||||
CSFix.cpp
|
||||
CSOptimizer.cpp
|
||||
CSDiagnostics.cpp
|
||||
CodeSynthesis.cpp
|
||||
CodeSynthesisDistributedActor.cpp
|
||||
|
||||
25
lib/Sema/CSOptimizer.cpp
Normal file
25
lib/Sema/CSOptimizer.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
//===--- CSOptimizer.cpp - Constraint Optimizer ---------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift.org open source project
|
||||
//
|
||||
// Copyright (c) 2014 - 2023 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements disjunction and other constraint optimizations.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Sema/ConstraintSystem.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
using namespace swift;
|
||||
using namespace constraints;
|
||||
|
||||
void ConstraintSystem::optimizeDisjunctions(
|
||||
SmallVectorImpl<Constraint *> &disjunctions) {
|
||||
}
|
||||
@@ -1835,6 +1835,8 @@ Constraint *ConstraintSystem::selectDisjunction() {
|
||||
if (disjunctions.empty())
|
||||
return nullptr;
|
||||
|
||||
optimizeDisjunctions(disjunctions);
|
||||
|
||||
if (auto *disjunction = selectBestBindingDisjunction(*this, disjunctions))
|
||||
return disjunction;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user