//===- ReductionNode.cpp - Reduction Node Implementation -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the reduction nodes which are used to track of the // metadata for a specific generated variant within a reduction pass and are the // building blocks of the reduction tree structure. A reduction tree is used to // keep track of the different generated variants throughout a reduction pass in // the MLIR Reduce tool. // //===----------------------------------------------------------------------===// #include "mlir/Reducer/ReductionNode.h" #include "mlir/IR/IRMapping.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> #include <limits> usingnamespacemlir; ReductionNode::ReductionNode( ReductionNode *parentNode, const std::vector<Range> &ranges, llvm::SpecificBumpPtrAllocator<ReductionNode> &allocator) /// Root node will have the parent pointer point to themselves. : … { … } LogicalResult ReductionNode::initialize(ModuleOp parentModule, Region &targetRegion) { … } /// If we haven't explored any variants from this node, we will create N /// variants, N is the length of `ranges` if N > 1. Otherwise, we will split the /// max element in `ranges` and create 2 new variants for each call. ArrayRef<ReductionNode *> ReductionNode::generateNewVariants() { … } void ReductionNode::update(std::pair<Tester::Interestingness, size_t> result) { … } ArrayRef<ReductionNode *> ReductionNode::iterator<SinglePath>::getNeighbors(ReductionNode *node) { … }