annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
1 //===- ARMLegalizerInfo ------------------------------------------*- C++ -*-==//
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
2 //
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
4 //
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
7 //
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
9 /// \file
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
10 /// This file declares the targeting of the Machinelegalizer class for ARM.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
11 /// \todo This should be generated by TableGen.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
12 //===----------------------------------------------------------------------===//
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
13
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
14 #ifndef LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
15 #define LLVM_LIB_TARGET_ARM_ARMMACHINELEGALIZER_H
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
16
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
17 #include "llvm/ADT/IndexedMap.h"
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
18 #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
19 #include "llvm/CodeGen/RuntimeLibcalls.h"
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
20 #include "llvm/IR/Instructions.h"
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
21
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
22 namespace llvm {
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
23
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
24 class ARMSubtarget;
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
25
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
26 /// This class provides the information for the target register banks.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
27 class ARMLegalizerInfo : public LegalizerInfo {
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
28 public:
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
29 ARMLegalizerInfo(const ARMSubtarget &ST);
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
30
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
31 bool legalizeCustom(MachineInstr &MI, MachineRegisterInfo &MRI,
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
32 MachineIRBuilder &MIRBuilder) const override;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
33
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
34 private:
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
35 void setFCmpLibcallsGNU();
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
36 void setFCmpLibcallsAEABI();
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
37
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
38 struct FCmpLibcallInfo {
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
39 // Which libcall this is.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
40 RTLIB::Libcall LibcallID;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
41
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
42 // The predicate to be used when comparing the value returned by the
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
43 // function with a relevant constant (currently hard-coded to zero). This is
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
44 // necessary because often the libcall will return e.g. a value greater than
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
45 // 0 to represent 'true' and anything negative to represent 'false', or
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
46 // maybe 0 to represent 'true' and non-zero for 'false'. If no comparison is
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
47 // needed, this should be CmpInst::BAD_ICMP_PREDICATE.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
48 CmpInst::Predicate Predicate;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
49 };
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
50 using FCmpLibcallsList = SmallVector<FCmpLibcallInfo, 2>;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
51
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
52 // Map from each FCmp predicate to the corresponding libcall infos. A FCmp
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
53 // instruction may be lowered to one or two libcalls, which is why we need a
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
54 // list. If two libcalls are needed, their results will be OR'ed.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
55 using FCmpLibcallsMapTy = IndexedMap<FCmpLibcallsList>;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
56
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
57 FCmpLibcallsMapTy FCmp32Libcalls;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
58 FCmpLibcallsMapTy FCmp64Libcalls;
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
59
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
60 // Get the libcall(s) corresponding to \p Predicate for operands of \p Size
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
61 // bits.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
62 FCmpLibcallsList getFCmpLibcalls(CmpInst::Predicate, unsigned Size) const;
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
63 };
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
64 } // End llvm namespace.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
65 #endif