xref: /llvm-project/llvm/lib/SandboxIR/PassManager.cpp (revision a461869db3bdc372203c9a7b8326d66a626f80d9)
13363760fSvporpo //===- PassManager.cpp - Runs a pipeline of Sandbox IR passes -------------===//
23363760fSvporpo //
33363760fSvporpo // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
43363760fSvporpo // See https://llvm.org/LICENSE.txt for license information.
53363760fSvporpo // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
63363760fSvporpo //
73363760fSvporpo //===----------------------------------------------------------------------===//
83363760fSvporpo 
93363760fSvporpo #include "llvm/SandboxIR/PassManager.h"
103363760fSvporpo 
11756ec99cSJorge Gorbe Moya namespace llvm::sandboxir {
123363760fSvporpo 
13*a461869dSvporpo bool FunctionPassManager::runOnFunction(Function &F, const Analyses &A) {
143363760fSvporpo   bool Change = false;
15756ec99cSJorge Gorbe Moya   for (auto &Pass : Passes) {
16*a461869dSvporpo     Change |= Pass->runOnFunction(F, A);
173363760fSvporpo     // TODO: run the verifier.
183363760fSvporpo   }
193363760fSvporpo   // TODO: Check ChangeAll against hashes before/after.
203363760fSvporpo   return Change;
213363760fSvporpo }
22f0f1b706Svporpo 
23*a461869dSvporpo bool RegionPassManager::runOnRegion(Region &R, const Analyses &A) {
24f35c213cSJorge Gorbe Moya   bool Change = false;
25756ec99cSJorge Gorbe Moya   for (auto &Pass : Passes) {
26*a461869dSvporpo     Change |= Pass->runOnRegion(R, A);
27f35c213cSJorge Gorbe Moya     // TODO: run the verifier.
28f35c213cSJorge Gorbe Moya   }
29f35c213cSJorge Gorbe Moya   // TODO: Check ChangeAll against hashes before/after.
30f35c213cSJorge Gorbe Moya   return Change;
31f35c213cSJorge Gorbe Moya }
32f35c213cSJorge Gorbe Moya 
33756ec99cSJorge Gorbe Moya } // namespace llvm::sandboxir
34