diff options
Diffstat (limited to 'lib/Target/Hexagon/HexagonSubtarget.h')
| -rw-r--r-- | lib/Target/Hexagon/HexagonSubtarget.h | 106 |
1 files changed, 83 insertions, 23 deletions
diff --git a/lib/Target/Hexagon/HexagonSubtarget.h b/lib/Target/Hexagon/HexagonSubtarget.h index 753dca0000652..678ef210d0aee 100644 --- a/lib/Target/Hexagon/HexagonSubtarget.h +++ b/lib/Target/Hexagon/HexagonSubtarget.h @@ -14,15 +14,17 @@ #ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H #define LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H +#include "HexagonDepArch.h" #include "HexagonFrameLowering.h" -#include "HexagonInstrInfo.h" #include "HexagonISelLowering.h" +#include "HexagonInstrInfo.h" +#include "HexagonRegisterInfo.h" #include "HexagonSelectionDAGInfo.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/CodeGen/ScheduleDAGMutation.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/MC/MCInstrItineraries.h" -#include "llvm/Target/TargetSubtargetInfo.h" #include <memory> #include <string> #include <vector> @@ -44,33 +46,45 @@ class Triple; class HexagonSubtarget : public HexagonGenSubtargetInfo { virtual void anchor(); - bool UseMemOps, UseHVXOps, UseHVXDblOps; + bool UseMemOps, UseHVX64BOps, UseHVX128BOps; bool UseLongCalls; bool ModeIEEERndNear; + bool HasMemNoShuf = false; + bool EnableDuplex = false; public: -#include "HexagonDepArch.h" - - HexagonArchEnum HexagonArchVersion; + Hexagon::ArchEnum HexagonArchVersion; + Hexagon::ArchEnum HexagonHVXVersion = Hexagon::ArchEnum::V4; + CodeGenOpt::Level OptLevel; /// True if the target should use Back-Skip-Back scheduling. This is the /// default for V60. bool UseBSBScheduling; - class HexagonDAGMutation : public ScheduleDAGMutation { - public: + struct UsrOverflowMutation : public ScheduleDAGMutation { + void apply(ScheduleDAGInstrs *DAG) override; + }; + struct HVXMemLatencyMutation : public ScheduleDAGMutation { + void apply(ScheduleDAGInstrs *DAG) override; + }; + struct CallMutation : public ScheduleDAGMutation { + void apply(ScheduleDAGInstrs *DAG) override; + private: + bool shouldTFRICallBind(const HexagonInstrInfo &HII, + const SUnit &Inst1, const SUnit &Inst2) const; + }; + struct BankConflictMutation : public ScheduleDAGMutation { void apply(ScheduleDAGInstrs *DAG) override; }; private: std::string CPUString; HexagonInstrInfo InstrInfo; + HexagonRegisterInfo RegInfo; HexagonTargetLowering TLInfo; HexagonSelectionDAGInfo TSInfo; HexagonFrameLowering FrameLowering; InstrItineraryData InstrItins; - void initializeEnvironment(); - public: HexagonSubtarget(const Triple &TT, StringRef CPU, StringRef FS, const TargetMachine &TM); @@ -82,7 +96,7 @@ public: } const HexagonInstrInfo *getInstrInfo() const override { return &InstrInfo; } const HexagonRegisterInfo *getRegisterInfo() const override { - return &InstrInfo.getRegisterInfo(); + return &RegInfo; } const HexagonTargetLowering *getTargetLowering() const override { return &TLInfo; @@ -102,19 +116,42 @@ public: void ParseSubtargetFeatures(StringRef CPU, StringRef FS); bool useMemOps() const { return UseMemOps; } - bool hasV5TOps() const { return getHexagonArchVersion() >= V5; } - bool hasV5TOpsOnly() const { return getHexagonArchVersion() == V5; } - bool hasV55TOps() const { return getHexagonArchVersion() >= V55; } - bool hasV55TOpsOnly() const { return getHexagonArchVersion() == V55; } - bool hasV60TOps() const { return getHexagonArchVersion() >= V60; } - bool hasV60TOpsOnly() const { return getHexagonArchVersion() == V60; } - bool hasV62TOps() const { return getHexagonArchVersion() >= V62; } - bool hasV62TOpsOnly() const { return getHexagonArchVersion() == V62; } + bool hasV5TOps() const { + return getHexagonArchVersion() >= Hexagon::ArchEnum::V5; + } + bool hasV5TOpsOnly() const { + return getHexagonArchVersion() == Hexagon::ArchEnum::V5; + } + bool hasV55TOps() const { + return getHexagonArchVersion() >= Hexagon::ArchEnum::V55; + } + bool hasV55TOpsOnly() const { + return getHexagonArchVersion() == Hexagon::ArchEnum::V55; + } + bool hasV60TOps() const { + return getHexagonArchVersion() >= Hexagon::ArchEnum::V60; + } + bool hasV60TOpsOnly() const { + return getHexagonArchVersion() == Hexagon::ArchEnum::V60; + } + bool hasV62TOps() const { + return getHexagonArchVersion() >= Hexagon::ArchEnum::V62; + } + bool hasV62TOpsOnly() const { + return getHexagonArchVersion() == Hexagon::ArchEnum::V62; + } + bool hasV65TOps() const { + return getHexagonArchVersion() >= Hexagon::ArchEnum::V65; + } + bool hasV65TOpsOnly() const { + return getHexagonArchVersion() == Hexagon::ArchEnum::V65; + } bool modeIEEERndNear() const { return ModeIEEERndNear; } - bool useHVXOps() const { return UseHVXOps; } - bool useHVXDblOps() const { return UseHVXOps && UseHVXDblOps; } - bool useHVXSglOps() const { return UseHVXOps && !UseHVXDblOps; } + bool useHVXOps() const { return HexagonHVXVersion > Hexagon::ArchEnum::V4; } + bool useHVX128BOps() const { return useHVXOps() && UseHVX128BOps; } + bool useHVX64BOps() const { return useHVXOps() && UseHVX64BOps; } + bool hasMemNoShuf() const { return HasMemNoShuf; } bool useLongCalls() const { return UseLongCalls; } bool usePredicatedCalls() const; @@ -138,7 +175,7 @@ public: return Hexagon_SMALL_DATA_THRESHOLD; } - const HexagonArchEnum &getHexagonArchVersion() const { + const Hexagon::ArchEnum &getHexagonArchVersion() const { return HexagonArchVersion; } @@ -150,10 +187,33 @@ public: std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const override; + /// \brief Enable use of alias analysis during code generation (during MI + /// scheduling, DAGCombine, etc.). + bool useAA() const override; + /// \brief Perform target specific adjustments to the latency of a schedule /// dependency. void adjustSchedDependency(SUnit *def, SUnit *use, SDep& dep) const override; + unsigned getVectorLength() const { + assert(useHVXOps()); + if (useHVX64BOps()) + return 64; + if (useHVX128BOps()) + return 128; + llvm_unreachable("Invalid HVX vector length settings"); + } + + bool isHVXVectorType(MVT VecTy) const { + if (!VecTy.isVector() || !useHVXOps()) + return false; + unsigned ElemWidth = VecTy.getVectorElementType().getSizeInBits(); + if (ElemWidth < 8 || ElemWidth > 64) + return false; + unsigned VecWidth = VecTy.getSizeInBits(); + return VecWidth == 8*getVectorLength() || VecWidth == 16*getVectorLength(); + } + unsigned getL1CacheLineSize() const; unsigned getL1PrefetchDistance() const; |
