llvm.org GIT mirror llvm / 5604263
TableGen: Update style in CodeGenIntrinsics. NFC Ran clang-format to remove the namespace indentation, and stopped repeating names in doc comments since I was updating every line anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274919 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 3 years ago
1 changed file(s) with 91 addition(s) and 98 deletion(s). Raw diff Collapse all Expand all
1818 #include
1919
2020 namespace llvm {
21 class Record;
22 class RecordKeeper;
23 class CodeGenTarget;
21 class Record;
22 class RecordKeeper;
23 class CodeGenTarget;
2424
25 struct CodeGenIntrinsic {
26 Record *TheDef; // The actual record defining this intrinsic.
27 std::string Name; // The name of the LLVM function "llvm.bswap.i32"
28 std::string EnumName; // The name of the enum "bswap_i32"
29 std::string GCCBuiltinName;// Name of the corresponding GCC builtin, or "".
30 std::string MSBuiltinName; // Name of the corresponding MS builtin, or "".
31 std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
25 struct CodeGenIntrinsic {
26 Record *TheDef; // The actual record defining this intrinsic.
27 std::string Name; // The name of the LLVM function "llvm.bswap.i32"
28 std::string EnumName; // The name of the enum "bswap_i32"
29 std::string GCCBuiltinName; // Name of the corresponding GCC builtin, or "".
30 std::string MSBuiltinName; // Name of the corresponding MS builtin, or "".
31 std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
3232
33 /// IntrinsicSignature - This structure holds the return values and
34 /// parameter values of an intrinsic. If the number of return values is > 1,
35 /// then the intrinsic implicitly returns a first-class aggregate. The
36 /// numbering of the types starts at 0 with the first return value and
37 /// continues from there through the parameter list. This is useful for
38 /// "matching" types.
39 struct IntrinsicSignature {
40 /// RetVTs - The MVT::SimpleValueType for each return type. Note that this
41 /// list is only populated when in the context of a target .td file. When
42 /// building Intrinsics.td, this isn't available, because we don't know
43 /// the target pointer size.
44 std::vector RetVTs;
33 /// This structure holds the return values and parameter values of an
34 /// intrinsic. If the number of return values is > 1, then the intrinsic
35 /// implicitly returns a first-class aggregate. The numbering of the types
36 /// starts at 0 with the first return value and continues from there through
37 /// the parameter list. This is useful for "matching" types.
38 struct IntrinsicSignature {
39 /// The MVT::SimpleValueType for each return type. Note that this list is
40 /// only populated when in the context of a target .td file. When building
41 /// Intrinsics.td, this isn't available, because we don't know the target
42 /// pointer size.
43 std::vector RetVTs;
4544
46 /// RetTypeDefs - The records for each return type.
47 std::vector RetTypeDefs;
45 /// The records for each return type.
46 std::vector RetTypeDefs;
4847
49 /// ParamVTs - The MVT::SimpleValueType for each parameter type. Note that
50 /// this list is only populated when in the context of a target .td file.
51 /// When building Intrinsics.td, this isn't available, because we don't
52 /// know the target pointer size.
53 std::vector ParamVTs;
48 /// The MVT::SimpleValueType for each parameter type. Note that this list is
49 /// only populated when in the context of a target .td file. When building
50 /// Intrinsics.td, this isn't available, because we don't know the target
51 /// pointer size.
52 std::vector ParamVTs;
5453
55 /// ParamTypeDefs - The records for each parameter type.
56 std::vector ParamTypeDefs;
57 };
58
59 IntrinsicSignature IS;
60
61 /// Bit flags describing the type (ref/mod) and location of memory
62 /// accesses that may be performed by the intrinsics. Analogous to
63 /// \c FunctionModRefBehaviour.
64 enum ModRefBits {
65 /// The intrinsic may access memory anywhere, i.e. it is not restricted
66 /// to access through pointer arguments.
67 MR_Anywhere = 1,
68
69 /// The intrinsic may read memory.
70 MR_Ref = 2,
71
72 /// The intrinsic may write memory.
73 MR_Mod = 4,
74
75 /// The intrinsic may both read and write memory.
76 MR_ModRef = MR_Ref | MR_Mod,
77 };
78
79 /// Memory mod/ref behavior of this intrinsic, corresponding to
80 /// intrinsic properties (IntrReadMem, IntrArgMemOnly, etc.).
81 enum ModRefBehavior {
82 NoMem = 0,
83 ReadArgMem = MR_Ref,
84 ReadMem = MR_Ref | MR_Anywhere,
85 WriteArgMem = MR_Mod,
86 WriteMem = MR_Mod | MR_Anywhere,
87 ReadWriteArgMem = MR_ModRef,
88 ReadWriteMem = MR_ModRef | MR_Anywhere,
89 };
90 ModRefBehavior ModRef;
91
92 /// This is set to true if the intrinsic is overloaded by its argument
93 /// types.
94 bool isOverloaded;
95
96 /// isCommutative - True if the intrinsic is commutative.
97 bool isCommutative;
98
99 /// canThrow - True if the intrinsic can throw.
100 bool canThrow;
101
102 /// isNoDuplicate - True if the intrinsic is marked as noduplicate.
103 bool isNoDuplicate;
104
105 /// isNoReturn - True if the intrinsic is no-return.
106 bool isNoReturn;
107
108 /// isConvergent - True if the intrinsic is marked as convergent.
109 bool isConvergent;
110
111 enum ArgAttribute {
112 NoCapture,
113 ReadOnly,
114 WriteOnly,
115 ReadNone
116 };
117 std::vector > ArgumentAttributes;
118
119 CodeGenIntrinsic(Record *R);
54 /// The records for each parameter type.
55 std::vector ParamTypeDefs;
12056 };
12157
122 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
123 /// .td file.
124 std::vector LoadIntrinsics(const RecordKeeper &RC,
125 bool TargetOnly);
58 IntrinsicSignature IS;
59
60 /// Bit flags describing the type (ref/mod) and location of memory
61 /// accesses that may be performed by the intrinsics. Analogous to
62 /// \c FunctionModRefBehaviour.
63 enum ModRefBits {
64 /// The intrinsic may access memory anywhere, i.e. it is not restricted
65 /// to access through pointer arguments.
66 MR_Anywhere = 1,
67
68 /// The intrinsic may read memory.
69 MR_Ref = 2,
70
71 /// The intrinsic may write memory.
72 MR_Mod = 4,
73
74 /// The intrinsic may both read and write memory.
75 MR_ModRef = MR_Ref | MR_Mod,
76 };
77
78 /// Memory mod/ref behavior of this intrinsic, corresponding to intrinsic
79 /// properties (IntrReadMem, IntrArgMemOnly, etc.).
80 enum ModRefBehavior {
81 NoMem = 0,
82 ReadArgMem = MR_Ref,
83 ReadMem = MR_Ref | MR_Anywhere,
84 WriteArgMem = MR_Mod,
85 WriteMem = MR_Mod | MR_Anywhere,
86 ReadWriteArgMem = MR_ModRef,
87 ReadWriteMem = MR_ModRef | MR_Anywhere,
88 };
89 ModRefBehavior ModRef;
90
91 /// This is set to true if the intrinsic is overloaded by its argument
92 /// types.
93 bool isOverloaded;
94
95 /// True if the intrinsic is commutative.
96 bool isCommutative;
97
98 /// True if the intrinsic can throw.
99 bool canThrow;
100
101 /// True if the intrinsic is marked as noduplicate.
102 bool isNoDuplicate;
103
104 /// True if the intrinsic is no-return.
105 bool isNoReturn;
106
107 /// True if the intrinsic is marked as convergent.
108 bool isConvergent;
109
110 enum ArgAttribute { NoCapture, ReadOnly, WriteOnly, ReadNone };
111 std::vector> ArgumentAttributes;
112
113 CodeGenIntrinsic(Record *R);
114 };
115
116 /// Read all of the intrinsics defined in the specified .td file.
117 std::vector LoadIntrinsics(const RecordKeeper &RC,
118 bool TargetOnly);
126119 }
127120
128121 #endif