17#define DEBUG_TYPE "double barriers"
31 MachineFunctionProperties::Property::NoVRegs);
36char ARMOptimizeBarriersPass::ID = 0;
43 return !(
MI->mayLoad() ||
45 MI->hasUnmodeledSideEffects() ||
50bool 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();
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.
MachineFunctionProperties & set(Property P)
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.