Skip to content

Commit 9f72e3f

Browse files
committed
[Lanai] Fix MC CodeGen layering, NFC
See issue #64166 for more information about the layering issue.
1 parent cda23c0 commit 9f72e3f

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

llvm/lib/Target/Lanai/LanaiAluCode.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define LLVM_LIB_TARGET_LANAI_LANAIALUCODE_H
1515

1616
#include "llvm/ADT/StringSwitch.h"
17-
#include "llvm/CodeGen/ISDOpcodes.h"
1817
#include "llvm/Support/ErrorHandling.h"
1918

2019
namespace llvm {
@@ -114,33 +113,6 @@ inline static AluCode stringToLanaiAluCode(StringRef S) {
114113
.Case("sha", SRA)
115114
.Default(UNKNOWN);
116115
}
117-
118-
inline static AluCode isdToLanaiAluCode(ISD::NodeType Node_type) {
119-
switch (Node_type) {
120-
case ISD::ADD:
121-
return AluCode::ADD;
122-
case ISD::ADDE:
123-
return AluCode::ADDC;
124-
case ISD::SUB:
125-
return AluCode::SUB;
126-
case ISD::SUBE:
127-
return AluCode::SUBB;
128-
case ISD::AND:
129-
return AluCode::AND;
130-
case ISD::OR:
131-
return AluCode::OR;
132-
case ISD::XOR:
133-
return AluCode::XOR;
134-
case ISD::SHL:
135-
return AluCode::SHL;
136-
case ISD::SRL:
137-
return AluCode::SRL;
138-
case ISD::SRA:
139-
return AluCode::SRA;
140-
default:
141-
return AluCode::UNKNOWN;
142-
}
143-
}
144116
} // namespace LPAC
145117
} // namespace llvm
146118

llvm/lib/Target/Lanai/LanaiISelDAGToDAG.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,37 @@ bool LanaiDAGToDAGISel::selectAddrSpls(SDValue Addr, SDValue &Base,
212212
return selectAddrRiSpls(Addr, Base, Offset, AluOp, /*RiMode=*/false);
213213
}
214214

215+
namespace llvm {
216+
namespace LPAC {
217+
static AluCode isdToLanaiAluCode(ISD::NodeType Node_type) {
218+
switch (Node_type) {
219+
case ISD::ADD:
220+
return AluCode::ADD;
221+
case ISD::ADDE:
222+
return AluCode::ADDC;
223+
case ISD::SUB:
224+
return AluCode::SUB;
225+
case ISD::SUBE:
226+
return AluCode::SUBB;
227+
case ISD::AND:
228+
return AluCode::AND;
229+
case ISD::OR:
230+
return AluCode::OR;
231+
case ISD::XOR:
232+
return AluCode::XOR;
233+
case ISD::SHL:
234+
return AluCode::SHL;
235+
case ISD::SRL:
236+
return AluCode::SRL;
237+
case ISD::SRA:
238+
return AluCode::SRA;
239+
default:
240+
return AluCode::UNKNOWN;
241+
}
242+
}
243+
} // namespace LPAC
244+
} // namespace llvm
245+
215246
bool LanaiDAGToDAGISel::selectAddrRr(SDValue Addr, SDValue &R1, SDValue &R2,
216247
SDValue &AluOp) {
217248
// if Address is FI, get the TargetFrameIndex.

0 commit comments

Comments
 (0)