Skip to content

Commit 9bf02a8

Browse files
authored
[LLVM][TableGen] Tighten intrinsic properties index type (#110733)
For intrinsic properties that are applicable only to arguments, require use of class `ArgIndex` for specifying the index. For properties that are applicable to either arguments or return value, use `AttrIndex`.
1 parent 5a40bc2 commit 9bf02a8

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,67 +64,73 @@ def Throws : IntrinsicProperty;
6464
class AttrIndex<int idx> {
6565
int Value = idx;
6666
}
67-
def FuncIndex : AttrIndex<-1>;
6867
def RetIndex : AttrIndex<0>;
6968
class ArgIndex<int argNo> : AttrIndex<!add(argNo, 1)>;
7069

70+
// Note: Properties that are applicable either to arguments or return values
71+
// use AttrIndex. Properties applicable only to arguments use ArgIndex. Please
72+
// refer to Attributes.td.
73+
7174
// NoCapture - The specified argument pointer is not captured by the intrinsic.
72-
class NoCapture<AttrIndex idx> : IntrinsicProperty {
75+
class NoCapture<ArgIndex idx> : IntrinsicProperty {
7376
int ArgNo = idx.Value;
7477
}
7578

76-
// NoAlias - The specified argument pointer is not aliasing other "noalias" pointer
77-
// arguments of the intrinsic wrt. the intrinsic scope.
79+
// NoAlias - The return value or the specified argument pointer is not aliasing
80+
// other "noalias" pointer arguments of the intrinsic wrt. the intrinsic scope.
7881
class NoAlias<AttrIndex idx> : IntrinsicProperty {
7982
int ArgNo = idx.Value;
8083
}
8184

82-
// NoUndef - The specified argument is neither undef nor poison.
85+
// NoUndef - The return value or specified argument is neither undef nor poison.
8386
class NoUndef<AttrIndex idx> : IntrinsicProperty {
8487
int ArgNo = idx.Value;
8588
}
8689

87-
// NonNull - The specified argument is not null.
90+
// NonNull - The return value or specified argument is not null.
8891
class NonNull<AttrIndex idx> : IntrinsicProperty {
8992
int ArgNo = idx.Value;
9093
}
9194

95+
// Align - Alignment for return value or the specified argument.
9296
class Align<AttrIndex idx, int align> : IntrinsicProperty {
9397
int ArgNo = idx.Value;
9498
int Align = align;
9599
}
96100

101+
// Dereferenceable -- Return value or the specified argument is dereferenceable
102+
// upto `bytes` bytes in size.
97103
class Dereferenceable<AttrIndex idx, int bytes> : IntrinsicProperty {
98104
int ArgNo = idx.Value;
99105
int Bytes = bytes;
100106
}
101107

102108
// Returned - The specified argument is always the return value of the
103109
// intrinsic.
104-
class Returned<AttrIndex idx> : IntrinsicProperty {
110+
class Returned<ArgIndex idx> : IntrinsicProperty {
105111
int ArgNo = idx.Value;
106112
}
107113

108114
// ImmArg - The specified argument must be an immediate.
109-
class ImmArg<AttrIndex idx> : IntrinsicProperty {
115+
class ImmArg<ArgIndex idx> : IntrinsicProperty {
110116
int ArgNo = idx.Value;
111117
}
112118

113119
// ReadOnly - The specified argument pointer is not written to through the
114120
// pointer by the intrinsic.
115-
class ReadOnly<AttrIndex idx> : IntrinsicProperty {
121+
class ReadOnly<ArgIndex idx> : IntrinsicProperty {
116122
int ArgNo = idx.Value;
117123
}
118124

119125
// WriteOnly - The intrinsic does not read memory through the specified
120126
// argument pointer.
121-
class WriteOnly<AttrIndex idx> : IntrinsicProperty {
127+
class WriteOnly<ArgIndex idx> : IntrinsicProperty {
122128
int ArgNo = idx.Value;
123129
}
124130

125131
// ReadNone - The specified argument pointer is not dereferenced by the
126132
// intrinsic.
127-
class ReadNone<AttrIndex idx> : IntrinsicProperty {
133+
class ReadNone<ArgIndex idx> : IntrinsicProperty {
128134
int ArgNo = idx.Value;
129135
}
130136

0 commit comments

Comments
 (0)