18 #define DEBUG_TYPE "double barriers" 20 STATISTIC(NumDMBsRemoved,
"Number of DMBs removed");
35 StringRef getPassName()
const override {
return "optimise barriers pass"; }
51 bool ARMOptimizeBarriersPass::runOnMachineFunction(
MachineFunction &MF) {
56 std::vector<MachineInstr *> ToRemove;
63 for (
auto &MBB : MF) {
66 bool IsRemovableNextDMB =
false;
67 for (
auto &
MI : MBB) {
68 if (
MI.getOpcode() == ARM::DMB) {
69 if (IsRemovableNextDMB) {
72 if (
MI.getOperand(0).getImm() == DMBType) {
73 ToRemove.push_back(&
MI);
77 DMBType =
MI.getOperand(0).getImm();
81 IsRemovableNextDMB =
true;
82 DMBType =
MI.getOperand(0).getImm();
87 IsRemovableNextDMB =
false;
93 for (
auto MI : ToRemove) {
94 MI->eraseFromParent();
106 return new ARMOptimizeBarriersPass();
bool isCall(QueryType Type=AnyInBundle) const
This class represents lattice values for constants.
FunctionPass * createARMOptimizeBarriersPass()
createARMOptimizeBarriersPass - Returns an instance of the remove double barriers pass...
STATISTIC(NumFunctions, "Total number of functions")
static bool CanMovePastDMB(const MachineInstr *MI)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
bool isReturn(QueryType Type=AnyInBundle) const
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
FunctionPass class - This class is used to implement most global optimizations.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
MachineFunctionProperties & set(Property P)
Representation of each machine instruction.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore...
StringRef - Represent a constant reference to a string, i.e.
Properties which a MachineFunction may have at a given point in time.