Go to the documentation of this file.
17 #define DEBUG_TYPE "double barriers"
19 STATISTIC(NumDMBsRemoved,
"Number of DMBs removed");
34 StringRef getPassName()
const override {
return "optimise barriers pass"; }
43 return !(
MI->mayLoad() ||
45 MI->hasUnmodeledSideEffects() ||
50 bool ARMOptimizeBarriersPass::runOnMachineFunction(
MachineFunction &MF) {
55 std::vector<MachineInstr *>
ToRemove;
62 for (
auto &
MBB : MF) {
65 bool IsRemovableNextDMB =
false;
66 for (
auto &
MI :
MBB) {
67 if (
MI.getOpcode() == ARM::DMB) {
68 if (IsRemovableNextDMB) {
71 if (
MI.getOperand(0).getImm() == DMBType) {
76 DMBType =
MI.getOperand(0).getImm();
80 IsRemovableNextDMB =
true;
81 DMBType =
MI.getOperand(0).getImm();
86 IsRemovableNextDMB =
false;
93 MI->eraseFromParent();
105 return new ARMOptimizeBarriersPass();
This is an optimization pass for GlobalISel generic memory operations.
static bool CanMovePastDMB(const MachineInstr *MI)
ReachingDefAnalysis InstSet & ToRemove
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
STATISTIC(NumFunctions, "Total number of functions")
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Representation of each machine instruction.
StringRef - Represent a constant reference to a string, i.e.
Function & getFunction()
Return the LLVM function that this machine code represents.
FunctionPass class - This class is used to implement most global optimizations.
FunctionPass * createARMOptimizeBarriersPass()
createARMOptimizeBarriersPass - Returns an instance of the remove double barriers pass.