-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathAIE2PInstrInfo.h
More file actions
206 lines (169 loc) · 8.82 KB
/
AIE2PInstrInfo.h
File metadata and controls
206 lines (169 loc) · 8.82 KB
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//===-- AIE2PInstrInfo.h - AIE2p Instruction Information *- C++ -------*-===//
//
// This file is licensed 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
//
// (c) Copyright 2024-2026 Advanced Micro Devices, Inc. or its affiliates
//
//===----------------------------------------------------------------------===//
//
// This file contains the AIE2p implementation of the TargetInstrInfo
// class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AIE2P_AIE2PINSTRINFO_H
#define LLVM_LIB_TARGET_AIE2P_AIE2PINSTRINFO_H
#include "AIE2PRegisterInfo.h"
#include "AIEBaseInstrInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#define GET_INSTRINFO_HEADER
#include "AIE2PGenInstrInfo.inc"
namespace llvm {
class AIE2PInstrInfo : public AIE2PGenInstrInfo {
public:
AIE2PInstrInfo();
unsigned getReturnOpcode() const override;
unsigned getCallOpcode(const MachineFunction &CallerF, bool IsIndirect,
bool IsTailCall) const override;
unsigned getNopOpcode() const override;
unsigned getMvSclOpcode() const override;
unsigned getAddrIntrinsic2D() const override;
unsigned getAddrIntrinsic3D() const override;
unsigned getPtrAdd2DOpcode() const override;
unsigned getPtrAdd3DOpcode() const override;
unsigned getMvSclMultiSlotPseudoOpcode() const override;
unsigned getAddSclOpcode() const override;
unsigned getOppositeBranchOpcode(unsigned Opc) const override;
unsigned getJumpOpcode() const override;
unsigned getPseudoMoveOpcode() const override;
unsigned getConstantMovOpcode(MachineRegisterInfo &MRI, unsigned int Reg,
APInt &Val) const override;
unsigned getScalarMovOpcode(Register DstReg, Register SrcReg) const override;
unsigned getMoveToMSOpcode(MachineInstr &I,
unsigned ConstTLastVal) const override;
Register getSSStatusReg() const override;
Register getMSStatusReg() const override;
Register getPackSignCReg() const override;
Register getUnpackSignCReg() const override;
unsigned getCycleSeparatorOpcode() const override;
unsigned getGenericAddVectorEltOpcode() const override;
unsigned getGenericInsertVectorEltOpcode() const override;
unsigned getGenericExtractVectorEltOpcode(bool SignExt) const override;
unsigned getGenericPadVectorOpcode() const override;
unsigned getGenericUnpadVectorOpcode() const override;
unsigned getGenericBroadcastVectorOpcode() const override;
unsigned getGenericVSelOpcode() const override;
unsigned getGenericVShiftOpcode() const override;
unsigned getGenericShuffleVectorOpcode() const override;
unsigned getGenericExtractSubvectorOpcode() const override;
unsigned getGenericIntegerComparisonOpcode() const override;
bool isLock(unsigned Opc) const override;
bool hasLockNoFenceSemantics() const override { return true; }
std::optional<unsigned> getDoneLatency(unsigned) const override;
bool isDelayedSchedBarrier(const MachineInstr &MI) const override;
bool isSchedBarrier(const MachineInstr &MI) const override;
unsigned getScalarRegSize() const override;
unsigned getBasicVecRegSize() const override;
unsigned getBasicVectorBitSize() const override;
unsigned getMaxVectorBitSize() const override;
unsigned getMaxSupportedLdStIncSize() const override;
virtual unsigned
getNumReservedDelaySlots(const MachineInstr &MI) const override;
unsigned getMachineBlockAlignmentBytes() const override { return 16; }
bool isJNZ(unsigned Opc) const override;
bool isJZ(unsigned Opc) const override;
bool isCall(unsigned Opc) const override;
bool jumpsToUnknown(unsigned Opcode) const override;
bool isIConst(unsigned Opc) const override;
bool isBooleanNoOp(unsigned Opc) const override;
bool isBooleanNot(unsigned Opc) const override;
bool isConstStep(const MachineInstr &MI, int64_t &Step) const override;
bool isGenericOffsetMemOpcode(unsigned Opcode) const override;
bool isFifoStoreConvOpcode(unsigned Opcode) const override;
bool verifyGenericInstruction(const MachineInstr &MI,
StringRef &ErrInfo) const override;
bool verifyMemOperand(const MachineInstr &MI,
StringRef &ErrInfo) const override;
unsigned getOffsetMemOpcode(unsigned BaseMemOpcode) const override;
std::optional<unsigned>
getCombinedPostIncOpcode(MachineInstr &BaseMemI, MachineInstr &PtrAddI,
TypeSize Size) const override;
std::optional<unsigned>
getStoreFlushConvOpcode(unsigned StoreFlushOpcode) const override;
unsigned getOpCode(MachineInstr &MI) const override;
Register getVaddSignControlRegister() const override;
Register getUPSModeControlRegister() const override;
Register getUPSSignControlRegister() const override;
virtual std::optional<ZOLSupport> getZOLSupport() const override;
virtual std::optional<JNZDSupport> getJNZDSupport() const override;
virtual std::optional<IfConvSupport> getIfConvSupport() const override;
bool isOffsetInImmediateRange(unsigned Opcode, unsigned LoadStoreSize,
std::optional<APInt> Immediate) const override;
unsigned getNumBypassedCycles(const InstrItineraryData *ItinData,
const MachineInstr &DefMI, unsigned DefIdx,
const MachineInstr &UseMI,
unsigned UseIdx) const override;
std::optional<int> getFirstMemoryCycle(unsigned SchedClass) const override;
std::optional<int> getLastMemoryCycle(unsigned SchedClass) const override;
int getMinFirstMemoryCycle() const override;
int getMaxFirstMemoryCycle() const override;
int getMinLastMemoryCycle() const override;
int getMaxLastMemoryCycle() const override;
SmallVector<int, 2> getMemoryCycles(unsigned SchedClass) const override;
virtual unsigned
getSchedClass(const MCInstrDesc &Desc,
iterator_range<const MachineOperand *> Operands,
const MachineRegisterInfo &MRI) const override;
SmallVector<TiedRegOperands, 4>
getTiedRegInfo(unsigned Opcode) const override;
std::optional<unsigned>
getOpcodeWithAtomicOperands(unsigned Opcode) const override;
TiedRegOperands getTiedRegInfoForSplitting(unsigned Opcode) const override;
std::optional<unsigned>
getOpcodeWithTupleOperands(unsigned Opcode) const override;
std::optional<PseudoBranchExpandInfo>
getPseudoBranchExpandInfo(const MachineInstr &MI) const override;
/// Allocate and return a hazard recognizer to use for this target when
/// scheduling the machine instructions after register allocation.
ScheduleHazardRecognizer *
CreateTargetPostRAHazardRecognizer(const InstrItineraryData *II,
const ScheduleDAG *DAG) const override;
ScheduleHazardRecognizer *
CreateTargetMIHazardRecognizer(const InstrItineraryData *II,
const ScheduleDAGMI *DAG) const override;
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
const DebugLoc &DL, MCRegister DstReg, MCRegister SrcReg,
bool KillSrc, bool RenamableDest = false,
bool RenamableSrc = false) const override;
void storeRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI, Register SrcReg,
bool IsKill, int FrameIndex,
const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI, Register VReg,
MachineInstr::MIFlag Flags) const override;
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI, Register DstReg,
int FrameIndex, const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI, Register VReg,
MachineInstr::MIFlag Flags) const override;
bool expandPostRAPseudo(MachineInstr &MI) const override;
// Implement MIR serialization of target flags
std::pair<unsigned, unsigned>
decomposeMachineOperandsTargetFlags(unsigned TF) const override;
ArrayRef<std::pair<unsigned, const char *>>
getSerializableDirectMachineOperandTargetFlags() const override;
bool canHoistCheapInst(const MachineInstr &MI) const override;
std::optional<const AbstractOp>
parseAbstractOp(const MachineInstr &MI) const override;
protected:
SmallVector<AIEPseudoExpandInfo, 4>
getSpillPseudoExpandInfo(const TargetRegisterInfo &TRI,
MachineInstr &MI) const override;
SmallVector<AIEPseudoExpandInfo, 4>
getSpillPseudoExpandInfoByOpcode(unsigned Opcode) const override;
AIERegOffsetSpillInstrInfo
getRegOffsetSpillInstrInfoFromImmOffset(const unsigned Opcode) const override;
};
} // namespace llvm
#endif