@@ -87,6 +87,9 @@ CSKYTargetLowering::CSKYTargetLowering(const TargetMachine &TM,
87
87
setOperationAction (ISD::ExternalSymbol, MVT::i32 , Custom);
88
88
setOperationAction (ISD::GlobalTLSAddress, MVT::i32 , Custom);
89
89
setOperationAction (ISD::BlockAddress, MVT::i32 , Custom);
90
+ if (!Subtarget.hasE2 ()) {
91
+ setOperationAction (ISD::ConstantPool, MVT::i32 , Custom);
92
+ }
90
93
setOperationAction (ISD::JumpTable, MVT::i32 , Custom);
91
94
setOperationAction (ISD::VASTART, MVT::Other, Custom);
92
95
@@ -170,6 +173,8 @@ SDValue CSKYTargetLowering::LowerOperation(SDValue Op,
170
173
return LowerJumpTable (Op, DAG);
171
174
case ISD::BlockAddress:
172
175
return LowerBlockAddress (Op, DAG);
176
+ case ISD::ConstantPool:
177
+ return LowerConstantPool (Op, DAG);
173
178
case ISD::VASTART:
174
179
return LowerVASTART (Op, DAG);
175
180
case ISD::FRAMEADDR:
@@ -1058,12 +1063,24 @@ SDValue CSKYTargetLowering::getTargetConstantPoolValue(BlockAddressSDNode *N,
1058
1063
EVT Ty,
1059
1064
SelectionDAG &DAG,
1060
1065
unsigned Flags) const {
1066
+ assert (N->getOffset () == 0 );
1061
1067
CSKYConstantPoolValue *CPV = CSKYConstantPoolConstant::Create (
1062
1068
N->getBlockAddress (), CSKYCP::CPBlockAddress, 0 , getModifier (Flags),
1063
1069
false );
1064
1070
return DAG.getTargetConstantPool (CPV, Ty);
1065
1071
}
1066
1072
1073
+ SDValue CSKYTargetLowering::getTargetConstantPoolValue (ConstantPoolSDNode *N,
1074
+ EVT Ty,
1075
+ SelectionDAG &DAG,
1076
+ unsigned Flags) const {
1077
+ assert (N->getOffset () == 0 );
1078
+ CSKYConstantPoolValue *CPV = CSKYConstantPoolConstant::Create (
1079
+ N->getConstVal (), Type::getInt32Ty (*DAG.getContext ()),
1080
+ CSKYCP::CPConstPool, 0 , getModifier (Flags), false );
1081
+ return DAG.getTargetConstantPool (CPV, Ty);
1082
+ }
1083
+
1067
1084
SDValue CSKYTargetLowering::getTargetNode (GlobalAddressSDNode *N, SDLoc DL,
1068
1085
EVT Ty, SelectionDAG &DAG,
1069
1086
unsigned Flags) const {
@@ -1089,6 +1106,14 @@ SDValue CSKYTargetLowering::getTargetNode(BlockAddressSDNode *N, SDLoc DL,
1089
1106
Flags);
1090
1107
}
1091
1108
1109
+ SDValue CSKYTargetLowering::getTargetNode (ConstantPoolSDNode *N, SDLoc DL,
1110
+ EVT Ty, SelectionDAG &DAG,
1111
+ unsigned Flags) const {
1112
+
1113
+ return DAG.getTargetConstantPool (N->getConstVal (), Ty, N->getAlign (),
1114
+ N->getOffset (), Flags);
1115
+ }
1116
+
1092
1117
const char *CSKYTargetLowering::getTargetNodeName (unsigned Opcode) const {
1093
1118
switch (Opcode) {
1094
1119
default :
@@ -1158,6 +1183,14 @@ SDValue CSKYTargetLowering::LowerBlockAddress(SDValue Op,
1158
1183
return getAddr (N, DAG);
1159
1184
}
1160
1185
1186
+ SDValue CSKYTargetLowering::LowerConstantPool (SDValue Op,
1187
+ SelectionDAG &DAG) const {
1188
+ assert (!Subtarget.hasE2 ());
1189
+ ConstantPoolSDNode *N = cast<ConstantPoolSDNode>(Op);
1190
+
1191
+ return getAddr (N, DAG);
1192
+ }
1193
+
1161
1194
SDValue CSKYTargetLowering::LowerVASTART (SDValue Op, SelectionDAG &DAG) const {
1162
1195
MachineFunction &MF = DAG.getMachineFunction ();
1163
1196
CSKYMachineFunctionInfo *FuncInfo = MF.getInfo <CSKYMachineFunctionInfo>();
0 commit comments