Skip to content

Commit ff48ce8

Browse files
committed
Xtensa
1 parent 48f06fe commit ff48ce8

File tree

8 files changed

+66
-64
lines changed

8 files changed

+66
-64
lines changed

llvm/lib/Target/Xtensa/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ tablegen(LLVM XtensaGenDisassemblerTables.inc -gen-disassembler)
1010
tablegen(LLVM XtensaGenInstrInfo.inc -gen-instr-info)
1111
tablegen(LLVM XtensaGenMCCodeEmitter.inc -gen-emitter)
1212
tablegen(LLVM XtensaGenRegisterInfo.inc -gen-register-info)
13+
tablegen(LLVM XtensaGenSDNodeInfo.inc -gen-sd-node-info)
1314
tablegen(LLVM XtensaGenSubtargetInfo.inc -gen-subtarget)
1415

1516
add_public_tablegen_target(XtensaCommonTableGen)
@@ -22,6 +23,7 @@ add_llvm_target(XtensaCodeGen
2223
XtensaISelDAGToDAG.cpp
2324
XtensaISelLowering.cpp
2425
XtensaRegisterInfo.cpp
26+
XtensaSelectionDAGInfo.cpp
2527
XtensaSubtarget.cpp
2628
XtensaTargetMachine.cpp
2729
XtensaUtils.cpp

llvm/lib/Target/Xtensa/XtensaISelDAGToDAG.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "Xtensa.h"
14+
#include "XtensaSelectionDAGInfo.h"
1415
#include "XtensaTargetMachine.h"
1516
#include "XtensaUtils.h"
1617
#include "llvm/CodeGen/MachineFunction.h"

llvm/lib/Target/Xtensa/XtensaISelLowering.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "XtensaConstantPoolValue.h"
1616
#include "XtensaInstrInfo.h"
1717
#include "XtensaMachineFunctionInfo.h"
18+
#include "XtensaSelectionDAGInfo.h"
1819
#include "XtensaSubtarget.h"
1920
#include "XtensaTargetMachine.h"
2021
#include "llvm/CodeGen/CallingConvLower.h"
@@ -1218,28 +1219,6 @@ SDValue XtensaTargetLowering::LowerOperation(SDValue Op,
12181219
}
12191220
}
12201221

1221-
const char *XtensaTargetLowering::getTargetNodeName(unsigned Opcode) const {
1222-
switch (Opcode) {
1223-
case XtensaISD::BR_JT:
1224-
return "XtensaISD::BR_JT";
1225-
case XtensaISD::CALL:
1226-
return "XtensaISD::CALL";
1227-
case XtensaISD::EXTUI:
1228-
return "XtensaISD::EXTUI";
1229-
case XtensaISD::PCREL_WRAPPER:
1230-
return "XtensaISD::PCREL_WRAPPER";
1231-
case XtensaISD::RET:
1232-
return "XtensaISD::RET";
1233-
case XtensaISD::SELECT_CC:
1234-
return "XtensaISD::SELECT_CC";
1235-
case XtensaISD::SRCL:
1236-
return "XtensaISD::SRCL";
1237-
case XtensaISD::SRCR:
1238-
return "XtensaISD::SRCR";
1239-
}
1240-
return nullptr;
1241-
}
1242-
12431222
//===----------------------------------------------------------------------===//
12441223
// Custom insertion
12451224
//===----------------------------------------------------------------------===//

llvm/lib/Target/Xtensa/XtensaISelLowering.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,6 @@
2020

2121
namespace llvm {
2222

23-
namespace XtensaISD {
24-
enum {
25-
FIRST_NUMBER = ISD::BUILTIN_OP_END,
26-
BR_JT,
27-
28-
// Calls a function. Operand 0 is the chain operand and operand 1
29-
// is the target address. The arguments start at operand 2.
30-
// There is an optional glue operand at the end.
31-
CALL,
32-
33-
// Extract unsigned immediate. Operand 0 is value, operand 1
34-
// is bit position of the field [0..31], operand 2 is bit size
35-
// of the field [1..16]
36-
EXTUI,
37-
38-
// Wraps a TargetGlobalAddress that should be loaded using PC-relative
39-
// accesses. Operand 0 is the address.
40-
PCREL_WRAPPER,
41-
RET,
42-
43-
// Select with condition operator - This selects between a true value and
44-
// a false value (ops #2 and #3) based on the boolean result of comparing
45-
// the lhs and rhs (ops #0 and #1) of a conditional expression with the
46-
// condition code in op #4
47-
SELECT_CC,
48-
49-
// SRCL(R) performs shift left(right) of the concatenation of 2 registers
50-
// and returns high(low) 32-bit part of 64-bit result
51-
SRCL,
52-
// Shift Right Combined
53-
SRCR,
54-
};
55-
}
56-
5723
class XtensaSubtarget;
5824

5925
class XtensaTargetLowering : public TargetLowering {
@@ -74,8 +40,6 @@ class XtensaTargetLowering : public TargetLowering {
7440

7541
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
7642

77-
const char *getTargetNodeName(unsigned Opcode) const override;
78-
7943
std::pair<unsigned, const TargetRegisterClass *>
8044
getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
8145
StringRef Constraint, MVT VT) const override;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===- XtensaSelectionDAGInfo.cpp -----------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "XtensaSelectionDAGInfo.h"
10+
11+
#define GET_SDNODE_DESC
12+
#include "XtensaGenSDNodeInfo.inc"
13+
14+
using namespace llvm;
15+
16+
XtensaSelectionDAGInfo::XtensaSelectionDAGInfo()
17+
: SelectionDAGGenTargetInfo(XtensaGenSDNodeInfo) {}
18+
19+
XtensaSelectionDAGInfo::~XtensaSelectionDAGInfo() = default;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===- XtensaSelectionDAGInfo.h ---------------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIB_TARGET_XTENSA_XTENSASELECTIONDAGINFO_H
10+
#define LLVM_LIB_TARGET_XTENSA_XTENSASELECTIONDAGINFO_H
11+
12+
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
13+
14+
#define GET_SDNODE_ENUM
15+
#include "XtensaGenSDNodeInfo.inc"
16+
17+
namespace llvm {
18+
19+
class XtensaSelectionDAGInfo : public SelectionDAGGenTargetInfo {
20+
public:
21+
XtensaSelectionDAGInfo();
22+
23+
~XtensaSelectionDAGInfo() override;
24+
};
25+
26+
} // namespace llvm
27+
28+
#endif // LLVM_LIB_TARGET_XTENSA_XTENSASELECTIONDAGINFO_H

llvm/lib/Target/Xtensa/XtensaSubtarget.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "XtensaSubtarget.h"
14+
#include "XtensaSelectionDAGInfo.h"
1415
#include "llvm/IR/GlobalValue.h"
1516
#include "llvm/Support/Debug.h"
1617

@@ -41,4 +42,12 @@ XtensaSubtarget::XtensaSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
4142
const TargetMachine &TM)
4243
: XtensaGenSubtargetInfo(TT, CPU, /*TuneCPU=*/CPU, FS), TargetTriple(TT),
4344
InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
44-
TSInfo(), FrameLowering(*this) {}
45+
FrameLowering(*this) {
46+
TSInfo = std::make_unique<SelectionDAGTargetInfo>();
47+
}
48+
49+
XtensaSubtarget::~XtensaSubtarget() = default;
50+
51+
const SelectionDAGTargetInfo *XtensaSubtarget::getSelectionDAGInfo() const {
52+
return TSInfo.get();
53+
}

llvm/lib/Target/Xtensa/XtensaSubtarget.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "XtensaISelLowering.h"
1818
#include "XtensaInstrInfo.h"
1919
#include "XtensaRegisterInfo.h"
20-
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
2120
#include "llvm/CodeGen/TargetSubtargetInfo.h"
2221
#include "llvm/IR/DataLayout.h"
2322
#include "llvm/Target/TargetMachine.h"
@@ -33,7 +32,7 @@ class XtensaSubtarget : public XtensaGenSubtargetInfo {
3332
const Triple &TargetTriple;
3433
XtensaInstrInfo InstrInfo;
3534
XtensaTargetLowering TLInfo;
36-
SelectionDAGTargetInfo TSInfo;
35+
std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;
3736
XtensaFrameLowering FrameLowering;
3837

3938
// Enabled Xtensa Density extension
@@ -45,6 +44,8 @@ class XtensaSubtarget : public XtensaGenSubtargetInfo {
4544
XtensaSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
4645
const TargetMachine &TM);
4746

47+
~XtensaSubtarget() override;
48+
4849
const Triple &getTargetTriple() const { return TargetTriple; }
4950

5051
const TargetFrameLowering *getFrameLowering() const override {
@@ -58,9 +59,8 @@ class XtensaSubtarget : public XtensaGenSubtargetInfo {
5859
const XtensaTargetLowering *getTargetLowering() const override {
5960
return &TLInfo;
6061
}
61-
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
62-
return &TSInfo;
63-
}
62+
63+
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;
6464

6565
bool hasDensity() const { return HasDensity; }
6666

0 commit comments

Comments
 (0)