Skip to content

Commit 08249e3

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 8cd5604 commit 08249e3

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@
1111
using namespace llvm;
1212
using namespace RTLIB;
1313

14+
static cl::opt<bool>
15+
HexagonEnableFastMathRuntimeCalls("hexagon-fast-math", cl::Hidden,
16+
cl::desc("Enable Fast Math processing"));
17+
18+
static void setAArch64LibcallNames(RuntimeLibcallsInfo &Info,
19+
const Triple &TT) {
20+
if (TT.isWindowsArm64EC()) {
21+
// FIXME: are there calls we need to exclude from this?
22+
#define HANDLE_LIBCALL(code, name) \
23+
{ \
24+
const char *libcallName = Info.getLibcallName(RTLIB::code); \
25+
if (libcallName && libcallName[0] != '#') \
26+
Info.setLibcallName(RTLIB::code, "#" #name); \
27+
}
28+
#include "llvm/IR/RuntimeLibcalls.def"
29+
#undef HANDLE_LIBCALL
30+
}
31+
}
32+
1433
/// Set default libcall names. If a target wants to opt-out of a libcall it
1534
/// should be placed here.
1635
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
@@ -249,6 +268,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
249268
}
250269
}
251270

271+
if (TT.getArch() == Triple::ArchType::aarch64)
272+
setAArch64LibcallNames(*this, TT);
273+
252274
if (TT.getArch() == Triple::ArchType::avr) {
253275
// Division rtlib functions (not supported), use divmod functions instead
254276
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)