2012-02-18 12:03:15 +00:00
|
|
|
//===-- HexagonSubtarget.h - Define Subtarget for the Hexagon ---*- C++ -*-===//
|
2011-12-12 21:14:40 +00: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 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
|
|
|
|
#define LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
|
2011-12-12 21:14:40 +00:00
|
|
|
|
2014-06-27 00:27:40 +00:00
|
|
|
#include "HexagonFrameLowering.h"
|
|
|
|
#include "HexagonISelLowering.h"
|
2015-01-14 11:23:27 +00:00
|
|
|
#include "HexagonInstrInfo.h"
|
2014-06-27 00:27:40 +00:00
|
|
|
#include "HexagonSelectionDAGInfo.h"
|
|
|
|
#include "llvm/IR/DataLayout.h"
|
2011-12-12 21:14:40 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2011-12-12 21:14:40 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
|
|
|
#include "HexagonGenSubtargetInfo.inc"
|
|
|
|
|
|
|
|
#define Hexagon_SMALL_DATA_THRESHOLD 8
|
2012-05-10 20:20:25 +00:00
|
|
|
#define Hexagon_SLOTS 4
|
2011-12-12 21:14:40 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class HexagonSubtarget : public HexagonGenSubtargetInfo {
|
2013-11-19 00:57:56 +00:00
|
|
|
virtual void anchor();
|
2014-06-27 00:27:40 +00:00
|
|
|
|
2011-12-12 21:14:40 +00:00
|
|
|
bool UseMemOps;
|
2012-05-10 20:20:25 +00:00
|
|
|
bool ModeIEEERndNear;
|
2011-12-12 21:14:40 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum HexagonArchEnum {
|
2015-02-09 21:56:37 +00:00
|
|
|
V4, V5
|
2011-12-12 21:14:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
HexagonArchEnum HexagonArchVersion;
|
2014-06-27 00:27:40 +00:00
|
|
|
private:
|
2011-12-12 21:14:40 +00:00
|
|
|
std::string CPUString;
|
2014-06-27 00:27:40 +00:00
|
|
|
HexagonInstrInfo InstrInfo;
|
|
|
|
HexagonTargetLowering TLInfo;
|
|
|
|
HexagonSelectionDAGInfo TSInfo;
|
|
|
|
HexagonFrameLowering FrameLowering;
|
2011-12-12 21:14:40 +00:00
|
|
|
InstrItineraryData InstrItins;
|
|
|
|
|
|
|
|
public:
|
2015-06-10 12:11:26 +00:00
|
|
|
HexagonSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
2014-06-27 00:27:40 +00:00
|
|
|
const TargetMachine &TM);
|
2011-12-12 21:14:40 +00:00
|
|
|
|
2014-08-15 22:17:28 +00:00
|
|
|
/// getInstrItins - Return the instruction itineraries based on subtarget
|
2011-12-12 21:14:40 +00:00
|
|
|
/// selection.
|
2014-09-03 11:41:21 +00:00
|
|
|
const InstrItineraryData *getInstrItineraryData() const override {
|
2014-08-04 21:25:23 +00:00
|
|
|
return &InstrItins;
|
|
|
|
}
|
|
|
|
const HexagonInstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
2014-09-03 11:41:21 +00:00
|
|
|
const HexagonRegisterInfo *getRegisterInfo() const override {
|
2014-06-27 00:27:40 +00:00
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
2014-09-03 11:41:21 +00:00
|
|
|
const HexagonTargetLowering *getTargetLowering() const override {
|
|
|
|
return &TLInfo;
|
|
|
|
}
|
|
|
|
const HexagonFrameLowering *getFrameLowering() const override {
|
2014-06-27 00:27:40 +00:00
|
|
|
return &FrameLowering;
|
|
|
|
}
|
2014-09-03 11:41:21 +00:00
|
|
|
const HexagonSelectionDAGInfo *getSelectionDAGInfo() const override {
|
|
|
|
return &TSInfo;
|
|
|
|
}
|
2011-12-12 21:14:40 +00:00
|
|
|
|
2014-06-27 00:27:40 +00:00
|
|
|
HexagonSubtarget &initializeSubtargetDependencies(StringRef CPU,
|
|
|
|
StringRef FS);
|
2011-12-12 21:14:40 +00: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 21:56:37 +00:00
|
|
|
bool useMemOps() const { return UseMemOps; }
|
|
|
|
bool hasV5TOps() const { return getHexagonArchVersion() >= V5; }
|
|
|
|
bool hasV5TOpsOnly() const { return getHexagonArchVersion() == V5; }
|
|
|
|
bool modeIEEERndNear() const { return ModeIEEERndNear; }
|
2015-03-11 22:56:10 +00: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 21:56:37 +00:00
|
|
|
|
2011-12-12 21:14:40 +00: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 {
|
|
|
|
return HexagonArchVersion;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|