16#define DEBUG_TYPE "double barriers"
30 MachineFunctionProperties::Property::NoVRegs);
35char ARMOptimizeBarriersPass::ID = 0;
42 return !(
MI->mayLoad() ||
44 MI->hasUnmodeledSideEffects() ||
49bool ARMOptimizeBarriersPass::runOnMachineFunction(
MachineFunction &MF) {
54 std::vector<MachineInstr *>
ToRemove;
61 for (
auto &
MBB : MF) {
64 bool IsRemovableNextDMB =
false;
65 for (
auto &
MI :
MBB) {
66 if (
MI.getOpcode() == ARM::DMB) {
67 if (IsRemovableNextDMB) {
70 if (
MI.getOperand(0).getImm() == DMBType) {
75 DMBType =
MI.getOperand(0).getImm();
79 IsRemovableNextDMB =
true;
80 DMBType =
MI.getOperand(0).getImm();
85 IsRemovableNextDMB =
false;
92 MI->eraseFromParent();
104 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.