You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
Demangle
ExecutionEngine
FuzzMutate
Fuzzer
IR
IRReader
LTO
LineEditor
Linker
MC
Object
ObjectYAML
Option
Passes
ProfileData
Support
TableGen
Target
AArch64
AMDGPU
ARC
ARM
AVR
BPF
Hexagon
Lanai
MSP430
Mips
NVPTX
Nios2
PowerPC
RISCV
Sparc
SystemZ
AsmParser
Disassembler
InstPrinter
MCTargetDesc
TargetInfo
CMakeLists.txt
LLVMBuild.txt
README.txt
SystemZ.h
SystemZ.td
SystemZAsmPrinter.cpp
SystemZAsmPrinter.h
SystemZCallingConv.cpp
SystemZCallingConv.h
SystemZCallingConv.td
SystemZConstantPoolValue.cpp
SystemZConstantPoolValue.h
SystemZElimCompare.cpp
SystemZExpandPseudo.cpp
SystemZFeatures.td
SystemZFrameLowering.cpp
SystemZFrameLowering.h
SystemZHazardRecognizer.cpp
SystemZHazardRecognizer.h
SystemZISelDAGToDAG.cpp
SystemZISelLowering.cpp.REMOVED.git-id
SystemZISelLowering.h
SystemZInstrBuilder.h
SystemZInstrDFP.td
SystemZInstrFP.td
SystemZInstrFormats.td.REMOVED.git-id
SystemZInstrHFP.td
SystemZInstrInfo.cpp
SystemZInstrInfo.h
SystemZInstrInfo.td
SystemZInstrSystem.td
SystemZInstrVector.td
SystemZLDCleanup.cpp
SystemZLongBranch.cpp
SystemZMCInstLower.cpp
SystemZMCInstLower.h
SystemZMachineFunctionInfo.cpp
SystemZMachineFunctionInfo.h
SystemZMachineScheduler.cpp
SystemZMachineScheduler.h
SystemZOperands.td
SystemZOperators.td
SystemZPatterns.td
SystemZProcessors.td
SystemZRegisterInfo.cpp
SystemZRegisterInfo.h
SystemZRegisterInfo.td
SystemZSchedule.td
SystemZScheduleZ13.td
SystemZScheduleZ14.td
SystemZScheduleZ196.td
SystemZScheduleZEC12.td
SystemZSelectionDAGInfo.cpp
SystemZSelectionDAGInfo.h
SystemZShortenInst.cpp
SystemZSubtarget.cpp
SystemZSubtarget.h
SystemZTDC.cpp
SystemZTargetMachine.cpp
SystemZTargetMachine.h
SystemZTargetTransformInfo.cpp
SystemZTargetTransformInfo.h
WebAssembly
X86
XCore
CMakeLists.txt
LLVMBuild.txt
README.txt
Target.cpp
TargetIntrinsicInfo.cpp
TargetLoweringObjectFile.cpp
TargetMachine.cpp
TargetMachineC.cpp
Testing
ToolDrivers
Transforms
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt
projects
resources
runtimes
scripts
test
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
148 lines
4.8 KiB
C
148 lines
4.8 KiB
C
![]() |
//==- SystemZMachineScheduler.h - SystemZ Scheduler Interface ----*- C++ -*-==//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
//
|
||
|
// -------------------------- Post RA scheduling ---------------------------- //
|
||
|
// SystemZPostRASchedStrategy is a scheduling strategy which is plugged into
|
||
|
// the MachineScheduler. It has a sorted Available set of SUs and a pickNode()
|
||
|
// implementation that looks to optimize decoder grouping and balance the
|
||
|
// usage of processor resources. Scheduler states are saved for the end
|
||
|
// region of each MBB, so that a successor block can learn from it.
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "SystemZHazardRecognizer.h"
|
||
|
#include "llvm/CodeGen/MachineScheduler.h"
|
||
|
#include "llvm/CodeGen/ScheduleDAG.h"
|
||
|
#include <set>
|
||
|
|
||
|
#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
||
|
#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|
||
|
|
||
|
using namespace llvm;
|
||
|
|
||
|
namespace llvm {
|
||
|
|
||
|
/// A MachineSchedStrategy implementation for SystemZ post RA scheduling.
|
||
|
class SystemZPostRASchedStrategy : public MachineSchedStrategy {
|
||
|
|
||
|
const MachineLoopInfo *MLI;
|
||
|
const SystemZInstrInfo *TII;
|
||
|
|
||
|
// A SchedModel is needed before any DAG is built while advancing past
|
||
|
// non-scheduled instructions, so it would not always be possible to call
|
||
|
// DAG->getSchedClass(SU).
|
||
|
TargetSchedModel SchedModel;
|
||
|
|
||
|
/// A candidate during instruction evaluation.
|
||
|
struct Candidate {
|
||
|
SUnit *SU = nullptr;
|
||
|
|
||
|
/// The decoding cost.
|
||
|
int GroupingCost = 0;
|
||
|
|
||
|
/// The processor resources cost.
|
||
|
int ResourcesCost = 0;
|
||
|
|
||
|
Candidate() = default;
|
||
|
Candidate(SUnit *SU_, SystemZHazardRecognizer &HazardRec);
|
||
|
|
||
|
// Compare two candidates.
|
||
|
bool operator<(const Candidate &other);
|
||
|
|
||
|
// Check if this node is free of cost ("as good as any").
|
||
|
bool noCost() const {
|
||
|
return (GroupingCost <= 0 && !ResourcesCost);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// A sorter for the Available set that makes sure that SUs are considered
|
||
|
// in the best order.
|
||
|
struct SUSorter {
|
||
|
bool operator() (SUnit *lhs, SUnit *rhs) const {
|
||
|
if (lhs->isScheduleHigh && !rhs->isScheduleHigh)
|
||
|
return true;
|
||
|
if (!lhs->isScheduleHigh && rhs->isScheduleHigh)
|
||
|
return false;
|
||
|
|
||
|
if (lhs->getHeight() > rhs->getHeight())
|
||
|
return true;
|
||
|
else if (lhs->getHeight() < rhs->getHeight())
|
||
|
return false;
|
||
|
|
||
|
return (lhs->NodeNum < rhs->NodeNum);
|
||
|
}
|
||
|
};
|
||
|
// A set of SUs with a sorter and dump method.
|
||
|
struct SUSet : std::set<SUnit*, SUSorter> {
|
||
|
#ifndef NDEBUG
|
||
|
void dump(SystemZHazardRecognizer &HazardRec) const;
|
||
|
#endif
|
||
|
};
|
||
|
|
||
|
/// The set of available SUs to schedule next.
|
||
|
SUSet Available;
|
||
|
|
||
|
/// Current MBB
|
||
|
MachineBasicBlock *MBB;
|
||
|
|
||
|
/// Maintain hazard recognizers for all blocks, so that the scheduler state
|
||
|
/// can be maintained past BB boundaries when appropariate.
|
||
|
typedef std::map<MachineBasicBlock*, SystemZHazardRecognizer*> MBB2HazRec;
|
||
|
MBB2HazRec SchedStates;
|
||
|
|
||
|
/// Pointer to the HazardRecognizer that tracks the scheduler state for
|
||
|
/// the current region.
|
||
|
SystemZHazardRecognizer *HazardRec;
|
||
|
|
||
|
/// Update the scheduler state by emitting (non-scheduled) instructions
|
||
|
/// up to, but not including, NextBegin.
|
||
|
void advanceTo(MachineBasicBlock::iterator NextBegin);
|
||
|
|
||
|
public:
|
||
|
SystemZPostRASchedStrategy(const MachineSchedContext *C);
|
||
|
virtual ~SystemZPostRASchedStrategy();
|
||
|
|
||
|
/// Called for a region before scheduling.
|
||
|
void initPolicy(MachineBasicBlock::iterator Begin,
|
||
|
MachineBasicBlock::iterator End,
|
||
|
unsigned NumRegionInstrs) override;
|
||
|
|
||
|
/// PostRA scheduling does not track pressure.
|
||
|
bool shouldTrackPressure() const override { return false; }
|
||
|
|
||
|
// Process scheduling regions top-down so that scheduler states can be
|
||
|
// transferrred over scheduling boundaries.
|
||
|
bool doMBBSchedRegionsTopDown() const override { return true; }
|
||
|
|
||
|
void initialize(ScheduleDAGMI *dag) override {}
|
||
|
|
||
|
/// Tell the strategy that MBB is about to be processed.
|
||
|
void enterMBB(MachineBasicBlock *NextMBB) override;
|
||
|
|
||
|
/// Tell the strategy that current MBB is done.
|
||
|
void leaveMBB() override;
|
||
|
|
||
|
/// Pick the next node to schedule, or return NULL.
|
||
|
SUnit *pickNode(bool &IsTopNode) override;
|
||
|
|
||
|
/// ScheduleDAGMI has scheduled an instruction - tell HazardRec
|
||
|
/// about it.
|
||
|
void schedNode(SUnit *SU, bool IsTopNode) override;
|
||
|
|
||
|
/// SU has had all predecessor dependencies resolved. Put it into
|
||
|
/// Available.
|
||
|
void releaseTopNode(SUnit *SU) override;
|
||
|
|
||
|
/// Currently only scheduling top-down, so this method is empty.
|
||
|
void releaseBottomNode(SUnit *SU) override {};
|
||
|
};
|
||
|
|
||
|
} // end namespace llvm
|
||
|
|
||
|
#endif // LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZMACHINESCHEDULER_H
|