Skip to content

Commit 262364d

Browse files
committed
AArch64: Partially move setting of libcall names out of TargetLowering
Move the parts that aren't dependent on the subtarget into RuntimeLibcallInfo, which should contain the superset of all possible runtime calls and be accurate outside of codegen.
1 parent 3846d84 commit 262364d

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ static cl::opt<bool>
1616
HexagonEnableFastMathRuntimeCalls("hexagon-fast-math", cl::Hidden,
1717
cl::desc("Enable Fast Math processing"));
1818

19+
static void setAArch64LibcallNames(RuntimeLibcallsInfo &Info,
20+
const Triple &TT) {
21+
if (TT.isWindowsArm64EC()) {
22+
// FIXME: are there calls we need to exclude from this?
23+
#define HANDLE_LIBCALL(code, name) \
24+
{ \
25+
const char *libcallName = Info.getLibcallName(RTLIB::code); \
26+
if (libcallName && libcallName[0] != '#') \
27+
Info.setLibcallName(RTLIB::code, "#" #name); \
28+
}
29+
#include "llvm/IR/RuntimeLibcalls.def"
30+
#undef HANDLE_LIBCALL
31+
}
32+
}
33+
1934
/// Set default libcall names. If a target wants to opt-out of a libcall it
2035
/// should be placed here.
2136
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
@@ -247,6 +262,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
247262
}
248263
}
249264

265+
if (TT.getArch() == Triple::ArchType::aarch64)
266+
setAArch64LibcallNames(*this, TT);
267+
250268
if (TT.getArch() == Triple::ArchType::avr) {
251269
// Division rtlib functions (not supported), use divmod functions instead
252270
setLibcallName(RTLIB::SDIV_I8, nullptr);

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,18 +1986,6 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
19861986
for (ISD::NodeType Op : {ISD::FLDEXP, ISD::STRICT_FLDEXP, ISD::FFREXP})
19871987
if (isOperationExpand(Op, MVT::f16))
19881988
setOperationAction(Op, MVT::f16, Promote);
1989-
1990-
if (Subtarget->isWindowsArm64EC()) {
1991-
// FIXME: are there calls we need to exclude from this?
1992-
#define HANDLE_LIBCALL(code, name) \
1993-
{ \
1994-
const char *libcallName = getLibcallName(RTLIB::code); \
1995-
if (libcallName && libcallName[0] != '#') \
1996-
setLibcallName(RTLIB::code, "#" #name); \
1997-
}
1998-
#include "llvm/IR/RuntimeLibcalls.def"
1999-
#undef HANDLE_LIBCALL
2000-
}
20011989
}
20021990

20031991
void AArch64TargetLowering::addTypeForNEON(MVT VT) {

0 commit comments

Comments
 (0)