forked from anza-xyz/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSBFSubtarget.h
140 lines (114 loc) · 4.63 KB
/
SBFSubtarget.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//===-- SBFSubtarget.h - Define Subtarget for the SBF -----------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares the SBF specific subclass of TargetSubtargetInfo.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_SBF_SBFSUBTARGET_H
#define LLVM_LIB_TARGET_SBF_SBFSUBTARGET_H
#include "SBFFrameLowering.h"
#include "SBFISelLowering.h"
#include "SBFInstrInfo.h"
#include "SBFRegisterInfo.h"
#include "SBFSelectionDAGInfo.h"
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
#include "llvm/CodeGen/RegisterBankInfo.h"
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/Target/TargetMachine.h"
#define GET_SUBTARGETINFO_HEADER
#include "SBFGenSubtargetInfo.inc"
namespace llvm {
class StringRef;
class SBFSubtarget : public SBFGenSubtargetInfo {
virtual void anchor();
SBFInstrInfo InstrInfo;
SBFFrameLowering FrameLowering;
SBFTargetLowering TLInfo;
SBFSelectionDAGInfo TSInfo;
private:
void initializeEnvironment(const Triple &TT);
void initSubtargetFeatures(StringRef CPU, StringRef FS);
protected:
// whether the cpu supports jmp ext
bool HasJmpExt;
// whether the cpu supports alu32 instructions.
bool HasAlu32;
// whether we should use fixed or dynamic frames
bool HasDynamicFrames;
// Relocate FK_Data_8 fixups as R_SBF_64_ABS64
bool UseRelocAbs64;
// Not used for anything, just set by the static-syscalls marker feature.
bool HasStaticSyscalls;
// whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
bool UseDwarfRIS;
// Whether to disable the negate (neg) instruction
bool DisableNeg;
// Whether to consider 'sub reg, imm' as 'reg = imm - reg', instead of 'reg =
// reg - imm'.
bool ReverseSubImm;
// Whether we should use the LDDW instruction
bool NoLddw;
// Whether to encode destination register in Callx's src field
bool CallxRegSrc;
// Whether we have the PQR instruction class
bool HasPqrClass;
// Whether we have store imm instructions
bool HasStoreImm;
// Whether we have the explicit sign extension instruction (mov32)
bool HasExplicitSignExt;
// Whether we enable the new encoding for memory instructions
bool NewMemEncoding;
// Whether we are using AbiV2
bool IsAbiV2;
std::unique_ptr<CallLowering> CallLoweringInfo;
std::unique_ptr<InstructionSelector> InstSelector;
std::unique_ptr<LegalizerInfo> Legalizer;
std::unique_ptr<RegisterBankInfo> RegBankInfo;
public:
// This constructor initializes the data members to match that
// of the specified triple.
SBFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
const TargetMachine &TM);
SBFSubtarget &initializeSubtargetDependencies(const Triple &TT, 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 TuneCPU, StringRef FS);
bool getHasJmpExt() const { return HasJmpExt; }
bool getHasAlu32() const { return HasAlu32; }
bool getHasDynamicFrames() const { return HasDynamicFrames; }
bool getUseDwarfRIS() const { return UseDwarfRIS; }
bool getDisableNeg() const { return DisableNeg; }
bool getReverseSubImm() const { return ReverseSubImm; }
bool getNoLddw() const { return NoLddw; }
bool getCallXRegSrc() const { return CallxRegSrc; }
bool getHasPqrClass() const { return HasPqrClass; }
bool getHasStoreImm() const { return HasStoreImm; }
bool getHasExplicitSignExt() const { return HasExplicitSignExt; }
bool getNewMemEncoding() const { return NewMemEncoding; }
bool getHasStaticSyscalls() const { return HasStaticSyscalls; }
const SBFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
const SBFFrameLowering *getFrameLowering() const override {
return &FrameLowering;
}
const SBFTargetLowering *getTargetLowering() const override {
return &TLInfo;
}
const SBFSelectionDAGInfo *getSelectionDAGInfo() const override {
return &TSInfo;
}
const SBFRegisterInfo *getRegisterInfo() const override {
return &InstrInfo.getRegisterInfo();
}
};
} // namespace llvm
#endif