diff options
author | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-07-29 13:59:09 +0000 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@codeaurora.org> | 2016-07-29 13:59:09 +0000 |
commit | e95e95521c62c9310203fcead43b6d495555e5f7 (patch) | |
tree | 005ffaa894370f5be2d96d15c725bd27b1dafbbd /llvm | |
parent | d898b0982ad4cc80c3090896926fd8b93e82c748 (diff) | |
download | bcm5719-llvm-e95e95521c62c9310203fcead43b6d495555e5f7.tar.gz bcm5719-llvm-e95e95521c62c9310203fcead43b6d495555e5f7.zip |
[Hexagon] Implement DFA based hazard recognizer
The post register allocator scheduler can generate poor schedules
because the scoreboard hazard recognizer is unable to identify
hazards for Hexagon precisely. Instead, Hexagon should use a DFA
based hazard recognizer.
Patch by Brendon Cahoon.
llvm-svn: 277143
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/Hexagon/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Target/Hexagon/CMakeLists.txt b/llvm/lib/Target/Hexagon/CMakeLists.txt index 06214149c69..e39247e474f 100644 --- a/llvm/lib/Target/Hexagon/CMakeLists.txt +++ b/llvm/lib/Target/Hexagon/CMakeLists.txt @@ -32,6 +32,7 @@ add_llvm_target(HexagonCodeGen HexagonGenMux.cpp HexagonGenPredicate.cpp HexagonHardwareLoops.cpp + HexagonHazardRecognizer.cpp HexagonInstrInfo.cpp HexagonISelDAGToDAG.cpp HexagonISelLowering.cpp diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp index d207fb66ed0..abba22273f0 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// +#include "HexagonHazardRecognizer.h" #include "HexagonInstrInfo.h" -#include "Hexagon.h" #include "HexagonRegisterInfo.h" #include "HexagonSubtarget.h" #include "llvm/ADT/STLExtras.h" @@ -23,6 +23,7 @@ #include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/PseudoSourceValue.h" +#include "llvm/CodeGen/ScheduleDAG.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" @@ -39,8 +40,6 @@ using namespace llvm; #include "HexagonGenInstrInfo.inc" #include "HexagonGenDFAPacketizer.inc" -using namespace llvm; - cl::opt<bool> ScheduleInlineAsm("hexagon-sched-inline-asm", cl::Hidden, cl::init(false), cl::desc("Do not consider inline-asm a scheduling/" "packetization boundary.")); @@ -67,6 +66,10 @@ static cl::opt<bool> EnableACCForwarding( static cl::opt<bool> BranchRelaxAsmLarge("branch-relax-asm-large", cl::init(true), cl::Hidden, cl::ZeroOrMore, cl::desc("branch relax asm")); +static cl::opt<bool> UseDFAHazardRec("dfa-hazard-rec", + cl::init(true), cl::Hidden, cl::ZeroOrMore, + cl::desc("Use the DFA based hazard recognizer.")); + /// /// Constants for Hexagon instructions. /// @@ -1433,6 +1436,10 @@ unsigned HexagonInstrInfo::getInlineAsmLength(const char *Str, ScheduleHazardRecognizer* HexagonInstrInfo::CreateTargetPostRAHazardRecognizer( const InstrItineraryData *II, const ScheduleDAG *DAG) const { + if (UseDFAHazardRec) { + auto &HST = DAG->MF.getSubtarget<HexagonSubtarget>(); + return new HexagonHazardRecognizer(II, this, HST); + } return TargetInstrInfo::CreateTargetPostRAHazardRecognizer(II, DAG); } |