Skip to content

Commit cacdf3b

Browse files
committed
[VE] Remove CodeGen deps from MCTargetDesc, NFC
See issue #64166 for more information about the layering issue.
1 parent 52abac2 commit cacdf3b

File tree

2 files changed

+90
-92
lines changed

2 files changed

+90
-92
lines changed

llvm/lib/Target/VE/VE.h

-92
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
#include "MCTargetDesc/VEMCTargetDesc.h"
1818
#include "llvm/ADT/StringSwitch.h"
19-
#include "llvm/CodeGen/ISDOpcodes.h"
20-
#include "llvm/CodeGen/SelectionDAGNodes.h"
2119
#include "llvm/Support/ErrorHandling.h"
2220
#include "llvm/Target/TargetMachine.h"
2321

@@ -204,80 +202,6 @@ inline static unsigned VECondCodeToVal(VECC::CondCode CC) {
204202
}
205203
}
206204

207-
/// Convert a DAG integer condition code to a VE ICC condition.
208-
inline static VECC::CondCode intCondCode2Icc(ISD::CondCode CC) {
209-
switch (CC) {
210-
default:
211-
llvm_unreachable("Unknown integer condition code!");
212-
case ISD::SETEQ:
213-
return VECC::CC_IEQ;
214-
case ISD::SETNE:
215-
return VECC::CC_INE;
216-
case ISD::SETLT:
217-
return VECC::CC_IL;
218-
case ISD::SETGT:
219-
return VECC::CC_IG;
220-
case ISD::SETLE:
221-
return VECC::CC_ILE;
222-
case ISD::SETGE:
223-
return VECC::CC_IGE;
224-
case ISD::SETULT:
225-
return VECC::CC_IL;
226-
case ISD::SETULE:
227-
return VECC::CC_ILE;
228-
case ISD::SETUGT:
229-
return VECC::CC_IG;
230-
case ISD::SETUGE:
231-
return VECC::CC_IGE;
232-
}
233-
}
234-
235-
/// Convert a DAG floating point condition code to a VE FCC condition.
236-
inline static VECC::CondCode fpCondCode2Fcc(ISD::CondCode CC) {
237-
switch (CC) {
238-
default:
239-
llvm_unreachable("Unknown fp condition code!");
240-
case ISD::SETFALSE:
241-
return VECC::CC_AF;
242-
case ISD::SETEQ:
243-
case ISD::SETOEQ:
244-
return VECC::CC_EQ;
245-
case ISD::SETNE:
246-
case ISD::SETONE:
247-
return VECC::CC_NE;
248-
case ISD::SETLT:
249-
case ISD::SETOLT:
250-
return VECC::CC_L;
251-
case ISD::SETGT:
252-
case ISD::SETOGT:
253-
return VECC::CC_G;
254-
case ISD::SETLE:
255-
case ISD::SETOLE:
256-
return VECC::CC_LE;
257-
case ISD::SETGE:
258-
case ISD::SETOGE:
259-
return VECC::CC_GE;
260-
case ISD::SETO:
261-
return VECC::CC_NUM;
262-
case ISD::SETUO:
263-
return VECC::CC_NAN;
264-
case ISD::SETUEQ:
265-
return VECC::CC_EQNAN;
266-
case ISD::SETUNE:
267-
return VECC::CC_NENAN;
268-
case ISD::SETULT:
269-
return VECC::CC_LNAN;
270-
case ISD::SETUGT:
271-
return VECC::CC_GNAN;
272-
case ISD::SETULE:
273-
return VECC::CC_LENAN;
274-
case ISD::SETUGE:
275-
return VECC::CC_GENAN;
276-
case ISD::SETTRUE:
277-
return VECC::CC_AT;
278-
}
279-
}
280-
281205
inline static VECC::CondCode VEValToCondCode(unsigned Val, bool IsInteger) {
282206
if (IsInteger) {
283207
switch (Val) {
@@ -402,22 +326,6 @@ inline static VERD::RoundingMode VEValToRD(unsigned Val) {
402326
llvm_unreachable("Invalid branch predicates");
403327
}
404328

405-
/// getImmVal - get immediate representation of integer value
406-
inline static uint64_t getImmVal(const ConstantSDNode *N) {
407-
return N->getSExtValue();
408-
}
409-
410-
/// getFpImmVal - get immediate representation of floating point value
411-
inline static uint64_t getFpImmVal(const ConstantFPSDNode *N) {
412-
const APInt &Imm = N->getValueAPF().bitcastToAPInt();
413-
uint64_t Val = Imm.getZExtValue();
414-
if (Imm.getBitWidth() == 32) {
415-
// Immediate value of float place places at higher bits on VE.
416-
Val <<= 32;
417-
}
418-
return Val;
419-
}
420-
421329
// MImm - Special immediate value of sequential bit stream of 0 or 1.
422330
// See VEInstrInfo.td for details.
423331
inline static bool isMImmVal(uint64_t Val) {

llvm/lib/Target/VE/VEISelLowering.h

+90
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,96 @@ enum NodeType : unsigned {
6565
};
6666
}
6767

68+
/// Convert a DAG integer condition code to a VE ICC condition.
69+
inline static VECC::CondCode intCondCode2Icc(ISD::CondCode CC) {
70+
switch (CC) {
71+
default:
72+
llvm_unreachable("Unknown integer condition code!");
73+
case ISD::SETEQ:
74+
return VECC::CC_IEQ;
75+
case ISD::SETNE:
76+
return VECC::CC_INE;
77+
case ISD::SETLT:
78+
return VECC::CC_IL;
79+
case ISD::SETGT:
80+
return VECC::CC_IG;
81+
case ISD::SETLE:
82+
return VECC::CC_ILE;
83+
case ISD::SETGE:
84+
return VECC::CC_IGE;
85+
case ISD::SETULT:
86+
return VECC::CC_IL;
87+
case ISD::SETULE:
88+
return VECC::CC_ILE;
89+
case ISD::SETUGT:
90+
return VECC::CC_IG;
91+
case ISD::SETUGE:
92+
return VECC::CC_IGE;
93+
}
94+
}
95+
96+
/// Convert a DAG floating point condition code to a VE FCC condition.
97+
inline static VECC::CondCode fpCondCode2Fcc(ISD::CondCode CC) {
98+
switch (CC) {
99+
default:
100+
llvm_unreachable("Unknown fp condition code!");
101+
case ISD::SETFALSE:
102+
return VECC::CC_AF;
103+
case ISD::SETEQ:
104+
case ISD::SETOEQ:
105+
return VECC::CC_EQ;
106+
case ISD::SETNE:
107+
case ISD::SETONE:
108+
return VECC::CC_NE;
109+
case ISD::SETLT:
110+
case ISD::SETOLT:
111+
return VECC::CC_L;
112+
case ISD::SETGT:
113+
case ISD::SETOGT:
114+
return VECC::CC_G;
115+
case ISD::SETLE:
116+
case ISD::SETOLE:
117+
return VECC::CC_LE;
118+
case ISD::SETGE:
119+
case ISD::SETOGE:
120+
return VECC::CC_GE;
121+
case ISD::SETO:
122+
return VECC::CC_NUM;
123+
case ISD::SETUO:
124+
return VECC::CC_NAN;
125+
case ISD::SETUEQ:
126+
return VECC::CC_EQNAN;
127+
case ISD::SETUNE:
128+
return VECC::CC_NENAN;
129+
case ISD::SETULT:
130+
return VECC::CC_LNAN;
131+
case ISD::SETUGT:
132+
return VECC::CC_GNAN;
133+
case ISD::SETULE:
134+
return VECC::CC_LENAN;
135+
case ISD::SETUGE:
136+
return VECC::CC_GENAN;
137+
case ISD::SETTRUE:
138+
return VECC::CC_AT;
139+
}
140+
}
141+
142+
/// getImmVal - get immediate representation of integer value
143+
inline static uint64_t getImmVal(const ConstantSDNode *N) {
144+
return N->getSExtValue();
145+
}
146+
147+
/// getFpImmVal - get immediate representation of floating point value
148+
inline static uint64_t getFpImmVal(const ConstantFPSDNode *N) {
149+
const APInt &Imm = N->getValueAPF().bitcastToAPInt();
150+
uint64_t Val = Imm.getZExtValue();
151+
if (Imm.getBitWidth() == 32) {
152+
// Immediate value of float place places at higher bits on VE.
153+
Val <<= 32;
154+
}
155+
return Val;
156+
}
157+
68158
class VECustomDAG;
69159

70160
class VETargetLowering : public TargetLowering {

0 commit comments

Comments
 (0)