@@ -150,45 +150,56 @@ isintrinsic(f::Function) = API.LLVMGetIntrinsicID(ref(f)) != 0
150
150
struct Intrinsic
151
151
id:: UInt32
152
152
153
- function Intrinsic (name:: String )
154
- new (API. LLVMLookupIntrinsicID (name, length (name)))
155
- end
156
-
157
153
function Intrinsic (f:: Function )
158
154
id = API. LLVMGetIntrinsicID (ref (f))
159
155
id == 0 && throw (ArgumentError (" Function is not an intrinsic" ))
160
156
new (id)
161
157
end
158
+
159
+ function Intrinsic (name:: String )
160
+ @assert version () >= v " 9"
161
+ new (API. LLVMLookupIntrinsicID (name, length (name)))
162
+ end
162
163
end
163
164
164
165
Base. convert (:: Type{UInt32} , intr:: Intrinsic ) = intr. id
165
166
166
167
function name (intr:: Intrinsic )
168
+ @assert version () >= v " 8"
167
169
len = Ref {Csize_t} ()
168
170
str = API. LLVMIntrinsicGetName (intr, len)
169
171
unsafe_string (convert (Ptr{Cchar}, str), len[])
170
172
end
171
173
172
174
function name (intr:: Intrinsic , params:: Vector{<:LLVMType} )
175
+ @assert version () >= v " 8"
173
176
len = Ref {Csize_t} ()
174
177
str = API. LLVMIntrinsicCopyOverloadedName (intr, ref .(params), length (params), len)
175
178
unsafe_message (convert (Ptr{Cchar}, str), len[])
176
179
end
177
180
178
- function FunctionType (intr:: Intrinsic , params :: Vector{<:LLVMType} = LLVMType[];
179
- ctx :: Context = GlobalContext ())
180
- LLVMType (API . LLVMIntrinsicGetType ( ref (ctx), intr, ref .(params), length (params) ))
181
+ function isoverloaded (intr:: Intrinsic )
182
+ @assert version () >= v " 8 "
183
+ convert (Core . Bool, API . LLVMIntrinsicIsOverloaded (intr ))
181
184
end
182
185
183
186
function Function (mod:: Module , intr:: Intrinsic , params:: Vector{<:LLVMType} = LLVMType[])
187
+ @assert version () >= v " 8"
184
188
Value (API. LLVMGetIntrinsicDeclaration (ref (mod), intr, ref .(params), length (params)))
185
189
end
186
190
191
+ function FunctionType (intr:: Intrinsic , params:: Vector{<:LLVMType} = LLVMType[];
192
+ ctx:: Context = GlobalContext ())
193
+ @assert version () >= v " 8"
194
+ LLVMType (API. LLVMIntrinsicGetType (ref (ctx), intr, ref .(params), length (params)))
195
+ end
196
+
187
197
function Base. show (io:: IO , intr:: Intrinsic )
188
- print (io, " Intrinsic($(intr. id) ): \" $(name (intr)) \" " )
189
- if isoverloaded (intr)
190
- print (io, " (overloaded)" )
198
+ print (io, " Intrinsic($(intr. id) )" )
199
+ if version () >= v " 8"
200
+ print (io, " : \" $(name (intr)) \" " )
201
+ if isoverloaded (intr)
202
+ print (io, " (overloaded)" )
203
+ end
191
204
end
192
205
end
193
-
194
- isoverloaded (intr:: Intrinsic ) = convert (Core. Bool, API. LLVMIntrinsicIsOverloaded (intr))
0 commit comments