llvm-project/llvm/lib/CodeGen/LibcallLoweringInfo.cpp
Matt Arsenault 1c5b1501ca
CodeGen: Move libcall lowering configuration to subtarget (#168621)
Previously libcall lowering decisions were made directly
in the TargetLowering constructor. Pull these into the subtarget
to facilitate turning LibcallLoweringInfo into a separate analysis
in the future.
2025-11-25 11:59:56 -05:00

31 lines
1.1 KiB
C++

//===- LibcallLoweringInfo.cpp - Interface for runtime libcalls -----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/LibcallLoweringInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
using namespace llvm;
LibcallLoweringInfo::LibcallLoweringInfo(
const RTLIB::RuntimeLibcallsInfo &RTLCI,
const TargetSubtargetInfo &Subtarget)
: RTLCI(RTLCI) {
// TODO: This should be generated with lowering predicates, and assert the
// call is available.
for (RTLIB::LibcallImpl Impl : RTLIB::libcall_impls()) {
if (RTLCI.isAvailable(Impl)) {
RTLIB::Libcall LC = RTLIB::RuntimeLibcallsInfo::getLibcallFromImpl(Impl);
// FIXME: Hack, assume the first available libcall wins.
if (LibcallImpls[LC] == RTLIB::Unsupported)
LibcallImpls[LC] = Impl;
}
}
Subtarget.initLibcallLoweringInfo(*this);
}