Skip to content

Commit 4ef459c

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 de3a9ea commit 4ef459c

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
@@ -11,6 +11,21 @@
1111
using namespace llvm;
1212
using namespace RTLIB;
1313

14+
static void setAArch64LibcallNames(RuntimeLibcallsInfo &Info,
15+
const Triple &TT) {
16+
if (TT.isWindowsArm64EC()) {
17+
// FIXME: are there calls we need to exclude from this?
18+
#define HANDLE_LIBCALL(code, name) \
19+
{ \
20+
const char *libcallName = Info.getLibcallName(RTLIB::code); \
21+
if (libcallName && libcallName[0] != '#') \
22+
Info.setLibcallName(RTLIB::code, "#" #name); \
23+
}
24+
#include "llvm/IR/RuntimeLibcalls.def"
25+
#undef HANDLE_LIBCALL
26+
}
27+
}
28+
1429
/// Set default libcall names. If a target wants to opt-out of a libcall it
1530
/// should be placed here.
1631
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
@@ -249,6 +264,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
249264
}
250265
}
251266

267+
if (TT.getArch() == Triple::ArchType::aarch64)
268+
setAArch64LibcallNames(*this, TT);
269+
252270
if (TT.getArch() == Triple::ArchType::avr) {
253271
// Division rtlib functions (not supported), use divmod functions instead
254272
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
@@ -1982,18 +1982,6 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
19821982
for (ISD::NodeType Op : {ISD::FLDEXP, ISD::STRICT_FLDEXP, ISD::FFREXP})
19831983
if (isOperationExpand(Op, MVT::f16))
19841984
setOperationAction(Op, MVT::f16, Promote);
1985-
1986-
if (Subtarget->isWindowsArm64EC()) {
1987-
// FIXME: are there calls we need to exclude from this?
1988-
#define HANDLE_LIBCALL(code, name) \
1989-
{ \
1990-
const char *libcallName = getLibcallName(RTLIB::code); \
1991-
if (libcallName && libcallName[0] != '#') \
1992-
setLibcallName(RTLIB::code, "#" #name); \
1993-
}
1994-
#include "llvm/IR/RuntimeLibcalls.def"
1995-
#undef HANDLE_LIBCALL
1996-
}
19971985
}
19981986

19991987
void AArch64TargetLowering::addTypeForNEON(MVT VT) {

0 commit comments

Comments
 (0)