Introduce a new class for the TargetLowering usage. This tracks the subtarget specific lowering decisions for which libcall to use. RuntimeLibcallsInfo is a module level property, which may have multiple implementations of a particular libcall available. This attempts to be a minimum boilerplate patch to introduce the new concept. In the future we should have a tablegen way of selecting which implementations should be used for a subtarget. Currently we do have some conflicting implementations added, it just happens to work out that the default cases to prefer is alphabetically first (plus some of these still are using manual overrides in TargetLowering constructors).
27 lines
981 B
C++
27 lines
981 B
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"
|
|
|
|
using namespace llvm;
|
|
|
|
LibcallLoweringInfo::LibcallLoweringInfo(
|
|
const RTLIB::RuntimeLibcallsInfo &RTLCI)
|
|
: 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;
|
|
}
|
|
}
|
|
}
|