mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
04bcc11905
derived classes. Since global data alignment, layout, and mangling is often based on the DataLayout, move it to the TargetMachine. This ensures that global data is going to be layed out and mangled consistently if the subtarget changes on a per function basis. Prior to this all targets(*) have had subtarget dependent code moved out and onto the TargetMachine. *One target hasn't been migrated as part of this change: R600. The R600 port has, as a subtarget feature, the size of pointers and this affects global data layout. I've currently hacked in a FIXME to enable progress, but the port needs to be updated to either pass the 64-bitness to the TargetMachine, or fix the DataLayout to avoid subtarget dependent features. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227113 91177308-0d34-0410-b5e6-96231b3b80d8
110 lines
3.5 KiB
C++
110 lines
3.5 KiB
C++
//===-- HexagonSubtarget.h - Define Subtarget for the Hexagon ---*- C++ -*-===//
|
|
//
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
|
|
#define LLVM_LIB_TARGET_HEXAGON_HEXAGONSUBTARGET_H
|
|
|
|
#include "HexagonFrameLowering.h"
|
|
#include "HexagonISelLowering.h"
|
|
#include "HexagonInstrInfo.h"
|
|
#include "HexagonSelectionDAGInfo.h"
|
|
#include "llvm/IR/DataLayout.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
|
#include <string>
|
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
|
#include "HexagonGenSubtargetInfo.inc"
|
|
|
|
#define Hexagon_SMALL_DATA_THRESHOLD 8
|
|
#define Hexagon_SLOTS 4
|
|
|
|
namespace llvm {
|
|
|
|
class HexagonSubtarget : public HexagonGenSubtargetInfo {
|
|
virtual void anchor();
|
|
|
|
bool UseMemOps;
|
|
bool ModeIEEERndNear;
|
|
|
|
public:
|
|
enum HexagonArchEnum {
|
|
V1, V2, V3, V4, V5
|
|
};
|
|
|
|
HexagonArchEnum HexagonArchVersion;
|
|
private:
|
|
std::string CPUString;
|
|
HexagonInstrInfo InstrInfo;
|
|
HexagonTargetLowering TLInfo;
|
|
HexagonSelectionDAGInfo TSInfo;
|
|
HexagonFrameLowering FrameLowering;
|
|
InstrItineraryData InstrItins;
|
|
|
|
public:
|
|
HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS,
|
|
const TargetMachine &TM);
|
|
|
|
/// getInstrItins - Return the instruction itineraries based on subtarget
|
|
/// selection.
|
|
const InstrItineraryData *getInstrItineraryData() const override {
|
|
return &InstrItins;
|
|
}
|
|
const HexagonInstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
|
const HexagonRegisterInfo *getRegisterInfo() const override {
|
|
return &InstrInfo.getRegisterInfo();
|
|
}
|
|
const HexagonTargetLowering *getTargetLowering() const override {
|
|
return &TLInfo;
|
|
}
|
|
const HexagonFrameLowering *getFrameLowering() const override {
|
|
return &FrameLowering;
|
|
}
|
|
const HexagonSelectionDAGInfo *getSelectionDAGInfo() const override {
|
|
return &TSInfo;
|
|
}
|
|
|
|
HexagonSubtarget &initializeSubtargetDependencies(StringRef CPU,
|
|
StringRef FS);
|
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
|
|
|
bool hasV2TOps () const { return HexagonArchVersion >= V2; }
|
|
bool hasV2TOpsOnly () const { return HexagonArchVersion == V2; }
|
|
bool hasV3TOps () const { return HexagonArchVersion >= V3; }
|
|
bool hasV3TOpsOnly () const { return HexagonArchVersion == V3; }
|
|
bool hasV4TOps () const { return HexagonArchVersion >= V4; }
|
|
bool hasV4TOpsOnly () const { return HexagonArchVersion == V4; }
|
|
bool useMemOps () const { return HexagonArchVersion >= V4 && UseMemOps; }
|
|
bool hasV5TOps () const { return HexagonArchVersion >= V5; }
|
|
bool hasV5TOpsOnly () const { return HexagonArchVersion == V5; }
|
|
bool modeIEEERndNear () const { return ModeIEEERndNear; }
|
|
|
|
bool isSubtargetV2() const { return HexagonArchVersion == V2;}
|
|
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
|