16#define DEBUG_TYPE "double barriers"
34char ARMOptimizeBarriersPass::ID = 0;
41 return !(
MI->mayLoad() ||
43 MI->hasUnmodeledSideEffects() ||
48bool ARMOptimizeBarriersPass::runOnMachineFunction(
MachineFunction &MF) {
53 std::vector<MachineInstr *>
ToRemove;
60 for (
auto &
MBB : MF) {
63 bool IsRemovableNextDMB =
false;
64 for (
auto &
MI :
MBB) {
65 if (
MI.getOpcode() == ARM::DMB) {
66 if (IsRemovableNextDMB) {
69 if (
MI.getOperand(0).getImm() == DMBType) {
74 DMBType =
MI.getOperand(0).getImm();
78 IsRemovableNextDMB =
true;
79 DMBType =
MI.getOperand(0).getImm();
84 IsRemovableNextDMB =
false;
91 MI->eraseFromParent();
103 return new ARMOptimizeBarriersPass();
ReachingDefAnalysis InstSet & ToRemove
static bool CanMovePastDMB(const MachineInstr *MI)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
FunctionPass class - This class is used to implement most global optimizations.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
virtual MachineFunctionProperties getRequiredProperties() const
Properties which a MachineFunction may have at a given point in time.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createARMOptimizeBarriersPass()
createARMOptimizeBarriersPass - Returns an instance of the remove double barriers pass.