comparison lib/Target/ARM/ARMLegalizerInfo.h @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents 1172e4bd9c6f
children c2174574ed3a
comparison
equal deleted inserted replaced
120:1172e4bd9c6f 121:803732b1fca8
12 //===----------------------------------------------------------------------===// 12 //===----------------------------------------------------------------------===//
13 13
14 #ifndef LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H 14 #ifndef LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H
15 #define LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H 15 #define LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H
16 16
17 #include "llvm/ADT/IndexedMap.h"
17 #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h" 18 #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
19 #include "llvm/CodeGen/RuntimeLibcalls.h"
20 #include "llvm/IR/Instructions.h"
18 21
19 namespace llvm { 22 namespace llvm {
20 23
21 class LLVMContext; 24 class ARMSubtarget;
22 25
23 /// This class provides the information for the target register banks. 26 /// This class provides the information for the target register banks.
24 class ARMLegalizerInfo : public LegalizerInfo { 27 class ARMLegalizerInfo : public LegalizerInfo {
25 public: 28 public:
26 ARMLegalizerInfo(); 29 ARMLegalizerInfo(const ARMSubtarget &ST);
30
31 bool legalizeCustom(MachineInstr &MI, MachineRegisterInfo &MRI,
32 MachineIRBuilder &MIRBuilder) const override;
33
34 private:
35 void setFCmpLibcallsGNU();
36 void setFCmpLibcallsAEABI();
37
38 struct FCmpLibcallInfo {
39 // Which libcall this is.
40 RTLIB::Libcall LibcallID;
41
42 // The predicate to be used when comparing the value returned by the
43 // function with a relevant constant (currently hard-coded to zero). This is
44 // necessary because often the libcall will return e.g. a value greater than
45 // 0 to represent 'true' and anything negative to represent 'false', or
46 // maybe 0 to represent 'true' and non-zero for 'false'. If no comparison is
47 // needed, this should be CmpInst::BAD_ICMP_PREDICATE.
48 CmpInst::Predicate Predicate;
49 };
50 using FCmpLibcallsList = SmallVector<FCmpLibcallInfo, 2>;
51
52 // Map from each FCmp predicate to the corresponding libcall infos. A FCmp
53 // instruction may be lowered to one or two libcalls, which is why we need a
54 // list. If two libcalls are needed, their results will be OR'ed.
55 using FCmpLibcallsMapTy = IndexedMap<FCmpLibcallsList>;
56
57 FCmpLibcallsMapTy FCmp32Libcalls;
58 FCmpLibcallsMapTy FCmp64Libcalls;
59
60 // Get the libcall(s) corresponding to \p Predicate for operands of \p Size
61 // bits.
62 FCmpLibcallsList getFCmpLibcalls(CmpInst::Predicate, unsigned Size) const;
27 }; 63 };
28 } // End llvm namespace. 64 } // End llvm namespace.
29 #endif 65 #endif