31 lines · cpp
1//===- LibcallLoweringInfo.cpp - Interface for runtime libcalls -----------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "llvm/CodeGen/LibcallLoweringInfo.h"10#include "llvm/CodeGen/TargetSubtargetInfo.h"11 12using namespace llvm;13 14LibcallLoweringInfo::LibcallLoweringInfo(15 const RTLIB::RuntimeLibcallsInfo &RTLCI,16 const TargetSubtargetInfo &Subtarget)17 : RTLCI(RTLCI) {18 // TODO: This should be generated with lowering predicates, and assert the19 // call is available.20 for (RTLIB::LibcallImpl Impl : RTLIB::libcall_impls()) {21 if (RTLCI.isAvailable(Impl)) {22 RTLIB::Libcall LC = RTLIB::RuntimeLibcallsInfo::getLibcallFromImpl(Impl);23 // FIXME: Hack, assume the first available libcall wins.24 if (LibcallImpls[LC] == RTLIB::Unsupported)25 LibcallImpls[LC] = Impl;26 }27 }28 29 Subtarget.initLibcallLoweringInfo(*this);30}31