brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · f7edf0b Raw
67 lines · c
1//===- ARMLegalizerInfo ------------------------------------------*- C++ -*-==//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/// \file9/// This file declares the targeting of the Machinelegalizer class for ARM.10/// \todo This should be generated by TableGen.11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H14#define LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H15 16#include "llvm/ADT/IndexedMap.h"17#include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"18#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"19#include "llvm/CodeGen/RuntimeLibcallUtil.h"20#include "llvm/IR/Instructions.h"21 22namespace llvm {23 24class ARMSubtarget;25 26class ARMLegalizerInfo : public LegalizerInfo {27public:28  ARMLegalizerInfo(const ARMSubtarget &ST);29 30  bool legalizeCustom(LegalizerHelper &Helper, MachineInstr &MI,31                      LostDebugLocObserver &LocObserver) const override;32 33private:34  void setFCmpLibcallsGNU();35  void setFCmpLibcallsAEABI();36 37  struct FCmpLibcallInfo {38    // Which libcall this is.39    RTLIB::Libcall LibcallID;40 41    // The predicate to be used when comparing the value returned by the42    // function with a relevant constant (currently hard-coded to zero). This is43    // necessary because often the libcall will return e.g. a value greater than44    // 0 to represent 'true' and anything negative to represent 'false', or45    // maybe 0 to represent 'true' and non-zero for 'false'. If no comparison is46    // needed, this should be CmpInst::BAD_ICMP_PREDICATE.47    CmpInst::Predicate Predicate;48  };49  using FCmpLibcallsList = SmallVector<FCmpLibcallInfo, 2>;50 51  // Map from each FCmp predicate to the corresponding libcall infos. A FCmp52  // instruction may be lowered to one or two libcalls, which is why we need a53  // list. If two libcalls are needed, their results will be OR'ed.54  using FCmpLibcallsMapTy = IndexedMap<FCmpLibcallsList>;55 56  FCmpLibcallsMapTy FCmp32Libcalls;57  FCmpLibcallsMapTy FCmp64Libcalls;58 59  // Get the libcall(s) corresponding to \p Predicate for operands of \p Size60  // bits.61  FCmpLibcallsList getFCmpLibcalls(CmpInst::Predicate, unsigned Size) const;62 63  const ARMSubtarget &ST;64};65} // End llvm namespace.66#endif67