1 //===- ARMLatencyMutations.h - ARM Latency Mutations ----------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 /// \file This file contains the ARM definition DAG scheduling mutations which
10 /// change inter-instruction latencies
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_ARM_LATENCYMUTATIONS_H
15 #define LLVM_LIB_TARGET_ARM_LATENCYMUTATIONS_H
17 #include "llvm/CodeGen/MachineScheduler.h"
18 #include "llvm/CodeGen/ScheduleDAGMutation.h"
23 class ARMBaseInstrInfo
;
25 /// Post-process the DAG to create cluster edges between instrs that may
26 /// be fused by the processor into a single operation.
27 class ARMOverrideBypasses
: public ScheduleDAGMutation
{
29 ARMOverrideBypasses(const ARMBaseInstrInfo
*t
, AAResults
*a
)
30 : ScheduleDAGMutation(), TII(t
), AA(a
) {}
32 void apply(ScheduleDAGInstrs
*DAGInstrs
) override
;
35 virtual void modifyBypasses(SUnit
&) = 0;
38 const ARMBaseInstrInfo
*TII
;
40 ScheduleDAGInstrs
*DAG
= nullptr;
42 static void setBidirLatencies(SUnit
&SrcSU
, SDep
&SrcDep
, unsigned latency
);
43 static bool zeroOutputDependences(SUnit
&ISU
, SDep
&Dep
);
44 unsigned makeBundleAssumptions(SUnit
&ISU
, SDep
&Dep
);
45 bool memoryRAWHazard(SUnit
&ISU
, SDep
&Dep
, unsigned latency
);
48 /// Note that you have to add:
49 /// DAG.addMutation(createARMLatencyMutation(ST, AA));
50 /// to ARMPassConfig::createMachineScheduler() to have an effect.
51 std::unique_ptr
<ScheduleDAGMutation
>
52 createARMLatencyMutations(const class ARMSubtarget
&, AAResults
*AA
);