LLVM 22.0.0git
RegionsFromBBs.cpp
Go to the documentation of this file.
1//===- RegionsFromBBs.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
13
14namespace llvm::sandboxir {
15
17 : FunctionPass("regions-from-bbs"),
18 RPM("rpm", Pipeline, SandboxVectorizerPassBuilder::createRegionPass) {}
19
22 // Create a region for each BB.
23 for (BasicBlock &BB : F) {
24 Regions.push_back(std::make_unique<Region>(F.getContext(), A.getTTI()));
25 auto &RgnPtr = Regions.back();
26 for (Instruction &I : BB)
27 RgnPtr->add(&I);
28 }
29 // For each region run the region pass pipeline.
30 for (auto &RgnPtr : Regions)
31 RPM.runOnRegion(*RgnPtr, A);
32 return false;
33}
34
35} // namespace llvm::sandboxir
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define F(x, y, z)
Definition MD5.cpp:55
#define I(x, y, z)
Definition MD5.cpp:58
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
FunctionPass(StringRef Name)
Name can't contain any spaces or start with '-'.
Definition Pass.h:78
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
Definition Instruction.h:43
bool runOnFunction(Function &F, const Analyses &A) final
\Returns true if it modifies F.
BasicBlock(llvm::BasicBlock *BB, Context &SBCtx)
Definition BasicBlock.h:75