| 1 | //===- PassManager.cpp - Runs a pipeline of Sandbox IR passes -------------===// |
| 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/SandboxIR/PassManager.h" |
| 10 | |
| 11 | namespace llvm::sandboxir { |
| 12 | |
| 13 | bool FunctionPassManager::runOnFunction(Function &F, const Analyses &A) { |
| 14 | bool Change = false; |
| 15 | for (auto &Pass : Passes) { |
| 16 | Change |= Pass->runOnFunction(F, A); |
| 17 | // TODO: run the verifier. |
| 18 | } |
| 19 | // TODO: Check ChangeAll against hashes before/after. |
| 20 | return Change; |
| 21 | } |
| 22 | |
| 23 | bool RegionPassManager::runOnRegion(Region &R, const Analyses &A) { |
| 24 | bool Change = false; |
| 25 | for (auto &Pass : Passes) { |
| 26 | Change |= Pass->runOnRegion(R, A); |
| 27 | // TODO: run the verifier. |
| 28 | } |
| 29 | // TODO: Check ChangeAll against hashes before/after. |
| 30 | return Change; |
| 31 | } |
| 32 | |
| 33 | } // namespace llvm::sandboxir |
| 34 | |