Skip to content

AArch64: Partially move setting of libcall names out of TargetLowering #142985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions llvm/lib/IR/RuntimeLibcalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ static cl::opt<bool>
HexagonEnableFastMathRuntimeCalls("hexagon-fast-math", cl::Hidden,
cl::desc("Enable Fast Math processing"));

static void setAArch64LibcallNames(RuntimeLibcallsInfo &Info,
const Triple &TT) {
if (TT.isWindowsArm64EC()) {
// FIXME: are there calls we need to exclude from this?
#define HANDLE_LIBCALL(code, name) \
{ \
const char *libcallName = Info.getLibcallName(RTLIB::code); \
if (libcallName && libcallName[0] != '#') \
Info.setLibcallName(RTLIB::code, "#" #name); \
}
#include "llvm/IR/RuntimeLibcalls.def"
#undef HANDLE_LIBCALL
}
}

/// Set default libcall names. If a target wants to opt-out of a libcall it
/// should be placed here.
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
Expand Down Expand Up @@ -247,6 +262,9 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
}
}

if (TT.getArch() == Triple::ArchType::aarch64)
setAArch64LibcallNames(*this, TT);

if (TT.getArch() == Triple::ArchType::avr) {
// Division rtlib functions (not supported), use divmod functions instead
setLibcallName(RTLIB::SDIV_I8, nullptr);
Expand Down
12 changes: 0 additions & 12 deletions llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1986,18 +1986,6 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
for (ISD::NodeType Op : {ISD::FLDEXP, ISD::STRICT_FLDEXP, ISD::FFREXP})
if (isOperationExpand(Op, MVT::f16))
setOperationAction(Op, MVT::f16, Promote);

if (Subtarget->isWindowsArm64EC()) {
// FIXME: are there calls we need to exclude from this?
#define HANDLE_LIBCALL(code, name) \
{ \
const char *libcallName = getLibcallName(RTLIB::code); \
if (libcallName && libcallName[0] != '#') \
setLibcallName(RTLIB::code, "#" #name); \
}
#include "llvm/IR/RuntimeLibcalls.def"
#undef HANDLE_LIBCALL
}
}

void AArch64TargetLowering::addTypeForNEON(MVT VT) {
Expand Down