-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0003-Xtensa-Add-Constant-Pool.patch
556 lines (552 loc) · 20.2 KB
/
0003-Xtensa-Add-Constant-Pool.patch
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
From af9decfa15a25c63dd6bba619e4b8d2caeef8b92 Mon Sep 17 00:00:00 2001
From: Andrei Safronov <[email protected]>
Date: Wed, 5 Apr 2023 00:58:37 +0300
Subject: [PATCH 003/158] [Xtensa] Add Constant Pool
---
llvm/lib/Target/Xtensa/CMakeLists.txt | 1 +
.../Target/Xtensa/XtensaConstantPoolValue.cpp | 234 +++++++++++++++
.../Target/Xtensa/XtensaConstantPoolValue.h | 282 ++++++++++++++++++
3 files changed, 517 insertions(+)
create mode 100644 llvm/lib/Target/Xtensa/XtensaConstantPoolValue.cpp
create mode 100644 llvm/lib/Target/Xtensa/XtensaConstantPoolValue.h
diff --git a/llvm/lib/Target/Xtensa/CMakeLists.txt b/llvm/lib/Target/Xtensa/CMakeLists.txt
index bb1e09cb0652..d4300678a043 100644
--- a/llvm/lib/Target/Xtensa/CMakeLists.txt
+++ b/llvm/lib/Target/Xtensa/CMakeLists.txt
@@ -16,6 +16,7 @@ add_public_tablegen_target(XtensaCommonTableGen)
add_llvm_target(XtensaCodeGen
XtensaAsmPrinter.cpp
+ XtensaConstantPoolValue.cpp
XtensaFrameLowering.cpp
XtensaInstrInfo.cpp
XtensaISelDAGToDAG.cpp
diff --git a/llvm/lib/Target/Xtensa/XtensaConstantPoolValue.cpp b/llvm/lib/Target/Xtensa/XtensaConstantPoolValue.cpp
new file mode 100644
index 000000000000..b7502eabbf71
--- /dev/null
+++ b/llvm/lib/Target/Xtensa/XtensaConstantPoolValue.cpp
@@ -0,0 +1,234 @@
+//===- XtensaConstantPoolValue.cpp - Xtensa constantpool value ------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// 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 implements the Xtensa specific constantpool value class.
+//
+//===----------------------------------------------------------------------===//
+
+#include "XtensaConstantPoolValue.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/IR/Constant.h"
+#include "llvm/IR/Constants.h"
+#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/Type.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstdlib>
+using namespace llvm;
+
+XtensaConstantPoolValue::XtensaConstantPoolValue(
+ Type *Ty, unsigned id, XtensaCP::XtensaCPKind kind, bool addCurrentAddress,
+ XtensaCP::XtensaCPModifier modifier)
+ : MachineConstantPoolValue(Ty), LabelId(id), Kind(kind), Modifier(modifier),
+ AddCurrentAddress(addCurrentAddress) {}
+
+XtensaConstantPoolValue::XtensaConstantPoolValue(
+ LLVMContext &C, unsigned id, XtensaCP::XtensaCPKind kind,
+ bool addCurrentAddress, XtensaCP::XtensaCPModifier modifier)
+ : MachineConstantPoolValue((Type *)Type::getInt32Ty(C)), LabelId(id),
+ Kind(kind), Modifier(modifier), AddCurrentAddress(addCurrentAddress) {}
+
+XtensaConstantPoolValue::~XtensaConstantPoolValue() {}
+
+StringRef XtensaConstantPoolValue::getModifierText() const {
+ switch (Modifier) {
+ case XtensaCP::no_modifier:
+ return "";
+ case XtensaCP::TPOFF:
+ return "@TPOFF";
+ }
+ llvm_unreachable("Unknown modifier!");
+}
+
+int XtensaConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) {
+ llvm_unreachable("Shouldn't be calling this directly!");
+}
+
+void XtensaConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
+ ID.AddInteger(LabelId);
+}
+
+bool XtensaConstantPoolValue::hasSameValue(XtensaConstantPoolValue *ACPV) {
+ if (ACPV->Kind == Kind) {
+ if (ACPV->LabelId == LabelId)
+ return true;
+ // Two PC relative constpool entries containing the same GV address or
+ // external symbols. FIXME: What about blockaddress?
+ if (Kind == XtensaCP::CPValue || Kind == XtensaCP::CPExtSymbol)
+ return true;
+ }
+ return false;
+}
+
+void XtensaConstantPoolValue::dump() const { errs() << " " << *this; }
+
+void XtensaConstantPoolValue::print(raw_ostream &O) const {}
+
+//===----------------------------------------------------------------------===//
+// XtensaConstantPoolConstant
+//===----------------------------------------------------------------------===//
+
+XtensaConstantPoolConstant::XtensaConstantPoolConstant(
+ Type *Ty, const Constant *C, unsigned ID, XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress)
+ : XtensaConstantPoolValue((Type *)C->getType(), ID, Kind,
+ AddCurrentAddress),
+ CVal(C) {}
+
+XtensaConstantPoolConstant::XtensaConstantPoolConstant(
+ const Constant *C, unsigned ID, XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress)
+ : XtensaConstantPoolValue((Type *)C->getType(), ID, Kind,
+ AddCurrentAddress),
+ CVal(C) {}
+
+XtensaConstantPoolConstant *
+XtensaConstantPoolConstant::Create(const Constant *C, unsigned ID,
+ XtensaCP::XtensaCPKind Kind) {
+ return new XtensaConstantPoolConstant(C, ID, Kind, false);
+}
+
+XtensaConstantPoolConstant *
+XtensaConstantPoolConstant::Create(const Constant *C, unsigned ID,
+ XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress) {
+ return new XtensaConstantPoolConstant(C, ID, Kind, AddCurrentAddress);
+}
+
+const GlobalValue *XtensaConstantPoolConstant::getGV() const {
+ return dyn_cast_or_null<GlobalValue>(CVal);
+}
+
+const BlockAddress *XtensaConstantPoolConstant::getBlockAddress() const {
+ return dyn_cast_or_null<BlockAddress>(CVal);
+}
+
+int XtensaConstantPoolConstant::getExistingMachineCPValue(
+ MachineConstantPool *CP, Align Alignment) {
+ return getExistingMachineCPValueImpl<XtensaConstantPoolConstant>(CP,
+ Alignment);
+}
+
+bool XtensaConstantPoolConstant::hasSameValue(XtensaConstantPoolValue *ACPV) {
+ const XtensaConstantPoolConstant *ACPC =
+ dyn_cast<XtensaConstantPoolConstant>(ACPV);
+ return ACPC && ACPC->CVal == CVal &&
+ XtensaConstantPoolValue::hasSameValue(ACPV);
+}
+
+void XtensaConstantPoolConstant::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
+ ID.AddPointer(CVal);
+ XtensaConstantPoolValue::addSelectionDAGCSEId(ID);
+}
+
+void XtensaConstantPoolConstant::print(raw_ostream &O) const {
+ O << CVal->getName();
+ XtensaConstantPoolValue::print(O);
+}
+
+XtensaConstantPoolSymbol::XtensaConstantPoolSymbol(
+ LLVMContext &C, const char *s, unsigned id, bool AddCurrentAddress,
+ bool PrivLinkage, XtensaCP::XtensaCPModifier Modifier)
+ : XtensaConstantPoolValue(C, id, XtensaCP::CPExtSymbol, AddCurrentAddress,
+ Modifier),
+ S(s), PrivateLinkage(PrivLinkage) {}
+
+XtensaConstantPoolSymbol *
+XtensaConstantPoolSymbol::Create(LLVMContext &C, const char *s, unsigned ID,
+ bool PrivLinkage,
+ XtensaCP::XtensaCPModifier Modifier)
+
+{
+ return new XtensaConstantPoolSymbol(C, s, ID, false, PrivLinkage, Modifier);
+}
+
+int XtensaConstantPoolSymbol::getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) {
+ return getExistingMachineCPValueImpl<XtensaConstantPoolSymbol>(CP, Alignment);
+}
+
+bool XtensaConstantPoolSymbol::hasSameValue(XtensaConstantPoolValue *ACPV) {
+ const XtensaConstantPoolSymbol *ACPS =
+ dyn_cast<XtensaConstantPoolSymbol>(ACPV);
+ return ACPS && ACPS->S == S && XtensaConstantPoolValue::hasSameValue(ACPV);
+}
+
+void XtensaConstantPoolSymbol::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
+ ID.AddString(S);
+ XtensaConstantPoolValue::addSelectionDAGCSEId(ID);
+}
+
+void XtensaConstantPoolSymbol::print(raw_ostream &O) const {
+ O << S;
+ XtensaConstantPoolValue::print(O);
+}
+
+XtensaConstantPoolMBB::XtensaConstantPoolMBB(LLVMContext &C,
+ const MachineBasicBlock *mbb,
+ unsigned id)
+ : XtensaConstantPoolValue(C, 0, XtensaCP::CPMachineBasicBlock, false),
+ MBB(mbb) {}
+
+XtensaConstantPoolMBB *
+XtensaConstantPoolMBB::Create(LLVMContext &C, const MachineBasicBlock *mbb,
+ unsigned idx) {
+ return new XtensaConstantPoolMBB(C, mbb, idx);
+}
+
+int XtensaConstantPoolMBB::getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) {
+ return getExistingMachineCPValueImpl<XtensaConstantPoolMBB>(CP, Alignment);
+}
+
+bool XtensaConstantPoolMBB::hasSameValue(XtensaConstantPoolValue *ACPV) {
+ const XtensaConstantPoolMBB *ACPMBB = dyn_cast<XtensaConstantPoolMBB>(ACPV);
+ return ACPMBB && ACPMBB->MBB == MBB &&
+ XtensaConstantPoolValue::hasSameValue(ACPV);
+}
+
+void XtensaConstantPoolMBB::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
+ ID.AddPointer(MBB);
+ XtensaConstantPoolValue::addSelectionDAGCSEId(ID);
+}
+
+void XtensaConstantPoolMBB::print(raw_ostream &O) const {
+ O << "BB#" << MBB->getNumber();
+ XtensaConstantPoolValue::print(O);
+}
+
+XtensaConstantPoolJumpTable::XtensaConstantPoolJumpTable(LLVMContext &C,
+ unsigned idx)
+ : XtensaConstantPoolValue(C, 0, XtensaCP::CPJumpTable, false), IDX(idx) {}
+
+XtensaConstantPoolJumpTable *XtensaConstantPoolJumpTable::Create(LLVMContext &C,
+ unsigned idx) {
+ return new XtensaConstantPoolJumpTable(C, idx);
+}
+
+int XtensaConstantPoolJumpTable::getExistingMachineCPValue(
+ MachineConstantPool *CP, Align Alignment) {
+ return getExistingMachineCPValueImpl<XtensaConstantPoolJumpTable>(CP,
+ Alignment);
+}
+
+bool XtensaConstantPoolJumpTable::hasSameValue(XtensaConstantPoolValue *ACPV) {
+ const XtensaConstantPoolJumpTable *ACPJT =
+ dyn_cast<XtensaConstantPoolJumpTable>(ACPV);
+ return ACPJT && ACPJT->IDX == IDX &&
+ XtensaConstantPoolValue::hasSameValue(ACPV);
+}
+
+void XtensaConstantPoolJumpTable::addSelectionDAGCSEId(FoldingSetNodeID &ID) {}
+
+void XtensaConstantPoolJumpTable::print(raw_ostream &O) const {
+ O << "JT" << IDX;
+ XtensaConstantPoolValue::print(O);
+}
diff --git a/llvm/lib/Target/Xtensa/XtensaConstantPoolValue.h b/llvm/lib/Target/Xtensa/XtensaConstantPoolValue.h
new file mode 100644
index 000000000000..c201508ceea4
--- /dev/null
+++ b/llvm/lib/Target/Xtensa/XtensaConstantPoolValue.h
@@ -0,0 +1,282 @@
+//===- XtensaConstantPoolValue.h - Xtensa constantpool value ----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// 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 implements the Xtensa specific constantpool value class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_TARGET_XTENSA_XTENSACONSTANTPOOLVALUE_H
+#define LLVM_LIB_TARGET_XTENSA_XTENSACONSTANTPOOLVALUE_H
+
+#include "llvm/CodeGen/MachineConstantPool.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <cstddef>
+#include <string>
+#include <vector>
+
+namespace llvm {
+
+class BlockAddress;
+class Constant;
+class GlobalValue;
+class LLVMContext;
+class MachineBasicBlock;
+
+namespace XtensaCP {
+enum XtensaCPKind {
+ CPValue,
+ CPExtSymbol,
+ CPBlockAddress,
+ CPMachineBasicBlock,
+ CPJumpTable
+};
+
+enum XtensaCPModifier {
+ no_modifier, // None
+ TPOFF // Thread Pointer Offset
+};
+} // namespace XtensaCP
+
+/// XtensaConstantPoolValue - Xtensa specific constantpool value. This is used
+/// to represent PC-relative displacement between the address of the load
+/// instruction and the constant being loaded, i.e. (&GV-(LPIC+8)).
+class XtensaConstantPoolValue : public MachineConstantPoolValue {
+ unsigned LabelId; // Label id of the load.
+ XtensaCP::XtensaCPKind Kind; // Kind of constant.
+ XtensaCP::XtensaCPModifier Modifier; // GV modifier
+ bool AddCurrentAddress;
+
+protected:
+ XtensaConstantPoolValue(
+ Type *Ty, unsigned id, XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress,
+ XtensaCP::XtensaCPModifier Modifier = XtensaCP::no_modifier);
+
+ XtensaConstantPoolValue(
+ LLVMContext &C, unsigned id, XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress,
+ XtensaCP::XtensaCPModifier Modifier = XtensaCP::no_modifier);
+
+ template <typename Derived>
+ int getExistingMachineCPValueImpl(MachineConstantPool *CP,
+ Align Alignment) {
+ const std::vector<MachineConstantPoolEntry> &Constants = CP->getConstants();
+ for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
+ if (Constants[i].isMachineConstantPoolEntry() &&
+ (Constants[i].getAlign() >= Alignment)) {
+ XtensaConstantPoolValue *CPV =
+ (XtensaConstantPoolValue *)Constants[i].Val.MachineCPVal;
+ if (Derived *APC = dyn_cast<Derived>(CPV))
+ if (cast<Derived>(this)->equals(APC))
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+public:
+ ~XtensaConstantPoolValue() override;
+
+ XtensaCP::XtensaCPModifier getModifier() const { return Modifier; }
+ bool hasModifier() const { return Modifier != XtensaCP::no_modifier; }
+ StringRef getModifierText() const;
+
+ bool mustAddCurrentAddress() const { return AddCurrentAddress; }
+
+ unsigned getLabelId() const { return LabelId; }
+ void setLabelId(unsigned id) { LabelId = id; }
+
+ bool isGlobalValue() const { return Kind == XtensaCP::CPValue; }
+ bool isExtSymbol() const { return Kind == XtensaCP::CPExtSymbol; }
+ bool isBlockAddress() const { return Kind == XtensaCP::CPBlockAddress; }
+ bool isMachineBasicBlock() const {
+ return Kind == XtensaCP::CPMachineBasicBlock;
+ }
+ bool isJumpTable() const { return Kind == XtensaCP::CPJumpTable; }
+
+ int getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) override;
+
+ void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
+
+ /// hasSameValue - Return true if this Xtensa constpool value can share the
+ /// same constantpool entry as another Xtensa constpool value.
+ virtual bool hasSameValue(XtensaConstantPoolValue *ACPV);
+
+ bool equals(const XtensaConstantPoolValue *A) const {
+ return this->LabelId == A->LabelId && this->Modifier == A->Modifier;
+ }
+
+ void print(raw_ostream &O) const override;
+ void print(raw_ostream *O) const {
+ if (O)
+ print(*O);
+ }
+ void dump() const;
+};
+
+inline raw_ostream &operator<<(raw_ostream &O,
+ const XtensaConstantPoolValue &V) {
+ V.print(O);
+ return O;
+}
+
+/// XtensaConstantPoolConstant - Xtensa-specific constant pool values for
+/// Constants, Functions, and BlockAddresses.
+class XtensaConstantPoolConstant : public XtensaConstantPoolValue {
+ const Constant *CVal; // Constant being loaded.
+
+ XtensaConstantPoolConstant(const Constant *C, unsigned ID,
+ XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress);
+ XtensaConstantPoolConstant(Type *Ty, const Constant *C, unsigned ID,
+ XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress);
+
+public:
+ static XtensaConstantPoolConstant *Create(const Constant *C, unsigned ID,
+ XtensaCP::XtensaCPKind Kind);
+ static XtensaConstantPoolConstant *Create(const Constant *C, unsigned ID,
+ XtensaCP::XtensaCPKind Kind,
+ bool AddCurrentAddress);
+
+ const GlobalValue *getGV() const;
+ const BlockAddress *getBlockAddress() const;
+
+ int getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) override;
+
+ /// hasSameValue - Return true if this Xtensa constpool value can share the
+ /// same constantpool entry as another Xtensa constpool value.
+ bool hasSameValue(XtensaConstantPoolValue *ACPV) override;
+
+ void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
+
+ void print(raw_ostream &O) const override;
+ static bool classof(const XtensaConstantPoolValue *APV) {
+ return APV->isGlobalValue() || APV->isBlockAddress();
+ }
+
+ bool equals(const XtensaConstantPoolConstant *A) const {
+ return CVal == A->CVal && XtensaConstantPoolValue::equals(A);
+ }
+};
+
+/// XtensaConstantPoolSymbol - Xtensa-specific constantpool values for external
+/// symbols.
+class XtensaConstantPoolSymbol : public XtensaConstantPoolValue {
+ const std::string S; // ExtSymbol being loaded.
+ bool PrivateLinkage;
+
+ XtensaConstantPoolSymbol(
+ LLVMContext &C, const char *s, unsigned id, bool AddCurrentAddress,
+ bool PrivLinkage,
+ XtensaCP::XtensaCPModifier Modifier = XtensaCP::no_modifier);
+
+public:
+ static XtensaConstantPoolSymbol *
+ Create(LLVMContext &C, const char *s, unsigned ID, bool PrivLinkage,
+ XtensaCP::XtensaCPModifier Modifier = XtensaCP::no_modifier);
+
+ const char *getSymbol() const { return S.c_str(); }
+
+ int getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) override;
+
+ void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
+
+ /// hasSameValue - Return true if this Xtensa constpool value can share the
+ /// same constantpool entry as another Xtensa constpool value.
+ bool hasSameValue(XtensaConstantPoolValue *ACPV) override;
+
+ bool isPrivateLinkage() { return PrivateLinkage; }
+
+ void print(raw_ostream &O) const override;
+
+ static bool classof(const XtensaConstantPoolValue *ACPV) {
+ return ACPV->isExtSymbol();
+ }
+
+ bool equals(const XtensaConstantPoolSymbol *A) const {
+ return S == A->S && XtensaConstantPoolValue::equals(A);
+ }
+};
+
+/// XtensaConstantPoolMBB - Xtensa-specific constantpool value of a machine
+/// basic block.
+class XtensaConstantPoolMBB : public XtensaConstantPoolValue {
+ const MachineBasicBlock *MBB; // Machine basic block.
+
+ XtensaConstantPoolMBB(LLVMContext &C, const MachineBasicBlock *mbb,
+ unsigned id);
+
+public:
+ static XtensaConstantPoolMBB *
+ Create(LLVMContext &C, const MachineBasicBlock *mbb, unsigned ID);
+
+ const MachineBasicBlock *getMBB() const { return MBB; }
+
+ int getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) override;
+
+ void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
+
+ /// hasSameValue - Return true if this Xtensa constpool value can share the
+ /// same constantpool entry as another Xtensa constpool value.
+ bool hasSameValue(XtensaConstantPoolValue *ACPV) override;
+
+ void print(raw_ostream &O) const override;
+
+ static bool classof(const XtensaConstantPoolValue *ACPV) {
+ return ACPV->isMachineBasicBlock();
+ }
+
+ bool equals(const XtensaConstantPoolMBB *A) const {
+ return MBB == A->MBB && XtensaConstantPoolValue::equals(A);
+ }
+};
+
+/// XtensaConstantPoolJumpTable - Xtensa-specific constantpool values for Jump
+/// Table symbols.
+class XtensaConstantPoolJumpTable : public XtensaConstantPoolValue {
+ unsigned IDX; // Jump Table Index.
+
+ XtensaConstantPoolJumpTable(LLVMContext &C, unsigned idx);
+
+public:
+ static XtensaConstantPoolJumpTable *Create(LLVMContext &C, unsigned idx);
+
+ unsigned getIndex() const { return IDX; }
+
+ int getExistingMachineCPValue(MachineConstantPool *CP,
+ Align Alignment) override;
+
+ void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
+
+ /// hasSameValue - Return true if this Xtensa constpool value can share the
+ /// same constantpool entry as another Xtensa constpool value.
+ bool hasSameValue(XtensaConstantPoolValue *ACPV) override;
+
+ void print(raw_ostream &O) const override;
+
+ static bool classof(const XtensaConstantPoolValue *ACPV) {
+ return ACPV->isJumpTable();
+ }
+
+ bool equals(const XtensaConstantPoolJumpTable *A) const {
+ return IDX == A->IDX && XtensaConstantPoolValue::equals(A);
+ }
+};
+
+} // namespace llvm
+
+#endif /* LLVM_LIB_TARGET_XTENSA_XTENSACONSTANTPOOLVALUE_H */
--
2.40.1