forked from Hoernchen/Epiphany
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EpiphanySubtarget.h
104 lines (79 loc) · 3.29 KB
/
EpiphanySubtarget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//==-- EpiphanySubtarget.h - Define Subtarget for the Epiphany ---*- 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 Epiphany specific subclass of TargetSubtargetInfo.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_EPIPHANY_SUBTARGET_H
#define LLVM_TARGET_EPIPHANY_SUBTARGET_H
#include "EpiphanyFrameLowering.h"
#include "EpiphanyISelLowering.h"
#include "EpiphanyInstrInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/MC/MCInstrItineraries.h"
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
#include <string>
#define GET_SUBTARGETINFO_HEADER
#include "EpiphanyGenSubtargetInfo.inc"
namespace llvm {
class StringRef;
class EpiphanyTargetMachine;
class EpiphanySubtarget : public EpiphanyGenSubtargetInfo {
virtual void anchor();
protected:
enum EpiphanyArchEnum {
E16
};
// Epiphany architecture version
EpiphanyArchEnum EpiphanyArchVersion;
// HasCmp - cmp instructions.
bool HasCmp = false;
// Itinerary data
InstrItineraryData InstrItins;
// Target Machine
const EpiphanyTargetMachine &TM;
// Target Triple
Triple TargetTriple;
const SelectionDAGTargetInfo TSInfo;
std::unique_ptr<const EpiphanyInstrInfo> InstrInfo;
std::unique_ptr<const EpiphanyFrameLowering> FrameLowering;
std::unique_ptr<const EpiphanyTargetLowering> TLInfo;
public:
const EpiphanyABIInfo &getABI() const;
/// This constructor initializes the data members to match that
/// of the specified triple.
///
EpiphanySubtarget(const Triple &TT, const std::string &CPU,
const std::string &FS, const EpiphanyTargetMachine &TM);
/// ParseSubtargetFeatures - Parses features string setting specified
/// subtarget options. Definition of function is auto generated by tblgen.
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
bool isE16() const { return EpiphanyArchVersion == E16; }
bool abiUsesSoftFloat() const;
bool hasCmp() const { return HasCmp; }
unsigned stackAlignment() const { return 2; }
unsigned stackOffset() const { return 8; }
EpiphanySubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS,
const TargetMachine &TM);
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
return &TSInfo;
}
const EpiphanyInstrInfo *getInstrInfo() const override { return InstrInfo.get(); }
const EpiphanyFrameLowering *getFrameLowering() const override { return FrameLowering.get(); }
const EpiphanyTargetLowering *getTargetLowering() const override { return TLInfo.get(); }
const EpiphanyRegisterInfo *getRegisterInfo() const override { return &InstrInfo->getRegisterInfo(); }
const InstrItineraryData *getInstrItineraryData() const override {
return &InstrItins;
}
AntiDepBreakMode getAntiDepBreakMode() const override { return ANTIDEP_ALL; }
bool enablePostRAScheduler() const override { return true; }
};
} // End llvm namespace
#endif // LLVM_TARGET_EPIPHANY_SUBTARGET_H