16#define DEBUG_TYPE "double barriers"
26 bool runOnMachineFunction(MachineFunction &Fn)
override;
28 MachineFunctionProperties getRequiredProperties()
const override {
29 return MachineFunctionProperties().setNoVRegs();
32 StringRef getPassName()
const override {
return "optimise barriers pass"; }
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();
ReachingDefInfo 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...
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createARMOptimizeBarriersPass()
createARMOptimizeBarriersPass - Returns an instance of the remove double barriers pass.