2012-02-18 13:03:15 +01:00
|
|
|
//===-- HexagonSubtarget.h - Define Subtarget for the Hexagon ---*- C++ -*-===//
|
2011-12-12 22:14:40 +01:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the Hexagon specific subclass of TargetSubtarget.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
|
|
|
|
#define LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
|
2011-12-12 22:14:40 +01:00
|
|
|
|
2014-06-27 02:27:40 +02:00
|
|
|
#include "HexagonFrameLowering.h"
|
|
|
|
#include "HexagonISelLowering.h"
|
2015-01-14 12:23:27 +01:00
|
|
|
#include "HexagonInstrInfo.h"
|
2014-06-27 02:27:40 +02:00
|
|
|
#include "HexagonSelectionDAGInfo.h"
|
2011-12-12 22:14:40 +01:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2012-12-04 08:12:27 +01:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2011-12-12 22:14:40 +01:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
|
|
|
#include "HexagonGenSubtargetInfo.inc"
|
|
|
|
|
|
|
|
#define Hexagon_SMALL_DATA_THRESHOLD 8
|
2012-05-10 22:20:25 +02:00
|
|
|
#define Hexagon_SLOTS 4
|
2011-12-12 22:14:40 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class HexagonSubtarget : public HexagonGenSubtargetInfo {
|
2013-11-19 01:57:56 +01:00
|
|
|
virtual void anchor();
|
2014-06-27 02:27:40 +02:00
|
|
|
|
2015-10-17 03:33:04 +02:00
|
|
|
bool UseMemOps, UseHVXOps, UseHVXDblOps;
|
2016-07-25 16:42:11 +02:00
|
|
|
bool UseLongCalls;
|
2012-05-10 22:20:25 +02:00
|
|
|
bool ModeIEEERndNear;
|
2011-12-12 22:14:40 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum HexagonArchEnum {
|
2015-10-17 03:33:04 +02:00
|
|
|
V4, V5, V55, V60
|
2011-12-12 22:14:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
HexagonArchEnum HexagonArchVersion;
|
2015-11-24 15:55:26 +01:00
|
|
|
/// True if the target should use Back-Skip-Back scheduling. This is the
|
|
|
|
/// default for V60.
|
|
|
|
bool UseBSBScheduling;
|
|
|
|
|
2016-07-15 19:48:09 +02:00
|
|
|
class HexagonDAGMutation : public ScheduleDAGMutation {
|
|
|
|
public:
|
|
|
|
void apply(ScheduleDAGInstrs *DAG) override;
|
|
|
|
};
|
|
|
|
|
2014-06-27 02:27:40 +02:00
|
|
|
private:
|
2011-12-12 22:14:40 +01:00
|
|
|
std::string CPUString;
|
2014-06-27 02:27:40 +02:00
|
|
|
HexagonInstrInfo InstrInfo;
|
|
|
|
HexagonTargetLowering TLInfo;
|
|
|
|
HexagonSelectionDAGInfo TSInfo;
|
|
|
|
HexagonFrameLowering FrameLowering;
|
2011-12-12 22:14:40 +01:00
|
|
|
InstrItineraryData InstrItins;
|
2015-11-25 21:30:59 +01:00
|
|
|
void initializeEnvironment();
|
2011-12-12 22:14:40 +01:00
|
|
|
|
|
|
|
public:
|
2015-06-10 14:11:26 +02:00
|
|
|
HexagonSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
2014-06-27 02:27:40 +02:00
|
|
|
const TargetMachine &TM);
|
2011-12-12 22:14:40 +01:00
|
|
|
|
2014-08-16 00:17:28 +02:00
|
|
|
/// getInstrItins - Return the instruction itineraries based on subtarget
|
2011-12-12 22:14:40 +01:00
|
|
|
/// selection.
|
2014-09-03 13:41:21 +02:00
|
|
|
const InstrItineraryData *getInstrItineraryData() const override {
|
2014-08-04 23:25:23 +02:00
|
|
|
return &InstrItins;
|
|
|
|
}
|
|
|
|
const HexagonInstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
2014-09-03 13:41:21 +02:00
|
|
|
const HexagonRegisterInfo *getRegisterInfo() const override {
|
2014-06-27 02:27:40 +02:00
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
2014-09-03 13:41:21 +02:00
|
|
|
const HexagonTargetLowering *getTargetLowering() const override {
|
|
|
|
return &TLInfo;
|
|
|
|
}
|
|
|
|
const HexagonFrameLowering *getFrameLowering() const override {
|
2014-06-27 02:27:40 +02:00
|
|
|
return &FrameLowering;
|
|
|
|
}
|
2014-09-03 13:41:21 +02:00
|
|
|
const HexagonSelectionDAGInfo *getSelectionDAGInfo() const override {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
2011-12-12 22:14:40 +01:00
|
|
|
|
2014-06-27 02:27:40 +02:00
|
|
|
HexagonSubtarget &initializeSubtargetDependencies(StringRef CPU,
|
|
|
|
StringRef FS);
|
2011-12-12 22:14:40 +01:00
|
|
|
|
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
|
|
|
|
2015-02-09 22:56:37 +01:00
|
|
|
bool useMemOps() const { return UseMemOps; }
|
|
|
|
bool hasV5TOps() const { return getHexagonArchVersion() >= V5; }
|
|
|
|
bool hasV5TOpsOnly() const { return getHexagonArchVersion() == V5; }
|
2015-11-25 21:30:59 +01:00
|
|
|
bool hasV55TOps() const { return getHexagonArchVersion() >= V55; }
|
|
|
|
bool hasV55TOpsOnly() const { return getHexagonArchVersion() == V55; }
|
2015-10-17 03:33:04 +02:00
|
|
|
bool hasV60TOps() const { return getHexagonArchVersion() >= V60; }
|
|
|
|
bool hasV60TOpsOnly() const { return getHexagonArchVersion() == V60; }
|
2015-02-09 22:56:37 +01:00
|
|
|
bool modeIEEERndNear() const { return ModeIEEERndNear; }
|
2015-11-25 21:30:59 +01:00
|
|
|
bool useHVXOps() const { return UseHVXOps; }
|
|
|
|
bool useHVXDblOps() const { return UseHVXOps && UseHVXDblOps; }
|
2015-10-17 03:33:04 +02:00
|
|
|
bool useHVXSglOps() const { return UseHVXOps && !UseHVXDblOps; }
|
2016-07-25 16:42:11 +02:00
|
|
|
bool useLongCalls() const { return UseLongCalls; }
|
2015-11-24 15:55:26 +01:00
|
|
|
|
|
|
|
bool useBSBScheduling() const { return UseBSBScheduling; }
|
2015-03-11 23:56:10 +01:00
|
|
|
bool enableMachineScheduler() const override;
|
|
|
|
// Always use the TargetLowering default scheduler.
|
|
|
|
// FIXME: This will use the vliw scheduler which is probably just hurting
|
|
|
|
// compiler time and will be removed eventually anyway.
|
|
|
|
bool enableMachineSchedDefaultSched() const override { return false; }
|
2015-02-09 22:56:37 +01:00
|
|
|
|
2016-05-26 17:38:50 +02:00
|
|
|
AntiDepBreakMode getAntiDepBreakMode() const override { return ANTIDEP_ALL; }
|
2016-05-26 21:44:28 +02:00
|
|
|
bool enablePostRAScheduler() const override { return true; }
|
2016-05-26 17:38:50 +02:00
|
|
|
|
2016-05-28 04:02:51 +02:00
|
|
|
bool enableSubRegLiveness() const override;
|
|
|
|
|
2011-12-12 22:14:40 +01:00
|
|
|
const std::string &getCPUString () const { return CPUString; }
|
|
|
|
|
|
|
|
// Threshold for small data section
|
|
|
|
unsigned getSmallDataThreshold() const {
|
|
|
|
return Hexagon_SMALL_DATA_THRESHOLD;
|
|
|
|
}
|
|
|
|
const HexagonArchEnum &getHexagonArchVersion() const {
|
2015-12-14 16:03:54 +01:00
|
|
|
return HexagonArchVersion;
|
2011-12-12 22:14:40 +01:00
|
|
|
}
|
2016-07-15 19:48:09 +02:00
|
|
|
|
|
|
|
void getPostRAMutations(
|
|
|
|
std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations)
|
|
|
|
const override;
|
2016-07-15 23:34:02 +02:00
|
|
|
|
|
|
|
/// \brief Perform target specific adjustments to the latency of a schedule
|
|
|
|
/// dependency.
|
|
|
|
void adjustSchedDependency(SUnit *def, SUnit *use, SDep& dep) const override;
|
|
|
|
|
2016-07-22 16:22:43 +02:00
|
|
|
unsigned getL1CacheLineSize() const;
|
|
|
|
unsigned getL1PrefetchDistance() const;
|
|
|
|
|
2016-07-15 23:34:02 +02:00
|
|
|
private:
|
|
|
|
// Helper function responsible for increasing the latency only.
|
2016-07-29 23:49:42 +02:00
|
|
|
void updateLatency(MachineInstr &SrcInst, MachineInstr &DstInst, SDep &Dep)
|
2016-07-18 16:23:10 +02:00
|
|
|
const;
|
|
|
|
void changeLatency(SUnit *Src, SmallVector<SDep, 4> &Deps, SUnit *Dst,
|
|
|
|
unsigned Lat) const;
|
|
|
|
bool isBestZeroLatency(SUnit *Src, SUnit *Dst, const HexagonInstrInfo *TII)
|
|
|
|
const;
|
2016-07-29 23:49:42 +02:00
|
|
|
void changePhiLatency(MachineInstr &SrcInst, SUnit *Dst, SDep &Dep) const;
|
2011-12-12 22:14:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|