1 //===- RegionsFromMetadata.cpp - A helper to test RegionPasses -----------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h" 10 11 #include "llvm/SandboxIR/Region.h" 12 #include "llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h" 13 14 namespace llvm::sandboxir { 15 16 RegionsFromMetadata::RegionsFromMetadata(StringRef Pipeline) 17 : FunctionPass("regions-from-metadata"), 18 RPM("rpm", Pipeline, SandboxVectorizerPassBuilder::createRegionPass) {} 19 20 bool RegionsFromMetadata::runOnFunction(Function &F, const Analyses &A) { 21 SmallVector<std::unique_ptr<sandboxir::Region>> Regions = 22 sandboxir::Region::createRegionsFromMD(F, A.getTTI()); 23 for (auto &R : Regions) { 24 RPM.runOnRegion(*R, A); 25 } 26 return false; 27 } 28 29 } // namespace llvm::sandboxir 30