Debian Codegraph @

llvm/tools/llvm-reduce/deltas/ReduceInstructionFlagsMIR.cpp

raw
1 //===- ReduceInstructionFlagsMIR.cpp - Specialized Delta Pass -------------===//
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 // This file implements a function which calls the Generic Delta pass in order
10 // to reduce uninteresting MachineInstr flags from the MachineFunction.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "ReduceInstructionFlagsMIR.h"
15 #include "llvm/CodeGen/MachineFunction.h"
16 #include "llvm/CodeGen/MachineModuleInfo.h"
17
18 using namespace llvm;
19
20 void llvm::reduceInstructionFlagsMIRDeltaPass(Oracle &O,
21 ReducerWorkItem &WorkItem) {
22 for (const Function &F : WorkItem.getModule()) {
23 if (auto *MF = WorkItem.MMI->getMachineFunction(F)) {
24 for (MachineBasicBlock &MBB : *MF) {
25 for (MachineInstr &MI : MBB) {
26 // TODO: Should this clear flags individually?
27 if (MI.getFlags() != 0 && !O.shouldKeep())
28 MI.setFlags(0);
29 }
30 }
31 }
32 }
33 }