Path: blob/main/contrib/llvm-project/llvm/lib/Target/ARM/ARMLegalizerInfo.h
35267 views
//===- ARMLegalizerInfo ------------------------------------------*- C++ -*-==//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7/// \file8/// This file declares the targeting of the Machinelegalizer class for ARM.9/// \todo This should be generated by TableGen.10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H13#define LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H1415#include "llvm/ADT/IndexedMap.h"16#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"17#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"18#include "llvm/CodeGen/RuntimeLibcallUtil.h"19#include "llvm/IR/Instructions.h"2021namespace llvm {2223class ARMSubtarget;2425class ARMLegalizerInfo : public LegalizerInfo {26public:27ARMLegalizerInfo(const ARMSubtarget &ST);2829bool legalizeCustom(LegalizerHelper &Helper, MachineInstr &MI,30LostDebugLocObserver &LocObserver) const override;3132private:33void setFCmpLibcallsGNU();34void setFCmpLibcallsAEABI();3536struct FCmpLibcallInfo {37// Which libcall this is.38RTLIB::Libcall LibcallID;3940// The predicate to be used when comparing the value returned by the41// function with a relevant constant (currently hard-coded to zero). This is42// necessary because often the libcall will return e.g. a value greater than43// 0 to represent 'true' and anything negative to represent 'false', or44// maybe 0 to represent 'true' and non-zero for 'false'. If no comparison is45// needed, this should be CmpInst::BAD_ICMP_PREDICATE.46CmpInst::Predicate Predicate;47};48using FCmpLibcallsList = SmallVector<FCmpLibcallInfo, 2>;4950// Map from each FCmp predicate to the corresponding libcall infos. A FCmp51// instruction may be lowered to one or two libcalls, which is why we need a52// list. If two libcalls are needed, their results will be OR'ed.53using FCmpLibcallsMapTy = IndexedMap<FCmpLibcallsList>;5455FCmpLibcallsMapTy FCmp32Libcalls;56FCmpLibcallsMapTy FCmp64Libcalls;5758// Get the libcall(s) corresponding to \p Predicate for operands of \p Size59// bits.60FCmpLibcallsList getFCmpLibcalls(CmpInst::Predicate, unsigned Size) const;61};62} // End llvm namespace.63#endif646566