1 //===- RegionsFromMetadata.cpp - A helper to test RegionPasses -----------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Transforms/Vectorize/SandboxVectorizer/Passes/RegionsFromMetadata.h"
11 #include "llvm/SandboxIR/Region.h"
12 #include "llvm/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerPassBuilder.h"
14 namespace llvm::sandboxir
{
16 RegionsFromMetadata::RegionsFromMetadata(StringRef Pipeline
)
17 : FunctionPass("regions-from-metadata"),
18 RPM("rpm", Pipeline
, SandboxVectorizerPassBuilder::createRegionPass
) {}
20 bool RegionsFromMetadata::runOnFunction(Function
&F
, const Analyses
&A
) {
21 SmallVector
<std::unique_ptr
<sandboxir::Region
>> Regions
=
22 sandboxir::Region::createRegionsFromMD(F
);
23 for (auto &R
: Regions
) {
24 RPM
.runOnRegion(*R
, A
);
29 } // namespace llvm::sandboxir