Skip to content

Commit d0276b6

Browse files
committed
CSKY
1 parent 276ef73 commit d0276b6

File tree

7 files changed

+65
-53
lines changed

7 files changed

+65
-53
lines changed

llvm/lib/Target/CSKY/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ tablegen(LLVM CSKYGenInstrInfo.inc -gen-instr-info)
1212
tablegen(LLVM CSKYGenMCCodeEmitter.inc -gen-emitter)
1313
tablegen(LLVM CSKYGenMCPseudoLowering.inc -gen-pseudo-lowering)
1414
tablegen(LLVM CSKYGenRegisterInfo.inc -gen-register-info)
15+
tablegen(LLVM CSKYGenSDNodeInfo.inc -gen-sd-node-info)
1516
tablegen(LLVM CSKYGenSubtargetInfo.inc -gen-subtarget)
1617

1718
add_public_tablegen_target(CSKYCommonTableGen)
@@ -26,6 +27,7 @@ add_llvm_target(CSKYCodeGen
2627
CSKYISelLowering.cpp
2728
CSKYMCInstLower.cpp
2829
CSKYRegisterInfo.cpp
30+
CSKYSelectionDAGInfo.cpp
2931
CSKYSubtarget.cpp
3032
CSKYTargetMachine.cpp
3133
CSKYTargetObjectFile.cpp

llvm/lib/Target/CSKY/CSKYISelLowering.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,33 +1116,6 @@ SDValue CSKYTargetLowering::getTargetNode(ConstantPoolSDNode *N, SDLoc DL,
11161116
N->getOffset(), Flags);
11171117
}
11181118

1119-
const char *CSKYTargetLowering::getTargetNodeName(unsigned Opcode) const {
1120-
switch (Opcode) {
1121-
default:
1122-
llvm_unreachable("unknown CSKYISD node");
1123-
case CSKYISD::NIE:
1124-
return "CSKYISD::NIE";
1125-
case CSKYISD::NIR:
1126-
return "CSKYISD::NIR";
1127-
case CSKYISD::RET:
1128-
return "CSKYISD::RET";
1129-
case CSKYISD::CALL:
1130-
return "CSKYISD::CALL";
1131-
case CSKYISD::CALLReg:
1132-
return "CSKYISD::CALLReg";
1133-
case CSKYISD::TAIL:
1134-
return "CSKYISD::TAIL";
1135-
case CSKYISD::TAILReg:
1136-
return "CSKYISD::TAILReg";
1137-
case CSKYISD::LOAD_ADDR:
1138-
return "CSKYISD::LOAD_ADDR";
1139-
case CSKYISD::BITCAST_TO_LOHI:
1140-
return "CSKYISD::BITCAST_TO_LOHI";
1141-
case CSKYISD::BITCAST_FROM_LOHI:
1142-
return "CSKYISD::BITCAST_FROM_LOHI";
1143-
}
1144-
}
1145-
11461119
SDValue CSKYTargetLowering::LowerGlobalAddress(SDValue Op,
11471120
SelectionDAG &DAG) const {
11481121
SDLoc DL(Op);

llvm/lib/Target/CSKY/CSKYISelLowering.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,14 @@
1414
#ifndef LLVM_LIB_TARGET_CSKY_CSKYISELLOWERING_H
1515
#define LLVM_LIB_TARGET_CSKY_CSKYISELLOWERING_H
1616

17+
#include "CSKYSelectionDAGInfo.h"
1718
#include "MCTargetDesc/CSKYBaseInfo.h"
1819
#include "llvm/CodeGen/CallingConvLower.h"
1920
#include "llvm/CodeGen/TargetLowering.h"
2021

2122
namespace llvm {
2223
class CSKYSubtarget;
2324

24-
namespace CSKYISD {
25-
enum NodeType : unsigned {
26-
FIRST_NUMBER = ISD::BUILTIN_OP_END,
27-
NIE,
28-
NIR,
29-
RET,
30-
CALL,
31-
CALLReg,
32-
TAIL,
33-
TAILReg,
34-
LOAD_ADDR,
35-
// i32, i32 <-- f64
36-
BITCAST_TO_LOHI,
37-
// f64 < -- i32, i32
38-
BITCAST_FROM_LOHI,
39-
};
40-
}
41-
4225
class CSKYTargetLowering : public TargetLowering {
4326
const CSKYSubtarget &Subtarget;
4427

@@ -71,8 +54,6 @@ class CSKYTargetLowering : public TargetLowering {
7154
SDValue LowerCall(TargetLowering::CallLoweringInfo &CLI,
7255
SmallVectorImpl<SDValue> &InVals) const override;
7356

74-
const char *getTargetNodeName(unsigned Opcode) const override;
75-
7657
/// If a physical register, this returns the register that receives the
7758
/// exception address on entry to an EH pad.
7859
Register
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//===- CSKYSelectionDAGInfo.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 "CSKYSelectionDAGInfo.h"
10+
11+
#define GET_SDNODE_DESC
12+
#include "CSKYGenSDNodeInfo.inc"
13+
14+
using namespace llvm;
15+
16+
CSKYSelectionDAGInfo::CSKYSelectionDAGInfo()
17+
: SelectionDAGGenTargetInfo(CSKYGenSDNodeInfo) {}
18+
19+
CSKYSelectionDAGInfo::~CSKYSelectionDAGInfo() = default;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//===- CSKYSelectionDAGInfo.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_CSKY_CSKYSELECTIONDAGINFO_H
10+
#define LLVM_LIB_TARGET_CSKY_CSKYSELECTIONDAGINFO_H
11+
12+
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
13+
14+
#define GET_SDNODE_ENUM
15+
#include "CSKYGenSDNodeInfo.inc"
16+
17+
namespace llvm {
18+
19+
class CSKYSelectionDAGInfo : public SelectionDAGGenTargetInfo {
20+
public:
21+
CSKYSelectionDAGInfo();
22+
23+
~CSKYSelectionDAGInfo() override;
24+
};
25+
26+
} // namespace llvm
27+
28+
#endif // LLVM_LIB_TARGET_CSKY_CSKYSELECTIONDAGINFO_H

llvm/lib/Target/CSKY/CSKYSubtarget.cpp

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

1313
#include "CSKYSubtarget.h"
14+
#include "CSKYSelectionDAGInfo.h"
1415
#include "llvm/CodeGen/MachineFrameInfo.h"
1516

1617
using namespace llvm;
@@ -91,7 +92,15 @@ CSKYSubtarget::CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
9192
StringRef FS, const TargetMachine &TM)
9293
: CSKYGenSubtargetInfo(TT, CPU, TuneCPU, FS),
9394
FrameLowering(initializeSubtargetDependencies(TT, CPU, TuneCPU, FS)),
94-
InstrInfo(*this), RegInfo(), TLInfo(TM, *this) {}
95+
InstrInfo(*this), RegInfo(), TLInfo(TM, *this) {
96+
TSInfo = std::make_unique<CSKYSelectionDAGInfo>();
97+
}
98+
99+
CSKYSubtarget::~CSKYSubtarget() = default;
100+
101+
const SelectionDAGTargetInfo *CSKYSubtarget::getSelectionDAGInfo() const {
102+
return TSInfo.get();
103+
}
95104

96105
bool CSKYSubtarget::useHardFloatABI() const {
97106
auto FloatABI = getTargetLowering()->getTargetMachine().Options.FloatABIType;

llvm/lib/Target/CSKY/CSKYSubtarget.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "CSKYISelLowering.h"
1818
#include "CSKYInstrInfo.h"
1919
#include "CSKYRegisterInfo.h"
20-
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
2120
#include "llvm/CodeGen/TargetSubtargetInfo.h"
2221
#include "llvm/Target/TargetMachine.h"
2322

@@ -34,7 +33,7 @@ class CSKYSubtarget : public CSKYGenSubtargetInfo {
3433
CSKYInstrInfo InstrInfo;
3534
CSKYRegisterInfo RegInfo;
3635
CSKYTargetLowering TLInfo;
37-
SelectionDAGTargetInfo TSInfo;
36+
std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;
3837

3938
enum CSKYProcFamilyEnum {
4039
Others,
@@ -112,6 +111,8 @@ class CSKYSubtarget : public CSKYGenSubtargetInfo {
112111
CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
113112
StringRef FS, const TargetMachine &TM);
114113

114+
~CSKYSubtarget() override;
115+
115116
const CSKYFrameLowering *getFrameLowering() const override {
116117
return &FrameLowering;
117118
}
@@ -120,9 +121,8 @@ class CSKYSubtarget : public CSKYGenSubtargetInfo {
120121
const CSKYTargetLowering *getTargetLowering() const override {
121122
return &TLInfo;
122123
}
123-
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
124-
return &TSInfo;
125-
}
124+
125+
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;
126126

127127
/// Initializes using the passed in CPU and feature strings so that we can
128128
/// use initializer lists for subtarget initialization.

0 commit comments

Comments
 (0)