xref: /freebsd/contrib/llvm-project/llvm/lib/SandboxIR/PassManager.cpp (revision 700637cbb5e582861067a11aaca4d053546871d2)
1*700637cbSDimitry Andric //===- PassManager.cpp - Runs a pipeline of Sandbox IR passes -------------===//
2*700637cbSDimitry Andric //
3*700637cbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*700637cbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*700637cbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*700637cbSDimitry Andric //
7*700637cbSDimitry Andric //===----------------------------------------------------------------------===//
8*700637cbSDimitry Andric 
9*700637cbSDimitry Andric #include "llvm/SandboxIR/PassManager.h"
10*700637cbSDimitry Andric 
11*700637cbSDimitry Andric namespace llvm::sandboxir {
12*700637cbSDimitry Andric 
runOnFunction(Function & F,const Analyses & A)13*700637cbSDimitry Andric bool FunctionPassManager::runOnFunction(Function &F, const Analyses &A) {
14*700637cbSDimitry Andric   bool Change = false;
15*700637cbSDimitry Andric   for (auto &Pass : Passes) {
16*700637cbSDimitry Andric     Change |= Pass->runOnFunction(F, A);
17*700637cbSDimitry Andric     // TODO: run the verifier.
18*700637cbSDimitry Andric   }
19*700637cbSDimitry Andric   // TODO: Check ChangeAll against hashes before/after.
20*700637cbSDimitry Andric   return Change;
21*700637cbSDimitry Andric }
22*700637cbSDimitry Andric 
runOnRegion(Region & R,const Analyses & A)23*700637cbSDimitry Andric bool RegionPassManager::runOnRegion(Region &R, const Analyses &A) {
24*700637cbSDimitry Andric   bool Change = false;
25*700637cbSDimitry Andric   for (auto &Pass : Passes) {
26*700637cbSDimitry Andric     Change |= Pass->runOnRegion(R, A);
27*700637cbSDimitry Andric     // TODO: run the verifier.
28*700637cbSDimitry Andric   }
29*700637cbSDimitry Andric   // TODO: Check ChangeAll against hashes before/after.
30*700637cbSDimitry Andric   return Change;
31*700637cbSDimitry Andric }
32*700637cbSDimitry Andric 
33*700637cbSDimitry Andric } // namespace llvm::sandboxir
34